Mercurial > libervia-backend
diff src/plugins/plugin_xep_0045.py @ 587:952322b1d490
Remove trailing whitespaces.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 18 Jan 2013 17:55:34 +0100 |
parents | ca13633d3b6b |
children | beaf6bec2fcd |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py Fri Jan 18 17:55:27 2013 +0100 +++ b/src/plugins/plugin_xep_0045.py Fri Jan 18 17:55:34 2013 +0100 @@ -106,7 +106,7 @@ # we have a nickname conflict, we try again with "_" suffixed to current nickname nick += '_' return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackArgs=[room_jid, nick, history_options, password, profile]) - + mess = _("Error when joining the room") error (mess) self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile) @@ -131,14 +131,14 @@ if not self.__check_profile(profile) or not self.clients[profile].joined_rooms.has_key(room_jid_s): return '' return self.clients[profile].joined_rooms[room_jid_s].nick - + def isNickInRoom(self, room_jid, nick, profile): """Tell if a nick is currently present in a room""" profile = self.host.memory.getProfileName(profile) if not self.__check_profile(profile): raise exceptions.UnknownProfileError("Unknown or disconnected profile") if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()): - raise UnknownRoom("This room has not been joined") + raise UnknownRoom("This room has not been joined") return self.clients[profile].joined_rooms[room_jid.userhost()].inRoster(nick) def getRoomsSubjects(self, profile_key='@DEFAULT@'): @@ -152,7 +152,7 @@ """Return unique name for room, avoiding collision""" #TODO: we should use #RFC-0045 10.1.4 when available here #TODO: we should be able to select the MUC service here - return uuid.uuid1() + return uuid.uuid1() def join(self, room_jid, nick, options, profile_key='@DEFAULT@'): def _errDeferred(exc_obj = Exception, txt='Error while joining room'): @@ -162,15 +162,15 @@ profile = self.host.memory.getProfileName(profile_key) if not self.__check_profile(profile): - return _errDeferred() + return _errDeferred() if self.clients[profile].joined_rooms.has_key(room_jid.userhost()): warning(_('%(profile)s is already in room %(room_jid)s') % {'profile':profile, 'room_jid':room_jid.userhost()}) - return _errDeferred() + return _errDeferred() info (_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile':profile,'room':room_jid.userhost(), 'nick':nick}) history_options = options["history"] == "True" if options.has_key("history") else None password = options["password"] if options.has_key("password") else None - + return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackArgs=[room_jid, nick, history_options, password, profile]) def _join(self, room_jid_s, nick, options={}, profile_key='@DEFAULT@'): @@ -193,23 +193,23 @@ if not self.__check_profile(profile): raise exceptions.UnknownProfileError("Unknown or disconnected profile") if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()): - raise UnknownRoom("This room has not been joined") + raise UnknownRoom("This room has not been joined") return self.clients[profile].nick(room_jid, nick) - - def leave(self, room_jid, profile_key): + + def leave(self, room_jid, profile_key): profile = self.host.memory.getProfileName(profile_key) if not self.__check_profile(profile): raise exceptions.UnknownProfileError("Unknown or disconnected profile") if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()): - raise UnknownRoom("This room has not been joined") + raise UnknownRoom("This room has not been joined") return self.clients[profile].leave(room_jid) - def subject(self, room_jid, subject, profile_key): + def subject(self, room_jid, subject, profile_key): profile = self.host.memory.getProfileName(profile_key) if not self.__check_profile(profile): raise exceptions.UnknownProfileError("Unknown or disconnected profile") if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()): - raise UnknownRoom("This room has not been joined") + raise UnknownRoom("This room has not been joined") return self.clients[profile].subject(room_jid, subject) def mucNick(self, room_jid_s, nick, profile_key='@DEFAULT@'): @@ -227,7 +227,7 @@ class SatMUCClient (muc.MUCClient): #implements(iwokkel.IDisco) - + def __init__(self, plugin_parent): self.plugin_parent = plugin_parent self.host = plugin_parent.host @@ -240,7 +240,7 @@ def subject(self, room, subject): return muc.MUCClientProtocol.subject(self, room, subject) - + def unavailableReceived(self, presence): #XXX: we override this method to manage nickname change #TODO: feed this back to Wokkel @@ -274,9 +274,9 @@ debug (_("user %(nick)s has joined room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()}) if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile): return - user_data={'entity':user.entity.full() if user.entity else '', 'affiliation':user.affiliation, 'role':user.role} + user_data={'entity':user.entity.full() if user.entity else '', 'affiliation':user.affiliation, 'role':user.role} self.host.bridge.roomUserJoined(room.roomJID.userhost(), user.nick, user_data, self.parent.profile) - + def userLeftRoom(self, room, user): if user.nick == room.nick: # we left the room @@ -288,7 +288,7 @@ self.host.bridge.roomLeft(room.roomJID.userhost(), self.parent.profile) else: debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()}) - user_data={'entity':user.entity.full() if user.entity else '', 'affiliation':user.affiliation, 'role':user.role} + user_data={'entity':user.entity.full() if user.entity else '', 'affiliation':user.affiliation, 'role':user.role} self.host.bridge.roomUserLeft(room.roomJID.userhost(), user.nick, user_data, self.parent.profile) def userChangedNick(self, room, user, new_nick): @@ -305,10 +305,10 @@ #def connectionInitialized(self): #pass - + #def getDiscoInfo(self, requestor, target, nodeIdentifier=''): #return [disco.DiscoFeature(NS_VCARD)] #def getDiscoItems(self, requestor, target, nodeIdentifier=''): #return [] - +