diff options
Diffstat (limited to 'plugins/SimpleStatusMsg/src')
-rw-r--r-- | plugins/SimpleStatusMsg/src/awaymsg.cpp | 8 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/main.cpp | 70 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/msgbox.cpp | 6 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/options.cpp | 22 |
4 files changed, 53 insertions, 53 deletions
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index ab93e8b13f..84a8acda74 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -44,7 +44,7 @@ static char *StrNormNewlineA(char *szStr) if (!nCR)
return mir_strdup(szStr);
- char *szNewStr = (char *)mir_alloc(lstrlenA(szStr) + nCR + 1), *pszStr = szNewStr;
+ char *szNewStr = (char *)mir_alloc(mir_strlen(szStr) + nCR + 1), *pszStr = szNewStr;
while (*szStr) {
if (*szStr == 0x0A)
*pszStr++ = 0x0D;
@@ -69,7 +69,7 @@ static TCHAR *StrNormNewline(TCHAR *tszStr) if (!nCR)
return mir_tstrdup(tszStr);
- TCHAR *tszNewStr = (TCHAR *)mir_alloc((lstrlen(tszStr) + nCR + 1) * sizeof(TCHAR)), *ptszStr = tszNewStr;
+ TCHAR *tszNewStr = (TCHAR *)mir_alloc((mir_tstrlen(tszStr) + nCR + 1) * sizeof(TCHAR)), *ptszStr = tszNewStr;
while (*tszStr) {
if (*tszStr == 0x0A)
*ptszStr++ = 0x0D;
@@ -268,7 +268,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP TCHAR *tszMsg = StrNormNewline((TCHAR *)ack->lParam);
mir_sntprintf(msg, SIZEOF(msg), _T("%s"), tszMsg);
mir_free(tszMsg);
- size_t len = lstrlen(msg);
+ size_t len = mir_tstrlen(msg);
if (len) {
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
@@ -351,7 +351,7 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) char *szMsgURL = (char *)mir_alloc(i + 1);
if (szMsgURL) {
- lstrcpynA(szMsgURL, szURL, i + 1);
+ mir_strncpy(szMsgURL, szURL, i + 1);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)szMsgURL);
mir_free(szMsgURL);
}
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index d514176267..bbf0c7fcef 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -163,7 +163,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) if (i + 2 <= 1024 && msg[i + 2])
{
count++;
- MoveMemory(p, p + 1, (lstrlen(p) - 1) * sizeof(TCHAR));
+ MoveMemory(p, p + 1, (mir_tstrlen(p) - 1) * sizeof(TCHAR));
}
else
{
@@ -194,11 +194,11 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else
continue;
- if (lstrlen(ptszWinampTitle) > 12)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(ptszWinampTitle) - 12) * sizeof(TCHAR));
+ if (mir_tstrlen(ptszWinampTitle) > 12)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(ptszWinampTitle) - 12) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(ptszWinampTitle), msg + i + 12, (lstrlen(msg) - i - 11) * sizeof(TCHAR));
- CopyMemory(msg + i, ptszWinampTitle, lstrlen(ptszWinampTitle) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(ptszWinampTitle), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(TCHAR));
+ CopyMemory(msg + i, ptszWinampTitle, mir_tstrlen(ptszWinampTitle) * sizeof(TCHAR));
mir_free(ptszWinampTitle);
}
@@ -229,21 +229,21 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) }
else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, SIZEOF(substituteStr));
- if (lstrlen(substituteStr) > 6)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 6)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 6, (lstrlen(msg) - i - 5) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
else if (!_tcsnicmp(msg + i, _T("%date%"), 6))
{
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, SIZEOF(substituteStr));
- if (lstrlen(substituteStr) > 6)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 6)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 6, (lstrlen(msg) - i - 5) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
else if (!_tcsnicmp(msg+i, _T("%rand("), 6))
{
@@ -261,11 +261,11 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) mir_sntprintf(substituteStr, SIZEOF(substituteStr), _T("%d"), GetRandom(ran_from, ran_to));
for (k = i + 1; msg[k]; k++) if (msg[k] == '%') { k++; break; }
- if (lstrlen(substituteStr) > k - i)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - (k - i)) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > k - i)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - (k - i)) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + (k - i), (lstrlen(msg) - i - (k - i - 1)) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + (k - i), (mir_tstrlen(msg) - i - (k - i - 1)) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
mir_free(temp);
}
@@ -296,12 +296,12 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) db_free(&dbv);
continue;
}
- lstrcpy(substituteStr, dbv.ptszVal);
+ mir_tstrcpy(substituteStr, dbv.ptszVal);
db_free(&dbv);
}
else continue;
- if (!lstrlen(substituteStr)) continue;
+ if (!mir_tstrlen(substituteStr)) continue;
if (_tcsstr(substituteStr, _T("%randmsg%")) != NULL || _tcsstr(substituteStr, _T("%randdefmsg%")) != NULL)
{
if (k == maxk) maxk--;
@@ -309,13 +309,13 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else rmark[0] = TRUE;
}
- if (k2 == maxk || k2 > maxk) lstrcpy(substituteStr, _T(""));
+ if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, _T(""));
- if (lstrlen(substituteStr) > 9)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - 9) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 9)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 9) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 9, (lstrlen(msg) - i - 8) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 9, (mir_tstrlen(msg) - i - 8) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
else if (!_tcsnicmp(msg+i, _T("%randdefmsg%"), 12))
{
@@ -344,12 +344,12 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) db_free(&dbv);
continue;
}
- lstrcpy(substituteStr, dbv.ptszVal);
+ mir_tstrcpy(substituteStr, dbv.ptszVal);
db_free(&dbv);
}
else continue;
- if (!lstrlen(substituteStr)) continue;
+ if (!mir_tstrlen(substituteStr)) continue;
if (_tcsstr(substituteStr, _T("%randmsg%")) != NULL || _tcsstr(substituteStr, _T("%randdefmsg%")) != NULL)
{
if (k == maxk) maxk--;
@@ -357,24 +357,24 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else rmark[0] = TRUE;
}
- if (k2 == maxk || k2 > maxk) lstrcpy(substituteStr, _T(""));
+ if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, _T(""));
- if (lstrlen(substituteStr) > 12)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg)+1+lstrlen(substituteStr)-12) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 12)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg)+1+mir_tstrlen(substituteStr)-12) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 12, (lstrlen(msg) - i - 11) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
}
- if (count) msg[lstrlen(msg) - count] = 0;
+ if (count) msg[mir_tstrlen(msg) - count] = 0;
if (szProto)
{
char szSetting[80];
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", szProto);
len = db_get_w(NULL, "SimpleStatusMsg", szSetting, 1024);
- if (len < lstrlen(msg))
+ if (len < mir_tstrlen(msg))
{
msg = (TCHAR *)mir_realloc(msg, len * sizeof(TCHAR));
msg[len] = 0;
@@ -467,7 +467,7 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) void DBWriteMessage(char *szSetting, TCHAR *tszMsg)
{
- if (tszMsg && lstrlen(tszMsg))
+ if (tszMsg && mir_tstrlen(tszMsg))
db_set_ts(NULL, "SimpleStatusMsg", szSetting, tszMsg);
else
db_unset(NULL, "SimpleStatusMsg", szSetting);
@@ -1401,7 +1401,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d db_free(&dbv);
}
- if (tszMsg && lstrlen(tszMsg))
+ if (tszMsg && mir_tstrlen(tszMsg))
{
#ifdef _DEBUG
log2file("UpdateMsgTimerProc(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iCurrentStatus, ""), tszMsg, accounts->pa[i]->szModuleName);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 487d575ca8..f0b8941f09 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -335,7 +335,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", i); if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv)) { if (dbv.ptszVal) { - if (!lstrlen(dbv.ptszVal)) { + if (!mir_tstrlen(dbv.ptszVal)) { db_free(&dbv); continue; } @@ -472,7 +472,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) int len; GetMenuString(hmenu, m_selection, (LPTSTR)&item_string, 128, MF_BYCOMMAND); - len = lstrlen(item_string); + len = mir_tstrlen(item_string); if (len) { LPTSTR lptstrCopy; HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR)); @@ -722,7 +722,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv)) { if (dbv.pszVal && strlen(dbv.pszVal)) { if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2)) { - if (dbv2.ptszVal && lstrlen(dbv2.ptszVal)) { + if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal)) { SetDlgItemText(hwndDlg, IDC_EDIT1, dbv2.ptszVal); fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)dbv2.ptszVal); if (fcursel != CB_ERR) diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 5ad595fc8a..e6b48a54a3 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -138,7 +138,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
ptrT text( db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default")));
- lstrcpyn(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
+ mir_tstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
for (j = 0; j < accounts->count; j++)
{
@@ -150,7 +150,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L data->status_msg[j+1].flags[i-ID_STATUS_ONLINE] = val;
mir_snprintf(setting, SIZEOF(setting), "%sDefault", accounts->pa[j]->szModuleName);
text = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
- lstrcpyn(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
+ mir_tstrncpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
}
}
}
@@ -453,7 +453,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
+ if ((dbv2.ptszVal) && (mir_tstrlen(dbv2.ptszVal)))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
@@ -608,7 +608,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
}
@@ -708,7 +708,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
}
@@ -822,7 +822,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
}
@@ -901,7 +901,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
{
GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
- lstrcpy(data->status_msg[j].msg[i], msg);
+ mir_tstrcpy(data->status_msg[j].msg[i], msg);
}
}
break;
@@ -924,7 +924,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ mir_tstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
}
}
}
@@ -942,7 +942,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
- int len = lstrlen(data->proto_msg[j].msg);
+ int len = mir_tstrlen(data->proto_msg[j].msg);
if (len > 0)
{
if (data->proto_msg[k+1].msg == NULL)
@@ -970,7 +970,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
+ mir_tstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
}
}
}
@@ -997,7 +997,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
+ mir_tstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
}
}
break;
|