diff src/plugins/plugin_xep_0045.py @ 1409:3265a2639182

massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 14:57:57 +0200
parents 77f07ea90420
children 176de79c8c39
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Thu Apr 16 13:31:14 2015 +0200
+++ b/src/plugins/plugin_xep_0045.py	Thu Apr 16 14:57:57 2015 +0200
@@ -106,7 +106,7 @@
         @param profile: profile to check
         @return: True if the profile is connected and has used the MUC feature, else False"""
         if not profile or profile not in self.clients or not self.host.isConnected(profile):
-            log.error(_('Unknown or disconnected profile (%s)') % profile)
+            log.error(_(u'Unknown or disconnected profile (%s)') % profile)
             if profile in self.clients:
                 del self.clients[profile]
             return False
@@ -138,7 +138,7 @@
             # and send the signal only when the room is unlocked
             # a proper configuration management should be done
             print "room locked !"
-            self.clients[profile].configure(room.roomJID, {}).addCallbacks(_sendBridgeSignal, lambda x: log.error(_('Error while configuring the room')))
+            self.clients[profile].configure(room.roomJID, {}).addCallbacks(_sendBridgeSignal, lambda x: log.error(_(u'Error while configuring the room')))
         else:
             _sendBridgeSignal()
         return room
@@ -359,9 +359,9 @@
         if not self.checkClient(profile):
             return _errDeferred()
         if room_jid in self.clients[profile].joined_rooms:
-            log.warning(_('%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()})
+            log.warning(_(u'%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()})
             return _errDeferred()
-        log.info(_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick})
+        log.info(_(u"[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick})
 
         if "history" in options:
             history_limit = int(options["history"])
@@ -709,7 +709,7 @@
         if user.nick in self.__changing_nicks:
             self.__changing_nicks.remove(user.nick)
         else:
-            log.debug(_("user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()})
+            log.debug(_(u"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}
@@ -721,12 +721,12 @@
         if user.nick == room.nick:
             # we left the room
             room_jid_s = room.roomJID.userhost()
-            log.info(_("Room [%(room)s] left (%(profile)s))") % {"room": room_jid_s,
+            log.info(_(u"Room [%(room)s] left (%(profile)s))") % {"room": room_jid_s,
                                                                  "profile": self.parent.profile})
             self.host.memory.delEntityCache(room.roomJID, profile_key=self.parent.profile)
             self.host.bridge.roomLeft(room.roomJID.userhost(), self.parent.profile)
         else:
-            log.debug(_("user %(nick)s left room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()})
+            log.debug(_(u"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}
             self.host.bridge.roomUserLeft(room.roomJID.userhost(), user.nick, user_data, self.parent.profile)
 
@@ -737,15 +737,15 @@
         self.host.bridge.presenceUpdate(room.roomJID.userhost() + '/' + user.nick, show or '', 0, {'default': status or ''}, self.parent.profile)
 
     def receivedGroupChat(self, room, user, body):
-        log.debug('receivedGroupChat: room=%s user=%s body=%s' % (room.roomJID.full(), user, body))
+        log.debug(u'receivedGroupChat: room=%s user=%s body=%s' % (room.roomJID.full(), user, body))
 
     def receivedHistory(self, room, user, message):
         # http://xmpp.org/extensions/xep-0045.html#enter-history
-        # log.debug('receivedHistory: room=%s user=%s body=%s' % (room.roomJID.full(), user, message))
+        # log.debug(u'receivedHistory: room=%s user=%s body=%s' % (room.roomJID.full(), user, message))
         pass
 
     def receivedSubject(self, room, user, subject):
         # http://xmpp.org/extensions/xep-0045.html#enter-subject
-        log.debug(_("New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject})
+        log.debug(_(u"New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject})
         self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject)
         self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile)