XMPP Class
Properties Methods Events Configuration Settings Errors
The XMPP Component is used to create a lightweight messaging client using the XMPP (Jabber) protocol.
Class Name
IPWorks_XMPP
Procedural Interface
ipworks_xmpp_open(); ipworks_xmpp_close($res); ipworks_xmpp_register_callback($res, $id, $function); ipworks_xmpp_get_last_error($res); ipworks_xmpp_get_last_error_code($res); ipworks_xmpp_set($res, $id, $index, $value); ipworks_xmpp_get($res, $id, $index); ipworks_xmpp_do_add($res, $jabberid, $name, $groups); ipworks_xmpp_do_cancel($res, $jabberid); ipworks_xmpp_do_changepassword($res, $password); ipworks_xmpp_do_changepresence($res, $presencecode, $status); ipworks_xmpp_do_config($res, $configurationstring); ipworks_xmpp_do_connect($res, $user, $password); ipworks_xmpp_do_disconnect($res); ipworks_xmpp_do_doevents($res); ipworks_xmpp_do_interrupt($res); ipworks_xmpp_do_probepresence($res, $jabberid); ipworks_xmpp_do_queryregister($res, $xmppserver); ipworks_xmpp_do_register($res, $xmppserver); ipworks_xmpp_do_remove($res, $jabberid, $name, $group); ipworks_xmpp_do_retrieveroster($res); ipworks_xmpp_do_sendcommand($res, $command); ipworks_xmpp_do_sendfile($res, $jabberid); ipworks_xmpp_do_sendmessage($res, $jabberid); ipworks_xmpp_do_setuserinfofield($res, $field, $value); ipworks_xmpp_do_subscribeto($res, $jabberid); ipworks_xmpp_do_unregister($res); ipworks_xmpp_do_unsubscribeto($res, $jabberid);
Remarks
A call to the Connect method will perform the entire logon process after which a Connected event will fire indicating connection status. For simplicity, the entire interface is synchronous; the class will not return until a call is completed.
After a successful connection, the class will automatically begin the process of receiving the user's buddy list. The class will parse the XML as it comes in from the server and will set the appropriate properties. Once the entire buddy list has been retrieved, a Sync event will fire.
Sending a message is as simple as calling a single method. One call to the SendMessage method will cause the class to connect if it has not already done so, send the specified message to a specified user, and return to the original connection state.
The XMPP Class interface supports messaging, list and presence management. Other features of the XMPP protocol are supported through the SendCommand method and PITrail event.
Example (Connecting and Sending a Message)
IMControl.Connect("myusername", "mypassword") IMControl.MessageText = "My Message" IMControl.SendMessage("ToUser")Example (Sending a Single Message)
IMControl.User = "myusername" IMControl.Password = "mypassword" IMControl.MessageText = "My Message" IMControl.SendMessage("ToUser")
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
AuthDomain | The domain under which the user will be authenticated. |
AuthMethods | Controls how the component authenticates itself with the XMPP server. |
BuddyCount | The number of records in the Buddy arrays. |
BuddyGroup | This is a comma-separated list of the buddy's associated groups. |
BuddyId | This is the jabber id of the buddy. |
BuddyNickName | The nickname of the buddy, if one exists. |
BuddyRealName | The real name of the buddy. |
BuddySubscription | This is a list of the subscription status for the buddy. |
Connected | This indicates the component's login status. |
FirewallAutoDetect | This property tells the component whether or not to automatically detect and use firewall system settings, if available. |
FirewallType | This property determines the type of firewall to connect through. |
FirewallHost | This property contains the name or IP address of firewall (optional). |
FirewallPassword | This property contains a password if authentication is to be used when connecting through the firewall. |
FirewallPort | This property contains the TCP port for the firewall Host . |
FirewallUser | This property contains a user name if authentication is to be used connecting through a firewall. |
IMPort | The server port for XMPP (default 5222). |
IMServer | This is the instant messaging server. |
LocalDirectory | The directory to which received files are saved. |
LocalFile | The path to the file that will be sent. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
MessageHTML | This is the HTML version of the current message. |
MessageOtherData | This property contains extra data elements for the current message. |
MessageSubject | This is the subject of the current message. |
MessageText | This is the plain text of the current message. |
MessageThread | This is the thread name of the current message. |
MessageType | This is the type of the current message. |
Password | This is the user's password. |
Presence | This is the availability of the entity. |
Resource | This is the resource for the current session. |
ServerDomain | The XMPP server's domain. |
Status | Description of the availability of this entity. |
Timeout | A timeout for the component. |
User | The user portion of this entity's Jabber ID. |
UserDomain | Gets or sets the domain value used for Jabber IDs. |
UserInfoCount | The number of records in the UserInfo arrays. |
UserInfoField | This is the name of the current property necessary for registration. |
UserInfoValue | This is the value for the current registration property, and should be set after calling QueryRegister and before calling Register . |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Add | This method will add an entity to this entity's roster. |
Cancel | This will cancel another entity's subscription to this entity's presence. |
ChangePassword | This method will change the current user's password. |
ChangePresence | This method will set the availability and status of this entity. |
Config | Sets or retrieves a configuration setting . |
Connect | This method will connect the component to the server. |
Disconnect | This method disconnects the component from the server. |
DoEvents | This method processes events from the internal message queue. |
Interrupt | Interrupt the current method. |
ProbePresence | Use this method to probe for another entity's presence. |
QueryRegister | This method queries a server for the necessary registration fields. |
Register | This method registers an account with a server. |
Remove | This method will remove an entity from this entity's roster. |
RetrieveRoster | This method will retrieve this entity's roster from the server. |
SendCommand | This method sends a command to the server. |
SendFile | Sends a file to the specified user. |
SendMessage | This method will send a message to the specified user. |
SetUserInfoField | This method will add a user information field for registration. |
SubscribeTo | Use this method to subscribe to another entity's presence. |
Unregister | This method cancels an account with the host. |
UnsubscribeTo | This method will cancel a subscription to another entity's presence. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
BuddyUpdate | This event is fired whenever a roster entry is updated. |
Connected | This event is fired when a connection to the IM Server is completed. |
ConnectionStatus | Fired to indicate changes in connection state. |
Disconnected | This event is fired when the chat service connection is lost. |
EndTransfer | Fired when a file transfer completes. |
Error | This event is fired when the server sends a protocol error message. |
IQ | This event is fired for IQ messages not normally supported by the component. |
MessageIn | This event is fired upon receipt of a message. |
PITrail | This event is fired for all protocol messages. |
Presence | This event is fired when the presence of a subscribed entity changes. |
ReadyToSend | Fired when IPPort is ready to send data. |
StartTransfer | Fired when a file transfer begins. |
SubscriptionRequest | This event fires when a subscription request is received. |
Sync | This event fires upon a complete information synchronization with the server. |
Transfer | Fired during file transfer. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
AccessToken | The OAuth access token used for authentication. |
ClientId | The OAuth client Id used for authentication. |
MessageXML | Returns the last root-level element received by the component. |
ParseHTML | Tells XMPP whether or not to parse MessageHTML when it's set. |
RetrieveRoster | Whether to automatically retrieve the roster when logging in. |
SendSubscriptionResponse | Determines whether a response will be sent to a Subscription Request. |
UseCompression | Specified whether or not stream compression is used. |
Overwrite | Specifies whether or not to overwrite received files. |
BlockSize | Specifies the block size for file transfers. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the component whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The TCP port in the local host where the component binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
RecordLength | The length of received data records. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
UseIPv6 | Whether to use IPv6. |
TcpNoDelay | Whether or not to delay when sending packets. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
CodePage | The system code page used for Unicode to Multibyte translations. |