summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-17 19:38:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-17 19:38:42 +0000
commitd0ceb5768ff3146499a0318ffe03c867c0845592 (patch)
tree984da5102d6a820e670323c47edd8187a37a0b33 /protocols
parent98ac258dc34b281e8441de847e37408c36c7415d (diff)
- numerous name conflicts resolved;
- funny code that loads resource #102 from miranda32.exe removed; - massive mir_sntprintf code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14979 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/src/jabber.cpp14
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp4
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp8
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp10
-rw-r--r--protocols/JabberG/src/jabber_caps.h2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp24
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp424
-rw-r--r--protocols/JabberG/src/jabber_file.cpp8
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp140
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp92
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp121
-rw-r--r--protocols/JabberG/src/jabber_iq.h2
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp5
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp8
-rw-r--r--protocols/JabberG/src/jabber_message_manager.h2
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp42
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp22
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp2
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp10
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp6
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp22
-rw-r--r--protocols/JabberG/src/jabber_send_manager.cpp2
-rw-r--r--protocols/JabberG/src/jabber_send_manager.h2
-rw-r--r--protocols/JabberG/src/jabber_std.cpp2
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp4
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp39
-rw-r--r--protocols/JabberG/src/jabber_treelist.cpp4
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp6
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp6
-rw-r--r--protocols/JabberG/src/jabber_ws.cpp2
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp10
-rw-r--r--protocols/JabberG/src/stdafx.h8
33 files changed, 534 insertions, 523 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 8065b8a0c4..360511ee12 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -68,7 +68,7 @@ HANDLE hExtListInit, hDiscoInfoResult;
void JabberUserInfoInit(void);
void JabberUserInfoUninit(void);
-int bSecureIM, bMirOTR, bNewGPG, bPlatform;
+bool bSecureIM, bMirOTR, bNewGPG, bPlatform;
/////////////////////////////////////////////////////////////////////////////
// Protocol instances
@@ -107,9 +107,9 @@ static int OnModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_TTB_MODULELOADED, g_OnToolbarInit);
- bSecureIM = (ServiceExists("SecureIM/IsContactSecured"));
- bMirOTR = (int)GetModuleHandle(_T("mirotr.dll"));
- bNewGPG = (int)GetModuleHandle(_T("new_gpg.dll"));
+ bSecureIM = ServiceExists("SecureIM/IsContactSecured") != 0;
+ bMirOTR = GetModuleHandle(_T("mirotr.dll")) != NULL;
+ bNewGPG = GetModuleHandle(_T("new_gpg.dll")) != NULL;
#ifdef _WIN64
bPlatform = 1;
#else
@@ -193,7 +193,7 @@ extern "C" int __declspec(dllexport) Load()
WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- mir_sntprintf(szCoreVersion, _countof(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
+ mir_sntprintf(szCoreVersion, _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
@@ -233,13 +233,13 @@ extern "C" int __declspec(dllexport) Unload(void)
if (g_nTempFileId != 0) {
TCHAR tszTempPath[MAX_PATH], tszFilePath[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
- mir_sntprintf(tszFilePath, _countof(tszFilePath), _T("%sjab*.tmp.*"), tszTempPath);
+ mir_sntprintf(tszFilePath, _T("%sjab*.tmp.*"), tszTempPath);
WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile(tszFilePath, &findData);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- mir_sntprintf(tszFilePath, _countof(tszFilePath), _T("%s%s"), tszTempPath, findData.cFileName);
+ mir_sntprintf(tszFilePath, _T("%s%s"), tszTempPath, findData.cFileName);
DeleteFile(tszFilePath);
} while (FindNextFile(hFind, &findData));
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index 043fd4a265..4d41574990 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
TCHAR Caption[512];
- mir_sntprintf(Caption, _countof(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else {
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
TCHAR Caption[512];
- mir_sntprintf(Caption, _countof(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index 3ebd23db99..1bdf32d6e9 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -94,7 +94,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
- mir_sntprintf(szPort, _countof(szPort), _T("%u"), connInfo.wPort);
+ mir_sntprintf(szPort, _T("%u"), connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
@@ -208,7 +208,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
if (localAddr == NULL)
localAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
- mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_BYTE, szPort);
item->jbt = jbt;
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -406,7 +406,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*)
int id = JabberGetPacketID(iqNode);
TCHAR listJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), id);
+ mir_sntprintf(listJid, _T("ftproxy_%d"), id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
if (item == NULL)
@@ -555,7 +555,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch
int iqId = SerialNext();
TCHAR listJid[256];
- mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), iqId);
+ mir_sntprintf(listJid, _T("ftproxy_%d"), iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 87f9036253..a8f5128281 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -201,7 +201,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
+ mir_sntprintf(szFullJid, _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
@@ -240,7 +240,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
TCHAR queryNode[512];
- mir_sntprintf(queryNode, _countof(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
+ mir_sntprintf(queryNode, _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(_T("node"), queryNode));
bRequestSent = TRUE;
@@ -517,7 +517,7 @@ BOOL CJabberClientCaps::SetPartialCaps(int nIqId, JabberCapsBits jcbCaps)
/////////////////////////////////////////////////////////////////////////////////////////
// CJabberClientCapsManager class
-CJabberClientCapsManager::CJabberClientCapsManager(CJabberProto* proto)
+CJabberClientCapsManager::CJabberClientCapsManager(CJabberProto *proto)
{
ppro = proto;
m_pClients = NULL;
@@ -615,7 +615,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
continue;
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ mir_sntprintf(szExtCap, _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
@@ -625,7 +625,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
// check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures()
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
+ mir_sntprintf(szExtCap, _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index f4bc11ac2d..2732cfcce5 100644
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -276,7 +276,7 @@ protected:
CJabberClientCaps *FindClient(const TCHAR *szNode);
public:
- CJabberClientCapsManager(CJabberProto* proto);
+ CJabberClientCapsManager(CJabberProto *proto);
~CJabberClientCapsManager();
void AddDefaultCaps();
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index e8ba922db5..41452c3843 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -355,7 +355,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason)
if (m_bJabberOnline) {
TCHAR szPresenceTo[JABBER_MAX_JID_LEN];
- mir_sntprintf(szPresenceTo, _countof(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
+ mir_sntprintf(szPresenceTo, _T("%s/%s"), item->jid, item->nick);
m_ThreadInfo->send(
XmlNode(_T("presence")) << XATTR(_T("to"), szPresenceTo) << XATTR(_T("type"), _T("unavailable"))
@@ -588,19 +588,19 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
sttFindGcMenuItem(gcmi, idx)->uType = 0;
for (i = 0; i < _countof(sttAffiliationItems); i++) {
- gc_item *item = sttFindGcMenuItem(gcmi, sttAffiliationItems[i].id);
- item->uType = (him->m_affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
- item->bDisabled = !(force || sttAffiliationItems[i].check(me, him));
+ gc_item *pItem = sttFindGcMenuItem(gcmi, sttAffiliationItems[i].id);
+ pItem->uType = (him->m_affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
+ pItem->bDisabled = !(force || sttAffiliationItems[i].check(me, him));
}
for (i = 0; i < _countof(sttRoleItems); i++) {
- gc_item *item = sttFindGcMenuItem(gcmi, sttRoleItems[i].id);
- item->uType = (him->m_role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
- item->bDisabled = !(force || sttRoleItems[i].check(me, him));
+ gc_item *pItem = sttFindGcMenuItem(gcmi, sttRoleItems[i].id);
+ pItem->uType = (him->m_role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
+ pItem->bDisabled = !(force || sttRoleItems[i].check(me, him));
}
if (him->m_tszRealJid && *him->m_tszRealJid) {
- mir_sntprintf(sttRJidBuf, _countof(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
+ mir_sntprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid);
if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
@@ -977,7 +977,6 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
WindowFreeIcon(hwndDlg);
g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, 0));
g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, 0));
- TUserInfoData *dat = (TUserInfoData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat) {
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
mir_free(dat);
@@ -1155,11 +1154,12 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
int idx = gch->dwData - IDM_LINK0;
LISTFOREACH(i, ppro, LIST_CHATROOM)
{
- if (JABBER_LIST_ITEM *item = ppro->ListGetItemPtrFromIndex(i))
+ if (JABBER_LIST_ITEM *pItem = ppro->ListGetItemPtrFromIndex(i)) {
if (!idx--) {
- szInviteTo = item->jid;
+ szInviteTo = pItem->jid;
break;
}
+ }
}
if (!szInviteTo) break;
@@ -1357,7 +1357,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const TCHAR *nick)
{
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), item->jid, nick);
+ mir_sntprintf(szFullJid, _T("%s/%s"), item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE);
if (hContact != NULL) {
pResourceStatus r(item->findResource(nick));
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index 3b2f40ea1f..15c0f18024 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -32,7 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SD_FAKEJID_AGENTS "@@transports"
#define SD_FAKEJID_FAVORITES "@@favorites"
-enum {
+enum
+{
SD_BROWSE_NORMAL,
SD_BROWSE_MYAGENTS,
SD_BROWSE_AGENTS,
@@ -61,107 +62,107 @@ static struct
int listIndex;
} sttNodeIcons[] =
{
-// standard identities: http://www.xmpp.org/registrar/disco-categories.html#directory
-// {NULL, _T("account"), _T("admin"), NULL, 0},
-// {NULL, _T("account"), _T("anonymous"), NULL, 0},
-// {NULL, _T("account"), _T("registered"), NULL, 0},
- {NULL, _T("account"), NULL, NULL, SKINICON_STATUS_ONLINE},
-
-// {NULL, _T("auth"), _T("cert"), NULL, 0},
-// {NULL, _T("auth"), _T("generic"), NULL, 0},
-// {NULL, _T("auth"), _T("ldap"), NULL, 0},
-// {NULL, _T("auth"), _T("ntlm"), NULL, 0},
-// {NULL, _T("auth"), _T("pam"), NULL, 0},
-// {NULL, _T("auth"), _T("radius"), NULL, 0},
- {NULL, _T("auth"), NULL, "key", 0},
-
-/// {NULL, _T("automation"), _T("command-list"), NULL, 0},
-/// {NULL, _T("automation"), _T("command-node"), NULL, 0},
-// {NULL, _T("automation"), _T("rpc"), NULL, 0},
-// {NULL, _T("automation"), _T("soap"), NULL, 0},
- {NULL, _T("automation"), NULL, "adhoc", 0},
-
-// {NULL, _T("client"), _T("bot"), NULL, 0},
-// {NULL, _T("client"), _T("console"), NULL, 0},
-// {NULL, _T("client"), _T("handheld"), NULL, 0},
-// {NULL, _T("client"), _T("pc"), NULL, 0},
-// {NULL, _T("client"), _T("phone"), NULL, 0},
-// {NULL, _T("client"), _T("web"), NULL, 0},
- {NULL, _T("client"), NULL, NULL, SKINICON_STATUS_ONLINE},
-
-// {NULL, _T("collaboration"), _T("whiteboard"), NULL, 0},
- {NULL, _T("collaboration"), NULL, "group", 0},
-
-// {NULL, _T("component"), _T("archive"), NULL, 0},
-// {NULL, _T("component"), _T("c2s"), NULL, 0},
-// {NULL, _T("component"), _T("generic"), NULL, 0},
-// {NULL, _T("component"), _T("load"), NULL, 0},
-// {NULL, _T("component"), _T("log"), NULL, 0},
-// {NULL, _T("component"), _T("presence"), NULL, 0},
-// {NULL, _T("component"), _T("router"), NULL, 0},
-// {NULL, _T("component"), _T("s2s"), NULL, 0},
-// {NULL, _T("component"), _T("sm"), NULL, 0},
-// {NULL, _T("component"), _T("stats"), NULL, 0},
-
-// {NULL, _T("conference"), _T("irc"), NULL, 0},
-// {NULL, _T("conference"), _T("text"), NULL, 0},
- {NULL, _T("conference"), NULL, "group", 0},
-
- {NULL, _T("directory"), _T("chatroom"), "group", 0},
- {NULL, _T("directory"), _T("group"), "group", 0},
- {NULL, _T("directory"), _T("user"), NULL, SKINICON_OTHER_FINDUSER},
-// {NULL, _T("directory"), _T("waitinglist"), NULL, 0},
- {NULL, _T("directory"), NULL, NULL, SKINICON_OTHER_SEARCHALL},
-
- {NULL, _T("gateway"), _T("aim"), "AIM", SKINICON_STATUS_ONLINE},
- {NULL, _T("gateway"), _T("gadu-gadu"), "GG", SKINICON_STATUS_ONLINE},
-// {NULL, _T("gateway"), _T("http-ws"), NUL, 0},
- {NULL, _T("gateway"), _T("icq"), "ICQ", SKINICON_STATUS_ONLINE},
- {NULL, _T("gateway"), _T("msn"), "MSN", SKINICON_STATUS_ONLINE},
- {NULL, _T("gateway"), _T("qq"), "QQ", SKINICON_STATUS_ONLINE},
-// {NULL, _T("gateway"), _T("sms"), NULL, 0},
-// {NULL, _T("gateway"), _T("smtp"), NULL, 0},
- {NULL, _T("gateway"), _T("tlen"), "TLEN", SKINICON_STATUS_ONLINE},
- {NULL, _T("gateway"), _T("yahoo"), "YAHOO", SKINICON_STATUS_ONLINE},
- {NULL, _T("gateway"), NULL, "Agents", 0},
-
-// {NULL, _T("headline"), _T("newmail"), NULL, 0},
- {NULL, _T("headline"), _T("rss"), "node_rss", 0},
- {NULL, _T("headline"), _T("weather"), "node_weather", 0},
-
-// {NULL, _T("hierarchy"), _T("branch"), NULL, 0},
-// {NULL, _T("hierarchy"), _T("leaf"), NULL, 0},
-
-// {NULL, _T("proxy"), _T("bytestreams"), NULL, 0},
- {NULL, _T("proxy"), NULL, NULL, SKINICON_EVENT_FILE},
-
-// {NULL, _T("pubsub"), _T("collection"), NULL, 0},
-// {NULL, _T("pubsub"), _T("leaf"), NULL, 0},
-// {NULL, _T("pubsub"), _T("pep"), NULL, 0},
-// {NULL, _T("pubsub"), _T("service"), NULL, 0},
-
-// {NULL, _T("server"), _T("im"), NULL, 0},
- {NULL, _T("server"), NULL, "node_server", 0},
-
-// {NULL, _T("store"), _T("berkeley"), NULL, 0},
-/// {NULL, _T("store"), _T("file"), NULL, 0},
-// {NULL, _T("store"), _T("generic"), NULL, 0},
-// {NULL, _T("store"), _T("ldap"), NULL, 0},
-// {NULL, _T("store"), _T("mysql"), NULL, 0},
-// {NULL, _T("store"), _T("oracle"), NULL, 0},
-// {NULL, _T("store"), _T("postgres"), NULL, 0},
- {NULL, _T("store"), NULL, "node_store", 0},
-
-// icons for non-standard identities
- {NULL, _T("x-service"), _T("x-rss"), "node_rss", 0},
- {NULL, _T("application"), _T("x-weather"), "node_weather", 0},
- {NULL, _T("user"), NULL, NULL, SKINICON_STATUS_ONLINE},
-
-// icon suggestions based on supported features
- {_T("jabber:iq:gateway"), NULL, NULL, "Agents", 0},
- {_T("jabber:iq:search"), NULL, NULL, NULL, SKINICON_OTHER_FINDUSER},
- { JABBER_FEAT_COMMANDS, NULL, NULL, "adhoc", 0},
- { JABBER_FEAT_REGISTER, NULL, NULL, "key", 0},
+ // standard identities: http://www.xmpp.org/registrar/disco-categories.html#directory
+ // {NULL, _T("account"), _T("admin"), NULL, 0},
+ // {NULL, _T("account"), _T("anonymous"), NULL, 0},
+ // {NULL, _T("account"), _T("registered"), NULL, 0},
+ {NULL, _T("account"), NULL, NULL, SKINICON_STATUS_ONLINE},
+
+ // {NULL, _T("auth"), _T("cert"), NULL, 0},
+ // {NULL, _T("auth"), _T("generic"), NULL, 0},
+ // {NULL, _T("auth"), _T("ldap"), NULL, 0},
+ // {NULL, _T("auth"), _T("ntlm"), NULL, 0},
+ // {NULL, _T("auth"), _T("pam"), NULL, 0},
+ // {NULL, _T("auth"), _T("radius"), NULL, 0},
+ {NULL, _T("auth"), NULL, "key", 0},
+
+ /// {NULL, _T("automation"), _T("command-list"), NULL, 0},
+ /// {NULL, _T("automation"), _T("command-node"), NULL, 0},
+ // {NULL, _T("automation"), _T("rpc"), NULL, 0},
+ // {NULL, _T("automation"), _T("soap"), NULL, 0},
+ {NULL, _T("automation"), NULL, "adhoc", 0},
+
+ // {NULL, _T("client"), _T("bot"), NULL, 0},
+ // {NULL, _T("client"), _T("console"), NULL, 0},
+ // {NULL, _T("client"), _T("handheld"), NULL, 0},
+ // {NULL, _T("client"), _T("pc"), NULL, 0},
+ // {NULL, _T("client"), _T("phone"), NULL, 0},
+ // {NULL, _T("client"), _T("web"), NULL, 0},
+ {NULL, _T("client"), NULL, NULL, SKINICON_STATUS_ONLINE},
+
+ // {NULL, _T("collaboration"), _T("whiteboard"), NULL, 0},
+ {NULL, _T("collaboration"), NULL, "group", 0},
+
+ // {NULL, _T("component"), _T("archive"), NULL, 0},
+ // {NULL, _T("component"), _T("c2s"), NULL, 0},
+ // {NULL, _T("component"), _T("generic"), NULL, 0},
+ // {NULL, _T("component"), _T("load"), NULL, 0},
+ // {NULL, _T("component"), _T("log"), NULL, 0},
+ // {NULL, _T("component"), _T("presence"), NULL, 0},
+ // {NULL, _T("component"), _T("router"), NULL, 0},
+ // {NULL, _T("component"), _T("s2s"), NULL, 0},
+ // {NULL, _T("component"), _T("sm"), NULL, 0},
+ // {NULL, _T("component"), _T("stats"), NULL, 0},
+
+ // {NULL, _T("conference"), _T("irc"), NULL, 0},
+ // {NULL, _T("conference"), _T("text"), NULL, 0},
+ {NULL, _T("conference"), NULL, "group", 0},
+
+ {NULL, _T("directory"), _T("chatroom"), "group", 0},
+ {NULL, _T("directory"), _T("group"), "group", 0},
+ {NULL, _T("directory"), _T("user"), NULL, SKINICON_OTHER_FINDUSER},
+ // {NULL, _T("directory"), _T("waitinglist"), NULL, 0},
+ {NULL, _T("directory"), NULL, NULL, SKINICON_OTHER_SEARCHALL},
+
+ {NULL, _T("gateway"), _T("aim"), "AIM", SKINICON_STATUS_ONLINE},
+ {NULL, _T("gateway"), _T("gadu-gadu"), "GG", SKINICON_STATUS_ONLINE},
+ // {NULL, _T("gateway"), _T("http-ws"), NUL, 0},
+ {NULL, _T("gateway"), _T("icq"), "ICQ", SKINICON_STATUS_ONLINE},
+ {NULL, _T("gateway"), _T("msn"), "MSN", SKINICON_STATUS_ONLINE},
+ {NULL, _T("gateway"), _T("qq"), "QQ", SKINICON_STATUS_ONLINE},
+ // {NULL, _T("gateway"), _T("sms"), NULL, 0},
+ // {NULL, _T("gateway"), _T("smtp"), NULL, 0},
+ {NULL, _T("gateway"), _T("tlen"), "TLEN", SKINICON_STATUS_ONLINE},
+ {NULL, _T("gateway"), _T("yahoo"), "YAHOO", SKINICON_STATUS_ONLINE},
+ {NULL, _T("gateway"), NULL, "Agents", 0},
+
+ // {NULL, _T("headline"), _T("newmail"), NULL, 0},
+ {NULL, _T("headline"), _T("rss"), "node_rss", 0},
+ {NULL, _T("headline"), _T("weather"), "node_weather", 0},
+
+ // {NULL, _T("hierarchy"), _T("branch"), NULL, 0},
+ // {NULL, _T("hierarchy"), _T("leaf"), NULL, 0},
+
+ // {NULL, _T("proxy"), _T("bytestreams"), NULL, 0},
+ {NULL, _T("proxy"), NULL, NULL, SKINICON_EVENT_FILE},
+
+ // {NULL, _T("pubsub"), _T("collection"), NULL, 0},
+ // {NULL, _T("pubsub"), _T("leaf"), NULL, 0},
+ // {NULL, _T("pubsub"), _T("pep"), NULL, 0},
+ // {NULL, _T("pubsub"), _T("service"), NULL, 0},
+
+ // {NULL, _T("server"), _T("im"), NULL, 0},
+ {NULL, _T("server"), NULL, "node_server", 0},
+
+ // {NULL, _T("store"), _T("berkeley"), NULL, 0},
+ /// {NULL, _T("store"), _T("file"), NULL, 0},
+ // {NULL, _T("store"), _T("generic"), NULL, 0},
+ // {NULL, _T("store"), _T("ldap"), NULL, 0},
+ // {NULL, _T("store"), _T("mysql"), NULL, 0},
+ // {NULL, _T("store"), _T("oracle"), NULL, 0},
+ // {NULL, _T("store"), _T("postgres"), NULL, 0},
+ {NULL, _T("store"), NULL, "node_store", 0},
+
+ // icons for non-standard identities
+ {NULL, _T("x-service"), _T("x-rss"), "node_rss", 0},
+ {NULL, _T("application"), _T("x-weather"), "node_weather", 0},
+ {NULL, _T("user"), NULL, NULL, SKINICON_STATUS_ONLINE},
+
+ // icon suggestions based on supported features
+ {_T("jabber:iq:gateway"), NULL, NULL, "Agents", 0},
+ {_T("jabber:iq:search"), NULL, NULL, NULL, SKINICON_OTHER_FINDUSER},
+ { JABBER_FEAT_COMMANDS, NULL, NULL, "adhoc", 0},
+ { JABBER_FEAT_REGISTER, NULL, NULL, "key", 0},
};
static void sttApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode);
@@ -174,7 +175,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pI
return;
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
- HXML query = XmlGetChild(iqNode , "query");
+ HXML query = XmlGetChild(iqNode, "query");
if (query == NULL)
pNode->SetInfoRequestId(JABBER_DISCO_RESULT_ERROR);
else {
@@ -192,7 +193,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pI
}
else {
if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
- HXML errorNode = XmlGetChild(iqNode , "error");
+ HXML errorNode = XmlGetChild(iqNode, "error");
TCHAR *str = JabberErrorMsg(errorNode);
pNode->SetInfoRequestErrorText(str);
mir_free(str);
@@ -218,7 +219,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *p
return;
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
- HXML query = XmlGetChild(iqNode , "query");
+ HXML query = XmlGetChild(iqNode, "query");
if (query == NULL)
pNode->SetItemsRequestId(JABBER_DISCO_RESULT_ERROR);
else {
@@ -232,7 +233,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *p
}
else {
if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
- HXML errorNode = XmlGetChild(iqNode , "error");
+ HXML errorNode = XmlGetChild(iqNode, "error");
TCHAR *str = JabberErrorMsg(errorNode);
pNode->SetItemsRequestErrorText(str);
mir_free(str);
@@ -257,7 +258,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo
mir_cslockfull lck(m_SDManager.cs());
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
- HXML query = XmlGetChild(iqNode , "query");
+ HXML query = XmlGetChild(iqNode, "query");
if (query) {
HXML feature;
for (int i = 1; (feature = XmlGetNthChild(query, _T("feature"), i)) != NULL; i++) {
@@ -265,7 +266,10 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(pInfo->GetReceiver(), XmlGetAttrValue(iqNode, _T("node")), NULL);
SendBothRequests(pNode, NULL);
break;
- } } } }
+ }
+ }
+ }
+ }
lck.unlock();
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_REFRESH);
@@ -279,7 +283,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInf
XmlNode packet(NULL);
mir_cslockfull lck(m_SDManager.cs());
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
- HXML query = XmlGetChild(iqNode , "query");
+ HXML query = XmlGetChild(iqNode, "query");
if (query) {
HXML item;
for (int i = 1; (item = XmlGetNthChild(query, _T("item"), i)) != NULL; i++) {
@@ -292,10 +296,12 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInf
XmlNodeIq iq(pNewInfo);
iq << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(_T("node"), szNode);
XmlAddChild(packet, iq);
- } } }
+ }
+ }
+ }
lck.unlock();
- if (XmlGetChild(packet ,0))
+ if (XmlGetChild(packet, 0))
m_ThreadInfo->send(packet);
}
@@ -379,11 +385,11 @@ BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent)
void CJabberProto::PerformBrowse(HWND hwndDlg)
{
TCHAR szJid[JABBER_MAX_JID_LEN];
- TCHAR szNode[ 512 ];
+ TCHAR szNode[512];
if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, _countof(szJid)))
- szJid[ 0 ] = 0;
+ szJid[0] = 0;
if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, _countof(szNode)))
- szNode[ 0 ] = 0;
+ szNode[0] = 0;
ComboAddRecentString(hwndDlg, IDC_COMBO_JID, "discoWnd_rcJid", szJid);
ComboAddRecentString(hwndDlg, IDC_COMBO_NODE, "discoWnd_rcNode", szNode);
@@ -401,8 +407,8 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
JABBER_LIST_ITEM *item = NULL;
LISTFOREACH(i, this, LIST_ROSTER)
{
- if ((item=ListGetItemPtrFromIndex(i)) != NULL) {
- if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription!=SUB_NONE) {
+ if ((item = ListGetItemPtrFromIndex(i)) != NULL) {
+ if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) {
MCONTACT hContact = HContactFromJID(item->jid);
if (hContact != NULL)
setByte(hContact, "IsTransport", TRUE);
@@ -412,8 +418,10 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(item->jid, NULL, NULL);
SendBothRequests(pNode, NULL);
- } }
- } }
+ }
+ }
+ }
+ }
else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
sttBrowseMode = SD_BROWSE_CONFERENCES;
TCHAR *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
@@ -439,17 +447,17 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
sttBrowseMode = SD_BROWSE_FAVORITES;
int count = getDword("discoWnd_favCount", 0);
- for (int i=0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favName_%d", i);
- ptrT tszName( getTStringA(setting));
+ ptrT tszName(getTStringA(setting));
if (tszName == NULL)
continue;
-
+
mir_snprintf(setting, "discoWnd_favJID_%d", i);
- ptrT dbvJid( getTStringA(setting));
+ ptrT dbvJid(getTStringA(setting));
mir_snprintf(setting, "discoWnd_favNode_%d", i);
- ptrT dbvNode( getTStringA(setting));
+ ptrT dbvNode(getTStringA(setting));
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(dbvJid, dbvNode, tszName);
SendBothRequests(pNode, NULL);
}
@@ -504,29 +512,24 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
iOverlay = SD_OVERLAY_NONE;
}
- for (int i=0; i < _countof(sttNodeIcons); i++)
- {
+ for (int i = 0; i < _countof(sttNodeIcons); i++) {
if (!sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
- if (sttNodeIcons[i].category)
- {
+ if (sttNodeIcons[i].category) {
CJabberSDIdentity *iIdentity;
for (iIdentity = pNode->GetFirstIdentity(); iIdentity; iIdentity = iIdentity->GetNext())
if (!mir_tstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
- (!sttNodeIcons[i].type || !mir_tstrcmp(iIdentity->GetType(), sttNodeIcons[i].type)))
- {
+ (!sttNodeIcons[i].type || !mir_tstrcmp(iIdentity->GetType(), sttNodeIcons[i].type))) {
iIcon = sttNodeIcons[i].listIndex;
break;
}
if (iIdentity) break;
}
- if (sttNodeIcons[i].feature)
- {
+ if (sttNodeIcons[i].feature) {
CJabberSDFeature *iFeature;
for (iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_tstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature))
- {
+ if (!mir_tstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature)) {
iIcon = sttNodeIcons[i].listIndex;
break;
}
@@ -569,7 +572,7 @@ BOOL CJabberProto::SyncTree(HTREELISTITEM hIndex, CJabberSDNode *pNode)
///////////////////////////////////////////////////////////////////////////////
// CJabberDlgDiscovery
-class CJabberDlgDiscovery: public CJabberDlgBase
+class CJabberDlgDiscovery : public CJabberDlgBase
{
typedef CJabberDlgBase CSuper;
@@ -657,8 +660,8 @@ void CJabberDlgDiscovery::OnInitDialog()
m_proto->ComboLoadRecentStrings(m_hwnd, IDC_COMBO_NODE, "discoWnd_rcNode");
HWND hwndList = m_lstDiscoTree.GetHwnd();//GetDlgItem(m_hwnd, IDC_TREE_DISCO);
- LVCOLUMN lvc = {0};
- lvc.mask = LVCF_SUBITEM|LVCF_WIDTH|LVCF_TEXT;
+ LVCOLUMN lvc = { 0 };
+ lvc.mask = LVCF_SUBITEM | LVCF_WIDTH | LVCF_TEXT;
lvc.cx = m_proto->getWord("discoWnd_cx0", 200);
lvc.iSubItem = 0;
lvc.pszText = TranslateT("Node hierarchy");
@@ -674,12 +677,11 @@ void CJabberDlgDiscovery::OnInitDialog()
TreeList_Create(hwndList);
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
- for (int i=0; i < _countof(sttNodeIcons); i++)
- {
+ for (int i = 0; i < _countof(sttNodeIcons); i++) {
bool needDestroy = false;
HICON hIcon;
if ((sttNodeIcons[i].iconIndex == SKINICON_STATUS_ONLINE) && sttNodeIcons[i].iconName) {
- hIcon = (HICON)CallProtoService(sttNodeIcons[i].iconName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ hIcon = (HICON)CallProtoService(sttNodeIcons[i].iconName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
needDestroy = true;
}
else if (sttNodeIcons[i].iconName)
@@ -706,7 +708,7 @@ void CJabberDlgDiscovery::OnClose()
m_proto->setByte("discoWnd_useTree", IsDlgButtonChecked(m_hwnd, IDC_BTN_VIEWTREE));
HWND hwndList = GetDlgItem(m_hwnd, IDC_TREE_DISCO);
- LVCOLUMN lvc = {0};
+ LVCOLUMN lvc = { 0 };
lvc.mask = LVCF_WIDTH;
ListView_GetColumn(hwndList, 0, &lvc);
m_proto->setWord("discoWnd_cx0", lvc.cx);
@@ -757,16 +759,16 @@ int CJabberDlgDiscovery::Resizer(UTILRESIZECONTROL *urc)
return 0;
case IDC_BUTTON_BROWSE:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP;
case IDC_TREE_DISCO:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDC_TXT_FILTER:
- return RD_ANCHORX_LEFT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
case IDC_TXT_FILTERTEXT:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
case IDC_BTN_FILTERAPPLY:
case IDC_BTN_FILTERRESET:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
}
return CSuper::Resizer(urc);
}
@@ -795,31 +797,33 @@ void CJabberDlgDiscovery::btnGoHome_OnClick(CCtrlButton *)
void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *)
{
HMENU hMenu = CreatePopupMenu();
- int count = m_proto->getDword("discoWnd_favCount", 0);
- for (int i=0; i < count; i++) {
- char setting[MAXMODULELABELLENGTH];
- mir_snprintf(setting, "discoWnd_favName_%d", i);
- ptrT tszName( m_proto->getTStringA(setting));
- if (tszName != NULL) {
- HMENU hSubMenu = CreatePopupMenu();
- AppendMenu(hSubMenu, MF_STRING, 100+i*10+0, TranslateT("Navigate"));
- AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
- AppendMenu(hSubMenu, MF_STRING, 100+i*10+1, TranslateT("Remove"));
- AppendMenu(hMenu, MF_POPUP|MF_STRING, (UINT_PTR)hSubMenu, tszName);
+ {
+ int count = m_proto->getDword("discoWnd_favCount", 0);
+ for (int i = 0; i < count; i++) {
+ char setting[MAXMODULELABELLENGTH];
+ mir_snprintf(setting, "discoWnd_favName_%d", i);
+ ptrT tszName(m_proto->getTStringA(setting));
+ if (tszName != NULL) {
+ HMENU hSubMenu = CreatePopupMenu();
+ AppendMenu(hSubMenu, MF_STRING, 100 + i * 10 + 0, TranslateT("Navigate"));
+ AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hSubMenu, MF_STRING, 100 + i * 10 + 1, TranslateT("Remove"));
+ AppendMenu(hMenu, MF_POPUP | MF_STRING, (UINT_PTR)hSubMenu, tszName);
+ }
}
}
int res = 0;
if (GetMenuItemCount(hMenu)) {
AppendMenu(hMenu, MF_SEPARATOR, 1, NULL);
- AppendMenu(hMenu, MF_STRING, 10+SD_BROWSE_FAVORITES, TranslateT("Browse all favorites"));
+ AppendMenu(hMenu, MF_STRING, 10 + SD_BROWSE_FAVORITES, TranslateT("Browse all favorites"));
AppendMenu(hMenu, MF_STRING, 1, TranslateT("Remove all favorites"));
}
if (GetMenuItemCount(hMenu))
AppendMenu(hMenu, MF_SEPARATOR, 1, NULL);
- AppendMenu(hMenu, MF_STRING, 10+SD_BROWSE_MYAGENTS, TranslateT("Registered transports"));
- AppendMenu(hMenu, MF_STRING, 10+SD_BROWSE_AGENTS, TranslateT("Browse local transports"));
- AppendMenu(hMenu, MF_STRING, 10+SD_BROWSE_CONFERENCES, TranslateT("Browse chatrooms"));
+ AppendMenu(hMenu, MF_STRING, 10 + SD_BROWSE_MYAGENTS, TranslateT("Registered transports"));
+ AppendMenu(hMenu, MF_STRING, 10 + SD_BROWSE_AGENTS, TranslateT("Browse local transports"));
+ AppendMenu(hMenu, MF_STRING, 10 + SD_BROWSE_CONFERENCES, TranslateT("Browse chatrooms"));
RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_BTN_FAVORITE), &rc);
CheckDlgButton(m_hwnd, IDC_BTN_FAVORITE, BST_CHECKED);
@@ -847,7 +851,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *)
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favJID_%d", res);
- ptrT dbv( m_proto->getTStringA(setting));
+ ptrT dbv(m_proto->getTStringA(setting));
if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv);
mir_snprintf(setting, "discoWnd_favNode_%d", res);
@@ -859,7 +863,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *)
}
else if (res == 1) {
int count = m_proto->getDword("discoWnd_favCount", 0);
- for (int i=0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favName_%d", i);
m_proto->delSetting(setting);
@@ -871,7 +875,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *)
m_proto->delSetting("discoWnd_favCount");
}
else if ((res >= 10) && (res <= 20)) {
- switch (res-10) {
+ switch (res - 10) {
case SD_BROWSE_FAVORITES:
SetDlgItemText(m_hwnd, IDC_COMBO_JID, _T(SD_FAKEJID_FAVORITES));
break;
@@ -909,7 +913,7 @@ void CJabberDlgDiscovery::btnRefresh_OnClick(CCtrlButton *)
}
lck.unlock();
- if (XmlGetChild(packet ,0))
+ if (XmlGetChild(packet, 0))
m_proto->m_ThreadInfo->send(packet);
}
@@ -964,8 +968,7 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
mir_cslockfull lck(m_proto->m_SDManager.cs());
CJabberSDNode *pNode = m_proto->m_SDManager.GetPrimaryNode();
- while (pNode)
- {
+ while (pNode) {
if (pNode->GetJid()) {
if (!pNode->GetTreeItemHandle()) {
HTREELISTITEM hNewItem = TreeList_AddItem(
@@ -975,7 +978,8 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
TreeList_AppendColumn(hNewItem, pNode->GetJid());
TreeList_AppendColumn(hNewItem, pNode->GetNode());
pNode->SetTreeItemHandle(hNewItem);
- } }
+ }
+ }
m_proto->SyncTree(NULL, pNode);
pNode = pNode->GetNext();
}
@@ -1141,7 +1145,8 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
{
//ClientToScreen(GetDlgItem(hwndServiceDiscovery, IDC_TREE_DISCO), &pt);
- enum { // This values are below CLISTMENUIDMAX and won't overlap
+ enum
+ { // This values are below CLISTMENUIDMAX and won't overlap
SD_ACT_REFRESH = 1, SD_ACT_REFRESHCHILDREN, SD_ACT_FAVORITE,
SD_ACT_ROSTER, SD_ACT_COPYJID, SD_ACT_COPYNODE, SD_ACT_USERMENU,
SD_ACT_COPYINFO,
@@ -1152,16 +1157,17 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
SD_ACT_JOIN, SD_ACT_BOOKMARK, SD_ACT_PROXY, SD_ACT_VCARD
};
- enum {
- SD_FLG_NONODE = 0x001,
- SD_FLG_NOTONROSTER = 0x002,
- SD_FLG_ONROSTER = 0x004,
- SD_FLG_SUBSCRIBED = 0x008,
+ enum
+ {
+ SD_FLG_NONODE = 0x001,
+ SD_FLG_NOTONROSTER = 0x002,
+ SD_FLG_ONROSTER = 0x004,
+ SD_FLG_SUBSCRIBED = 0x008,
SD_FLG_NOTSUBSCRIBED = 0x010,
- SD_FLG_ONLINE = 0x020,
- SD_FLG_NOTONLINE = 0x040,
- SD_FLG_NORESOURCE = 0x080,
- SD_FLG_HASUSER = 0x100
+ SD_FLG_ONLINE = 0x020,
+ SD_FLG_NOTONLINE = 0x040,
+ SD_FLG_NORESOURCE = 0x080,
+ SD_FLG_HASUSER = 0x100
};
struct
@@ -1174,34 +1180,34 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
static items[] =
{
{ NULL, LPGENT("Contact Menu..."), SD_ACT_USERMENU, SD_FLG_NONODE},
- { NULL, LPGENT("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE},
- { JABBER_FEAT_MUC, LPGENT("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE},
- {0},
- { NULL, LPGENT("Refresh Info"), SD_ACT_REFRESH},
- { NULL, LPGENT("Refresh Children"), SD_ACT_REFRESHCHILDREN},
- {0},
- { NULL, LPGENT("Add to favorites"), SD_ACT_FAVORITE},
- { NULL, LPGENT("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE|SD_FLG_NOTONROSTER},
- { JABBER_FEAT_MUC, LPGENT("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE|SD_FLG_HASUSER},
- { _T("jabber:iq:search"), LPGENT("Add search directory"), SD_ACT_ADDDIRECTORY},
- { JABBER_FEAT_BYTESTREAMS, LPGENT("Use this proxy"), SD_ACT_PROXY},
- {0},
- { JABBER_FEAT_REGISTER, LPGENT("Register"), SD_ACT_REGISTER},
- { _T("jabber:iq:gateway"), LPGENT("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER|SD_FLG_SUBSCRIBED},
- { JABBER_FEAT_COMMANDS, LPGENT("Commands..."), SD_ACT_ADHOC},
- {0},
- { _T("jabber:iq:gateway"), LPGENT("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER|SD_FLG_SUBSCRIBED|SD_FLG_ONLINE},
- { _T("jabber:iq:gateway"), LPGENT("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER|SD_FLG_SUBSCRIBED|SD_FLG_NOTONLINE},
- {0},
- { NULL, LPGENT("Copy JID"), SD_ACT_COPYJID},
- { NULL, LPGENT("Copy node name"), SD_ACT_COPYNODE},
- { NULL, LPGENT("Copy node information"), SD_ACT_COPYINFO},
+ { NULL, LPGENT("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE},
+ { JABBER_FEAT_MUC, LPGENT("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE},
+ {0},
+ { NULL, LPGENT("Refresh Info"), SD_ACT_REFRESH},
+ { NULL, LPGENT("Refresh Children"), SD_ACT_REFRESHCHILDREN},
+ {0},
+ { NULL, LPGENT("Add to favorites"), SD_ACT_FAVORITE},
+ { NULL, LPGENT("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE | SD_FLG_NOTONROSTER},
+ { JABBER_FEAT_MUC, LPGENT("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE | SD_FLG_HASUSER},
+ { _T("jabber:iq:search"), LPGENT("Add search directory"), SD_ACT_ADDDIRECTORY},
+ { JABBER_FEAT_BYTESTREAMS, LPGENT("Use this proxy"), SD_ACT_PROXY},
+ {0},
+ { JABBER_FEAT_REGISTER, LPGENT("Register"), SD_ACT_REGISTER},
+ { _T("jabber:iq:gateway"), LPGENT("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED},
+ { JABBER_FEAT_COMMANDS, LPGENT("Commands..."), SD_ACT_ADHOC},
+ {0},
+ { _T("jabber:iq:gateway"), LPGENT("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_ONLINE},
+ { _T("jabber:iq:gateway"), LPGENT("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_NOTONLINE},
+ {0},
+ { NULL, LPGENT("Copy JID"), SD_ACT_COPYJID},
+ { NULL, LPGENT("Copy node name"), SD_ACT_COPYNODE},
+ { NULL, LPGENT("Copy node information"), SD_ACT_COPYINFO},
};
HMENU hMenu = CreatePopupMenu();
BOOL lastSeparator = TRUE;
bool bFilterItems = !GetAsyncKeyState(VK_CONTROL);
- for (int i=0; i < _countof(items); i++) {
+ for (int i = 0; i < _countof(items); i++) {
JABBER_LIST_ITEM *rosterItem = NULL;
if (bFilterItems) {
if ((items[i].flags & SD_FLG_NONODE) && pNode->GetNode())
@@ -1229,7 +1235,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
MCONTACT hContact;
if ((items[i].action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) {
HMENU hContactMenu = Menu_BuildContactMenu(hContact);
- AppendMenu(hMenu, MF_STRING|MF_POPUP, (UINT_PTR)hContactMenu, TranslateTS(items[i].title));
+ AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hContactMenu, TranslateTS(items[i].title));
}
else AppendMenu(hMenu, MF_STRING, items[i].action, TranslateTS(items[i].title));
lastSeparator = FALSE;
@@ -1294,11 +1300,11 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
mir_cslock lck(m_SDManager.cs());
for (int iChild = TreeList_GetChildrenCount(hItem); iChild--;) {
HTREELISTITEM hNode = TreeList_GetChild(hItem, iChild);
- CJabberSDNode *pNode = (CJabberSDNode *)TreeList_GetData(hNode);
- if (pNode) {
+ CJabberSDNode *n = (CJabberSDNode *)TreeList_GetData(hNode);
+ if (n) {
TreeList_ResetItem(GetDlgItem(m_pDlgServiceDiscovery->GetHwnd(), IDC_TREE_DISCO), hNode);
- pNode->ResetInfo();
- SendBothRequests(pNode, packet);
+ n->ResetInfo();
+ SendBothRequests(n, packet);
TreeList_MakeFakeParent(hNode, FALSE);
}
@@ -1377,7 +1383,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
break;
item->name = mir_tstrdup(pNode->GetName());
}
-
+
item->type = _T("conference");
AddEditBookmark(item);
}
@@ -1394,7 +1400,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
}
HMENU hContactMenu = Menu_BuildContactMenu(hContact);
GetCursorPos(&pt);
- int res = TrackPopupMenu(hContactMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_pDlgServiceDiscovery->GetHwnd(), NULL);
+ res = TrackPopupMenu(hContactMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_pDlgServiceDiscovery->GetHwnd(), NULL);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(res, MPCF_CONTACTMENU), hContact);
}
break;
@@ -1431,9 +1437,9 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
break;
case SD_ACT_UNREGISTER:
- m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext(), pNode->GetJid()) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove")));
+ m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), pNode->GetJid()) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove")));
- m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext()) << XQUERY(JABBER_FEAT_IQ_ROSTER)
+ m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext()) << XQUERY(JABBER_FEAT_IQ_ROSTER)
<< XCHILD(_T("item")) << XATTR(_T("jid"), pNode->GetJid()) << XATTR(_T("subscription"), _T("remove")));
break;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index a6e46d77e7..6a00da7d80 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -178,7 +178,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
TCHAR szPort[10];
- mir_sntprintf(szPort, _countof(szPort), _T("%d"), connInfo.wPort);
+ mir_sntprintf(szPort, _T("%d"), connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
@@ -258,7 +258,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
ft->hFileEvent = hEvent;
TCHAR szPort[20];
- mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
@@ -440,7 +440,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
/////////////////////////////////////////////////////////////////////////////////////////
// filetransfer class members
-filetransfer::filetransfer(CJabberProto* proto)
+filetransfer::filetransfer(CJabberProto *proto)
{
memset(this, 0, sizeof(filetransfer));
ppro = proto;
@@ -499,7 +499,7 @@ int filetransfer::create()
return fileId;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
+ mir_sntprintf(filefull, _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
replaceStrT(std.tszCurrentFile, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 41955dc4e5..56ae8f742b 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -82,7 +82,7 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft)
int i;
TCHAR sid[9];
- if (jid == NULL || ft == NULL || !m_bJabberOnline || (rs=ListGetBestClientResourceNamePtr(jid)) == NULL) {
+ if (jid == NULL || ft == NULL || !m_bJabberOnline || (rs = ListGetBestClientResourceNamePtr(jid)) == NULL) {
if (ft) {
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
delete ft;
@@ -90,27 +90,27 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft)
return;
}
ft->type = FT_SI;
- for (i=0; i<8; i++)
- sid[i] = (rand()%10) + '0';
+ for (i = 0; i < 8; i++)
+ sid[i] = (rand() % 10) + '0';
sid[8] = '\0';
if (ft->sid != NULL) mir_free(ft->sid);
ft->sid = mir_tstrdup(sid);
filename = ft->std.ptszFiles[ft->std.currentFileNumber];
if ((p = _tcsrchr(filename, '\\')) != NULL)
- filename = p+1;
+ filename = p + 1;
- TCHAR tszJid[ 512 ];
- mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, rs);
+ TCHAR tszJid[512];
+ mir_sntprintf(tszJid, _T("%s/%s"), jid, rs);
- XmlNodeIq iq( AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
+ XmlNodeIq iq(AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
HXML si = iq << XCHILDNS(_T("si"), JABBER_FEAT_SI) << XATTR(_T("id"), sid)
- << XATTR(_T("mime-type"), _T("binary/octet-stream")) << XATTR(_T("profile"), JABBER_FEAT_SI_FT);
+ << XATTR(_T("mime-type"), _T("binary/octet-stream")) << XATTR(_T("profile"), JABBER_FEAT_SI_FT);
si << XCHILDNS(_T("file"), JABBER_FEAT_SI_FT) << XATTR(_T("name"), filename)
<< XATTRI64(_T("size"), ft->fileSize[ft->std.currentFileNumber]) << XCHILD(_T("desc"), ft->szDescription);
HXML field = si << XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
- << XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("form"))
- << XCHILD(_T("field")) << XATTR(_T("var"), _T("stream-method")) << XATTR(_T("type"), _T("list-single"));
+ << XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("form"))
+ << XCHILD(_T("field")) << XATTR(_T("var"), _T("stream-method")) << XATTR(_T("type"), _T("list-single"));
BOOL bDirect = m_options.BsDirect;
BOOL bProxy = m_options.BsProxyManual;
@@ -130,16 +130,16 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
if (!ft) return;
if ((pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) && pInfo->m_szFrom && pInfo->m_szTo) {
- if ((siNode = XmlGetChild(iqNode , "si")) != NULL) {
+ if ((siNode = XmlGetChild(iqNode, "si")) != NULL) {
// fix for very smart clients, like gajim
BOOL bDirect = m_options.BsDirect;
BOOL bProxy = m_options.BsProxyManual;
- if ((featureNode = XmlGetChild(siNode , "feature")) != NULL) {
+ if ((featureNode = XmlGetChild(siNode, "feature")) != NULL) {
if ((xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL) {
if ((fieldNode = XmlGetChildByTag(xNode, "field", "var", _T("stream-method"))) != NULL) {
- if ((valueNode = XmlGetChild(fieldNode , "value")) != NULL && XmlGetText(valueNode) != NULL) {
+ if ((valueNode = XmlGetChild(fieldNode, "value")) != NULL && XmlGetText(valueNode) != NULL) {
if ((bDirect || bProxy) && !mir_tstrcmp(XmlGetText(valueNode), JABBER_FEAT_BYTESTREAMS)) {
// Start Bytestream session
JABBER_BYTE_TRANSFER *jbt = new JABBER_BYTE_TRANSFER;
@@ -155,7 +155,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
ForkThread((MyThreadFunc)&CJabberProto::ByteSendThread, jbt);
}
else if (!mir_tstrcmp(XmlGetText(valueNode), JABBER_FEAT_IBB)) {
- JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *) mir_alloc(sizeof (JABBER_IBB_TRANSFER));
+ JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
jibb->srcJID = mir_tstrdup(pInfo->m_szTo);
jibb->dstJID = mir_tstrdup(pInfo->m_szFrom);
@@ -166,7 +166,13 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
ft->type = FT_IBB;
ft->jibb = jibb;
ForkThread((MyThreadFunc)&CJabberProto::IbbSendThread, jibb);
- } } } } } } }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
else {
debugLogA("File transfer stream initiation request denied or failed");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR ? ACKRESULT_DENIED : ACKRESULT_FAILED, ft, 0);
@@ -183,7 +189,7 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft)
debugLog(_T("Sending [%s]"), ft->std.ptszFiles[ft->std.currentFileNumber]);
_tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
- if ((fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY|_O_RDONLY)) < 0) {
+ if ((fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) {
debugLog(_T("File cannot be opened"));
return FALSE;
}
@@ -192,8 +198,8 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft)
ft->std.currentFileSize = statbuf.st_size;
ft->std.currentFileProgress = 0;
- if ((buffer=(char*)mir_alloc(2048)) != NULL) {
- while ((numRead=_read(fd, buffer, 2048)) > 0) {
+ if ((buffer = (char*)mir_alloc(2048)) != NULL) {
+ while ((numRead = _read(fd, buffer, 2048)) > 0) {
if (Netlib_Send(hConn, buffer, numRead, 0) != numRead) {
mir_free(buffer);
_close(fd);
@@ -215,8 +221,8 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft)
struct _stati64 statbuf;
_tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
-
- int fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY|_O_RDONLY);
+
+ int fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY);
if (fd < 0) {
debugLogA("File cannot be opened");
return FALSE;
@@ -276,7 +282,7 @@ void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft)
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ft->state == FT_DENIED ? ACKRESULT_DENIED : ACKRESULT_FAILED, ft, 0);
}
else {
- if (ft->std.currentFileNumber < ft->std.totalFiles-1) {
+ if (ft->std.currentFileNumber < ft->std.totalFiles - 1) {
ft->std.currentFileNumber++;
replaceStrT(ft->std.tszCurrentFile, ft->std.ptszFiles[ft->std.currentFileNumber]);
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
@@ -297,19 +303,19 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
const TCHAR *from, *sid, *str, *szId, *filename;
HXML siNode, fileNode, featureNode, xNode, fieldNode, n;
int i;
- unsigned __int64 filesize;
+ unsigned __int64 filesize;
if (!iqNode ||
- (from = XmlGetAttrValue(iqNode, _T("from"))) == NULL ||
- (str = XmlGetAttrValue(iqNode, _T("type"))) == NULL || mir_tstrcmp(str, _T("set")) ||
- (siNode = XmlGetChildByTag(iqNode, "si", "xmlns", JABBER_FEAT_SI)) == NULL)
+ (from = XmlGetAttrValue(iqNode, _T("from"))) == NULL ||
+ (str = XmlGetAttrValue(iqNode, _T("type"))) == NULL || mir_tstrcmp(str, _T("set")) ||
+ (siNode = XmlGetChildByTag(iqNode, "si", "xmlns", JABBER_FEAT_SI)) == NULL)
return;
- szId = XmlGetAttrValue(iqNode, _T("id"));
- if ((sid = XmlGetAttrValue(siNode, _T("id"))) != NULL &&
+ szId = XmlGetAttrValue(iqNode, _T("id"));
+ if ((sid = XmlGetAttrValue(siNode, _T("id"))) != NULL &&
(fileNode = XmlGetChildByTag(siNode, "file", "xmlns", JABBER_FEAT_SI_FT)) != NULL &&
- (filename = XmlGetAttrValue(fileNode, _T("name"))) != NULL &&
- (str = XmlGetAttrValue(fileNode, _T("size"))) != NULL) {
+ (filename = XmlGetAttrValue(fileNode, _T("name"))) != NULL &&
+ (str = XmlGetAttrValue(fileNode, _T("size"))) != NULL) {
filesize = _ttoi64(str);
if ((featureNode = XmlGetChildByTag(siNode, "feature", "xmlns", JABBER_FEAT_FEATURE_NEG)) != NULL &&
@@ -321,31 +327,39 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
JABBER_FT_TYPE ftType = FT_OOB;
if (!bIbbOnly) {
- for (i=0; ; i++) {
- optionNode = XmlGetChild(fieldNode ,i);
+ for (i = 0; ; i++) {
+ optionNode = XmlGetChild(fieldNode, i);
if (!optionNode)
break;
if (!mir_tstrcmp(XmlGetName(optionNode), _T("option"))) {
- if ((n = XmlGetChild(optionNode , "value")) != NULL && XmlGetText(n)) {
+ if ((n = XmlGetChild(optionNode, "value")) != NULL && XmlGetText(n)) {
if (!mir_tstrcmp(XmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
ftType = FT_BYTESTREAM;
break;
- } } } } }
+ }
+ }
+ }
+ }
+ }
// try IBB only if bytestreams support not found or BsOnlyIBB flag exists
if (bIbbOnly || !optionNode) {
- for (i=0; ; i++) {
- optionNode = XmlGetChild(fieldNode ,i);
+ for (i = 0; ; i++) {
+ optionNode = XmlGetChild(fieldNode, i);
if (!optionNode)
break;
if (!mir_tstrcmp(XmlGetName(optionNode), _T("option"))) {
- if ((n = XmlGetChild(optionNode , "value")) != NULL && XmlGetText(n)) {
+ if ((n = XmlGetChild(optionNode, "value")) != NULL && XmlGetText(n)) {
if (!mir_tstrcmp(XmlGetText(n), JABBER_FEAT_IBB)) {
ftType = FT_IBB;
break;
- } } } } }
+ }
+ }
+ }
+ }
+ }
if (optionNode != NULL) {
// Found known stream mechanism
@@ -366,7 +380,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
pre.timestamp = time(NULL);
pre.files.t = (TCHAR**)&filename;
pre.lParam = (LPARAM)ft;
- if ((n = XmlGetChild(fileNode , "desc")) != NULL)
+ if ((n = XmlGetChild(fileNode, "desc")) != NULL)
pre.descr.t = (TCHAR*)XmlGetText(n);
ProtoChainRecvFile(ft->std.hContact, &pre);
@@ -380,7 +394,9 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
e << XCHILDNS(_T("no-valid-streams"), JABBER_FEAT_SI);
m_ThreadInfo->send(iq);
return;
- } } }
+ }
+ }
+ }
// Bad stream initiation, reply with bad-profile
XmlNodeIq iq(_T("error"), szId, from);
@@ -395,34 +411,36 @@ void CJabberProto::FtAcceptSiRequest(filetransfer *ft)
if (!m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
JABBER_LIST_ITEM *item;
- if ((item=ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
+ if ((item = ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
item->ft = ft;
m_ThreadInfo->send(
XmlNodeIq(_T("result"), ft->szId, ft->jid)
- << XCHILDNS(_T("si"), JABBER_FEAT_SI)
- << XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
- << XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"))
- << XCHILD(_T("field")) << XATTR(_T("var"), _T("stream-method"))
- << XCHILD(_T("value"), JABBER_FEAT_BYTESTREAMS));
-} }
+ << XCHILDNS(_T("si"), JABBER_FEAT_SI)
+ << XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
+ << XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"))
+ << XCHILD(_T("field")) << XATTR(_T("var"), _T("stream-method"))
+ << XCHILD(_T("value"), JABBER_FEAT_BYTESTREAMS));
+ }
+}
void CJabberProto::FtAcceptIbbRequest(filetransfer *ft)
{
if (!m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
JABBER_LIST_ITEM *item;
- if ((item=ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
+ if ((item = ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
item->ft = ft;
m_ThreadInfo->send(
XmlNodeIq(_T("result"), ft->szId, ft->jid)
- << XCHILDNS(_T("si"), JABBER_FEAT_SI)
- << XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
- << XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"))
- << XCHILD(_T("field")) << XATTR(_T("var"), _T("stream-method"))
- << XCHILD(_T("value"), JABBER_FEAT_IBB));
-} }
+ << XCHILDNS(_T("si"), JABBER_FEAT_SI)
+ << XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
+ << XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"))
+ << XCHILD(_T("field")) << XATTR(_T("var"), _T("stream-method"))
+ << XCHILD(_T("value"), JABBER_FEAT_IBB));
+ }
+}
BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
@@ -469,15 +487,15 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen)
if (item == NULL) {
m_ThreadInfo->send(
XmlNodeIq(_T("error"), id, from)
- << XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
- << XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
+ << XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
+ << XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
return FALSE;
}
// open event
if (bOpen) {
if (!item->jibb) {
- JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *) mir_alloc(sizeof(JABBER_IBB_TRANSFER));
+ JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
jibb->srcJID = mir_tstrdup(from);
jibb->dstJID = mir_tstrdup(to);
@@ -489,14 +507,14 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen)
item->jibb = jibb;
ForkThread((MyThreadFunc)&CJabberProto::IbbReceiveThread, jibb);
- m_ThreadInfo->send( XmlNodeIq(_T("result"), id, from));
+ m_ThreadInfo->send(XmlNodeIq(_T("result"), id, from));
return TRUE;
}
// stream already open
m_ThreadInfo->send(
XmlNodeIq(_T("error"), id, from)
- << XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
- << XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
+ << XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
+ << XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
return FALSE;
}
@@ -505,7 +523,7 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen)
item->jibb->bStreamClosed = TRUE;
SetEvent(item->jibb->hEvent);
- m_ThreadInfo->send( XmlNodeIq(_T("result"), id, from));
+ m_ThreadInfo->send(XmlNodeIq(_T("result"), id, from));
return TRUE;
}
@@ -521,7 +539,7 @@ int CJabberProto::FtReceive(HANDLE, filetransfer *ft, char* buffer, int datalen)
__int64 remainingBytes = ft->std.currentFileSize - ft->std.currentFileProgress;
if (remainingBytes > 0) {
- int writeSize = (remainingBytes<datalen) ? remainingBytes : datalen;
+ int writeSize = (remainingBytes < datalen) ? remainingBytes : datalen;
if (_write(ft->fileId, buffer, writeSize) != writeSize) {
debugLogA("_write() error");
return -1;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 6b38a3ee49..ec7563819b 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -33,24 +33,24 @@ int JabberGcGetStatus(JABBER_RESOURCE_STATUS *r);
struct JabberGcRecentInfo
{
- ptrT room, server, nick, password;
+ ptrT m_room, m_server, m_nick, m_password;
CJabberProto *ppro;
- JabberGcRecentInfo(CJabberProto* proto)
+ JabberGcRecentInfo(CJabberProto *proto)
{
ppro = proto;
}
- JabberGcRecentInfo(CJabberProto* proto, const TCHAR *_room, const TCHAR *_server, const TCHAR *_nick = NULL, const TCHAR *_password = NULL)
+ JabberGcRecentInfo(CJabberProto *proto, const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL)
{
ppro = proto;
- fillData(_room, _server, _nick, _password);
+ fillData(room, server, nick, password);
}
- JabberGcRecentInfo(CJabberProto* proto, const TCHAR *jid)
+ JabberGcRecentInfo(CJabberProto *proto, const TCHAR *jid)
{
ppro = proto;
fillData(jid);
}
- JabberGcRecentInfo(CJabberProto* proto, int iRecent)
+ JabberGcRecentInfo(CJabberProto *proto, int iRecent)
{
ppro = proto;
loadRecent(iRecent);
@@ -62,40 +62,40 @@ struct JabberGcRecentInfo
void cleanup()
{
- room = server = nick = password = NULL;
+ m_room = m_server = m_nick = m_password = NULL;
}
BOOL equals(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL)
{
return
- null_strequals(this->room, room) &&
- null_strequals(this->server, server) &&
- null_strequals(this->nick, nick) &&
- null_strequals(this->password, password);
+ null_strequals(m_room, room) &&
+ null_strequals(m_server, server) &&
+ null_strequals(m_nick, nick) &&
+ null_strequals(m_password, password);
}
BOOL equalsnp(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL)
{
return
- null_strequals(this->room, room) &&
- null_strequals(this->server, server) &&
- null_strequals(this->nick, nick);
+ null_strequals(m_room, room) &&
+ null_strequals(m_server, server) &&
+ null_strequals(m_nick, nick);
}
void fillForm(HWND hwndDlg)
{
- SetDlgItemText(hwndDlg, IDC_SERVER, server ? server : _T(""));
- SetDlgItemText(hwndDlg, IDC_ROOM, room ? room : _T(""));
- SetDlgItemText(hwndDlg, IDC_NICK, nick ? nick : _T(""));
- SetDlgItemText(hwndDlg, IDC_PASSWORD, password ? password : _T(""));
+ SetDlgItemText(hwndDlg, IDC_SERVER, m_server ? m_server : _T(""));
+ SetDlgItemText(hwndDlg, IDC_ROOM, m_room ? m_room : _T(""));
+ SetDlgItemText(hwndDlg, IDC_NICK, m_nick ? m_nick : _T(""));
+ SetDlgItemText(hwndDlg, IDC_PASSWORD, m_password ? m_password : _T(""));
}
void fillData(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL)
{
- this->room = mir_tstrdup(room);
- this->server = mir_tstrdup(server);
- this->nick = mir_tstrdup(nick);
- this->password = mir_tstrdup(password);
+ m_room = mir_tstrdup(room);
+ m_server = mir_tstrdup(server);
+ m_nick = mir_tstrdup(nick);
+ m_password = mir_tstrdup(password);
}
void fillData(const TCHAR *jid)
@@ -120,18 +120,18 @@ struct JabberGcRecentInfo
{
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "rcMuc_%d_server", iRecent);
- server = ppro->getTStringA(setting);
+ m_server = ppro->getTStringA(setting);
mir_snprintf(setting, "rcMuc_%d_room", iRecent);
- room = ppro->getTStringA(setting);
+ m_room = ppro->getTStringA(setting);
mir_snprintf(setting, "rcMuc_%d_nick", iRecent);
- nick = ppro->getTStringA(setting);
+ m_nick = ppro->getTStringA(setting);
mir_snprintf(setting, "password_rcMuc_%d", iRecent);
- password = ppro->getTStringA(NULL, setting);
+ m_password = ppro->getTStringA(NULL, setting);
- return room || server || nick || password;
+ return m_room || m_server || m_nick || m_password;
}
void saveRecent(int iRecent)
@@ -139,26 +139,26 @@ struct JabberGcRecentInfo
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "rcMuc_%d_server", iRecent);
- if (server)
- ppro->setTString(setting, server);
+ if (m_server)
+ ppro->setTString(setting, m_server);
else
ppro->delSetting(setting);
mir_snprintf(setting, "rcMuc_%d_room", iRecent);
- if (room)
- ppro->setTString(setting, room);
+ if (m_room)
+ ppro->setTString(setting, m_room);
else
ppro->delSetting(setting);
mir_snprintf(setting, "rcMuc_%d_nick", iRecent);
- if (nick)
- ppro->setTString(setting, nick);
+ if (m_nick)
+ ppro->setTString(setting, m_nick);
else
ppro->delSetting(setting);
mir_snprintf(setting, "password_rcMuc_%d", iRecent);
- if (password)
- ppro->setTString(setting, password);
+ if (m_password)
+ ppro->setTString(setting, m_password);
else
ppro->delSetting(setting);
}
@@ -251,12 +251,12 @@ void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, con
JABBER_LIST_ITEM *item = ListAdd(LIST_CHATROOM, text);
item->bAutoJoin = autojoin;
replaceStrT(item->nick, nick);
- replaceStrT(item->password, info.password);
+ replaceStrT(item->password, info.m_password);
int status = (m_iStatus == ID_STATUS_INVISIBLE) ? ID_STATUS_ONLINE : m_iStatus;
XmlNode x(_T("x")); x << XATTR(_T("xmlns"), JABBER_FEAT_MUC);
- if (info.password && info.password[0])
- x << XCHILD(_T("password"), info.password);
+ if (info.m_password && info.m_password[0])
+ x << XCHILD(_T("password"), info.m_password);
SendPresenceTo(status, text, x);
}
@@ -414,24 +414,24 @@ void CJabberDlgGcJoin::OnInitDialog()
WindowSetIcon(m_hwnd, m_proto, "group");
- JabberGcRecentInfo *info = NULL;
+ JabberGcRecentInfo *pInfo = NULL;
if (m_jid)
- info = new JabberGcRecentInfo(m_proto, m_jid);
+ pInfo = new JabberGcRecentInfo(m_proto, m_jid);
else if(OpenClipboard(m_hwnd)) {
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData) {
TCHAR *buf = (TCHAR *)GlobalLock(hData);
if (buf && _tcschr(buf, _T('@')) && !_tcschr(buf, _T(' ')))
- info = new JabberGcRecentInfo(m_proto, buf);
+ pInfo = new JabberGcRecentInfo(m_proto, buf);
GlobalUnlock(hData);
}
CloseClipboard();
}
- if (info) {
- info->fillForm(m_hwnd);
- delete info;
+ if (pInfo) {
+ pInfo->fillForm(m_hwnd);
+ delete pInfo;
}
ptrT tszNick(m_proto->getTStringA("Nick"));
@@ -466,9 +466,7 @@ void CJabberDlgGcJoin::OnInitDialog()
if (!info.loadRecent(i))
break;
- mir_sntprintf(jid, _countof(jid), _T("%s@%s (%s)"),
- info.room, info.server,
- info.nick ? info.nick : TranslateT("<no nick>"));
+ mir_sntprintf(jid, _T("%s@%s (%s)"), info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateT("<no nick>"));
SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
}
sttJoinDlgShowRecentItems(m_hwnd, i);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index c2cb84c87e..ebca9d50dd 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -86,7 +86,7 @@ int CIconPool::CPoolItem::cmp(const CPoolItem *p1, const CPoolItem *p2)
return mir_strcmp(p1->m_name, p2->m_name);
}
-CIconPool::CPoolItem::CPoolItem():
+CIconPool::CPoolItem::CPoolItem() :
m_name(NULL), m_szIcolibName(NULL), m_hIcolibItem(NULL)
{
}
@@ -168,7 +168,7 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
void CJabberProto::IconsInit(void)
{
m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * _countof(TransportProtoTable));
- for (int i=0; i < _countof(TransportProtoTable); i++)
+ for (int i = 0; i < _countof(TransportProtoTable); i++)
m_transportProtoTableStartIndex[i] = -1;
}
@@ -201,7 +201,7 @@ static inline TCHAR qtoupper(TCHAR c)
static BOOL WildComparei(const TCHAR *name, const TCHAR *mask)
{
- const TCHAR *last='\0';
+ const TCHAR *last = '\0';
for (;; mask++, name++) {
if (*mask != '?' && qtoupper(*mask) != qtoupper(*name))
break;
@@ -213,7 +213,7 @@ static BOOL WildComparei(const TCHAR *name, const TCHAR *mask)
return FALSE;
for (;; mask++, name++) {
- while(*mask == '*') {
+ while (*mask == '*') {
last = mask++;
if (*mask == '\0')
return ((BOOL)!*mask); /* true */
@@ -223,7 +223,8 @@ static BOOL WildComparei(const TCHAR *name, const TCHAR *mask)
return ((BOOL)!*mask); /* *mask == EOS */
if (*mask != '?' && qtoupper(*mask) != qtoupper(*name))
name -= (size_t)(mask - last) - 1, mask = last;
-} }
+ }
+}
static BOOL MatchMask(const TCHAR *name, const TCHAR *mask)
{
@@ -234,13 +235,13 @@ static BOOL MatchMask(const TCHAR *name, const TCHAR *mask)
return WildComparei(name, mask);
TCHAR *temp = NEWTSTR_ALLOCA(mask);
- for (int e=1; mask[e] != '\0'; e++) {
+ for (int e = 1; mask[e] != '\0'; e++) {
int s = e;
while (mask[e] != '\0' && mask[e] != '|')
e++;
- temp[e]= 0;
- if (WildComparei(name, temp+s))
+ temp[e] = 0;
+ if (WildComparei(name, temp + s))
return TRUE;
if (mask[e] == 0)
@@ -253,37 +254,37 @@ static BOOL MatchMask(const TCHAR *name, const TCHAR *mask)
static HICON ExtractIconFromPath(const char *path, BOOL * needFree)
{
char *comma;
- char file[MAX_PATH],fileFull[MAX_PATH];
+ char file[MAX_PATH], fileFull[MAX_PATH];
int n;
HICON hIcon;
- mir_strncpy(file,path,sizeof(file));
- comma=strrchr(file,',');
- if (comma == NULL) n=0;
- else {n=atoi(comma+1); *comma=0;}
+ mir_strncpy(file, path, sizeof(file));
+ comma = strrchr(file, ',');
+ if (comma == NULL) n = 0;
+ else { n = atoi(comma + 1); *comma = 0; }
PathToAbsolute(file, fileFull);
- hIcon=NULL;
- ExtractIconExA(fileFull,n,NULL,&hIcon,1);
+ hIcon = NULL;
+ ExtractIconExA(fileFull, n, NULL, &hIcon, 1);
if (needFree)
- *needFree=(hIcon != NULL);
+ *needFree = (hIcon != NULL);
return hIcon;
}
-static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectName,TCHAR *Description,int internalidx, BOOL * needFree)
+static HICON LoadTransportIcon(char *filename, int i, char *IconName, TCHAR *SectName, TCHAR *Description, int internalidx, BOOL *needFree)
{
- char szPath[MAX_PATH],szMyPath[MAX_PATH], szFullPath[MAX_PATH],*str;
- BOOL has_proto_icon=FALSE;
- if (needFree) *needFree=FALSE;
+ char szPath[MAX_PATH], szMyPath[MAX_PATH], szFullPath[MAX_PATH], *str;
+ BOOL has_proto_icon = FALSE;
+ if (needFree) *needFree = FALSE;
GetModuleFileNameA(NULL, szPath, MAX_PATH);
- str=strrchr(szPath,'\\');
- if (str != NULL) *str=0;
+ str = strrchr(szPath, '\\');
+ if (str != NULL) *str = 0;
mir_snprintf(szMyPath, _countof(szMyPath), "%s\\Icons\\%s", szPath, filename);
mir_snprintf(szFullPath, _countof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
BOOL nf;
- HICON hi=ExtractIconFromPath(szFullPath,&nf);
- if (hi) has_proto_icon=TRUE;
+ HICON hi = ExtractIconFromPath(szFullPath, &nf);
+ if (hi) has_proto_icon = TRUE;
if (hi && nf) DestroyIcon(hi);
- if (IconName != NULL && SectName != NULL) {
+ if (IconName != NULL && SectName != NULL) {
SKINICONDESC sid = { 0 };
sid.hDefaultIcon = (has_proto_icon) ? NULL : Skin_LoadProtoIcon(0, -internalidx);
sid.section.t = SectName;
@@ -297,39 +298,29 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa
return IcoLib_GetIcon(IconName);
}
-static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
-{
- HICON hIcon=NULL; // icon handle
- int index=-(int)lpIconName;
- TCHAR filename[MAX_PATH]={0};
- GetModuleFileName(hInstance,filename,MAX_PATH);
- ExtractIconEx(filename,index,NULL,&hIcon,1);
- return hIcon;
-}
-
int CJabberProto::LoadAdvancedIcons(int iID)
{
char *proto = TransportProtoTable[iID].proto;
- char defFile[MAX_PATH] = {0};
+ char defFile[MAX_PATH] = { 0 };
TCHAR Group[255];
char Uname[255];
- int first=-1;
- HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102));
+ int first = -1;
+ HICON empty = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mir_sntprintf(Group, _countof(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
- mir_snprintf(defFile, _countof(defFile), "proto_%s.dll",proto);
+ mir_sntprintf(Group, LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
+ mir_snprintf(defFile, "proto_%s.dll", proto);
if (!hAdvancedStatusIcon)
- hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
+ hAdvancedStatusIcon = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
mir_cslock lck(m_csModeMsgMutex);
- for (int i=0; i < ID_STATUS_ONTHEPHONE-ID_STATUS_OFFLINE; i++) {
+ for (int i = 0; i < ID_STATUS_ONTHEPHONE - ID_STATUS_OFFLINE; i++) {
BOOL needFree;
int n = skinStatusToJabberStatus[i];
- TCHAR *descr = pcli->pfnGetStatusModeDescription(n+ID_STATUS_OFFLINE, 0);
+ TCHAR *descr = pcli->pfnGetStatusModeDescription(n + ID_STATUS_OFFLINE, 0);
mir_snprintf(Uname, _countof(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
- HICON hicon = LoadTransportIcon(defFile,-skinIconStatusToResourceId[i],Uname,Group,descr,-(n+ID_STATUS_OFFLINE),&needFree);
- int index = (m_transportProtoTableStartIndex[iID] == -1)?-1:m_transportProtoTableStartIndex[iID]+n;
- int added = ImageList_ReplaceIcon(hAdvancedStatusIcon,index,hicon?hicon:empty);
+ HICON hicon = LoadTransportIcon(defFile, -skinIconStatusToResourceId[i], Uname, Group, descr, -(n + ID_STATUS_OFFLINE), &needFree);
+ int index = (m_transportProtoTableStartIndex[iID] == -1) ? -1 : m_transportProtoTableStartIndex[iID] + n;
+ int added = ImageList_ReplaceIcon(hAdvancedStatusIcon, index, hicon ? hicon : empty);
if (first == -1)
first = added;
if (hicon && needFree)
@@ -343,8 +334,8 @@ int CJabberProto::LoadAdvancedIcons(int iID)
int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
{
- for (int i=0; i<_countof(TransportProtoTable); i++)
- if ( MatchMask(TransportDomain, TransportProtoTable[i].mask))
+ for (int i = 0; i < _countof(TransportProtoTable); i++)
+ if (MatchMask(TransportDomain, TransportProtoTable[i].mask))
return i;
return -1;
@@ -366,7 +357,7 @@ int CJabberProto::GetTransportStatusIconIndex(int iID, int Status)
if (Status < ID_STATUS_OFFLINE)
Status = ID_STATUS_OFFLINE;
- return m_transportProtoTableStartIndex[iID] + skinStatusToJabberStatus[ Status - ID_STATUS_OFFLINE ];
+ return m_transportProtoTableStartIndex[iID] + skinStatusToJabberStatus[Status - ID_STATUS_OFFLINE];
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -374,7 +365,7 @@ int CJabberProto::GetTransportStatusIconIndex(int iID, int Status)
int CJabberProto::OnReloadIcons(WPARAM, LPARAM)
{
- for (int i=0; i < _countof(TransportProtoTable); i++)
+ for (int i = 0; i < _countof(TransportProtoTable); i++)
if (m_transportProtoTableStartIndex[i] != -1)
LoadAdvancedIcons(i);
@@ -398,7 +389,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM hContact, LPARAM)
if (!getByte(hContact, "IsTransported", 0))
return -1;
- int iID = GetTransportProtoID( ptrT( getTStringA(hContact, "Transport")));
+ int iID = GetTransportProtoID(ptrT(getTStringA(hContact, "Transport")));
if (iID < 0)
return -1;
@@ -420,11 +411,11 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta
return FALSE;
// strip domain part from jid
- TCHAR *domain = _tcschr((TCHAR*)jid, '@');
- BOOL isAgent = (domain == NULL) ? TRUE : FALSE;
- BOOL isTransported = FALSE;
+ TCHAR *domain = _tcschr((TCHAR*)jid, '@');
+ BOOL isAgent = (domain == NULL) ? TRUE : FALSE;
+ BOOL isTransported = FALSE;
if (domain != NULL)
- domain = NEWTSTR_ALLOCA(domain+1);
+ domain = NEWTSTR_ALLOCA(domain + 1);
else
domain = NEWTSTR_ALLOCA(jid);
@@ -432,7 +423,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta
if (resourcepos != NULL)
*resourcepos = '\0';
- for (int i=0; i < _countof(TransportProtoTable); i++)
+ for (int i = 0; i < _countof(TransportProtoTable); i++)
if (MatchMask(domain, TransportProtoTable[i].mask)) {
GetTransportStatusIconIndex(GetTransportProtoID(domain), ID_STATUS_OFFLINE);
isTransported = TRUE;
@@ -440,7 +431,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta
}
if (m_lstTransports.getIndex(domain) == -1 && isAgent) {
- m_lstTransports.insert( mir_tstrdup(domain));
+ m_lstTransports.insert(mir_tstrdup(domain));
setByte(hContact, "IsTransport", 1);
}
@@ -454,7 +445,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta
void CJabberProto::CheckAllContactsAreTransported()
{
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrT jid(getTStringA(hContact, "jid"));
if (jid)
DBCheckIsTransportedContact(jid, hContact);
}
@@ -525,29 +516,29 @@ static IconItem sharedIconList4[] =
void g_IconsInit()
{
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
}
HANDLE g_GetIconHandle(int iconId)
{
int i;
- for (i=0; i < _countof(sharedIconList1); i++)
+ for (i = 0; i < _countof(sharedIconList1); i++)
if (sharedIconList1[i].defIconID == iconId)
return sharedIconList1[i].hIcolib;
- for (i=0; i < _countof(sharedIconList2); i++)
+ for (i = 0; i < _countof(sharedIconList2); i++)
if (sharedIconList2[i].defIconID == iconId)
return sharedIconList2[i].hIcolib;
- for (i=0; i < _countof(sharedIconList3); i++)
+ for (i = 0; i < _countof(sharedIconList3); i++)
if (sharedIconList3[i].defIconID == iconId)
return sharedIconList3[i].hIcolib;
- for (i=0; i < _countof(sharedIconList4); i++)
+ for (i = 0; i < _countof(sharedIconList4); i++)
if (sharedIconList4[i].defIconID == iconId)
return sharedIconList4[i].hIcolib;
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h
index d567d47a2d..941fe8c76a 100644
--- a/protocols/JabberG/src/jabber_iq.h
+++ b/protocols/JabberG/src/jabber_iq.h
@@ -158,7 +158,7 @@ protected:
void ExpireInfo(CJabberIqInfo *pInfo);
public:
- CJabberIqManager(CJabberProto* proto);
+ CJabberIqManager(CJabberProto *proto);
~CJabberIqManager();
bool Start();
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index dd5a94857c..c6ad02925c 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -104,7 +104,7 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo)
TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
- mir_sntprintf(szTZ, _countof(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
+ mir_sntprintf(szTZ, _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq(_T("result"), pInfo);
HXML timeNode = iq << XCHILDNS(_T("time"), JABBER_FEAT_ENTITY_TIME);
@@ -125,7 +125,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo)
_tzset();
time(&ltime);
gmt = gmtime(&ltime);
- mir_sntprintf(stime, _countof(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
+ mir_sntprintf(stime, _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
dtime = _tctime(&ltime);
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 9326a4264b..5c55583396 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -502,7 +502,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
if (m_options.AutoJoinConferences)
for (int i=0; i < chatRooms.getCount(); i++)
- GroupchatJoinByHContact((MCONTACT)chatRooms[i], true);
+ GroupchatJoinByHContact((DWORD_PTR)chatRooms[i], true);
UI_SAFE_NOTIFY_HWND(m_hwndJabberAddBookmark, WM_JABBER_CHECK_ONLINE);
WindowList_Broadcast(m_hWindowList, WM_JABBER_CHECK_ONLINE, 0, 0);
@@ -648,7 +648,6 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
HXML vCardNode, m, n, o;
const TCHAR *type, *jid;
MCONTACT hContact;
- TCHAR text[128];
DBVARIANT dbv;
debugLogA("<iq/> iqIdGetVcard");
@@ -810,6 +809,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
else if (!mir_tstrcmp(XmlGetName(n), _T("ADR"))) {
if (!hasHome && XmlGetChild(n, "HOME") != NULL) {
// Home address
+ TCHAR text[128];
hasHome = true;
if ((m=XmlGetChild(n, "STREET")) != NULL && XmlGetText(m) != NULL) {
hasHomeStreet = true;
@@ -855,6 +855,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
// Work address
hasWork = true;
if ((m=XmlGetChild(n, "STREET")) != NULL && XmlGetText(m) != NULL) {
+ TCHAR text[128];
hasWorkStreet = true;
if (hContact != NULL) {
if ((o=XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL)
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 17307fbbc6..dbc81e1a7d 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -117,14 +117,14 @@ static void sttFillJidList(HWND hwndDlg)
if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = XmlGetText(XmlGetChild(itemNode , _T("reason")));
if (reason != NULL) {
- mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , jid, reason);
+ mir_sntprintf(tszItemText, _T("%s (%s)") , jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
LPCTSTR nick = XmlGetAttrValue(itemNode, _T("nick"));
if (nick != NULL) {
- mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , nick, jid);
+ mir_sntprintf(tszItemText, _T("%s (%s)") , nick, jid);
lvi.pszText = tszItemText;
}
}
@@ -248,7 +248,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
HXML queryNode = XmlGetChild(iqNode , _T("query"));
if (queryNode != NULL) {
TCHAR *localFrom = mir_tstrdup(from);
- mir_sntprintf(title, _countof(title), TranslateT("%s, %d items (%s)"),
+ mir_sntprintf(title, TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
(dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
@@ -347,7 +347,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
//delete
TCHAR msgText[128];
- mir_sntprintf(msgText, _countof(msgText), TranslateT("Removing %s?"), text);
+ mir_sntprintf(msgText, TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND) == IDYES) {
dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam);
mir_free((void *)lvi.lParam);
diff --git a/protocols/JabberG/src/jabber_message_manager.h b/protocols/JabberG/src/jabber_message_manager.h
index c0bfdac3bf..0e88a5bd22 100644
--- a/protocols/JabberG/src/jabber_message_manager.h
+++ b/protocols/JabberG/src/jabber_message_manager.h
@@ -122,7 +122,7 @@ protected:
OBJLIST<CJabberMessagePermanentInfo> m_arHandlers;
public:
- CJabberMessageManager(CJabberProto* proto);
+ CJabberMessageManager(CJabberProto *proto);
~CJabberMessageManager();
CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index bf376b217d..2fadd3420b 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -47,7 +47,7 @@ void JabberChatDllError()
{
MessageBox(NULL,
TranslateT("CHAT plugin is required for conferences. Install it before chatting"),
- TranslateT("Jabber Error"), MB_OK|MB_SETFOREGROUND);
+ TranslateT("Jabber Error"), MB_OK | MB_SETFOREGROUND);
}
///////////////////////////////////////////////////////////////////////////////
@@ -83,14 +83,14 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick)
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = (DWORD)(sizeof(DWORD)*2 + mir_strlen(szNick) + mir_strlen(szJid) + 5);
+ dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + mir_strlen(szJid) + 5);
PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
*((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD);
*((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD);
- mir_strcpy((char*)pCurBlob, szNick); pCurBlob += mir_strlen(szNick)+1;
+ mir_strcpy((char*)pCurBlob, szNick); pCurBlob += mir_strlen(szNick) + 1;
*pCurBlob = '\0'; pCurBlob++; //firstName
*pCurBlob = '\0'; pCurBlob++; //lastName
- mir_strcpy((char*)pCurBlob, szJid); pCurBlob += mir_strlen(szJid)+1;
+ mir_strcpy((char*)pCurBlob, szJid); pCurBlob += mir_strlen(szJid) + 1;
*pCurBlob = '\0'; //reason
db_event_add(NULL, &dbei);
@@ -102,13 +102,13 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick)
MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource)
{
- if (jid == NULL || jid[0]=='\0')
+ if (jid == NULL || jid[0] == '\0')
return NULL;
TCHAR *s = NEWTSTR_ALLOCA(jid);
- TCHAR *q = NULL, *p;
+ TCHAR *q = NULL;
// strip resource if present
- if ((p = _tcschr(s, '@')) != NULL)
+ if (TCHAR *p = _tcschr(s, '@'))
if ((q = _tcschr(p, '/')) != NULL)
*q = '\0';
@@ -118,12 +118,12 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL
// We can't use JabberHContactFromJID() here because of the stripResource option
size_t len = mir_tstrlen(s);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT jid( getTStringA(hContact, "jid"));
- if (jid == NULL)
+ ptrT dbJid(getTStringA(hContact, "jid"));
+ if (dbJid == NULL)
continue;
- TCHAR *p = jid;
- if (p && mir_tstrlen(p) >= len && (p[len]=='\0'||p[len]=='/') && !_tcsnicmp(p, s, len))
+ TCHAR *p = dbJid; // not null
+ if (_tcslen(p) >= len && (p[len] == '\0' || p[len] == '/') && !_tcsnicmp(p, s, len))
return hContact;
}
@@ -137,7 +137,7 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL
else
SendGetVcard(s);
debugLog(_T("Create Jabber contact jid=%s, nick=%s"), s, nick);
- DBCheckIsTransportedContact(s,hNewContact);
+ DBCheckIsTransportedContact(s, hNewContact);
return hNewContact;
}
@@ -184,9 +184,9 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(pszDest);
- pszDest[ tPathLen++ ] = '\\';
+ pszDest[tPathLen++] = '\\';
- const TCHAR* szFileType = ProtoGetAvatarExtension( getByte(hContact, "AvatarType", PA_FORMAT_PNG));
+ const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_PNG));
if (hContact != NULL) {
char str[256];
@@ -194,7 +194,7 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c
DBVARIANT dbv;
if (!db_get_utf(hContact, m_szModuleName, "jid", &dbv)) {
strncpy_s(str, dbv.pszVal, _TRUNCATE);
- str[ sizeof(str)-1 ] = 0;
+ str[sizeof(str) - 1] = 0;
db_free(&dbv);
}
else _i64toa((LONG_PTR)hContact, str, 10);
@@ -205,7 +205,7 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c
m_ThreadInfo->conn.username, m_ThreadInfo->conn.server, szFileType);
}
else {
- ptrA res1( getStringA("LoginName")), res2( getStringA("LoginServer"));
+ ptrA res1(getStringA("LoginName")), res2(getStringA("LoginServer"));
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S@%S avatar%s"),
(res1) ? (LPSTR)res1 : "noname", (res2) ? (LPSTR)res2 : m_szModuleName, szFileType);
}
@@ -225,15 +225,15 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid)
if (!getByte(hContact, "IsTransported", 0))
continue;
- ptrT dbJid( getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
- ptrT dbNick( getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
+ ptrT dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
+ ptrT dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
TCHAR *p = _tcschr(dbJid, '@');
if (p == NULL)
continue;
*p = 0;
- if (!mir_tstrcmp(jid, p+1) && !mir_tstrcmp(dbJid, dbNick)) {
+ if (!mir_tstrcmp(jid, p + 1) && !mir_tstrcmp(dbJid, dbNick)) {
*p = '@';
m_ThreadInfo->resolveID = SendGetVcard(dbJid);
m_ThreadInfo->resolveContact = hContact;
@@ -401,13 +401,13 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource)
if (!tszMirVer.IsEmpty())
setTString(hContact, "MirVer", tszMirVer);
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrT jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return;
TCHAR szFullJid[JABBER_MAX_JID_LEN];
if (resource->m_tszResourceName && !_tcschr(jid, '/'))
- mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
+ mir_sntprintf(szFullJid, _T("%s/%s"), jid, resource->m_tszResourceName);
else
mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index 5b35fe871b..29bd0e7129 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -137,9 +137,8 @@ void CNoteList::LoadXml(HXML hXml)
destroy();
m_bIsModified = false;
- int count = XmlGetChildCount(hXml);
- for (int i=0; i < count; i++)
- {
+ int iCount = XmlGetChildCount(hXml);
+ for (int i = 0; i < iCount; i++) {
CNoteItem *pNote = new CNoteItem(xmlGetChild(hXml, i));
if (pNote->IsNotEmpty())
insert(pNote);
@@ -153,8 +152,7 @@ void CNoteList::SaveXml(HXML hXmlParent)
m_bIsModified = false;
CNoteList &me = *this;
- for (int i=0; i < getCount(); i++)
- {
+ for (int i = 0; i < getCount(); i++) {
HXML hXmlItem = hXmlParent << XCHILD(_T("note"));
hXmlItem << XATTR(_T("from"), me[i].GetFrom()) << XATTR(_T("tags"), me[i].GetTagsStr());
hXmlItem << XCHILD(_T("title"), me[i].GetTitle());
@@ -211,7 +209,7 @@ private:
}
};
-CJabberDlgNoteItem::CJabberDlgNoteItem(CJabberDlgBase *parent, CNoteItem *pNote):
+CJabberDlgNoteItem::CJabberDlgNoteItem(CJabberDlgBase *parent, CNoteItem *pNote) :
CSuper(parent->GetProto(), IDD_NOTE_EDIT),
m_pNote(pNote),
m_fnProcess(NULL),
@@ -224,7 +222,7 @@ CJabberDlgNoteItem::CJabberDlgNoteItem(CJabberDlgBase *parent, CNoteItem *pNote)
m_btnOk.OnClick = Callback(this, &CJabberDlgNoteItem::btnOk_OnClick);
}
-CJabberDlgNoteItem::CJabberDlgNoteItem(CJabberProto *proto, CNoteItem *pNote, TFnProcessNote fnProcess):
+CJabberDlgNoteItem::CJabberDlgNoteItem(CJabberProto *proto, CNoteItem *pNote, TFnProcessNote fnProcess) :
CSuper(proto, IDD_NOTE_EDIT),
m_pNote(pNote),
m_fnProcess(fnProcess),
@@ -278,7 +276,7 @@ int CJabberDlgNoteItem::Resizer(UTILRESIZECONTROL *urc)
/////////////////////////////////////////////////////////////////////////////////////////
// Notebook window
-class CCtrlNotebookList: public CCtrlListBox
+class CCtrlNotebookList : public CCtrlListBox
{
typedef CCtrlListBox CSuper;
bool m_adding;
@@ -291,7 +289,7 @@ public:
{
m_hfntNormal = m_hfntSmall = m_hfntBold = NULL;
}
-
+
void SetFonts(HFONT hfntNormal, HFONT hfntSmall, HFONT hfntBold)
{
m_hfntNormal = hfntNormal;
@@ -486,8 +484,8 @@ private:
for (int i = 0; i < m_proto->m_notes.getCount(); i++) {
TCHAR *tags = m_proto->m_notes[i].GetTags();
for (TCHAR *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1)
- if (!tagSet.find(tag))
- tagSet.insert(tag);
+ if (!tagSet.find(tag))
+ tagSet.insert(tag);
}
bool selected = false;
@@ -530,7 +528,7 @@ private:
void ListItems(const TCHAR *tag)
{
m_lstNotes.ResetContent();
- for (int i=0; i < m_proto->m_notes.getCount(); i++)
+ for (int i = 0; i < m_proto->m_notes.getCount(); i++)
if (m_proto->m_notes[i].HasTag(tag))
InsertItem(m_proto->m_notes[i]);
EnableControls();
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index e76dd082e2..e422eca806 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -1168,7 +1168,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg)
TCHAR filename[MAX_PATH] = { 0 };
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, _countof(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
+ mir_sntprintf(filter, _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 5264a5b250..13fe033689 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -991,16 +991,16 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
TCHAR szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
- mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _T("If Jabber ID is '%s' then"), pRule->GetValue());
break;
case Group:
- mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _T("If group is '%s' then"), pRule->GetValue());
break;
case Subscription:
- mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _T("If subscription is '%s' then"), pRule->GetValue());
break;
case Else:
- mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("Else"));
+ mir_sntprintf(szTypeValue, _T("Else"));
break;
}
@@ -1033,7 +1033,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
}
TCHAR szListItem[ 512 ];
- mir_sntprintf(szListItem, _countof(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
+ mir_sntprintf(szListItem, _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem);
SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETITEMDATA, nItemId, (LPARAM)pRule);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 0cfc3446f8..bf467a484b 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -633,7 +633,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
for (int i=0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
TCHAR tmp[JABBER_MAX_JID_LEN];
- mir_sntprintf(tmp, _countof(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
+ mir_sntprintf(tmp, _T("%s/%s"), szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
@@ -716,7 +716,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
mir_free(szServer);
szServer = mir_tstrdup(_T("sms"));
}
- mir_sntprintf(jsb->jid, _countof(jsb->jid), _T("%s@%s"), szJid, szServer);
+ mir_sntprintf(jsb->jid, _T("%s@%s"), szJid, szServer);
}
else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
@@ -1122,7 +1122,7 @@ int __cdecl CJabberProto::SetStatus(int iNewStatus)
void __cdecl CJabberProto::GetAwayMsgThread(void *param)
{
- MCONTACT hContact = (MCONTACT)param;
+ MCONTACT hContact = (DWORD_PTR)param;
ptrT jid(getTStringA(hContact, "jid"));
if (jid != NULL) {
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index eb347895b9..0a1ee0901f 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -310,7 +310,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc
// priority
TCHAR szPriority[ 256 ];
- mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (short)getWord("Priority", 5));
+ mir_sntprintf(szPriority, _T("%d"), (short)getWord("Priority", 5));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Priority")) << XATTR(_T("type"), _T("text-single"))
<< XATTR(_T("var"), _T("status-priority")) << XCHILD(_T("value"), szPriority);
@@ -414,12 +414,12 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
// Automatically Accept File Transfers
TCHAR szTmpBuff[ 1024 ];
- mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
+ mir_sntprintf(szTmpBuff, _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Automatically Accept File Transfers"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("auto-files")) << XCHILD(_T("value"), szTmpBuff);
// Use sounds
- mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
+ mir_sntprintf(szTmpBuff, _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Play sounds"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("sounds")) << XCHILD(_T("value"), szTmpBuff);
@@ -495,7 +495,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
- mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no messages to forward"));
+ mir_sntprintf(szMsg, TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -517,7 +517,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
xNode << XCHILD(_T("title"), TranslateT("Forward options"));
- mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
+ mir_sntprintf(szMsg, TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
xNode << XCHILD(_T("instructions"), szMsg);
xNode << XCHILD(_T("field")) << XATTR(_T("type"), _T("hidden")) << XATTR(_T("var"), _T("FORM_TYPE"))
@@ -583,7 +583,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1;
if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
- mir_sntprintf(szOFrom, _countof(szOFrom), _T("%s/%s"), tszJid, szOResource);
+ mir_sntprintf(szOFrom, _T("%s/%s"), tszJid, szOResource);
} else
_tcsncpy_s(szOFrom, tszJid, _TRUNCATE);
@@ -593,7 +593,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(&ltime);
TCHAR stime[512];
- mir_sntprintf(stime, _countof(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
+ mir_sntprintf(stime, _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(_T("delay"), _T("urn:xmpp:delay")) << XATTR(_T("stamp"), stime);
@@ -607,7 +607,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
}
}
- mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
+ mir_sntprintf(szMsg, TranslateT("%d message(s) forwarded"), nEventsSent);
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -627,9 +627,9 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes
TCHAR szMsg[ 1024 ];
if (bOk)
- mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Workstation successfully locked"));
+ mir_sntprintf(szMsg, TranslateT("Workstation successfully locked"));
else
- mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
+ mir_sntprintf(szMsg, TranslateT("Error %d occurred during workstation lock"), GetLastError());
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe
if (!nChatsCount) {
TCHAR szMsg[ 1024 ];
- mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no group chats to leave"));
+ mir_sntprintf(szMsg, TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
diff --git a/protocols/JabberG/src/jabber_send_manager.cpp b/protocols/JabberG/src/jabber_send_manager.cpp
index af2767d88b..c67cfa95fc 100644
--- a/protocols/JabberG/src/jabber_send_manager.cpp
+++ b/protocols/JabberG/src/jabber_send_manager.cpp
@@ -31,7 +31,7 @@ static int CompareItems(const CJabberSendPermanentInfo *p1, const CJabberSendPer
return p1->getPriority() - p2->getPriority();
}
-CJabberSendManager::CJabberSendManager(CJabberProto* proto) :
+CJabberSendManager::CJabberSendManager(CJabberProto *proto) :
m_arHandlers(1, CompareItems)
{
ppro = proto;
diff --git a/protocols/JabberG/src/jabber_send_manager.h b/protocols/JabberG/src/jabber_send_manager.h
index 304b4be17d..279ea01308 100644
--- a/protocols/JabberG/src/jabber_send_manager.h
+++ b/protocols/JabberG/src/jabber_send_manager.h
@@ -93,7 +93,7 @@ protected:
OBJLIST<CJabberSendPermanentInfo> m_arHandlers;
public:
- CJabberSendManager(CJabberProto* proto);
+ CJabberSendManager(CJabberProto *proto);
~CJabberSendManager();
CJabberSendPermanentInfo* AddPermanentHandler(JABBER_SEND_HANDLER pHandler, void *pUserData = NULL, SEND_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index 485d85ff01..e911f2a2c9 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -78,7 +78,7 @@ void CJabberProto::ConvertPasswords()
break;
mir_snprintf(varName, _countof(varName), "rcMuc_%d", i);
- ptrT passw(JSetStringCrypt(m_szModuleName, NULL, varName));
+ passw = JSetStringCrypt(m_szModuleName, NULL, varName);
if (passw != NULL) {
delSetting(varName);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index ff9279d881..20eed98aac 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -153,7 +153,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
if (TCHAR *bestResName = ListGetBestClientResourceNamePtr(tszJid))
- mir_sntprintf(szJid, _countof(szJid), _T("%s/%s"), tszJid, bestResName);
+ mir_sntprintf(szJid, _T("%s/%s"), tszJid, bestResName);
if (szJid[0] == 0)
_tcsncpy_s(szJid, tszJid, _TRUNCATE);
@@ -533,7 +533,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM)
TCHAR tszJid[JABBER_MAX_JID_LEN];
TCHAR *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
- mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, szResource);
+ mir_sntprintf(tszJid, _T("%s/%s"), jid, szResource);
else
_tcsncpy_s(tszJid, jid, _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 34e1f98944..f533190ef9 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -217,11 +217,11 @@ void CJabberProto::xmlStreamInitializeNow(ThreadData *info)
xmlDestroyNode(n);
}
-void CJabberProto::ServerThread(JABBER_CONN_DATA *param)
+void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam)
{
ptrT tszValue;
- ThreadData info(this, param);
+ ThreadData info(this, pParam);
debugLogA("Thread started: type=%d", info.bIsReg);
@@ -290,7 +290,7 @@ LBL_FatalError:
}
TCHAR jidStr[512];
- mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
+ mir_sntprintf(jidStr, _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
_tcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
@@ -299,7 +299,7 @@ LBL_FatalError:
if (m_savedPassword != NULL)
_tcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
- mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
+ mir_sntprintf(jidStr, _T("%s@%S"), info.conn.username, info.conn.server);
JabberPasswordDlgParam param;
param.pro = this;
@@ -971,8 +971,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node)
szLengthInTime[0] = 0;
if (szLength) {
int nLength = _ttoi(szLength);
- mir_sntprintf(szLengthInTime, _countof(szLengthInTime), _T("%02d:%02d:%02d"),
- nLength / 3600, (nLength / 60) % 60, nLength % 60);
+ mir_sntprintf(szLengthInTime, _T("%02d:%02d:%02d"), nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
SetContactTune(hContact, szArtist, szLength ? szLengthInTime : NULL, szSource, szTitle, szTrack);
@@ -1290,8 +1289,8 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
TCHAR chkJID[JABBER_MAX_JID_LEN] = _T("@");
JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
- for (int i = 1;; i++) {
- HXML iNode = XmlGetNthChild(xNode, _T("item"), i);
+ for (int j = 1;; j++) {
+ HXML iNode = XmlGetNthChild(xNode, _T("item"), j);
if (iNode == NULL)
break;
@@ -1301,14 +1300,14 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
const TCHAR *group = XmlGetText(XmlGetChild(iNode, _T("group")));
if (action && jid && _tcsstr(jid, chkJID)) {
if (!mir_tstrcmp(action, _T("add"))) {
- MCONTACT hContact = DBCreateContact(jid, nick, FALSE, FALSE);
+ MCONTACT cc = DBCreateContact(jid, nick, FALSE, FALSE);
if (group)
- db_set_ts(hContact, "CList", "Group", group);
+ db_set_ts(cc, "CList", "Group", group);
}
else if (!mir_tstrcmp(action, _T("delete"))) {
- MCONTACT hContact = HContactFromJID(jid);
- if (hContact)
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ MCONTACT cc = HContactFromJID(jid);
+ if (cc)
+ CallService(MS_DB_CONTACT_DELETE, cc, 0);
}
}
}
@@ -1836,7 +1835,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from)
{
if (m_regInfo && from) {
TCHAR text[MAX_PATH];
- mir_sntprintf(text, MAX_PATH, _T("%s@%S"), m_regInfo->conn.username, m_regInfo->conn.server);
+ mir_sntprintf(text, _T("%s@%S"), m_regInfo->conn.username, m_regInfo->conn.server);
XmlNodeIq iq(_T("set"), SerialNext(), (TCHAR*)from);
iq << XATTR(_T("from"), text);
HXML query = iq << XQUERY(JABBER_FEAT_REGISTER);
@@ -1965,26 +1964,26 @@ int ThreadData::recv(char* buf, size_t len)
return recvws(buf, len, MSG_DUMPASTEXT);
}
-int ThreadData::sendws(char* buffer, size_t bufsize, int flags)
+int ThreadData::sendws(char* buf, size_t bufsize, int flags)
{
- return proto->WsSend(s, buffer, (int)bufsize, flags);
+ return proto->WsSend(s, buf, (int)bufsize, flags);
}
-int ThreadData::send(char* buffer, int bufsize)
+int ThreadData::send(char* buf, int bufsize)
{
if (this == NULL)
return 0;
if (bufsize == -1)
- bufsize = (int)mir_strlen(buffer);
+ bufsize = (int)mir_strlen(buf);
WaitForSingleObject(iomutex, 6000);
int result;
if (useZlib)
- result = zlibSend(buffer, bufsize);
+ result = zlibSend(buf, bufsize);
else
- result = sendws(buffer, bufsize, MSG_DUMPASTEXT);
+ result = sendws(buf, bufsize, MSG_DUMPASTEXT);
ReleaseMutex(iomutex);
return result;
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp
index 8736508387..8b75279968 100644
--- a/protocols/JabberG/src/jabber_treelist.cpp
+++ b/protocols/JabberG/src/jabber_treelist.cpp
@@ -322,8 +322,8 @@ void TreeList_Update(HWND hwnd)
else {
for (int i = data->hItemSelected->subItems.getCount(); i--;)
sttTreeList_CreateItems_List(data->hItemSelected->subItems[i], (LPARAM)hwnd);
- for (HTREELISTITEM hItem = data->hItemSelected; !(hItem->flags & TLIF_ROOT); hItem = hItem->parent)
- sttTreeList_CreateItems_List(hItem, (LPARAM)hwnd);
+ for (HTREELISTITEM p = data->hItemSelected; !(p->flags & TLIF_ROOT); p = p->parent)
+ sttTreeList_CreateItems_List(p, (LPARAM)hwnd);
}
ListView_SortItems(hwnd, sttTreeList_SortFunc, 0);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index cff0711614..9078cd998a 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -251,7 +251,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
// Resource priority
TCHAR szPriority[128];
- mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (int)r->m_iPriority);
+ mir_sntprintf(szPriority, _T("%d"), (int)r->m_iPriority);
sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY));
// Idle
@@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
TCHAR szDescription[ 1024 ];
if (g_JabberFeatCapPairs[i].tszDescription)
- mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature);
+ mir_sntprintf(szDescription, _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature);
else
_tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE);
sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i));
@@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) {
TCHAR szDescription[ 1024 ];
if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription)
- mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature);
+ mir_sntprintf(szDescription, _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature);
else
_tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE);
sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i));
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index d98e163758..7ab1794408 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -733,7 +733,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
ptrT email( ppro->getTStringA(idstr));
if (email == NULL) break;
- mir_sntprintf(number, _countof(number), _T("%d"), i+1);
+ mir_sntprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
ptrT phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
- mir_sntprintf(number, _countof(number), _T("%d"), i+1);
+ mir_sntprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -880,7 +880,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
else if (hti.iSubItem == 2) {
- EditDlgParam param = { lvi.lParam, ppro };
+ EditDlgParam param = { (int)lvi.lParam, ppro };
int res;
if (nm->hdr.idFrom == IDC_PHONES)
res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp
index 62e9da7501..7c06a01359 100644
--- a/protocols/JabberG/src/jabber_ws.cpp
+++ b/protocols/JabberG/src/jabber_ws.cpp
@@ -29,7 +29,7 @@ BOOL CJabberProto::WsInit(void)
m_lastTicks = ::GetTickCount();
TCHAR name[128];
- mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 5c830ca8c2..1837898e5c 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -695,7 +695,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe
if (m_proto->m_pInfoFrame) {
if (mood >= 0) {
- mir_sntprintf(title, _countof(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
}
else {
@@ -1083,7 +1083,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec
if (m_proto->m_pInfoFrame) {
if (activity >= 0) {
- mir_sntprintf(title, _countof(title), TranslateT("Activity: %s"), activityTitle);
+ mir_sntprintf(title, TranslateT("Activity: %s"), activityTitle);
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(activity)), activityTitle);
}
else {
@@ -1211,10 +1211,10 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s
li.ptszAlbum = (TCHAR*)szSource;
li.ptszTitle = (TCHAR*)szTitle;
li.ptszTrack = (TCHAR*)szTrack;
- szListeningTo = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)_T("%title% - %artist%"), (LPARAM)&li);
+ szListeningTo = (TCHAR*)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)_T("%title% - %artist%"), (LPARAM)&li);
}
else {
- szListeningTo = (TCHAR *) mir_alloc(2048 * sizeof(TCHAR));
+ szListeningTo = (TCHAR*)mir_alloc(2048 * sizeof(TCHAR));
mir_sntprintf(szListeningTo, 2047, _T("%s - %s"), szTitle ? szTitle : _T(""), szArtist ? szArtist : _T(""));
}
@@ -1286,7 +1286,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
szTmp++;
}
}
- mir_sntprintf(szLengthInSec, _countof(szLengthInSec), _T("%d"), result);
+ mir_sntprintf(szLengthInSec, _T("%d"), result);
}
SendPepTune(szArtist, szLength ? szLengthInSec : NULL, szSource, szTitle, szTrack, NULL);
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index 02eb632d1d..bab4c80f57 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -428,7 +428,7 @@ typedef enum { FT_CONNECTING, FT_INITIALIZING, FT_RECEIVING, FT_DONE, FT_ERROR,
struct filetransfer
{
- filetransfer(CJabberProto* proto);
+ filetransfer(CJabberProto *proto);
~filetransfer();
void close();
@@ -595,7 +595,7 @@ extern struct CountryListEntry* g_countries;
extern FI_INTERFACE *FIP;
extern HANDLE hExtListInit, hDiscoInfoResult;
-extern int bSecureIM, bMirOTR, bNewGPG, bPlatform;
+extern bool bSecureIM, bMirOTR, bNewGPG, bPlatform;
/*******************************************************************
* Function declarations
@@ -686,7 +686,7 @@ struct CJabberAdhocStartupParams
TCHAR *m_szNode;
CJabberProto *m_pProto;
- CJabberAdhocStartupParams(CJabberProto* proto, TCHAR* szJid, TCHAR* szNode = NULL)
+ CJabberAdhocStartupParams(CJabberProto *proto, TCHAR* szJid, TCHAR* szNode = NULL)
{
m_pProto = proto;
m_szJid = mir_tstrdup(szJid);
@@ -701,7 +701,7 @@ struct CJabberAdhocStartupParams
struct JabberAdHocData
{
- CJabberProto* proto;
+ CJabberProto *proto;
int CurrentHeight;
int curPos;
int frameHeight;