summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/msgs.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-09-01 15:18:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-09-01 15:18:56 +0000
commitc16bd3d58396036f078282ad0b7032562c0c0533 (patch)
tree28a330ad3bd8ba85a20cd2b9a18d5186a0861e66 /plugins/TabSRMM/src/msgs.cpp
parent1b9f36054bddeef87d4f9c139877d28c4e6b1702 (diff)
- adaptation for the kernel strdel();
- buffer overrun removed (rare crashes); - old useless code removed; - removal of a blank line after comments was a bad idea git-svn-id: http://svn.miranda-ng.org/main/trunk@15136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/msgs.cpp')
-rw-r--r--plugins/TabSRMM/src/msgs.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 48954f3a24..4f22af20e5 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -41,6 +41,7 @@ void Chat_AddIcons(void);
/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes IEView plugin options. Apply them to all open tabs
+
int IEViewOptionsChanged(WPARAM, LPARAM)
{
M.BroadcastMessage(DM_IEVIEWOPTIONSCHANGED, 0, 0);
@@ -49,6 +50,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes smileyadd options. Notify all open tabs about the changes
+
int SmileyAddOptionsChanged(WPARAM, LPARAM)
{
M.BroadcastMessage(DM_SMILEYOPTIONSCHANGED, 0, 0);
@@ -58,6 +60,7 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// Message API 0.0.0.3 services
+
static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
{
char *szBuf = (char*)wParam;
@@ -70,6 +73,7 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
// wparam = (MessageWindowInputData*)
// lparam = (MessageWindowData*)
// returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
+
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
@@ -112,6 +116,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// service function. Sets a status bar text for a contact
+
static void SetStatusTextWorker(TWindowData *dat, StatusTextData *st)
{
if (!dat)
@@ -148,6 +153,7 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// service function. Invoke the user preferences dialog for the contact given (by handle) in wParam
+
static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
{
HWND hWnd = WindowList_Find(PluginConfig.hUserPrefsWindowList, wParam);
@@ -161,6 +167,7 @@ static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// service function - open the tray menu from the TTB button
+
static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
{
SendMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, lParam == 0 ? WM_LBUTTONUP : WM_RBUTTONUP);
@@ -172,6 +179,7 @@ static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
// wParam == hContact of the window to find
// lParam == window handle (set it to 0 if you want search for hcontact, otherwise it
// is directly used as the handle for the target window
+
static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam)
{
HWND hwndTarget = (HWND)lParam;
@@ -187,6 +195,7 @@ static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// return the version of the window api supported
+
static INT_PTR GetWindowAPI(WPARAM, LPARAM)
{
return PLUGIN_MAKE_VERSION(0, 0, 0, 2);
@@ -203,6 +212,7 @@ static INT_PTR GetWindowAPI(WPARAM, LPARAM)
// or (if lParam was specified) the hwnd if the window exists.
// 0 if there is none (or the popup mode of the target container was configured to "hide"
// the window..
+
INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
{
HWND hwnd = 0;
@@ -242,6 +252,7 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
// ReadMessageCommand is executed whenever the user wants to manually open a window.
// This can happen when double clicking a contact on the clist OR when opening a new
// message (clicking on a popup, clicking the flashing tray icon and so on).
+
static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
{
MCONTACT hContact = ((CLISTEVENT *)lParam)->hContact;
@@ -266,6 +277,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
// e.g. it is called when user double clicks a contact on the contact list
// it is implemented as a service, so external plugins can use it to open a message window.
// contacts handle must be passed in wParam.
+
INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar)
{
// make sure that only the main UI thread will handle window creation
@@ -323,6 +335,7 @@ INT_PTR SendMessageCommand_W(WPARAM hContact, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// open a window when user clicks on the flashing "typing message" tray icon.
// just calls SendMessageCommand() for the given contact.
+
static INT_PTR TypingMessageCommand(WPARAM, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT*)lParam;
@@ -382,6 +395,7 @@ int MyAvatarChanged(WPARAM wParam, LPARAM lParam)
//
// this function searches and activates the tab belonging to the given hwnd (which is the
// hwnd of a message dialog window)
+
int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
{
TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndChild, GWLP_USERDATA); // needed to obtain the hContact for the message window
@@ -430,6 +444,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
// this function creates and activates a new tab within the given container.
// bActivateTab: make the new tab the active one
// bPopupContainer: restore container if it was minimized, otherwise flash it...
+
HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, int isSend, const char *pszInitialText, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup, MEVENT hdbEvent)
{
if (M.FindWindow(hContact) != 0) {
@@ -462,7 +477,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
else
_tcsncpy_s(newcontactname, contactName, _TRUNCATE);
- Utils::DoubleAmpersands(newcontactname);
+ Utils::DoubleAmpersands(newcontactname, _countof(newcontactname));
}
else _tcsncpy_s(newcontactname, _T("_U_"), _TRUNCATE);
@@ -582,6 +597,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
// this is used by the 2nd containermode (limit tabs on default containers).
// it searches a container with "room" for the new tabs or otherwise creates
// a new (cloned) one.
+
TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName)
{
int iMaxTabs = M.GetDword("maxtabs", 0);
@@ -598,6 +614,7 @@ TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName)
/////////////////////////////////////////////////////////////////////////////////////////
// load some global icons.
+
void TSAPI CreateImageList(BOOL bInitial)
{
// the imagelist is now a fake. It is still needed to provide the tab control with a
@@ -758,6 +775,7 @@ static int GetIconPackVersion(HMODULE hDLL)
/////////////////////////////////////////////////////////////////////////////////////////
// setup default icons for the IcoLib service. This needs to be done every time the
// plugin is loaded default icons are taken from the icon pack in either \icons or \plugins
+
static int TSAPI SetupIconLibConfig()
{
int j = 2, version = 0;
@@ -846,6 +864,7 @@ static int TSAPI LoadFromIconLib()
/////////////////////////////////////////////////////////////////////////////////////////
// load icon theme from either icon pack or IcoLib
+
void TSAPI LoadIconTheme()
{
if (SetupIconLibConfig() == 0)
@@ -893,6 +912,7 @@ int IconsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// initialises the internal API, services, events etc...
+
static void TSAPI InitAPI()
{
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);