Last active
January 3, 2016 10:39
-
-
Save ernado/8450956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... | |
| def initialize(jid, send=True): | |
| """ | |
| Initializes user by subscribing to friends and sending initial presence | |
| @type jid: unicode | |
| @param jid: client jid | |
| @param send: send presence flag | |
| """ | |
| logger.debug("user api: called init for user %s" % jid) | |
| assert isinstance(jid, unicode) | |
| friends = get_friends(jid) | |
| database.set_friends(jid, friends) | |
| database.unset_polling(jid) | |
| database.unset_processing(jid) | |
| database.set_online(jid) | |
| if friends: | |
| logger.debug("user api: subscribing friends for %s" % jid) | |
| roster_subscribe(jid, friends) | |
| if send: | |
| logger.debug('sending initial presence') | |
| send_init_presence(jid) | |
| # ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment