def Login(sock, account, password): msg = ptt.rr_pb2.Login() msg.account = account m = hashlib.md5() m.update(password) msg.password = m.hexdigest().upper() msg.version = 1 msg.platform = 'python' msg.device = 'pc' msg.expect_payload = 103 msg.accept_payloads._values = (101, 103) packet = etpacket.pack(msg) sock.send(packet)
def UdpHeartBeat(sock, address, uid, gid): msg = ptt.net_pb2.HeartBeat() msg.gid = gid msg.uid = uid packet = etpacket.rtp_pack(100, 0, 0, uid, etpacket.pack(msg)) sock.sendto(packet, address)
def Pong(sock): msg = ptt.net_pb2.Pong() packet = etpacket.pack(msg) sock.send(packet)
def HeartBeat(sock): msg = ptt.net_pb2.HeartBeat() packet = etpacket.pack() sock.send(packet)
def ReleaseMic(sock, gid): msg = ptt.rr_pb2.ReleaseMic() msg.gid = gid packet = etpacket.pack(msg) sock.send(packet)
def LeaveGroup(sock, gid): msg = ptt.rr_pb2.LeaveGroup() msg.gid = gid packet = etpacket.pack(msg) sock.send(packet)
def QueryGroup(sock): msg = ptt.rr_pb2.QueryGroup() packet = etpacket.pack(msg) sock.send(packet)
def Logout(sock): msg = ptt.rr_pb2.Logout() packet = etpacket.pack(msg) sock.send(packet)