diff options
author | René Schümann <white06tiger@gmail.com> | 2015-03-26 20:39:52 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2015-03-26 20:39:52 +0000 |
commit | 33343901dabdc08991f0378781eccf53d0d7fac1 (patch) | |
tree | 6aab35b6ed11ba0d2b905f72942f67b16838133c /plugins/MirOTR/src/svcs_menu.cpp | |
parent | 958b2c8f49e4b05dd047e016def67690e31e09ca (diff) |
MirOTR: fixed ICQ problem as it's dropping all messages with "otr.cypherpunks.ca" in it and thus every manually started session (which then never starts)
This change actually improves the invite message as HTML is gone and the message is send in up to two languages (English + user)
git-svn-id: http://svn.miranda-ng.org/main/trunk@12506 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src/svcs_menu.cpp')
-rw-r--r-- | plugins/MirOTR/src/svcs_menu.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 4ed3f7a0d9..5467416408 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -14,9 +14,36 @@ int StartOTR(MCONTACT hContact) { if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy; lib_cs_lock(); + #ifndef MIROTR_PROTO_HELLO_MSG char *msg = otrl_proto_default_query_msg(MODULENAME, pol); otr_gui_inject_message((void*)hContact, proto, proto, uname, msg ? msg : MIROTR_PROTO_HELLO); free(msg); + #else + TCHAR* nick=ProtoGetNickname(proto); + if(nick){ + TCHAR msg[1024]; + TCHAR* msgend = msg+SIZEOF(msg)-1; + TCHAR* msgoff = msg; + for(const char* c=MIROTR_PROTO_HELLO; *c; *msgoff++=*c++); + *msgoff++ = '\n'; + for(const TCHAR* c=nick; *c && msgoff<msgend; *msgoff++=*c++); + for(const TCHAR* c=MIROTR_PROTO_HELLO_MSG; *c && msgoff<msgend; *msgoff++=*c++); + LCID langid = Langpack_GetDefaultLocale(); + if(langid != 0x0409/*US*/ && langid != 0x1009/*CA*/ && langid != 0x0809/*GB*/){ // non english + const TCHAR* translated=TranslateTS(MIROTR_PROTO_HELLO_MSG); + if(_tcscmp(MIROTR_PROTO_HELLO_MSG,translated)){ + *msgoff++ = '\n'; + for(const TCHAR* c=nick; *c && msgoff<msgend; *msgoff++=*c++); + for(const TCHAR* c=translated; *c && msgoff<msgend; *msgoff++=*c++); + } + } + *msgoff='\0'; + mir_free(nick); + char* msg_utf8 = mir_utf8encodeT(msg); + otr_gui_inject_message((void*)hContact, proto, proto, uname, msg_utf8 ? msg_utf8 : MIROTR_PROTO_HELLO); + mir_free(msg_utf8); + } + #endif lib_cs_unlock(); mir_free(uname); return 0; |