summaryrefslogtreecommitdiff
path: root/plugins/NewAwaySysMod
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-22 18:51:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-22 18:51:47 +0000
commit3d930b54d40bdb2250816a793e06f7f7cef08010 (patch)
tree49c375b7ee4ab3570e679a17ea37a687877ccb67 /plugins/NewAwaySysMod
parent32acb35e56646b68b4d06beab209fb67a625a913 (diff)
- toolbar button restored;
- fix for the main menu item's text updating; - unused bitmaps removed; git-svn-id: http://svn.miranda-ng.org/main/trunk@8222 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewAwaySysMod')
-rw-r--r--plugins/NewAwaySysMod/res/NewAwaySys.rc8
-rw-r--r--plugins/NewAwaySysMod/res/off.bmpbin1336 -> 0 bytes
-rw-r--r--plugins/NewAwaySysMod/res/on.bmpbin1016 -> 0 bytes
-rw-r--r--plugins/NewAwaySysMod/src/AwayOpt.cpp1
-rw-r--r--plugins/NewAwaySysMod/src/AwaySys.cpp68
-rw-r--r--plugins/NewAwaySysMod/src/Common.h6
-rw-r--r--plugins/NewAwaySysMod/src/Properties.h4
-rw-r--r--plugins/NewAwaySysMod/src/resource.h2
8 files changed, 40 insertions, 49 deletions
diff --git a/plugins/NewAwaySysMod/res/NewAwaySys.rc b/plugins/NewAwaySysMod/res/NewAwaySys.rc
index ab026a3ef9..4e79555c42 100644
--- a/plugins/NewAwaySysMod/res/NewAwaySys.rc
+++ b/plugins/NewAwaySysMod/res/NewAwaySys.rc
@@ -676,14 +676,6 @@ BEGIN
END
END
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_SOE_ENABLED BITMAP MOVEABLE PURE "res\\on.bmp"
-IDB_SOE_DISABLED BITMAP MOVEABLE PURE "res\\off.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/NewAwaySysMod/res/off.bmp b/plugins/NewAwaySysMod/res/off.bmp
deleted file mode 100644
index fcc9507634..0000000000
--- a/plugins/NewAwaySysMod/res/off.bmp
+++ /dev/null
Binary files differ
diff --git a/plugins/NewAwaySysMod/res/on.bmp b/plugins/NewAwaySysMod/res/on.bmp
deleted file mode 100644
index cf7343ef31..0000000000
--- a/plugins/NewAwaySysMod/res/on.bmp
+++ /dev/null
Binary files differ
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp
index 1b71f8312a..6a39066c0b 100644
--- a/plugins/NewAwaySysMod/src/AwayOpt.cpp
+++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp
@@ -585,7 +585,6 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case WM_NOTIFY:
if (((NMHDR*)lParam)->code == PSN_APPLY) {
g_AutoreplyOptPage.PageToMemToDB();
- //UpdateSOEButtons();
return true;
}
break;
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp
index 179d21e162..c4053d6c34 100644
--- a/plugins/NewAwaySysMod/src/AwaySys.cpp
+++ b/plugins/NewAwaySysMod/src/AwaySys.cpp
@@ -48,8 +48,10 @@
HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
-int hLangpack = 0;
-HANDLE g_hContactMenuItem = NULL, g_hReadStatMenuItem = NULL, /*g_hTopToolbarbutton = NULL, */g_hToggleSOEMenuItem = NULL, g_hToggleSOEContactMenuItem = NULL, g_hAutoreplyOnContactMenuItem = NULL, g_hAutoreplyOffContactMenuItem = NULL, g_hAutoreplyUseDefaultContactMenuItem = NULL;
+int hLangpack;
+HANDLE g_hContactMenuItem, g_hReadStatMenuItem, g_hTopToolbarbutton;
+HANDLE g_hToggleSOEMenuItem, g_hToggleSOEContactMenuItem;
+HANDLE g_hAutoreplyOnContactMenuItem, g_hAutoreplyOffContactMenuItem, g_hAutoreplyUseDefaultContactMenuItem;
bool g_fNoProcessing = false; // tells the status change proc not to do anything
int g_bIsIdle = false;
HANDLE hMainThread;
@@ -289,7 +291,7 @@ int StatusChanged(WPARAM wParam, LPARAM lParam)
// wParam = PROTOCOLSETTINGEX** protoSettings
int CSStatusChange(WPARAM wParam, LPARAM lParam) // CommonStatus plugins (StartupStatus and AdvancedAutoAway)
{
- PROTOCOLSETTINGEX** ps = *(PROTOCOLSETTINGEX***)wParam;
+ PROTOCOLSETTINGEX **ps = *(PROTOCOLSETTINGEX***)wParam;
if (!ps)
return -1;
@@ -324,11 +326,9 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam) // StartupStatus and AdvancedAu
int PreBuildContactMenu(WPARAM hContact, LPARAM lParam)
{
char *szProto = GetContactProto(hContact);
- CLISTMENUITEM miSetMsg = { 0 };
- miSetMsg.cbSize = sizeof(miSetMsg);
+ CLISTMENUITEM miSetMsg = { sizeof(miSetMsg) };
miSetMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIF_HIDDEN;
- CLISTMENUITEM miReadMsg = { 0 };
- miReadMsg.cbSize = sizeof(miReadMsg);
+ CLISTMENUITEM miReadMsg = { sizeof(miReadMsg) };
miReadMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIF_HIDDEN;
int iMode = szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : 0;
int Flag1 = szProto ? CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) : 0;
@@ -377,8 +377,7 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM lParam)
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hAutoreplyUseDefaultContactMenuItem, (LPARAM)&mi);
}
else { // hide the Autoreply menu item
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | CMIF_TCHAR | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hToggleSOEContactMenuItem, (LPARAM)&mi);
}
@@ -405,8 +404,19 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM lParam)
}
INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM lParam)
-{ // used only for the global setting
+{
+ // used only for the global setting
CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].Status, hContact).Autoreply.Toggle();
+
+ if (hContact == NULL) {
+ int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].Status).Autoreply;
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_NAME | CMIF_TCHAR;
+ mi.ptszName = SendOnEvent ? DISABLE_SOE_COMMAND : ENABLE_SOE_COMMAND;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hToggleSOEMenuItem, (LPARAM)&mi);
+ }
+
return 0;
}
@@ -428,26 +438,22 @@ INT_PTR srvAutoreplyUseDefault(WPARAM hContact, LPARAM lParam)
return 0;
}
-/* //NightFox: deleted used-to-be support
-int Create_TopToolbar(WPARAM wParam, LPARAM lParam)
-{
-int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
-if (ServiceExists(MS_TTB_ADDBUTTON))
+static int Create_TopToolbar(WPARAM wParam, LPARAM lParam)
{
-TTBButton ttbb = {0};
-ttbb.cbSize = sizeof(ttbb);
-ttbb.hbBitmapUp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_SOE_DISABLED));
-ttbb.hbBitmapDown = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_SOE_ENABLED));
-ttbb.pszServiceUp = MS_AWAYSYS_AUTOREPLY_TOGGLE;
-ttbb.pszServiceDown = MS_AWAYSYS_AUTOREPLY_TOGGLE;
-ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
-ttbb.name = Translate("Toggle autoreply on/off");
-g_hTopToolbarbutton = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttbb, 0);
-CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)g_hTopToolbarbutton, SendOnEvent ? TTBST_PUSHED : TTBST_RELEASED);
-}
-return 0;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
+ if (ServiceExists(MS_TTB_REMOVEBUTTON)) {
+ TTBButton ttbb = { sizeof(ttbb) };
+ ttbb.hIconUp = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_DISABLED));
+ ttbb.hIconDn = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_ENABLED));
+ ttbb.pszService = MS_AWAYSYS_AUTOREPLY_TOGGLE;
+ ttbb.dwFlags = TTBBF_SHOWTOOLTIP;
+ ttbb.name = "Toggle autoreply on/off";
+ g_hTopToolbarbutton = TopToolbar_AddButton(&ttbb);
+
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)g_hTopToolbarbutton, SendOnEvent ? TTBST_PUSHED : TTBST_RELEASED);
+ }
+ return 0;
}
-*/
static int IconsChanged(WPARAM wParam, LPARAM lParam)
{
@@ -713,7 +719,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam)
// and old AwaySysMod service, for compatibility reasons
CreateServiceFunction(MS_AWAYSYS_SETSTATUSMODE, SetStatusMode);
- // hHooks.insert(HookEvent(ME_TTB_MODULELOADED, Create_TopToolbar);
+ HookEvent(ME_TTB_MODULELOADED, Create_TopToolbar);
HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
HookEvent(ME_CLIST_STATUSMODECHANGE, StatusChanged);
HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange); // for compatibility with StartupStatus and AdvancedAutoAway
@@ -742,6 +748,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam)
mi.ptszName = LPGENT("Read status message"); // never seen...
mi.pszService = MS_AWAYMSG_SHOWAWAYMSG;
g_hReadStatMenuItem = Menu_AddContactMenuItem(&mi);
+
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USEMENUITEM)) {
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
@@ -791,8 +798,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam)
CreateServiceFunction(MS_AWAYSYS_FREEVARMEM, srvFreeVarMem);
CreateServiceFunction(MS_AWAYSYS_VARIABLESHANDLER, srvVariablesHandler);
- TOKENREGISTER tr = { 0 };
- tr.cbSize = sizeof(TOKENREGISTER);
+ TOKENREGISTER tr = { sizeof(tr) };
tr.szService = MS_AWAYSYS_VARIABLESHANDLER;
tr.szCleanupService = MS_AWAYSYS_FREEVARMEM;
tr.memType = TR_MEM_OWNER;
diff --git a/plugins/NewAwaySysMod/src/Common.h b/plugins/NewAwaySysMod/src/Common.h
index 446df14a68..daeee41e9d 100644
--- a/plugins/NewAwaySysMod/src/Common.h
+++ b/plugins/NewAwaySysMod/src/Common.h
@@ -62,9 +62,8 @@
#include "resource.h"
#include "m_variables.h"
-//#include "m_toptoolbar.h"
+#include "m_toptoolbar.h"
#include "m_popup.h"
-//#include "m_popupw.h"
#include "m_metacontacts.h"
#include "m_LogService.h"
@@ -317,10 +316,7 @@ int _Workaround_CallService(const char *name, WPARAM wParam, LPARAM lParam);
int MsgEventAdded(WPARAM wParam, LPARAM lParam);
// buttons
-//void UpdateSOEButtons(MCONTACT hContact = NULL);
INT_PTR ToggleSendOnEvent(WPARAM wParam, LPARAM lParam);
-//int Create_TopToolbar(WPARAM wParam, LPARAM lParam);
-
static __inline int LogMessage(const char *Format, ...)
{
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h
index b068189332..e02e5c1586 100644
--- a/plugins/NewAwaySysMod/src/Properties.h
+++ b/plugins/NewAwaySysMod/src/Properties.h
@@ -331,7 +331,7 @@ public:
{
CString Setting(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY);
if (db_get_b(NULL, MOD_NAME, Setting, VAL_USEDEFAULT) == Value)
- return *this; // prevent deadlocks when calling UpdateSOEButtons
+ return *this;
if (Value != VAL_USEDEFAULT)
db_set_b(NULL, MOD_NAME, Setting, Value != 0);
@@ -450,7 +450,7 @@ public:
CString Setting(Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
MCONTACT hContact = (Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL;
if (db_get_b(hContact, MOD_NAME, Setting, VAL_USEDEFAULT) == Value)
- return *this; // prevent deadlocks when calling UpdateSOEButtons
+ return *this;
if (Value != VAL_USEDEFAULT)
db_set_b(hContact, MOD_NAME, Setting, Value != 0);
diff --git a/plugins/NewAwaySysMod/src/resource.h b/plugins/NewAwaySysMod/src/resource.h
index 1c6190554b..5d3d715b5b 100644
--- a/plugins/NewAwaySysMod/src/resource.h
+++ b/plugins/NewAwaySysMod/src/resource.h
@@ -9,8 +9,6 @@
#define IDI_SOE_ENABLED 110
#define IDD_READAWAYMSG 111
#define IDI_SOE_DISABLED 111
-#define IDB_SOE_ENABLED 112
-#define IDB_SOE_DISABLED 114
#define IDD_NOTIFYOPTDLG 115
#define IDD_NOTIFYVARSDLG 116
#define IDD_AUTOREPLY 121