summaryrefslogtreecommitdiff
path: root/sunshine
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-05-15 19:15:40 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-05-15 19:15:40 +0200
commit84b19fa58d60c477d921592dc51d83314e08942e (patch)
tree7db89974bc5f85a3bfd3ea3080ffb374e12eb064 /sunshine
parentf5984e373d43cef98e278a72ec07dcbfa589c6e0 (diff)
Adding new packets to GG library.
Diffstat (limited to 'sunshine')
-rwxr-xr-xsunshine/lqsoft/pygadu/network_base.py24
-rwxr-xr-xsunshine/lqsoft/pygadu/network_v8.py22
2 files changed, 14 insertions, 32 deletions
diff --git a/sunshine/lqsoft/pygadu/network_base.py b/sunshine/lqsoft/pygadu/network_base.py
index 686ee39..392d42f 100755
--- a/sunshine/lqsoft/pygadu/network_base.py
+++ b/sunshine/lqsoft/pygadu/network_base.py
@@ -32,13 +32,10 @@ class GaduPacket(CStruct):
#
# INCOMING PACKETS
#
-#@inpacket(0x01)
class WelcomePacket(GaduPacket):
- seed = numeric.IntField(0)
-
+ seed = numeric.IntField(0)
WelcomePacket = inpacket(0x01)(WelcomePacket)
-#@inpacket(0x05)
class MessageAckPacket(GaduPacket): #SendMsgAck
MSG_STATUS = Enum({
'BLOCKED': 0x0001, 'DELIVERED': 0x0002,
@@ -51,27 +48,22 @@ class MessageAckPacket(GaduPacket): #SendMsgAck
seq = numeric.IntField(2)
MessageAckPacket = inpacket(0x05)(MessageAckPacket)
-#@inpacket(0x09)
class LoginFailedPacket(GaduPacket):
pass
LoginFailedPacket = inpacket(0x09)(LoginFailedPacket)
-#@inpacket(0x0b)
class DisconnectPacket(GaduPacket):
pass
DisconnectPacket = inpacket(0x0b)(DisconnectPacket)
-#@inpacket(0x14)
class NeedEmailPacket(GaduPacket):
pass
NeedEmailPacket = inpacket(0x14)(NeedEmailPacket)
-#@inpacket(0x0d)
class UnavailbleAckPacket(GaduPacket):
pass
UnavailbleAckPacket = inpacket(0x0d)(UnavailbleAckPacket)
-#@inpacket(0x07)
class PongPacket(GaduPacket):
pass
PongPacket = inpacket(0x07)(PongPacket)
@@ -79,7 +71,6 @@ PongPacket = inpacket(0x07)(PongPacket)
#
# OUTGOING PACKETS
#
-
class StructNotice(CStruct): # Notify
TYPE = Enum({
'BUDDY': 0x01,
@@ -93,26 +84,27 @@ class StructNotice(CStruct): # Notify
def __str__(self):
return "%d[%d]" (self.uin, self.type)
-@outpacket(0x0f)
class NoticeFirstPacket(GaduPacket): #NotifyFirst
contacts = complex.ArrayField(0, complex.StructField(0, struct=StructNotice), length=-1)
+NoticeFirstPacket = outpacket(0x0f)(NoticeFirstPacket)
-@outpacket(0x10)
class NoticeLastPacket(GaduPacket): #NotifyLast
contacts = complex.ArrayField(0, complex.StructField(0, struct=StructNotice), length=-1)
+NoticeLastPacket = outpacket(0x10)(NoticeLastPacket)
-@outpacket(0x12)
class NoNoticesPacket(GaduPacket):
pass
+NoNoticesPacket = outpacket(0x12)(NoNoticesPacket)
-@outpacket(0x0d)
class AddNoticePacket(GaduPacket):
contact = complex.StructField(0, struct=StructNotice)
+AddNoticePacket = outpacket(0x0d)(AddNoticePacket)
-@outpacket(0x0e)
class RemoveNoticePacket(GaduPacket):
contact = complex.StructField(0, struct=StructNotice)
+RemoveNoticePacket = outpacket(0x0e)(RemoveNoticePacket)
-@outpacket(0x08)
class PingPacket(GaduPacket):
pass
+PingPacket = outpacket(0x08)(PingPacket)
+
diff --git a/sunshine/lqsoft/pygadu/network_v8.py b/sunshine/lqsoft/pygadu/network_v8.py
index e96bcb1..1d5db79 100755
--- a/sunshine/lqsoft/pygadu/network_v8.py
+++ b/sunshine/lqsoft/pygadu/network_v8.py
@@ -105,7 +105,7 @@ class LoginPacket(GaduPacket):
login_hash = StringField(3, length=64)
status = UIntField(4, default=0x02)
flags = UIntField(5, default=0x03)
- features = UIntField(6, default=0x2637)
+ features = UIntField(6, default=0x2777)
local_ip = IntField(7)
local_port = ShortField(8)
external_ip = IntField(9)
@@ -123,12 +123,14 @@ class LoginPacket(GaduPacket):
self.login_hash = hash.digest()
LoginPacket = outpacket(0x31)(LoginPacket)
-#@inpacket(0x35)
+class Login80FailedPacket(GaduPacket):
+ reserved = IntField(0, True)
+Login80FailedPacket = inpacket(0x43)(Login80FailedPacket)
+
class LoginOKPacket(GaduPacket): #LoginOk80
reserved = IntField(0, True)
LoginOKPacket = inpacket(0x35)(LoginOKPacket)
-#@inpacket(0x2e)
class MessageInPacket(GaduPacket): #RecvMsg80
sender = IntField(0)
seq = IntField(1)
@@ -136,14 +138,12 @@ class MessageInPacket(GaduPacket): #RecvMsg80
content = StructField(3, struct=StructMessage)
MessageInPacket = inpacket(0x2e)(MessageInPacket)
-#@outpacket(0x2d)
class MessageOutPacket(GaduPacket):
recipient = IntField(0, default=None)
seq = IntField(1)
content = StructField(2, struct=StructMessage)
MessageOutPacket = outpacket(0x2d)(MessageOutPacket)
-#@outpacket(0x38)
class ChangeStatusPacket(GaduPacket): #NewStatus80
STATUS = Enum({
'NOT_AVAILABLE': 0x0001,
@@ -172,12 +172,10 @@ class ChangeStatusPacket(GaduPacket): #NewStatus80
description = StringField(3, length='description_size')
ChangeStatusPacket = outpacket(0x38)(ChangeStatusPacket)
-#@inpacket(0x36)
class StatusUpdatePacket(GaduPacket): # Status80
contact = StructField(0, struct=StructStatus)
StatusUpdatePacket = inpacket(0x36)(StatusUpdatePacket)
-#@inpacket(0x37)
class StatusNoticiesPacket(GaduPacket): # NotifyReply80
contacts = ArrayField(0, length=-1, subfield=StructField(0, struct=StructStatus))
StatusNoticiesPacket = inpacket(0x37)(StatusNoticiesPacket)
@@ -185,7 +183,6 @@ StatusNoticiesPacket = inpacket(0x37)(StatusNoticiesPacket)
#
# Contact database altering packets
#
-#@outpacket(0x2f)
class ULRequestPacket(GaduPacket): # UserListReq80
"""Import contact list from the server"""
TYPE = Enum({
@@ -198,7 +195,6 @@ class ULRequestPacket(GaduPacket): # UserListReq80
data = StringField(1, length=-1)
ULRequestPacket = outpacket(0x2f)(ULRequestPacket)
-#@inpacket(0x30)
class ULReplyPacket(GaduPacket): # UserListReply80
TYPE = Enum({
'PUT_REPLY': 0x00,
@@ -222,17 +218,14 @@ ULReplyPacket = inpacket(0x30)(ULReplyPacket)
#
# GG_XML_EVENT and GG_XML_ACTION packets
#
-#@inpacket(0x27)
class XmlEventPacket(GaduPacket):
data = StringField(0, length=-1)
XmlEventPacket = inpacket(0x27)(XmlEventPacket)
-#@inpacket(0x2c)
class XmlActionPacket(GaduPacket):
data = StringField(0, length=-1)
XmlActionPacket = inpacket(0x2c)(XmlActionPacket)
-#@outpacket(0x46)
class RecvMsgAck(GaduPacket):
num = IntField(0)
RecvMsgAck = outpacket(0x46)(RecvMsgAck)
@@ -240,7 +233,6 @@ RecvMsgAck = outpacket(0x46)(RecvMsgAck)
#
# GG_USER_DATA packets
#
-#@inpacket(0x44)
class UserDataPacket(GaduPacket):
type = IntField(0)
num = IntField(1)
@@ -250,8 +242,6 @@ UserDataPacket = inpacket(0x44)(UserDataPacket)
#
# GG_TYPING_NOTIFY packets
#
-#@inpacket(0x59)
-#@outpacket(0x59)
class TypingNotifyPacket(GaduPacket):
TYPE = Enum({
'START': 0x01,
@@ -261,4 +251,4 @@ class TypingNotifyPacket(GaduPacket):
type = ShortField(0)
uin = IntField(1)
TypingNotifyPacket = inpacket(0x59)(TypingNotifyPacket)
-TypingNotifyPacket = outpacket(0x59)(TypingNotifyPacket) \ No newline at end of file
+TypingNotifyPacket = outpacket(0x59)(TypingNotifyPacket)