xmpp.protocol.Presence

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 7

Example 1

Project: spade Source File: socialnetwork.py
Function: send_presence
    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))

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")

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")

Example 4

Project: spade Source File: socialnetwork.py
Function: set_priority
    def setPriority(self, prio):
        self.myAgent.jabber.send(Presence(priority=prio))

Example 5

Project: spade Source File: socialnetwork.py
Function: set_show
    def setShow(self, show):
        self.myAgent.jabber.send(Presence(show=show))

Example 6

Project: spade Source File: socialnetwork.py
Function: set_status
    def setStatus(self, status):
        self.myAgent.jabber.send(Presence(status=status))