summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-28 18:44:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-28 18:44:24 +0300
commit2cf63b38b3ddc616a18847a29ab36790138a168a (patch)
treecd108e21f71cb5f6626b1b788e70a419852a5d3d
parent1ab93d3afabe3a5872040b5acafc9f113c196a2b (diff)
more unneeded code removed
-rw-r--r--include/m_message.h38
-rw-r--r--plugins/Scriver/src/chat.h1
-rw-r--r--plugins/Scriver/src/chat_manager.cpp17
-rw-r--r--plugins/Scriver/src/msgs.cpp10
-rw-r--r--plugins/Scriver/src/statusicon.cpp2
-rw-r--r--plugins/Scriver/src/stdafx.h1
-rw-r--r--plugins/TabSRMM/src/msgs.cpp69
7 files changed, 43 insertions, 95 deletions
diff --git a/include/m_message.h b/include/m_message.h
index b00e1c0abe..23f4482b5c 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int hLangpack;
+/////////////////////////////////////////////////////////////////////////////////////////
// brings up the send message dialog for a contact
// wParam = (MCONTACT)hContact
// lParam = (LPARAM)(char*)szText
@@ -37,18 +38,19 @@ extern int hLangpack;
// szText is the text to put in the edit box of the window (but not send)
// szText = NULL will not use any text
// szText != NULL is only supported on v0.1.2.0+
+
#define MS_MSG_SENDMESSAGE "SRMsg/SendCommand"
#define MS_MSG_SENDMESSAGEW "SRMsg/SendCommandW"
-#define ME_MSG_WINDOWEVENT "MessageAPI/WindowEvent"
+/////////////////////////////////////////////////////////////////////////////////////////
+// gets fired when a message window appears/disappears
// wparam = 0
// lparam = (WPARAM)(MessageWindowEventData*)hWindowEvent;
-// Event types
-#define MSG_WINDOW_EVT_OPENING 1 //window is about to be opened
-#define MSG_WINDOW_EVT_OPEN 2 //window has been opened
-#define MSG_WINDOW_EVT_CLOSING 3 //window is about to be closed
-#define MSG_WINDOW_EVT_CLOSE 4 //window has been closed
+#define MSG_WINDOW_EVT_OPENING 1 // window is about to be opened
+#define MSG_WINDOW_EVT_OPEN 2 // window has been opened
+#define MSG_WINDOW_EVT_CLOSING 3 // window is about to be closed
+#define MSG_WINDOW_EVT_CLOSE 4 // window has been closed
#define MSG_WINDOW_UFLAG_MSG_FROM 0x00000001
#define MSG_WINDOW_UFLAG_MSG_TO 0x00000002
@@ -56,25 +58,27 @@ extern int hLangpack;
struct MessageWindowEventData
{
- MCONTACT hContact;
+ MCONTACT hContact;
HWND hwndWindow; // top level window for the contact
- unsigned int uType; // see event types above
- unsigned int uFlags; // used to indicate message direction for all event types except custom
- void *local; // used to store pointer to custom data
- HWND hwndInput; // input area window for the contact (or NULL if there is none)
- HWND hwndLog; // log area window for the contact (or NULL if there is none)
+ uint32_t uType; // see event types above
+ uint32_t uFlags; // used to indicate message direction for all event types except custom
+ HWND hwndInput; // input area window for the contact (or NULL if there is none)
+ HWND hwndLog; // log area window for the contact (or NULL if there is none)
};
-struct StatusTextData
-{
- HICON hIcon;
- wchar_t tszText[100];
-};
+#define ME_MSG_WINDOWEVENT "MessageAPI/WindowEvent"
/////////////////////////////////////////////////////////////////////////////////////////
// wparam = (MCONTACT)hContact
// lparam = (StatusTextData*) or NULL to clear statusbar
// Sets a statusbar line text for the appropriate contact
+
+struct StatusTextData
+{
+ HICON hIcon;
+ wchar_t tszText[100];
+};
+
#define MS_MSG_SETSTATUSTEXT "MessageAPI/SetStatusText"
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Scriver/src/chat.h b/plugins/Scriver/src/chat.h
index 8d40bbd6f2..f4bee7dcfb 100644
--- a/plugins/Scriver/src/chat.h
+++ b/plugins/Scriver/src/chat.h
@@ -74,7 +74,6 @@ void FreeMsgLogBitmaps(void);
void ShowRoom(SESSION_INFO *si);
// manager.c
-HWND SM_FindWindowByContact(MCONTACT hContact);
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const wchar_t* pszOriginal, const wchar_t* pszCurrent);
char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui);
diff --git a/plugins/Scriver/src/chat_manager.cpp b/plugins/Scriver/src/chat_manager.cpp
index f86764560a..c763f15e6a 100644
--- a/plugins/Scriver/src/chat_manager.cpp
+++ b/plugins/Scriver/src/chat_manager.cpp
@@ -21,23 +21,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-HWND SM_FindWindowByContact(MCONTACT hContact)
-{
- for (int i = 0; i < pci->arSessions.getCount(); i++) {
- SESSION_INFO *si = pci->arSessions[i];
- if (si->hContact == hContact)
- return (si->pDlg) ? si->pDlg->GetHwnd() : nullptr;
- }
- return nullptr;
-}
-
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO *currSession, SESSION_INFO *prevSession, const wchar_t *pszOriginal, const wchar_t *pszCurrent)
{
- SESSION_INFO* pResult = nullptr;
+ SESSION_INFO *pResult = nullptr;
if (prevSession == nullptr && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName)
pResult = currSession;
else {
- wchar_t* pszName = nullptr;
+ wchar_t *pszName = nullptr;
if (currSession == prevSession)
pszCurrent = pszOriginal;
@@ -58,11 +48,10 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO *cu
char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui)
{
- STATUSINFO * ti;
if (!ui || !si)
return '\0';
- ti = pci->TM_FindStatus(si->pStatuses, pci->TM_WordToString(si->pStatuses, ui->Status));
+ STATUSINFO *ti = pci->TM_FindStatus(si->pStatuses, pci->TM_WordToString(si->pStatuses, ui->Status));
if (ti) {
if ((INT_PTR)ti->hIcon < STATUSICONCOUNT) {
INT_PTR id = si->iStatusCount - (INT_PTR)ti->hIcon - 1;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 2be9a2c810..1b3ac3df92 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -290,11 +290,8 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
return 1;
HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
- if (hwnd == nullptr) {
- hwnd = SM_FindWindowByContact(hContact);
- if (hwnd == nullptr)
- return 1;
- }
+ if (hwnd == nullptr)
+ return 1;
CScriverWindow *dat = (CScriverWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat == nullptr || dat->m_pParent == nullptr)
@@ -438,9 +435,6 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam)
return 0;
HWND hwnd = WindowList_Find(pci->hWindowList, wParam);
- if (hwnd == nullptr)
- hwnd = SM_FindWindowByContact(wParam);
-
if (hwnd != nullptr)
SendMessage(hwnd, DM_SWITCHTYPING, 0, 0);
return 0;
diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp
index 401ef8335f..f59c9f8ede 100644
--- a/plugins/Scriver/src/statusicon.cpp
+++ b/plugins/Scriver/src/statusicon.cpp
@@ -65,8 +65,6 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM)
WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
else {
HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
- if (hwnd == nullptr)
- hwnd = SM_FindWindowByContact(hContact);
if (hwnd != nullptr)
PostMessage(GetParent(hwnd), DM_STATUSICONCHANGE, 0, 0);
}
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h
index 09d0124a84..7100a13efb 100644
--- a/plugins/Scriver/src/stdafx.h
+++ b/plugins/Scriver/src/stdafx.h
@@ -87,7 +87,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CFM_WEIGHT 0x00400000
#endif
-extern HWND SM_FindWindowByContact(MCONTACT hContact);
extern HINSTANCE g_hInst;
extern HCURSOR hDragCursor;
extern ITaskbarList3 *pTaskbarInterface;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index d6ccb076ab..5d3799b8a3 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -280,37 +280,28 @@ void CTabBaseDlg::NotifyDeliveryFailure() const
/////////////////////////////////////////////////////////////////////////////////////////
// service function. Sets a status bar text for a contact
-static void SetStatusTextWorker(CTabBaseDlg *dat, StatusTextData *st)
+static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
{
- if (!dat)
- return;
+ HWND hwnd = M.FindWindow(hContact);
+ if (hwnd == nullptr)
+ hwnd = M.FindWindow(db_mc_getMeta(hContact));
+ if (hwnd == nullptr)
+ return 0;
- // delete old custom data
- if (dat->m_sbCustom) {
- delete dat->m_sbCustom;
- dat->m_sbCustom = nullptr;
- }
+ CTabBaseDlg *pDlg = (CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (pDlg != nullptr) {
+ // delete old custom data
+ if (pDlg->m_sbCustom) {
+ delete pDlg->m_sbCustom;
+ pDlg->m_sbCustom = nullptr;
+ }
- if (st != nullptr)
- dat->m_sbCustom = new StatusTextData(*st);
+ StatusTextData *st = (StatusTextData*)lParam;
+ if (st != nullptr)
+ pDlg->m_sbCustom = new StatusTextData(*st);
- dat->tabUpdateStatusBar();
-}
-
-static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
-{
- SESSION_INFO *si = SM_FindSessionByHCONTACT(hContact);
- if (si == nullptr) {
- HWND hwnd = M.FindWindow(hContact);
- if (hwnd != nullptr)
- SetStatusTextWorker((CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
-
- if (hContact = db_mc_getMeta(hContact))
- if (hwnd = M.FindWindow(hContact))
- SetStatusTextWorker((CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam);
+ pDlg->tabUpdateStatusBar();
}
- else SetStatusTextWorker(si->pDlg, (StatusTextData*)lParam);
-
return 0;
}
@@ -338,28 +329,6 @@ static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// return the version of the window api supported
-
-static INT_PTR BroadcastMessage(WPARAM, LPARAM lParam)
-{
- M.BroadcastMessage((UINT)lParam, 0, 0);
- return 0;
-}
-
-static INT_PTR ReloadSkin(WPARAM, LPARAM)
-{
- Skin->setFileName();
- Skin->Load();
- return 0;
-}
-
-static INT_PTR ReloadSettings(WPARAM, LPARAM lParam)
-{
- PluginConfig.reloadSettings(lParam != 0);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// service function finds a message session
// wParam = contact handle for which we want the window handle
// thanks to bio for the suggestion of this service
@@ -1046,10 +1015,6 @@ static void TSAPI InitAPI()
CreateServiceFunction(MS_TABMSG_TRAYSUPPORT, Service_OpenTrayMenu);
CreateServiceFunction(MS_TABMSG_SLQMGR, CSendLater::svcQMgr);
- CreateServiceFunction("SRMsg/BroadcastMessage", BroadcastMessage);
- CreateServiceFunction("TabSRMsg/ReloadSkin", ReloadSkin);
- CreateServiceFunction("TabSRMsg/ReloadSettings", ReloadSettings);
-
SI_InitStatusIcons();
CB_InitCustomButtons();