summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-06-06 13:08:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-06-06 13:08:58 +0000
commit74949105683f2d78efaff0376b99308c3fb1efd9 (patch)
tree4acbe11ca99b42f1b456383746808594fa040ef3 /protocols/JabberG/src
parent176fb1d22df02c5791815a0764273c0b8da1d3d4 (diff)
- CGroupchatInviteAcceptDlg redesigned to avoid separate thread creation;
- local function WindowSetIcon replaced with Window_SetIcon_IcoLib(); git-svn-id: http://svn.miranda-ng.org/main/trunk@16925 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp2
-rw-r--r--protocols/JabberG/src/jabber_bookmarks.cpp2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_console.cpp2
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp2
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp43
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp4
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp4
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp2
-rw-r--r--protocols/JabberG/src/jabber_password.cpp2
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp2
-rw-r--r--protocols/JabberG/src/jabber_proto.h9
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp2
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp2
-rw-r--r--protocols/JabberG/src/stdafx.h1
15 files changed, 27 insertions, 56 deletions
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index 1c2c64c15d..5186d2241e 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -358,7 +358,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
dat->proto = pStartupParams->m_pProto;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- WindowSetIcon(hwndDlg, dat->proto, "adhoc");
+ Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_COMMAND));
dat->proto->m_hwndCommandWindow = hwndDlg;
TranslateDialogDefault(hwndDlg);
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp
index 11a136cd86..2106a4b2c7 100644
--- a/protocols/JabberG/src/jabber_bookmarks.cpp
+++ b/protocols/JabberG/src/jabber_bookmarks.cpp
@@ -272,7 +272,7 @@ void CJabberDlgBookmarks::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "bookmarks");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_BOOKMARKS));
m_btnAdd.Disable();
m_btnEdit.Disable();
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index be0f1efadf..f4a983f1ba 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -730,7 +730,7 @@ public:
CSuper::OnInitDialog();
SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMString(FORMAT, TranslateT("Invite Users to\n%s"), m_room));
- WindowSetIcon(m_hwnd, m_proto, "group");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_CLIST), GWL_STYLE,
GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_CLIST), GWL_STYLE) | CLS_HIDEOFFLINE | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE | CLS_GROUPCHECKBOXES);
@@ -840,7 +840,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
dat = (TUserInfoData *)lParam;
- WindowSetIcon(hwndDlg, dat->ppro, "group");
+ Window_SetIcon_IcoLib(hwndDlg, g_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 721fed6aac..4033edb1b7 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -336,7 +336,7 @@ void CJabberDlgConsole::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "xmlconsole");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_CONSOLE));
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_EXLIMITTEXT, 0, 0x80000000);
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index d11f05d097..e5f6df0342 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -631,7 +631,7 @@ void CJabberDlgDiscovery::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "servicediscovery");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_SERVICE_DISCOVERY));
if (m_jid) {
SetDlgItemText(m_hwnd, IDC_COMBO_JID, m_jid);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 348f62bfda..e4f81a4d68 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -417,7 +417,7 @@ void CJabberDlgGcJoin::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "group");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
JabberGcRecentInfo *pInfo = NULL;
if (m_jid)
@@ -1141,12 +1141,12 @@ class CGroupchatInviteAcceptDlg : public CJabberDlgBase
{
typedef CJabberDlgBase CSuper;
CCtrlButton m_accept;
- JABBER_GROUPCHAT_INVITE_INFO* m_info;
+ CMString m_roomJid, m_from, m_reason, m_password;
public:
- CGroupchatInviteAcceptDlg(CJabberProto *ppro, JABBER_GROUPCHAT_INVITE_INFO* pInfo) :
+ CGroupchatInviteAcceptDlg(CJabberProto *ppro, const TCHAR *roomJid, const TCHAR *from, const TCHAR *reason, const TCHAR *password) :
CSuper(ppro, IDD_GROUPCHAT_INVITE_ACCEPT, NULL),
- m_info(pInfo),
+ m_roomJid(roomJid), m_from(from), m_reason(reason), m_password(password),
m_accept(this, IDC_ACCEPT)
{
m_accept.OnClick = Callback(this, &CGroupchatInviteAcceptDlg::OnCommand_Accept);
@@ -1157,17 +1157,14 @@ public:
CSuper::OnInitDialog();
TCHAR buf[256];
- mir_sntprintf(buf, TranslateT("Group chat invitation to\n%s"), m_info->roomJid);
+ mir_sntprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid);
SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf);
- SetDlgItemText(m_hwnd, IDC_FROM, m_info->from);
-
- if (m_info->reason != NULL)
- SetDlgItemText(m_hwnd, IDC_REASON, m_info->reason);
-
+ SetDlgItemText(m_hwnd, IDC_FROM, m_from);
+ SetDlgItemText(m_hwnd, IDC_REASON, m_reason);
SetDlgItemText(m_hwnd, IDC_NICK, ptrT(JabberNickFromJID(m_proto->m_szJabberJID)));
- WindowSetIcon(m_hwnd, m_proto, "group");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
SetFocus(GetDlgItem(m_hwnd, IDC_NICK));
}
@@ -1176,20 +1173,15 @@ public:
{
TCHAR text[128];
GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
- m_proto->AcceptGroupchatInvite(m_info->roomJid, text, m_info->password);
+ m_proto->AcceptGroupchatInvite(m_roomJid, text, m_password);
EndDialog(m_hwnd, 0);
}
};
-void __cdecl CJabberProto::GroupchatInviteAcceptThread(JABBER_GROUPCHAT_INVITE_INFO *inviteInfo)
+static void __stdcall sttShowDialog(void *pArg)
{
- CGroupchatInviteAcceptDlg(this, inviteInfo).DoModal();
-
- mir_free(inviteInfo->roomJid);
- mir_free(inviteInfo->from);
- mir_free(inviteInfo->reason);
- mir_free(inviteInfo->password);
- mir_free(inviteInfo);
+ CGroupchatInviteAcceptDlg *pDlg = (CGroupchatInviteAcceptDlg*)pArg;
+ pDlg->Show();
}
void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *from, const TCHAR *reason, const TCHAR *password)
@@ -1200,15 +1192,7 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro
if (ListGetItemPtr(LIST_CHATROOM, roomJid))
return;
- if (m_options.AutoAcceptMUC == FALSE) {
- JABBER_GROUPCHAT_INVITE_INFO* inviteInfo = (JABBER_GROUPCHAT_INVITE_INFO *)mir_alloc(sizeof(JABBER_GROUPCHAT_INVITE_INFO));
- inviteInfo->roomJid = mir_tstrdup(roomJid);
- inviteInfo->from = mir_tstrdup(from);
- inviteInfo->reason = mir_tstrdup(reason);
- inviteInfo->password = mir_tstrdup(password);
- ForkThread((MyThreadFunc)&CJabberProto::GroupchatInviteAcceptThread, inviteInfo);
- }
- else {
+ if (m_options.AutoAcceptMUC) {
ptrT nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
if (nick == NULL)
nick = getTStringA("Nick");
@@ -1216,6 +1200,7 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro
nick = JabberNickFromJID(m_szJabberJID);
AcceptGroupchatInvite(roomJid, nick, password);
}
+ else CallFunctionAsync(sttShowDialog, new CGroupchatInviteAcceptDlg(this, roomJid, from, reason, password));
}
void CJabberProto::AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password)
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 01361f011c..82c385c64b 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -557,7 +557,3 @@ void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon)
ImageList_AddIcon(hIml, hIcon);
IcoLib_ReleaseIcon(hIcon);
}
-
-void WindowSetIcon(HWND hWnd, CJabberProto *proto, const char* name)
-{
-}
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index 00ab589b8c..47cbbd8cfb 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -237,7 +237,7 @@ CJabberDlgNoteItem::CJabberDlgNoteItem(CJabberProto *proto, CNoteItem *pNote, TF
void CJabberDlgNoteItem::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "notes");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_NOTES));
if (m_fnProcess) {
CMString buf;
@@ -639,7 +639,7 @@ void CJabberDlgNotes::UpdateData()
void CJabberDlgNotes::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "notes");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_NOTES));
LOGFONT lf, lfTmp;
m_hfntNormal = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 28e5f33660..71dd2f0eee 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -1398,7 +1398,7 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
TranslateDialogDefault(hwndDlg);
- WindowSetIcon(hwndDlg, ppro, "Agents");
+ Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_AGENTS));
Utils_RestoreWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_");
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp
index 4fe3ae4ab0..d75d0afec1 100644
--- a/protocols/JabberG/src/jabber_password.cpp
+++ b/protocols/JabberG/src/jabber_password.cpp
@@ -46,7 +46,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR
ppro = (CJabberProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
- WindowSetIcon(hwndDlg, ppro, "key");
+ Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_KEYS));
TranslateDialogDefault(hwndDlg);
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
TCHAR text[1024];
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 3dd5805f00..c957183889 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -760,7 +760,7 @@ void CJabberDlgPrivacyLists::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "privacylists");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_PRIVACY_LISTS));
EnableWindow(GetDlgItem(m_hwnd, IDC_ADD_RULE), FALSE);
EnableWindow(GetDlgItem(m_hwnd, IDC_EDIT_RULE), FALSE);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 8b0b35cad5..0cdc87a234 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -46,14 +46,6 @@ typedef UNIQUE_MAP<TCHAR,TCharKeyCmp> U_TCHAR_MAP;
#define JABBER_DEFAULT_RECENT_COUNT 10
-struct JABBER_GROUPCHAT_INVITE_INFO
-{
- TCHAR *roomJid;
- TCHAR *from;
- TCHAR *reason;
- TCHAR *password;
-};
-
struct ROSTERREQUSERDATA
{
HWND hwndDlg;
@@ -415,7 +407,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
//---- jabber_groupchat.c ------------------------------------------------------------
INT_PTR __cdecl OnMenuHandleJoinGroupchat(WPARAM wParam, LPARAM lParam);
- void __cdecl GroupchatInviteAcceptThread(JABBER_GROUPCHAT_INVITE_INFO *inviteInfo);
INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index 9b6ecf86a6..0c9abaf40a 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -601,7 +601,7 @@ public:
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "openid");
+ Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_OPEN));
SetDlgItemText(m_hwnd, IDC_TXT_URL, m_pParams->m_szUrl);
SetDlgItemText(m_hwnd, IDC_TXT_FROM, m_pParams->m_szFrom);
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index e654238361..4982f6fe1f 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -224,7 +224,7 @@ void CJabberDlgPepSimple::OnInitDialog()
{
CSuper::OnInitDialog();
- WindowSetIcon(m_hwnd, m_proto, "main");
+ Window_SetIcon_IcoLib(m_hwnd, m_proto->m_hProtoIcon);
SetWindowText(m_hwnd, m_title);
m_txtDescription.Enable(false);
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index 429ec8f418..805b83eb23 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -656,7 +656,6 @@ HANDLE g_GetIconHandle(int iconId);
HICON g_LoadIconEx(const char* name, bool big = false);
void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon);
-void WindowSetIcon(HWND hWnd, CJabberProto *proto, const char* name);
//---- jabber_libstr.c ----------------------------------------------