From 3ae61fd1e898ae97669acf30e514ce98985d1fe8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 Aug 2018 20:15:51 +0300 Subject: fixes #1538 (MirOTR menu items are disaplyed for non-IM contacts) --- plugins/MirOTR/src/svcs_menu.cpp | 91 +++++++++++++++++++++------------------- plugins/MirOTR/src/version.h | 2 +- 2 files changed, 48 insertions(+), 45 deletions(-) (limited to 'plugins') diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 0dc6a16897..d0104d60dc 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -5,45 +5,46 @@ static HGENMENU hStopItem, hStartItem; //////////////////////////////// ///////// Menu Services //////// /////////////////////////////// -int StartOTR(MCONTACT hContact) { +int StartOTR(MCONTACT hContact) +{ const char *proto = GetContactProto(hContact); if (!proto) return 1; // error char *uname = contact_get_id(hContact); if (!uname) return 1; // error DWORD pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY); - if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy; - + if (pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy; + lib_cs_lock(); - #ifndef MIROTR_PROTO_HELLO_MSG +#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 - wchar_t* nick=ProtoGetNickname(proto); - if(nick){ +#else + wchar_t* nick = ProtoGetNickname(proto); + if (nick) { wchar_t msg[1024]; - wchar_t* msgend = msg+_countof(msg)-1; + wchar_t* msgend = msg + _countof(msg) - 1; wchar_t* msgoff = msg; - for(const char* c=MIROTR_PROTO_HELLO; *c; *msgoff++=*c++); + for (const char* c = MIROTR_PROTO_HELLO; *c; *msgoff++ = *c++); *msgoff++ = '\n'; - for(const wchar_t* c=nick; *c && msgoff -- cgit v1.2.3