added handleBuddyRemoved
This commit is contained in:
parent
c8121e9ff4
commit
111050fb22
|
@ -1,4 +1,10 @@
|
||||||
import protocol_pb2, socket, struct, sys, os
|
import protocol_pb2
|
||||||
|
import socket
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
import google.protobuf
|
||||||
|
|
||||||
def WRAP(MESSAGE, TYPE):
|
def WRAP(MESSAGE, TYPE):
|
||||||
wrap = protocol_pb2.WrapperMessage()
|
wrap = protocol_pb2.WrapperMessage()
|
||||||
|
@ -26,7 +32,7 @@ class SpectrumBackend:
|
||||||
m.message = msg
|
m.message = msg
|
||||||
m.nickname = nickname
|
m.nickname = nickname
|
||||||
m.xhtml = xhtml
|
m.xhtml = xhtml
|
||||||
#m.timestamp = str(timestamp)
|
m.timestamp = str(timestamp)
|
||||||
|
|
||||||
message = WRAP(m.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_CONV_MESSAGE)
|
message = WRAP(m.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_CONV_MESSAGE)
|
||||||
self.send(message)
|
self.send(message)
|
||||||
|
@ -77,6 +83,13 @@ class SpectrumBackend:
|
||||||
message = WRAP(buddy.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_BUDDY_CHANGED)
|
message = WRAP(buddy.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_BUDDY_CHANGED)
|
||||||
self.send(message)
|
self.send(message)
|
||||||
|
|
||||||
|
def handleBuddyRemoved(self, user, buddyName):
|
||||||
|
buddy = protocol_pb2.Buddy()
|
||||||
|
buddy.userName = user
|
||||||
|
buddy.buddyName = buddyName
|
||||||
|
|
||||||
|
message = WRAP(buddy.SerializeToString(), protocol_pb2.WrapperMessage.TYPE_BUDDY_REMOVED)
|
||||||
|
self.send(message);
|
||||||
|
|
||||||
def handleBuddyTyping(self, user, buddyName):
|
def handleBuddyTyping(self, user, buddyName):
|
||||||
buddy = protocol_pb2.Buddy()
|
buddy = protocol_pb2.Buddy()
|
||||||
|
@ -334,6 +347,7 @@ class SpectrumBackend:
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
wrapper = protocol_pb2.WrapperMessage()
|
wrapper = protocol_pb2.WrapperMessage()
|
||||||
if (wrapper.ParseFromString(self.m_data[4:]) == False):
|
if (wrapper.ParseFromString(self.m_data[4:]) == False):
|
||||||
self.m_data = self.m_data[expected_size+4:]
|
self.m_data = self.m_data[expected_size+4:]
|
||||||
|
|
Loading…
Reference in a new issue