summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_menu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-20 14:23:07 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-20 14:23:07 +0000
commit5e4286f1becfb5ce52372f882a51ae8ea6f6ef6d (patch)
tree60e5dc3d3fa347ba34e1447e6b6e925c0e33c29b /protocols/JabberG/src/jabber_menu.cpp
parentd7382326906b9f3bdd66704dd1b41f9299c1daa6 (diff)
- Jabber resource fix: in LAST_SEEN mode resource is skipped when no sessions were available;
- code cleanup; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@5429 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_menu.cpp')
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 9390b7317e..e4bc58399b 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -355,8 +355,8 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
if ((hContact=(HANDLE)wParam) == NULL)
return 0;
- BYTE bIsChatRoom = (BYTE)getByte(hContact, "ChatRoom", 0);
- BYTE bIsTransport = (BYTE)getByte(hContact, "IsTransport", 0);
+ bool bIsChatRoom = isChatRoom(hContact);
+ bool bIsTransport = getBool(hContact, "IsTransport", false);
if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
if ( !getTString(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
@@ -484,15 +484,17 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM wParam, LPARAM)
{
- BYTE bIsChatRoom = (BYTE)getByte((HANDLE) wParam, "ChatRoom", 0);
- if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
- DBVARIANT dbv;
- if ( !getTString((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
- delSetting((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?"ChatRoomID":"jid");
- setTString((HANDLE) wParam, (bIsChatRoom != GCW_CHATROOM)?"ChatRoomID":"jid", dbv.ptszVal);
- db_free(&dbv);
- setByte((HANDLE) wParam, "ChatRoom", (bIsChatRoom == GCW_CHATROOM)?0:GCW_CHATROOM);
- } }
+ HANDLE hContact = (HANDLE)wParam;
+ BYTE bIsChatRoom = isChatRoom(hContact);
+ const char *szSetting = (bIsChatRoom) ? "ChatRoomID" : "jid";
+
+ DBVARIANT dbv;
+ if ( !getTString(hContact, szSetting, &dbv)) {
+ delSetting(hContact, szSetting);
+ setTString(hContact, szSetting, dbv.ptszVal);
+ db_free(&dbv);
+ setByte(hContact, "ChatRoom", !bIsChatRoom);
+ }
return 0;
}
@@ -1053,22 +1055,22 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
}
- if (bSupportTyping && !getTString(event->hContact, "jid", &dbv)) {
- TCHAR jid[ JABBER_MAX_JID_LEN ];
- GetClientJID(dbv.ptszVal, jid, SIZEOF(jid));
- db_free(&dbv);
+ if (!bSupportTyping)
+ return 0;
+ TCHAR jid[JABBER_MAX_JID_LEN];
+ if ( GetClientJID(event->hContact, jid, SIZEOF(jid))) {
JABBER_RESOURCE_STATUS *r = ResourceInfoFromJID(jid);
-
if (r && r->bMessageSessionActive) {
r->bMessageSessionActive = FALSE;
- JabberCapsBits jcb = GetResourceCapabilites(jid, TRUE);
- if (jcb & JABBER_CAPS_CHATSTATES)
+ if (GetResourceCapabilites(jid, TRUE) & JABBER_CAPS_CHATSTATES)
m_ThreadInfo->send(
XmlNode(_T("message")) << XATTR(_T("to"), jid) << XATTR(_T("type"), _T("chat")) << XATTRID( SerialNext())
<< XCHILDNS(_T("gone"), _T(JABBER_FEAT_CHATSTATES)));
- } } }
+ }
+ }
+ }
return 0;
}