summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-20 13:23:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-20 13:23:20 +0000
commitd7382326906b9f3bdd66704dd1b41f9299c1daa6 (patch)
treeccc0696d8ec511b4894cf2b20971b9f7fc625689 /protocols/Gadu-Gadu
parent874cdbe42cfe376f0e72fd5fe6bad0d2f75f4ee3 (diff)
protocol helper for detecting chats: isChatRoom
git-svn-id: http://svn.miranda-ng.org/main/trunk@5428 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp2
4 files changed, 14 insertions, 15 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 03d23031ed..63b5c14735 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -1293,14 +1293,11 @@ void GGPROTO::broadcastnewstatus(int newStatus)
int GGPROTO::contactdeleted(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE) wParam;
- uin_t uin; int type;
- DBVARIANT dbv;
-
- uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
- type = getByte(hContact, "ChatRoom", 0);
+ uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
// Terminate conference if contact is deleted
- if (type && !getTString(hContact, "ChatRoomID", &dbv) && gc_enabled)
+ DBVARIANT dbv;
+ if ( isChatRoom(hContact) && !getTString(hContact, "ChatRoomID", &dbv) && gc_enabled)
{
GCDEST gcdest = {0};
gcdest.pszModule = m_szModuleName;
@@ -1378,8 +1375,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam)
// Groupchat window contact is being renamed
DBVARIANT dbv;
- int type = getByte(hContact, "ChatRoom", 0);
- if (type && !getTString(hContact, "ChatRoomID", &dbv))
+ if (isChatRoom(hContact) && !getTString(hContact, "ChatRoomID", &dbv))
{
// Most important... check redundancy (fucking cascading)
static int cascade = 0;
@@ -1561,7 +1557,7 @@ HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
#endif
// Look for contact in DB
for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if ((uin_t)getDword(hContact, GG_KEY_UIN, 0) == uin && !getByte(hContact, "ChatRoom", 0)) {
+ if ((uin_t)getDword(hContact, GG_KEY_UIN, 0) == uin && !isChatRoom(hContact)) {
if (inlist) {
db_unset(hContact, "CList", "NotOnList");
db_unset(hContact, "CList", "Hidden");
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 55d531e6af..ffc5c96f4e 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -907,9 +907,13 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
int GGPROTO::details_init(WPARAM wParam, LPARAM lParam)
{
- char* szProto = GetContactProto((HANDLE)lParam);
- if ((szProto == NULL || strcmp(szProto, m_szModuleName)) && lParam || lParam && db_get_b((HANDLE)lParam, m_szModuleName, "ChatRoom", 0))
- return 0;
+ HANDLE hContact = (HANDLE)lParam;
+ char* szProto = GetContactProto(hContact);
+ if (szProto == NULL)
+ return 0;
+
+ if (hContact && (strcmp(szProto, m_szModuleName) || isChatRoom(hContact)))
+ return 0;
// Here goes init
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 697ab3d8e0..836384139c 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -234,8 +234,7 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam)
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_TCHAR;
if ( gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) ||
- gg->getByte(hContact, "ChatRoom", 0) ||
- db_get_b(hContact, "CList", "NotOnList", 0))
+ gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
mi.flags |= CMIF_HIDDEN;
mi.ptszName = gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block");
Menu_ModifyItem(gg->hBlockMenuItem, &mi);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index d6b2e84afd..d19d5abaea 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -102,7 +102,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
// Readup contacts
for (HANDLE hContact = db_find_first(gg->m_szModuleName); hContact; hContact = db_find_next(hContact, gg->m_szModuleName)) {
- if (gg->getByte(hContact, "ChatRoom", 0))
+ if (gg->isChatRoom(hContact))
continue;
// Readup FirstName