Changeset 15c3a6b
- Timestamp:
- 2015-06-22T09:24:59Z (9 years ago)
- Children:
- 31e2b09
- Parents:
- ed83279
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/wa.py
red83279 r15c3a6b 50 50 import implugin 51 51 52 logger = logging.getLogger("yowsup.layers. network.layer")52 logger = logging.getLogger("yowsup.layers.logger.layer") 53 53 logger.setLevel(logging.DEBUG) 54 54 ch = logging.StreamHandler() … … 59 59 TODO/Things I'm unhappy about: 60 60 61 About the fact that WhatsApp is a rubbish protocol that happily rejects 62 every second stanza you send it if you're trying to implement a client that 63 doesn't keep local state. See how to cope with that.. It'd help if Yowsup 64 came with docs on what a normal login sequence looks like instead of just 65 throwing some stanzas over a wall but hey. 66 61 67 The randomness of where which bits/state live, in the implugin and the 62 68 yowsup layer. Can't really merge this but at least state should live in … … 72 78 And more. But let's first get this into a state where it even works.. 73 79 """ 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 ProtocolTreeNode83 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 node90 91 80 92 81 class BitlBeeLayer(YowInterfaceLayer): … … 221 210 # did get our ping back, declare failure. 222 211 self.onSyncResultFail() 212 if "groups" in self.todo: 213 # Well fuck this. Just reject ALL the things! 214 # Maybe I don't need this one then. 215 self.check_connected("groups") 223 216 self.check_connected("ping") 224 217 … … 397 390 # basic info but not yet a member list) and ACK the join 398 391 # once that's done. 399 self.yow.Ship(ParticipantsGroupsIqProtocolEntity(name)) 392 # Well except that WA/YS killed this one. \o/ 393 #self.yow.Ship(ParticipantsGroupsIqProtocolEntity(name)) 394 395 # So for now do without a participant list.. 396 #self.chat_join_participants(None) 397 self.chat_send_backlog(group) 400 398 401 399 def chat_join_participants(self, entity): 400 """ 402 401 group = self.groups[entity.getFrom()] 403 402 id = group["id"] … … 405 404 if p != self.account["user"]: 406 405 self.bee.chat_add_buddy(id, p) 407 406 """ 407 408 def chat_send_backlog(self, group): 408 409 # Add the user themselves last to avoid a visible join flood. 409 self.bee.chat_add_buddy( id, self.account["user"])410 self.bee.chat_add_buddy(group["id"], self.account["user"]) 410 411 for msg in group.setdefault("queue", []): 411 412 self.b.show_message(msg) … … 465 466 group = self.groups[msg.getFrom()] 466 467 if "id" in group: 468 self.bee.chat_add_buddy(group["id"], msg.getParticipant()) 467 469 self.bee.chat_msg(group["id"], msg.getParticipant(), text, 0, msg.getTimestamp()) 468 470 else:
Note: See TracChangeset
for help on using the changeset viewer.