diff options
author | George Hazan <ghazan@miranda.im> | 2019-04-13 20:22:59 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-04-13 20:22:59 +0300 |
commit | 680873487c4a7987012606119a744e5ca725ad30 (patch) | |
tree | 8e5fbc68a253c3ec44287754c9295670f1ee44c3 /protocols/JabberG/src | |
parent | 6c4136504c660bf3359e6641362672c4b9502be5 (diff) |
merge with trunk
Diffstat (limited to 'protocols/JabberG/src')
39 files changed, 286 insertions, 369 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 2317ee00e8..854d565e1f 100755 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -156,6 +156,10 @@ int CMPlugin::Load() bPlatform = 0;
#endif
+ char tmp[8];
+ Utils_GetRandom(tmp, sizeof(tmp));
+ bin2hex(tmp, sizeof(tmp), szRandom);
+
Miranda_GetVersionText(szCoreVersion, _countof(szCoreVersion));
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 66a0ac71ef..4685038a02 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -103,7 +103,7 @@ void CJabberProto::OnIqResult_CommandExecution(const TiXmlElement *iqNode, CJabb void CJabberProto::AdHoc_RequestListOfCommands(char *szResponder, HWND hwndDlg)
{
- m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_ListOfCommands, JABBER_IQ_TYPE_GET, szResponder, 0, -1, hwndDlg))
+ m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_ListOfCommands, JABBER_IQ_TYPE_GET, szResponder, hwndDlg))
<< XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR("node", JABBER_FEAT_COMMANDS));
}
@@ -118,7 +118,7 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, char*, JabberAdHocData *dat if (node) {
const char *jid2 = XmlGetAttr(itemNode, "jid");
m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg))
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, hwndDlg))
<< XCHILDNS("command", JABBER_FEAT_COMMANDS) << XATTR("node", node) << XATTR("action", "execute"));
EnableDlgItem(hwndDlg, IDC_SUBMIT, FALSE);
@@ -279,7 +279,7 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData *dat, ch auto *xNode = XmlFirstChild(commandNode, "x");
const char *jid2 = XmlGetAttr(dat->AdHocNode, "from");
- XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg));
+ XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, hwndDlg));
TiXmlElement *command = iq << XCHILDNS("command", JABBER_FEAT_COMMANDS);
const char *sessionId = XmlGetAttr(commandNode, "sessionid");
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat->proto = pStartupParams->m_pProto;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_COMMAND));
+ Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_GROUP));
dat->proto->m_hwndCommandWindow = hwndDlg;
TranslateDialogDefault(hwndDlg);
@@ -371,7 +371,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA }
else {
dat->proto->m_ThreadInfo->send(
- XmlNodeIq(dat->proto->AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, pStartupParams->m_szJid, 0, -1, hwndDlg))
+ XmlNodeIq(dat->proto->AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, pStartupParams->m_szJid, hwndDlg))
<< XCHILDNS("command", JABBER_FEAT_COMMANDS)
<< XATTR("node", pStartupParams->m_szNode) << XATTR("action", "execute"));
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 4d52cfa41b..42c91b1ce8 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -163,17 +163,6 @@ HJHANDLER CJabberProto::AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, con return (HJHANDLER)m_iqManager.AddPermanentHandler(&CJabberProto::ExternalIqHandler, iIqTypes, 0, szXmlns, FALSE, szTag, d, free, iPriority);
}
-HJHANDLER CJabberProto::AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData, DWORD dwTimeout, int iPriority)
-{
- sHandlerData *d = (sHandlerData*)malloc(sizeof(sHandlerData));
- d->Func = Func;
- d->pUserData = pUserData;
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::ExternalTempIqHandler, iIqTypes, nullptr, 0, iIqId, d, iPriority);
- if (pInfo && dwTimeout > 0)
- pInfo->SetTimeout(dwTimeout);
- return (HJHANDLER)pInfo;
-}
-
HJHANDLER CJabberProto::AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority)
{
sHandlerData *d = (sHandlerData*)malloc(sizeof(sHandlerData));
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 87ac8971f8..b3d8e0e791 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -186,7 +186,7 @@ public: {
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_BOOKMARKS));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_BOOKMARKS));
m_btnAdd.Disable();
m_btnEdit.Disable();
@@ -195,8 +195,8 @@ public: m_lvBookmarks.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER);
HIMAGELIST hIml = m_lvBookmarks.CreateImageList(LVSIL_SMALL);
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("group"));
- ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_EVENT_URL));
+ g_plugin.addImgListIcon(hIml, IDI_GROUP);
+ ImageList_AddSkinIcon(hIml, SKINICON_EVENT_URL);
m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->getWord("bookmarksWnd_cx0", 120));
m_lvBookmarks.AddColumn(1, TranslateT("Address (JID or URL)"), m_proto->getWord("bookmarksWnd_cx1", 210));
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 5d89502c94..c72ebaaea6 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -161,7 +161,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) jbt->szProxyJid = nullptr;
jbt->hProxyEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::IqResultProxyDiscovery, JABBER_IQ_TYPE_GET, proxyJid, 0, -1, jbt);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::IqResultProxyDiscovery, JABBER_IQ_TYPE_GET, proxyJid, jbt);
nIqId = pInfo->GetIqId();
XmlNodeIq iq(pInfo);
iq << XQUERY(JABBER_FEAT_BYTESTREAMS);
@@ -184,7 +184,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) }
}
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::ByteInitiateResult, JABBER_IQ_TYPE_SET, jbt->dstJID, 0, -1, jbt);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::ByteInitiateResult, JABBER_IQ_TYPE_SET, jbt->dstJID, jbt);
nIqId = pInfo->GetIqId();
char szPort[8];
{
@@ -538,18 +538,15 @@ int CJabberProto::ByteSendProxyParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jb jbt->hProxyEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
jbt->bStreamActivated = FALSE;
- int iqId = SerialNext();
+ auto *pIq = AddIQ(&CJabberProto::IqResultStreamActivate, JABBER_IQ_TYPE_SET, jbt->streamhostJID);
char listJid[256];
- mir_snprintf(listJid, "ftproxy_%d", iqId);
+ mir_snprintf(listJid, "ftproxy_%d", pIq->GetIqId());
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
- m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::IqResultStreamActivate, JABBER_IQ_TYPE_SET, jbt->streamhostJID, 0, iqId))
- << XQUERY(JABBER_FEAT_BYTESTREAMS) << XATTR("sid", jbt->sid) << XCHILD("activate", jbt->dstJID));
-
+ m_ThreadInfo->send(XmlNodeIq(pIq) << XQUERY(JABBER_FEAT_BYTESTREAMS) << XATTR("sid", jbt->sid) << XCHILD("activate", jbt->dstJID));
WaitForSingleObject(jbt->hProxyEvent, INFINITE);
CloseHandle(jbt->hProxyEvent);
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 50a94e6204..b4c4ad2923 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -264,7 +264,8 @@ JabberCapsBits CJabberProto::GetResourceCapabilities(const char *jid, pResourceS if (jcbMainCaps == JABBER_RESOURCE_CAPS_UNINIT) {
// send disco#info query
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, jid);
+ pInfo->SetParamsToParse(JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
pCaps->SetCaps(JABBER_RESOURCE_CAPS_IN_PROGRESS, pInfo->GetIqId());
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
@@ -318,7 +319,8 @@ JabberCapsBits CJabberProto::GetResourceCapabilities(const char *jid, pResourceS void CJabberProto::RequestOldCapsInfo(pResourceStatus &r, const char *fullJid)
{
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid);
+ pInfo->SetParamsToParse(JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 1a70cecb22..9b4dc70a54 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -689,7 +689,7 @@ public: m_newJids(1),
m_btnInvite(this, IDC_INVITE),
m_txtNewJid(this, IDC_NEWJID),
- m_btnAddJid(this, IDC_ADDJID, ppro->LoadIconEx("addroster"), "Add"),
+ m_btnAddJid(this, IDC_ADDJID, g_plugin.getIcon(IDI_ADDCONTACT), "Add"),
m_txtReason(this, IDC_REASON),
m_clc(this, IDC_CLIST)
{
@@ -713,7 +713,7 @@ public: CSuper::OnInitDialog();
SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMStringW(FORMAT, TranslateT("Invite Users to\n%s"), m_room));
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_GROUP));
SetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE,
GetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE) | CLS_SHOWHIDDEN | CLS_HIDEOFFLINE | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE | CLS_GROUPCHECKBOXES);
@@ -819,7 +819,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
dat = (TUserInfoData *)lParam;
- Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_GROUP));
+ Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_GROUP));
{
LOGFONT lf;
GetObject((HFONT)SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_GETFONT, 0, 0), sizeof(lf), &lf);
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 80510be24f..6c1de0b61a 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -298,14 +298,14 @@ struct {
int type;
wchar_t *title;
- char *icon;
+ int icon;
}
static filter_modes[] =
{
- { TFilterInfo::T_JID, L"JID", "main" },
- { TFilterInfo::T_XMLNS, L"xmlns", "xmlconsole" },
- { TFilterInfo::T_ANY, L"all attributes", "sd_filter_apply" },
- { TFilterInfo::T_OFF, L"disabled", "sd_filter_reset" },
+ { TFilterInfo::T_JID, L"JID", IDI_JABBER },
+ { TFilterInfo::T_XMLNS, L"xmlns", IDI_CONSOLE },
+ { TFilterInfo::T_ANY, L"all attributes", IDI_FILTER_APPLY },
+ { TFilterInfo::T_OFF, L"disabled", IDI_FILTER_RESET },
};
class CJabberDlgConsole : public CJabberDlgBase
@@ -321,7 +321,7 @@ public: {
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_CONSOLE));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_CONSOLE));
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_EXLIMITTEXT, 0, 0x80000000);
@@ -342,21 +342,21 @@ public: {
int idc;
char *title;
- char *icon;
+ int icon;
bool push;
BOOL pushed;
}
static buttons[] =
{
- { IDC_BTN_MSG, "Messages", "pl_msg_allow", true, m_proto->m_filterInfo.msg},
- { IDC_BTN_PRESENCE, "Presences", "pl_prin_allow", true, m_proto->m_filterInfo.presence},
- { IDC_BTN_IQ, "Queries", "pl_iq_allow", true, m_proto->m_filterInfo.iq},
- { IDC_BTN_FILTER, "Filter mode", "sd_filter_apply", true, FALSE},
- { IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
+ { IDC_BTN_MSG, "Messages", IDI_PL_MSG_ALLOW, true, m_proto->m_filterInfo.msg },
+ { IDC_BTN_PRESENCE, "Presences", IDI_PL_PRIN_ALLOW, true, m_proto->m_filterInfo.presence },
+ { IDC_BTN_IQ, "Queries", IDI_PL_QUERY_ALLOW, true, m_proto->m_filterInfo.iq },
+ { IDC_BTN_FILTER, "Filter mode", IDI_FILTER_APPLY, true, false },
+ { IDC_BTN_FILTER_REFRESH, "Refresh list", IDI_NAV_REFRESH, false, false },
};
for (auto &it : buttons) {
- SendDlgItemMessage(m_hwnd, it.idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon));
+ SendDlgItemMessage(m_hwnd, it.idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.icon));
SendDlgItemMessage(m_hwnd, it.idc, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(m_hwnd, it.idc, BUTTONADDTOOLTIP, (WPARAM)it.title, 0);
if (it.push)
@@ -367,8 +367,8 @@ public: for (auto &it : filter_modes)
if (it.type == m_proto->m_filterInfo.type) {
- IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon)));
- SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon));
+ IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.icon)));
+ SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.icon));
break;
}
@@ -527,7 +527,7 @@ public: m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
for (auto &it : filter_modes) {
if (it.type == m_proto->m_filterInfo.type) {
- IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon)));
+ IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.icon)));
break;
}
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 30d9ea5519..c299941589 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -51,57 +51,51 @@ static DWORD sttLastAutoDisco = 0; enum { SD_OVERLAY_NONE, SD_OVERLAY_FAIL, SD_OVERLAY_PROGRESS, SD_OVERLAY_REGISTERED };
-static struct
+struct
{
char *feature;
char *category;
char *type;
- char *iconName;
+ int iconRes;
int iconIndex;
int listIndex;
-} sttNodeIcons[] =
+}
+static sttNodeIcons[] =
{
// standard identities: http://www.xmpp.org/registrar/disco-categories.html#directory
- {nullptr, "account", nullptr, nullptr, SKINICON_STATUS_ONLINE},
- {nullptr, "auth", nullptr, "key", 0},
- {nullptr, "automation", nullptr, "adhoc", 0},
- {nullptr, "client", nullptr, nullptr, SKINICON_STATUS_ONLINE},
- {nullptr, "collaboration", nullptr, "group", 0},
- {nullptr, "conference", nullptr, "group", 0},
-
- {nullptr, "directory", "chatroom", "group", 0},
- {nullptr, "directory", "group", "group", 0},
- {nullptr, "directory", "user", nullptr, SKINICON_OTHER_FINDUSER},
- {nullptr, "directory", nullptr, nullptr, SKINICON_OTHER_SEARCHALL},
-
- {nullptr, "gateway", "aim", "AIM", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", "gadu-gadu", "GG", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", "icq", "ICQ", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", "msn", "MSN", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", "qq", "QQ", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", "tlen", "TLEN", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", "yahoo", "YAHOO", SKINICON_STATUS_ONLINE},
- {nullptr, "gateway", nullptr, "Agents", 0},
-
- {nullptr, "headline", "rss", "node_rss", 0},
- {nullptr, "headline", "weather", "node_weather", 0},
-
- {nullptr, "proxy", nullptr, nullptr, SKINICON_EVENT_FILE},
-
- {nullptr, "server", nullptr, "node_server", 0},
-
- {nullptr, "store", nullptr, "node_store", 0},
-
- // icons for non-standard identities
- {nullptr, "x-service", "x-rss", "node_rss", 0},
- {nullptr, "application", "x-weather", "node_weather", 0},
- {nullptr, "user", nullptr, nullptr, SKINICON_STATUS_ONLINE},
-
- // icon suggestions based on supported features
- {"jabber:iq:gateway", nullptr, nullptr, "Agents", 0},
- {"jabber:iq:search", nullptr, nullptr, nullptr, SKINICON_OTHER_FINDUSER},
- {JABBER_FEAT_COMMANDS, nullptr, nullptr, "adhoc", 0},
- {JABBER_FEAT_REGISTER, nullptr, nullptr, "key", 0},
+ {nullptr, "account", nullptr, 0, SKINICON_STATUS_ONLINE},
+ {nullptr, "auth", nullptr, IDI_KEYS, 0},
+ {nullptr, "automation", nullptr, IDI_COMMAND, 0},
+ {nullptr, "client", nullptr, 0, SKINICON_STATUS_ONLINE},
+ {nullptr, "collaboration", nullptr, IDI_GROUP, 0},
+ {nullptr, "conference", nullptr, IDI_GROUP, 0},
+
+ {nullptr, "directory", "chatroom", IDI_GROUP, 0},
+ {nullptr, "directory", "group", IDI_GROUP, 0},
+ {nullptr, "directory", "user", 0, SKINICON_OTHER_FINDUSER},
+ {nullptr, "directory", nullptr, 0, SKINICON_OTHER_SEARCHALL},
+
+ {nullptr, "gateway", nullptr, IDI_AGENTS, 0},
+
+ {nullptr, "headline", "rss", IDI_NODE_RSS, 0},
+ {nullptr, "headline", "weather", IDI_NODE_WEATHER, 0},
+
+ {nullptr, "proxy", nullptr, 0, SKINICON_EVENT_FILE},
+
+ {nullptr, "server", nullptr, IDI_NODE_SERVER, 0},
+
+ {nullptr, "store", nullptr, IDI_NODE_STORE, 0},
+
+ // icons for non-standard identities
+ {nullptr, "x-service", "x-rss", IDI_NODE_RSS, 0},
+ {nullptr, "application", "x-weather", IDI_NODE_WEATHER, 0},
+ {nullptr, "user", nullptr, 0, SKINICON_STATUS_ONLINE},
+
+ // icon suggestions based on supported features
+ {"jabber:iq:gateway", nullptr, nullptr, IDI_AGENTS, 0},
+ {"jabber:iq:search", nullptr, nullptr, 0, SKINICON_OTHER_FINDUSER},
+ {JABBER_FEAT_COMMANDS, nullptr, nullptr, IDI_COMMAND, 0},
+ {JABBER_FEAT_REGISTER, nullptr, nullptr, IDI_KEYS, 0},
};
void CJabberProto::OnIqResultServiceDiscoveryInfo(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
@@ -181,12 +175,12 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(const TiXmlElement *iqNode, C void CJabberProto::OnIqResultServiceDiscoveryRootInfo(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
- if (!pInfo->m_pUserData) return;
+ if (!pInfo->GetUserData()) return;
mir_cslockfull lck(m_SDManager.cs());
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
for (auto *feature : TiXmlFilter(XmlFirstChild(iqNode, "query"), "feature")) {
- if (!mir_strcmp(XmlGetAttr(feature, "var"), (char*)pInfo->m_pUserData)) {
+ if (!mir_strcmp(XmlGetAttr(feature, "var"), (char*)pInfo->GetUserData())) {
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(pInfo->GetReceiver(), XmlGetAttr(iqNode, "node"));
SendBothRequests(pNode);
break;
@@ -200,7 +194,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(const TiXmlElement *iqNode void CJabberProto::OnIqResultServiceDiscoveryRootItems(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
- if (!pInfo->m_pUserData)
+ if (!pInfo->GetUserData())
return;
TiXmlDocument packet;
@@ -209,8 +203,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(const TiXmlElement *iqNod for (auto *item : TiXmlFilter(XmlFirstChild(iqNode, "query"), "item")) {
const char *szJid = XmlGetAttr(item, "jid");
const char *szNode = XmlGetAttr(item, "node");
- CJabberIqInfo *pNewInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootInfo, JABBER_IQ_TYPE_GET, szJid);
- pNewInfo->m_pUserData = pInfo->m_pUserData;
+ CJabberIqInfo *pNewInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootInfo, JABBER_IQ_TYPE_GET, szJid, pInfo->GetUserData());
pNewInfo->SetTimeout(30000);
XmlNodeIq iq(pNewInfo);
@@ -341,16 +334,14 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) }
}
else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, m_ThreadInfo->conn.server);
- pInfo->m_pUserData = (void*)JABBER_FEAT_MUC;
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, m_ThreadInfo->conn.server, (void*)JABBER_FEAT_MUC);
pInfo->SetTimeout(30000);
XmlNodeIq iq(pInfo);
iq << XQUERY(JABBER_FEAT_DISCO_ITEMS);
m_ThreadInfo->send(iq);
}
else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, m_ThreadInfo->conn.server);
- pInfo->m_pUserData = (void*)L"jabber:iq:gateway";
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, m_ThreadInfo->conn.server, L"jabber:iq:gateway");
pInfo->SetTimeout(30000);
XmlNodeIq iq(pInfo);
iq << XQUERY(JABBER_FEAT_DISCO_ITEMS);
@@ -423,7 +414,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) }
for (auto &it : sttNodeIcons) {
- if (!it.iconIndex && !it.iconName)
+ if (!it.iconIndex && !it.iconRes)
continue;
if (it.category) {
@@ -506,12 +497,12 @@ public: CJabberDlgDiscovery(CJabberProto *proto, char *jid) :
CJabberDlgBase(proto, IDD_SERVICE_DISCOVERY),
m_jid(jid),
- m_btnViewAsTree(this, IDC_BTN_VIEWTREE, proto->LoadIconEx("sd_view_tree"), "View as tree"),
- m_btnViewAsList(this, IDC_BTN_VIEWLIST, proto->LoadIconEx("sd_view_list"), "View as list"),
- m_btnGoHome(this, IDC_BTN_NAVHOME, proto->LoadIconEx("sd_nav_home"), "Navigate home"),
- m_btnBookmarks(this, IDC_BTN_FAVORITE, proto->LoadIconEx("bookmarks"), "Favorites"),
- m_btnRefresh(this, IDC_BTN_REFRESH, proto->LoadIconEx("sd_nav_refresh"), "Refresh node"),
- m_btnBrowse(this, IDC_BUTTON_BROWSE, proto->LoadIconEx("sd_browse"), "Browse"),
+ m_btnViewAsTree(this, IDC_BTN_VIEWTREE, g_plugin.getIcon(IDI_VIEW_TREE), "View as tree"),
+ m_btnViewAsList(this, IDC_BTN_VIEWLIST, g_plugin.getIcon(IDI_VIEW_LIST), "View as list"),
+ m_btnGoHome(this, IDC_BTN_NAVHOME, g_plugin.getIcon(IDI_NAV_HOME), "Navigate home"),
+ m_btnBookmarks(this, IDC_BTN_FAVORITE, g_plugin.getIcon(IDI_BOOKMARKS), "Favorites"),
+ m_btnRefresh(this, IDC_BTN_REFRESH, g_plugin.getIcon(IDI_NAV_REFRESH), "Refresh node"),
+ m_btnBrowse(this, IDC_BUTTON_BROWSE, g_plugin.getIcon(IDI_BROWSE), "Browse"),
m_lstDiscoTree(this, IDC_TREE_DISCO),
m_filter(this, IDC_FILTER)
{
@@ -529,7 +520,7 @@ public: {
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_SERVICE_DISCOVERY));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_SERVICE_DISCOVERY));
if (m_jid) {
SetDlgItemTextUtf(m_hwnd, IDC_COMBO_JID, m_jid);
@@ -572,25 +563,19 @@ public: ListView_InsertColumn(hwndList, 2, &lvc);
TreeList_Create(hwndList);
- TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
+ TreeList_AddIcon(hwndList, g_plugin.getIcon(IDI_JABBER), 0);
for (auto &it : sttNodeIcons) {
- bool needDestroy = false;
HICON hIcon;
- if ((it.iconIndex == SKINICON_STATUS_ONLINE) && it.iconName) {
- hIcon = (HICON)CallProtoService(it.iconName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- needDestroy = true;
- }
- else if (it.iconName)
- hIcon = m_proto->LoadIconEx(it.iconName);
+ if (it.iconRes)
+ hIcon = g_plugin.getIcon(it.iconRes);
else if (it.iconIndex)
hIcon = Skin_LoadIcon(it.iconIndex);
else continue;
it.listIndex = TreeList_AddIcon(hwndList, hIcon, 0);
- if (needDestroy) DestroyIcon(hIcon);
}
- TreeList_AddIcon(hwndList, m_proto->LoadIconEx("disco_fail"), SD_OVERLAY_FAIL);
- TreeList_AddIcon(hwndList, m_proto->LoadIconEx("disco_progress"), SD_OVERLAY_PROGRESS);
- TreeList_AddIcon(hwndList, m_proto->LoadIconEx("disco_ok"), SD_OVERLAY_REGISTERED);
+ TreeList_AddIcon(hwndList, g_plugin.getIcon(IDI_DISCO_FAIL), SD_OVERLAY_FAIL);
+ TreeList_AddIcon(hwndList, g_plugin.getIcon(IDI_DISCO_PROGRESS), SD_OVERLAY_PROGRESS);
+ TreeList_AddIcon(hwndList, g_plugin.getIcon(IDI_DISCO_OK), SD_OVERLAY_REGISTERED);
TreeList_SetMode(hwndList, m_proto->getByte("discoWnd_useTree", 1) ? TLM_TREE : TLM_REPORT);
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 4ce01e3396..fcc0d2eed1 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -102,7 +102,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto) : SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
CreateInfoItem("$", true);
- UpdateInfoItem("$", proto->GetIconHandle(IDI_JABBER), proto->m_tszUserName);
+ UpdateInfoItem("$", proto->m_hProtoIcon, proto->m_tszUserName);
CreateInfoItem("$/JID", true);
UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), L"Offline");
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index c63f50aa96..e832925e2a 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -97,7 +97,9 @@ void CJabberProto::FtInitiate(char* jid, filetransfer *ft) if (wchar_t *p = wcsrchr(filename, '\\'))
filename = p + 1;
- XmlNodeIq iq(AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, MakeJid(jid, rs), JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
+ auto *pIq = AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, MakeJid(jid, rs), ft);
+ pIq->SetParamsToParse(JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO);
+ XmlNodeIq iq(pIq);
TiXmlElement *si = iq << XCHILDNS("si", JABBER_FEAT_SI) << XATTR("id", sid)
<< XATTR("mime-type", "binary/octet-stream") << XATTR("profile", JABBER_FEAT_SI_FT);
si << XCHILDNS("file", JABBER_FEAT_SI_FT) << XATTR("name", T2Utf(filename))
@@ -124,7 +126,7 @@ void CJabberProto::OnFtSiResult(const TiXmlElement *iqNode, CJabberIqInfo *pInfo if (!ft)
return;
- if ((pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) && pInfo->m_szFrom && pInfo->m_szTo) {
+ if ((pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) && pInfo->GetFrom() && pInfo->GetTo()) {
if (auto *siNode = XmlFirstChild(iqNode, "si")) {
// fix for very smart clients, like gajim
BOOL bDirect = m_bBsDirect;
@@ -138,8 +140,8 @@ void CJabberProto::OnFtSiResult(const TiXmlElement *iqNode, CJabberIqInfo *pInfo // Start Bytestream session
JABBER_BYTE_TRANSFER *jbt = new JABBER_BYTE_TRANSFER;
memset(jbt, 0, sizeof(JABBER_BYTE_TRANSFER));
- jbt->srcJID = mir_strdup(pInfo->m_szTo);
- jbt->dstJID = mir_strdup(pInfo->m_szFrom);
+ jbt->srcJID = mir_strdup(pInfo->GetTo());
+ jbt->dstJID = mir_strdup(pInfo->GetFrom());
jbt->sid = mir_strdup(ft->sid);
jbt->pfnSend = &CJabberProto::FtSend;
jbt->pfnFinal = &CJabberProto::FtSendFinal;
@@ -151,8 +153,8 @@ void CJabberProto::OnFtSiResult(const TiXmlElement *iqNode, CJabberIqInfo *pInfo else if (!mir_strcmp(valueNode->GetText(), JABBER_FEAT_IBB)) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
- jibb->srcJID = mir_strdup(pInfo->m_szTo);
- jibb->dstJID = mir_strdup(pInfo->m_szFrom);
+ jibb->srcJID = mir_strdup(pInfo->GetTo());
+ jibb->dstJID = mir_strdup(pInfo->GetFrom());
jibb->sid = mir_strdup(ft->sid);
jibb->pfnSend = &CJabberProto::FtIbbSend;
jibb->pfnFinal = &CJabberProto::FtSendFinal;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 3fba354194..7e18ceae1b 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -403,7 +403,7 @@ public: {
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_GROUP));
JabberGcRecentInfo *pInfo = nullptr;
if (m_jid)
@@ -443,7 +443,7 @@ public: lf.lfWeight = FW_BOLD;
SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), TRUE);
- SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx("bookmarks"));
+ SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BOOKMARKS));
SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONADDTOOLTIP, (WPARAM)"Bookmarks", 0);
SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONSETASPUSHBTN, TRUE, 0);
@@ -561,16 +561,16 @@ public: SetTextColor(lpdis->hDC, clLine2);
DrawText(lpdis->hDC, info->line2, -1, &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("group"), 16, 16, 0, nullptr, DI_NORMAL);
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, g_plugin.getIcon(IDI_GROUP), 16, 16, 0, nullptr, DI_NORMAL);
switch (info->overlay) {
case RoomInfo::ROOM_WAIT:
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_progress"), 16, 16, 0, nullptr, DI_NORMAL);
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, g_plugin.getIcon(IDI_DISCO_PROGRESS), 16, 16, 0, nullptr, DI_NORMAL);
break;
case RoomInfo::ROOM_FAIL:
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_fail"), 16, 16, 0, nullptr, DI_NORMAL);
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, g_plugin.getIcon(IDI_DISCO_FAIL), 16, 16, 0, nullptr, DI_NORMAL);
break;
case RoomInfo::ROOM_BOOKMARK:
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_ok"), 16, 16, 0, nullptr, DI_NORMAL);
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, g_plugin.getIcon(IDI_DISCO_OK), 16, 16, 0, nullptr, DI_NORMAL);
break;
}
}
@@ -613,7 +613,7 @@ public: if (*server) {
sttRoomListAppend(GetDlgItem(m_hwnd, IDC_ROOM), RoomInfo::ROOM_WAIT, TranslateT("Loading..."), TranslateT("Please wait for room list to download."), L"");
- CJabberIqInfo *pInfo = m_proto->AddIQ(&CJabberProto::OnIqResultDiscovery, JABBER_IQ_TYPE_GET, T2Utf(server), 0, -1, (void*)GetDlgItem(m_hwnd, IDC_ROOM));
+ CJabberIqInfo *pInfo = m_proto->AddIQ(&CJabberProto::OnIqResultDiscovery, JABBER_IQ_TYPE_GET, T2Utf(server), (void*)GetDlgItem(m_hwnd, IDC_ROOM));
pInfo->SetTimeout(30000);
XmlNodeIq iq(pInfo);
iq << XQUERY(JABBER_FEAT_DISCO_ITEMS);
@@ -1145,7 +1145,7 @@ public: SetDlgItemTextUtf(m_hwnd, IDC_REASON, m_reason);
SetDlgItemTextUtf(m_hwnd, IDC_NICK, JabberNickFromJID(m_proto->m_szJabberJID));
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_GROUP));
SetFocus(GetDlgItem(m_hwnd, IDC_NICK));
return true;
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index c0eadf883e..59edaf6a5f 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -98,7 +98,7 @@ void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb) jibb->state = JIBB_SENDING;
m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIbbInitiateResult, JABBER_IQ_TYPE_SET, jibb->dstJID, 0, -1, jibb))
+ XmlNodeIq(AddIQ(&CJabberProto::OnIbbInitiateResult, JABBER_IQ_TYPE_SET, jibb->dstJID, jibb))
<< XCHILDNS("open", JABBER_FEAT_IBB) << XATTR("sid", jibb->sid) << XATTRI("block-size", JABBER_IBB_BLOCK_SIZE)
<< XATTR("stanza", "message"));
@@ -115,7 +115,7 @@ void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb) jibb->hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIbbCloseResult, JABBER_IQ_TYPE_SET, jibb->dstJID, 0, -1, jibb))
+ XmlNodeIq(AddIQ(&CJabberProto::OnIbbCloseResult, JABBER_IQ_TYPE_SET, jibb->dstJID, jibb))
<< XCHILDNS("close", JABBER_FEAT_IBB) << XATTR("sid", jibb->sid));
WaitForSingleObject(jibb->hEvent, INFINITE);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index ec8fdfedc8..e3b9b58054 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -172,25 +172,6 @@ void CJabberProto::IconsInit(void) m_transportProtoTableStartIndex[i] = -1;
}
-HANDLE CJabberProto::GetIconHandle(int iconId)
-{
- if (iconId == IDI_JABBER)
- return m_hProtoIcon;
-
- return g_GetIconHandle(iconId);
-}
-
-HICON CJabberProto::LoadIconEx(const char* name, bool big)
-{
- if (HICON result = g_LoadIconEx(name, big))
- return result;
-
- if (!mir_strcmp(name, "main"))
- return IcoLib_GetIconByHandle(m_hProtoIcon, big);
-
- return nullptr;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// internal functions
@@ -456,7 +437,7 @@ void CJabberProto::CheckAllContactsAreTransported() static IconItem sharedIconList1[] =
{
- { LPGEN("Jabber"), "jabber", IDI_JABBER },
+ { LPGEN("Jabber"), "jabber", IDI_JABBER },
{ LPGEN("Privacy Lists"), "privacylists", IDI_PRIVACY_LISTS },
{ LPGEN("Bookmarks"), "bookmarks", IDI_BOOKMARKS },
{ LPGEN("Notes"), "notes", IDI_NOTES },
@@ -522,42 +503,8 @@ static IconItem sharedIconList4[] = void g_IconsInit()
{
- g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, GLOBAL_SETTING_PREFIX);
- g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, GLOBAL_SETTING_PREFIX);
- g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs") "/" LPGEN("Discovery"), sharedIconList3, GLOBAL_SETTING_PREFIX);
- g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, GLOBAL_SETTING_PREFIX);
-}
-
-HANDLE g_GetIconHandle(int iconId)
-{
- for (auto &it : sharedIconList1)
- if (it.defIconID == iconId)
- return it.hIcolib;
-
- for (auto &it : sharedIconList2)
- if (it.defIconID == iconId)
- return it.hIcolib;
-
- for (auto &it : sharedIconList3)
- if (it.defIconID == iconId)
- return it.hIcolib;
-
- for (auto &it : sharedIconList4)
- if (it.defIconID == iconId)
- return it.hIcolib;
-
- return nullptr;
-}
-
-HICON g_LoadIconEx(const char* name, bool big)
-{
- char szSettingName[100];
- mir_snprintf(szSettingName, "%s_%s", GLOBAL_SETTING_PREFIX, name);
- return IcoLib_GetIcon(szSettingName, big);
-}
-
-void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon)
-{
- ImageList_AddIcon(hIml, hIcon);
- IcoLib_ReleaseIcon(hIcon);
+ g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, GLOBAL_SETTING_MODULE);
+ g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, GLOBAL_SETTING_MODULE);
+ g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs") "/" LPGEN("Discovery"), sharedIconList3, GLOBAL_SETTING_MODULE);
+ g_plugin.registerIcon(LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, GLOBAL_SETTING_MODULE);
}
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index ca1f0b1e17..fc0f50d997 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -201,15 +201,12 @@ void CJabberIqManager::ExpireAll() ExpireInfo(pInfo);
}
-CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const char *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority)
+CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const char *szReceiver, void *pUserData, int iPriority)
{
CJabberIqInfo *pInfo = new CJabberIqInfo();
pInfo->m_pHandler = pHandler;
- if (nIqId == -1)
- nIqId = ppro->SerialNext();
- pInfo->m_nIqId = nIqId;
+ pInfo->m_nIqId = ppro->SerialNext();
pInfo->m_nIqType = nIqType;
- pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_dwRequestTime = GetTickCount();
pInfo->m_dwTimeout = JABBER_DEFAULT_IQ_REQUEST_TIMEOUT;
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index f7210f45eb..f457a55496 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -61,8 +61,6 @@ protected: DWORD m_dwTimeout;
char* m_szReceiver;
int m_iPriority;
-
-public:
void* m_pUserData;
int m_nIqType;
const char* m_szFrom;
@@ -166,7 +164,7 @@ public: void Shutdown();
// fucking params, maybe just return CJabberIqRequestInfo pointer ?
- CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const char *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority);
+ CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const char *szReceiver, void *pUserData, int iPriority);
CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const char *szXmlns, BOOL bAllowPartialNs, const char *szTag, void *pUserData = nullptr, IQ_USER_DATA_FREE_FUNC pUserDataFree = nullptr, int iPriority = JH_PRIORITY_DEFAULT);
// returns TRUE when pInfo found, or FALSE otherwise
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 8686e1f314..bed8949e14 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -431,7 +431,7 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams) mir_snprintf(szService, "%s%s", m_szModuleName, JS_HTTP_AUTH);
CLISTEVENT cle = {};
- cle.hIcon = (HICON)LoadIconEx("openid");
+ cle.hIcon = g_plugin.getIcon(IDI_HTTP_AUTH);
cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_UNICODE;
cle.hDbEvent = -99;
cle.lParam = (LPARAM)pParams;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 5b82a7d45b..e5a231f64c 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -105,7 +105,7 @@ void CJabberProto::OnIqResultNestedRosterGroups(const TiXmlElement *iqNode, CJab // roster request
char *szUserData = mir_strdup(szGroupDelimiter ? szGroupDelimiter : "\\");
m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetRoster, JABBER_IQ_TYPE_GET, nullptr, 0, -1, (void*)szUserData))
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetRoster, JABBER_IQ_TYPE_GET, nullptr, szUserData))
<< XCHILDNS("query", JABBER_FEAT_IQ_ROSTER));
}
@@ -1505,12 +1505,12 @@ void CJabberProto::OnIqResultSetBookmarks(const TiXmlElement *iqNode, CJabberIqI // last activity (XEP-0012) support
void CJabberProto::OnIqResultLastActivity(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
- pResourceStatus r(ResourceInfoFromJID(pInfo->m_szFrom));
+ pResourceStatus r(ResourceInfoFromJID(pInfo->GetFrom()));
if (r == nullptr)
return;
time_t lastActivity = -1;
- if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
+ if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
if (auto *xmlLast = XmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_LAST_ACTIVITY)) {
int nSeconds = xmlLast->IntAttribute("seconds");
lastActivity = (nSeconds == 0) ? 0 : time(0) - nSeconds;
@@ -1528,10 +1528,10 @@ void CJabberProto::OnIqResultLastActivity(const TiXmlElement *iqNode, CJabberIqI // entity time (XEP-0202) support
void CJabberProto::OnIqResultEntityTime(const TiXmlElement *pIqNode, CJabberIqInfo *pInfo)
{
- if (!pInfo->m_hContact)
+ if (!pInfo->GetHContact())
return;
- if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
+ if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
auto *xmlTime = XmlGetChildByTag(pIqNode, "time", "xmlns", JABBER_FEAT_ENTITY_TIME);
if (xmlTime) {
const char *szTzo = XmlGetChildText(xmlTime, "tzo");
@@ -1544,22 +1544,22 @@ void CJabberProto::OnIqResultEntityTime(const TiXmlElement *pIqNode, CJabberIqIn if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT)
nTz -= tzinfo.DaylightBias / 30;
- setByte(pInfo->m_hContact, "Timezone", (signed char)nTz);
+ setByte(pInfo->GetHContact(), "Timezone", (signed char)nTz);
const char *szTz = XmlGetChildText(xmlTime, "tz");
if (szTz)
- setUString(pInfo->m_hContact, "TzName", szTz);
+ setUString(pInfo->GetHContact(), "TzName", szTz);
else
- delSetting(pInfo->m_hContact, "TzName");
+ delSetting(pInfo->GetHContact(), "TzName");
return;
}
}
}
- else if (pInfo->m_nIqType == JABBER_IQ_TYPE_ERROR) {
- if (getWord(pInfo->m_hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
+ else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
+ if (getWord(pInfo->GetHContact(), "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
return;
}
- delSetting(pInfo->m_hContact, "Timezone");
- delSetting(pInfo->m_hContact, "TzName");
+ delSetting(pInfo->GetHContact(), "Timezone");
+ delSetting(pInfo->GetHContact(), "TzName");
}
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 6cc9421c32..3079cfa96a 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -59,13 +59,13 @@ struct {
int idc;
char *title;
- char *icon;
+ int icon;
bool push;
}
static buttons[] =
{
- { IDC_BTN_FILTERAPPLY, "Apply filter", "sd_filter_apply", false },
- { IDC_BTN_FILTERRESET, "Reset filter", "sd_filter_reset", false },
+ { IDC_BTN_FILTERAPPLY, "Apply filter", IDI_FILTER_APPLY, false },
+ { IDC_BTN_FILTERRESET, "Reset filter", IDI_FILTER_RESET, false },
};
class CJabberMucJidListDlg : public CJabberDlgBase
@@ -180,8 +180,8 @@ public: bool OnInitDialog() override
{
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 0);
- ImageList_AddIcon(hImageList, g_LoadIconEx("delete"));
- ImageList_AddIcon(hImageList, g_LoadIconEx("addcontact"));
+ g_plugin.addImgListIcon(hImageList, IDI_DELETE);
+ g_plugin.addImgListIcon(hImageList, IDI_ADDCONTACT);
m_list.SetImageList(hImageList, LVSIL_SMALL);
m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES | LVS_EX_GRIDLINES);
@@ -197,7 +197,7 @@ public: Refresh(m_info);
for (auto &it : buttons) {
- SendDlgItemMessage(m_hwnd, it.idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon));
+ SendDlgItemMessage(m_hwnd, it.idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.icon));
SendDlgItemMessage(m_hwnd, it.idc, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(m_hwnd, it.idc, BUTTONADDTOOLTIP, (WPARAM)it.title, 0);
if (it.push)
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f1cbdcbae9..d0ec3b9dae 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -170,7 +170,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/ConvertChatContact";
mi.name.a = LPGEN("Convert");
mi.position = -1999901004;
- mi.hIcolibItem = g_GetIconHandle(IDI_USER2ROOM);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_USER2ROOM);
g_hMenuConvert = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, JabberMenuConvertChatContact);
@@ -188,7 +188,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/AddToBookmarks";
mi.name.a = LPGEN("Add to Bookmarks");
mi.position = -1999901006;
- mi.hIcolibItem = g_GetIconHandle(IDI_BOOKMARKS);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_BOOKMARKS);
g_hMenuAddBookmark = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, JabberMenuBookmarkAdd);
@@ -197,7 +197,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/TransportLogin";
mi.name.a = LPGEN("Login/logout");
mi.position = -1999901007;
- mi.hIcolibItem = g_GetIconHandle(IDI_LOGIN);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_LOGIN);
g_hMenuLogin = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, JabberMenuTransportLogin);
@@ -206,7 +206,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/TransportGetNicks";
mi.name.a = LPGEN("Resolve nicks");
mi.position = -1999901008;
- mi.hIcolibItem = g_GetIconHandle(IDI_REFRESH);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_REFRESH);
g_hMenuRefresh = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, JabberMenuTransportResolve);
@@ -215,7 +215,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/RunCommands";
mi.name.a = LPGEN("Commands");
mi.position = -1999901009;
- mi.hIcolibItem = g_GetIconHandle(IDI_COMMAND);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_COMMAND);
g_hMenuCommands = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, JabberContactMenuRunCommands);
@@ -224,7 +224,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/SendNote";
mi.name.a = LPGEN("Send Note");
mi.position = -1999901010;
- mi.hIcolibItem = g_GetIconHandle(IDI_SEND_NOTE);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_SEND_NOTE);
g_hMenuSendNote = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, JabberMenuSendNote);
@@ -235,7 +235,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/DirectPresenceDummySvc";
mi.name.a = LPGEN("Send Presence");
mi.position = -1999901011;
- mi.hIcolibItem = g_GetIconHandle(IDI_NOTES);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_NOTES);
g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi);
UNSET_UID(mi);
@@ -261,7 +261,7 @@ void g_MenuInit(void) mi.pszService = "Jabber/ResourceSelectorDummySvc";
mi.name.a = LPGEN("Jabber Resource");
mi.position = -1999901011;
- mi.hIcolibItem = g_GetIconHandle(IDI_JABBER);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_JABBER);
g_hMenuResourcesRoot = Menu_AddContactMenuItem(&mi);
UNSET_UID(mi);
@@ -270,14 +270,14 @@ void g_MenuInit(void) mi.pszService = "Jabber/UseResource_last";
mi.name.a = LPGEN("Last Active");
mi.position = -1999901000;
- mi.hIcolibItem = g_GetIconHandle(IDI_JABBER);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_JABBER);
g_hMenuResourcesActive = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_LASTSEEN);
mi.pszService = "Jabber/UseResource_server";
mi.name.a = LPGEN("Server's Choice");
mi.position = -1999901000;
- mi.hIcolibItem = g_GetIconHandle(IDI_NODE_SERVER);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_NODE_SERVER);
g_hMenuResourcesServer = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_SERVER);
}
@@ -541,14 +541,14 @@ void CJabberProto::OnBuildProtoMenu() CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleBookmarks);
mi.name.a = LPGEN("Bookmarks");
mi.position = 200001;
- mi.hIcolibItem = GetIconHandle(IDI_BOOKMARKS);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_BOOKMARKS);
m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Services..."
mi.pszService = nullptr;
mi.name.a = LPGEN("Services...");
mi.position = 200003;
- mi.hIcolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_SERVICE_DISCOVERY);
HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Service Discovery..."
@@ -557,35 +557,35 @@ void CJabberProto::OnBuildProtoMenu() CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscovery);
mi.name.a = LPGEN("Service Discovery");
mi.position = 2000050001;
- mi.hIcolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_SERVICE_DISCOVERY);
m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/SD/MyTransports";
CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
mi.name.a = LPGEN("Registered Transports");
mi.position = 2000050003;
- mi.hIcolibItem = GetIconHandle(IDI_TRANSPORTL);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_TRANSPORTL);
m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/SD/Transports";
CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
mi.name.a = LPGEN("Local Server Transports");
mi.position = 2000050004;
- mi.hIcolibItem = GetIconHandle(IDI_TRANSPORT);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_TRANSPORT);
m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/SD/Conferences";
CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
mi.name.a = LPGEN("Browse chatrooms");
mi.position = 2000050005;
- mi.hIcolibItem = GetIconHandle(IDI_GROUP);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_GROUP);
m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/Groupchat";
CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleJoinGroupchat);
mi.name.a = LPGEN("Create/Join group chat");
mi.position = 2000050006;
- mi.hIcolibItem = GetIconHandle(IDI_GROUP);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_GROUP);
m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Change Password..."
@@ -593,7 +593,7 @@ void CJabberProto::OnBuildProtoMenu() CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleChangePassword);
mi.name.a = LPGEN("Change Password");
mi.position = 2000050007;
- mi.hIcolibItem = GetIconHandle(IDI_KEYS);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_KEYS);
m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Roster editor"
@@ -601,7 +601,7 @@ void CJabberProto::OnBuildProtoMenu() CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleRosterControl);
mi.name.a = LPGEN("Roster editor");
mi.position = 2000050009;
- mi.hIcolibItem = GetIconHandle(IDI_AGENTS);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_AGENTS);
m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "XML Console"
@@ -609,14 +609,14 @@ void CJabberProto::OnBuildProtoMenu() CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleConsole);
mi.name.a = LPGEN("XML Console");
mi.position = 2000050010;
- mi.hIcolibItem = GetIconHandle(IDI_CONSOLE);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_CONSOLE);
Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/Notes";
CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleNotes);
mi.name.a = LPGEN("Notes");
mi.position = 2000050011;
- mi.hIcolibItem = GetIconHandle(IDI_NOTES);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_NOTES);
m_hMenuNotes = Menu_AddProtoMenuItem(&mi, m_szModuleName);
BuildPrivacyMenu();
@@ -694,11 +694,11 @@ void CJabberProto::BuildPriorityMenu() mir_snprintf(srvFce, "/menuSetPriority/%d", steps[i]);
if (steps[i] > 0) {
mir_snwprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
- mi.hIcolibItem = GetIconHandle(IDI_ARROW_UP);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ARROW_UP);
}
else {
mir_snwprintf(szName, TranslateT("Decrease priority by %d"), -steps[i]);
- mi.hIcolibItem = GetIconHandle(IDI_ARROW_DOWN);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ARROW_DOWN);
}
if (needServices)
@@ -799,19 +799,19 @@ int g_OnToolbarInit(WPARAM, LPARAM) CreateServiceFunction("JABBER/*/Groupchat", g_ToolbarHandleJoinGroupchat);
ttb.pszService = "JABBER/*/Groupchat";
ttb.pszTooltipUp = ttb.name = LPGEN("Join conference");
- ttb.hIconHandleUp = g_GetIconHandle(IDI_GROUP);
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_GROUP);
g_plugin.addTTB(&ttb);
CreateServiceFunction("JABBER/*/Bookmarks", g_ToolbarHandleBookmarks);
ttb.pszService = "JABBER/*/Bookmarks";
ttb.pszTooltipUp = ttb.name = LPGEN("Open bookmarks");
- ttb.hIconHandleUp = g_GetIconHandle(IDI_BOOKMARKS);
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_BOOKMARKS);
g_plugin.addTTB(&ttb);
CreateServiceFunction("JABBER/*/ServiceDiscovery", g_ToolbarHandleServiceDiscovery);
ttb.pszService = "JABBER/*/ServiceDiscovery";
ttb.pszTooltipUp = ttb.name = LPGEN("Service discovery");
- ttb.hIconHandleUp = g_GetIconHandle(IDI_SERVICE_DISCOVERY);
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_SERVICE_DISCOVERY);
g_plugin.addTTB(&ttb);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 7f6ccc3d53..434394c7da 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -412,7 +412,7 @@ void CJabberProto::InitPopups(void) mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors"));
- ppc.hIcon = LoadIconEx("main");
+ ppc.hIcon = IcoLib_GetIconByHandle(m_hProtoIcon);
ppc.colorBack = RGB(191, 0, 0); //Red
ppc.colorText = RGB(255, 245, 225); //Yellow
ppc.iSeconds = 60;
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 0956b06bfc..11e1f98a54 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -178,7 +178,7 @@ public: bool OnInitDialog() override
{
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_NOTES));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_NOTES));
if (m_fnProcess) {
CMStringW buf;
@@ -507,7 +507,7 @@ public: bool OnInitDialog() override
{
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_NOTES));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_NOTES));
LOGFONT lf, lfTmp;
m_hfntNormal = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
@@ -723,7 +723,7 @@ bool CJabberProto::OnIncomingNote(const char *szFrom, const TiXmlElement *hXml) mir_snprintf(szService, "%s%s", m_szModuleName, JS_INCOMING_NOTE_EVENT);
CLISTEVENT cle = {};
- cle.hIcon = (HICON)LoadIconEx("notes");
+ cle.hIcon = g_plugin.getIcon(IDI_NOTES);
cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_UNICODE;
cle.hDbEvent = -99;
cle.lParam = (LPARAM)pItem;
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index dce6f4cc7e..cab97f697d 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -1934,7 +1934,7 @@ bool CJabberProto::OmemoCheckSession(MCONTACT hContact) while (id) {
if (!checked) {
pending_check = true;
- XmlNodeIq iq(AddIQ(&CJabberProto::OmemoOnIqResultGetBundle, JABBER_IQ_TYPE_GET, nullptr, 0UL, -1, &id));
+ XmlNodeIq iq(AddIQ(&CJabberProto::OmemoOnIqResultGetBundle, JABBER_IQ_TYPE_GET, nullptr, &id));
char szBareJid[JABBER_MAX_JID_LEN];
iq << XATTR("from", JabberStripJid(m_ThreadInfo->fullJID, szBareJid, _countof_portable(szBareJid)));
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index c8bda4c769..f8c5ed2379 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -97,13 +97,13 @@ void CCtrlTreeOpts::OnInit() DeleteAllItems();
hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR | ILC_COLOR32 | ILC_MASK, 5, 1);
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_MIRANDA));
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_TICK)); // check on
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_NOTICK)); // check off
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_TICK)); // radio on
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_NOTICK)); // radio on
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN));
- ImageList_AddIcon_Icolib(hImgLst, Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT));
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_MIRANDA);
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_TICK); // check on
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_NOTICK); // check off
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_TICK); // radio on
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_NOTICK); // radio on
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_GROUPOPEN);
+ ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_GROUPSHUT);
SetImageList(hImgLst, TVSIL_NORMAL);
/* build options tree. based on code from IcoLib */
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index 4ad8974619..b80679f565 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -41,7 +41,7 @@ public: bool OnInitDialog() override
{
m_proto->m_hwndJabberChangePassword = m_hwnd;
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_KEYS));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_KEYS));
if (m_proto->m_bJabberOnline && m_proto->m_ThreadInfo != nullptr) {
char text[1024];
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 5cc56e0e84..14508b7c92 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -46,12 +46,11 @@ BOOL CJabberProto::OnIqRequestPrivacyLists(const TiXmlElement*, CJabberIqInfo *p void CJabberProto::OnIqResultPrivacyListModify(const TiXmlElement*, CJabberIqInfo *pInfo)
{
- if (!pInfo->m_pUserData)
+ CPrivacyListModifyUserParam *pParam = (CPrivacyListModifyUserParam *)pInfo->GetUserData();
+ if (pParam == nullptr)
return;
- CPrivacyListModifyUserParam *pParam = (CPrivacyListModifyUserParam *)pInfo->m_pUserData;
-
- if (pInfo->m_nIqType != JABBER_IQ_TYPE_RESULT)
+ if (pInfo->GetIqType() != JABBER_IQ_TYPE_RESULT)
pParam->m_bAllOk = FALSE;
InterlockedDecrement(&pParam->m_dwCount);
@@ -243,7 +242,7 @@ void CJabberProto::OnIqResultPrivacyListDefault(const TiXmlElement *iqNode, CJab void CJabberProto::OnIqResultPrivacyLists(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
- if (pInfo->m_nIqType != JABBER_IQ_TYPE_RESULT)
+ if (pInfo->GetIqType() != JABBER_IQ_TYPE_RESULT)
return;
auto *query = XmlFirstChild(iqNode, "query");
@@ -357,10 +356,10 @@ public: m_proto->m_hwndPrivacyRule = m_hwnd;
- SendDlgItemMessage(m_hwnd, IDC_ICO_MESSAGE, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_msg_allow"), 0);
- SendDlgItemMessage(m_hwnd, IDC_ICO_QUERY, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_iq_allow"), 0);
- SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prin_allow"), 0);
- SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prout_allow"), 0);
+ SendDlgItemMessage(m_hwnd, IDC_ICO_MESSAGE, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_PL_MSG_ALLOW), 0);
+ SendDlgItemMessage(m_hwnd, IDC_ICO_QUERY, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_PL_QUERY_ALLOW), 0);
+ SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_PL_PRIN_ALLOW), 0);
+ SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_PL_PROUT_ALLOW), 0);
wchar_t *szTypes[] = { L"JID", L"Group", L"Subscription", L"Any" };
int i, nTypes[] = { Jid, Group, Subscription, Else };
@@ -832,11 +831,11 @@ class CJabberDlgPrivacyLists : public CJabberDlgBase }
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 4, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
- m_proto->LoadIconEx("main"), 16, 16, 0, nullptr, DI_NORMAL);
+ IcoLib_GetIconByHandle(m_proto->m_hProtoIcon), 16, 16, 0, nullptr, DI_NORMAL);
if (pRule)
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 4, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
- m_proto->LoadIconEx(pRule->GetAction() ? "disco_ok" : "disco_fail"),
+ g_plugin.getIcon(pRule->GetAction() ? IDI_DISCO_OK : IDI_DISCO_FAIL),
16, 16, 0, nullptr, DI_NORMAL);
if (lpdis->itemState & ODS_FOCUS) {
@@ -915,12 +914,12 @@ class CJabberDlgPrivacyLists : public CJabberDlgBase DrawNextRulePart(lpdis->hDC, clLine2, TranslateT(" (default)"), &rc);
DrawIconEx(lpdis->hDC, lpdis->rcItem.right - 16 - 4, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
- m_proto->LoadIconEx(bActive ? "pl_list_active" : "pl_list_any"),
+ g_plugin.getIcon(bActive ? IDI_PL_LIST_ACTIVE : IDI_PL_LIST_ANY),
16, 16, 0, nullptr, DI_NORMAL);
if (bDefault)
DrawIconEx(lpdis->hDC, lpdis->rcItem.right - 16 - 4, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
- m_proto->LoadIconEx("disco_ok"),
+ g_plugin.getIcon(IDI_DISCO_OK),
16, 16, 0, nullptr, DI_NORMAL);
if (hfnt)
@@ -1271,16 +1270,16 @@ lbl_return: public:
CJabberDlgPrivacyLists(CJabberProto *proto) :
CSuper(proto, IDD_PRIVACY_LISTS),
- m_btnSimple(this, IDC_BTN_SIMPLE, proto->LoadIconEx("group"), LPGEN("Simple mode")),
- m_btnAdvanced(this, IDC_BTN_ADVANCED, proto->LoadIconEx("sd_view_list"), LPGEN("Advanced mode")),
- m_btnAddJid(this, IDC_ADDJID, proto->LoadIconEx("addroster"), LPGEN("Add JID")),
- m_btnActivate(this, IDC_ACTIVATE, proto->LoadIconEx("pl_list_active"), LPGEN("Activate")),
- m_btnSetDefault(this, IDC_SET_DEFAULT, proto->LoadIconEx("pl_list_default"), LPGEN("Set default")),
+ m_btnSimple(this, IDC_BTN_SIMPLE, g_plugin.getIcon(IDI_GROUP), LPGEN("Simple mode")),
+ m_btnAdvanced(this, IDC_BTN_ADVANCED, g_plugin.getIcon(IDI_VIEW_LIST), LPGEN("Advanced mode")),
+ m_btnAddJid(this, IDC_ADDJID, g_plugin.getIcon(IDI_ADDCONTACT), LPGEN("Add JID")),
+ m_btnActivate(this, IDC_ACTIVATE, g_plugin.getIcon(IDI_PL_LIST_ACTIVE), LPGEN("Activate")),
+ m_btnSetDefault(this, IDC_SET_DEFAULT, g_plugin.getIcon(IDI_PL_LIST_DEFAULT), LPGEN("Set default")),
m_btnEditRule(this, IDC_EDIT_RULE, SKINICON_OTHER_RENAME, LPGEN("Edit rule")),
m_btnAddRule(this, IDC_ADD_RULE, SKINICON_OTHER_ADDCONTACT, LPGEN("Add rule")),
m_btnRemoveRule(this, IDC_REMOVE_RULE, SKINICON_OTHER_DELETE, LPGEN("Delete rule")),
- m_btnUpRule(this, IDC_UP_RULE, proto->LoadIconEx("arrow_up"), LPGEN("Move rule up")),
- m_btnDownRule(this, IDC_DOWN_RULE, proto->LoadIconEx("arrow_down"), LPGEN("Move rule down")),
+ m_btnUpRule(this, IDC_UP_RULE, g_plugin.getIcon(IDI_ARROW_UP), LPGEN("Move rule up")),
+ m_btnDownRule(this, IDC_DOWN_RULE, g_plugin.getIcon(IDI_ARROW_DOWN), LPGEN("Move rule down")),
m_btnAddList(this, IDC_ADD_LIST, SKINICON_OTHER_ADDCONTACT, LPGEN("Add list...")),
m_btnRemoveList(this, IDC_REMOVE_LIST, SKINICON_OTHER_DELETE, LPGEN("Remove list")),
m_btnApply(this, IDC_APPLY),
@@ -1318,7 +1317,7 @@ public: {
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_PRIVACY_LISTS));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_PRIVACY_LISTS));
EnableWindow(GetDlgItem(m_hwnd, IDC_ADD_RULE), FALSE);
EnableWindow(GetDlgItem(m_hwnd, IDC_EDIT_RULE), FALSE);
@@ -1340,15 +1339,15 @@ public: m_clcClist.SetExStyle(CLS_EX_DISABLEDRAGDROP | CLS_EX_TRACKSELECT);
HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 9, 9);
- ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_msg_allow"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_msg_deny"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_prin_allow"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_prin_deny"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_prout_allow"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_prout_deny"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_iq_allow"));
- ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("pl_iq_deny"));
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_SMALLDOT);
+ g_plugin.addImgListIcon(hIml, IDI_PL_MSG_ALLOW);
+ g_plugin.addImgListIcon(hIml, IDI_PL_MSG_DENY);
+ g_plugin.addImgListIcon(hIml, IDI_PL_PRIN_ALLOW);
+ g_plugin.addImgListIcon(hIml, IDI_PL_PRIN_DENY);
+ g_plugin.addImgListIcon(hIml, IDI_PL_PROUT_ALLOW);
+ g_plugin.addImgListIcon(hIml, IDI_PL_PROUT_DENY);
+ g_plugin.addImgListIcon(hIml, IDI_PL_QUERY_ALLOW);
+ g_plugin.addImgListIcon(hIml, IDI_PL_QUERY_DENY);
m_clcClist.SetExtraImageList(hIml);
m_clcClist.SetExtraColumns(4);
@@ -1530,15 +1529,15 @@ public: struct
{
wchar_t *textEng;
- char *icon;
+ int icon;
wchar_t *text;
}
static drawItems[] =
{
- { LPGENW("Message"), "pl_msg_allow" },
- { LPGENW("Presence (in)"), "pl_prin_allow" },
- { LPGENW("Presence (out)"), "pl_prout_allow" },
- { LPGENW("Query"), "pl_iq_allow" }
+ { LPGENW("Message"), IDI_PL_MSG_ALLOW },
+ { LPGENW("Presence (in)"), IDI_PL_PRIN_ALLOW },
+ { LPGENW("Presence (out)"), IDI_PL_PROUT_ALLOW },
+ { LPGENW("Query"), IDI_PL_QUERY_ALLOW }
};
LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
@@ -1561,7 +1560,7 @@ public: rc.left = (rc.left + rc.right - totalWidth) / 2;
for (auto &it : drawItems) {
- DrawIconEx(lpdis->hDC, rc.left, (rc.top + rc.bottom - 16) / 2, m_proto->LoadIconEx(it.icon),
+ DrawIconEx(lpdis->hDC, rc.left, (rc.top + rc.bottom - 16) / 2, g_plugin.getIcon(it.icon),
16, 16, 0, nullptr, DI_NORMAL);
rc.left += 18;
DrawNextRulePart(lpdis->hDC, clText, it.text, &rc);
@@ -1621,7 +1620,7 @@ public: }
EnableWindow(GetDlgItem(m_hwnd, IDC_ACTIVATE), FALSE);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ACTIVATE), GWLP_USERDATA, (LONG_PTR)pList);
- XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultPrivacyListActive, JABBER_IQ_TYPE_SET, nullptr, 0, -1, pList));
+ XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultPrivacyListActive, JABBER_IQ_TYPE_SET, nullptr, pList));
TiXmlElement *query = iq << XQUERY(JABBER_FEAT_PRIVACY_LISTS);
TiXmlElement *active = query << XCHILD("active");
if (pList)
@@ -1648,7 +1647,7 @@ public: EnableWindow(GetDlgItem(m_hwnd, IDC_SET_DEFAULT), FALSE);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SET_DEFAULT), GWLP_USERDATA, (LONG_PTR)pList);
- XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultPrivacyListDefault, JABBER_IQ_TYPE_SET, nullptr, 0, -1, pList));
+ XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultPrivacyListDefault, JABBER_IQ_TYPE_SET, nullptr, pList));
TiXmlElement *query = iq << XQUERY(JABBER_FEAT_PRIVACY_LISTS);
TiXmlElement *defaultTag = query << XCHILD("default");
if (pList)
@@ -1878,7 +1877,7 @@ public: pUserData->m_dwCount++;
- XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultPrivacyListModify, JABBER_IQ_TYPE_SET, nullptr, 0, -1, pUserData));
+ XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultPrivacyListModify, JABBER_IQ_TYPE_SET, nullptr, pUserData));
TiXmlElement *query = iq << XQUERY(JABBER_FEAT_PRIVACY_LISTS);
TiXmlElement *listTag = query << XCHILD("list") << XATTR("name", pList->GetListName());
@@ -2006,7 +2005,7 @@ INT_PTR __cdecl CJabberProto::menuSetPrivacyList(WPARAM, LPARAM, LPARAM iList) pList = pList->GetNext();
}
- XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResultPrivacyListActive, JABBER_IQ_TYPE_SET, nullptr, 0, -1, pList));
+ XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResultPrivacyListActive, JABBER_IQ_TYPE_SET, nullptr, pList));
TiXmlElement *query = iq << XQUERY(JABBER_FEAT_PRIVACY_LISTS);
TiXmlElement *active = query << XCHILD("active");
if (pList)
@@ -2024,7 +2023,7 @@ void CJabberProto::BuildPrivacyMenu() {
CMenuItem mi(&g_plugin);
mi.position = 200005;
- mi.hIcolibItem = GetIconHandle(IDI_AGENTS);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_AGENTS);
mi.flags = CMIF_UNMOVABLE | CMIF_HIDDEN;
mi.name.a = LPGEN("Privacy Lists");
mi.root = m_hMenuRoot;
@@ -2034,7 +2033,7 @@ void CJabberProto::BuildPrivacyMenu() CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandlePrivacyLists);
mi.position = 3000040000;
mi.flags = CMIF_UNMOVABLE | CMIF_UNICODE;
- mi.hIcolibItem = GetIconHandle(IDI_PRIVACY_LISTS);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_PRIVACY_LISTS);
mi.name.w = LPGENW("List Editor...");
mi.root = m_hPrivacyMenuRoot;
Menu_AddProtoMenuItem(&mi, m_szModuleName);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 005311104f..ec65a52654 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -281,7 +281,7 @@ void CJabberProto::OnModulesLoaded() StatusIconData sid = {};
sid.szModule = m_szModuleName;
- sid.hIcon = LoadIconEx("main");
+ sid.hIcon = IcoLib_GetIconByHandle(m_hProtoIcon);
sid.flags = MBF_HIDDEN;
sid.szTooltip.a = LPGEN("Jabber Resource");
Srmm_AddIcon(&sid, &g_plugin);
@@ -613,12 +613,14 @@ int CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) JabberStripJid(jid, szBareJid, _countof(szBareJid));
if (m_ThreadInfo) {
- m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIqResultEntityTime, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_HCONTACT))
- << XCHILDNS("time", JABBER_FEAT_ENTITY_TIME));
+ auto *pInfo = AddIQ(&CJabberProto::OnIqResultEntityTime, JABBER_IQ_TYPE_GET, jid);
+ pInfo->SetParamsToParse(JABBER_IQ_PARSE_HCONTACT);
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XCHILDNS("time", JABBER_FEAT_ENTITY_TIME));
// XEP-0012, last logoff time
- m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_FROM)) << XQUERY(JABBER_FEAT_LAST_ACTIVITY));
+ pInfo = AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, jid);
+ pInfo->SetParamsToParse(JABBER_IQ_PARSE_FROM);
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_LAST_ACTIVITY));
JABBER_LIST_ITEM *item = nullptr;
if ((item = ListGetItemPtr(LIST_VCARD_TEMP, jid)) == nullptr)
@@ -643,14 +645,17 @@ int CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) pResourceStatus r(it);
CMStringA tmp(MakeJid(szBareJid, r->m_szResourceName));
- if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO)
- m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT))
- << XQUERY(JABBER_FEAT_DISCO_INFO));
+ if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
+ pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, tmp);
+ pInfo->SetParamsToParse(JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT);
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO));
+ }
- if (mir_strcmp(tmp, jid)) // skip current resource, we've already sent this iq to it
- m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM)) << XQUERY(JABBER_FEAT_LAST_ACTIVITY));
+ if (mir_strcmp(tmp, jid)) { // skip current resource, we've already sent this iq to it
+ pInfo = AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp);
+ pInfo->SetParamsToParse(JABBER_IQ_PARSE_FROM);
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_LAST_ACTIVITY));
+ }
}
}
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 40227f952c..d91582c5eb 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -482,8 +482,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface int* m_transportProtoTableStartIndex;
void IconsInit(void);
- HANDLE GetIconHandle(int iconId);
- HICON LoadIconEx(const char* name, bool big = false);
int LoadAdvancedIcons(int iID);
int GetTransportProtoID(char* TransportDomain);
int GetTransportStatusIconIndex(int iID, int Status);
@@ -493,9 +491,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_iq.c -------------------------------------------------------------------
- __forceinline CJabberIqInfo* AddIQ(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const char *szReceiver = nullptr, DWORD dwParamsToParse = 0, int nIqId = -1, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT)
+ __forceinline CJabberIqInfo* AddIQ(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const char *szReceiver = nullptr, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT)
{
- return m_iqManager.AddHandler(pHandler, nIqType, szReceiver, dwParamsToParse, nIqId, pUserData, iPriority);
+ return m_iqManager.AddHandler(pHandler, nIqType, szReceiver, pUserData, iPriority);
}
void __cdecl ExpirerThread(void*);
@@ -837,7 +835,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_xml.c ------------------------------------------------------------------
- int OnXmlParse(char* buffer);
void OnConsoleProcessXml(const TiXmlElement *node, DWORD flags);
//---- jabber_xmlns.c ----------------------------------------------------------------
@@ -905,7 +902,6 @@ public: HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority) override;
HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, const char *szXmlns, const char *szTag, void *pUserData, int iPriority) override;
HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, const char *szXmlns, const char *szTag, void *pUserData, int iPriority) override;
- HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData, DWORD dwTimeout, int iPriority) override;
HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority) override;
int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler) override;
diff --git a/protocols/JabberG/src/jabber_roster.cpp b/protocols/JabberG/src/jabber_roster.cpp index 727f77ea9a..c248722229 100644 --- a/protocols/JabberG/src/jabber_roster.cpp +++ b/protocols/JabberG/src/jabber_roster.cpp @@ -236,7 +236,7 @@ public: bool OnInitDialog() override { - Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_AGENTS)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_AGENTS)); Utils_RestoreWindowPosition(m_hwnd, 0, m_proto->m_szModuleName, "rosterCtrlWnd_"); diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 8ac857be1b..15061de69d 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -583,7 +583,7 @@ public: {
CSuper::OnInitDialog();
- Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_OPEN));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_OPEN));
SetDlgItemTextUtf(m_hwnd, IDC_TXT_URL, m_pParams->m_szUrl);
SetDlgItemTextUtf(m_hwnd, IDC_TXT_FROM, m_pParams->m_szFrom);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 486fd6fbcc..880e6eb0f9 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -424,13 +424,13 @@ LBL_FatalError: else if (nSelRes == 0) {
if (m_bSendKeepAlive) {
if (info.jabberServerCaps & JABBER_CAPS_PING) {
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, nullptr, 0, -1, this);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, nullptr, this);
pInfo->SetTimeout(m_iConnectionKeepAliveTimeout);
info.send(XmlNodeIq(pInfo) << XATTR("from", info.fullJID) << XCHILDNS("ping", JABBER_FEAT_PING));
}
}
- else
- info.send(" \t "); //TODO: why do we need this ?
+ else info.send(" \t ");
+
if (m_bEnableStreamMgmt)
m_StrmMgmt.RequestAck();
}
@@ -1298,9 +1298,8 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) auto *idNode = XmlFirstChild(xNode, "id");
if (XmlFirstChild(xNode, "delivered") != nullptr || XmlFirstChild(xNode, "offline") != nullptr) {
int id = -1;
- if (idNode != nullptr && idNode->GetText() != nullptr)
- if (!strncmp(idNode->GetText(), JABBER_IQID, mir_strlen(JABBER_IQID)))
- id = atoi((idNode->GetText()) + mir_strlen(JABBER_IQID));
+ if (idNode != nullptr)
+ id = JabberGetPacketID(idNode->GetText());
if (id != -1)
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)id, 0);
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index c228169c17..b8588ef601 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -138,9 +138,9 @@ void TreeList_Create(HWND hwnd) ListView_SetImageList(hwnd, hIml, LVSIL_SMALL);
hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1);
- ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN));
- ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT));
- ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_DOWNARROW));
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_GROUPOPEN);
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_GROUPSHUT);
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_DOWNARROW);
ListView_SetImageList(hwnd, hIml, LVSIL_STATE);
}
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 16a0097a95..0488052609 100755 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -233,7 +233,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti // caps JabberCapsBits jcb = ppro->GetResourceCapabilities(MakeJid(item->jid, r->m_szResourceName), r); if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) { - HTREEITEM htiCaps = sttFillInfoLine(hwndTree, htiResource, ppro->LoadIconEx("main"), nullptr, TranslateU("Client capabilities"), sttInfoLineId(resource, INFOLINE_CAPS)); + HTREEITEM htiCaps = sttFillInfoLine(hwndTree, htiResource, IcoLib_GetIconByHandle(ppro->m_hProtoIcon), nullptr, TranslateU("Client capabilities"), sttInfoLineId(resource, INFOLINE_CAPS)); int i; for (i = 0; i < g_cJabberFeatCapPairs; i++) if (jcb & g_JabberFeatCapPairs[i].jcbCap) { @@ -258,7 +258,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti } // Software info - HTREEITEM htiSoftwareInfo = sttFillInfoLine(hwndTree, htiResource, ppro->LoadIconEx("main"), nullptr, TranslateU("Software information"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION)); + HTREEITEM htiSoftwareInfo = sttFillInfoLine(hwndTree, htiResource, IcoLib_GetIconByHandle(ppro->m_hProtoIcon), nullptr, TranslateU("Software information"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION)); int nLineId = 0; if (CJabberClientPartialCaps *pCaps = r->m_pCaps) { if (pCaps->GetOs()) @@ -300,7 +300,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM sttCleanupInfo(hwndTree, 0); - HTREEITEM htiRoot = sttFillInfoLine(hwndTree, nullptr, ppro->LoadIconEx("main"), L"JID", item->jid, sttInfoLineId(0, INFOLINE_NAME), true); + HTREEITEM htiRoot = sttFillInfoLine(hwndTree, nullptr, IcoLib_GetIconByHandle(ppro->m_hProtoIcon), L"JID", item->jid, sttInfoLineId(0, INFOLINE_NAME), true); if (MCONTACT hContact = ppro->HContactFromJID(item->jid)) { sttFillAdvStatusInfo(ppro, hwndTree, htiRoot, sttInfoLineId(0, INFOLINE_MOOD), hContact, TranslateT("Mood"), ADVSTATUS_MOOD); @@ -403,12 +403,12 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa memset(dat, 0, sizeof(JabberUserInfoDlgData)); dat->resourcesCount = -1; dat->hContact = lParam; - { - GetClientRect(hwndDlg, &rc); - MoveWindow(GetDlgItem(hwndDlg, IDC_TV_INFO), 5, 5, rc.right - 10, rc.bottom - 10, TRUE); + GetClientRect(hwndDlg, &rc); + MoveWindow(GetDlgItem(hwndDlg, IDC_TV_INFO), 5, 5, rc.right - 10, rc.bottom - 10, TRUE); + { HIMAGELIST himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR | ILC_COLOR32 | ILC_MASK, 5, 1); - ImageList_AddIcon_Icolib(himl, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)); + ImageList_AddSkinIcon(himl, SKINICON_OTHER_SMALLDOT); TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TV_INFO), himl, TVSIL_NORMAL); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); @@ -439,8 +439,8 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (dat->item == nullptr) { HWND hwndTree = GetDlgItem(hwndDlg, IDC_TV_INFO); TreeView_DeleteAllItems(hwndTree); - HTREEITEM htiRoot = sttFillInfoLine(hwndTree, nullptr, dat->ppro->LoadIconEx("main"), L"JID", jid, sttInfoLineId(0, INFOLINE_NAME), true); - sttFillInfoLine(hwndTree, htiRoot, dat->ppro->LoadIconEx("vcard"), nullptr, TranslateU("Please switch online to see more details.")); + HTREEITEM htiRoot = sttFillInfoLine(hwndTree, nullptr, IcoLib_GetIconByHandle(dat->ppro->m_hProtoIcon), L"JID", jid, sttInfoLineId(0, INFOLINE_NAME), true); + sttFillInfoLine(hwndTree, htiRoot, g_plugin.getIcon(IDI_VCARD), nullptr, TranslateU("Please switch online to see more details.")); break; } } @@ -570,7 +570,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP photoInfo->ppro = nullptr; photoInfo->hBitmap = nullptr; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)photoInfo); - SendDlgItemMessage(hwndDlg, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_LoadIconEx("save")); + SendDlgItemMessage(hwndDlg, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_SAVE)); SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONSETASFLATBTN, TRUE, 0); ShowWindow(GetDlgItem(hwndDlg, IDC_LOAD), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_DELETE), SW_HIDE); diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 981610f811..b1169e26ab 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -514,12 +514,11 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) ///////////////////////////////////////////////////////////////////////////////
// JabberGetPacketID - converts the xml id attribute into an integer
-int JabberGetPacketID(const TiXmlElement *n)
+int JabberGetPacketID(const char *str)
{
- const char *str = XmlGetAttr(n, "id");
- if (str)
- if (!strncmp(str, JABBER_IQID, _countof(JABBER_IQID) - 1))
- return atoi(str + _countof(JABBER_IQID) - 1);
+ if (mir_strlen(str) >= 20)
+ if (!memcmp(str, "mir", 3) && !memcmp(g_plugin.szRandom, str+3, 16) && str[19] == '_')
+ return atoi(str + 20);
return -1;
}
@@ -527,7 +526,7 @@ int JabberGetPacketID(const TiXmlElement *n) char* JabberId2string(int id)
{
char text[100];
- mir_snprintf(text, JABBER_IQID "%d", id);
+ mir_snprintf(text, "mir%s_%d", g_plugin.szRandom, id);
return mir_strdup(text);
}
@@ -693,7 +692,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) else {
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP/");
ppro->m_pInfoFrame->CreateInfoItem("$/PEP", false);
- ppro->m_pInfoFrame->UpdateInfoItem("$/PEP", ppro->GetIconHandle(IDI_PL_LIST_ANY), TranslateT("Advanced Status"));
+ ppro->m_pInfoFrame->UpdateInfoItem("$/PEP", g_plugin.getIconHandle(IDI_PL_LIST_ANY), TranslateT("Advanced Status"));
ppro->m_pInfoFrame->CreateInfoItem("$/PEP/mood", true);
ppro->m_pInfoFrame->SetInfoItemCallback("$/PEP/mood", &CJabberProto::InfoFrame_OnUserMood);
@@ -706,7 +705,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) ppro->m_pInfoFrame->RemoveInfoItem("$/Transports/");
ppro->m_pInfoFrame->CreateInfoItem("$/Transports", false);
- ppro->m_pInfoFrame->UpdateInfoItem("$/Transports", ppro->GetIconHandle(IDI_TRANSPORT), TranslateT("Transports"));
+ ppro->m_pInfoFrame->UpdateInfoItem("$/Transports", g_plugin.getIconHandle(IDI_TRANSPORT), TranslateT("Transports"));
JABBER_LIST_ITEM *item = nullptr;
LISTFOREACH(i, ppro, LIST_ROSTER)
@@ -720,7 +719,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) char name[128];
mir_snprintf(name, "$/Transports/%s", item->jid);
ppro->m_pInfoFrame->CreateInfoItem(name, true, hContact);
- ppro->m_pInfoFrame->UpdateInfoItem(name, ppro->GetIconHandle(IDI_TRANSPORTL), (wchar_t *)item->jid);
+ ppro->m_pInfoFrame->UpdateInfoItem(name, g_plugin.getIconHandle(IDI_TRANSPORTL), (wchar_t *)item->jid);
ppro->m_pInfoFrame->SetInfoItemCallback(name, &CJabberProto::InfoFrame_OnTransport);
}
}
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index a8ba50067c..1dc02d045d 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -264,9 +264,9 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_INITDIALOG:
if (!lParam) break; // Launched from userinfo
TranslateDialogDefault(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_LOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_LoadIconEx("open"));
+ SendDlgItemMessage(hwndDlg, IDC_LOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_OPEN));
SendDlgItemMessage(hwndDlg, IDC_LOAD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_LoadIconEx("delete"));
+ SendDlgItemMessage(hwndDlg, IDC_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_DELETE));
SendDlgItemMessage(hwndDlg, IDC_DELETE, BUTTONSETASFLATBTN, TRUE, 0);
ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE);
{
@@ -804,11 +804,11 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc);
if (nm->nmcd.lItemlParam == -1 && nm->iSubItem == 3)
- hIcon = g_LoadIconEx("addcontact");
+ hIcon = g_plugin.getIcon(IDI_ADDCONTACT);
else if (nm->iSubItem == 2 && nm->nmcd.lItemlParam != -1)
- hIcon = g_LoadIconEx("edit");
+ hIcon = g_plugin.getIcon(IDI_EDIT);
else if (nm->iSubItem == 3 && nm->nmcd.lItemlParam != -1)
- hIcon = g_LoadIconEx("delete");
+ hIcon = g_plugin.getIcon(IDI_DELETE);
else break;
DrawIconEx(nm->nmcd.hdc, (rc.left + rc.right - GetSystemMetrics(SM_CXSMICON)) / 2, (rc.top + rc.bottom - GetSystemMetrics(SM_CYSMICON)) / 2, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 6fa1c31610..b981aab7fb 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -129,8 +129,5 @@ TiXmlElement* __fastcall operator<<(TiXmlElement *node, const XQUERY &child) void XmlAddAttrID(TiXmlElement *hXml, int id)
{
- char text[100];
- mir_snprintf(text, JABBER_IQID "%d", id);
- hXml->SetAttribute("id", text);
+ hXml->SetAttribute("id", ptrA(JabberId2string(id)).get());
}
-
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 230be83e14..d0babbcfb4 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _JABBER_XML_H_
void XmlAddAttrID(TiXmlElement*, int id);
+
class XmlNode : public TiXmlDocument, private MNonCopyable
{
protected:
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 6f2b8a80fe..af69115cf2 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -760,7 +760,7 @@ void CPepMood::UpdateMenuView() ///////////////////////////////////////////////////////////////////////////////
// CPepActivity
-#define ACTIVITY_ICON(section, item) -(300 + (section) * 20 + (item))
+#define ACTIVITY_ICON(section, item) -(1300 + (section) * 20 + (item))
struct
{
@@ -1499,7 +1499,7 @@ void g_XstatusIconsInit() mir_wstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods"));
for (int i = 1; i < _countof(g_arrMoods); i++)
- g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateW(g_arrMoods[i].szName));
+ g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(1200 + i), szSection, TranslateW(g_arrMoods[i].szName));
mir_wstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Activities"));
for (int k = 0; k < _countof(g_arrActivities); k++) {
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index f319bb16d2..d7710f32a6 100755 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -116,6 +116,8 @@ struct CJabberProto; struct CMPlugin : public ACCPROTOPLUGIN<CJabberProto>
{
+ char szRandom[17];
+
CMPlugin();
int Load() override;
@@ -147,11 +149,9 @@ protected: * Global constants
*******************************************************************/
-#define GLOBAL_SETTING_PREFIX "JABBER"
#define GLOBAL_SETTING_MODULE "JABBER"
#define JABBER_DEFAULT_PORT 5222
-#define JABBER_IQID "mir_"
#define JABBER_MAX_JID_LEN 1024
#define JABBER_GC_MSG_QUIT LPGEN("I'm happy Miranda NG user. Get it at https://miranda-ng.org/.")
@@ -672,10 +672,6 @@ public: void g_IconsInit();
void g_XstatusIconsInit();
void g_XstatusIconsUninit();
-HANDLE g_GetIconHandle(int iconId);
-HICON g_LoadIconEx(const char* name, bool big = false);
-
-void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon);
//---- jabber_libstr.c ----------------------------------------------
@@ -751,9 +747,13 @@ void JabberHttpUrlDecode(wchar_t *str); int JabberCombineStatus(int status1, int status2);
time_t JabberIsoToUnixTime(const char *stamp);
char* JabberStripJid(const char *jid, char *dest, size_t destLen);
-int JabberGetPacketID(const TiXmlElement *n);
+int JabberGetPacketID(const char*);
char* JabberId2string(int id);
+__inline int JabberGetPacketID(const TiXmlElement *n)
+{ return JabberGetPacketID(XmlGetAttr(n, "id"));
+}
+
char* time2str(time_t _time, char *buf, size_t bufLen);
time_t str2time(const char*);
|