summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-12 18:34:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-12 18:34:10 +0000
commit627687a2d798a8fa4ecbe4578c75d93bf97f6da5 (patch)
treeee3aa1c8cd6352c935ae548951ad0467d0bc57f3 /protocols/JabberG
parent94299a59b85ed18ffcaadd7c857bea64fcc2864a (diff)
- fix for Jabber popup menu;
- all calls of MS_CLIST_GETCONTACTDISPLAYNAME are replaced with direct calls of CLIST_INTERFACE; - old unneeded function removed git-svn-id: http://svn.miranda-ng.org/main/trunk@4434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp39
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp2
-rw-r--r--protocols/JabberG/src/jabber_proto.h3
-rw-r--r--protocols/JabberG/src/jabber_std.cpp12
-rw-r--r--protocols/JabberG/src/version.h6
7 files changed, 26 insertions, 40 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index ff98ee0034..3f6e51a2aa 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -1408,7 +1408,7 @@ static void sttLogListHook(CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK* g
if (item != NULL) {
item->type = _T("conference");
HANDLE hContact = ppro->HContactFromJID(item->jid);
- item->name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ item->name = pcli->pfnGetContactDisplayName(hContact, 0);
ppro->AddEditBookmark(item);
}
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index cfd0bdc946..b0ab9625d2 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -138,7 +138,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hC
return;
if (cws->value.type == DBVT_DELETED) {
- TCHAR* nick = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_NOMYHANDLE | GCDNF_TCHAR);
+ TCHAR* nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE);
AddContactToRoster(item->jid, nick, item->group);
mir_free(nick);
return;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 869636f8f8..a7d5065054 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -310,7 +310,7 @@ void g_MenuInit(void)
mi.pszService = "Jabber/ResourceSelectorDummySvc";
mi.pszName = LPGEN("Jabber Resource");
mi.position = -1999901011;
- mi.pszPopupName = (char *)-1;
+ mi.hParentMenu = HGENMENU_ROOT;
mi.icolibItem = g_GetIconHandle(IDI_JABBER);
g_hMenuResourcesRoot = Menu_AddContactMenuItem(&mi);
@@ -326,7 +326,6 @@ void g_MenuInit(void)
mi.pszService = "Jabber/UseResource_server";
mi.pszName = LPGEN("Server's Choice");
mi.position = -1999901000;
- mi.pszPopupName = (char *)g_hMenuResourcesRoot;
mi.icolibItem = g_GetIconHandle(IDI_NODE_SERVER);
g_hMenuResourcesServer = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_SERVER);
@@ -418,11 +417,16 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
Menu_ShowItem(g_hMenuResourcesRoot, TRUE);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_ICON|CMIM_FLAGS;
+ mi.flags = CMIM_ICON | CMIM_FLAGS;
mi.icolibItem = m_hProtoIcon;
Menu_ModifyItem(g_hMenuResourcesRoot, &mi);
+
+ mi.flags = CMIM_ICON | CMIM_FLAGS | ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
Menu_ModifyItem(g_hMenuResourcesActive, &mi);
+ mi.flags = CMIM_FLAGS | ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hMenuResourcesServer, &mi);
+
int nMenuResourceItemsNew = m_nMenuResourceItems;
if (m_nMenuResourceItems < item->resourceCount) {
m_phMenuResourceItems = (HGENMENU*)mir_realloc(m_phMenuResourceItems, item->resourceCount * sizeof(HGENMENU));
@@ -436,7 +440,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
mi.flags = CMIF_CHILDPOPUP;
mi.position = 0;
- mi.icolibItem = GetIconHandle(IDI_REQUEST);
+ mi.icolibItem = NULL;
mi.pszService = text;
mi.pszContactOwner = m_szModuleName;
@@ -447,7 +451,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
JCreateServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
mi.pszName = "";
mi.position = i;
- mi.pszPopupName = (char *)g_hMenuResourcesRoot;
+ mi.hParentMenu = g_hMenuResourcesRoot;
m_phMenuResourceItems[i] = Menu_AddContactMenuItem(&mi);
}
if (i < item->resourceCount) {
@@ -471,12 +475,6 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
else Menu_ShowItem(m_phMenuResourceItems[i], FALSE);
}
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(g_hMenuResourcesActive, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(g_hMenuResourcesServer, &mi);
-
m_nMenuResourceItems = nMenuResourceItemsNew;
}
@@ -621,25 +619,26 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM wParam, LPARAM)
INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM)
{
+ HANDLE hContact = (HANDLE)wParam;
+ if (!hContact)
+ return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
+
DBVARIANT dbv;
- if ( !wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- if ( !JGetStringT((HANDLE)wParam, "ChatRoomID", &dbv)) {
+ if ( !JGetStringT(hContact, "ChatRoomID", &dbv)) {
TCHAR *roomID = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
if (ListGetItemPtr(LIST_BOOKMARK, roomID) == NULL) {
TCHAR *nick = 0;
- if ( !JGetStringT((HANDLE)wParam, "Nick", &dbv)) {
+ if ( !JGetStringT(hContact, "Nick", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
- JABBER_LIST_ITEM* item = NULL;
-
- item = (JABBER_LIST_ITEM*)mir_alloc(sizeof(JABBER_LIST_ITEM));
- ZeroMemory(item, sizeof(JABBER_LIST_ITEM));
+
+ JABBER_LIST_ITEM *item = (JABBER_LIST_ITEM*)mir_calloc(sizeof(JABBER_LIST_ITEM));
item->jid = mir_tstrdup(roomID);
- item->name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR);
+ item->name = pcli->pfnGetContactDisplayName(hContact, 0);
item->type = _T("conference");
- if ( !JGetStringT((HANDLE)wParam, "MyNick", &dbv)) {
+ if ( !JGetStringT(hContact, "MyNick", &dbv)) {
item->nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 2e4e1bd282..90fa6ec363 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -1204,7 +1204,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis)
DrawNextRulePart(lpdis->hDC, clLine2, TranslateT("'"), &rc);
if (HANDLE hContact = m_proto->HContactFromJID(pRule->GetValue())) {
- TCHAR *szName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ TCHAR *szName = pcli->pfnGetContactDisplayName(hContact, 0);
if (szName) {
DrawNextRulePart(lpdis->hDC, clLine2, TranslateT(" (nickname: "), &rc);
DrawNextRulePart(lpdis->hDC, clLine1, szName, &rc);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 6810416685..0b898e90bd 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -797,9 +797,7 @@ struct CJabberProto : public PROTO_INTERFACE
HANDLE JForkThreadEx(JThreadFunc, void*, UINT* threadID = NULL);
void JDeleteSetting(HANDLE hContact, const char* valueName);
-// DWORD JGetByte(const char* valueName, int parDefltValue);
DWORD JGetByte(HANDLE hContact, const char* valueName, int parDefltValue);
- char* JGetContactName(HANDLE hContact);
DWORD JGetDword(HANDLE hContact, const char* valueName, DWORD parDefltValue);
int JGetStaticString(const char* valueName, HANDLE hContact, char* dest, int dest_len);
int JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv);
@@ -810,7 +808,6 @@ struct CJabberProto : public PROTO_INTERFACE
WORD JGetWord(HANDLE hContact, const char* valueName, int parDefltValue);
void JHookEvent(const char*, JEventFunc);
int JSendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
-// DWORD JSetByte(const char* valueName, int parValue);
DWORD JSetByte(HANDLE hContact, const char* valueName, int parValue);
DWORD JSetDword(HANDLE hContact, const char* valueName, DWORD parValue);
DWORD JSetString(HANDLE hContact, const char* valueName, const char* parValue);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index 373c0681f7..0c1a6625e1 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -70,22 +70,12 @@ void CJabberProto::JDeleteSetting(HANDLE hContact, const char* valueName)
{
db_unset(hContact, m_szModuleName, valueName);
}
-/*
-DWORD CJabberProto::JGetByte(const char* valueName, int parDefltValue)
-{
- return db_get_b(NULL, m_szModuleName, valueName, parDefltValue);
-}
-*/
+
DWORD CJabberProto::JGetByte(HANDLE hContact, const char* valueName, int parDefltValue)
{
return db_get_b(hContact, m_szModuleName, valueName, parDefltValue);
}
-char* __stdcall JGetContactName(HANDLE hContact)
-{
- return (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), 0);
-}
-
DWORD CJabberProto::JGetDword(HANDLE hContact, const char* valueName, DWORD parDefltValue)
{
return db_get_dw(hContact, m_szModuleName, valueName, parDefltValue);
diff --git a/protocols/JabberG/src/version.h b/protocols/JabberG/src/version.h
index cf7a422dc2..2efdeac444 100644
--- a/protocols/JabberG/src/version.h
+++ b/protocols/JabberG/src/version.h
@@ -1,3 +1,3 @@
-#define __FILEVERSION_STRING 0,11,0,1
-#define __VERSION_STRING "0.11.0.1"
-#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0,11,0,1)
+#define __FILEVERSION_STRING 0,11,0,2
+#define __VERSION_STRING "0.11.0.2"
+#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0,11,0,2)