diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-04 22:12:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-04 22:12:13 +0000 |
commit | b7c74cd5b22618d544a3f4ae124985d4837e3a22 (patch) | |
tree | 468d9610a590685322ad2159a9bd2d9e2ba83f89 /plugins/SimpleStatusMsg/src | |
parent | 7de513f180c429859e246d1033d745b394e1fc28 (diff) |
new mir_snprintf templates without SIZEOF
git-svn-id: http://svn.miranda-ng.org/main/trunk@14002 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SimpleStatusMsg/src')
-rw-r--r-- | plugins/SimpleStatusMsg/src/main.cpp | 70 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/msgbox.cpp | 38 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/options.cpp | 66 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/utils.cpp | 8 |
4 files changed, 91 insertions, 91 deletions
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 488610a156..fcc879976a 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -288,7 +288,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) k2++;
if (k2 == maxk || k2 > maxk) rmark[0] = TRUE;
- mir_snprintf(buff, SIZEOF(buff), "SMsg%d", k);
+ mir_snprintf(buff, "SMsg%d", k);
if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (dbv.ptszVal == NULL)
@@ -336,7 +336,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) k2++;
if (k2 == maxk || k2 > maxk) rmark[0] = TRUE;
- mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", k);
+ mir_snprintf(buff, "DefMsg%d", k);
if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (dbv.ptszVal == NULL)
@@ -372,7 +372,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) if (szProto)
{
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", szProto);
+ mir_snprintf(szSetting, "Proto%sMaxLen", szProto);
len = db_get_w(NULL, "SimpleStatusMsg", szSetting, 1024);
if (len < mir_tstrlen(msg))
{
@@ -407,7 +407,7 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) char szSetting[80];
TCHAR *format;
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", szProto ? szProto : "");
+ mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
flags = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
if (flags & STATUS_EMPTY_MSG)
@@ -416,9 +416,9 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) if (flags & STATUS_LAST_STATUS_MSG)
{
if (szProto)
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", szProto);
+ mir_snprintf(szSetting, "%sMsg", szProto);
else
- mir_snprintf(szSetting, SIZEOF(szSetting), "Msg");
+ mir_snprintf(szSetting, "Msg");
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), &dbv))
return NULL; //mir_tstrdup(_T(""));
@@ -429,9 +429,9 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) else if (flags & STATUS_LAST_MSG)
{
if (szProto)
- mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", szProto);
+ mir_snprintf(szSetting, "Last%sMsg", szProto);
else
- mir_snprintf(szSetting, SIZEOF(szSetting), "LastMsg");
+ mir_snprintf(szSetting, "LastMsg");
if (db_get(NULL, "SimpleStatusMsg", szSetting, &dbv2))
return NULL; //mir_tstrdup(_T(""));
@@ -449,9 +449,9 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) else if (flags & STATUS_THIS_MSG)
{
if (szProto)
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", szProto);
+ mir_snprintf(szSetting, "%sDefault", szProto);
else
- mir_snprintf(szSetting, SIZEOF(szSetting), "Default");
+ mir_snprintf(szSetting, "Default");
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), &dbv))
return mir_tstrdup(_T(""));
@@ -490,7 +490,7 @@ void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat) if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(szSetting, SIZEOF(szSetting), bIsFormat ? "FCur%sMsg" : "Cur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, bIsFormat ? "FCur%sMsg" : "Cur%sMsg", accounts->pa[i]->szModuleName);
DBWriteMessage(szSetting, tszMsg);
#ifdef _DEBUG
if (bIsFormat)
@@ -505,7 +505,7 @@ void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat) if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
return;
- mir_snprintf(szSetting, SIZEOF(szSetting), bIsFormat ? "FCur%sMsg" : "Cur%sMsg", szProto);
+ mir_snprintf(szSetting, bIsFormat ? "FCur%sMsg" : "Cur%sMsg", szProto);
DBWriteMessage(szSetting, tszMsg);
#ifdef _DEBUG
if (bIsFormat)
@@ -519,7 +519,7 @@ void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat) void SaveStatusAsCurrent(const char *szProto, int iStatus)
{
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "Cur%sStatus", szProto);
+ mir_snprintf(szSetting, "Cur%sStatus", szProto);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)iStatus);
}
@@ -531,7 +531,7 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, if ((!iStatus || iStatus == ID_STATUS_CURRENT) && szProto)
{
DBVARIANT dbv;
- mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", szProto);
+ mir_snprintf(szSetting, "FCur%sMsg", szProto);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
format = mir_tstrdup(dbv.ptszVal);
@@ -550,7 +550,7 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, if (szProto && !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)))
return NULL;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", szProto ? szProto : "");
+ mir_snprintf(szSetting, "Proto%sFlags", szProto ? szProto : "");
flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
//if (flags & PROTO_NO_MSG)
@@ -561,7 +561,7 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, if (flags & PROTO_THIS_MSG)
{
DBVARIANT dbv;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", szProto);
+ mir_snprintf(szSetting, "Proto%sDefault", szProto);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
format = mir_tstrdup(dbv.ptszVal);
@@ -573,7 +573,7 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, else if (flags & PROTO_NOCHANGE && szProto)
{
DBVARIANT dbv;
- mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", szProto);
+ mir_snprintf(szSetting, "FCur%sMsg", szProto);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
format = mir_tstrdup(dbv.ptszVal);
@@ -654,7 +654,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus char szSetting[80];
int flags;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", szProto);
+ mir_snprintf(szSetting, "Proto%sFlags", szProto);
flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG)
@@ -669,7 +669,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus DBVARIANT dbv;
TCHAR *msg;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", szProto);
+ mir_snprintf(szSetting, "Proto%sDefault", szProto);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
SaveMessageToDB(szProto, dbv.ptszVal, TRUE);
@@ -806,11 +806,11 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, TCHA {
int iProfileNumber = iStatus - 40083;
char szSetting[128];
- mir_snprintf(szSetting, SIZEOF(szSetting), "%d_%s", iProfileNumber, accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "%d_%s", iProfileNumber, accounts->pa[i]->szModuleName);
iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
if (iStatus == ID_STATUS_IDLE) // the same as ID_STATUS_LAST in StartupStatus
{
- mir_snprintf(szSetting, SIZEOF(szSetting), "last_%s", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "last_%s", accounts->pa[i]->szModuleName);
iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
}
else if (iStatus == ID_STATUS_CURRENT)
@@ -1021,7 +1021,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) }
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", szProto ? szProto : "");
+ mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
int iDlgFlags = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
BOOL bShowDlg = iDlgFlags & STATUS_SHOW_DLG || bOnStartup;
@@ -1046,7 +1046,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) return 0;
}
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", szProto);
+ mir_snprintf(szSetting, "Proto%sFlags", szProto);
iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG) {
if (HasProtoStaticStatusMsg(szProto, iStatus, iStatus))
@@ -1056,7 +1056,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
TCHAR *msg = NULL;
- mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", szProto);
+ mir_snprintf(szSetting, "FCur%sMsg", szProto);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
msg = mir_tstrdup(dbv.ptszVal);
@@ -1126,7 +1126,7 @@ static int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (iProtoFlags & PROTO_NOCHANGE) {
DBVARIANT dbv;
- mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "FCur%sMsg", accounts->pa[i]->szModuleName);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
msg = mir_tstrdup(dbv.ptszVal);
@@ -1204,7 +1204,7 @@ int SetStartupStatus(int i) return -1;
}
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sFlags", accounts->pa[i]->szModuleName);
flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG || flags & PROTO_THIS_MSG)
{
@@ -1214,7 +1214,7 @@ int SetStartupStatus(int i) else if (flags & PROTO_NOCHANGE)
{
DBVARIANT dbv;
- mir_snprintf(szSetting, SIZEOF(szSetting), "FCur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "FCur%sMsg", accounts->pa[i]->szModuleName);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv))
{
fmsg = mir_tstrdup(dbv.ptszVal);
@@ -1481,7 +1481,7 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) continue;
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sFlags", pa[i]->szModuleName);
int iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG)
continue;
@@ -1601,13 +1601,13 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) max_hist_msgs = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
for (j = 1; j <= max_hist_msgs; j++)
{
- mir_snprintf(buff, SIZEOF(buff), "SMsg%d", j);
+ mir_snprintf(buff, "SMsg%d", j);
if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv))
{
if (!mir_tstrcmp(dbv.ptszVal, szMsgW))
{
found = TRUE;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", ps[i]->szName);
+ mir_snprintf(szSetting, "Last%sMsg", ps[i]->szName);
db_set_s(NULL, "SimpleStatusMsg", szSetting, buff);
db_free(&dbv);
break;
@@ -1618,12 +1618,12 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) if (!found)
{
- mir_snprintf(buff, SIZEOF(buff), "FCur%sMsg", ps[i]->szName);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", ps[i]->szName);
+ mir_snprintf(buff, "FCur%sMsg", ps[i]->szName);
+ mir_snprintf(szSetting, "Last%sMsg", ps[i]->szName);
db_set_s(NULL, "SimpleStatusMsg", szSetting, buff);
}
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", ps[i]->szName);
+ mir_snprintf(szSetting, "%sMsg", ps[i]->szName);
db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
msg = InsertVarsIntoMsg(szMsgW, ps[i]->szName, status_mode, NULL);
@@ -1823,7 +1823,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) continue;
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
g_uSetStatusTimer[i] = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), SetStartupStatusProc);
}
}
@@ -1844,7 +1844,7 @@ static int OnOkToExit(WPARAM, LPARAM) if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sStatus", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Last%sStatus", accounts->pa[i]->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0));
}
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 3ce328a87a..3faaa205aa 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -238,7 +238,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) // history messages if (j < 1) j = data->max_hist_msgs; - mir_snprintf(buff, SIZEOF(buff), "SMsg%d", j); + mir_snprintf(buff, "SMsg%d", j); j--; if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv)) { if (dbv.ptszVal != NULL && *dbv.ptszVal != '\0') { @@ -332,7 +332,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) for (i = 1; i <= data->num_def_msgs; ++i) { // predefined messages - mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", i); + mir_snprintf(buff, "DefMsg%d", i); if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv)) { if (dbv.ptszVal) { if (!mir_tstrlen(dbv.ptszVal)) { @@ -500,7 +500,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L switch (uMsg) { case WM_CONTEXTMENU: { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; RECT rc; GetClientRect(hwndDlg, &rc); @@ -709,14 +709,14 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) num_start = SendMessage(data->recent_cbex, CB_GETCOUNT, 0, 0); num_start -= data->num_def_msgs + 1; - mir_snprintf(setting, SIZEOF(setting), "%sFlags", data->m_szProto ? data->m_szProto : ""); + mir_snprintf(setting, "%sFlags", data->m_szProto ? data->m_szProto : ""); flags = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT); if (flags & STATUS_LAST_MSG) { if (data->m_szProto) - mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", data->m_szProto); + mir_snprintf(setting, "Last%sMsg", data->m_szProto); else - mir_snprintf(setting, SIZEOF(setting), "LastMsg"); + mir_snprintf(setting, "LastMsg"); if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv)) { if (dbv.pszVal && mir_strlen(dbv.pszVal)) { @@ -744,9 +744,9 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) } else if (flags & STATUS_THIS_MSG) { if (data->m_szProto) - mir_snprintf(setting, SIZEOF(setting), "%sDefault", data->m_szProto); + mir_snprintf(setting, "%sDefault", data->m_szProto); else - mir_snprintf(setting, SIZEOF(setting), "Default"); + mir_snprintf(setting, "Default"); if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting), &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT1, dbv.ptszVal); @@ -758,9 +758,9 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) } else if (flags & STATUS_LAST_STATUS_MSG) { if (data->m_szProto) - mir_snprintf(setting, SIZEOF(setting), "%sMsg", data->m_szProto); + mir_snprintf(setting, "%sMsg", data->m_szProto); else - mir_snprintf(setting, SIZEOF(setting), "Msg"); + mir_snprintf(setting, "Msg"); if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting), &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT1, dbv.ptszVal); @@ -1129,10 +1129,10 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (iMsgLen == 0) { char szSetting[80]; if (msgbox_data->m_szProto) { - mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", msgbox_data->m_szProto); + mir_snprintf(szSetting, "Last%sMsg", msgbox_data->m_szProto); db_set_s(NULL, "SimpleStatusMsg", szSetting, ""); - mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", msgbox_data->m_szProto); + mir_snprintf(szSetting, "%sMsg", msgbox_data->m_szProto); db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), _T("")); } else { @@ -1150,10 +1150,10 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; - mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", accounts->pa[j]->szModuleName); + mir_snprintf(szSetting, "Last%sMsg", accounts->pa[j]->szModuleName); db_set_s(NULL, "SimpleStatusMsg", szSetting, ""); - mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", accounts->pa[j]->szModuleName); + mir_snprintf(szSetting, "%sMsg", accounts->pa[j]->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName); db_set_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), _T("")); } @@ -1174,7 +1174,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA BOOL found = FALSE; for (int i = 1; i <= msgbox_data->max_hist_msgs; i++) { - mir_snprintf(buff, SIZEOF(buff), "SMsg%d", i); + mir_snprintf(buff, "SMsg%d", i); if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv)) { if (!mir_tstrcmp(dbv.ptszVal, tszMsg)) { found = TRUE; @@ -1223,7 +1223,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA else last_modified_msg++; - mir_snprintf(buff, SIZEOF(buff), "SMsg%d", last_modified_msg); + mir_snprintf(buff, "SMsg%d", last_modified_msg); db_set_ts(NULL, "SimpleStatusMsg", buff, tszMsg); if (msgbox_data->m_szProto) { @@ -1387,7 +1387,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(histitem.lParam) == HISTORY_MSG) { char szSetting[16]; - mir_snprintf(szSetting, SIZEOF(szSetting), "SMsg%d", (int)HIWORD(histitem.lParam)); + mir_snprintf(szSetting, "SMsg%d", (int)HIWORD(histitem.lParam)); db_set_ts(NULL, "SimpleStatusMsg", szSetting, _T("")); SendMessage(msgbox_data->recent_cbex, CBEM_DELETEITEM, (WPARAM)msgbox_data->curr_sel_msg, 0); } @@ -1505,7 +1505,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&histitem); if (LOWORD(histitem.lParam) == HISTORY_MSG) { - mir_snprintf(buff, SIZEOF(buff), "SMsg%d", (int)HIWORD(histitem.lParam)); + mir_snprintf(buff, "SMsg%d", (int)HIWORD(histitem.lParam)); db_set_ts(NULL, "SimpleStatusMsg", buff, _T("")); } else if (LOWORD(histitem.lParam) == PREDEFINED_MSG) @@ -1597,7 +1597,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA cbitem.pszText = text; SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&cbitem); - mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", i); + mir_snprintf(buff, "DefMsg%d", i); if (LOWORD(cbitem.lParam) == PREDEFINED_MSG) { new_num_def_msgs++; db_set_ts(NULL, "SimpleStatusMsg", buff, text); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 99ca669461..0c19914ee0 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -146,10 +146,10 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (!IsAccountEnabled(accounts->pa[j]) || !CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(setting, SIZEOF(setting), "%sFlags", accounts->pa[j]->szModuleName);
+ mir_snprintf(setting, "%sFlags", accounts->pa[j]->szModuleName);
val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
data->status_msg[j+1].flags[i-ID_STATUS_ONLINE] = val;
- mir_snprintf(setting, SIZEOF(setting), "%sDefault", accounts->pa[j]->szModuleName);
+ mir_snprintf(setting, "%sDefault", accounts->pa[j]->szModuleName);
text = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
mir_tstrncpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
}
@@ -202,14 +202,14 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, index, (LPARAM)i + 1);
if (index != CB_ERR && index != CB_ERRSPACE)
{
- mir_snprintf(setting, SIZEOF(setting), "Proto%sDefault", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Proto%sDefault", accounts->pa[i]->szModuleName);
data->proto_msg[i+1].msg = db_get_tsa(NULL, "SimpleStatusMsg", setting);
- mir_snprintf(setting, SIZEOF(setting), "Proto%sFlags", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Proto%sFlags", accounts->pa[i]->szModuleName);
val = db_get_b(NULL, "SimpleStatusMsg", setting, PROTO_DEFAULT);
data->proto_msg[i+1].flags = val;
- mir_snprintf(setting, SIZEOF(setting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Proto%sMaxLen", accounts->pa[i]->szModuleName);
val = db_get_w(NULL, "SimpleStatusMsg", setting, 1024);
data->proto_msg[i+1].max_length = val;
SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i + 1);
@@ -442,9 +442,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv, dbv2;
if (i)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[k]->szModuleName);
+ mir_snprintf(setting, "Last%sMsg", accounts->pa[k]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+ mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
@@ -486,9 +486,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv;
if (i)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[k]->szModuleName);
+ mir_snprintf(setting, "%sMsg", accounts->pa[k]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ mir_snprintf(setting, "Msg");
if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
{
@@ -597,9 +597,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv, dbv2;
if (i)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i-1]->szModuleName);
+ mir_snprintf(setting, "Last%sMsg", accounts->pa[i-1]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+ mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
@@ -640,9 +640,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv;
if (i)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[i-1]->szModuleName);
+ mir_snprintf(setting, "%sMsg", accounts->pa[i-1]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ mir_snprintf(setting, "Msg");
if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
{
@@ -697,9 +697,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv,dbv2;
if (j)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
+ mir_snprintf(setting, "Last%sMsg", accounts->pa[j-1]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+ mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
@@ -732,9 +732,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv;
if (j)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
+ mir_snprintf(setting, "%sMsg", accounts->pa[j-1]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ mir_snprintf(setting, "Msg");
if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
{
@@ -811,9 +811,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv, dbv2;
if (j)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
+ mir_snprintf(setting, "Last%sMsg", accounts->pa[j-1]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+ mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv))
@@ -846,9 +846,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBVARIANT dbv;
if (j)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
+ mir_snprintf(setting, "%sMsg", accounts->pa[j-1]->szModuleName);
else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ mir_snprintf(setting, "Msg");
if (!db_get_ts(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
{
@@ -1028,10 +1028,10 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
{
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", accounts->pa[j]->szModuleName);
+ mir_snprintf(szSetting, "%sDefault", accounts->pa[j]->szModuleName);
db_set_ts(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", accounts->pa[j]->szModuleName);
+ mir_snprintf(szSetting, "%sFlags", accounts->pa[j]->szModuleName);
db_set_b(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
@@ -1055,16 +1055,16 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sDefault", accounts->pa[i]->szModuleName);
if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
db_set_ts(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
// else
// db_unset(NULL, "SimpleStatusMsg", szSetting);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sMaxLen", accounts->pa[i]->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sFlags", accounts->pa[i]->szModuleName);
db_set_b(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
}
}
@@ -1197,7 +1197,7 @@ static BOOL IsHistoryMsgsFound(HWND hwndDlg, int histMax) for (int i = 1; i <= histMax; ++i, --j) {
if (j < 1)
j = histMax;
- mir_snprintf(szSetting, SIZEOF(szSetting), "SMsg%d", j);
+ mir_snprintf(szSetting, "SMsg%d", j);
if (!db_get_ts(NULL, "SimpleStatusMsg", szSetting, &dbv)) {
if (dbv.ptszVal != NULL && *dbv.ptszVal != '\0') {
db_free(&dbv);
@@ -1360,7 +1360,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Last%sMsg", accounts->pa[i]->szModuleName);
db_set_s(NULL, "SimpleStatusMsg", setting, "");
}
db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
@@ -1379,7 +1379,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w nDefMSgCount = db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
for (int i = 1; i <= nDefMSgCount; i++) {
- mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i);
+ mir_snprintf(szSetting, "DefMsg%d", i);
db_unset(NULL, "SimpleStatusMsg", szSetting);
}
db_set_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
@@ -1458,9 +1458,9 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa if (index != LB_ERR && index != LB_ERRSPACE)
{
char setting[80];
- mir_snprintf(setting, SIZEOF(setting), "Startup%sStatus", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Startup%sStatus", accounts->pa[i]->szModuleName);
data->status[i] = db_get_w(NULL, "SimpleStatusMsg", setting, ID_STATUS_CURRENT);
- mir_snprintf(setting, SIZEOF(setting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
data->setdelay[i] = db_get_w(NULL, "SimpleStatusMsg", setting, 300);
SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
@@ -1640,10 +1640,10 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa if (!IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Startup%sStatus", accounts->pa[i]->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
}
db_set_w(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index b77b652757..2d1b04e920 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -126,7 +126,7 @@ const char *StatusModeToDbSetting(int status, const char *suffix) case ID_STATUS_IDLE: prefix = "Idl"; break;
default: return NULL;
}
- mir_snprintf(str, SIZEOF(str), "%s%s", prefix, suffix);
+ mir_snprintf(str, "%s%s", prefix, suffix);
return str;
}
@@ -134,7 +134,7 @@ int GetCurrentStatus(const char *szProto) {
if (szProto) {
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "Cur%sStatus", szProto);
+ mir_snprintf(szSetting, "Cur%sStatus", szProto);
return (int)db_get_w(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
}
@@ -147,11 +147,11 @@ int GetStartupStatus(const char *szProto) int status_mode;
char szSetting[80];
- mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", szProto);
+ mir_snprintf(szSetting, "Startup%sStatus", szProto);
status_mode = db_get_w(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_CURRENT);
if (status_mode == ID_STATUS_CURRENT) {
// load status used for this proto last time
- mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sStatus", szProto);
+ mir_snprintf(szSetting, "Last%sStatus", szProto);
status_mode = db_get_w(NULL, "SimpleStatusMsg", szSetting, ID_STATUS_OFFLINE);
}
return status_mode;
|