Opened 10 years ago

Closed 4 months ago

#2943 enhancement closed wontfix (wontfix)

Adding status message (aka available message) support to oscar.py

Reported by: venom087 Owned by:
Priority: normal Milestone:
Component: words Keywords:
Cc: Branch:
Author:

Description

I've been using Twisted Words to write an AIM bot using the oscar protocol. I needed to be able to retrieve users' status messages so I added that functionality to oscar.py. It's just three extra lines of code. The following is a patch with my changes:

Index: /words/protocols/oscar.py
===================================================================
--- /words/protocols/oscar.py	(revision 22046)
+++ /words/protocols/oscar.py	(working copy)
@@ -104,6 +104,7 @@
         self.warning = warn
         self.flags = []
         self.caps = []
+        self.statusMessage = ''
         for k,v in tlvs.items():
             if k == 1: # user flags
                 v=struct.unpack('!H',v)[0]
@@ -161,6 +162,8 @@
                 self.sessionLength = struct.unpack('!L',v)[0]
             elif k == 16: # session length (aol)
                 self.sessionLength = struct.unpack('!L',v)[0]
+            elif k == 29: # status message (aim)
+                self.statusMessage = v[26:len(v)-19]
             elif k == 30: # no idea
                 pass
             else:

Change History (5)

comment:1 Changed 10 years ago by Jean-Paul Calderone

Owner: changed from Jean-Paul Calderone to venom087

Can you add a unit test for this, too? It would help me understand parts of that patch, such as the magical 26 and 19.

comment:2 in reply to:  1 Changed 10 years ago by venom087

Replying to exarkun:

magical 26 and 19

I know next to nothing about this protocol. On a hunch I printed the tlvs array passed to the OSCARUser constructor and noticed that item 29 contained the status message, with 26 mysterious characters before it and 19 mysterious characters after it. Unfortunately I can't tell you anything more other than that it's been working for me so far, including for empty status messages.

comment:3 Changed 10 years ago by venom087

Owner: changed from venom087 to Jean-Paul Calderone

comment:4 Changed 7 years ago by <automation>

Owner: Jean-Paul Calderone deleted

comment:5 Changed 4 months ago by Craig Rodrigues

Resolution: wontfix
Status: newclosed

oscar was removed in ticket:9024

Note: See TracTickets for help on using tickets.