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: patch.diff
(1.8 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
--- oscar.py 2006-05-31 03:52:36.000000000 +0200
+++ oscar.py 2007-05-25 06:59:59.000000000 +0200
@@ -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,9 +2207,15 @@
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
+ 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, None]
+ #encoding = tlvs[1] We're ignoring this for now
#profile = tlvs[2] This is what we're after
return tlvs.get(0x02,None)
@@ -2424,8 +2440,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