forked from hackyourlife/orakel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonline.py
More file actions
24 lines (21 loc) · 706 Bytes
/
online.py
File metadata and controls
24 lines (21 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: utf-8 -*-
# vim:set ts=8 sts=8 sw=8 tw=80 noet cc=80:
from module import Module, MUC_MENTION
class Online(Module):
def __init__(self, **keywords):
super(Online, self).__init__([MUC_MENTION], name=__name__,
**keywords)
self.send_cmd("get_room_info")
def muc_mention(self, msg, **keywords):
if not (msg.startswith("ist ") and (msg.endswith(" online?") \
or msg.endswith(" online"))):
return
u = msg[4:-7].strip()
if len(u) == 0:
return
for n in self.participants:
if u == n or u + "@webchat" == n \
or self.participants[n]["jid"].split("@")[0] == u:
self.send_muc("Ja, %s ist online." % n)
return
self.send_muc("Nein, %s ist nicht online." % u)