diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
commit | 8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch) | |
tree | 03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/Sessions/Src | |
parent | c5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff) |
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/Sessions/Src')
-rw-r--r-- | plugins/Sessions/Src/Main.cpp | 92 | ||||
-rw-r--r-- | plugins/Sessions/Src/Options.cpp | 44 | ||||
-rw-r--r-- | plugins/Sessions/Src/Utils.cpp | 82 | ||||
-rw-r--r-- | plugins/Sessions/Src/stdafx.h | 6 |
4 files changed, 113 insertions, 111 deletions
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 169a42ab0b..e45fc6d03a 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -61,7 +61,7 @@ IconItem iconList[] = /////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo =
+PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -75,9 +75,13 @@ PLUGININFOEX pluginInfo = { 0x60558872, 0x2aab, 0x45aa, { 0x88, 0x8d, 0x9, 0x76, 0x91, 0xc9, 0xb6, 0x83 } }
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -97,13 +101,13 @@ INT_PTR CALLBACK ExitDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) SavePosition(hdlg, "ExitDlg");
SaveSessionDate();
SaveSessionHandles(0, 0);
- db_set_b(NULL, MODNAME, "lastempty", 0);
+ db_set_b(NULL, MODULENAME, "lastempty", 0);
DestroyWindow(hdlg);
break;
case IDCANCEL:
SavePosition(hdlg, "ExitDlg");
- db_set_b(NULL, MODNAME, "lastempty", 1);
+ db_set_b(NULL, MODULENAME, "lastempty", 1);
DestroyWindow(hdlg);
break;
}
@@ -263,7 +267,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
{
- int iDelay = db_get_w(NULL, MODNAME, "StartupModeDelay", 1500);
+ int iDelay = db_get_w(NULL, MODULENAME, "StartupModeDelay", 1500);
if (g_hghostw == TRUE)
SetTimer(hdlg, TIMERID_LOAD, iDelay, nullptr);
else {
@@ -322,7 +326,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case IDC_SESSDEL:
if (session_list_recovered[0] && ses_count == 256) {
for (int i = 0; session_list_recovered[i]; i++)
- db_set_b(session_list_recovered[i], MODNAME, "wasInLastSession", 0);
+ db_set_b(session_list_recovered[i], MODULENAME, "wasInLastSession", 0);
memset(session_list_recovered, 0, sizeof(session_list_recovered));
g_bIncompletedSave = 0;
@@ -428,7 +432,7 @@ int SaveSessionHandles(WPARAM, LPARAM lparam) }
if (lparam == 1) {
g_ses_count++;
- db_set_b(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
+ db_set_b(0, MODULENAME, "UserSessionsCount", (BYTE)g_ses_count);
}
return 0;
}
@@ -452,8 +456,8 @@ INT_PTR OpenSessionsManagerWindow(WPARAM, LPARAM) }
ptrW
- tszSession(db_get_wsa(NULL, MODNAME, "SessionDate_0")),
- tszUserSession(db_get_wsa(NULL, MODNAME, "UserSessionDsc_0"));
+ tszSession(db_get_wsa(NULL, MODULENAME, "SessionDate_0")),
+ tszUserSession(db_get_wsa(NULL, MODULENAME, "UserSessionDsc_0"));
if (g_bIncompletedSave || tszSession || tszUserSession) {
g_hDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
return 0;
@@ -481,9 +485,9 @@ int SaveSessionDate() char szSetting[256];
mir_snprintf(szSetting, "%s_%d", "SessionDate", 0);
- wchar_t *ptszSaveSessionDate = db_get_wsa(NULL, MODNAME, szSetting);
+ wchar_t *ptszSaveSessionDate = db_get_wsa(NULL, MODULENAME, szSetting);
- db_set_ws(NULL, MODNAME, szSetting, szSessionTime);
+ db_set_ws(NULL, MODULENAME, szSetting, szSessionTime);
mir_free(szSessionTime);
if (ptszSaveSessionDate)
@@ -495,7 +499,7 @@ int SaveSessionDate() mir_free(szDateBuf);
}
if (g_bCrashRecovery)
- db_set_b(NULL, MODNAME, "lastSaveCompleted", 1);
+ db_set_b(NULL, MODULENAME, "lastSaveCompleted", 1);
return 0;
}
@@ -506,11 +510,11 @@ int SaveUserSessionName(wchar_t *szUSessionName) char szSetting[256];
mir_snprintf(szSetting, "%s_%u", "UserSessionDsc", 0);
- wchar_t *ptszUserSessionName = db_get_wsa(NULL, MODNAME, szSetting);
+ wchar_t *ptszUserSessionName = db_get_wsa(NULL, MODULENAME, szSetting);
if (ptszUserSessionName)
ResaveSettings("UserSessionDsc", 1, 255, ptszUserSessionName);
- db_set_ws(NULL, MODNAME, szSetting, szUSessionName);
+ db_set_ws(NULL, MODULENAME, szSetting, szUSessionName);
return 0;
}
@@ -592,30 +596,30 @@ int DelUserDefSession(int ses_count) char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", ses_count);
- db_unset(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODULENAME, szSessionName);
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", ses_count);
- db_unset(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODULENAME, szSessionName);
for (int i = ses_count + 1;; i++) {
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", i);
- ptrW szSessionNameBuf(db_get_wsa(NULL, MODNAME, szSessionName));
+ ptrW szSessionNameBuf(db_get_wsa(NULL, MODULENAME, szSessionName));
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", i - 1);
if (szSessionNameBuf) {
MarkUserDefSession(i - 1, IsMarkedUserDefSession(i));
- db_set_ws(NULL, MODNAME, szSessionName, szSessionNameBuf);
+ db_set_ws(NULL, MODULENAME, szSessionName, szSessionNameBuf);
}
else {
- db_unset(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODULENAME, szSessionName);
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", i - 1);
- db_unset(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODULENAME, szSessionName);
break;
}
}
g_ses_count--;
- db_set_b(0, MODNAME, "UserSessionsCount", (BYTE)g_ses_count);
+ db_set_b(0, MODULENAME, "UserSessionsCount", (BYTE)g_ses_count);
return 0;
}
@@ -628,17 +632,17 @@ int DeleteAutoSession(int ses_count) char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "SessionDate", ses_count);
- db_unset(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODULENAME, szSessionName);
for (int i = ses_count + 1;; i++) {
mir_snprintf(szSessionName, "%s_%u", "SessionDate", i);
- ptrW szSessionNameBuf(db_get_wsa(NULL, MODNAME, szSessionName));
+ ptrW szSessionNameBuf(db_get_wsa(NULL, MODULENAME, szSessionName));
mir_snprintf(szSessionName, "%s_%u", "SessionDate", i - 1);
if (szSessionNameBuf)
- db_set_ws(NULL, MODNAME, szSessionName, szSessionNameBuf);
+ db_set_ws(NULL, MODULENAME, szSessionName, szSessionNameBuf);
else {
- db_unset(NULL, MODNAME, szSessionName);
+ db_unset(NULL, MODULENAME, szSessionName);
break;
}
}
@@ -653,23 +657,23 @@ int SessionPreShutdown(WPARAM, LPARAM) if (g_hDlg) DestroyWindow(g_hDlg);
if (g_hSDlg) DestroyWindow(g_hSDlg);
- db_set_b(NULL, MODNAME, "lastSaveCompleted", 1);
+ db_set_b(NULL, MODULENAME, "lastSaveCompleted", 1);
return 0;
}
int OkToExit(WPARAM, LPARAM)
{
- int exitmode = db_get_b(NULL, MODNAME, "ShutdownMode", 2);
+ int exitmode = db_get_b(NULL, MODULENAME, "ShutdownMode", 2);
DONT = 1;
if (exitmode == 2 && session_list[0] != 0) {
SaveSessionDate();
SaveSessionHandles(0, 0);
- db_set_b(NULL, MODNAME, "lastempty", 0);
+ db_set_b(NULL, MODULENAME, "lastempty", 0);
}
else if (exitmode == 1 && session_list[0] != 0) {
DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXDIALOG), nullptr, ExitDlgProc);
}
- else db_set_b(NULL, MODNAME, "lastempty", 1);
+ else db_set_b(NULL, MODULENAME, "lastempty", 1);
return 0;
}
@@ -679,13 +683,13 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) if (MWeventdata->uType == MSG_WINDOW_EVT_OPEN) {
AddToCurSession(MWeventdata->hContact, 0);
if (g_bCrashRecovery)
- db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 1);
+ db_set_b(MWeventdata->hContact, MODULENAME, "wasInLastSession", 1);
}
else if (MWeventdata->uType == MSG_WINDOW_EVT_CLOSE) {
if (!DONT)
DelFromCurSession(MWeventdata->hContact, 0);
if (g_bCrashRecovery)
- db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 0);
+ db_set_b(MWeventdata->hContact, MODULENAME, "wasInLastSession", 0);
}
return 0;
@@ -733,7 +737,7 @@ static int CreateButtons(WPARAM, LPARAM) static void CALLBACK LaunchSessions()
{
- int startup = db_get_b(NULL, MODNAME, "StartupMode", 3);
+ int startup = db_get_b(NULL, MODULENAME, "StartupMode", 3);
if (startup == 1 || (startup == 3 && isLastTRUE == TRUE)) {
StartUp = TRUE;
g_hDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
@@ -810,7 +814,7 @@ static int PluginInit(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load(void)
{
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
CreateServiceFunction(MS_SESSIONS_SHOWFAVORITESMENU, BuildFavMenu);
CreateServiceFunction(MS_SESSIONS_OPENMANAGER, OpenSessionsManagerWindow);
@@ -820,31 +824,31 @@ extern "C" __declspec(dllexport) int Load(void) Miranda_WaitOnHandle(LaunchSessions);
- g_ses_count = db_get_b(NULL, MODNAME, "UserSessionsCount", 0);
- g_ses_limit = db_get_b(NULL, MODNAME, "TrackCount", 10);
- g_bExclHidden = db_get_b(NULL, MODNAME, "ExclHidden", 0) != 0;
- g_bWarnOnHidden = db_get_b(NULL, MODNAME, "WarnOnHidden", 0) != 0;
- g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1) != 0;
- g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0) != 0;
+ g_ses_count = db_get_b(NULL, MODULENAME, "UserSessionsCount", 0);
+ g_ses_limit = db_get_b(NULL, MODULENAME, "TrackCount", 10);
+ g_bExclHidden = db_get_b(NULL, MODULENAME, "ExclHidden", 0) != 0;
+ g_bWarnOnHidden = db_get_b(NULL, MODULENAME, "WarnOnHidden", 0) != 0;
+ g_bOtherWarnings = db_get_b(NULL, MODULENAME, "OtherWarnings", 1) != 0;
+ g_bCrashRecovery = db_get_b(NULL, MODULENAME, "CrashRecovery", 0) != 0;
if (g_bCrashRecovery)
- g_bIncompletedSave = db_get_b(NULL, MODNAME, "lastSaveCompleted", 0) == 0;
+ g_bIncompletedSave = db_get_b(NULL, MODULENAME, "lastSaveCompleted", 0) == 0;
if (g_bIncompletedSave) {
int i = 0;
memset(session_list_recovered, 0, sizeof(session_list_recovered));
for (auto &hContact : Contacts())
- if (db_get_b(hContact, MODNAME, "wasInLastSession", 0))
+ if (db_get_b(hContact, MODULENAME, "wasInLastSession", 0))
session_list_recovered[i++] = hContact;
}
if (!session_list_recovered[0])
g_bIncompletedSave = false;
- db_set_b(NULL, MODNAME, "lastSaveCompleted", 0);
+ db_set_b(NULL, MODULENAME, "lastSaveCompleted", 0);
- if (!db_get_b(NULL, MODNAME, "lastempty", 1) || g_bIncompletedSave)
+ if (!db_get_b(NULL, MODULENAME, "lastempty", 1) || g_bIncompletedSave)
isLastTRUE = true;
HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
@@ -852,7 +856,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, SessionPreShutdown);
// Icons
- g_plugin.registerIcon(MODNAME, iconList);
+ g_plugin.registerIcon(MODULENAME, iconList);
return 0;
}
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index b577147bbe..5ff238d1af 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -160,19 +160,19 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l hIcon = (bChecked = IsMarkedUserDefSession(opses_count)) ? hMarked : hNotMarked;
- SetDlgItemInt(hdlg, IDC_TRACK, g_ses_limit = db_get_b(NULL, MODNAME, "TrackCount", 10), FALSE);
+ SetDlgItemInt(hdlg, IDC_TRACK, g_ses_limit = db_get_b(NULL, MODULENAME, "TrackCount", 10), FALSE);
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE));
SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
- SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODNAME, "StartupModeDelay", 1500), FALSE);
- int startupmode = db_get_b(NULL, MODNAME, "StartupMode", 3);
- int exitmode = db_get_b(NULL, MODNAME, "ShutdownMode", 2);
+ SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODULENAME, "StartupModeDelay", 1500), FALSE);
+ int startupmode = db_get_b(NULL, MODULENAME, "StartupMode", 3);
+ int exitmode = db_get_b(NULL, MODULENAME, "ShutdownMode", 2);
- g_bExclHidden = db_get_b(NULL, MODNAME, "ExclHidden", 0) != 0;
- g_bWarnOnHidden = db_get_b(NULL, MODNAME, "WarnOnHidden", 0) != 0;
- g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1) != 0;
- g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0) != 0;
+ g_bExclHidden = db_get_b(NULL, MODULENAME, "ExclHidden", 0) != 0;
+ g_bWarnOnHidden = db_get_b(NULL, MODULENAME, "WarnOnHidden", 0) != 0;
+ g_bOtherWarnings = db_get_b(NULL, MODULENAME, "OtherWarnings", 1) != 0;
+ g_bCrashRecovery = db_get_b(NULL, MODULENAME, "CrashRecovery", 0) != 0;
CheckDlgButton(hdlg, IDC_EXCLHIDDEN, g_bExclHidden ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg, IDC_LASTHIDDENWARN, g_bWarnOnHidden ? BST_CHECKED : BST_UNCHECKED);
@@ -242,30 +242,30 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l case PSN_APPLY:
{
int iDelay = GetDlgItemInt(hdlg, IDC_STARTDELAY, nullptr, FALSE);
- db_set_w(0, MODNAME, "StartupModeDelay", (WORD)iDelay);
- db_set_b(0, MODNAME, "TrackCount", (BYTE)(g_ses_limit = GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE)));
+ db_set_w(0, MODULENAME, "StartupModeDelay", (WORD)iDelay);
+ db_set_b(0, MODULENAME, "TrackCount", (BYTE)(g_ses_limit = GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE)));
if (IsDlgButtonChecked(hdlg, IDC_REXSAVE))
- db_set_b(NULL, MODNAME, "ShutdownMode", 2);
+ db_set_b(NULL, MODULENAME, "ShutdownMode", 2);
else if (IsDlgButtonChecked(hdlg, IDC_REXDSAVE))
- db_set_b(NULL, MODNAME, "ShutdownMode", 0);
+ db_set_b(NULL, MODULENAME, "ShutdownMode", 0);
else if (IsDlgButtonChecked(hdlg, IDC_REXASK))
- db_set_b(NULL, MODNAME, "ShutdownMode", 1);
+ db_set_b(NULL, MODULENAME, "ShutdownMode", 1);
if (IsDlgButtonChecked(hdlg, IDC_STARTDIALOG)) {
if (BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
- db_set_b(NULL, MODNAME, "StartupMode", 1);
+ db_set_b(NULL, MODULENAME, "StartupMode", 1);
else
- db_set_b(NULL, MODNAME, "StartupMode", 3);
+ db_set_b(NULL, MODULENAME, "StartupMode", 3);
}
else if (IsDlgButtonChecked(hdlg, IDC_RLOADLAST))
- db_set_b(NULL, MODNAME, "StartupMode", 2);
+ db_set_b(NULL, MODULENAME, "StartupMode", 2);
else if (IsDlgButtonChecked(hdlg, IDC_RNOTHING))
- db_set_b(NULL, MODNAME, "StartupMode", 0);
+ db_set_b(NULL, MODULENAME, "StartupMode", 0);
- db_set_b(NULL, MODNAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
- db_set_b(NULL, MODNAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
- db_set_b(NULL, MODNAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
- db_set_b(NULL, MODNAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
+ db_set_b(NULL, MODULENAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
+ db_set_b(NULL, MODULENAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
+ db_set_b(NULL, MODULENAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
+ db_set_b(NULL, MODULENAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
}
return 1;
@@ -493,7 +493,7 @@ int OptionsInit(WPARAM wparam, LPARAM) odp.position = 955000000;
odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.szTitle.a = MODNAME;
+ odp.szTitle.a = MODULENAME;
odp.pfnDlgProc = OptionsProc;
odp.szGroup.a = LPGEN("Message sessions");
odp.flags = ODPF_BOLDGROUPS;
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 0dac6aef1a..36bdeae375 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void AddSessionMark(MCONTACT hContact, int mode, char bit)
{
if (mode == 0) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks"));
if (szValue) {
char temp_1 = szValue[0];
for (int i = 0; i < g_ses_limit; i++) {
@@ -33,13 +33,13 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) for (int i = g_ses_limit; i < 10; i++)
szValue[i] = '0';
szValue[0] = bit;
- db_set_s(hContact, MODNAME, "LastSessionsMarks", szValue);
+ db_set_s(hContact, MODULENAME, "LastSessionsMarks", szValue);
}
else if (bit == '1')
- db_set_s(hContact, MODNAME, "LastSessionsMarks", "10000000000");
+ db_set_s(hContact, MODULENAME, "LastSessionsMarks", "10000000000");
}
else if (mode == 1) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsMarks"));
if (szValue) {
char *pszBuffer;
if (mir_strlen(szValue) < g_ses_count) {
@@ -56,21 +56,21 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) temp_1 = temp_2;
}
pszBuffer[0] = bit;
- db_set_s(hContact, MODNAME, "UserSessionsMarks", pszBuffer);
+ db_set_s(hContact, MODULENAME, "UserSessionsMarks", pszBuffer);
mir_free(pszBuffer);
}
else if (bit == '1')
- db_set_s(hContact, MODNAME, "UserSessionsMarks", "10000000000");
+ db_set_s(hContact, MODULENAME, "UserSessionsMarks", "10000000000");
else
- db_set_s(hContact, MODNAME, "UserSessionsMarks", "00000000000");
+ db_set_s(hContact, MODULENAME, "UserSessionsMarks", "00000000000");
}
}
void RemoveSessionMark(MCONTACT hContact, int mode, int marknum)
{
if (mode == 0) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks"));
if (szValue) {
for (int i = marknum; i < g_ses_limit; i++)
szValue[i] = szValue[i + 1];
@@ -78,16 +78,16 @@ void RemoveSessionMark(MCONTACT hContact, int mode, int marknum) for (int i = g_ses_limit; i < 10; i++)
szValue[i] = '0';
- db_set_s(hContact, MODNAME, "LastSessionsMarks", szValue);
+ db_set_s(hContact, MODULENAME, "LastSessionsMarks", szValue);
}
}
else if (mode == 1) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsMarks"));
if (szValue) {
for (int i = marknum; i < g_ses_limit; i++)
szValue[i] = szValue[i + 1];
- db_set_s(hContact, MODNAME, "UserSessionsMarks", szValue);
+ db_set_s(hContact, MODULENAME, "UserSessionsMarks", szValue);
}
}
}
@@ -95,17 +95,17 @@ void RemoveSessionMark(MCONTACT hContact, int mode, int marknum) void SetSessionMark(MCONTACT hContact, int mode, char bit, unsigned int marknum)
{
if (mode == 0) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks"));
if (szValue) {
szValue[marknum] = bit;
- db_set_s(hContact, MODNAME, "LastSessionsMarks", szValue);
+ db_set_s(hContact, MODULENAME, "LastSessionsMarks", szValue);
}
}
else if (mode == 1) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsMarks"));
if (szValue) {
szValue[marknum] = bit;
- db_set_s(hContact, MODNAME, "UserSessionsMarks", szValue);
+ db_set_s(hContact, MODULENAME, "UserSessionsMarks", szValue);
}
}
}
@@ -114,9 +114,9 @@ bool LoadContactsFromMask(MCONTACT hContact, int mode, int count) {
ptrA szValue;
if (mode == 0)
- szValue = db_get_sa(hContact, MODNAME, "LastSessionsMarks");
+ szValue = db_get_sa(hContact, MODULENAME, "LastSessionsMarks");
else if (mode == 1)
- szValue = db_get_sa(hContact, MODNAME, "UserSessionsMarks");
+ szValue = db_get_sa(hContact, MODULENAME, "UserSessionsMarks");
if (szValue == NULL)
return false;
@@ -130,7 +130,7 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) mir_snprintf(szFormNumBuf, "%02u", ordernum);
if (mode == 0) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsMarks"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks"));
if (szValue) {
int len = (int)mir_strlen(szValue);
if (!len)
@@ -146,15 +146,15 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) for (int i = (g_ses_limit * 2); i < 20; i++)
temp[i] = '0';
- db_set_s(hContact, MODNAME, "LastSessionsOrder", temp);
+ db_set_s(hContact, MODULENAME, "LastSessionsOrder", temp);
}
else if (writemode == 1) {
mir_snprintf(szFormNumBuf, "%02u%s", ordernum, "000000000000000000");
- db_set_s(hContact, MODNAME, "LastSessionsOrder", szFormNumBuf);
+ db_set_s(hContact, MODULENAME, "LastSessionsOrder", szFormNumBuf);
}
}
else if (mode == 1) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsOrder"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsOrder"));
if (szValue) {
char *pszBuffer;
if (mir_strlen(szValue) < (g_ses_count * 2)) {
@@ -169,13 +169,13 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) char *temp = (char*)_alloca(len + 1);
mir_snprintf(temp, len + 1, "%02u%s", ordernum, szValue);
- db_set_s(hContact, MODNAME, "UserSessionsOrder", temp);
+ db_set_s(hContact, MODULENAME, "UserSessionsOrder", temp);
mir_free(pszBuffer);
}
else if (writemode == 1)
- db_set_s(hContact, MODNAME, "UserSessionsOrder", szFormNumBuf);
+ db_set_s(hContact, MODULENAME, "UserSessionsOrder", szFormNumBuf);
else
- db_set_s(hContact, MODNAME, "UserSessionsOrder", "00");
+ db_set_s(hContact, MODULENAME, "UserSessionsOrder", "00");
}
}
@@ -183,14 +183,14 @@ int GetInSessionOrder(MCONTACT hContact, int mode, int count) {
char szTemp[3];
if (mode == 0) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsOrder"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsOrder"));
if (szValue) {
strncpy_s(szTemp, &szValue[count * 2], 2);
return atoi(szTemp);
}
}
else if (mode == 1) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsOrder"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsOrder"));
if (szValue) {
strncpy_s(szTemp, &szValue[count * 2], 2);
return atoi(szTemp);
@@ -205,19 +205,19 @@ void SetInSessionOrder(MCONTACT hContact, int mode, int count, unsigned int orde mir_snprintf(szTemp, "%02u", ordernum);
if (mode == 0) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsOrder"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsOrder"));
if (szValue) {
szValue[count * 2] = szTemp[0];
szValue[count * 2 + 1] = szTemp[1];
- db_set_s(hContact, MODNAME, "LastSessionsOrder", szValue);
+ db_set_s(hContact, MODULENAME, "LastSessionsOrder", szValue);
}
}
else if (mode == 1) {
- ptrA szValue(db_get_sa(hContact, MODNAME, "UserSessionsOrder"));
+ ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsOrder"));
if (szValue) {
szValue[count * 2] = szTemp[0];
szValue[count * 2 + 1] = szTemp[1];
- db_set_s(hContact, MODNAME, "UserSessionsOrder", szValue);
+ db_set_s(hContact, MODULENAME, "UserSessionsOrder", szValue);
}
}
}
@@ -231,8 +231,8 @@ BOOL ResaveSettings(char *szName, int iFirst, int iLimit, wchar_t *szBuffer) char szNameBuf[256];
mir_snprintf(szNameBuf, "%s_%u", szName, i);
- wchar_t *ptszTemp = db_get_wsa(NULL, MODNAME, szNameBuf);
- db_set_ws(NULL, MODNAME, szNameBuf, szBuffer);
+ wchar_t *ptszTemp = db_get_wsa(NULL, MODULENAME, szNameBuf);
+ db_set_ws(NULL, MODULENAME, szNameBuf, szBuffer);
mir_free(szBuffer);
BYTE marked = IsMarkedUserDefSession(i);
@@ -298,7 +298,7 @@ int LoadSessionToCombobox(HWND hdlg, BOOL mode, int iLimit, char* pszSetting, in for (int i = 0; i < iLimit; i++) {
mir_snprintf(szBuffer, "%s_%u", pszSetting, i);
- wchar_t *pszBuffer = db_get_wsa(NULL, MODNAME, szBuffer);
+ wchar_t *pszBuffer = db_get_wsa(NULL, MODULENAME, szBuffer);
if (pszBuffer) {
if (!IsMarkedUserDefSession(i + iFirstNum) || mode == 1) {
index = SendDlgItemMessage(hdlg, IDC_LIST, CB_ADDSTRING, 0, (LPARAM)pszBuffer);
@@ -327,7 +327,7 @@ int FillFavoritesMenu(HMENU hMenu, int iLimit) if (IsMarkedUserDefSession(i)) {
char szBuffer[256];
mir_snprintf(szBuffer, "%s_%u", "UserSessionDsc", i);
- wchar_t *pszBuffer = db_get_wsa(NULL, MODNAME, szBuffer);
+ wchar_t *pszBuffer = db_get_wsa(NULL, MODULENAME, szBuffer);
if (pszBuffer) {
AppendMenu(hMenu, MF_STRING, i + 1, pszBuffer);
iItems++;
@@ -362,14 +362,14 @@ void RenameUserDefSession(int ses_count, wchar_t* ptszNewName) {
char szSession[256];
mir_snprintf(szSession, "%s_%u", "UserSessionDsc", ses_count);
- db_set_ws(NULL, MODNAME, szSession, ptszNewName);
+ db_set_ws(NULL, MODULENAME, szSession, ptszNewName);
}
int MarkUserDefSession(int ses_count, BYTE bCheck)
{
char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", ses_count);
- db_set_b(NULL, MODNAME, szSessionName, bCheck);
+ db_set_b(NULL, MODULENAME, szSessionName, bCheck);
return 0;
}
@@ -377,7 +377,7 @@ BYTE IsMarkedUserDefSession(int ses_count) {
char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", ses_count);
- return db_get_b(NULL, MODNAME, szSessionName, 0);
+ return db_get_b(NULL, MODULENAME, szSessionName, 0);
}
void SavePosition(HWND hwnd, char *wndName)
@@ -386,17 +386,17 @@ void SavePosition(HWND hwnd, char *wndName) GetWindowRect(hwnd, &rc);
char buffer[512];
mir_snprintf(buffer, "%sPosX", wndName);
- db_set_dw(0, MODNAME, buffer, rc.left);
+ db_set_dw(0, MODULENAME, buffer, rc.left);
mir_snprintf(buffer, "%sPosY", wndName);
- db_set_dw(0, MODNAME, buffer, rc.top);
+ db_set_dw(0, MODULENAME, buffer, rc.top);
}
void LoadPosition(HWND hWnd, char *wndName)
{
char buffer[512];
mir_snprintf(buffer, "%sPosX", wndName);
- int x = db_get_dw(0, MODNAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2) - 130);
+ int x = db_get_dw(0, MODULENAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2) - 130);
mir_snprintf(buffer, "%sPosY", wndName);
- int y = db_get_dw(0, MODNAME, buffer, ((GetSystemMetrics(SM_CYSCREEN)) / 2) - 80);
+ int y = db_get_dw(0, MODULENAME, buffer, ((GetSystemMetrics(SM_CYSCREEN)) / 2) - 80);
SetWindowPos(hWnd, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSIZE);
}
diff --git a/plugins/Sessions/Src/stdafx.h b/plugins/Sessions/Src/stdafx.h index 642ae6bc52..2a2424edbb 100644 --- a/plugins/Sessions/Src/stdafx.h +++ b/plugins/Sessions/Src/stdafx.h @@ -45,13 +45,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "version.h"
#include "Resource.h"
-#define MODNAME "Sessions"
+#define MODULENAME "Sessions"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODNAME)
- {}
+ CMPlugin();
};
extern IconItem iconList[];
|