summaryrefslogtreecommitdiff
path: root/plugins/SimpleAR/src/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SimpleAR/src/Main.cpp')
-rw-r--r--plugins/SimpleAR/src/Main.cpp50
1 files changed, 27 insertions, 23 deletions
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index 98e99e3200..af14ff2daf 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -49,6 +49,10 @@ PLUGININFOEX pluginInfoEx =
{ 0x46bf191f, 0x8dfb, 0x4656, { 0x88, 0xb2, 0x4c, 0x20, 0xbe, 0x4c, 0xfa, 0x44 } }
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
@@ -58,8 +62,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
INT_PTR ToggleEnable(WPARAM, LPARAM)
{
- BOOL fEnabled = !db_get_b(NULL, protocolname, KEY_ENABLED, 1);
- db_set_b(NULL, protocolname, KEY_ENABLED, fEnabled);
+ BOOL fEnabled = !db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
+ db_set_b(NULL, MODULENAME, KEY_ENABLED, fEnabled);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
@@ -70,8 +74,8 @@ INT_PTR ToggleEnable(WPARAM, LPARAM)
INT_PTR Toggle(WPARAM hContact, LPARAM)
{
- BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
- db_set_b(hContact, protocolname, "TurnedOn", on);
+ BOOL on = !db_get_b(hContact, MODULENAME, "TurnedOn", 0);
+ db_set_b(hContact, MODULENAME, "TurnedOn", on);
on = !on;
if (on)
@@ -83,7 +87,7 @@ INT_PTR Toggle(WPARAM hContact, LPARAM)
INT OnPreBuildContactMenu(WPARAM hContact, LPARAM)
{
- BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
+ BOOL on = !db_get_b(hContact, MODULENAME, "TurnedOn", 0);
if (on)
Menu_ModifyItem(hToggle, LPGENW("Turn off Autoanswer"), iconList[0].hIcolib);
else
@@ -93,12 +97,12 @@ INT OnPreBuildContactMenu(WPARAM hContact, LPARAM)
INT CheckDefaults(WPARAM, LPARAM)
{
- interval = db_get_w(NULL, protocolname, KEY_REPEATINTERVAL, 300);
+ interval = db_get_w(NULL, MODULENAME, KEY_REPEATINTERVAL, 300);
- wchar_t *ptszVal = db_get_wsa(NULL, protocolname, KEY_HEADING);
+ wchar_t *ptszVal = db_get_wsa(NULL, MODULENAME, KEY_HEADING);
if (ptszVal == nullptr)
// Heading not set
- db_set_ws(NULL, protocolname, KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
+ db_set_ws(NULL, MODULENAME, KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
else
mir_free(ptszVal);
@@ -108,7 +112,7 @@ INT CheckDefaults(WPARAM, LPARAM)
else {
char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", c);
- ptszVal = db_get_wsa(NULL, protocolname, szStatus);
+ ptszVal = db_get_wsa(NULL, MODULENAME, szStatus);
if (ptszVal == nullptr) {
wchar_t *ptszDefault;
if (c < ID_STATUS_FREECHAT)
@@ -119,7 +123,7 @@ INT CheckDefaults(WPARAM, LPARAM)
else
ptszDefault = nullptr;
if (ptszDefault)
- db_set_ws(NULL, protocolname, szStatus, TranslateW(ptszDefault));
+ db_set_ws(NULL, MODULENAME, szStatus, TranslateW(ptszDefault));
}
else
mir_free(ptszVal);
@@ -129,7 +133,7 @@ INT CheckDefaults(WPARAM, LPARAM)
if (ServiceExists(MS_VARS_FORMATSTRING))
gbVarsServiceExist = TRUE;
- BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1);
+ BOOL fEnabled = db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
else
@@ -139,7 +143,7 @@ INT CheckDefaults(WPARAM, LPARAM)
INT addEvent(WPARAM hContact, LPARAM hDBEvent)
{
- BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1);
+ BOOL fEnabled = db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
if (!fEnabled || !hContact || !hDBEvent)
return FALSE; /// unspecifyed error
@@ -170,12 +174,12 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
if (db_get_b(hContact, "CList", "NotOnList", 0))
return FALSE;
- if (db_get_b(hContact, protocolname, "TurnedOn", 0))
+ if (db_get_b(hContact, MODULENAME, "TurnedOn", 0))
return FALSE;
if (!(dbei.flags & DBEF_SENT)) {
- int timeBetween = time(0) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
- if (timeBetween > interval || db_get_w(hContact, protocolname, "LastStatus", 0) != status) {
+ int timeBetween = time(0) - db_get_dw(hContact, MODULENAME, "LastReplyTS", 0);
+ if (timeBetween > interval || db_get_w(hContact, MODULENAME, "LastStatus", 0) != status) {
size_t msgLen = 1;
int isQun = db_get_b(hContact, pszProto, "IsQun", 0);
if (isQun)
@@ -183,7 +187,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", status);
- ptszVal = db_get_wsa(NULL, protocolname, szStatus);
+ ptszVal = db_get_wsa(NULL, MODULENAME, szStatus);
if (ptszVal) {
if (*ptszVal) {
CMStringW ptszTemp;
@@ -196,7 +200,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
msgLen += mir_wstrlen(ptszVal);
- wchar_t *ptszHead = db_get_wsa(NULL, protocolname, KEY_HEADING);
+ wchar_t *ptszHead = db_get_wsa(NULL, MODULENAME, KEY_HEADING);
if (ptszHead != nullptr) {
ptszTemp = ptszHead;
ptszTemp.Replace(L"%user%", ptszNick);
@@ -230,8 +234,8 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
}
}
- db_set_dw(hContact, protocolname, "LastReplyTS", time(0));
- db_set_w(hContact, protocolname, "LastStatus", status);
+ db_set_dw(hContact, MODULENAME, "LastReplyTS", time(0));
+ db_set_w(hContact, MODULENAME, "LastStatus", status);
}
return 0;
}
@@ -249,21 +253,21 @@ extern "C" int __declspec(dllexport)Load(void)
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- CreateServiceFunction(protocolname"/ToggleEnable", ToggleEnable);
- CreateServiceFunction(protocolname"/ToggleAutoanswer", Toggle);
+ CreateServiceFunction(MODULENAME"/ToggleEnable", ToggleEnable);
+ CreateServiceFunction(MODULENAME"/ToggleAutoanswer", Toggle);
CMenuItem mi;
SET_UID(mi, 0xac1c64a, 0x82ca, 0x4845, 0x86, 0x89, 0x59, 0x76, 0x12, 0x74, 0x72, 0x7b);
mi.position = 500090000;
mi.name.w = L"";
- mi.pszService = protocolname"/ToggleEnable";
+ mi.pszService = MODULENAME"/ToggleEnable";
hEnableMenu = Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0xb290cccd, 0x4ecc, 0x475e, 0x87, 0xcb, 0x51, 0xf4, 0x3b, 0xc3, 0x44, 0x9c);
mi.position = -0x7FFFFFFF;
mi.name.w = L"";
- mi.pszService = protocolname"/ToggleAutoanswer";
+ mi.pszService = MODULENAME"/ToggleAutoanswer";
hToggle = Menu_AddContactMenuItem(&mi);
//add hook