From 25f639726e86826fac199133caf9f69cd97ebb76 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 29 Jun 2015 18:19:20 +0000 Subject: various minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@14438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StatusPlugins/StartupStatus/profiles.cpp | 6 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 123 +++++++++++------------ protocols/Twitter/src/proto.cpp | 14 +-- 3 files changed, 68 insertions(+), 75 deletions(-) diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 03fd184191..c756889587 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -97,9 +97,9 @@ static int CreateMainMenuItems(WPARAM, LPARAM) mi.flags = CMIF_TCHAR; mcount = 0; count = GetProfileCount(0, 0); - for (i=0; i < count; i++) { + for (i = 0; i < count; i++) { TCHAR profilename[128]; - if ( !db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename)) + if (!db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename)) continue; if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1)) @@ -132,7 +132,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM) return 0; } mi.pszService = servicename; - if ( Menu_AddStatusMenuItem(&mi)) { + if (Menu_AddStatusMenuItem(&mi)) { menuprofiles[mcount] = i; mcount += 1; } diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 15e464cdb6..d0eaa861ac 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -69,20 +69,20 @@ void RebuildContact() HGENMENU mhRoot = NULL; HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[4] = {NULL, NULL, NULL, NULL }; + static HGENMENU hMenuItem[4] = { NULL, NULL, NULL, NULL }; SvcEMailRebuildMenu(); SvcHomepageRebuildMenu(); // load options int flag = db_get_b(NULL, MODNAME, SET_MI_CONTACT, MCAS_NOTINITIATED); - if (flag == MCAS_NOTINITIATED){ - flag = MCAS_EXIMPORT|TRUE; + if (flag == MCAS_NOTINITIATED) { + flag = MCAS_EXIMPORT | TRUE; db_set_b(NULL, MODNAME, SET_MI_CONTACT, flag); } // delete all MenuItems and set all bytes 0 to avoid problems - RemoveMenuItems (hMenuItem, _countof(hMenuItem)); + RemoveMenuItems(hMenuItem, _countof(hMenuItem)); // support new genmenu style TMO_MenuItem mi = { 0 }; @@ -159,17 +159,17 @@ void RebuildMain() HGENMENU mhRoot = NULL; HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; + static HGENMENU hMenuItem[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; // load options int flag = db_get_b(NULL, MODNAME, SET_MI_MAIN, MCAS_NOTINITIATED); - if (flag == MCAS_NOTINITIATED){ - flag = MCAS_ALL|TRUE; + if (flag == MCAS_NOTINITIATED) { + flag = MCAS_ALL | TRUE; db_set_b(NULL, MODNAME, SET_MI_MAIN, flag); } // delete all MenuItems and set all bytes 0 to avoid problems - RemoveMenuItems (hMenuItem, _countof(hMenuItem)); + RemoveMenuItems(hMenuItem, _countof(hMenuItem)); // support new genmenu style TMO_MenuItem mi = { 0 }; @@ -284,17 +284,17 @@ void RebuildGroup() HGENMENU mhRoot = NULL; HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[3] = {NULL, NULL, NULL }; + static HGENMENU hMenuItem[3] = { NULL, NULL, NULL }; // load options flag = db_get_b(NULL, MODNAME, SET_MI_GROUP, MCAS_NOTINITIATED); - if (flag == MCAS_NOTINITIATED){ - flag = MCAS_EXIMPORT|TRUE; + if (flag == MCAS_NOTINITIATED) { + flag = MCAS_EXIMPORT | TRUE; db_set_b(NULL, MODNAME, SET_MI_GROUP, flag); } // delete all MenuItems and set all bytes 0 to avoid problems - RemoveMenuItems (hMenuItem, _countof(hMenuItem)); + RemoveMenuItems(hMenuItem, _countof(hMenuItem)); // create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it char text[200]; @@ -304,34 +304,33 @@ void RebuildGroup() mi.pszService = text; char* tDest = text + mir_strlen(text); - switch (flag) - { - case 3: - //cascade off - mhRoot = mhExIm = NULL; - hMenuItem[item++] = NULL; - break; - case 5: - //cascade all - mi.position = 250000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); - mi.name.a = MODULELONGNAME; - mhRoot = Menu_AddGroupMenuItem(0, &mi); - hMenuItem[item++] = mhRoot; - mhExIm = mhRoot; - break; - case 9: - //cascade Ex/Import - mi.position = 250100; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); - mi.name.a = LPGEN("Export/import contact"); - mhExIm = Menu_AddGroupMenuItem(0, &mi); - hMenuItem[item++] = mhExIm; - mhRoot = NULL; - break; - default: - //disable Menue - return; + switch (flag) { + case 3: + //cascade off + mhRoot = mhExIm = NULL; + hMenuItem[item++] = NULL; + break; + case 5: + //cascade all + mi.position = 250000; + mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.name.a = MODULELONGNAME; + mhRoot = Menu_AddGroupMenuItem(0, &mi); + hMenuItem[item++] = mhRoot; + mhExIm = mhRoot; + break; + case 9: + //cascade Ex/Import + mi.position = 250100; + mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); + mi.name.a = LPGEN("Export/import contact"); + mhExIm = Menu_AddGroupMenuItem(0, &mi); + hMenuItem[item++] = mhExIm; + mhRoot = NULL; + break; + default: + //disable Menue + return; } // VCard's Ex/Import menuitems @@ -373,17 +372,17 @@ void RebuildSubGroup() HGENMENU mhRoot = NULL; HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[3] = {NULL, NULL, NULL }; + static HGENMENU hMenuItem[3] = { NULL, NULL, NULL }; // load options flag = db_get_b(NULL, MODNAME, SET_MI_SUBGROUP, MCAS_NOTINITIATED); - if (flag == MCAS_NOTINITIATED){ - flag = MCAS_DISABLED|TRUE; + if (flag == MCAS_NOTINITIATED) { + flag = MCAS_DISABLED | TRUE; db_set_b(NULL, MODNAME, SET_MI_SUBGROUP, flag); } // delete all MenuItems and set all bytes 0 to avoid problems - RemoveMenuItems (hMenuItem, _countof(hMenuItem)); + RemoveMenuItems(hMenuItem, _countof(hMenuItem)); // create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it char text[200]; @@ -431,8 +430,8 @@ void RebuildSubGroup() mi.name.a = mhExIm != NULL ? LPGEN("&Export") : LPGEN("&Export group"); mi.position = 1050200; mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); - gmp.lParam=0; - gmp.wParam=TRUE; + gmp.lParam = 0; + gmp.wParam = TRUE; hMenuItem[item++] = Menu_AddSubGroupMenuItem(&gmp, &mi); // Import @@ -441,8 +440,8 @@ void RebuildSubGroup() mi.name.a = mhExIm != NULL ? LPGEN("&Import") : LPGEN("&Import group"); mi.position = 1050300; mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); - gmp.lParam=0; - gmp.wParam=FALSE; + gmp.lParam = 0; + gmp.wParam = FALSE; hMenuItem[item++] = Menu_AddSubGroupMenuItem(&gmp, &mi); } @@ -472,18 +471,18 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) // on call by hook or first start if (!lParam || !hMenuItemAccount) { size_t sizeNew = mItems * mProtoCount * sizeof(HGENMENU); - hMenuItemAccount = (HGENMENU*) mir_realloc(hMenuItemAccount,sizeNew); + hMenuItemAccount = (HGENMENU*)mir_realloc(hMenuItemAccount, sizeNew); // set all bytes 0 to avoid problems memset(hMenuItemAccount, 0, sizeNew); } // on options change else // delete all MenuItems backward (first item second group) - RemoveMenuItems (hMenuItemAccount, mItems * mProtoCount); + RemoveMenuItems(hMenuItemAccount, mItems * mProtoCount); // load options int flag = db_get_b(NULL, MODNAME, SET_MI_ACCOUNT, MCAS_NOTINITIATED); - if (flag == MCAS_NOTINITIATED){ - flag = MCAS_EXIMPORT|TRUE; + if (flag == MCAS_NOTINITIATED) { + flag = MCAS_EXIMPORT | TRUE; db_set_b(NULL, MODNAME, SET_MI_ACCOUNT, flag); } @@ -495,16 +494,16 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) HGENMENU mhRoot = pcli->menuProtos[i].pMenu, mhExIm; if (mhRoot == NULL) break; - - PROTOACCOUNT *pAccountName = Proto_GetAccount(pcli->menuProtos[i].szProto); + + PROTOACCOUNT *pa = Proto_GetAccount(pcli->menuProtos[i].szProto); // create service name main (account module name) and set pointer to end it - char text[ 200 ]; + char text[200]; mir_strcpy(text, pcli->menuProtos[i].szProto); - + TMO_MenuItem mi = { 0 }; mi.pszService = text; - char* tDest = text + mir_strlen( text ); + char* tDest = text + mir_strlen(text); // support new genmenu style mi.root = mhRoot; @@ -515,14 +514,14 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mhExIm = mhRoot; // seperator mi.position = 50100; - hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi); + hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); break; case 5: // cascade all mi.position = 50100; mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); mi.name.a = MODULELONGNAME; - hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi); + hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); mhRoot = hMenuItemAccount[mItems*i + item++]; mhExIm = mhRoot; break; @@ -531,7 +530,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mi.position = 50100; mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); mi.name.a = LPGEN("Export/import"); - hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi); + hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); mhRoot = hMenuItemAccount[mItems*i + item++]; mhExIm = mhRoot; break; @@ -549,7 +548,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mi.name.a = LPGEN("&Export xml"); mi.position = 50200; mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); - hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi); + hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); // Import mir_strcpy(tDest, "/ImportAccount"); @@ -557,7 +556,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mi.name.a = LPGEN("&Import xml"); mi.position = 50300; mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); - hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi); + hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); } return 0; } diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 0d65b25b0c..d3c8fab685 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -256,26 +256,20 @@ int TwitterProto::OnBuildStatusMenu(WPARAM, LPARAM) if (hRoot == NULL) return 0; - char text[200]; - mir_strcpy(text, m_szModuleName); - char *tDest = text + mir_strlen(text); - TMO_MenuItem mi = { 0 }; - mi.pszService = text; - mi.root = hRoot; mi.flags = CMIF_TCHAR; mi.position = 1001; - Menu_AddStatusMenuItem(&mi); + Menu_AddStatusMenuItem(&mi, m_szModuleName); // TODO: Disable this menu item when offline // "Send Tweet..." - CreateProtoService("/Tweet", &TwitterProto::OnTweet); - mir_strcpy(tDest, "/Tweet"); + mi.pszService = "/Tweet"; + CreateProtoService(mi.pszService, &TwitterProto::OnTweet); mi.name.t = LPGENT("Send Tweet..."); mi.position = 200001; mi.hIcolibItem = GetIconHandle("tweet"); - Menu_AddStatusMenuItem(&mi); + Menu_AddStatusMenuItem(&mi, m_szModuleName); return 0; } -- cgit v1.2.3