IJabberSession
This is the main interface that you should use to communicate to the Jabber server. This interface stores all of the configuration information and encapsulates all of the server communication and XML details.

Properties


Methods


CreateMsg: IJabberMsg
A Class Factory method that creates a new JabberMsg Object and returns an interface to that object.
CreateIQ: IJabberIQ
A Class Factory method that creates a new JabberIQ Object and returns an interface to that object.
CreateXMLTag: IXMLTag
A Class Factory method that creates a new XMLTag Object and returns an interface to that object.
GetNextID: string
This function will increment the internal ID counter and return a string for you to use in ID fields. These are generally in the form: "JCOM_" followed by a sequential number.
DoConnect(NewUser: boolean; AuthType: JabberAuthType)
This method will attempt to connect to the specified server, authenticate the user, and send our presence to the server. Newuser specifies whether or not you want to create a new user account on the specified server.
Possible Auth Types:
NOTE: NEW AUTH functionality as OF 11/1/2000:
JabberCOM will now attempt to authenticate based on the "supported" methods from the server. So you can use the new jatAuto auth type as default. JabberCOM will always query the server to find out which types of authentication are supported, then automatically select the "strongest" encryption method. JabberCOM also now supports the ZeroK (0k) method of authentication for 1.2 jabber servers. If the server is pre 1.2, it will send an error back when JabberCOM queries it for supported auth types. In this case, JabberCOM will fall back to the previous behavior and use the specified auth type, or use plain-text as a last resort.

There is also a new auth type jatNoAuth which will establish a connection to the server, but will not register the new user, OR send any authentication tokens. Use this auth-type in conjunction with the SendRegister and new OnRegFields event to handle "dynamic user registration". (see SendRegister for more info).

NOTE: NEW AUTH functionality as of Feb 28, 2002
IJabberSession now has a new property called CustomAuth. By setting this property, JabberCOM will not send out the iq-set which actually authenticates the user. Instead, it will fire the OnConnected event when this tag would normally be sent out.

At this point in the authentication procedure, the client application can use GetAuthTag to obtain a pre-populated version of the iq-set which would normally be sent to the server. Using this tag, the client application can add elements, or modify the tag in any way before using SendAuthTag to actually send to the jabber server which would then authenticate the user.

DoDisconnect(Immediate: boolean)
Disconnect from the server. Normal operation is Immediate=False, this sends a end stream packet to the server and the server is then responsible for closing the socket. If you send true, JabberCOM just closes the socket, and does all the normal cleanup without waiting for anything from the server. This is useful to send after socket/COMM errors.
SendRegister (IQ: IJabberIQ)
Send the new user registration query using the information passed in the IJabberIQ. Use this in conjunction with the OnRegFields event to handle "dynamic" form registration. This might be the case when using LDAP enabled servers, since the new user registration might require more information than "normally" used.
SendAuth(AuthType: JabberAuthType)
Use this method to manually send the authentication tokens to the server using the authentication method specified.
SendMessage(Msg: IJabberMsg)
Send a message to a specific user using the IJabberMsg interface.
SendIQ(IQ: IJabberIQ)
Send a JabberIQ back to the server.
SendPresence(JID: String; PresType: JabberPresenceType; Status: string; XTag: IXMLTag)
Send a presence [subscription] to someone.
SendMyPresence
Send your current presence info to the server. Note that also setting the Status or Available properties AUTOMATICALLY sends you new presence back to the server.
Browse(jid: string; QueryID: string; Refresh: Boolean)
This will send a browse query to the specified JID. Note that JabberCOM caches browse results. So if the results for this JID are already in the cache, no XML will be generated. The results and appropriate events will fire automatically.
If you send Refresh=true, this will force JabberCOM to refresh the cache if results already exist for this JID. Normally, you'd only do this under specific cases.

NOTE: Browsing will eventually replace the entire Agents interface. When working with 1.4 servers, you should be able to Browse the server JID (jabber.org) and receive all of the available services. 1.4 Servers still support the old agents list but this list is begin generated (built) based on the browse objects the server knows about.

GetPres(jid: String; resource: string; Primary: Boolean): IJabberPres
This method is used to fetch presence objects off of the Presence Database. To find if someone is online, use a blank resource, and fetch their primary resource. See below for details about the IJabberPres object. Successive calls to GetPres with the same jid, blank resource, and primary = false, will iterate through the presence database and provide you with all of the user's presence objects.
SendXML(txt: String)
send some raw text to the server.
SendXMLTag(tag: IXMLTag)
send a XML fragment to the server.
GetAuthTag: IXMLTag (NEW)
Get an interface which points to the iq-set tag which would normally be dispatched to authenticate the user.
SendAuthTag(tag: IXMLTag) (NEW)
Send the specified tag to the server, treating the tag as the authentication request.

Events


OnConnect
Fires after the server connection has been made and the username/pass correctly authenticated.
OnDisconnect
Fires when the connection is disconnected or is dropped.
OnAuthError(txt: string)
Fires when a problem occurs during authentication. Correct the username/pass and possibly the resource, and try Connect again. Txt will most likely contain an explaination of the error.The Error Code received from the server will be stored in the LastErrorCode variable.
OnCommError(txt: string)
General communication error. Check the text for more info. Could be a XML error or a communiction error.
OnQueryError(txt: string; FromJID: string; Tag: IXMLTag)
DEPRECATED EVENT! An error occured during a <iq> query. Txt should contain the error info returned from the server. The Error Code received from the server will be stored in the LastErrorCode variable. The Tag variable contains an interface to the entire XML tag received. NOTE:In JabberCOM 2.4+ you should start migrating to the "unified" OnQuery event to handle ALL iq packets. This will simplfy your code and allow you to handle things significantly better. This event still works, but (very, very) long term, will eventually be phased out.
OnRosterStart
Signals the start of roster processing. Expect 0, 1 or more OnRosterItem events after this event.
OnRosterItemEx(Item: IJabberRosterItem)
A new roster item has been received. This is ideally the place to display the item in some GUI, or deal with it internally. This event is not always preceded by a OnRosterStart event... "single" OnRosterItem events can occur when the server changes something in the roster item and sends it back to you (aka, a Roster Push).
OnRosterItemEx(Item: IJabberRosterItem; Tag: IXMLTag)
NOTE, Changed in 2.3 This is a new event which allows you to hook into the IXMLTag interface as well. Version 2.2 had this introduced as another param to the OnRosterItem event. This has been changed back to the original version to maintain backwards compatability.
OnRosterEnd
Main roster processing has finished.
OnAgentsStart
We have started to receive an agents listing.
OnAgentItem(Agent: IJabberAgentItem; iqID: string)
We received an agent. The interface to the agent is passed. The ID string passed is the ID from the iq tag. Use this to "direct" incoming events in your client.
OnAgentsEnd
Agents list has finished processing
OnMessage(Msg: IJabberMsg; Tag: IXMLTag)
A message has been received. Use the IJabberMsg interface to get the details of the message. The tag object passed is a IXMLTag object which contains all of the actual XML Elements in this tag. Use it for dealing with special 'x' tags are looking for something in the low level message data/text.
OnPresence(PresJID: string; Available: Boolean; InRoster: boolean; Tag: IXMLTag)
This event fires when we receive a presence item from the server. We get the JID, whether the user is available or not, and whether or not they are in our roster.
OnSubscriptionRequest(FromJID: string; SubType: string)
Someone is sending us _some_ kind of subscription request.. could be 'subscribe' or 'unsubscribe'.
OnSubscriptionApproved(FromJID: string)
A user granted our request to subscribe to their presence information. The server will automatically update our roster, and send us presence info for this user.
OnSubscriptionDenied(FromJID: string)
We requested to subscribe to someone's presence information and they said 'no'.
OnXML(Direction: int; txt: String)
This event occurs whenever xml is either sent to or recieved from the server over the socket connection. Direction = (0) means text is coming in from the server, while (1) means text is being sent from the client to the server. This event is essential for debugging and trouble- shooting.
OnJabberIQ(namespace; string; IQ: IJabberIQ)
DEPRECATED EVENT! This event fires whenever we recieve an 'iq' tag. The associated JabberIQ tag is passed along with the namespace for the query tag. Only "handled" namespaces will fire this event. This includes jabber:iq:register. NOTE:In JabberCOM 2.4+ this event is being deprecated. XML packets that would normally fire this event will still fire it, but will also fire the new OnQuery() event, as well as the OnUnhandledQuery event.
OnUnhandledQuery(Namespace: string; Tag: IXMLTag)
DEPRECATED EVENT! Any iq or query tags that are received, but are not handled explicityly fire this event and pass the entire XML tag object back to the client. NOTE:In JabberCOM 2.4+ you should start migrating to the "unified" OnQuery event to handle ALL iq packets. This will simplfy your code and allow you to handle things significantly better. This event still works, but (very, very) long term, will eventually be phased out.
OnXMLTag(Tag: IXMLTag)
This is a totally generic "catch-all" event that will fire after EVERY tag is parsed after it is received over the socket. The parsed tag is passed as a parameter. This occurs after any other processing has already occurred by JabberCOM.
OnVersionGet(FromJID: String; Tag: IXMLTag)
This event is fired whenever someone sends you a request for your CTCP version information. (jabber:iq:version namespace). To respond, create and send a JabberIQ object back to the sender adding the appropriate fields.
OnVersionResult(FromJID, AppName, AppVer, OS: String; Tag: IXMLTag)
This event is fired when you receive results from a CTCP Version query. Just display the information passed back.
OnTimeGet(FromJID: Tag:IXMLTag)
Similar to the OnVersionGet event. Create and send back a JabberIQ which uses the jabber:iq:time fields. This namespace is also used to "ping" poeple, so almost all clients should respond to it.
OnTimeResults(FromJID, Display: string; Tag: IXMLTag)
Fired when we get results from a CTCP Time query from another client. Display contains the localized way of representing the date/time.
OnSearchFields(Tag: IXMLTag)
Occurs after you do a IJabberAgentItem.GetSearch call. The resulting tag contains the iq tag which contains all of the fields.
OnSearchResult(JID: string; IQ: IJabberIQ)
This event fires for EACH "record" that is returned in a set of search results. The JabberIQ object will have all of the fields inside of it, and the JID is the JID for that record.
OnSearchEnd
This event fires to tell us we have received all of the search results.
OnGetOOB(FromJID, URL, Desc: String; Tag: IXMLTag)
This event is fired when someone tries to send you a file or URL.
OnRegFields(RegIQ: IJabberIQ)
This event fires when the DoConnect method is called using: DoConnect(jatNoAuth, true); This will tell JabberCOM to "query" the server for the registration fields necessary to register a new user on this server. This event will fire, and the IJabberIQ passed back will have all of the blank fields ready to be filled in. You can then use the SendRegister method to send back a completed registration form. The SendRegister will register the user, and log that new user into the server.
OnBrowseStart(FromJID, iqID: string; Tag: IXMLTag)
This event fires when a browse result set is being sent to you. You it to initialize GUI elements in a Jabber browser.
OnBrowseItem(JID, iqID: string; BrowseObj: IJabberOject; Tag: IXMLTag)
This will fire for each browse object that is sent to as a child of a 'main' parent browse object. To get access to the parent browse object (or a browse push item) use the OnBrowseEnd event.
OnBrowseEnd(FromJID, iqID: string; ParentObject: IJabberObject
This will fire at the end of a browse list or when you receive a browse push.
OnBrowseRequest(FromJID, iqID: string; Tag IXMLTag)
This event will fire when another client is trying to browse to your resource. You should respond with a an IQ-Result.
OnForm(FromJID, iqID: string; Tag: IXMLTag)
This event will fire when you receive a form from a service.