summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-05-18 18:06:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-05-18 18:06:34 +0300
commit3e5db6cadd0d09294ce7f0123647edccd0d6859f (patch)
tree69d01791ca566ffcb5a69691a8861f350782dc23
parent95fcc842ba6df1606e75d2aef29502181d2f5ab7 (diff)
CPepGuiService::LaunchSetGui / ShowSetDialog: useless parameter removed
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp36
-rw-r--r--protocols/JabberG/src/jabber_xstatus.h62
2 files changed, 52 insertions, 46 deletions
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 028acab9b2..466ee76dcc 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -428,12 +428,12 @@ void CPepGuiService::RebuildMenu()
m_hMenuItem = Menu_AddProtoMenuItem(&mi, m_proto->m_szModuleName);
}
-bool CPepGuiService::LaunchSetGui(BYTE bQuiet)
+bool CPepGuiService::LaunchSetGui()
{
if (m_bGuiOpen) return false;
m_bGuiOpen = true;
- ShowSetDialog(bQuiet);
+ ShowSetDialog();
m_bGuiOpen = false;
return true;
@@ -450,7 +450,7 @@ void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text)
int CPepGuiService::OnMenuItemClick(WPARAM, LPARAM)
{
- LaunchSetGui(0);
+ LaunchSetGui();
return 0;
}
@@ -669,20 +669,24 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t *
NotifyEventHooks(m_proto->m_hEventXStatusChanged, hContact, 0);
}
-void CPepMood::ShowSetDialog(BYTE bQuiet)
+void CPepMood::ShowSetDialog()
{
- if (!bQuiet) {
- CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood"));
- for (int i = 1; i < _countof(g_arrMoods); i++)
- dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateW(g_arrMoods[i].szName));
+ CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood"));
+ for (int i = 1; i < _countof(g_arrMoods); i++)
+ dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateW(g_arrMoods[i].szName));
- dlg.SetActiveStatus(m_mode, m_text);
- if (!dlg.DoModal())
- return;
+ dlg.SetActiveStatus(m_mode, m_text);
+ if (!dlg.DoModal())
+ return;
- m_mode = dlg.GetStatusMode();
+ m_mode = dlg.GetStatusMode();
+ replaceStrW(m_text, dlg.GetStatusText());
+
+ if (m_mode >= 0) {
replaceStrW(m_text, dlg.GetStatusText());
+ Publish();
}
+ else Retract();
UpdateMenuView();
}
@@ -1027,7 +1031,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, const char *szFirst, const cha
else m_proto->ResetAdvStatus(hContact, ADVSTATUS_ACTIVITY);
}
-void CPepActivity::ShowSetDialog(BYTE)
+void CPepActivity::ShowSetDialog()
{
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Activity"));
for (int i = 0; i < _countof(g_arrActivities); i++)
@@ -1241,12 +1245,12 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
void CJabberProto::InfoFrame_OnUserMood(CJabberInfoFrame_Event*)
{
- ((CPepGuiService *)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->LaunchSetGui(0);
+ ((CPepGuiService *)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->LaunchSetGui();
}
void CJabberProto::InfoFrame_OnUserActivity(CJabberInfoFrame_Event*)
{
- ((CPepGuiService *)m_pepServices.Find(JABBER_FEAT_USER_ACTIVITY))->LaunchSetGui(0);
+ ((CPepGuiService *)m_pepServices.Find(JABBER_FEAT_USER_ACTIVITY))->LaunchSetGui();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1357,7 +1361,7 @@ INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM, LPARAM lParam)
if (status >= 0 && status < _countof(g_arrMoods)) {
pepMood->m_mode = status;
pepMood->m_text = (pData->flags & CSSF_MASK_MESSAGE) ? JabberStrFixLines(pData->ptszMessage) : nullptr;
- pepMood->LaunchSetGui(1);
+ pepMood->UpdateMenuView();
return 0;
}
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h
index af27c75cfe..25f72f40e9 100644
--- a/protocols/JabberG/src/jabber_xstatus.h
+++ b/protocols/JabberG/src/jabber_xstatus.h
@@ -122,70 +122,72 @@ public:
class CPepGuiService: public CPepService
{
typedef CPepService CSuper;
+ friend struct CJabberProto;
+
+ HANDLE m_hMenuService;
+ HANDLE m_hIcolibItem;
+ wchar_t *m_szText;
+
+ bool m_bGuiOpen;
+ int __cdecl OnMenuItemClick(WPARAM, LPARAM);
+
public:
CPepGuiService(CJabberProto *proto, char *name, char *node);
~CPepGuiService();
void InitGui();
void RebuildMenu();
- bool LaunchSetGui(BYTE bQuiet);
+ bool LaunchSetGui();
protected:
void UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text);
- virtual void ShowSetDialog(BYTE bQuiet) = 0;
-
-private:
- HANDLE m_hMenuService;
- HANDLE m_hIcolibItem;
- wchar_t *m_szText;
-
- bool m_bGuiOpen;
-
- int __cdecl OnMenuItemClick(WPARAM, LPARAM);
+ virtual void ShowSetDialog() = 0;
};
class CPepMood: public CPepGuiService
{
typedef CPepGuiService CSuper;
-public:
- CPepMood(CJabberProto *proto);
- ~CPepMood();
- void ProcessItems(const char *from, const TiXmlElement *items);
- void ResetExtraIcon(MCONTACT hContact);
+ friend struct CJabberProto;
-public:
wchar_t *m_text;
int m_mode;
-protected:
- void ShowSetDialog(BYTE bQuiet) override;
- void UpdateMenuView(void) override;
-
void SetExtraIcon(MCONTACT hContact, char *szMood);
void CreateData(TiXmlElement*);
void SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t *szText);
+
+public:
+ CPepMood(CJabberProto *proto);
+ ~CPepMood();
+
+ void ShowSetDialog() override;
+ void UpdateMenuView(void) override;
+
+ void ProcessItems(const char *from, const TiXmlElement *items);
+ void ResetExtraIcon(MCONTACT hContact);
};
class CPepActivity: public CPepGuiService
{
typedef CPepGuiService CSuper;
-public:
- CPepActivity(CJabberProto *proto);
- ~CPepActivity();
- void ProcessItems(const char *from, const TiXmlElement *items);
- void ResetExtraIcon(MCONTACT hContact);
-protected:
wchar_t *m_text;
int m_mode;
- void ShowSetDialog(BYTE bQuiet) override;
- void UpdateMenuView(void) override;
-
void CreateData(TiXmlElement*);
void SetExtraIcon(MCONTACT hContact, char *szActivity);
void SetActivity(MCONTACT hContact, const char *szFirst, const char *szSecond, const wchar_t *szText);
+
+public:
+ CPepActivity(CJabberProto *proto);
+ ~CPepActivity();
+
+ void ShowSetDialog() override;
+ void UpdateMenuView(void) override;
+
+ void ProcessItems(const char *from, const TiXmlElement *items);
+ void ResetExtraIcon(MCONTACT hContact);
};
#endif // _JABBER_XSTATUS_H_