My favorites
▼
|
Sign in
pyicqt
ICQ transport for XMPP
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
65
attachment: away_fix.patch
(2.0 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Index: PyICQt.py
===================================================================
--- PyICQt.py (revision 227)
+++ PyICQt.py (working copy)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/pkg/bin/python
# Make 'cwd'/src in the PYTHONPATH
import sys, os, os.path
Index: src/tlib/oscar.py
===================================================================
--- src/tlib/oscar.py (revision 227)
+++ src/tlib/oscar.py (working copy)
@@ -883,6 +883,16 @@
else:
return u
+ def parseProfile(self, data):
+ l = ord(data[0])
+ warn, tlvcnt = struct.unpack("!HH", data[1 + l : 5 + l])
+ return readTLVs(data[5 + l:], tlvcnt)[0]
+
+ def parseAway(self, data):
+ l = ord(data[0])
+ warn, tlvcnt = struct.unpack("!HH", data[1 + l : 5 + l])
+ return readTLVs(data[5 + l:], tlvcnt)[0]
+
def parseMoreInfo(self, data):
# why did i have this here and why did dsh remove it
#result = ord(data[0])
@@ -2197,10 +2207,14 @@
return self.sendSNAC(0x02, 0x15, '\x00\x00\x00\x01'+chr(len(user))+user).addCallback(self._cbGetProfile).addErrback(self._cbGetProfileError)
def _cbGetProfile(self, snac):
- user, rest = self.parseUser(snac[5],1)
- tlvs = readTLVs(rest)
- #encoding = tlvs[1] We're ignoring this for now
- #profile = tlvs[2] This is what we're after
+ try:
+ user, rest = self.parseUser(snac[5],1)
+ tlvs = readTLVs(rest)
+ except (TypeError, struct.error):
+ try:
+ tlvs = self.parseProfile(snac[5])
+ except (TypeError, struct.error):
+ return None
return tlvs.get(0x02,None)
@@ -2424,8 +2438,10 @@
def _cbGetAway(self, snac):
log.msg("_cbGetAway %r" % snac)
- user, rest = self.parseUser(snac[5],1)
- tlvs = readTLVs(rest)
+ try:
+ tlvs = self.parseAway(snac[5])
+ except (TypeError, struct.error):
+ return [None, None]
return [tlvs.get(0x03,None),tlvs.get(0x04,None)] # return None if there is no away message
#def acceptSendFileRequest(self,
Powered by
Google Project Hosting