diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-29 18:50:37 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-29 18:50:37 +0000 |
commit | 2afddc4305325447f91d879af7d5c4c280257867 (patch) | |
tree | 768293d3378dc33da532e22d9b99e19ca0323680 /protocols/SkypeWeb/src/requests/messages.h | |
parent | 09f41999e99c45c0948d08f474682a85504a48df (diff) |
SkypeWeb: code optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@14754 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/requests/messages.h')
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 1f4d4bc87d..451f89cb23 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -29,11 +29,12 @@ public: << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
- JSONNode node(JSON_NODE);
- node.push_back(JSONNode("clientmessageid", (long)timestamp));
- node.push_back(JSONNode("messagetype", "RichText"));
- node.push_back(JSONNode("contenttype", "text"));
- node.push_back(JSONNode("content", message));
+ JSONNode node;
+ node
+ << JSONNode("clientmessageid", (long)timestamp)
+ << JSONNode("messagetype", "RichText")
+ << JSONNode("contenttype", "text")
+ << JSONNode("content", message);
Body << VALUE(node.write().c_str());
}
@@ -53,12 +54,13 @@ public: CMStringA content;
content.AppendFormat("%s %s", selfusername, message);
- JSONNode node(JSON_NODE);
- node.push_back(JSONNode("clientmessageid", (long)timestamp));
- node.push_back(JSONNode("messagetype", "RichText"));
- node.push_back(JSONNode("contenttype", "text"));
- node.push_back(JSONNode("content", content));
- node.push_back(JSONNode("skypeemoteoffset", (int)(mir_strlen(selfusername) + 1)));
+ JSONNode node;
+ node
+ << JSONNode("clientmessageid", (long)timestamp)
+ << JSONNode("messagetype", "RichText")
+ << JSONNode("contenttype", "text")
+ << JSONNode("content", content)
+ << JSONNode("skypeemoteoffset", (int)(mir_strlen(selfusername) + 1));
Body << VALUE(node.write().c_str());
}
@@ -75,13 +77,14 @@ public: << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
- char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping";
+ const char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping";
- JSONNode node(JSON_NODE);
- node.push_back(JSONNode("clientmessageid", (long)time(NULL)));
- node.push_back(JSONNode("messagetype", state));
- node.push_back(JSONNode("contenttype", "text"));
- node.push_back(JSONNode("content", ""));
+ JSONNode node;
+ node
+ << JSONNode("clientmessageid", (long)time(NULL))
+ << JSONNode("messagetype", state)
+ << JSONNode("contenttype", "text")
+ << JSONNode("content", "");
Body << VALUE(node.write().c_str());
}
@@ -101,7 +104,7 @@ public: //"lastReadMessageTimestamp;modificationTime;lastReadMessageId"
JSONNode node(JSON_NODE);
- node.push_back(JSONNode("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp).GetBuffer()));
+ node << JSONNode("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp));
Body << VALUE(node.write().c_str());
}
|