/[classpath]/inetlib/source/gnu/inet/imap/IMAPResponse.java
ViewVC logotype

Diff of /inetlib/source/gnu/inet/imap/IMAPResponse.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by dog, Thu Oct 21 15:21:55 2004 UTC revision 1.5 by dog, Thu Nov 25 22:15:05 2004 UTC
# Line 1  Line 1 
1  /*  /*
2   * $Id$   * IMAPResponse.java
3   * Copyright (C) 2003 The Free Software Foundation   * Copyright (C) 2003 The Free Software Foundation
4   *   *
5   * This file is part of GNU inetlib, a library.   * This file is part of GNU inetlib, a library.
# Line 44  import java.util.List; Line 44  import java.util.List;
44   * An IMAP4rev1 server response.   * An IMAP4rev1 server response.
45   *   *
46   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
  * @version $Revision$ $Date$  
47   */   */
48  public class IMAPResponse  public class IMAPResponse
49  {  {
# Line 52  public class IMAPResponse Line 51  public class IMAPResponse
51    /**    /**
52     * The untagged response tag.     * The untagged response tag.
53     */     */
54    public static final String UNTAGGED = "*".intern ();    public static final String UNTAGGED = "*";
55    
56    /**    /**
57     * The continuation response tag.     * The continuation response tag.
58     */     */
59    public static final String CONTINUATION = "+".intern ();    public static final String CONTINUATION = "+";
60    
61    /**    /**
62     * The tag for this response.     * The tag for this response.
# Line 89  public class IMAPResponse Line 88  public class IMAPResponse
88     */     */
89    protected String text;    protected String text;
90    
91    public String getTag ()    public String getTag()
92    {    {
93      return tag;      return tag;
94    }    }
95    
96    public boolean isTagged ()    public boolean isTagged()
97    {    {
98      return (tag != UNTAGGED && tag != CONTINUATION);      return (tag != UNTAGGED && tag != CONTINUATION);
99    }    }
100    
101    public boolean isUntagged ()    public boolean isUntagged()
102    {    {
103      return (tag == UNTAGGED);      return (tag == UNTAGGED);
104    }    }
105    
106    public boolean isContinuation ()    public boolean isContinuation()
107    {    {
108      return (tag == CONTINUATION);      return (tag == CONTINUATION);
109    }    }
110    
111    public String getID ()    public String getID()
112    {    {
113      return id;      return id;
114    }    }
115    
116    public int getCount ()    public int getCount()
117    {    {
118      return count;      return count;
119    }    }
120    
121    public List getResponseCode ()    public List getResponseCode()
122    {    {
123      return code;      return code;
124    }    }
125    
126    public String getText ()    public String getText()
127    {    {
128      return text;      return text;
129    }    }
# Line 132  public class IMAPResponse Line 131  public class IMAPResponse
131    /**    /**
132     * ANSI-coloured toString for debugging.     * ANSI-coloured toString for debugging.
133     */     */
134    public String toANSIString ()    public String toANSIString()
135    {    {
136      StringBuffer buffer = new StringBuffer ();      StringBuffer buffer = new StringBuffer();
137      buffer.append (tag);      buffer.append(tag);
138      if (count != -1)      if (count != -1)
139      {        {
140        buffer.append (" \u001b[00;31m");          buffer.append(" \u001b[00;31m");
141        buffer.append (count);          buffer.append(count);
142        buffer.append ("\u001b[00m");          buffer.append("\u001b[00m");
143      }        }
144      if (!isContinuation ())      if (!isContinuation())
145      {        {
146        buffer.append (" \u001b[01m");          buffer.append(" \u001b[01m");
147        buffer.append (id);          buffer.append(id);
148        buffer.append ("\u001b[00m");          buffer.append("\u001b[00m");
149      }        }
150      if (mailbox != null)      if (mailbox != null)
151      {        {
152        buffer.append (" \u001b[00;35m");          buffer.append(" \u001b[00;35m");
153        buffer.append (mailbox);          buffer.append(mailbox);
154        buffer.append ("\u001b[00m");          buffer.append("\u001b[00m");
155      }        }
156      if (code != null)      if (code != null)
157      {        {
158        buffer.append (" \u001b[00;36m");          buffer.append(" \u001b[00;36m");
159        buffer.append (code);          buffer.append(code);
160        buffer.append ("\u001b[00m");          buffer.append("\u001b[00m");
161      }        }
162      if (text != null)      if (text != null)
163      {        {
164        buffer.append (" \u001b[00;33m");          buffer.append(" \u001b[00;33m");
165        buffer.append (text);          buffer.append(text);
166        buffer.append ("\u001b[00m");          buffer.append("\u001b[00m");
167      }        }
168      return buffer.toString ();      return buffer.toString();
169    }    }
170    
171    public String toString ()    public String toString()
172    {    {
173      StringBuffer buffer = new StringBuffer ();      StringBuffer buffer = new StringBuffer();
174      buffer.append (tag);      buffer.append(tag);
175      if (count != -1)      if (count != -1)
176      {        {
177        buffer.append (' ');          buffer.append(' ');
178        buffer.append (count);          buffer.append(count);
179      }        }
180      if (!isContinuation ())      if (!isContinuation())
181      {        {
182        buffer.append (' ');          buffer.append(' ');
183        buffer.append (id);          buffer.append(id);
184      }        }
185      if (mailbox != null)      if (mailbox != null)
186      {        {
187        buffer.append (' ');          buffer.append(' ');
188        buffer.append (mailbox);          buffer.append(mailbox);
189      }        }
190      if (code != null)      if (code != null)
191      {        {
192        buffer.append (' ');          buffer.append(' ');
193        buffer.append (code);          buffer.append(code);
194      }        }
195      if (text != null)      if (text != null)
196      {        {
197        buffer.append (' ');          buffer.append(' ');
198        buffer.append (text);          buffer.append(text);
199      }        }
200      return buffer.toString ();      return buffer.toString();
201    }    }
202    
203  }  }
204    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26