From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tlen/src/jabber_iqid.cpp | 13 +++++-------- protocols/Tlen/src/jabber_svc.cpp | 9 ++++----- protocols/Tlen/src/jabber_thread.cpp | 14 +++++--------- protocols/Tlen/src/tlen.cpp | 12 +++--------- 4 files changed, 17 insertions(+), 31 deletions(-) (limited to 'protocols/Tlen/src') diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp index 49df5a88be..3cf0e0f2ae 100644 --- a/protocols/Tlen/src/jabber_iqid.cpp +++ b/protocols/Tlen/src/jabber_iqid.cpp @@ -241,14 +241,11 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) } /////////////////////////////////////// { - CLISTMENUITEM clmi; - memset(&clmi, 0, sizeof(CLISTMENUITEM)); - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuMUC, (LPARAM) &clmi); - if (proto->hMenuChats != NULL){ - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuChats, (LPARAM) &clmi); - } + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuMUC, (LPARAM) &mi); + if (proto->hMenuChats != NULL) + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuChats, (LPARAM)&mi); } proto->isOnline = TRUE; diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp index 0c4ba468e5..450446f640 100644 --- a/protocols/Tlen/src/jabber_svc.cpp +++ b/protocols/Tlen/src/jabber_svc.cpp @@ -1213,11 +1213,10 @@ int __cdecl TlenProtocol::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPAR case EV_PROTO_ONEXIT: return TlenPreShutdown(this, 0, 0 ); case EV_PROTO_ONRENAME: { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( CLISTMENUITEM ); - clmi.flags = CMIM_NAME | CMIF_TCHAR; - clmi.ptszName = m_tszUserName; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME | CMIF_TCHAR; + mi.ptszName = m_tszUserName; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi ); /* FIXME: Rename network user as well */ } } diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 291d1208a5..6daf6ce0f3 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -114,11 +114,9 @@ void __cdecl JabberServerThread(ThreadData *info) int numRetry; int reconnectTime; char *str; - CLISTMENUITEM clmi; int loginErr = 0; JabberLog(info->proto, "Thread started"); - // Normal server connection, we will fetch all connection parameters // e.g. username, password, etc. from the database. @@ -353,13 +351,11 @@ void __cdecl JabberServerThread(ThreadData *info) info->proto->isOnline = FALSE; info->proto->isConnected = FALSE; - memset(&clmi, 0, sizeof(CLISTMENUITEM)); - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS | CMIF_GRAYED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuMUC, (LPARAM) &clmi); - if (info->proto->hMenuChats != NULL){ - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuChats, (LPARAM) &clmi); - } + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_GRAYED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuMUC, (LPARAM) &mi); + if (info->proto->hMenuChats != NULL) + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuChats, (LPARAM) &mi); // Set status to offline oldStatus = info->proto->m_iStatus; diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index d8a0a00652..05c76957f5 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -156,10 +156,9 @@ int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam) { HANDLE hContact; DBVARIANT dbv; - CLISTMENUITEM clmi = {0}; + CLISTMENUITEM clmi = { sizeof(clmi) }; JABBER_LIST_ITEM *item; TlenProtocol *proto = (TlenProtocol *)ptr; - clmi.cbSize = sizeof(CLISTMENUITEM); if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) { if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) { if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) { @@ -353,13 +352,9 @@ int TlenPreShutdown(void *ptr, WPARAM wParam, LPARAM lParam) static void initMenuItems(TlenProtocol *proto) { - char text[_MAX_PATH]; - CLISTMENUITEM mi, clmi; - memset(&mi, 0, sizeof(CLISTMENUITEM)); - mi.cbSize = sizeof(CLISTMENUITEM); - memset(&clmi, 0, sizeof(CLISTMENUITEM)); - clmi.cbSize = sizeof(CLISTMENUITEM); + + CLISTMENUITEM mi = { sizeof(mi) }, clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_GRAYED; mi.pszContactOwner = proto->m_szModuleName; @@ -411,7 +406,6 @@ static void initMenuItems(TlenProtocol *proto) mi.hParentMenu = NULL; - // "Send picture" sprintf(text, "%s/SendPicture", proto->m_szModuleName); CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleSendPicture); -- cgit v1.2.3