Changeset 14 in chevmsgr for trunk/msg.cpp
- Timestamp:
- 08/30/15 21:31:39 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/msg.cpp
r11 r14 42 42 } 43 43 44 std::string Message::serialize() const 45 { 46 return json::Serialize(mObject); 47 } 48 44 49 // request 45 50 void Request::setUserID(const std::string & id) … … 83 88 DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::LOGIN); 84 89 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); 86 98 87 99 return json::Serialize(obj); … … 97 109 } 98 110 99 std::string Request::openSession(const std:: string & to) const111 std::string Request::openSession(const std::vector<std::string> & idList) const 100 112 { 101 113 DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::OPEN_SESSION); 102 114 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; 104 121 105 122 return json::Serialize(obj); 106 123 } 107 124 108 std::string Request:: chat(const std::string & sessid, const std::string & message, const int sensitive) const125 std::string Request::tell(const std::string & sessid, const std::string & message, const int sensitive) const 109 126 { 110 DECLARE_TEMPLATE_OBJECT(obj, ProtocolType:: CHAT);127 DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::TELL); 111 128 112 129 obj[ProtocolType::FROM] = mID; … … 133 150 std::string Response::result(const std::string & requestType, const bool status) const 134 151 { 135 DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::RESULT);152 DECLARE_TEMPLATE_OBJECT(obj, requestType); 136 153 137 154 obj[ProtocolType::RESULT] = status;
Note:
See TracChangeset
for help on using the changeset viewer.