private void HandleRemoveBuddy(RemoveBuddyResponse r) { Debug.Print("handling remove buddy"); }
private void Handle() { while (connected) { byte type; byte[] buffer = Packet.Read(stream, out type); if (buffer == null) { Debug.Print("broken"); break; } Debug.Print("Type: {0}", type); lastReset = null; // dispatch switch (type) { case Packet.PACKET_LOGIN: { LoginResponse r = LoginResponse.Parser.ParseFrom(buffer); HandleLogin(r); break; } case Packet.PACKET_REGISTER: { RegisterResponse r = RegisterResponse.Parser.ParseFrom(buffer); HandleRegister(r); break; } case Packet.PACKET_LIST_USER: { ListUserResponse r = ListUserResponse.Parser.ParseFrom(buffer); HandleListUser(r); break; } case Packet.PACKET_LIST_BUDDY: { ListBuddyResponse r = ListBuddyResponse.Parser.ParseFrom(buffer); HandleListBuddy(r); break; } case Packet.PACKET_ADD_BUDDY: { AddBuddyResponse r = AddBuddyResponse.Parser.ParseFrom(buffer); HandleAddBuddy(r); break; } case Packet.PACKET_REMOVE_BUDDY: { RemoveBuddyResponse r = RemoveBuddyResponse.Parser.ParseFrom(buffer); HandleRemoveBuddy(r); break; } case Packet.PACKET_MESSAGE: { Message r = Message.Parser.ParseFrom(buffer); HandleMessage(r); break; } case Packet.PACKET_RESET: { Reset r = Reset.Parser.ParseFrom(buffer); HandleReset(r); break; } case Packet.PACKET_RAW: { Debug.Print(Encoding.UTF8.GetString(buffer)); break; } default: { LoginResponse r = LoginResponse.Parser.ParseFrom(buffer); break; } } } Close(); }