1 | #!/usr/bin/python |
---|
2 | |
---|
3 | import collections |
---|
4 | import logging |
---|
5 | import threading |
---|
6 | import time |
---|
7 | |
---|
8 | import yowsup |
---|
9 | |
---|
10 | from yowsup.layers.auth import YowAuthenticationProtocolLayer |
---|
11 | from yowsup.layers.protocol_acks import YowAckProtocolLayer |
---|
12 | from yowsup.layers.protocol_chatstate import YowChatstateProtocolLayer |
---|
13 | from yowsup.layers.protocol_contacts import YowContactsIqProtocolLayer |
---|
14 | from yowsup.layers.protocol_groups import YowGroupsProtocolLayer |
---|
15 | from yowsup.layers.protocol_ib import YowIbProtocolLayer |
---|
16 | from yowsup.layers.protocol_iq import YowIqProtocolLayer |
---|
17 | from yowsup.layers.protocol_messages import YowMessagesProtocolLayer |
---|
18 | from yowsup.layers.protocol_notifications import YowNotificationsProtocolLayer |
---|
19 | from yowsup.layers.protocol_presence import YowPresenceProtocolLayer |
---|
20 | from yowsup.layers.protocol_privacy import YowPrivacyProtocolLayer |
---|
21 | from yowsup.layers.protocol_profiles import YowProfilesProtocolLayer |
---|
22 | from yowsup.layers.protocol_receipts import YowReceiptProtocolLayer |
---|
23 | from yowsup.layers.network import YowNetworkLayer |
---|
24 | from yowsup.layers.coder import YowCoderLayer |
---|
25 | from yowsup.stacks import YowStack, YowStackBuilder |
---|
26 | from yowsup.common import YowConstants |
---|
27 | from yowsup.layers import YowLayerEvent |
---|
28 | from yowsup.stacks import YowStack, YOWSUP_CORE_LAYERS |
---|
29 | from yowsup import env |
---|
30 | |
---|
31 | from yowsup.layers.interface import YowInterfaceLayer, ProtocolEntityCallback |
---|
32 | from yowsup.layers.protocol_acks.protocolentities import * |
---|
33 | from yowsup.layers.protocol_chatstate.protocolentities import * |
---|
34 | from yowsup.layers.protocol_contacts.protocolentities import * |
---|
35 | from yowsup.layers.protocol_groups.protocolentities import * |
---|
36 | from yowsup.layers.protocol_ib.protocolentities import * |
---|
37 | from yowsup.layers.protocol_iq.protocolentities import * |
---|
38 | from yowsup.layers.protocol_media.mediauploader import MediaUploader |
---|
39 | from yowsup.layers.protocol_media.protocolentities import * |
---|
40 | from yowsup.layers.protocol_messages.protocolentities import * |
---|
41 | from yowsup.layers.protocol_notifications.protocolentities import * |
---|
42 | from yowsup.layers.protocol_presence.protocolentities import * |
---|
43 | from yowsup.layers.protocol_privacy.protocolentities import * |
---|
44 | from yowsup.layers.protocol_profiles.protocolentities import * |
---|
45 | from yowsup.layers.protocol_receipts.protocolentities import * |
---|
46 | from yowsup.layers.axolotl.protocolentities.iq_key_get import GetKeysIqProtocolEntity |
---|
47 | from yowsup.layers.axolotl import YowAxolotlLayer |
---|
48 | from yowsup.common.tools import ModuleTools |
---|
49 | |
---|
50 | import implugin |
---|
51 | |
---|
52 | logger = logging.getLogger("yowsup.layers.network.layer") |
---|
53 | logger.setLevel(logging.DEBUG) |
---|
54 | ch = logging.StreamHandler() |
---|
55 | ch.setLevel(logging.DEBUG) |
---|
56 | logger.addHandler(ch) |
---|
57 | |
---|
58 | """ |
---|
59 | TODO/Things I'm unhappy about: |
---|
60 | |
---|
61 | The randomness of where which bits/state live, in the implugin and the |
---|
62 | yowsup layer. Can't really merge this but at least state should live in |
---|
63 | one place. |
---|
64 | |
---|
65 | Mix of silly CamelCase and proper_style. \o/ |
---|
66 | |
---|
67 | Most important: This is NOT thread-clean. implugin can call into yowsup |
---|
68 | cleanly by throwing closures into a queue, but there's no mechanism in |
---|
69 | the opposite direction, I'll need to cook up some hack to make this |
---|
70 | possible through bjsonrpc's tiny event loop. I think I know how... |
---|
71 | |
---|
72 | And more. But let's first get this into a state where it even works.. |
---|
73 | """ |
---|
74 | |
---|
75 | # Tried this but yowsup is not passing back the result, will have to update the library. :-( |
---|
76 | class GetStatusIqProtocolEntity(IqProtocolEntity): |
---|
77 | def __init__(self, jids=None): |
---|
78 | super(GetStatusIqProtocolEntity, self).__init__("status", None, _type="get", to="s.whatsapp.net") |
---|
79 | self.jids = jids or [] |
---|
80 | |
---|
81 | def toProtocolTreeNode(self): |
---|
82 | from yowsup.structs import ProtocolTreeNode |
---|
83 | |
---|
84 | node = super(GetStatusIqProtocolEntity, self).toProtocolTreeNode() |
---|
85 | sr = ProtocolTreeNode("status") |
---|
86 | node.addChild(sr) |
---|
87 | for jid in self.jids: |
---|
88 | sr.addChild(ProtocolTreeNode("user", {"jid": jid})) |
---|
89 | return node |
---|
90 | |
---|
91 | |
---|
92 | class BitlBeeLayer(YowInterfaceLayer): |
---|
93 | |
---|
94 | def __init__(self, *a, **kwa): |
---|
95 | super(BitlBeeLayer, self).__init__(*a, **kwa) |
---|
96 | # Offline messages are sent while we're still logging in. |
---|
97 | self.msg_queue = [] |
---|
98 | |
---|
99 | def receive(self, entity): |
---|
100 | print "Received: %r" % entity |
---|
101 | #print entity |
---|
102 | super(BitlBeeLayer, self).receive(entity) |
---|
103 | |
---|
104 | def Ship(self, entity): |
---|
105 | """Send an entity into Yowsup, but through the correct thread.""" |
---|
106 | print "Queueing: %s" % entity.getTag() |
---|
107 | #print entity |
---|
108 | def doit(): |
---|
109 | self.toLower(entity) |
---|
110 | self.getStack().execDetached(doit) |
---|
111 | |
---|
112 | @ProtocolEntityCallback("success") |
---|
113 | def onSuccess(self, entity): |
---|
114 | self.b = self.getStack().getProp("org.bitlbee.Bijtje") |
---|
115 | self.cb = self.b.bee |
---|
116 | self.b.yow = self |
---|
117 | |
---|
118 | self.cb.log("Authenticated, syncing contact list") |
---|
119 | |
---|
120 | # We're done once this set is empty. |
---|
121 | self.todo = set(["contacts", "groups", "ping"]) |
---|
122 | |
---|
123 | # Supposedly WA can also do national-style phone numbers without |
---|
124 | # a + prefix BTW (relative to I guess the user's country?). I |
---|
125 | # don't want to support this at least for now. |
---|
126 | numbers = [("+" + x.split("@")[0]) for x in self.cb.get_local_contacts()] |
---|
127 | self.toLower(GetSyncIqProtocolEntity(numbers)) |
---|
128 | self.toLower(ListGroupsIqProtocolEntity()) |
---|
129 | self.b.keepalive() |
---|
130 | |
---|
131 | try: |
---|
132 | self.toLower(PresenceProtocolEntity(name=self.b.setting("name"))) |
---|
133 | except KeyError: |
---|
134 | pass |
---|
135 | |
---|
136 | def check_connected(self, done): |
---|
137 | if not self.todo: |
---|
138 | return |
---|
139 | self.todo.remove(done) |
---|
140 | if not self.todo: |
---|
141 | self.cb.connected() |
---|
142 | self.flush_msg_queue() |
---|
143 | |
---|
144 | def flush_msg_queue(self): |
---|
145 | for msg in self.msg_queue: |
---|
146 | self.onMessage(msg) |
---|
147 | self.msg_queue = None |
---|
148 | |
---|
149 | @ProtocolEntityCallback("failure") |
---|
150 | def onFailure(self, entity): |
---|
151 | self.b = self.getStack().getProp("org.bitlbee.Bijtje") |
---|
152 | self.cb = self.b.bee |
---|
153 | self.cb.error(entity.getReason()) |
---|
154 | self.cb.logout(False) |
---|
155 | |
---|
156 | def onEvent(self, event): |
---|
157 | # TODO: Make this work without, hmm, over-recursing. (This handler |
---|
158 | # getting called when we initiated the disconnect, which upsets yowsup.) |
---|
159 | if event.getName() == "orgopenwhatsapp.yowsup.event.network.disconnected": |
---|
160 | self.cb.error(event.getArg("reason")) |
---|
161 | self.cb.logout(True) |
---|
162 | self.getStack().execDetached(self.daemon.StopDaemon) |
---|
163 | else: |
---|
164 | print "Received event: %s name %s" % (event, event.getName()) |
---|
165 | |
---|
166 | @ProtocolEntityCallback("presence") |
---|
167 | def onPresence(self, pres): |
---|
168 | if pres.getFrom() == self.b.account["user"]: |
---|
169 | # WA returns our own presence. Meh. |
---|
170 | return |
---|
171 | |
---|
172 | # Online/offline is not really how WA works. Let's show everyone |
---|
173 | # as online but unavailable folks as away. This also solves the |
---|
174 | # problem of offline->IRC /quit causing the persons to leave chat |
---|
175 | # channels as well (and not reappearing there when they return). |
---|
176 | status = 8 | 1 # MOBILE | ONLINE |
---|
177 | if pres.getType() == "unavailable": |
---|
178 | status |= 4 # AWAY |
---|
179 | self.cb.buddy_status(pres.getFrom(), status, None, None) |
---|
180 | |
---|
181 | try: |
---|
182 | # Last online time becomes idle time which I guess is |
---|
183 | # sane enough? |
---|
184 | self.cb.buddy_times(pres.getFrom(), 0, int(pres.getLast())) |
---|
185 | except (ValueError, TypeError): |
---|
186 | # Could be "error" or, more likely, "deny", or None. |
---|
187 | pass |
---|
188 | |
---|
189 | @ProtocolEntityCallback("message") |
---|
190 | def onMessage(self, msg): |
---|
191 | if self.todo: |
---|
192 | # We're still logging in, so wait. |
---|
193 | self.msg_queue.append(msg) |
---|
194 | return |
---|
195 | |
---|
196 | self.b.show_message(msg) |
---|
197 | |
---|
198 | # ACK is required! So only use return above in case of errors. |
---|
199 | # (So that we will/might get a retry after restarting.) |
---|
200 | self.toLower(OutgoingReceiptProtocolEntity(msg.getId(), msg.getFrom())) |
---|
201 | |
---|
202 | @ProtocolEntityCallback("receipt") |
---|
203 | def onReceipt(self, entity): |
---|
204 | ack = OutgoingAckProtocolEntity(entity.getId(), entity.getTag(), |
---|
205 | entity.getType(), entity.getFrom()) |
---|
206 | self.toLower(ack) |
---|
207 | |
---|
208 | @ProtocolEntityCallback("iq") |
---|
209 | def onIq(self, entity): |
---|
210 | if isinstance(entity, ResultSyncIqProtocolEntity): |
---|
211 | return self.onSyncResult(entity) |
---|
212 | elif isinstance(entity, ListParticipantsResultIqProtocolEntity): |
---|
213 | return self.b.chat_join_participants(entity) |
---|
214 | elif isinstance(entity, ListGroupsResultIqProtocolEntity): |
---|
215 | return self.onListGroupsResult(entity) |
---|
216 | elif "ping" in self.todo: # Pong has no type, sigh. |
---|
217 | if "contacts" in self.todo: |
---|
218 | # Shitty Whatsapp rejected the sync request, and |
---|
219 | # annoying Yowsup doesn't inform on error responses. |
---|
220 | # So instead, if we received no response to it but |
---|
221 | # did get our ping back, declare failure. |
---|
222 | self.onSyncResultFail() |
---|
223 | self.check_connected("ping") |
---|
224 | |
---|
225 | def onSyncResult(self, entity): |
---|
226 | # TODO HERE AND ELSEWHERE: Thread idiocy happens when going |
---|
227 | # from here to the IMPlugin. Check how bjsonrpc lets me solve that. |
---|
228 | for num, jid in entity.inNumbers.iteritems(): |
---|
229 | self.toLower(SubscribePresenceProtocolEntity(jid)) |
---|
230 | self.cb.add_buddy(jid, "") |
---|
231 | if entity.outNumbers: |
---|
232 | self.cb.error("Not on WhatsApp: %s" % |
---|
233 | ", ".join(entity.outNumbers.keys())) |
---|
234 | if entity.invalidNumbers: |
---|
235 | self.cb.error("Invalid numbers: %s" % |
---|
236 | ", ".join(entity.invalidNumbers)) |
---|
237 | |
---|
238 | #self.getStatuses(entity.inNumbers.values()) |
---|
239 | self.check_connected("contacts") |
---|
240 | |
---|
241 | def onSyncResultFail(self): |
---|
242 | # Whatsapp rate-limits sync stanzas, so in case of failure |
---|
243 | # just assume all contacts are valid. |
---|
244 | for jid in self.cb.get_local_contacts(): |
---|
245 | self.toLower(SubscribePresenceProtocolEntity(jid)) |
---|
246 | self.cb.add_buddy(jid, "") |
---|
247 | #self.getStatuses? |
---|
248 | self.check_connected("contacts") |
---|
249 | |
---|
250 | def onListGroupsResult(self, groups): |
---|
251 | """Save group info for later if the user decides to join.""" |
---|
252 | for g in groups.getGroups(): |
---|
253 | jid = g.getId() |
---|
254 | if "@" not in jid: |
---|
255 | jid += "@g.us" |
---|
256 | group = self.b.groups[jid] |
---|
257 | |
---|
258 | # Save it. We're going to mix ListGroups elements and |
---|
259 | # Group-Subject notifications there, which don't have |
---|
260 | # consistent fieldnames for the same bits of info \o/ |
---|
261 | g.getSubjectTimestamp = g.getSubjectTime |
---|
262 | group["topic"] = g |
---|
263 | |
---|
264 | self.check_connected("groups") |
---|
265 | |
---|
266 | def getStatuses(self, contacts): |
---|
267 | return # Disabled since yowsup won't give us the result... |
---|
268 | self.toLower(GetStatusIqProtocolEntity(contacts)) |
---|
269 | self.todo.add("statuses") |
---|
270 | |
---|
271 | @ProtocolEntityCallback("notification") |
---|
272 | def onNotification(self, ent): |
---|
273 | if isinstance(ent, StatusNotificationProtocolEntity): |
---|
274 | return self.onStatusNotification(ent) |
---|
275 | elif isinstance(ent, SubjectGroupsNotificationProtocolEntity): |
---|
276 | return self.onGroupSubjectNotification(ent) |
---|
277 | |
---|
278 | def onStatusNotification(self, status): |
---|
279 | print "New status for %s: %s" % (status.getFrom(), status.status) |
---|
280 | self.bee.buddy_status_msg(status.getFrom(), status.status) |
---|
281 | |
---|
282 | def onGroupSubjectNotification(self, sub): |
---|
283 | print "New /topic for %s: %s" % (sub.getFrom(), sub.getSubject()) |
---|
284 | group = self.b.groups[sub.getFrom()] |
---|
285 | group["topic"] = sub |
---|
286 | id = group.get("id", None) |
---|
287 | if id is not None: |
---|
288 | self.cb.chat_topic(id, sub.getSubjectOwner(), |
---|
289 | sub.getSubject(), sub.getSubjectTimestamp()) |
---|
290 | |
---|
291 | @ProtocolEntityCallback("media") |
---|
292 | def onMedia(self, med): |
---|
293 | """Your PC better be MPC3 compliant!""" |
---|
294 | print "YAY MEDIA! %r" % med |
---|
295 | print med |
---|
296 | |
---|
297 | #@ProtocolEntityCallback("chatstate") |
---|
298 | #def onChatstate(self, entity): |
---|
299 | # print(entity) |
---|
300 | |
---|
301 | |
---|
302 | class YowsupDaemon(threading.Thread): |
---|
303 | daemon = True |
---|
304 | stack = None |
---|
305 | |
---|
306 | class Terminate(Exception): |
---|
307 | pass |
---|
308 | |
---|
309 | def run(self): |
---|
310 | try: |
---|
311 | self.stack.loop(timeout=0.2, discrete=0.2, count=1) |
---|
312 | except YowsupDaemon.Terminate: |
---|
313 | print "Exiting loop!" |
---|
314 | pass |
---|
315 | |
---|
316 | def StopDaemon(self): |
---|
317 | # Ugly, but yowsup offers no "run single iteration" version |
---|
318 | # of their event loop :-( |
---|
319 | raise YowsupDaemon.Terminate |
---|
320 | |
---|
321 | |
---|
322 | class YowsupIMPlugin(implugin.BitlBeeIMPlugin): |
---|
323 | NAME = "wa" |
---|
324 | SETTINGS = { |
---|
325 | "cc": { |
---|
326 | # Country code. Seems to be required for registration only. |
---|
327 | "type": "int", |
---|
328 | }, |
---|
329 | "name": { |
---|
330 | "flags": 0x100, # NULL_OK |
---|
331 | }, |
---|
332 | } |
---|
333 | AWAY_STATES = ["Away"] |
---|
334 | ACCOUNT_FLAGS = 14 # HANDLE_DOMAINS + STATUS_MESSAGE + LOCAL_CONTACTS |
---|
335 | # TODO: HANDLE_DOMAIN in right place (add ... ... nick bug) |
---|
336 | PING_INTERVAL = 299 # seconds |
---|
337 | |
---|
338 | def login(self, account): |
---|
339 | self.stack = self.build_stack(account) |
---|
340 | self.daemon = YowsupDaemon(name="yowsup") |
---|
341 | self.daemon.stack = self.stack |
---|
342 | self.daemon.start() |
---|
343 | self.bee.log("Started yowsup thread") |
---|
344 | |
---|
345 | self.groups = collections.defaultdict(dict) |
---|
346 | self.groups_by_id = {} |
---|
347 | |
---|
348 | self.next_ping = None |
---|
349 | |
---|
350 | def keepalive(self): |
---|
351 | if self.next_ping and (time.time() < self.next_ping): |
---|
352 | return |
---|
353 | self.yow.Ship(PingIqProtocolEntity(to="s.whatsapp.net")) |
---|
354 | self.next_ping = time.time() + self.PING_INTERVAL |
---|
355 | |
---|
356 | def logout(self): |
---|
357 | self.stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)) |
---|
358 | self.stack.execDetached(self.daemon.StopDaemon) |
---|
359 | |
---|
360 | def buddy_msg(self, to, text, flags): |
---|
361 | msg = TextMessageProtocolEntity(text, to=to) |
---|
362 | self.yow.Ship(msg) |
---|
363 | |
---|
364 | def add_buddy(self, handle, _group): |
---|
365 | self.yow.Ship(GetSyncIqProtocolEntity( |
---|
366 | ["+" + handle.split("@")[0]], mode=GetSyncIqProtocolEntity.MODE_DELTA)) |
---|
367 | |
---|
368 | def remove_buddy(self, handle, _group): |
---|
369 | self.yow.Ship(UnsubscribePresenceProtocolEntity(handle)) |
---|
370 | |
---|
371 | def set_away(self, state, status): |
---|
372 | print "Trying to set status to %r, %r" % (state, status) |
---|
373 | if state: |
---|
374 | # Only one option offered so None = available, not None = away. |
---|
375 | self.yow.Ship(AvailablePresenceProtocolEntity()) |
---|
376 | else: |
---|
377 | self.yow.Ship(UnavailablePresenceProtocolEntity()) |
---|
378 | if status: |
---|
379 | self.yow.Ship(SetStatusIqProtocolEntity(status)) |
---|
380 | |
---|
381 | def set_set_name(self, _key, value): |
---|
382 | self.yow.Ship(PresenceProtocolEntity(name=value)) |
---|
383 | |
---|
384 | def chat_join(self, id, name, _nick, _password, settings): |
---|
385 | print "New chat created with id: %d" % id |
---|
386 | group = self.groups[name] |
---|
387 | group.update({"id": id, "name": name}) |
---|
388 | self.groups_by_id[id] = group |
---|
389 | |
---|
390 | gi = group.get("topic", None) |
---|
391 | if gi: |
---|
392 | self.bee.chat_topic(id, gi.getSubjectOwner(), |
---|
393 | gi.getSubject(), gi.getSubjectTimestamp()) |
---|
394 | |
---|
395 | # WA doesn't really have a concept of joined or not, just |
---|
396 | # long-term membership. Let's just sync state (we have |
---|
397 | # basic info but not yet a member list) and ACK the join |
---|
398 | # once that's done. |
---|
399 | self.yow.Ship(ParticipantsGroupsIqProtocolEntity(name)) |
---|
400 | |
---|
401 | def chat_join_participants(self, entity): |
---|
402 | group = self.groups[entity.getFrom()] |
---|
403 | id = group["id"] |
---|
404 | for p in entity.getParticipants(): |
---|
405 | if p != self.account["user"]: |
---|
406 | self.bee.chat_add_buddy(id, p) |
---|
407 | |
---|
408 | # Add the user themselves last to avoid a visible join flood. |
---|
409 | self.bee.chat_add_buddy(id, self.account["user"]) |
---|
410 | for msg in group.setdefault("queue", []): |
---|
411 | self.b.show_message(msg) |
---|
412 | del group["queue"] |
---|
413 | |
---|
414 | def chat_msg(self, id, text, flags): |
---|
415 | msg = TextMessageProtocolEntity(text, to=self.groups_by_id[id]["name"]) |
---|
416 | self.yow.Ship(msg) |
---|
417 | |
---|
418 | def chat_leave(self, id): |
---|
419 | # WA never really let us leave, so just disconnect id and jid. |
---|
420 | group = self.groups_by_id[id] |
---|
421 | del self.groups_by_id[id] |
---|
422 | del group["id"] |
---|
423 | |
---|
424 | def build_stack(self, account): |
---|
425 | self.account = account |
---|
426 | creds = (account["user"].split("@")[0], account["pass"]) |
---|
427 | |
---|
428 | stack = (YowStackBuilder() |
---|
429 | .pushDefaultLayers(False) |
---|
430 | .push(BitlBeeLayer) |
---|
431 | .build()) |
---|
432 | stack.setProp(YowAuthenticationProtocolLayer.PROP_CREDENTIALS, creds) |
---|
433 | stack.setProp(YowNetworkLayer.PROP_ENDPOINT, YowConstants.ENDPOINTS[0]) |
---|
434 | stack.setProp(YowCoderLayer.PROP_DOMAIN, YowConstants.DOMAIN) |
---|
435 | stack.setProp(YowCoderLayer.PROP_RESOURCE, env.CURRENT_ENV.getResource()) |
---|
436 | try: |
---|
437 | stack.setProp(YowIqProtocolLayer.PROP_PING_INTERVAL, 0) |
---|
438 | except AttributeError: |
---|
439 | # Ping setting only exists since May 2015. |
---|
440 | from yowsup.layers.protocol_iq.layer import YowPingThread |
---|
441 | YowPingThread.start = lambda x: None |
---|
442 | |
---|
443 | stack.setProp("org.bitlbee.Bijtje", self) |
---|
444 | |
---|
445 | stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT)) |
---|
446 | |
---|
447 | return stack |
---|
448 | |
---|
449 | |
---|
450 | # Not RPCs from here on. |
---|
451 | def show_message(self, msg): |
---|
452 | if hasattr(msg, "getBody"): |
---|
453 | text = msg.getBody() |
---|
454 | elif hasattr(msg, "getCaption") and hasattr(msg, "getMediaUrl"): |
---|
455 | lines = [] |
---|
456 | if msg.getMediaUrl(): |
---|
457 | lines.append(msg.getMediaUrl()) |
---|
458 | else: |
---|
459 | lines.append("<Broken link>") |
---|
460 | if msg.getCaption(): |
---|
461 | lines.append(msg.getCaption()) |
---|
462 | text = "\n".join(lines) |
---|
463 | |
---|
464 | if msg.getParticipant(): |
---|
465 | group = self.groups[msg.getFrom()] |
---|
466 | if "id" in group: |
---|
467 | self.bee.chat_msg(group["id"], msg.getParticipant(), text, 0, msg.getTimestamp()) |
---|
468 | else: |
---|
469 | self.bee.log("Warning: Activity in room %s" % msg.getFrom()) |
---|
470 | self.groups[msg.getFrom()].setdefault("queue", []).append(msg) |
---|
471 | else: |
---|
472 | self.bee.buddy_msg(msg.getFrom(), text, 0, msg.getTimestamp()) |
---|
473 | |
---|
474 | |
---|
475 | implugin.RunPlugin(YowsupIMPlugin, debug=True) |
---|