From 8a74e7495ce5ad39de4f5c25121a84d35df90c36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 15:08:48 +0300 Subject: CMPlugin to receive a reference to PLUGININFOEX --- plugins/NewAwaySysMod/src/AwayOpt.cpp | 10 ++++---- plugins/NewAwaySysMod/src/AwaySys.cpp | 36 ++++++++++++++++------------- plugins/NewAwaySysMod/src/Client.cpp | 2 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 6 ++--- plugins/NewAwaySysMod/src/Properties.cpp | 28 +++++++++++----------- plugins/NewAwaySysMod/src/Properties.h | 22 +++++++++--------- plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 4 ++-- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 24 +++++++++---------- plugins/NewAwaySysMod/src/stdafx.h | 10 ++++---- 9 files changed, 72 insertions(+), 70 deletions(-) (limited to 'plugins/NewAwaySysMod') diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 731a5de605..be2996772e 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -64,7 +64,7 @@ void MySetPos(HWND hwndParent) // ================================================ Message options ================================================ -COptPage g_MessagesOptPage(MOD_NAME, nullptr); +COptPage g_MessagesOptPage(MODULENAME, nullptr); void EnableMessagesOptDlgControls(CMsgTree* MsgTree) { @@ -326,7 +326,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP // ================================================ Main options ================================================ -COptPage g_MoreOptPage(MOD_NAME, nullptr); +COptPage g_MoreOptPage(MODULENAME, nullptr); void EnableMoreOptDlgControls() { @@ -446,7 +446,7 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // ================================================ Autoreply options ================================================ -COptPage g_AutoreplyOptPage(MOD_NAME, nullptr); +COptPage g_AutoreplyOptPage(MODULENAME, nullptr); void EnableAutoreplyOptDlgControls() { @@ -1046,8 +1046,8 @@ int OptsDlgInit(WPARAM wParam, LPARAM) return 0; } -COptPage g_SetAwayMsgPage(MOD_NAME, nullptr); -COptPage g_MsgTreePage(MOD_NAME, nullptr); +COptPage g_SetAwayMsgPage(MODULENAME, nullptr); +COptPage g_MsgTreePage(MODULENAME, nullptr); void InitOptions() { diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 6c4afc8c36..1d319a88d0 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -77,7 +77,7 @@ HICON GetIcon(int iconId, bool size) ///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -90,9 +90,13 @@ PLUGININFOEX pluginInfo = { 0xb2dd9270, 0xce5e, 0x11df, { 0xbd, 0x3d, 0x8, 0x0, 0x20, 0xc, 0x9a, 0x66 } } }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -146,7 +150,7 @@ int StatusMsgReq(WPARAM wParam, LPARAM lParam, CString &szProto) hFoundContact = INVALID_CONTACT_ID; else if (iMode >= ID_STATUS_ONLINE && iMode <= ID_STATUS_OUTTOLUNCH) // don't count xstatus requests - db_set_w(hFoundContact, MOD_NAME, DB_REQUESTCOUNT, db_get_w(hFoundContact, MOD_NAME, DB_REQUESTCOUNT, 0) + 1); + db_set_w(hFoundContact, MODULENAME, DB_REQUESTCOUNT, db_get_w(hFoundContact, MODULENAME, DB_REQUESTCOUNT, 0) + 1); MCONTACT hContactForSettings = hFoundContact; // used to take into account not-on-list contacts when getting contact settings, but at the same time allows to get correct contact info for contacts that are in the DB if (hContactForSettings != INVALID_CONTACT_ID && db_get_b(hContactForSettings, "CList", "NotOnList", 0)) @@ -502,11 +506,11 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) Result = TranslateT("Stranger"); } else if (!mir_wstrcmp(ai->targv[0], VAR_REQUESTCOUNT)) { - mir_snwprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MOD_NAME, DB_REQUESTCOUNT, 0)); + mir_snwprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MODULENAME, DB_REQUESTCOUNT, 0)); Result.ReleaseBuffer(); } else if (!mir_wstrcmp(ai->targv[0], VAR_MESSAGENUM)) { - mir_snwprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MOD_NAME, DB_MESSAGECOUNT, 0)); + mir_snwprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MODULENAME, DB_MESSAGECOUNT, 0)); Result.ReleaseBuffer(); } else if (!mir_wstrcmp(ai->targv[0], VAR_TIMEPASSED)) { @@ -533,7 +537,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); - TreeCtrl->DBToMem(CString(MOD_NAME)); + TreeCtrl->DBToMem(CString(MODULENAME)); for (int i = 0; i < TreeCtrl->m_value.GetSize(); i++) { if (!(TreeCtrl->m_value[i].Flags & TIF_GROUP) && !mir_wstrcmpi(TreeCtrl->m_value[i].Title, ai->targv[1])) { @@ -705,27 +709,27 @@ int MirandaLoaded(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void) { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded); - g_plugin.registerIcon(MOD_NAME, iconList, "nas"); + g_plugin.registerIcon(MODULENAME, iconList, "nas"); InitCommonControls(); InitOptions(); // must be called before we hook CallService - if (db_get_b(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1) { // change all %nas_message% variables to %extratext% if it wasn't done before - TCString Str = db_get_s(NULL, MOD_NAME, "PopupsFormat", L""); + if (db_get_b(NULL, MODULENAME, DB_SETTINGSVER, 0) < 1) { // change all %nas_message% variables to %extratext% if it wasn't done before + TCString Str = db_get_s(NULL, MODULENAME, "PopupsFormat", L""); if (Str.GetLen()) - db_set_ws(NULL, MOD_NAME, "PopupsFormat", Str.Replace(L"nas_message", L"extratext")); + db_set_ws(NULL, MODULENAME, "PopupsFormat", Str.Replace(L"nas_message", L"extratext")); - Str = db_get_s(NULL, MOD_NAME, "ReplyPrefix", L""); + Str = db_get_s(NULL, MODULENAME, "ReplyPrefix", L""); if (Str.GetLen()) - db_set_ws(NULL, MOD_NAME, "ReplyPrefix", Str.Replace(L"nas_message", L"extratext")); + db_set_ws(NULL, MODULENAME, "ReplyPrefix", Str.Replace(L"nas_message", L"extratext")); } - if (db_get_b(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 2) { // disable autoreply for not-on-list contacts, as such contact may be a spam bot - db_set_b(NULL, MOD_NAME, ContactStatusToDBSetting(0, DB_ENABLEREPLY, 0, INVALID_CONTACT_ID), 0); - db_set_b(NULL, MOD_NAME, DB_SETTINGSVER, 2); + if (db_get_b(NULL, MODULENAME, DB_SETTINGSVER, 0) < 2) { // disable autoreply for not-on-list contacts, as such contact may be a spam bot + db_set_b(NULL, MODULENAME, ContactStatusToDBSetting(0, DB_ENABLEREPLY, 0, INVALID_CONTACT_ID), 0); + db_set_b(NULL, MODULENAME, DB_SETTINGSVER, 2); } return 0; } diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index 975db0e8cd..ab4d62c937 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -134,7 +134,7 @@ int GetRecentGroupID(int iMode) // COptPage MoreOptData(g_MoreOptPage); COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); - TreeCtrl->DBToMem(CString(MOD_NAME)); + TreeCtrl->DBToMem(CString(MODULENAME)); if (!g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSMRM)) return g_Messages_RecentRootID; diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index f86c1d6e00..43b596af48 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -176,7 +176,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) COptPage AutoreplyOptData(g_AutoreplyOptPage); AutoreplyOptData.DBToMem(); if (dbei->eventType == EVENTTYPE_MESSAGE) - db_set_w(hContact, MOD_NAME, DB_MESSAGECOUNT, db_get_w(hContact, MOD_NAME, DB_MESSAGECOUNT, 0) + 1); // increment message counter + db_set_w(hContact, MODULENAME, DB_MESSAGECOUNT, db_get_w(hContact, MODULENAME, DB_MESSAGECOUNT, 0) + 1); // increment message counter if (AutoreplyOptData.GetValue(StatusModeList[i].DisableReplyCtlID)) return 0; @@ -210,7 +210,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) int SendCount = (int)AutoreplyOptData.GetValue(IDC_REPLYDLG_SENDCOUNT); if ((AutoreplyOptData.GetValue(IDC_REPLYDLG_DONTSENDTOICQ) && UIN) || // an icq contact - (SendCount != -1 && db_get_b(hContact, MOD_NAME, DB_SENDCOUNT, 0) >= SendCount)) + (SendCount != -1 && db_get_b(hContact, MODULENAME, DB_SENDCOUNT, 0) >= SendCount)) return 0; if ((dbei->eventType == EVENTTYPE_MESSAGE && !AutoreplyOptData.GetValue(IDC_REPLYDLG_EVENTMSG)) || @@ -218,7 +218,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) (dbei->eventType == EVENTTYPE_FILE && !AutoreplyOptData.GetValue(IDC_REPLYDLG_EVENTFILE))) return 0; - db_set_b(hContact, MOD_NAME, DB_SENDCOUNT, db_get_b(hContact, MOD_NAME, DB_SENDCOUNT, 0) + 1); + db_set_b(hContact, MODULENAME, DB_SENDCOUNT, db_get_b(hContact, MODULENAME, DB_SENDCOUNT, 0) + 1); GetDynamicStatMsg(hContact); // it updates VarParseData.Message needed for %extratext% in the format TCString Reply(*(TCString*)AutoreplyOptData.GetValue(IDC_REPLYDLG_PREFIX)); if (Reply != nullptr && ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) { diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 077704fb56..3c570cfe51 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -24,9 +24,9 @@ CProtoStates g_ProtoStates; void ResetContactSettingsOnStatusChange(MCONTACT hContact) { - db_unset(hContact, MOD_NAME, DB_REQUESTCOUNT); - db_unset(hContact, MOD_NAME, DB_SENDCOUNT); - db_unset(hContact, MOD_NAME, DB_MESSAGECOUNT); + db_unset(hContact, MODULENAME, DB_REQUESTCOUNT); + db_unset(hContact, MODULENAME, DB_SENDCOUNT); + db_unset(hContact, MODULENAME, DB_MESSAGECOUNT); } void ResetSettingsOnStatusChange(const char *szProto = nullptr, int bResetPersonalMsgs = false, int Status = 0) @@ -110,9 +110,9 @@ void CContactSettings::SetMsgFormat(int Flags, TCString Message) ResetContactSettingsOnStatusChange(m_hContact); if (Message != nullptr) - db_set_ws(m_hContact, MOD_NAME, DBSetting, Message); + db_set_ws(m_hContact, MODULENAME, DBSetting, Message); else - db_unset(m_hContact, MOD_NAME, DBSetting); + db_unset(m_hContact, MODULENAME, DBSetting); } if (Flags & (SMF_LAST | SMF_TEMPORARY)) { @@ -132,7 +132,7 @@ TCString CContactSettings::GetMsgFormat(int Flags, int *pOrder, char *szProtoOve *pOrder = -1; if (Flags & GMF_PERSONAL) // try getting personal message (it overrides global) - Message = db_get_s(m_hContact, MOD_NAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (wchar_t*)NULL); + Message = db_get_s(m_hContact, MODULENAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (wchar_t*)NULL); if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL | GMF_TEMPORARY) && Message.IsEmpty()) { char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? GetContactProto(m_hContact) : nullptr); @@ -164,19 +164,19 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) g_ProtoStates[szProto].TempMsg.Unset(); CString DBSetting(ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS)); if (Message != nullptr) - db_set_ws(NULL, MOD_NAME, DBSetting, Message); + db_set_ws(NULL, MODULENAME, DBSetting, Message); else { if (!szProto) - db_set_ws(NULL, MOD_NAME, DBSetting, CProtoSettings(nullptr, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary + db_set_ws(NULL, MODULENAME, DBSetting, CProtoSettings(nullptr, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary else - db_unset(NULL, MOD_NAME, DBSetting); + db_unset(NULL, MODULENAME, DBSetting); } } if (Flags & SMF_LAST) { COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); - TreeCtrl->DBToMem(CString(MOD_NAME)); + TreeCtrl->DBToMem(CString(MODULENAME)); int RecentGroupID = GetRecentGroupID(Status); if (RecentGroupID == -1) { // we didn't find the group, it also means that we're using per status messages; so we need to create it TreeCtrl->m_value.AddElem(CTreeItem(Status ? Clist_GetStatusModeDescription(Status, 0) : MSGTREE_RECENT_OTHERGROUP, g_Messages_RecentRootID, RecentGroupID = TreeCtrl->GenerateID(), TIF_GROUP)); @@ -244,7 +244,7 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) } } } - TreeCtrl->MemToDB(CString(MOD_NAME)); + TreeCtrl->MemToDB(CString(MODULENAME)); } } @@ -263,7 +263,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) } } if (Flags & GMF_PERSONAL && Message == nullptr) // try getting personal message (it overrides global) - Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); + Message = db_get_s(NULL, MODULENAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); if (Flags & GMF_PROTOORGLOBAL && Message == nullptr) { Message = CProtoSettings().GetMsgFormat(GMF_PERSONAL | (Flags & GMF_TEMPORARY), pOrder); @@ -273,10 +273,10 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) if (Flags & GMF_LASTORDEFAULT && Message == nullptr) { // try to get the last or default message, depending on current settings COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); - TreeCtrl->DBToMem(CString(MOD_NAME)); + TreeCtrl->DBToMem(CString(MODULENAME)); Message = nullptr; if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USELASTMSG)) { // if using last message by default... - Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); // try per-protocol message first + Message = db_get_s(NULL, MODULENAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); // try per-protocol message first if (Message.IsEmpty()) { Message = nullptr; // to be sure it's NULL, not "" - as we're checking 'Message == NULL' later int RecentGroupID = GetRecentGroupID(Status); diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index f5b2f2d7fb..27da4917e4 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -326,19 +326,19 @@ public: CAutoreply& operator=(const int m_value) { CString Setting(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY); - if (db_get_b(NULL, MOD_NAME, Setting, VAL_USEDEFAULT) == m_value) + if (db_get_b(NULL, MODULENAME, Setting, VAL_USEDEFAULT) == m_value) return *this; if (m_value != VAL_USEDEFAULT) - db_set_b(NULL, MOD_NAME, Setting, m_value != 0); + db_set_b(NULL, MODULENAME, Setting, m_value != 0); else - db_unset(NULL, MOD_NAME, Setting); + db_unset(NULL, MODULENAME, Setting); return *this; } operator int() { - return db_get_b(NULL, MOD_NAME, Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY, + return db_get_b(NULL, MODULENAME, Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY, Parent->szProto ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY); } @@ -421,15 +421,15 @@ public: CString Setting(Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)); MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL; if (m_value) - db_set_b(hContact, MOD_NAME, Setting, 1); + db_set_b(hContact, MODULENAME, Setting, 1); else - db_unset(hContact, MOD_NAME, Setting); + db_unset(hContact, MODULENAME, Setting); return *this; } operator int() { - return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME, + return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MODULENAME, Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), 0); } @@ -445,16 +445,16 @@ public: { CString Setting(Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)); MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL; - if (db_get_b(hContact, MOD_NAME, Setting, VAL_USEDEFAULT) == m_value) + if (db_get_b(hContact, MODULENAME, Setting, VAL_USEDEFAULT) == m_value) return *this; if (m_value != VAL_USEDEFAULT) - db_set_b(hContact, MOD_NAME, Setting, m_value != 0); + db_set_b(hContact, MODULENAME, Setting, m_value != 0); else - db_unset(hContact, MOD_NAME, Setting); + db_unset(hContact, MODULENAME, Setting); return *this; } - operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);} + operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MODULENAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);} int IncludingParents(const char *szProtoOverride = nullptr) // takes into account protocol and global data also, if per-contact setting is not defined { _ASSERT((Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 45ae7c6dce..71108da370 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -53,7 +53,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); - Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING); + Utils_RestoreWindowPosition(hwndDlg, NULL, MODULENAME, RAMDLGSIZESETTING); { READAWAYMSGDATA *awayData = new READAWAYMSGDATA; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)awayData); @@ -124,7 +124,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam awayData->hAwayMsgEvent = nullptr; } delete awayData; - Utils_SaveWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING); + Utils_SaveWindowPosition(hwndDlg, NULL, MODULENAME, RAMDLGSIZESETTING); WindowList_Remove(g_hReadWndList, hwndDlg); } return false; diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 88fb5f0dcd..acf2df40ab 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -520,12 +520,12 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA MinContactSplitterX = rcMsgDlg.right - rc.left + 1; // [try] getting dialog position - int DlgPosX = db_get_dw(NULL, MOD_NAME, SAM_DB_DLGPOSX, -1); - int DlgPosY = db_get_dw(NULL, MOD_NAME, SAM_DB_DLGPOSY, -1); - int DlgSizeX = db_get_dw(NULL, MOD_NAME, SAM_DB_DLGSIZEX, -1); - int DlgSizeY = db_get_dw(NULL, MOD_NAME, SAM_DB_DLGSIZEY, -1); - int MsgSplitterX = db_get_dw(NULL, MOD_NAME, SAM_DB_MSGSPLITTERPOS, -1); - int ContactSplitterX = db_get_dw(NULL, MOD_NAME, SAM_DB_CONTACTSPLITTERPOS, -1); + int DlgPosX = db_get_dw(NULL, MODULENAME, SAM_DB_DLGPOSX, -1); + int DlgPosY = db_get_dw(NULL, MODULENAME, SAM_DB_DLGPOSY, -1); + int DlgSizeX = db_get_dw(NULL, MODULENAME, SAM_DB_DLGSIZEX, -1); + int DlgSizeY = db_get_dw(NULL, MODULENAME, SAM_DB_DLGSIZEY, -1); + int MsgSplitterX = db_get_dw(NULL, MODULENAME, SAM_DB_MSGSPLITTERPOS, -1); + int ContactSplitterX = db_get_dw(NULL, MODULENAME, SAM_DB_CONTACTSPLITTERPOS, -1); if (DlgPosX >= 0 && DlgPosY >= 0 && DlgSizeX > 0 && DlgSizeY > 0 && MsgSplitterX > 0 && ContactSplitterX > 0) { RECT rcWorkArea, rcIntersect; SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0); @@ -939,12 +939,12 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA { RECT rcRect; GetWindowRect(hwndDlg, &rcRect); - db_set_dw(NULL, MOD_NAME, SAM_DB_DLGPOSX, rcRect.left); - db_set_dw(NULL, MOD_NAME, SAM_DB_DLGPOSY, rcRect.top); - db_set_dw(NULL, MOD_NAME, SAM_DB_DLGSIZEX, rcRect.right - rcRect.left); - db_set_dw(NULL, MOD_NAME, SAM_DB_DLGSIZEY, rcRect.bottom - rcRect.top); - db_set_dw(NULL, MOD_NAME, SAM_DB_MSGSPLITTERPOS, g_MsgSplitterX); - db_set_dw(NULL, MOD_NAME, SAM_DB_CONTACTSPLITTERPOS, g_ContactSplitterX); + db_set_dw(NULL, MODULENAME, SAM_DB_DLGPOSX, rcRect.left); + db_set_dw(NULL, MODULENAME, SAM_DB_DLGPOSY, rcRect.top); + db_set_dw(NULL, MODULENAME, SAM_DB_DLGSIZEX, rcRect.right - rcRect.left); + db_set_dw(NULL, MODULENAME, SAM_DB_DLGSIZEY, rcRect.bottom - rcRect.top); + db_set_dw(NULL, MODULENAME, SAM_DB_MSGSPLITTERPOS, g_MsgSplitterX); + db_set_dw(NULL, MODULENAME, SAM_DB_CONTACTSPLITTERPOS, g_ContactSplitterX); g_SetAwayMsgPage.PageToMemToDB(); } break; diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index 991bd0aa23..004dca9cb2 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -141,11 +141,11 @@ #define STR_XSTATUSDESC TranslateT("extended status") -#define MOD_NAME "NewAwaySys" +#define MODULENAME "NewAwaySys" #define MOD_NAMEW L"NewAwaySys" -#define LOG_ID MOD_NAME // LogService log ID -#define LOG_PREFIX MOD_NAME ": " // netlib.log prefix for all NAS' messages +#define LOG_ID MODULENAME // LogService log ID +#define LOG_PREFIX MODULENAME ": " // netlib.log prefix for all NAS' messages #define DB_SETTINGSVER "SettingsVer" @@ -223,9 +223,7 @@ int ICQStatusToGeneralStatus(int bICQStat); // TODO: get rid of these protocol-s struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(MOD_NAME) - {} + CMPlugin(); }; struct SetAwayMsgData -- cgit v1.2.3