Here are the examples of the python api xmpp.protocol.Presence taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6 Examples
3
Example 1
def sendPresence(self, typ=None, priority=None, show=None, status=None):
'''
Updates your presence to all your contacts
typ - your presence type (available, unavailable,...) default='available'
priority - the priority of the resource you are connected from
show - The message shown to your contacts
status - a brief description of your status
'''
jid = self.myAgent.getName() + self.myAgent.resource
self.myAgent.jabber.send(Presence(jid, typ=typ, priority=priority, show=show, status=status))
3
Example 2
Project: spade Source File: socialnetwork.py
def acceptSubscription(self, jid):
'''
Accepts the subscription request from 'jid'
'''
msg = Presence(to=jid, typ="subscribed")
self.myAgent.send(msg)
self.myAgent.DEBUG("I have accepted the " + str(jid) + "'s request of subscription to me")
3
Example 3
Project: spade Source File: socialnetwork.py
def declineSubscription(self, jid):
'''
Declines the subscription request from 'jid'
'''
msg = Presence(to=jid, typ="unsubscribed")
self.myAgent.send(msg)
self.myAgent.DEBUG("I have declined the " + str(jid) + "'s request of subscription to me")
0
Example 4
def setPriority(self, prio):
self.myAgent.jabber.send(Presence(priority=prio))
0
Example 5
def setShow(self, show):
self.myAgent.jabber.send(Presence(show=show))
0
Example 6
def setStatus(self, status):
self.myAgent.jabber.send(Presence(status=status))