Presence Event

This event is fired when the presence of a subscribed entity changes.

Syntax

public event OnPresenceHandler OnPresence;

public delegate void OnPresenceHandler(object sender, XmppPresenceEventArgs e);

public class XmppPresenceEventArgs : EventArgs {
  public string User { get; }
  public string Domain { get; }
  public string Resource { get; }
  public int Availability { get; }
  public string Status { get; }
}
Public Event OnPresence As OnPresenceHandler

Public Delegate Sub OnPresenceHandler(sender As Object, e As XmppPresenceEventArgs)

Public Class XmppPresenceEventArgs Inherits EventArgs
  Public ReadOnly Property User As String
  Public ReadOnly Property Domain As String
  Public ReadOnly Property Resource As String
  Public ReadOnly Property Availability As Integer
  Public ReadOnly Property Status As String
End Class

Remarks

This event contains the availability and status information of a particular Jabber entity to whom this entity has a subscription.

Because a user can log in multiple times using the same account, the XMPP component will parse the user's Jabber ID into the User, Domain and Resource parameters so that the client can easily track which instance of the account sent the presence.

The XMPP protocol permits XMPP (Jabber) clients to communicate with foreign IM networks such as AIM, MSN, SMS, and others through the use of gateway servers that translate between the foreign protocol and XMPP. When sending or receiving presence information, messages, or subscription requests, Domain will be a gateway for the foreign network on which the contact resides and with which this user has registered an account for that foreign network. The Register method can be used to register with a foreign network gateway.

Availability corresponds to the Presence property of the component, with the same possible values:

pcOffline (0)Invisible: JabberId is offline.
pcChat (1)Available: JabberId is online.
pcAway (2)Away: JabberId is online, but the user is away from their computer.
pcXA (3)Extended Away: JabberId is online, but the user is away from their computer for an extended period of time.
pcDND (4)Do not Disturb: JabberId is online, but is busy and does not wish to be disturbed.

By default, the component sets the client presence to pcChat, meaning that the user is available. To change the initial status sent by the component set Presence to the desired presence before calling Connect.

Note: offline is not officially supported by the XMPP specification, however some XMPP server implementations may recognize the value. Setting the client's presence state to this value may cause the server to respond with an Error.

Status corresponds to the Status property. This value may be any random string, including the empty string, "".

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 .NET Edition - Version 20.0 [Build 8307]