summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0085.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-11-17 02:00:20 -0500
committerLance Stout <lancestout@gmail.com>2010-11-17 02:01:12 -0500
commit26aca2b789f62123819041229ba40ab10268f49e (patch)
tree20388fb0559ed85f7143eb3b8a669142cdc43f6b /sleekxmpp/plugins/xep_0085.py
parent4f69a03bb1a8caab7899bd04f97b7975a78f2f34 (diff)
parent5424ede413393db5b835686e8544a9b703fb113b (diff)
downloadslixmpp-26aca2b789f62123819041229ba40ab10268f49e.tar.gz
slixmpp-26aca2b789f62123819041229ba40ab10268f49e.tar.bz2
slixmpp-26aca2b789f62123819041229ba40ab10268f49e.tar.xz
slixmpp-26aca2b789f62123819041229ba40ab10268f49e.zip
Merge branch 'roster' of github.com:fritzy/SleekXMPP into roster
Conflicts: sleekxmpp/basexmpp.py sleekxmpp/roster.py sleekxmpp/test/sleektest.py tests/test_stream_presence.py tests/test_stream_roster.py
Diffstat (limited to 'sleekxmpp/plugins/xep_0085.py')
-rw-r--r--sleekxmpp/plugins/xep_0085.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/sleekxmpp/plugins/xep_0085.py b/sleekxmpp/plugins/xep_0085.py
index b7b5d6dd..3627e718 100644
--- a/sleekxmpp/plugins/xep_0085.py
+++ b/sleekxmpp/plugins/xep_0085.py
@@ -14,15 +14,18 @@ from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
from .. stanza.message import Message
+log = logging.getLogger(__name__)
+
+
class ChatState(ElementBase):
namespace = 'http://jabber.org/protocol/chatstates'
plugin_attrib = 'chat_state'
interface = set(('state',))
states = set(('active', 'composing', 'gone', 'inactive', 'paused'))
-
+
def active(self):
self.setState('active')
-
+
def composing(self):
self.setState('composing')
@@ -67,11 +70,11 @@ class xep_0085(base.base_plugin):
"""
XEP-0085 Chat State Notifications
"""
-
+
def plugin_init(self):
self.xep = '0085'
self.description = 'Chat State Notifications'
-
+
handlers = [('Active Chat State', 'active'),
('Composing Chat State', 'composing'),
('Gone Chat State', 'gone'),
@@ -79,10 +82,10 @@ class xep_0085(base.base_plugin):
('Paused Chat State', 'paused')]
for handler in handlers:
self.xmpp.registerHandler(
- Callback(handler[0],
- MatchXPath("{%s}message/{%s}%s" % (self.xmpp.default_ns,
+ Callback(handler[0],
+ MatchXPath("{%s}message/{%s}%s" % (self.xmpp.default_ns,
ChatState.namespace,
- handler[1])),
+ handler[1])),
self._handleChatState))
registerStanzaPlugin(Message, Active)
@@ -90,12 +93,12 @@ class xep_0085(base.base_plugin):
registerStanzaPlugin(Message, Gone)
registerStanzaPlugin(Message, Inactive)
registerStanzaPlugin(Message, Paused)
-
+
def post_init(self):
base.base_plugin.post_init(self)
self.xmpp.plugin['xep_0030'].add_feature('http://jabber.org/protocol/chatstates')
-
+
def _handleChatState(self, msg):
state = msg['chat_state'].name
- logging.debug("Chat State: %s, %s" % (state, msg['from'].jid))
+ log.debug("Chat State: %s, %s" % (state, msg['from'].jid))
self.xmpp.event('chatstate_%s' % state, msg)