Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/jabber/jabberbeans/PresenceBuilder.java


1   package org.jabber.jabberbeans;
2   
3   import org.jabber.jabberbeans.Extension.*;
4   
5   import java.lang.String;
6   import java.lang.InstantiationException;
7   import java.util.Vector;
8   import java.util.Enumeration;
9   
10  /**
11   * This class is an abstraction of presence packets - both incoming and 
12   * outgoing.
13   *
14   * Incoming presence packets are notifications on a resource - they are
15   * sent by the remote client's server when that client has a status change.
16   *
17   * Outgoing presence packets are of two types. You send out your presence by
18   * sending a packet to the server with your new status. The second type is a
19   * subscribe request, where you request a remote user add you to their
20   * presence notifications.
21   */
22  public class PresenceBuilder
23      extends PacketBuilder
24  {
25      //address we received from
26      private String status;
27      private int priority;
28      private String stateShow;
29      private Vector extensions;
30  
31      public PresenceBuilder()
32      {
33    reset();
34      }
35  
36      public void reset()
37      {
38    resetBase();
39    status=stateShow=null;
40    priority=-1;
41    extensions=new Vector();
42      }
43    
44      public String getStatus()
45      {
46    return status;
47      }
48      public void setStatus(String status)
49      {
50    this.status=status;
51      }
52  
53      public int getPriority()
54      {
55    return priority;
56      }
57      public void setPriority(int priority)
58      {
59    this.priority=priority;
60      }
61  
62      public String getStateShow()
63      {
64    return stateShow;
65      }
66      public void setStateShow(String state)
67      {
68    stateShow=state;
69      }
70      public void addExtension(PresenceExtension e)
71      {
72    extensions.addElement(e);
73      }
74      public void removeExtension(PresenceExtension e)
75      {
76    if (extensions.contains(e))
77        extensions.removeElement(e);
78      }
79      public Enumeration enumerateExtensions()
80      {
81    return extensions.elements();
82      }
83      
84      public Packet build()
85    throws java.lang.InstantiationException
86      {
87    return new Presence(this);
88      }
89  }