Changeset 14 in chevmsgr for trunk/msg.cpp


Ignore:
Timestamp:
08/30/15 21:31:39 (9 years ago)
Author:
cheese
Message:

테스트 코드 추가
UI 모양 작업
채팅되는 상태까지 확인

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/msg.cpp

    r11 r14  
    4242    }
    4343
     44    std::string Message::serialize() const
     45    {
     46        return json::Serialize(mObject);
     47    }
     48
    4449    // request
    4550    void Request::setUserID(const std::string & id)
     
    8388        DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::LOGIN);
    8489
    85         obj[ProtocolType::PW] = mID + DELIMITER + pw;
     90        obj[ProtocolType::PW] = pw;
     91
     92        return json::Serialize(obj);
     93    }
     94
     95    std::string Request::logout() const
     96    {
     97        DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::LOGOUT);
    8698
    8799        return json::Serialize(obj);
     
    97109    }
    98110
    99     std::string Request::openSession(const std::string & to) const
     111    std::string Request::openSession(const std::vector<std::string> & idList) const
    100112    {
    101113        DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::OPEN_SESSION);
    102114
    103         obj[ProtocolType::TO] = to;
     115        json::Array ar;
     116        std::vector<std::string>::const_iterator iter;
     117        for (iter = idList.begin(); iter != idList.end(); iter++)
     118            ar.push_back(*iter);
     119
     120        obj[ProtocolType::ID_LIST] = ar;
    104121
    105122        return json::Serialize(obj);
    106123    }
    107124
    108     std::string Request::chat(const std::string & sessid, const std::string & message, const int sensitive) const
     125    std::string Request::tell(const std::string & sessid, const std::string & message, const int sensitive) const
    109126    {
    110         DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::CHAT);
     127        DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::TELL);
    111128
    112129        obj[ProtocolType::FROM] = mID;
     
    133150    std::string Response::result(const std::string & requestType, const bool status) const
    134151    {
    135         DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::RESULT);
     152        DECLARE_TEMPLATE_OBJECT(obj, requestType);
    136153
    137154        obj[ProtocolType::RESULT] = status;
Note: See TracChangeset for help on using the changeset viewer.