summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/AimOscar/src/theme.cpp27
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/FacebookRM/src/theme.cpp45
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp44
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp10
-rw-r--r--protocols/IRCG/src/services.cpp32
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp85
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp16
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp4
-rw-r--r--protocols/MSN/src/msn_menu.cpp35
-rw-r--r--protocols/SkypeWeb/src/skype_menus.cpp34
-rw-r--r--protocols/Steam/src/steam_menus.cpp17
-rw-r--r--protocols/Tox/src/tox_menus.cpp32
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp26
-rw-r--r--protocols/WhatsApp/src/theme.cpp16
-rw-r--r--protocols/Yahoo/src/services.cpp55
-rw-r--r--src/mir_app/src/clistmenus.cpp10
19 files changed, 212 insertions, 300 deletions
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index c51a5fb3eb..321630221c 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -209,13 +209,9 @@ int CAimProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM)
void CAimProto::InitMainMenus(void)
{
- //Do not put any services below HTML get away message!!!
- char service_name[200];
-
- CLISTMENUITEM mi = { 0 };
-
HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hRoot == NULL) {
+ CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.icolibItem = GetIconHandle("aim");
mi.name.t = m_tszUserName;
@@ -229,30 +225,29 @@ void CAimProto::InitMainMenus(void)
}
}
- mi.pszService = service_name;
+ CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hRoot;
- mi.flags = 0;
- mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/ManageAccount");
- CreateProtoService("/ManageAccount", &CAimProto::ManageAccount);
+ mi.pszService = "/ManageAccount";
+ CreateProtoService(mi.pszService, &CAimProto::ManageAccount);
mi.position = 201001;
mi.icolibItem = GetIconHandle("aim");
mi.name.a = LPGEN("Manage Account");
- hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/InstantIdle");
- CreateProtoService("/InstantIdle",&CAimProto::InstantIdle);
+ mi.pszService = "/InstantIdle";
+ CreateProtoService(mi.pszService, &CAimProto::InstantIdle);
mi.position = 201002;
mi.icolibItem = GetIconHandle("idle");
mi.name.a = LPGEN("Instant Idle");
- hMainMenu[1] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/JoinChatRoom");
- CreateProtoService("/JoinChatRoom", &CAimProto::JoinChatUI);
+ mi.pszService = "/JoinChatRoom";
+ CreateProtoService(mi.pszService, &CAimProto::JoinChatUI);
mi.position = 201003;
mi.icolibItem = GetIconHandle("aol");
mi.name.a = LPGEN( "Join Chat Room" );
- hMainMenu[2] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
void CAimProto::InitContactMenus(void)
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 13d816fac3..df22c38441 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -67,10 +67,6 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) :
CreateProtoService(PS_JOINCHAT, &FacebookProto::OnJoinChat);
CreateProtoService(PS_LEAVECHAT, &FacebookProto::OnLeaveChat);
- CreateProtoService("/Mind", &FacebookProto::OnMind);
- CreateProtoService("/VisitProfile", &FacebookProto::VisitProfile);
- CreateProtoService("/VisitNotifications", &FacebookProto::VisitNotifications);
-
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu);
HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit);
HookProtoEvent(ME_IDLE_CHANGED, &FacebookProto::OnIdleChanged);
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index ecb6403495..88e8d3ded4 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -208,13 +208,6 @@ int FacebookProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM)
{
- char text[200];
- mir_strncpy(text, m_szModuleName, 100);
- char *tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hRoot == NULL) {
CLISTMENUITEM miRoot = { 0 };
@@ -231,49 +224,49 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM)
}
}
+ CLISTMENUITEM mi = { 0 };
mi.flags = (this->isOnline() ? 0 : CMIF_GRAYED);
mi.position = 201001;
mi.hParentMenu = hRoot;
- //CreateProtoService(m_szModuleName,"/Mind",&FacebookProto::OnMind,this);
- mir_strcpy(tDest, "/Mind");
+ mi.pszService = "/Mind";
+ CreateProtoService(mi.pszService, &FacebookProto::OnMind);
mi.name.a = LPGEN("Share status...");
mi.icolibItem = GetIconHandle("mind");
- m_hStatusMind = Menu_AddProtoMenuItem(&mi);
+ m_hStatusMind = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- //CreateProtoService("/VisitProfile",&FacebookProto::VisitProfile);
- mir_strcpy(tDest, "/VisitProfile");
+ mi.pszService = "/VisitProfile";
+ CreateProtoService(mi.pszService, &FacebookProto::VisitProfile);
mi.name.a = LPGEN("Visit profile");
mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL);
- // TODO RM: remember and properly free in destructor?
- /*m_hStatusMind = */Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
- //CreateProtoService("/VisitNotifications", &FacebookProto::VisitNotifications);
- mir_strcpy(tDest, "/VisitNotifications");
+ mi.pszService = "/VisitNotifications";
+ CreateProtoService(mi.pszService, &FacebookProto::VisitNotifications);
mi.name.a = LPGEN("Visit notifications");
mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL);
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Services...
mi.hParentMenu = m_hMenuServicesRoot = Menu_CreateRoot(MO_PROTO, LPGENT("Services..."), mi.position, Skin_GetIconHandle(SKINICON_OTHER_HELP));
- CreateProtoService("/RefreshBuddyList", &FacebookProto::RefreshBuddyList);
- mir_strcpy(tDest, "/RefreshBuddyList");
+ mi.pszService = "/RefreshBuddyList";
+ CreateProtoService(mi.pszService, &FacebookProto::RefreshBuddyList);
mi.name.a = LPGEN("Refresh Buddy List");
mi.icolibItem = GetIconHandle("friendship");
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/CheckFriendRequests", &FacebookProto::CheckFriendRequests);
- mir_strcpy(tDest, "/CheckFriendRequests");
+ mi.pszService = "/CheckFriendRequests";
+ CreateProtoService(mi.pszService, &FacebookProto::CheckFriendRequests);
mi.name.a = LPGEN("Check Friends Requests");
mi.icolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/CheckNewsfeeds", &FacebookProto::CheckNewsfeeds);
- mir_strcpy(tDest, "/CheckNewsfeeds");
+ mi.pszService = "/CheckNewsfeeds";
+ CreateProtoService(mi.pszService, &FacebookProto::CheckNewsfeeds);
mi.name.a = LPGEN("Check Newsfeeds");
mi.icolibItem = GetIconHandle("newsfeed");
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 95b23cc877..0e8d5463b0 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -274,12 +274,12 @@ void GGPROTO::menus_init()
mi.name.t = LPGENT("Conference");
mi.position = 200001;
mi.icolibItem = iconList[14].hIcolib;
- hGCRoot = Menu_AddProtoMenuItem(&mi);
+ hGCRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.name.t = LPGENT("Contact list");
mi.position = 200002;
mi.icolibItem = iconList[7].hIcolib;
- hCLRoot = Menu_AddProtoMenuItem(&mi);
+ hCLRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
if (hMenuRoot)
Menu_RemoveItem(hMenuRoot);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index abecfa9c4a..61e1318022 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -57,29 +57,25 @@ int GGPROTO::gc_init()
void GGPROTO::gc_menus_init(HGENMENU hRoot)
{
if (gc_enabled) {
- char service[64];
-
CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_TCHAR;
mi.hParentMenu = hRoot;
// Conferencing
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_OPEN_CONF);
- CreateProtoService(GGS_OPEN_CONF, &GGPROTO::gc_openconf);
+ mi.pszService = GGS_OPEN_CONF;
+ CreateProtoService(mi.pszService, &GGPROTO::gc_openconf);
mi.position = 2000050001;
mi.icolibItem = iconList[14].hIcolib;
mi.name.t = LPGENT("Open &conference...");
- mi.pszService = service;
- hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Clear ignored conferences
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_CLEAR_IGNORED);
- CreateProtoService(GGS_CLEAR_IGNORED, &GGPROTO::gc_clearignored);
+ mi.pszService = GGS_CLEAR_IGNORED;
+ CreateProtoService(mi.pszService, &GGPROTO::gc_clearignored);
mi.position = 2000050002;
mi.icolibItem = iconList[15].hIcolib;
mi.name.t = LPGENT("&Clear ignored conferences");
- mi.pszService = service;
- hMainMenu[1] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
}
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 1c8b286dee..7a4cea35cd 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -514,57 +514,47 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam)
void GGPROTO::import_init(HGENMENU hRoot)
{
- // Import from server item
- char service[64];
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_IMPORT_SERVER);
- CreateProtoService(GGS_IMPORT_SERVER, &GGPROTO::import_server);
-
CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_TCHAR;
mi.hParentMenu = hRoot;
+
+ // Import from server item
+ mi.pszService = GGS_IMPORT_SERVER;
+ CreateProtoService(mi.pszService, &GGPROTO::import_server);
mi.position = 2000500001;
mi.icolibItem = iconList[1].hIcolib;
mi.name.t = LPGENT("Import List From &Server");
- mi.pszService = service;
- hMainMenu[2] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Import from textfile
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_IMPORT_TEXT);
- CreateProtoService(GGS_IMPORT_TEXT, &GGPROTO::import_text);
-
+ mi.pszService = GGS_IMPORT_TEXT;
+ CreateProtoService(mi.pszService, &GGPROTO::import_text);
mi.position = 2000500002;
mi.icolibItem = iconList[2].hIcolib;
mi.name.t = LPGENT("Import List From &Text File...");
- mi.pszService = service;
- hMainMenu[3] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[3] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Remove from server
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_REMOVE_SERVER);
- CreateProtoService(GGS_REMOVE_SERVER, &GGPROTO::remove_server);
-
+ mi.pszService = GGS_REMOVE_SERVER;
+ CreateProtoService(mi.pszService, &GGPROTO::remove_server);
mi.position = 2000500003;
mi.icolibItem = iconList[3].hIcolib;
mi.name.t = LPGENT("&Remove List From Server");
- mi.pszService = service;
- hMainMenu[4] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[4] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Export to server
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_EXPORT_SERVER);
- CreateProtoService(GGS_EXPORT_SERVER, &GGPROTO::export_server);
-
+ mi.pszService = GGS_EXPORT_SERVER;
+ CreateProtoService(mi.pszService, &GGPROTO::export_server);
mi.position = 2005000001;
mi.icolibItem = iconList[4].hIcolib;
mi.name.t = LPGENT("Export List To &Server");
- mi.pszService = service;
- hMainMenu[5] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[5] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Export to textfile
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_EXPORT_TEXT);
- CreateProtoService(GGS_EXPORT_TEXT, &GGPROTO::export_text);
-
+ mi.pszService = GGS_EXPORT_TEXT;
+ CreateProtoService(mi.pszService, &GGPROTO::export_text);
mi.position = 2005000002;
mi.icolibItem = iconList[5].hIcolib;
mi.name.t = LPGENT("Export List To &Text File...");
- mi.pszService = service;
- hMainMenu[6] = Menu_AddProtoMenuItem(&mi);
+ hMainMenu[6] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 748c8751de..4823849635 100644
--- a/protocols/Gadu-Gadu/src/sessions.cpp
+++ b/protocols/Gadu-Gadu/src/sessions.cpp
@@ -416,16 +416,14 @@ BOOL GGPROTO::sessions_closedlg()
void GGPROTO::sessions_menus_init(HGENMENU hRoot)
{
- char service[64];
- mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_CONCUR_SESS);
- CreateProtoService(GGS_CONCUR_SESS, &GGPROTO::sessions_view);
-
CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_TCHAR;
mi.hParentMenu = hRoot;
+
+ mi.pszService = GGS_CONCUR_SESS;
+ CreateProtoService(mi.pszService, &GGPROTO::sessions_view);
mi.position = (hMenuRoot) ? 2050000001 : 200003;
mi.icolibItem = iconList[16].hIcolib;
mi.name.t = LPGENT("Concurrent &sessions");
- mi.pszService = service;
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 5dab9c9973..095b23b114 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -23,15 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CIrcProto::InitMainMenus(void)
{
- char temp[MAXMODULELABELLENGTH];
- char *d = temp + mir_snprintf(temp, _countof(temp), m_szModuleName);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = temp;
-
HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hRoot == NULL) {
// Root popupmenuitem
+ CLISTMENUITEM mi = { 0 };
mi.name.t = m_tszUserName;
mi.position = -1999901010;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
@@ -45,40 +40,41 @@ void CIrcProto::InitMainMenus(void)
}
}
- mi.flags = 0;
+ CLISTMENUITEM mi = { 0 };
+ mi.hParentMenu = hRoot;
+
mi.name.a = LPGEN("&Quick connect");
mi.icolibItem = GetIconHandle(IDI_QUICK);
- mir_strcpy(d, IRC_QUICKCONNECT);
+ mi.pszService = IRC_QUICKCONNECT;
mi.position = 201001;
- mi.hParentMenu = hRoot;
- hMenuQuick = Menu_AddProtoMenuItem(&mi);
+ hMenuQuick = Menu_AddProtoMenuItem(&mi, m_szModuleName);
if (m_iStatus != ID_STATUS_OFFLINE) mi.flags |= CMIF_GRAYED;
mi.name.a = LPGEN("&Join channel");
mi.icolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN);//GetIconHandle(IDI_JOIN);
- mir_strcpy(d, IRC_JOINCHANNEL);
+ mi.pszService = IRC_JOINCHANNEL;
mi.position = 201002;
- hMenuJoin = Menu_AddProtoMenuItem(&mi);
+ hMenuJoin = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.name.a = LPGEN("&Change your nickname");
mi.icolibItem = GetIconHandle(IDI_RENAME);
- mir_strcpy(d, IRC_CHANGENICK);
+ mi.pszService = IRC_CHANGENICK;
mi.position = 201003;
- hMenuNick = Menu_AddProtoMenuItem(&mi);
+ hMenuNick = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.name.a = LPGEN("Show the &list of available channels");
mi.icolibItem = GetIconHandle(IDI_LIST);
- mir_strcpy(d, IRC_SHOWLIST);
+ mi.pszService = IRC_SHOWLIST;
mi.position = 201004;
- hMenuList = Menu_AddProtoMenuItem(&mi);
+ hMenuList = Menu_AddProtoMenuItem(&mi, m_szModuleName);
if (m_useServer) mi.flags &= ~CMIF_GRAYED;
mi.name.a = LPGEN("&Show the server window");
mi.icolibItem = GetIconHandle(IDI_SERVER);
- mir_strcpy(d, IRC_SHOWSERVER);
+ mi.pszService = IRC_SHOWSERVER;
mi.position = 201005;
- hMenuServer = Menu_AddProtoMenuItem(&mi);
+ hMenuServer = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 7124ed79bd..4c2091eb02 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -577,15 +577,9 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM)
void CJabberProto::MenuInit()
{
- char text[200];
- strncpy(text, m_szModuleName, sizeof(text) - 1);
- char* tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
HGENMENU hJabberRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hJabberRoot == NULL) {
+ CLISTMENUITEM mi = { 0 };
mi.name.t = m_tszUserName;
mi.position = -1999901006;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
@@ -593,95 +587,97 @@ void CJabberProto::MenuInit()
hJabberRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if (m_hMenuRoot)
+ if (m_hMenuRoot) {
Menu_RemoveItem(m_hMenuRoot);
- m_hMenuRoot = NULL;
+ m_hMenuRoot = NULL;
+ }
}
- // "Bookmarks..."
- CreateProtoService("/Bookmarks", &CJabberProto::OnMenuHandleBookmarks);
- mir_strcpy(tDest, "/Bookmarks");
- mi.flags = 0;
+ CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hJabberRoot;
+
+ // "Bookmarks..."
+ mi.pszService = "/Bookmarks";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleBookmarks);
mi.name.a = LPGEN("Bookmarks");
mi.position = 200001;
mi.icolibItem = GetIconHandle(IDI_BOOKMARKS);
- m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi);
+ m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Services..."
+ mi.pszService = NULL;
mi.name.a = LPGEN("Services...");
- mir_strcpy(tDest, "/Services");
mi.position = 200003;
mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
- HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi);
+ HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Service Discovery..."
- CreateProtoService("/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery);
- mir_strcpy(tDest, "/ServiceDiscovery");
+ mi.hParentMenu = hMenuServicesRoot;
+ mi.pszService = "/ServiceDiscovery";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscovery);
mi.name.a = LPGEN("Service Discovery");
mi.position = 2000050001;
mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
- mi.hParentMenu = hMenuServicesRoot;
- m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi);
+ m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/SD/MyTransports", &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
- mir_strcpy(tDest, "/SD/MyTransports");
+ mi.pszService = "/SD/MyTransports";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
mi.name.a = LPGEN("Registered Transports");
mi.position = 2000050003;
mi.icolibItem = GetIconHandle(IDI_TRANSPORTL);
- m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi);
+ m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/SD/Transports", &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
- mir_strcpy(tDest, "/SD/Transports");
+ mi.pszService = "/SD/Transports";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
mi.name.a = LPGEN("Local Server Transports");
mi.position = 2000050004;
mi.icolibItem = GetIconHandle(IDI_TRANSPORT);
- m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi);
+ m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/SD/Conferences", &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
- mir_strcpy(tDest, "/SD/Conferences");
+ mi.pszService = "/SD/Conferences";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
mi.name.a = LPGEN("Browse chatrooms");
mi.position = 2000050005;
mi.icolibItem = GetIconHandle(IDI_GROUP);
- m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi);
+ m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/Groupchat", &CJabberProto::OnMenuHandleJoinGroupchat);
- mir_strcpy(tDest, "/Groupchat");
+ mi.pszService = "/Groupchat";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleJoinGroupchat);
mi.name.a = LPGEN("Create/Join group chat");
mi.position = 2000050006;
mi.icolibItem = GetIconHandle(IDI_GROUP);
- m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi);
+ m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Change Password..."
- CreateProtoService("/ChangePassword", &CJabberProto::OnMenuHandleChangePassword);
- mir_strcpy(tDest, "/ChangePassword");
+ mi.pszService = "/ChangePassword";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleChangePassword);
mi.name.a = LPGEN("Change Password");
mi.position = 2000050007;
mi.icolibItem = GetIconHandle(IDI_KEYS);
- m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi);
+ m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Roster editor"
- CreateProtoService("/RosterEditor", &CJabberProto::OnMenuHandleRosterControl);
- mir_strcpy(tDest, "/RosterEditor");
+ mi.pszService = "/RosterEditor";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleRosterControl);
mi.name.a = LPGEN("Roster editor");
mi.position = 2000050009;
mi.icolibItem = GetIconHandle(IDI_AGENTS);
- m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi);
+ m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "XML Console"
- CreateProtoService("/XMLConsole", &CJabberProto::OnMenuHandleConsole);
- mir_strcpy(tDest, "/XMLConsole");
+ mi.pszService = "/XMLConsole";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleConsole);
mi.name.a = LPGEN("XML Console");
mi.position = 2000050010;
mi.icolibItem = GetIconHandle(IDI_CONSOLE);
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/Notes", &CJabberProto::OnMenuHandleNotes);
- mir_strcpy(tDest, "/Notes");
+ mi.pszService = "/Notes";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleNotes);
mi.name.a = LPGEN("Notes");
mi.position = 2000050011;
mi.icolibItem = GetIconHandle(IDI_NOTES);
- m_hMenuNotes = Menu_AddProtoMenuItem(&mi);
+ m_hMenuNotes = Menu_AddProtoMenuItem(&mi, m_szModuleName);
BuildPrivacyMenu();
if (m_menuItemsStatus)
@@ -693,6 +689,7 @@ void CJabberProto::MenuInit()
m_priorityMenuVal = 0;
m_priorityMenuValSet = false;
+ mi.pszService = NULL;
mi.position = 200006;
mi.hParentMenu = hJabberRoot;
mi.name.a = LPGEN("Resource priority");
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 27b686607f..48b3900a8d 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -2098,8 +2098,8 @@ void CJabberProto::BuildPrivacyMenu()
mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName);
m_hPrivacyMenuRoot = Menu_AddProtoMenuItem(&mi);
- CreateProtoService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
mi.pszService = "/PrivacyLists";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandlePrivacyLists);
mi.position = 3000040000;
mi.flags = CMIF_TCHAR;
mi.icolibItem = GetIconHandle(IDI_PRIVACY_LISTS);
@@ -2118,7 +2118,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
mir_cslock lck(m_privacyListManager.m_cs);
- char srvFce[MAX_PATH + 64], *svcName = srvFce + mir_strlen(m_szModuleName);
+ char srvFce[MAX_PATH + 64];
CLISTMENUITEM mi = { 0 };
mi.position = 2000040000;
@@ -2127,22 +2127,22 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
mi.pszService = srvFce;
int i = 0;
- mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "/menuPrivacy%d", i);
if (i > m_privacyMenuServiceAllocated) {
- CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
+ CreateProtoServiceParam(srvFce, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
}
mi.position++;
mi.icolibItem = Skin_GetIconHandle(m_privacyListManager.GetActiveListName() ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
mi.name.t = LPGENT("<none>");
- m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi));
+ m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) {
i++;
- mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "/menuPrivacy%d", i);
if (i > m_privacyMenuServiceAllocated) {
- CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
+ CreateProtoServiceParam(srvFce, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
}
@@ -2150,6 +2150,6 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
mi.icolibItem = Skin_GetIconHandle(
mir_tstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
mi.name.t = pList->GetListName();
- m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi));
+ m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
}
}
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 7e1cd47ed0..93aad6d7e3 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -463,7 +463,7 @@ void CPepGuiService::RebuildMenu()
return;
char szService[128];
- mir_snprintf(szService, "%s/AdvStatusSet/%s", m_proto->m_szModuleName, m_name);
+ mir_snprintf(szService, "/AdvStatusSet/%s", m_name);
CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hJabberRoot;
@@ -472,7 +472,7 @@ void CPepGuiService::RebuildMenu()
mi.flags = CMIF_TCHAR | CMIF_HIDDEN;
mi.icolibItem = m_hIcolibItem;
mi.name.t = m_szText ? m_szText : _T("<advanced status slot>");
- m_hMenuItem = Menu_AddProtoMenuItem(&mi);
+ m_hMenuItem = Menu_AddProtoMenuItem(&mi, m_proto->m_szModuleName);
}
bool CPepGuiService::LaunchSetGui(BYTE bQuiet)
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index a70494628c..334d51c66f 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -268,10 +268,6 @@ INT_PTR CMsnProto::SetNicknameUI(WPARAM, LPARAM)
void CMsnProto::MsnInitMainMenu(void)
{
- char servicefunction[100];
- mir_strcpy(servicefunction, m_szModuleName);
- char* tDest = servicefunction + mir_strlen(servicefunction);
-
CLISTMENUITEM mi = { 0 };
HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName);
@@ -289,44 +285,43 @@ void CMsnProto::MsnInitMainMenu(void)
mi.flags = 0;
mi.hParentMenu = hRoot;
- mi.pszService = servicefunction;
#ifdef OBSOLETE
- mir_strcpy(tDest, MS_SET_NICKNAME_UI);
- CreateProtoService(MS_SET_NICKNAME_UI, &CMsnProto::SetNicknameUI);
+ mi.pszService = MS_SET_NICKNAME_UI;
+ CreateProtoService(mi.pszService, &CMsnProto::SetNicknameUI);
mi.position = 201001;
mi.icolibItem = GetIconHandle(IDI_MSN);
mi.name.a = LPGEN("Set &Nickname");
- menuItemsMain[0] = Menu_AddProtoMenuItem(&mi);
+ menuItemsMain[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
#endif
- mir_strcpy(tDest, MSN_INVITE);
- CreateProtoService(MSN_INVITE, &CMsnProto::MsnInviteCommand);
+ mi.pszService = MSN_INVITE;
+ CreateProtoService(mi.pszService, &CMsnProto::MsnInviteCommand);
mi.position = 201002;
mi.icolibItem = GetIconHandle(IDI_INVITE);
mi.name.a = LPGEN("Create &Chat");
- menuItemsMain[0] = Menu_AddProtoMenuItem(&mi);
+ menuItemsMain[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_strcpy(tDest, MS_GOTO_INBOX);
- CreateProtoService(MS_GOTO_INBOX, &CMsnProto::MsnGotoInbox);
+ mi.pszService = MS_GOTO_INBOX;
+ CreateProtoService(mi.pszService, &CMsnProto::MsnGotoInbox);
mi.position = 201003;
mi.icolibItem = GetIconHandle(IDI_INBOX);
mi.name.a = LPGEN("Display &Hotmail Inbox");
- menuItemsMain[1] = Menu_AddProtoMenuItem(&mi);
+ menuItemsMain[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_strcpy(tDest, MS_EDIT_PROFILE);
- CreateProtoService(MS_EDIT_PROFILE, &CMsnProto::MsnEditProfile);
+ mi.pszService = MS_EDIT_PROFILE;
+ CreateProtoService(mi.pszService, &CMsnProto::MsnEditProfile);
mi.position = 201004;
mi.icolibItem = GetIconHandle(IDI_PROFILE);
mi.name.a = LPGEN("View &Profile");
- menuItemsMain[2] = Menu_AddProtoMenuItem(&mi);
+ menuItemsMain[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_strcpy(tDest, MS_EDIT_ALERTS);
- CreateProtoService(MS_EDIT_ALERTS, &CMsnProto::MsnSetupAlerts);
+ mi.pszService = MS_EDIT_ALERTS;
+ CreateProtoService(mi.pszService, &CMsnProto::MsnSetupAlerts);
mi.position = 201004;
mi.icolibItem = GetIconHandle(IDI_PROFILE);
mi.name.a = LPGEN("Setup Live &Alerts");
- menuItemsMain[3] = Menu_AddProtoMenuItem(&mi);
+ menuItemsMain[3] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
MSN_EnableMenuItems(m_iStatus >= ID_STATUS_ONLINE);
}
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp
index d3b5f9b130..15700ec21a 100644
--- a/protocols/SkypeWeb/src/skype_menus.cpp
+++ b/protocols/SkypeWeb/src/skype_menus.cpp
@@ -108,39 +108,25 @@ void CSkypeProto::UninitMenus()
int CSkypeProto::OnInitStatusMenu()
{
- char text[MAX_PATH];
- mir_strcpy(text, m_szModuleName);
- char *tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
- HGENMENU hStatusMunuRoot = Menu_GetProtocolRoot(m_szModuleName);
- if (!hStatusMunuRoot)
+ HGENMENU hStatusMenuRoot = Menu_GetProtocolRoot(m_szModuleName);
+ if (!hStatusMenuRoot)
{
+ CLISTMENUITEM mi = { 0 };
mi.name.t = m_tszUserName;
mi.position = -1999901006;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.icolibItem = Skin_GetIconHandle("main");
- hStatusMunuRoot = /*m_hMenuRoot = */Menu_AddProtoMenuItem(&mi);
+ hStatusMenuRoot = Menu_AddProtoMenuItem(&mi);
}
- /*else
- {
- if (m_hMenuRoot)
- Menu_RemoveItem(m_hMenuRoot, 0);
- m_hMenuRoot = NULL;
- }*/
- mi.hParentMenu = hStatusMunuRoot;
- mi.flags = CMIF_TCHAR;
-
+ CLISTMENUITEM mi = { 0 };
+ mi.hParentMenu = hStatusMenuRoot;
- mir_strcpy(tDest, "/CreateNewChat");
- CreateProtoService(tDest, &CSkypeProto::SvcCreateChat);
- mi.name.t = LPGENT("Create new chat");
+ mi.pszService = "/CreateNewChat";
+ CreateProtoService(mi.pszService, &CSkypeProto::SvcCreateChat);
+ mi.name.a = LPGEN("Create new chat");
mi.position = SMI_POSITION + SMI_CREATECHAT;
mi.icolibItem = GetIconHandle("conference");
- Menu_AddProtoMenuItem(&mi);
-
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
return 0;
} \ No newline at end of file
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp
index 13fbb9fddd..5ec4a180b1 100644
--- a/protocols/Steam/src/steam_menus.cpp
+++ b/protocols/Steam/src/steam_menus.cpp
@@ -96,15 +96,9 @@ int CSteamProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
void CSteamProto::OnInitStatusMenu()
{
- char text[200];
- mir_strncpy(text, m_szModuleName, 100);
- char* tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
HGENMENU hSteamRoot = Menu_GetProtocolRoot(m_szModuleName);
if (!hSteamRoot) {
+ CLISTMENUITEM mi = { 0 };
mi.name.t = m_tszUserName;
mi.position = -1999901006;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
@@ -115,16 +109,15 @@ void CSteamProto::OnInitStatusMenu()
m_hMenuRoot = NULL;
}
+ CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hSteamRoot;
- mi.flags = CMIF_TCHAR;
// Show block list
- mir_strcpy(tDest, "/BlockList");
- CreateProtoService(tDest, &CSteamProto::OpenBlockListCommand);
+ mi.pszService = "/BlockList";
+ CreateProtoService(mi.pszService, &CSteamProto::OpenBlockListCommand);
mi.name.t = LPGENT("Blocked contacts");
mi.position = 200000 + SMI_BLOCKED_LIST;
- //mi.icolibItem = NULL;
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
void CSteamProto::InitMenus()
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index b023a668ba..fd99f26022 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -76,41 +76,35 @@ void CToxProto::UninitMenus()
int CToxProto::OnInitStatusMenu()
{
- char text[MAX_PATH];
- mir_strcpy(text, m_szModuleName);
- char *tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
- HGENMENU hStatusMunuRoot = Menu_GetProtocolRoot(m_szModuleName);
- if (!hStatusMunuRoot)
+ HGENMENU hStatusMenuRoot = Menu_GetProtocolRoot(m_szModuleName);
+ if (!hStatusMenuRoot)
{
+ CLISTMENUITEM mi = { 0 };
mi.name.t = m_tszUserName;
mi.position = -1999901006;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.icolibItem = Skin_GetIconHandle("main");
- hStatusMunuRoot = Menu_AddProtoMenuItem(&mi);
+ hStatusMenuRoot = Menu_AddProtoMenuItem(&mi);
}
- mi.hParentMenu = hStatusMunuRoot;
- mi.flags = CMIF_TCHAR;
+ CLISTMENUITEM mi = { 0 };
+ mi.hParentMenu = hStatusMenuRoot;
// Create copy tox id command
- mir_strcpy(tDest, "/CopyToxID");
- CreateProtoService(tDest, &CToxProto::OnCopyToxID);
+ mi.pszService = "/CopyToxID";
+ CreateProtoService(mi.pszService, &CToxProto::OnCopyToxID);
mi.name.t = LPGENT("Copy Tox ID");
mi.position = SMI_POSITION + SMI_TOXID_COPY;
- Menu_AddProtoMenuItem(&mi);
-
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Create group chat command
- /*mir_strcpy(tDest, "/CreateChatRoom");
- CreateProtoService(tDest, &CToxProto::OnCreateChatRoom);
+ /*
+ mi.pszService = "/CreateChatRoom";
+ CreateProtoService(mi.pszService, &CToxProto::OnCreateChatRoom);
mi.name.t = LPGENT("Create group chat");
mi.position = SMI_POSITION + SMI_GROUPCHAT_CREATE;
mi.icolibItem = Skin_GetIconHandle("conference");
- HGENMENU hCreateChatRoom = Menu_AddProtoMenuItem(&mi);*/
+ HGENMENU hCreateChatRoom = Menu_AddProtoMenuItem(&mi, m_szModuleName);*/
return 0;
} \ No newline at end of file
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index c342ba326a..1ab461cc26 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -191,43 +191,39 @@ void CVkProto::InitMenus()
CreateProtoService(PS_SETSTATUSMSG, &CVkProto::SvcSetStatusMsg);
CreateProtoService(PS_WALLPOST, &CVkProto::SvcWallPost);
- char szService[100];
-
CLISTMENUITEM mi = { 0 };
- mi.pszService = szService;
+ mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName);
// Proto menu
- mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName);
-
- mir_snprintf(szService, "%s%s", m_szModuleName, PS_CREATECHAT);
+ mi.pszService = PS_CREATECHAT;
mi.position = 10009 + PMI_CREATECHAT;
mi.icolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN);
mi.name.a = LPGEN("Create new chat");
- g_hProtoMenuItems[PMI_CREATECHAT] = Menu_AddProtoMenuItem(&mi);
+ g_hProtoMenuItems[PMI_CREATECHAT] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_snprintf(szService, "%s%s", m_szModuleName, PS_SETSTATUSMSG);
+ mi.pszService = PS_SETSTATUSMSG;
mi.position = 10009 + PMI_SETSTATUSMSG;
mi.icolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_STATUS));
mi.name.a = LPGEN("Status message");
- g_hProtoMenuItems[PMI_SETSTATUSMSG] = Menu_AddProtoMenuItem(&mi);
+ g_hProtoMenuItems[PMI_SETSTATUSMSG] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_snprintf(szService, "%s%s", m_szModuleName, PS_WALLPOST);
+ mi.pszService = PS_WALLPOST;
mi.position = 10009 + PMI_WALLPOST;
mi.icolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL));
mi.name.a = LPGEN("Send message to my wall");
- g_hProtoMenuItems[PMI_WALLPOST] = Menu_AddProtoMenuItem(&mi);
+ g_hProtoMenuItems[PMI_WALLPOST] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_snprintf(szService, "%s%s", m_szModuleName, PS_LOADVKNEWS);
+ mi.pszService = PS_LOADVKNEWS;
mi.position = 10009 + PMI_LOADVKNEWS;
mi.icolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
mi.name.a = LPGEN("Load news from VK");
- g_hProtoMenuItems[PMI_LOADVKNEWS] = Menu_AddProtoMenuItem(&mi);
+ g_hProtoMenuItems[PMI_LOADVKNEWS] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mir_snprintf(szService, "%s%s", m_szModuleName, PS_VISITPROFILE);
+ mi.pszService = PS_VISITPROFILE;
mi.position = 10009 + PMI_VISITPROFILE;
mi.icolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_VISITPROFILE));
mi.name.a = LPGEN("Visit profile");
- g_hProtoMenuItems[PMI_VISITPROFILE] = Menu_AddProtoMenuItem(&mi);
+ g_hProtoMenuItems[PMI_VISITPROFILE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Contact Menu Items
mi.hParentMenu = NULL;
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp
index 4595692cc7..b5fe0ad6b5 100644
--- a/protocols/WhatsApp/src/theme.cpp
+++ b/protocols/WhatsApp/src/theme.cpp
@@ -47,15 +47,9 @@ static WhatsAppProto* GetInstanceByHContact(MCONTACT hContact)
int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam)
{
- char text[200];
- mir_strcpy(text, m_szModuleName);
- char *tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hRoot == NULL) {
+ CLISTMENUITEM mi = { 0 };
mi.position = 500085000;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | (isOnline() ? 0 : CMIF_GRAYED);
mi.icolibItem = GetIconHandle("whatsApp");
@@ -69,16 +63,16 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam)
}
}
+ CLISTMENUITEM mi = { 0 };
mi.flags = (isOnline() ? 0 : CMIF_GRAYED);
mi.position = 201001;
- CreateProtoService("/CreateGroup", &WhatsAppProto::OnCreateGroup);
- mir_strcpy(tDest, "/CreateGroup");
+ mi.pszService = "/CreateGroup";
+ CreateProtoService(mi.pszService, &WhatsAppProto::OnCreateGroup);
mi.hParentMenu = hRoot;
mi.name.a = LPGEN("Create group");
mi.icolibItem = GetIconHandle("createGroup");
- m_hMenuCreateGroup = Menu_AddProtoMenuItem(&mi);
-
+ m_hMenuCreateGroup = Menu_AddProtoMenuItem(&mi, m_szModuleName);
return 0;
}
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index f9ea13afd1..d534f092d1 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -358,12 +358,7 @@ INT_PTR __cdecl CYahooProto::GetUnreadEmailCount(WPARAM, LPARAM)
void CYahooProto::MenuMainInit(void)
{
- char servicefunction[100];
- mir_strcpy(servicefunction, m_szModuleName);
- char* tDest = servicefunction + mir_strlen(servicefunction);
-
CLISTMENUITEM mi = { 0 };
- mi.pszService = servicefunction;
HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hRoot == NULL) {
@@ -384,66 +379,60 @@ void CYahooProto::MenuMainInit(void)
mi.hParentMenu = hRoot;
// Show custom status menu
- mir_strcpy(tDest, YAHOO_SET_CUST_STAT);
- CreateProtoService(YAHOO_SET_CUST_STAT, &CYahooProto::SetCustomStatCommand);
-
+ mi.pszService = YAHOO_SET_CUST_STAT;
+ CreateProtoService(mi.pszService, &CYahooProto::SetCustomStatCommand);
mi.position = 290000;
mi.icolibItem = GetIconHandle(IDI_SET_STATUS);
mi.name.a = LPGEN("Set &Custom Status");
-
- menuItemsAll[0] = Menu_AddProtoMenuItem(&mi);
+ menuItemsAll[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Edit My profile
- mir_strcpy(tDest, YAHOO_EDIT_MY_PROFILE);
- CreateProtoService(YAHOO_EDIT_MY_PROFILE, &CYahooProto::OnEditMyProfile);
-
+ mi.pszService = YAHOO_EDIT_MY_PROFILE;
+ CreateProtoService(mi.pszService, &CYahooProto::OnEditMyProfile);
mi.position = 290005;
mi.icolibItem = GetIconHandle(IDI_PROFILE);
mi.name.a = LPGEN("&Edit My Profile");
- menuItemsAll[1] = Menu_AddProtoMenuItem(&mi);
+ menuItemsAll[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Show My profile
- mir_strcpy(tDest, YAHOO_SHOW_MY_PROFILE);
- CreateProtoService(YAHOO_SHOW_MY_PROFILE, &CYahooProto::OnShowMyProfileCommand);
-
+ mi.pszService = YAHOO_SHOW_MY_PROFILE;
+ CreateProtoService(mi.pszService, &CYahooProto::OnShowMyProfileCommand);
mi.position = 290006;
mi.icolibItem = GetIconHandle(IDI_PROFILE);
mi.name.a = LPGEN("&My Profile");
- menuItemsAll[2] = Menu_AddProtoMenuItem(&mi);
+ menuItemsAll[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Show Yahoo mail
- mir_strcpy(tDest, YAHOO_YAHOO_MAIL);
- CreateProtoService(YAHOO_YAHOO_MAIL, &CYahooProto::OnGotoMailboxCommand);
-
+ mi.pszService = YAHOO_YAHOO_MAIL;
+ CreateProtoService(mi.pszService, &CYahooProto::OnGotoMailboxCommand);
mi.position = 290010;
mi.icolibItem = GetIconHandle(IDI_INBOX);
mi.name.a = LPGEN("&Yahoo Mail");
- menuItemsAll[3] = Menu_AddProtoMenuItem(&mi);
+ menuItemsAll[3] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Show Address Book
- mir_strcpy(tDest, YAHOO_AB);
- CreateProtoService(YAHOO_AB, &CYahooProto::OnABCommand);
-
+ mi.pszService = YAHOO_AB;
+ CreateProtoService(mi.pszService, &CYahooProto::OnABCommand);
mi.position = 290015;
mi.icolibItem = GetIconHandle(IDI_YAB);
mi.name.a = LPGEN("&Address Book");
- menuItemsAll[4] = Menu_AddProtoMenuItem(&mi);
+ menuItemsAll[4] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Show Calendar
- mir_strcpy(tDest, YAHOO_CALENDAR);
- CreateProtoService(YAHOO_CALENDAR, &CYahooProto::OnCalendarCommand);
-
+ mi.pszService = YAHOO_CALENDAR;
+ CreateProtoService(mi.pszService, &CYahooProto::OnCalendarCommand);
mi.position = 290017;
mi.icolibItem = GetIconHandle(IDI_CALENDAR);
mi.name.a = LPGEN("&Calendar");
- menuItemsAll[5] = Menu_AddProtoMenuItem(&mi);
- mir_strcpy(tDest, "/JoinChatRoom");
- CreateProtoService("/JoinChatRoom", &CYahooProto::CreateConference);
+ menuItemsAll[5] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ // Join chatroom
+ mi.pszService = "/JoinChatRoom";
+ CreateProtoService(mi.pszService, &CYahooProto::CreateConference);
mi.position = 290018;
mi.icolibItem = GetIconHandle(IDI_YAHOO);
mi.name.a = LPGEN("Create Conference");
- menuItemsAll[6] = Menu_AddProtoMenuItem(&mi);
+ menuItemsAll[6] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
void CYahooProto::MenuContactInit(void)
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp
index 6d1e4ec605..0254b89e99 100644
--- a/src/mir_app/src/clistmenus.cpp
+++ b/src/mir_app/src/clistmenus.cpp
@@ -543,8 +543,12 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
return 0;
if (smep->custom) {
- if (smep->svc && *smep->svc)
- CallService(smep->svc, 0, (LPARAM)smep->hMenuItem);
+ if (smep->svc && *smep->svc) {
+ if (smep->szProto && *smep->svc == '/')
+ ProtoCallService(smep->szProto, smep->svc, 0, (LPARAM)smep->hMenuItem);
+ else
+ CallService(smep->svc, 0, (LPARAM)smep->hMenuItem);
+ }
return 0;
}
@@ -617,7 +621,7 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
if (smep != NULL) {
mir_free(smep->szProto);
mir_free(smep->svc);
- mir_free(&smep);
+ mir_free(smep);
}
return (0);