diff src/plugins/plugin_xep_0249.py @ 594:e629371a28d3

Fix pep8 support in src/plugins.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:35 +0100
parents beaf6bec2fcd
children 84a6e83157c2
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0249.py	Mon Jan 21 00:59:50 2013 +0100
+++ b/src/plugins/plugin_xep_0249.py	Fri Jan 18 17:55:35 2013 +0100
@@ -34,21 +34,22 @@
 except ImportError:
     from wokkel.subprotocols import XMPPHandler
 
-MESSAGE= '/message'
+MESSAGE = '/message'
 NS_DIRECT_MUC_INVITATION = 'jabber:x:conference'
 DIRECT_MUC_INVITATION_REQUEST = MESSAGE + '/x[@xmlns="' + NS_DIRECT_MUC_INVITATION + '"]'
 
 PLUGIN_INFO = {
-"name": "XEP 0249 Plugin",
-"import_name": "XEP-0249",
-"type": "XEP",
-"protocols": ["XEP-0249"],
-"dependencies": ["XEP-0045"],
-"main": "XEP_0249",
-"handler": "yes",
-"description": _("""Implementation of Direct MUC Invitations""")
+    "name": "XEP 0249 Plugin",
+    "import_name": "XEP-0249",
+    "type": "XEP",
+    "protocols": ["XEP-0249"],
+    "dependencies": ["XEP-0045"],
+    "main": "XEP_0249",
+    "handler": "yes",
+    "description": _("""Implementation of Direct MUC Invitations""")
 }
 
+
 class XEP_0249(object):
 
     def __init__(self, host):
@@ -71,15 +72,15 @@
         if not profile:
             error(_("Profile doesn't exists !"))
             return
-        message = domish.Element((None,'message'))
+        message = domish.Element((None, 'message'))
         message["to"] = target.full()
-        x_elt = message.addElement('x',NS_DIRECT_MUC_INVITATION)
+        x_elt = message.addElement('x', NS_DIRECT_MUC_INVITATION)
         x_elt['jid'] = room.userhost()
         for opt in options:
             x_elt[opt] = options[opt]
         self.host.profiles[profile].xmlstream.send(message)
 
-    def _invite(self, target, service, roomId, options = {}, profile_key='@DEFAULT@'):
+    def _invite(self, target, service, roomId, options={}, profile_key='@DEFAULT@'):
         """
         Invite an user to a room
         @param target: jid of the user to invite
@@ -90,14 +91,13 @@
         #TODO: check parameters validity
         self.invite(jid.JID(target), jid.JID("%s@%s" % (roomId, service)), options, profile_key)
 
-
     def onInvitation(self, message, profile):
         """
         called when an invitation is received
         @param message: message element
         @profile: %(doc_profile)s
         """
-        info(_('Invitation received for room %(room)s [%(profile)s]') % {'room':'','profile':profile})
+        info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': '', 'profile': profile})
         try:
             room = jid.JID(message.firstChildElement()['jid'])
         except:
@@ -116,7 +116,7 @@
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(DIRECT_MUC_INVITATION_REQUEST, self.plugin_parent.onInvitation, profile = self.parent.profile)
+        self.xmlstream.addObserver(DIRECT_MUC_INVITATION_REQUEST, self.plugin_parent.onInvitation, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_DIRECT_MUC_INVITATION)]