summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp99
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp16
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp28
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.h2
-rw-r--r--plugins/TabSRMM/src/msgs.h78
-rw-r--r--plugins/TabSRMM/src/version.h2
6 files changed, 100 insertions, 125 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 2a3f18fc2c..77fc5b539a 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -666,54 +666,6 @@ bool CMsgDialog::OnInitDialog()
return true;
}
-bool CMsgDialog::OnClose()
-{
- // usual close, not forced
- if (!m_bForcedClose) {
- // esc handles error controls if we are in error state (error controls visible)
- if (m_bErrorState) {
- DM_ErrorDetected(MSGERROR_CANCEL, 0);
- return false;
- }
-
- switch (PluginConfig.m_EscapeCloses) {
- case 1: // minimize container
- SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- return false;
-
- case 2: // close or hide, optionally
- if (PluginConfig.m_bHideOnClose) {
- ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
- return false;
- }
- break;
-
- case 3: // do nothing
- _dlgReturn(m_hwnd, FALSE);
- return false;
- }
- _dlgReturn(m_hwnd, TRUE);
- }
-
- if (m_iOpenJobs > 0 && !m_bForcedClose) {
- if (m_bErrorState)
- DM_ErrorDetected(MSGERROR_CANCEL, 1);
- else {
- if (m_bWarnClose)
- return false;
-
- m_bWarnClose = true;
- LRESULT result = SendQueue::WarnPendingJobs(0);
- m_bWarnClose = false;
- if (result == IDNO)
- return false;
- }
- }
-
- CloseTab();
- return true;
-}
-
void CMsgDialog::OnDestroy()
{
NotifyEvent(MSG_WINDOW_EVT_CLOSING);
@@ -833,7 +785,7 @@ void CMsgDialog::onClick_Ok(CCtrlButton *)
}
else final_sendformat = true;
- if (GetSendButtonState(m_hwnd) == PBS_DISABLED)
+ if (GetSendButtonState() == PBS_DISABLED)
return;
ptrA streamOut(m_message.GetRichTextRtf(!final_sendformat));
@@ -1629,7 +1581,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter)
}
if (pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE) {
- if (GetSendButtonState(m_hwnd) != PBS_DISABLED && !m_pContainer->m_flags.m_bHideToolbar)
+ if (GetSendButtonState() != PBS_DISABLED && !m_pContainer->m_flags.m_bHideToolbar)
SetFocus(GetDlgItem(m_hwnd, IDOK));
else
SetFocus(m_pLog->GetHwnd());
@@ -2002,7 +1954,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
m_message.SendMsg(WM_SETREDRAW, TRUE, 0);
RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
if (!fCompleted) {
- if ((GetSendButtonState(GetHwnd()) != PBS_DISABLED))
+ if ((GetSendButtonState() != PBS_DISABLED))
SetFocus(m_message.GetHwnd());
else
SetFocus(m_pLog->GetHwnd());
@@ -3145,6 +3097,51 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
return 0;
+ case WM_CLOSE:
+ // usual close, not forced
+ if (wParam == 0 && lParam == 0) {
+ // esc handles error controls if we are in error state (error controls visible)
+ if (m_bErrorState) {
+ DM_ErrorDetected(MSGERROR_CANCEL, 0);
+ return TRUE;
+ }
+
+ switch (PluginConfig.m_EscapeCloses) {
+ case 1: // minimize container
+ SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ return TRUE;
+
+ case 2: // close or hide, optionally
+ if (PluginConfig.m_bHideOnClose) {
+ ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
+ return TRUE;
+ }
+ break;
+
+ case 3: // do nothing
+ _dlgReturn(m_hwnd, FALSE);
+ return TRUE;
+ }
+ _dlgReturn(m_hwnd, TRUE);
+ }
+
+ if (m_iOpenJobs > 0 && lParam != 2) {
+ if (m_bErrorState)
+ DM_ErrorDetected(MSGERROR_CANCEL, 1);
+ else {
+ if (m_bWarnClose)
+ return TRUE;
+
+ m_bWarnClose = true;
+ LRESULT result = SendQueue::WarnPendingJobs(0);
+ m_bWarnClose = false;
+ if (result == IDNO)
+ return TRUE;
+ }
+ }
+ CloseTab();
+ return 0;
+
case WM_DWMCOMPOSITIONCHANGED:
BB_RefreshTheme();
m_pContainer->ClearMargins();
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index 3051d7c59c..757a77e74f 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -693,8 +693,8 @@ void CMsgDialog::GetMyNick()
}
/////////////////////////////////////////////////////////////////////////////////////////
-// retrieve both buddys and my own UIN for a message session and store them in the message window *dat
-// respects metacontacts and uses the current protocol if the contact is a MC
+// retrieve both buddys and my own UIN for a message session and store them in the message
+// window *dat respects metacontacts and uses the current protocol if the contact is a MC
void CMsgDialog::GetMYUIN()
{
@@ -706,6 +706,14 @@ void CMsgDialog::GetMYUIN()
}
/////////////////////////////////////////////////////////////////////////////////////////
+// returns the status of Send button
+
+LRESULT CMsgDialog::GetSendButtonState()
+{
+ return m_btnOk.SendMsg(BUTTONGETSTATEID, TRUE, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// reads send format and configures the toolbar buttons
// if mode == 0, int only configures the buttons and does not change send format
@@ -1963,9 +1971,9 @@ void CMsgDialog::UpdateSaveAndSendButton()
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
int len = SendDlgItemMessage(m_hwnd, IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
- if (len && GetSendButtonState(m_hwnd) == PBS_DISABLED)
+ if (len && GetSendButtonState() == PBS_DISABLED)
EnableSendButton(true);
- else if (len == 0 && GetSendButtonState(m_hwnd) != PBS_DISABLED)
+ else if (len == 0 && GetSendButtonState() != PBS_DISABLED)
EnableSendButton(false);
if (len) { // looks complex but avoids flickering on the button while typing.
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 5b8cc97467..80be1a7e5f 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -257,24 +257,6 @@ void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// checks, if there is a valid smileypack installed for the given protocol
-
-int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact)
-{
- if (!PluginConfig.g_SmileyAddAvail)
- return 0;
-
- SMADD_INFO2 smainfo = { 0 };
- smainfo.cbSize = sizeof(smainfo);
- smainfo.Protocolname = const_cast<char *>(szProto);
-
- CallService(MS_SMILEYADD_GETINFO2, 0, (LPARAM)&smainfo);
- if (smainfo.ButtonIcon)
- DestroyIcon(smainfo.ButtonIcon);
- return smainfo.NumberOfVisibleSmileys;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// return value MUST be mir_free()'d by caller.
wchar_t* TSAPI QuoteText(const wchar_t *text)
@@ -346,13 +328,3 @@ bool IsStringValidLink(wchar_t *pszText)
return wcsstr(pszText, L"://") != nullptr;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-LRESULT TSAPI GetSendButtonState(HWND hwnd)
-{
- HWND hwndIDok = GetDlgItem(hwnd, IDOK);
- if (hwndIDok)
- return SendMessage(hwndIDok, BUTTONGETSTATEID, TRUE, 0);
- return 0;
-}
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h
index ea40839012..76e5f41879 100644
--- a/plugins/TabSRMM/src/msgdlgutils.h
+++ b/plugins/TabSRMM/src/msgdlgutils.h
@@ -33,10 +33,8 @@
void TSAPI AddUnreadContact(MCONTACT hContact);
void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam);
BOOL TSAPI CheckCustomLink(HWND hwndRich, POINT *ptClient, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bUrlNeeded);
-int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact);
wchar_t* TSAPI QuoteText(const wchar_t *text);
void TSAPI CutContactName(const wchar_t *szold, wchar_t *sznew, size_t size);
-LRESULT TSAPI GetSendButtonState(HWND hwnd);
void TSAPI RearrangeTab(HWND hwndDlg, const CMsgDialog *dat, int iMode, BOOL bSavePos);
bool TSAPI IsStatusEvent(int eventType);
bool TSAPI IsCustomEvent(int eventType);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 6deb8bf7d9..b1027bb849 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -384,6 +384,7 @@ class CMsgDialog : public CSrmmBaseDialog
int FindRTLLocale(void);
void FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei);
void FlashTab(bool bInvertMode);
+ LRESULT GetSendButtonState();
void GetSendFormat(void);
HICON GetXStatusIcon() const;
void HandlePasteAndSend(void);
@@ -545,7 +546,6 @@ public:
int OnFilter(MSGFILTER *);
bool OnInitDialog() override;
- bool OnClose() override;
void OnDestroy() override;
int Resizer(UTILRESIZECONTROL *urc) override;
@@ -586,44 +586,44 @@ public:
return m_pContainer->IsActive() && m_pContainer->m_hwndActive == m_hwnd;
}
- void DM_OptionsApplied(bool bRemakeLog = true);
- void DM_RecalcPictureSize(void);
- void DM_ScrollToBottom(WPARAM wParam, LPARAM lParam);
-
- void ActivateTooltip(int iCtrlId, const wchar_t *pwszMessage);
- void CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int code);
- void DrawStatusIcons(HDC hDC, const RECT &rc, int gap);
- void EnableSendButton(bool bMode) const;
- void EnableSending(bool bMode) const;
- void FormatRaw(CMStringW&, int flags, bool isSent);
- bool FormatTitleBar(const wchar_t *szFormat, CMStringW &dest);
- bool GetAvatarVisibility(void);
- void GetClientIcon(void);
- HICON GetMyContactIcon(LPCSTR szSetting);
- void GetMyNick(void);
- HICON IconFromAvatar(void) const;
- void KbdState(bool &isShift, bool &isControl, bool &isAlt);
- void LimitMessageText(int iLen);
- int LoadLocalFlags(void);
- bool MustPlaySound(void) const;
- void NotifyDeliveryFailure(void) const;
- void RemakeLog(void);
- void SaveSplitter(void);
- void SelectContainer(void);
- void SetDialogToType(void);
- void ShowPicture(bool showNewPic);
- void SplitterMoved(int x, HWND hwnd);
- void SwitchToContainer(const wchar_t *szNewName);
- int Typing(int secs);
- void UpdateReadChars(void) const;
- void UpdateSaveAndSendButton(void);
-
- int MsgWindowDrawHandler(DRAWITEMSTRUCT *dis);
- int MsgWindowMenuHandler(int selection, int menuId);
- int MsgWindowUpdateMenu(HMENU submenu, int menuID);
-
- void RenderToolbarBG(HDC hdc, const RECT &rcWindow) const;
- void UpdateToolbarBG(void);
+ void DM_OptionsApplied(bool bRemakeLog = true);
+ void DM_RecalcPictureSize(void);
+ void DM_ScrollToBottom(WPARAM wParam, LPARAM lParam);
+
+ void ActivateTooltip(int iCtrlId, const wchar_t *pwszMessage);
+ void CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int code);
+ void DrawStatusIcons(HDC hDC, const RECT &rc, int gap);
+ void EnableSendButton(bool bMode) const;
+ void EnableSending(bool bMode) const;
+ void FormatRaw(CMStringW&, int flags, bool isSent);
+ bool FormatTitleBar(const wchar_t *szFormat, CMStringW &dest);
+ bool GetAvatarVisibility(void);
+ void GetClientIcon(void);
+ HICON GetMyContactIcon(LPCSTR szSetting);
+ void GetMyNick(void);
+ HICON IconFromAvatar(void) const;
+ void KbdState(bool &isShift, bool &isControl, bool &isAlt);
+ void LimitMessageText(int iLen);
+ int LoadLocalFlags(void);
+ bool MustPlaySound(void) const;
+ void NotifyDeliveryFailure(void) const;
+ void RemakeLog(void);
+ void SaveSplitter(void);
+ void SelectContainer(void);
+ void SetDialogToType(void);
+ void ShowPicture(bool showNewPic);
+ void SplitterMoved(int x, HWND hwnd);
+ void SwitchToContainer(const wchar_t *szNewName);
+ int Typing(int secs);
+ void UpdateReadChars(void) const;
+ void UpdateSaveAndSendButton(void);
+
+ int MsgWindowDrawHandler(DRAWITEMSTRUCT *dis);
+ int MsgWindowMenuHandler(int selection, int menuId);
+ int MsgWindowUpdateMenu(HMENU submenu, int menuID);
+
+ void RenderToolbarBG(HDC hdc, const RECT &rcWindow) const;
+ void UpdateToolbarBG(void);
};
extern LIST<void> g_arUnreadWindows;
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h
index dd583941e3..17b97c7709 100644
--- a/plugins/TabSRMM/src/version.h
+++ b/plugins/TabSRMM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 3
#define __MINOR_VERSION 6
#define __RELEASE_NUM 1
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#include <stdver.h>