summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-11-09 09:19:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-11-09 09:19:38 +0000
commit581844d52f2b91a45240a1e7bf7cd95cc93b0837 (patch)
tree5f16a4047144eeca67deb3dd3b7d98cd191a6096
parentb067cb5f4dd97509448956205c41f96cce6f8473 (diff)
fix for the frame processing in Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@15702 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp94
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp10
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp21
5 files changed, 76 insertions, 53 deletions
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index 63ef368c46..1191a99bd8 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -75,54 +75,55 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
m_proto = proto;
m_clickedItem = -1;
- if (!proto->m_options.DisableFrame && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- InitClass();
-
- CLISTFrame frame = { sizeof(frame) };
- HWND hwndClist = pcli->hwndContactList;
- frame.hWnd = CreateWindowEx(0, _T("JabberInfoFrameClass"), NULL, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, NULL, hInst, this);
- frame.align = alBottom;
- frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
- frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
- frame.tname = mir_a2t(proto->m_szModuleName);
- frame.TBtname = proto->m_tszUserName;
- m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
- mir_free(frame.tname);
- if (m_frameId == -1) {
- DestroyWindow(frame.hWnd);
- return;
- }
+ InitClass();
+
+ CLISTFrame frame = { sizeof(frame) };
+ HWND hwndClist = pcli->hwndContactList;
+ frame.hWnd = CreateWindowEx(0, _T("JabberInfoFrameClass"), NULL, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, NULL, hInst, this);
+ frame.align = alBottom;
+ frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
+ frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
+ frame.tname = mir_a2t(proto->m_szModuleName);
+ frame.TBtname = proto->m_tszUserName;
+ m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
+ mir_free(frame.tname);
+ if (m_frameId == -1) {
+ DestroyWindow(frame.hWnd);
+ return;
+ }
- m_hhkFontsChanged = HookEventMessage(ME_FONT_RELOAD, m_hwnd, WM_APP);
- ReloadFonts();
+ m_hhkFontsChanged = HookEventMessage(ME_FONT_RELOAD, m_hwnd, WM_APP);
+ ReloadFonts();
- m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- m_hwnd, NULL, hInst, NULL);
- SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ m_hwnd, NULL, hInst, NULL);
+ 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);
+ CreateInfoItem("$", true);
+ UpdateInfoItem("$", proto->GetIconHandle(IDI_JABBER), proto->m_tszUserName);
- CreateInfoItem("$/JID", true);
- UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), _T("Offline"));
- SetInfoItemCallback("$/JID", &CJabberProto::InfoFrame_OnSetup);
- }
+ CreateInfoItem("$/JID", true);
+ UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), _T("Offline"));
+ SetInfoItemCallback("$/JID", &CJabberProto::InfoFrame_OnSetup);
}
CJabberInfoFrame::~CJabberInfoFrame()
{
- if (!m_hwnd) return;
-
- if (m_hhkFontsChanged) UnhookEvent(m_hhkFontsChanged);
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)m_frameId, 0);
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
- DestroyWindow(m_hwnd);
- DestroyWindow(m_hwndToolTip);
- DeleteObject(m_hfntText);
- DeleteObject(m_hfntTitle);
- m_hwnd = NULL;
+
+ if (m_hhkFontsChanged)
+ UnhookEvent(m_hhkFontsChanged);
+
+ if (m_hwnd != NULL) {
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
+ DestroyWindow(m_hwnd);
+ DestroyWindow(m_hwndToolTip);
+ DeleteObject(m_hfntText);
+ DeleteObject(m_hfntTitle);
+ m_hwnd = NULL;
+ }
}
void CJabberInfoFrame::InitClass()
@@ -497,3 +498,18 @@ void CJabberInfoFrame::RemoveInfoItem(char *pszName)
if (bUpdate)
UpdateSize();
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CJabberProto::InitInfoFrame()
+{
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ return;
+
+ if (!m_options.DisableFrame)
+ m_pInfoFrame = new CJabberInfoFrame(this);
+ else {
+ delete m_pInfoFrame;
+ m_pInfoFrame = NULL;
+ }
+}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 30a1b3b212..09fed5861d 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -760,15 +760,18 @@ class CDlgOptAdvanced: public CJabberDlgBase
CCtrlEdit m_txtProxy;
CCtrlTreeOpts m_otvOptions;
+ BYTE m_oldFrameValue;
+
public:
- CDlgOptAdvanced(CJabberProto *proto):
+ CDlgOptAdvanced(CJabberProto *proto) :
CJabberDlgBase(proto, IDD_OPT_JABBER2, false),
m_chkDirect(this, IDC_DIRECT),
m_chkDirectManual(this, IDC_DIRECT_MANUAL),
m_chkProxy(this, IDC_PROXY_MANUAL),
m_txtDirect(this, IDC_DIRECT_ADDR),
m_txtProxy(this, IDC_PROXY_ADDR),
- m_otvOptions(this, IDC_OPTTREE)
+ m_otvOptions(this, IDC_OPTTREE),
+ m_oldFrameValue(proto->m_options.DisableFrame)
{
CreateLink(m_chkDirect, proto->m_options.BsDirect);
CreateLink(m_chkDirectManual, proto->m_options.BsDirectManual);
@@ -820,6 +823,9 @@ public:
void OnApply()
{
+ if (m_proto->m_options.DisableFrame != m_oldFrameValue)
+ m_proto->InitInfoFrame();
+
BOOL bChecked = m_proto->m_options.ShowTransport;
LISTFOREACH(index, m_proto, LIST_ROSTER)
{
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index b9d3223dda..c4165ee45e 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -199,7 +199,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
XStatusInit();
m_pepServices.InitGui();
- m_pInfoFrame = new CJabberInfoFrame(this);
+ InitInfoFrame();
GCREGISTER gcr = { sizeof(gcr) };
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 80070ab9db..755037f677 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -746,7 +746,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg = NULL);
void SendPresence(int m_iStatus, bool bSendToAll);
void StringAppend(char* *str, int *sizeAlloced, const char* fmt, ...);
+
void RebuildInfoFrame(void);
+ void InitInfoFrame(void);
// returns buf or NULL on error
TCHAR* GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen);
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 42d77dd05c..089ce677d6 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -690,21 +690,20 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe
m_mode = mood;
replaceStrT(m_text, szText);
- HANDLE hIcon = (mood >= 0) ? g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag) : Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT);
+ HANDLE hIcon;
TCHAR title[128];
-
- if (m_proto->m_pInfoFrame) {
- if (mood >= 0) {
- mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
- }
- else {
- mir_tstrcpy(title, LPGENT("Set mood..."));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
- }
+ if (mood >= 0) {
+ mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag);
+ }
+ else {
+ mir_tstrcpy(title, TranslateT("Set mood..."));
+ hIcon = Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT);
}
UpdateMenuItem(hIcon, title);
+ if (m_proto->m_pInfoFrame)
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", hIcon, title);
}
else SetExtraIcon(hContact, mood < 0 ? NULL : g_arrMoods[mood].szTag);