summaryrefslogtreecommitdiff
path: root/plugins/LotusNotify/src/LotusNotify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/LotusNotify/src/LotusNotify.cpp')
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp144
1 files changed, 75 insertions, 69 deletions
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index 69006c457a..d25e47eed1 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -21,7 +21,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam);
#define MAX_SETTING_STR 512
#define STATUS_COUNT 9
-char PLUGINNAME[64] = {0}; //init at init_pluginname();
+char MODULENAME[64] = {0}; //init at init_pluginname();
int &hLangpack(g_plugin.m_hLang);
CMPlugin g_plugin;
CLIST_INTERFACE *pcli;
@@ -67,7 +67,7 @@ wchar_t *startuperrors[] = {
/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo = {
+PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -79,12 +79,18 @@ PLUGININFOEX pluginInfo = {
{ 0x23eacc0d, 0xbab0, 0x49c0, { 0x8f, 0x37, 0x5e, 0x25, 0x9e, 0xce, 0x52, 0x7f } } // {23EACC0D-BAB0-49c0-8F37-5E259ECE527F}
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+}
+
extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
#ifdef _WIN64
#error LotusNotify.dll cannot work with 64bit Miranda. (Lotus client is 32bit only)
#endif
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -243,8 +249,8 @@ void init_pluginname()
}
// copy to static variable
- strncpy_s(PLUGINNAME, _countof(PLUGINNAME), p, mir_strlen(p));
- assert(mir_strlen(PLUGINNAME)>0);
+ strncpy_s(MODULENAME, _countof(MODULENAME), p, mir_strlen(p));
+ assert(mir_strlen(MODULENAME)>0);
}
@@ -318,7 +324,7 @@ void Click(HWND hWnd,BOOL execute)
deletePopupsHandles((&(getEl(pid->id))->pq),TRUE);
if(settingNewest && (pid->id > settingNewestID) ){
- db_set_dw(NULL, PLUGINNAME, "LNNewestID", settingNewestID=pid->id);
+ db_set_dw(NULL, MODULENAME, "LNNewestID", settingNewestID=pid->id);
}
if(execute && settingCommand[0] ) {
char tmpcommand[2*MAX_SETTING_STR];
@@ -392,7 +398,7 @@ BOOL checkNotesIniFile(BOOL bInfo)
strncpy_s(tmp1,_countof(tmp1),tmp,sizeof(tmp1));//copy temporary
assert(mir_strlen(tmp1)>0);
- char* PLUGINNAME_lower = _strlwr(mir_strdup(PLUGINNAME));
+ char* PLUGINNAME_lower = _strlwr(mir_strdup(MODULENAME));
//is there our plugin as safe?
if(strstr(tmp1,PLUGINNAME_lower) == nullptr)
@@ -401,7 +407,7 @@ BOOL checkNotesIniFile(BOOL bInfo)
return FALSE;
if(!settingIniAnswer || bInfo){
- switch(MessageBox(nullptr, TranslateT("This utility check your notes.ini file if it's set to authenticate this plugin as safe. Plugin is not added as Lotus Extension, so plugin built-in authentication will not work properly. Do you want to add plugin as Lotus Extension (modify notes.ini by adding \"EXTMGR_ADDINS=PLUGINNAME\")?"), TranslateT("LotusNotify plugin configuration"), MB_YESNO))
+ switch(MessageBox(nullptr, TranslateT("This utility check your notes.ini file if it's set to authenticate this plugin as safe. Plugin is not added as Lotus Extension, so plugin built-in authentication will not work properly. Do you want to add plugin as Lotus Extension (modify notes.ini by adding \"EXTMGR_ADDINS=MODULENAME\")?"), TranslateT("LotusNotify plugin configuration"), MB_YESNO))
{
case IDYES:
{
@@ -698,7 +704,7 @@ void checkthread(void*)
// remember newest id depending on options set
if (settingNewest&&settingEvenNonClicked && (noteID > settingNewestID))
- db_set_dw(NULL, PLUGINNAME, "LNNewestID", settingNewestID = noteID);
+ db_set_dw(NULL, MODULENAME, "LNNewestID", settingNewestID = noteID);
//if(((!settingOnceOnly||(settingOnceOnly&&settingNonClickedOnly))&&existElem(noteID))||(settingNewest&&settingNewestID>=noteID))
//continue;
@@ -967,66 +973,66 @@ static void lookupLotusDefaultSettings(HWND hwndDlg)
// get variables values stored in db.
static void LoadSettings()
{
- settingInterval = (INT)db_get_dw(NULL, PLUGINNAME, "LNInterval", 15);
- settingInterval1 = (INT)db_get_dw(NULL, PLUGINNAME, "LNInterval1", 0);
- settingKeepConnection = db_get_b(NULL, PLUGINNAME, "LNKeepConnection", 1);
+ settingInterval = (INT)db_get_dw(NULL, MODULENAME, "LNInterval", 15);
+ settingInterval1 = (INT)db_get_dw(NULL, MODULENAME, "LNInterval1", 0);
+ settingKeepConnection = db_get_b(NULL, MODULENAME, "LNKeepConnection", 1);
DBVARIANT dbv;
- if (!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)) {
+ if (!db_get_s(NULL, MODULENAME, "LNDatabase", &dbv)) {
strncpy_s(settingDatabase, _countof(settingDatabase), dbv.pszVal, _countof(settingDatabase));
db_free(&dbv);
}
- if (!db_get_s(NULL, PLUGINNAME, "LNServer", &dbv)) {
+ if (!db_get_s(NULL, MODULENAME, "LNServer", &dbv)) {
strncpy_s(settingServer, _countof(settingServer), dbv.pszVal, _countof(settingServer));
db_free(&dbv);
}
- if (!db_get_s(NULL, PLUGINNAME, "LNServerSec", &dbv)) {
+ if (!db_get_s(NULL, MODULENAME, "LNServerSec", &dbv)) {
strncpy_s(settingServerSec, _countof(settingServerSec), dbv.pszVal, _countof(settingServerSec));
db_free(&dbv);
}
- if (!db_get(NULL, PLUGINNAME, "LNPassword", &dbv)) {
+ if (!db_get(NULL, MODULENAME, "LNPassword", &dbv)) {
strncpy_s(settingPassword, _countof(settingPassword), dbv.pszVal, _countof(settingPassword));
db_free(&dbv);
}
- if (!db_get_s(NULL, PLUGINNAME, "LNCommand", &dbv, DBVT_ASCIIZ)) {
+ if (!db_get_s(NULL, MODULENAME, "LNCommand", &dbv, DBVT_ASCIIZ)) {
strncpy_s(settingCommand, _countof(settingCommand), dbv.pszVal, _countof(settingCommand));
db_free(&dbv);
}
- if (!db_get_s(NULL, PLUGINNAME, "LNParameters", &dbv, DBVT_ASCIIZ)) {
+ if (!db_get_s(NULL, MODULENAME, "LNParameters", &dbv, DBVT_ASCIIZ)) {
strncpy_s(settingParameters, _countof(settingParameters), dbv.pszVal, _countof(settingParameters));
db_free(&dbv);
}
- if (!db_get_ws(NULL, PLUGINNAME, "LNFilterSender", &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, "LNFilterSender", &dbv)) {
wcsncpy_s(settingFilterSender, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- if (!db_get_ws(NULL, PLUGINNAME, "LNFilterSubject", &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, "LNFilterSubject", &dbv)) {
wcsncpy_s(settingFilterSubject, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- if (!db_get_ws(NULL, PLUGINNAME, "LNFilterTo", &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, "LNFilterTo", &dbv)) {
wcsncpy_s(settingFilterTo, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- settingOnceOnly = db_get_b(NULL, PLUGINNAME, "LNOnceOnly", 0);
+ settingOnceOnly = db_get_b(NULL, MODULENAME, "LNOnceOnly", 0);
- settingNonClickedOnly = db_get_b(NULL, PLUGINNAME, "LNNonClickedOnly", 1);
- settingShowError = db_get_b(NULL, PLUGINNAME, "LNShowError", 1);
- settingSetColours = db_get_b(NULL, PLUGINNAME, "LNSetColours", 0);
- settingBgColor = (COLORREF)db_get_dw(NULL, PLUGINNAME, "LNBgColor", (DWORD)0xFFFFFF);
- settingFgColor = (COLORREF)db_get_dw(NULL, PLUGINNAME, "LNFgColor", (DWORD)0x000000);
- settingNewest = db_get_b(NULL, PLUGINNAME, "LNNewest", 0);
- settingEvenNonClicked = db_get_b(NULL, PLUGINNAME, "LNEvenNonClicked", 0);
- settingNewestID = (DWORD)db_get_dw(NULL, PLUGINNAME, "LNNewestID", 0);
- settingIniAnswer = db_get_b(NULL, PLUGINNAME, "LNIniAnswer", 0);
- settingIniCheck = db_get_b(NULL, PLUGINNAME, "LNIniCheck", 0);
+ settingNonClickedOnly = db_get_b(NULL, MODULENAME, "LNNonClickedOnly", 1);
+ settingShowError = db_get_b(NULL, MODULENAME, "LNShowError", 1);
+ settingSetColours = db_get_b(NULL, MODULENAME, "LNSetColours", 0);
+ settingBgColor = (COLORREF)db_get_dw(NULL, MODULENAME, "LNBgColor", (DWORD)0xFFFFFF);
+ settingFgColor = (COLORREF)db_get_dw(NULL, MODULENAME, "LNFgColor", (DWORD)0x000000);
+ settingNewest = db_get_b(NULL, MODULENAME, "LNNewest", 0);
+ settingEvenNonClicked = db_get_b(NULL, MODULENAME, "LNEvenNonClicked", 0);
+ settingNewestID = (DWORD)db_get_dw(NULL, MODULENAME, "LNNewestID", 0);
+ settingIniAnswer = db_get_b(NULL, MODULENAME, "LNIniAnswer", 0);
+ settingIniCheck = db_get_b(NULL, MODULENAME, "LNIniCheck", 0);
for (int i = 0; i < STATUS_COUNT; i++) {
char buff[128];
mir_snprintf(buff, "LNStatus%d", i);
- settingStatus[i] = (db_get_b(0, PLUGINNAME, buff, 0) == 1);
+ settingStatus[i] = (db_get_b(0, MODULENAME, buff, 0) == 1);
}
//lookupLotusDefaultSettings();
}
@@ -1035,30 +1041,30 @@ static void SaveSettings(HWND hwndDlg)
{
char buff[128];
GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
- db_set_s(NULL, PLUGINNAME, "LNServer", settingServer);
- db_set_s(NULL, PLUGINNAME, "LNServerSec", settingServerSec);
- db_set_s(NULL, PLUGINNAME, "LNPassword", settingPassword);
- db_set_s(NULL, PLUGINNAME, "LNDatabase", settingDatabase);
- db_set_dw(NULL, PLUGINNAME, "LNInterval", settingInterval);
- db_set_dw(NULL, PLUGINNAME, "LNInterval1", settingInterval1);
- db_set_b(NULL, PLUGINNAME, "LNKeepConnection", settingKeepConnection);
- db_set_s(NULL, PLUGINNAME, "LNCommand", settingCommand);
- db_set_s(NULL, PLUGINNAME, "LNParameters", settingParameters);
- db_set_b(NULL, PLUGINNAME, "LNOnceOnly", settingOnceOnly);
- db_set_b(NULL, PLUGINNAME, "LNNonClickedOnly", settingNonClickedOnly);
- db_set_b(NULL, PLUGINNAME, "LNShowError", settingShowError);
- db_set_b(NULL, PLUGINNAME, "LNSetColours", settingSetColours);
- db_set_dw(NULL, PLUGINNAME, "LNBgColor", (DWORD)settingBgColor);
- db_set_dw(NULL, PLUGINNAME, "LNFgColor", (DWORD)settingFgColor);
- db_set_b(NULL, PLUGINNAME, "LNNewest", settingNewest);
- db_set_b(NULL, PLUGINNAME, "LNEvenNonClicked", settingEvenNonClicked);
- db_set_b(NULL, PLUGINNAME, "LNIniCheck", settingIniCheck);
- db_set_b(NULL, PLUGINNAME, "LNIniAnswer", settingIniAnswer);
+ db_set_s(NULL, MODULENAME, "LNServer", settingServer);
+ db_set_s(NULL, MODULENAME, "LNServerSec", settingServerSec);
+ db_set_s(NULL, MODULENAME, "LNPassword", settingPassword);
+ db_set_s(NULL, MODULENAME, "LNDatabase", settingDatabase);
+ db_set_dw(NULL, MODULENAME, "LNInterval", settingInterval);
+ db_set_dw(NULL, MODULENAME, "LNInterval1", settingInterval1);
+ db_set_b(NULL, MODULENAME, "LNKeepConnection", settingKeepConnection);
+ db_set_s(NULL, MODULENAME, "LNCommand", settingCommand);
+ db_set_s(NULL, MODULENAME, "LNParameters", settingParameters);
+ db_set_b(NULL, MODULENAME, "LNOnceOnly", settingOnceOnly);
+ db_set_b(NULL, MODULENAME, "LNNonClickedOnly", settingNonClickedOnly);
+ db_set_b(NULL, MODULENAME, "LNShowError", settingShowError);
+ db_set_b(NULL, MODULENAME, "LNSetColours", settingSetColours);
+ db_set_dw(NULL, MODULENAME, "LNBgColor", (DWORD)settingBgColor);
+ db_set_dw(NULL, MODULENAME, "LNFgColor", (DWORD)settingFgColor);
+ db_set_b(NULL, MODULENAME, "LNNewest", settingNewest);
+ db_set_b(NULL, MODULENAME, "LNEvenNonClicked", settingEvenNonClicked);
+ db_set_b(NULL, MODULENAME, "LNIniCheck", settingIniCheck);
+ db_set_b(NULL, MODULENAME, "LNIniAnswer", settingIniAnswer);
for (int i = 0; i < STATUS_COUNT; i++) {
mir_snprintf(buff, "LNStatus%d", i);
settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE);
- db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0);
+ db_set_b(0, MODULENAME, buff, settingStatus[i] ? 1 : 0);
}
settingFilterSender[0] = 0;
@@ -1068,7 +1074,7 @@ static void SaveSettings(HWND hwndDlg)
wcscat_s(settingFilterSender, _countof(settingFilterSender), text);
wcscat_s(settingFilterSender, _countof(settingFilterSender), TEXT(";"));
}
- db_set_ws(NULL, PLUGINNAME, "LNFilterSender", settingFilterSender);
+ db_set_ws(NULL, MODULENAME, "LNFilterSender", settingFilterSender);
settingFilterSubject[0] = 0;
for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCOUNT, 0, 0); i++) {
@@ -1077,7 +1083,7 @@ static void SaveSettings(HWND hwndDlg)
wcscat_s(settingFilterSubject, _countof(settingFilterSubject), text);
wcscat_s(settingFilterSubject, _countof(settingFilterSubject), TEXT(";"));
}
- db_set_ws(NULL, PLUGINNAME, "LNFilterSubject", settingFilterSubject);
+ db_set_ws(NULL, MODULENAME, "LNFilterSubject", settingFilterSubject);
settingFilterTo[0] = 0;
for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCOUNT, 0, 0); i++) {
@@ -1086,7 +1092,7 @@ static void SaveSettings(HWND hwndDlg)
wcscat_s(settingFilterTo, _countof(settingFilterTo), text);
wcscat_s(settingFilterTo, _countof(settingFilterTo), TEXT(";"));
}
- db_set_ws(NULL, PLUGINNAME, "LNFilterTo", settingFilterTo);
+ db_set_ws(NULL, MODULENAME, "LNFilterTo", settingFilterTo);
}
//callback function to speak with user interactions in options page
@@ -1505,7 +1511,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM)
//gives name to protocol module
INT_PTR GetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, PLUGINNAME, wParam);
+ strncpy((char*)lParam, MODULENAME, wParam);
return 0;
}
@@ -1554,7 +1560,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
Menu_EnableItem(hMenuHandle, TRUE);
}
else {
- ProtoBroadcastAck(PLUGINNAME, NULL, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)currentStatus, wParam);
+ ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)currentStatus, wParam);
return -1;
}
}
@@ -1572,7 +1578,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
}
//broadcast the message
if (currentStatus != (int)wParam)
- ProtoBroadcastAck(PLUGINNAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)currentStatus, wParam);
+ ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)currentStatus, wParam);
currentStatus = wParam;
return 0;
@@ -1677,7 +1683,7 @@ static int preshutdown(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load(void)
{
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
Plugin_Terminated = false;
@@ -1697,7 +1703,7 @@ extern "C" int __declspec(dllexport) Load(void)
init_pluginname();
logRegister();
- log_p(L"Load: Entering LotusNotify.dll Load() bMirandaCall=%d PLUGINNAME=[%S]", bMirandaCall, PLUGINNAME);
+ log_p(L"Load: Entering LotusNotify.dll Load() bMirandaCall=%d MODULENAME=[%S]", bMirandaCall, MODULENAME);
if (!(hCheckEvent = CreateHookableEvent("LotusNotify/Check"))) //check if there is another copy of plugin running
second = TRUE;
@@ -1722,14 +1728,14 @@ extern "C" int __declspec(dllexport) Load(void)
}
// set all contacts to offline
- for (auto &hContact : Contacts(PLUGINNAME))
- db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE);
-
- CreateProtoServiceFunction(PLUGINNAME, PS_GETCAPS, GetCaps);
- CreateProtoServiceFunction(PLUGINNAME, PS_GETNAME, GetName);
- CreateProtoServiceFunction(PLUGINNAME, PS_LOADICON, TMLoadIcon);
- CreateProtoServiceFunction(PLUGINNAME, PS_SETSTATUS, SetStatus);
- CreateProtoServiceFunction(PLUGINNAME, PS_GETSTATUS, GetStatus);
+ for (auto &hContact : Contacts(MODULENAME))
+ db_set_w(hContact, MODULENAME, "status", ID_STATUS_OFFLINE);
+
+ CreateProtoServiceFunction(MODULENAME, PS_GETCAPS, GetCaps);
+ CreateProtoServiceFunction(MODULENAME, PS_GETNAME, GetName);
+ CreateProtoServiceFunction(MODULENAME, PS_LOADICON, TMLoadIcon);
+ CreateProtoServiceFunction(MODULENAME, PS_SETSTATUS, SetStatus);
+ CreateProtoServiceFunction(MODULENAME, PS_GETSTATUS, GetStatus);
LoadSettings(); //read from db to variables