summaryrefslogtreecommitdiff
path: root/MySpace/server_con.cpp
diff options
context:
space:
mode:
author(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2008-04-28 04:06:10 +0000
committer(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2008-04-28 04:06:10 +0000
commit75006603dec984b397d895273b50ec47c6276307 (patch)
tree48613a7064eaaa0df13116d14b53ceb8701d5b0d /MySpace/server_con.cpp
parent0ead8bc26f63385a8ee1cba53fb857d32dcd3567 (diff)
fix for dodgy client sending typing notifications with incorrect message type
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@405 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/server_con.cpp')
-rw-r--r--MySpace/server_con.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp
index d2c5916..2b524e7 100644
--- a/MySpace/server_con.cpp
+++ b/MySpace/server_con.cpp
@@ -546,24 +546,31 @@ void __cdecl ServerThreadFunc(void*) {
}
char text[MAX_MESSAGE_SIZE + 1];
if(msg.get_string("msg", text, MAX_MESSAGE_SIZE + 1)) {
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)0); // auto end typing
-
- strip_tags(text);
- decode_smileys(text);
- unentitize_xml(text);
-
- PROTORECVEVENT pre = {0};
- pre.flags = PREF_UTF;
- pre.szMessage = text;
- pre.timestamp = (DWORD)time(0);
- pre.lParam = EVENTTYPE_MESSAGE;
-
- CCSDATA css = {0};
- css.hContact = hContact;
- css.lParam = (LPARAM)&pre;
- css.szProtoService = PSR_MESSAGE;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&css);
+ // handle dodgy client with wrong message type
+ if(strcmp(text, "%typing%") == 0) {
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)20);
+ } else if(strcmp(text, "%stoptyping%") == 0) {
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)0);
+ } else {
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)0); // auto end typing
+
+ strip_tags(text);
+ decode_smileys(text);
+ unentitize_xml(text);
+
+ PROTORECVEVENT pre = {0};
+ pre.flags = PREF_UTF;
+ pre.szMessage = text;
+ pre.timestamp = (DWORD)time(0);
+ pre.lParam = EVENTTYPE_MESSAGE;
+
+ CCSDATA css = {0};
+ css.hContact = hContact;
+ css.lParam = (LPARAM)&pre;
+ css.szProtoService = PSR_MESSAGE;
+
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&css);
+ }
}
}
} else if(msg.exists(NMString("persistr"))) {