예제 #1
0
        public static ChatRequest createLoginRequest(chat.model.User user)
        {
            proto.User  userDTO = proto.User.CreateBuilder().SetId(user.Id).SetPasswd(user.Password).Build();
            ChatRequest request = ChatRequest.CreateBuilder().SetType(ChatRequest.Types.Type.Login)
                                  .SetUser(userDTO).Build();

            return(request);
        }
예제 #2
0
        public static ChatRequest createLoggedFriendsRequest(chat.model.User user)
        {
            proto.User  userDTO = proto.User.CreateBuilder().SetId(user.Id).Build();
            ChatRequest request = ChatRequest.CreateBuilder().SetType(ChatRequest.Types.Type.GetLoggedFriends)
                                  .SetUser(userDTO).Build();

            return(request);
        }
예제 #3
0
        public static ChatResponse createFriendLoggedOutResponse(chat.model.User user)
        {
            proto.User   userDTO  = proto.User.CreateBuilder().SetId(user.Id).Build();
            ChatResponse response = ChatResponse.CreateBuilder()
                                    .SetType(ChatResponse.Types.Type.FriendLoggedOut)
                                    .SetUser(userDTO).Build();

            return(response);
        }
예제 #4
0
        public static ChatResponse createLoggedFriendsResponse(chat.model.User[] users)
        {
            ChatResponse.Builder response = ChatResponse.CreateBuilder()
                                            .SetType(ChatResponse.Types.Type.GetLoggedFriends);
            foreach (chat.model.User user in users)
            {
                proto.User userDTO = proto.User.CreateBuilder().SetId(user.Id).Build();
                response.AddFriends(userDTO);
            }

            return(response.Build());
        }