diff options
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_db_utils.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_disco.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_events.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_icolib.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 14 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_misc.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_privacy.cpp | 14 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_std.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_vcard.cpp | 16 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xstatus.cpp | 128 | ||||
-rw-r--r-- | protocols/JabberG/src/ui_utils.cpp | 4 |
18 files changed, 149 insertions, 84 deletions
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index f40352c2b4..b8e7a1f4d5 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -167,6 +167,8 @@ protected: #define WM_JABBER_ADD_TO_BOOKMARKS (WM_PROTO_LAST + 116)
#define WM_JABBER_REFRESH_VCARD (WM_PROTO_LAST + 117)
+#define STATUS_TITLE_MAX 16
+#define STATUS_DESC_MAX 64
// Error code
#define JABBER_ERROR_REDIRECT 302
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 6db767c192..76772609f9 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -388,7 +388,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM* item, int code, HXML reason) DBVARIANT dbvMessage;
if ( !DBGetContactSettingTString(NULL, m_szModuleName, "GcMsgQuit", &dbvMessage)) {
szMessage = NEWTSTR_ALLOCA(dbvMessage.ptszVal);
- DBFreeVariant(&dbvMessage);
+ db_free(&dbvMessage);
}
else szMessage = TranslateTS(JABBER_GC_MSG_QUIT);
}
@@ -399,7 +399,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM* item, int code, HXML reason) CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
}
- DBDeleteContactSetting(HContactFromJID(item->jid), "CList", "Hidden");
+ db_unset(HContactFromJID(item->jid), "CList", "Hidden");
item->bChatActive = FALSE;
if (m_bJabberOnline) {
@@ -1109,7 +1109,7 @@ static void sttNickListHook(CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK* << XCHILD(_T("body"), buf));
if (szMessage == dbv.ptszVal)
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
}
diff --git a/protocols/JabberG/src/jabber_db_utils.h b/protocols/JabberG/src/jabber_db_utils.h index 4b09bac744..60becf5ad9 100644 --- a/protocols/JabberG/src/jabber_db_utils.h +++ b/protocols/JabberG/src/jabber_db_utils.h @@ -145,7 +145,7 @@ public: if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, m_szSetting, &dbv))
{
result = dbv.ptszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return result;
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 8b37a6677d..b6322ea0c6 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -1461,7 +1461,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_ROSTER:
{
HANDLE hContact = DBCreateContact(pNode->GetJid(), pNode->GetName(), FALSE, FALSE);
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
JABBER_LIST_ITEM* item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid());
item->bUseResource = TRUE;
break;
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 2ac6da3a18..4af605937f 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -188,7 +188,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL SendGetVcard(jid.ptszVal);
mir_free(nick);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
db_free(&jid);
}
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 30f00fae86..84981edb0f 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -480,7 +480,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM wParam, LPARAM) return -1;
int iID = GetTransportProtoID(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (iID >= 0) {
WORD Status = ID_STATUS_OFFLINE;
Status = JGetWord(hContact, "Status", ID_STATUS_OFFLINE);
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 11052adb22..760267d5ee 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -606,13 +606,13 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) if (_tcscmp(nick, dbnick.ptszVal) != 0)
db_set_ts(hContact, "CList", "MyHandle", nick);
else
- DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ db_unset(hContact, "CList", "MyHandle");
db_free(&dbnick);
}
else db_set_ts(hContact, "CList", "MyHandle", nick);
}
- else DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ else db_unset(hContact, "CList", "MyHandle");
if ( !m_options.IgnoreRosterGroups)
{
@@ -621,7 +621,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) db_set_ts(hContact, "CList", "Group", item->group);
}
else
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
}
mir_free(nick);
@@ -642,7 +642,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) ListRemove(LIST_ROSTER, jid);
} }
else if (JGetByte(hContact, "ChatRoom", 0))
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
else
UpdateSubscriptionInfo(hContact, item);
} }
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 6d5988145c..b043e7fcb3 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -458,13 +458,13 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) if (lstrcmp(nick, dbNick.ptszVal) != 0)
db_set_ts(hContact, "CList", "MyHandle", nick);
else
- DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ db_unset(hContact, "CList", "MyHandle");
db_free(&dbNick);
}
else db_set_ts(hContact, "CList", "MyHandle", nick);
}
- else DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ else db_unset(hContact, "CList", "MyHandle");
if (JGetByte(hContact, "ChatRoom", 0)) {
GCSESSION gcw = {0};
@@ -481,7 +481,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
chatRooms.insert(hContact);
} else
{
@@ -502,7 +502,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) else db_set_ts(hContact, "CList", "Group", item->group);
}
else
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
if (hContact != NULL) {
@@ -1111,7 +1111,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) else {
char text[ 100 ];
sprintf(text, "e-mail%d", nEmail-1);
- if (DBGetContactSettingString(hContact, m_szModuleName, text, &dbv)) break;
+ if ( DBGetContactSettingString(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(hContact, text);
}
@@ -1122,7 +1122,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) while (true) {
char text[ 100 ];
sprintf(text, "e-mail%d", nEmail);
- if (DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
+ if ( DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(NULL, text);
sprintf(text, "e-mailFlag%d", nEmail);
@@ -1155,7 +1155,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) while (true) {
char text[ 100 ];
sprintf(text, "Phone%d", nPhone);
- if (DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
+ if ( DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(NULL, text);
sprintf(text, "PhoneFlag%d", nPhone);
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 3884a47568..ba6a104413 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -77,7 +77,7 @@ static void JabberContactListCreateClistGroup(TCHAR* groupName) for (i=0;;i++) {
_itoa(i, str, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if ( DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
break;
TCHAR* name = dbv.ptszVal;
if (name[0]!='\0' && !_tcscmp(name+1, groupName)) {
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 6e0b6537f0..4f2dd2060f 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1086,18 +1086,18 @@ void CJabberProto::_RosterHandleGetRequest(HXML node) DBVARIANT dbvtemp;
if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbvtemp)) {
name = mir_tstrdup(dbvtemp.ptszVal);
- DBFreeVariant(&dbvtemp);
+ db_free(&dbvtemp);
}
if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbvtemp)) {
group = mir_tstrdup(dbvtemp.ptszVal);
- DBFreeVariant(&dbvtemp);
+ db_free(&dbvtemp);
}
_RosterInsertListItem(hList, jid, name, group, NULL, FALSE);
if (jid) mir_free(jid);
if (name) mir_free(name);
if (group) mir_free(group);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 7c879920d3..c5754fcd0d 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -479,11 +479,11 @@ public: for (int i = 0; ; i++)
{
mir_snprintf(buf, 20, "%d", i);
- if (DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if ( DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
break;
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)&dbv.ptszVal[1]);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// FIXME: ugly code :)
@@ -1387,7 +1387,7 @@ bool CJabberDlgPrivacyLists::CListIsGroup(HANDLE hGroup) DBVARIANT dbv;
bool result = DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv) == 0;
if (result)
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return result;
}
@@ -1403,13 +1403,13 @@ HANDLE CJabberDlgPrivacyLists::CListFindGroupByName(TCHAR *name) {
_itoa(i, idstr, 10);
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if ( DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcscmp(dbv.ptszVal + 1, name))
hGroup = (HANDLE)(i+1);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return hGroup;
@@ -1610,7 +1610,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) char idstr[33];
_itoa(iGroup-1, idstr, 10);
DBVARIANT dbv = {0};
- if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if ( DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
hItem = m_clcClist.FindGroup((HANDLE)iGroup);
@@ -1621,7 +1621,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) if (dwPackets = CListGetPackets(hwndList, hItem, false))
pList->AddRule(Group, szJid, FALSE, dwOrder++, dwPackets);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
hItem = clc_info.hItemSubBoth;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index d74ca56df1..2a10f808a9 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -120,8 +120,7 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : JCreateService(PS_JOINCHAT, &CJabberProto::OnJoinChat);
JCreateService(PS_LEAVECHAT, &CJabberProto::OnLeaveChat);
- // not needed anymore and therefore commented out
- // JCreateService(PS_GETXSTATUSEX, &CJabberProto::OnGetXStatusEx);
+ JCreateService(PS_GETCUSTOMSTATUSEX, &CJabberProto::OnGetXStatusEx);
JCreateService(PS_SETCUSTOMSTATUSEX, &CJabberProto::OnSetXStatusEx);
JCreateService(PS_GETCUSTOMSTATUSICON, &CJabberProto::OnGetXStatusIcon);
JCreateService(PS_GETADVANCEDSTATUSICON, &CJabberProto::JGetAdvancedStatusIcon);
@@ -215,7 +214,6 @@ CJabberProto::~CJabberProto() {
WsUninit();
IqUninit();
- XStatusUninit();
SerialUninit();
ConsoleUninit();
GlobalMenuUninit();
@@ -503,7 +501,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent) if ((hContact = AddToListByJID(newJid, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
} } }
mir_free(newJid);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 5606a3bfd1..9ab3c99164 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -261,9 +261,6 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject JABBER_MODEMSGS m_modeMsgs;
BOOL m_bModeMsgStatusChangePending;
- HANDLE m_hHookExtraIconsRebuild;
- HANDLE m_hHookExtraIconsApply;
-
BOOL m_bChangeStatusMessageOnly;
BOOL m_bSendKeepAlive;
BOOL m_bPepSupported;
@@ -956,6 +953,7 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject INT_PTR __cdecl OnSetListeningTo(WPARAM wParam, LPARAM lParams);
INT_PTR __cdecl OnGetXStatusIcon(WPARAM wParam, LPARAM lParams);
+ INT_PTR __cdecl OnGetXStatusEx(WPARAM wParam, LPARAM lParams);
INT_PTR __cdecl OnSetXStatusEx(WPARAM wParam, LPARAM lParams);
HICON GetXStatusIcon(int bStatus, UINT flags);
@@ -969,7 +967,6 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject BOOL SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri);
void XStatusInit(void);
- void XStatusUninit(void);
void SetContactTune(HANDLE hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 376cb21bd1..8c0a8ac683 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -67,7 +67,7 @@ HANDLE CJabberProto::JForkThreadEx(JThreadFunc pFunc, void *param, UINT* threadI void CJabberProto::JDeleteSetting(HANDLE hContact, const char* valueName)
{
- DBDeleteContactSetting(hContact, m_szModuleName, valueName);
+ db_unset(hContact, m_szModuleName, valueName);
}
/*
DWORD CJabberProto::JGetByte(const char* valueName, int parDefltValue)
@@ -220,14 +220,14 @@ TCHAR* CJabberProto::JGetStringCrypt(HANDLE hContact, char *valueName) {
DBVARIANT dbv;
- if (DBGetContactSettingString(hContact, m_szModuleName, valueName, &dbv))
+ if ( DBGetContactSettingString(hContact, m_szModuleName, valueName, &dbv))
return NULL;
sttCryptString(dbv.pszVal);
WCHAR *res = mir_utf8decodeW(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 12bb41479a..e4c946a2ad 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -911,7 +911,7 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info) }
Log("Success: Logged-in.");
- if (DBGetContactSettingString(NULL, m_szModuleName, "Nick", &dbv))
+ if ( DBGetContactSettingString(NULL, m_szModuleName, "Nick", &dbv))
JSetStringT(NULL, "Nick", info->username);
else
db_free(&dbv);
@@ -1570,7 +1570,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) if (item->itemResource.statusMessage)
db_set_ts(hContact, "CList", "StatusMsg", item->itemResource.statusMessage);
else
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_unset(hContact, "CList", "StatusMsg");
}
// Determine status to show for the contact based on the remaining resources
@@ -1594,7 +1594,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) if (item->resource[nSelectedResource].statusMessage)
db_set_ts(hContact, "CList", "StatusMsg", item->resource[nSelectedResource].statusMessage);
else
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_unset(hContact, "CList", "StatusMsg");
UpdateMirVer(hContact, &item->resource[nSelectedResource]);
}
else JDeleteSetting(hContact, DBSETTING_DISPLAY_UID);
@@ -1799,7 +1799,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if ((hContact=AddToListByJID(from, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
} } }
RebuildInfoFrame();
}
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 70b4ee433c..2e6570dd3f 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -589,7 +589,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", dat->id);
- if (DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
} }
GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
@@ -663,7 +663,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
wsprintfA(idstr, "Phone%d", dat->id);
- if (DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
}
}
@@ -746,7 +746,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
wsprintfA(idstr, "e-mail%d", i);
- if (DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
@@ -765,7 +765,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
wsprintfA(idstr, "Phone%d", i);
- if (DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
@@ -872,7 +872,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP WORD nFlag;
wsprintfA(idstr, szIdTemplate, i+1);
- if (DBGetContactSettingString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( DBGetContactSettingString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintfA(idstr,szIdTemplate,i);
ppro->JSetString(NULL, idstr, dbv.pszVal);
wsprintfA(idstr, szFlagTemplate, i+1);
@@ -1020,7 +1020,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char* tag, char* key) return;
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, m_szModuleName, key, &dbv))
+ if ( DBGetContactSettingTString(NULL, m_szModuleName, key, &dbv))
n << XCHILD(_A2T(tag));
else {
n << XCHILD(_A2T(tag), dbv.ptszVal);
@@ -1057,7 +1057,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) for (i=0;;i++) {
wsprintfA(idstr, "e-mail%d", i);
- if (DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv))
+ if ( DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv))
break;
HXML e = v << XCHILD(_T("EMAIL"), dbv.ptszVal);
@@ -1105,7 +1105,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) for (i=0;;i++) {
wsprintfA(idstr, "Phone%d", i);
- if (DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv)) break;
+ if ( DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
n = v << XCHILD(_T("TEL"));
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 7a1d656cb7..b9b1a17e0a 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -1154,7 +1154,7 @@ void CPepActivity::ShowSetDialog(BYTE bQuiet) HICON CJabberProto::GetXStatusIcon(int bStatus, UINT flags)
{
- CPepMood *pepMood = (CPepMood *)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD));
+ CPepMood *pepMood = (CPepMood*)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD));
HICON icon = g_MoodIcons.GetIcon(g_arrMoods[bStatus].szTag, (flags & LR_BIGICON) != 0);
return (flags & LR_SHARED) ? icon : CopyIcon(icon);
}
@@ -1171,7 +1171,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam) return 0;
if ( !wParam)
- wParam = ((CPepMood *)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD)))->m_mode;
+ wParam = ((CPepMood*)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD)))->m_mode;
if (wParam < 1 || wParam >= SIZEOF(g_arrMoods))
return 0;
@@ -1341,28 +1341,101 @@ void CJabberProto::XStatusInit() RegisterAdvStatusSlot(ADVSTATUS_ACTIVITY);
}
-void CJabberProto::XStatusUninit()
-{
- if (m_hHookExtraIconsRebuild)
- UnhookEvent(m_hHookExtraIconsRebuild);
-
- if (m_hHookExtraIconsApply)
- UnhookEvent(m_hHookExtraIconsApply);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// JabberSetXStatus - sets the extended status info (mood)
-INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM wParam, LPARAM lParam)
+INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam)
{
+ if ( !m_bPepSupported || !m_bJabberOnline)
+ return 1;
+
CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam;
+ if (pData->cbSize < sizeof(CUSTOM_STATUS))
+ return 1;
+
+ CPepMood *pepMood = (CPepMood*)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD));
+ if (pepMood == NULL)
+ return 1;
+
+ HANDLE hContact = (HANDLE)wParam;
+
+ // fill status member
+ if (pData->flags & CSSF_MASK_STATUS)
+ *pData->status = pepMood->m_mode;
+
+ // fill status name member
+ if (pData->flags & CSSF_MASK_NAME) {
+ if (pData->flags & CSSF_DEFAULT_NAME) {
+ DWORD dwXStatus = (pData->wParam == NULL) ? pepMood->m_mode : *pData->wParam;
+ if (dwXStatus >= SIZEOF(g_arrMoods))
+ return 1;
+
+ if (pData->flags & CSSF_UNICODE)
+ lstrcpynW(pData->pwszName, g_arrMoods[dwXStatus].szName, (STATUS_TITLE_MAX+1));
+ else {
+ size_t dwStatusTitleSize = lstrlenW( g_arrMoods[dwXStatus].szName );
+ if (dwStatusTitleSize > STATUS_TITLE_MAX)
+ dwStatusTitleSize = STATUS_TITLE_MAX;
+
+ WideCharToMultiByte(CP_ACP, 0, g_arrMoods[dwXStatus].szName, (DWORD)dwStatusTitleSize, pData->pszName, MAX_PATH, NULL, NULL);
+ pData->pszName[dwStatusTitleSize] = 0;
+ }
+ }
+ else {
+ *pData->ptszName = 0;
+ if (pData->flags & CSSF_UNICODE) {
+ mir_ptr<TCHAR> title( ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
+ if (title)
+ _tcsncpy(pData->ptszName, title, STATUS_TITLE_MAX);
+ }
+ else {
+ mir_ptr<char> title( ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
+ if (title)
+ strncpy(pData->pszName, title, STATUS_TITLE_MAX);
+ }
+ }
+ }
+
+ // fill status message member
+ if (pData->flags & CSSF_MASK_MESSAGE) {
+ *pData->pszMessage = 0;
+ if (pData->flags & CSSF_UNICODE) {
+ mir_ptr<TCHAR> title( ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
+ if (title)
+ _tcsncpy(pData->ptszMessage, title, STATUS_TITLE_MAX);
+ }
+ else {
+ mir_ptr<char> title( ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
+ if (title)
+ strncpy(pData->pszMessage, title, STATUS_TITLE_MAX);
+ }
+ }
+
+ if (pData->flags & CSSF_DISABLE_UI)
+ if (pData->wParam)
+ *pData->wParam = true;
+
+ if (pData->flags & CSSF_STATUSES_COUNT)
+ if (pData->wParam)
+ *pData->wParam = SIZEOF(g_arrMoods);
+ if (pData->flags & CSSF_STR_SIZES) {
+ if (pData->wParam) *pData->wParam = STATUS_TITLE_MAX;
+ if (pData->lParam) *pData->lParam = STATUS_DESC_MAX;
+ }
+ return 0;
+}
+
+INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM wParam, LPARAM lParam)
+{
if ( !m_bPepSupported || !m_bJabberOnline)
return 1;
- if (pData->cbSize < sizeof(CUSTOM_STATUS)) return 1; // Failure
+ CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam;
+ if (pData->cbSize < sizeof(CUSTOM_STATUS))
+ return 1;
- CPepMood *pepMood = (CPepMood *)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD));
+ CPepMood *pepMood = (CPepMood*)m_pepServices.Find(_T(JABBER_FEAT_USER_MOOD));
int status = *pData->status;
if (status > 0 && status < SIZEOF(g_arrMoods)) {
@@ -1397,24 +1470,19 @@ void CJabberProto::RegisterAdvStatusSlot(const char *pszSlot) }
void CJabberProto::ResetAdvStatus(HANDLE hContact, const char *pszSlot)
-{ // set empty text before DBDeleteContactSetting to make resident setting manager happy
+{
char szSetting[128];
-
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/id", m_szModuleName, pszSlot);
- db_set_s(hContact, "AdvStatus", szSetting, "");
- DBDeleteContactSetting(hContact, "AdvStatus", szSetting);
+ db_unset(hContact, "AdvStatus", szSetting);
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/icon", m_szModuleName, pszSlot);
- db_set_s(hContact, "AdvStatus", szSetting, "");
- DBDeleteContactSetting(hContact, "AdvStatus", szSetting);
+ db_unset(hContact, "AdvStatus", szSetting);
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/title", m_szModuleName, pszSlot);
- db_set_s(hContact, "AdvStatus", szSetting, "");
- DBDeleteContactSetting(hContact, "AdvStatus", szSetting);
+ db_unset(hContact, "AdvStatus", szSetting);
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/text", m_szModuleName, pszSlot);
- db_set_s(hContact, "AdvStatus", szSetting, "");
- DBDeleteContactSetting(hContact, "AdvStatus", szSetting);
+ db_unset(hContact, "AdvStatus", szSetting);
}
void CJabberProto::WriteAdvStatus(HANDLE hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText)
@@ -1434,9 +1502,9 @@ void CJabberProto::WriteAdvStatus(HANDLE hContact, const char *pszSlot, const TC if (pszText)
db_set_ts(hContact, "AdvStatus", szSetting, pszText);
else {
- // set empty text before DBDeleteContactSetting to make resident setting manager happy
+ // set empty text before db_unset to make resident setting manager happy
db_set_s(hContact, "AdvStatus", szSetting, "");
- DBDeleteContactSetting(hContact, "AdvStatus", szSetting);
+ db_unset(hContact, "AdvStatus", szSetting);
}
}
@@ -1446,11 +1514,11 @@ char *CJabberProto::ReadAdvStatusA(HANDLE hContact, const char *pszSlot, const c mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
DBVARIANT dbv;
- if (DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
+ if ( DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
return NULL;
char *res = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
}
@@ -1460,11 +1528,11 @@ TCHAR *CJabberProto::ReadAdvStatusT(HANDLE hContact, const char *pszSlot, const mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
DBVARIANT dbv;
- if (DBGetContactSettingTString(hContact, "AdvStatus", szSetting, &dbv))
+ if ( DBGetContactSettingTString(hContact, "AdvStatus", szSetting, &dbv))
return NULL;
TCHAR *res = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
}
diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp index da8a4531f1..ac7bde98e0 100644 --- a/protocols/JabberG/src/ui_utils.cpp +++ b/protocols/JabberG/src/ui_utils.cpp @@ -2395,7 +2395,7 @@ CDbLink::~CDbLink() mir_free(m_szSetting);
mir_free(m_szDefault);
if (dbv.type != DBVT_DELETED)
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
DWORD CDbLink::LoadUnsigned()
@@ -2429,7 +2429,7 @@ void CDbLink::SaveInt(DWORD value) TCHAR* CDbLink::LoadText()
{
- if (dbv.type != DBVT_DELETED) DBFreeVariant(&dbv);
+ if (dbv.type != DBVT_DELETED) db_free(&dbv);
if ( !DBGetContactSettingTString(NULL, m_szModule, m_szSetting, &dbv))
{
if (dbv.type == DBVT_TCHAR)
|