diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-10 15:13:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-10 15:13:20 +0000 |
commit | 45a5b1f9b7709f8d93b57abea7ba46b44eac5707 (patch) | |
tree | 03f5a5db7a5e8a951951710a3d383a936a14ce74 | |
parent | eb25a0d7ed0da6bd4630c553be933df5bd46b6b9 (diff) |
- MS_CLIST_GETSTATUSMODEDESCRIPTION replaced with the direct clist call
- crazy & obsolete constant GSMDF_PREFIXONLINE removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@6428 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
43 files changed, 209 insertions, 350 deletions
diff --git a/include/m_clist.h b/include/m_clist.h index df82559883..2636f2881b 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -60,8 +60,6 @@ extern int hLangpack; //lParam = flags, below
//returns a static buffer of the description of the given status mode
//returns NULL if the status mode was unknown
-#define GSMDF_PREFIXONLINE 1 //prefix "Online: " to all status modes that
- //imply online, eg "Online: Away"
#define GSMDF_UNICODE 2 //will return TCHAR* instead of char*
#if defined(_UNICODE)
#define GSMDF_TCHAR GSMDF_UNICODE //will return TCHAR* instead of char*
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index 95046f8922..cf7babd781 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -74,7 +74,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) CheckDlgButton(hwndDlg,IDC_MAINOPT_TRAYICON,(g_wMask & OPT_TRAYICON) ? (BST_CHECKED) : (BST_UNCHECKED));
for (int i = ID_STATUS_OFFLINE;i <= ID_STATUS_OUTTOLUNCH; i++)
- SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_INSERTSTRING, -1, (LPARAM) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,i,GSMDF_TCHAR));
+ SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, i, GSMDF_TCHAR));
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, db_get_b(NULL, MOD_NAME, "stattype", 2), 0);
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 935024308a..f668e70a9b 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -453,8 +453,7 @@ static int OptionsInit(WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
{
time_t tmpTime;
@@ -462,12 +461,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar tmpTime = getLastSeen((HANDLE)lparam);
if (tmpTime == -1)
SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, TranslateT("not detected"));
- else
- {
- /*
- int status = db_get_w((HANDLE)lparam, MODULE_NAME, "LastStatus", ID_STATUS_OFFLINE);
- char *strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, 0);
- */
+ else {
_tcsftime(tmpBuf, 50, _T("%#x"), gmtime(&tmpTime));
SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, tmpBuf);
}
@@ -475,8 +469,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar tmpTime = getLastInputMsg((HANDLE)lparam);
if (tmpTime == -1)
SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, TranslateT("not found"));
- else
- {
+ else {
_tcsftime(tmpBuf, 50, _T("%#x"), gmtime(&tmpTime));
SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, tmpBuf);
}
@@ -487,20 +480,15 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar SetDlgItemInt(hdlg, IDC_EDITABSENCE, AbsencePeriod, FALSE);
if (isContactGoneFor((HANDLE)lparam, options.iAbsencePeriod2))
- {
SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, TranslateT("This contact has been absent for an extended period of time."));
- }
else
- {
SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, _T(""));
- }
SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
TranslateDialogDefault(hdlg);
-
return TRUE;
}
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index e9ae405c35..dd8ecdaa3d 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -310,19 +310,16 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus }
// Get Status name
- {
- TCHAR *tmp = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)nStatus, GSMDF_TCHAR);
- lstrcpyn(text, tmp, text_size);
- //CopySkipUnprintableChars(text, dbv.pszVal, text_size-1);
- if (text[0] != '\0')
- return 1;
+ TCHAR *tmp = pcli->pfnGetStatusModeDescription(nStatus, 0);
+ if (tmp && *tmp) {
+ _tcsncpy_s(text, text_size, tmp, _TRUNCATE);
+ return 1;
}
// Get XStatusName
if ( !noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
- //lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 433c219aa9..f2f8a77b0c 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -268,7 +268,7 @@ static int FillDialog(HWND hwnd) {
LVITEM item = {0};
item.mask = LVIF_TEXT;
- item.pszText = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, GSMDF_TCHAR);
+ item.pszText = pcli->pfnGetStatusModeDescription(i, 0);
item.iItem = i - ID_STATUS_OFFLINE;
newItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index c2203a4417..46120e83d1 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -802,7 +802,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ConfigureCLUIGeometry(0);
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- statusNames[i - ID_STATUS_OFFLINE] = reinterpret_cast<TCHAR *>(CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, GSMDF_TCHAR));
+ statusNames[i-ID_STATUS_OFFLINE] = pcli->pfnGetStatusModeDescription(i, 0);
//delay creation of CLC so that it can get the status icons right the first time (needs protocol modules loaded)
if (cfg::dat.bLayeredHack) {
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 8e373e9138..d6e5939c86 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -210,29 +210,27 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) iIcon = IconFromStatusMode(dbv.pszVal, (int) wStatus, 0, &hIcon);
}
mir_free(dbv.pszVal);
- } else {
+ }
+ else {
wStatus = maxStatus;
iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : NULL, (int) wStatus, 0, &hIcon);
g_maxStatus = (int)wStatus;
- if (szMaxProto) {
- lstrcpynA(g_maxProto, szMaxProto, 100);
- g_maxProto[99] = 0;
- }
+ if (szMaxProto)
+ strncpy_s(g_maxProto, SIZEOF(g_maxProto), szMaxProto, _TRUNCATE);
}
+
/*
* this is used globally (actually, by the clist control only) to determine if
* any protocol is "in connection" state. If true, then the clist discards redraws
* and uses timer based sort and redraw handling. This can improve performance
* when connecting multiple protocols significantly.
*/
- //g_isConnecting = (wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE);
- szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) wStatus, GSMDF_TCHAR);
+ szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
/*
* set the global status icon and display the global (most online) status mode on the
* status mode button
*/
-
if (szStatus && pcli->hwndContactList) {
HWND hwndClistBtn = GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS);
if ( IsWindow(hwndClistBtn)) {
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 98ac8c008e..33014a64f7 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -152,25 +152,24 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM for (int i = 0; i < nParts; i++) {
RECT rc;
SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc);
- if (PtInRect(&rc,pt)) {
+ if ( PtInRect(&rc,pt)) {
ProtocolData *PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0);
- if (PD) {
- if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event
- tooltip_active = TRUE;
- else if (cfg::getDword("mToolTip", "ShowStatusTip", 0)) {
- CLCINFOTIP ti = {0};
- BYTE isLocked = 0;
- char szTipText[256], *szStatus = NULL;
- WORD wStatus;
-
- ti.cbSize = sizeof(ti);
- ti.isTreeFocused = GetFocus() == pcli->hwndContactList ? 1 : 0;
- wStatus = (WORD)CallProtoService(PD->RealName, PS_GETSTATUS, 0, 0);
- isLocked = cfg::getByte(PD->RealName, "LockMainStatus", 0);
- szStatus = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus, 0);
- mir_snprintf(szTipText, 256, "<b>%s</b>: %s%s", PD->RealName, szStatus, isLocked ? " (LOCKED)" : "");
- CallService("mToolTip/ShowTip", (WPARAM)szTipText, (LPARAM)&ti);
- }
+ if (PD == NULL)
+ continue;
+
+ if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event
+ tooltip_active = TRUE;
+ else if (cfg::getDword("mToolTip", "ShowStatusTip", 0)) {
+ WORD wStatus = (WORD)CallProtoService(PD->RealName, PS_GETSTATUS, 0, 0);
+ BYTE isLocked = cfg::getByte(PD->RealName, "LockMainStatus", 0);
+
+ TCHAR szTipText[256];
+ mir_sntprintf(szTipText, SIZEOF(szTipText), _T("<b>%s</b>: %s%s"),
+ PD->RealName, pcli->pfnGetStatusModeDescription(wStatus, 0), isLocked ? _T(" (LOCKED)") : _T(""));
+
+ CLCINFOTIP ti = { sizeof(ti) };
+ ti.isTreeFocused = (GetFocus() == pcli->hwndContactList);
+ CallService("mToolTip/ShowTipW", (WPARAM)szTipText, (LPARAM)&ti);
}
break;
}
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 3ea740882e..c33fbb9b15 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -172,7 +172,7 @@ static int FillDialog(HWND hwnd) {
LVCOLUMN lvc = {0};
HWND hwndList = GetDlgItem(hwnd, IDC_PROTOCOLS);
- LVITEMA item = {0};
+ LVITEM item = {0};
int protoCount = 0, i;
PROTOACCOUNT **accs = 0;
@@ -187,38 +187,32 @@ static int FillDialog(HWND hwnd) ProtoEnumAccounts( &protoCount, &accs );
item.mask = LVIF_TEXT;
item.iItem = 1000;
- for (i = 0; i < protoCount; i++) {
- item.pszText = accs[i]->szModuleName;
- SendMessageA(hwndList, LVM_INSERTITEMA, 0, (LPARAM)&item);
+ for (i=0; i < protoCount; i++) {
+ item.pszText = accs[i]->tszAccountName;
+ ListView_InsertItem(hwndList, &item);
}
ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP);
// fill groups
- {
- hwndList = GetDlgItem(hwnd, IDC_GROUPS);
+ hwndList = GetDlgItem(hwnd, IDC_GROUPS);
- ListView_SetExtendedListViewStyle(hwndList, LVS_EX_CHECKBOXES);
- lvc.mask = LVCF_FMT;
- lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
- ListView_InsertColumn(hwndList, 0, &lvc);
+ ListView_SetExtendedListViewStyle(hwndList, LVS_EX_CHECKBOXES);
+ lvc.mask = LVCF_FMT;
+ lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
+ ListView_InsertColumn(hwndList, 0, &lvc);
- LVITEM item = {0};
- item.mask = LVIF_TEXT;
- item.iItem = 1000;
+ item.pszText = TranslateT("Ungrouped contacts");
+ SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
- item.pszText = TranslateT("Ungrouped contacts");
+ TCHAR *grpName;
+ for (i = 1; (grpName = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) {
+ item.pszText = grpName;
SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
-
- TCHAR *grpName;
- for (i = 1; (grpName = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) {
- item.pszText = grpName;
- SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
- }
- ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
- ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP);
}
+ ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
+ ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP);
hwndList = GetDlgItem(hwnd, IDC_STATUSMODES);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_CHECKBOXES);
@@ -228,9 +222,9 @@ static int FillDialog(HWND hwnd) ListView_InsertColumn(hwndList, 0, &lvc);
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- item.pszText = Translate((char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, 0));
+ item.pszText = TranslateTS(pcli->pfnGetStatusModeDescription(i, 0));
item.iItem = i - ID_STATUS_OFFLINE;
- SendMessageA(hwndList, LVM_INSERTITEMA, 0, (LPARAM)&item);
+ ListView_InsertItem(hwndList, &item);
}
ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP);
diff --git a/plugins/CmdLine/src/commonheaders.h b/plugins/CmdLine/src/commonheaders.h index eb64fbed2a..becf33539c 100644 --- a/plugins/CmdLine/src/commonheaders.h +++ b/plugins/CmdLine/src/commonheaders.h @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
+#include <malloc.h>
#include <time.h>
#include "newpluginapi.h"
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 18c39570e7..b0cf21c1ca 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -339,70 +339,20 @@ int ParseValueParam(char *param, void *&result) int ParseStatusParam(char *status)
{
- int res = 0;
- char lower[256];
- STRNCPY(lower, status, sizeof(lower));
+ char *lower = NEWSTR_ALLOCA(status);
+ _strlwr(lower);
- if (strcmp(lower, "offline") == 0)
- {
- res = ID_STATUS_OFFLINE;
- }
- else{
- if (strcmp(lower, "online") == 0)
- {
- res = ID_STATUS_ONLINE;
- }
- else{
- if (strcmp(lower, "away") == 0)
- {
- res = ID_STATUS_AWAY;
- }
- else{
- if (strcmp(lower, "dnd") == 0)
- {
- res = ID_STATUS_DND;
- }
- else{
- if (strcmp(lower, "na") == 0)
- {
- res = ID_STATUS_NA;
- }
- else{
- if (strcmp(lower, "occupied") == 0)
- {
- res = ID_STATUS_OCCUPIED;
- }
- else{
- if (strcmp(lower, "freechat") == 0)
- {
- res = ID_STATUS_FREECHAT;
- }
- else{
- if (strcmp(lower, "invisible") == 0)
- {
- res = ID_STATUS_INVISIBLE;
- }
- else{
- if (strcmp(lower, "onthephone") == 0)
- {
- res = ID_STATUS_ONTHEPHONE;
- }
- else{
- if (strcmp(lower, "outtolunch") == 0)
- {
- res = ID_STATUS_OUTTOLUNCH;
- }//outtolunch
- }//onthephone
- }//invisible
- }//freechat
- }//occupied
- }//na
- } //dnd
- } //away
- } //online
- } //offline
-
- return res;
+ if ( !strcmp(lower, "offline")) return ID_STATUS_OFFLINE;
+ if ( !strcmp(lower, "online")) return ID_STATUS_ONLINE;
+ if ( !strcmp(lower, "away")) return ID_STATUS_AWAY;
+ if ( !strcmp(lower, "dnd")) return ID_STATUS_DND;
+ if ( !strcmp(lower, "na")) return ID_STATUS_NA;
+ if ( !strcmp(lower, "occupied")) return ID_STATUS_OCCUPIED;
+ if ( !strcmp(lower, "freechat")) return ID_STATUS_FREECHAT;
+ if ( !strcmp(lower, "invisible")) return ID_STATUS_INVISIBLE;
+ if ( !strcmp(lower, "onthephone")) return ID_STATUS_ONTHEPHONE;
+ if ( !strcmp(lower, "outtolunch")) return ID_STATUS_OUTTOLUNCH;
+ return 0;
}
char *PrettyStatusMode(int status, char *buffer, int size)
@@ -410,9 +360,7 @@ char *PrettyStatusMode(int status, char *buffer, int size) *buffer = 0;
char *data = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0);
if (data)
- {
STRNCPY(buffer, data, size);
- }
return buffer;
}
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 6490407faf..45ef5f7d02 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -109,11 +109,6 @@ char *GetContactUID(HANDLE hContact, int bTchar) return null_strdup(szUid);
}
-TCHAR* MirandaStatusToStringT(int mirandaStatus)
-{
- return (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, GSMDF_UNICODE);
-}
-
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv)
{
return db_get_s(hContact, szModule, szSetting, dbv, 0);
@@ -188,7 +183,7 @@ void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, char* pszTitleStart) if (strcmpT(uid?uid:contactName, oldTitle))
SetDlgItemTextT(hwndDlg, IDC_NAME, uid?uid:contactName);
- szStatus = MirandaStatusToStringT(szProto==NULL ? ID_STATUS_OFFLINE:db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE));
+ szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE), 0);
mir_sntprintf(newtitle, 256, "%s %s (%s)", SRCTranslateT(pszTitleStart, str), contactName, szStatus);
SAFE_FREE((void**)&uid);
diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index cc21980207..adb29ff1fd 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -35,7 +35,6 @@ char* __fastcall null_strdup(const char *string); char *GetContactUID(HANDLE hContact, int bTchar);
TCHAR *GetContactDisplayNameT(HANDLE hContact);
-TCHAR* MirandaStatusToStringT(int mirandaStatus);
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv);
TCHAR* DBGetContactSettingStringT(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef);
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index a8a7963966..98a10c53f0 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -389,13 +389,12 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) DBVARIANT dbv;
TCHAR *title;
bool bFree = false;
- if (db_get_ts(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal)
- {
+ if (db_get_ts(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal) {
char *proto = GetContactProto(hContact);
int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
- title = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
- } else
- {
+ title = pcli->pfnGetStatusModeDescription(status, 0);
+ }
+ else {
title = dbv.ptszVal;
bFree = true;
}
@@ -639,7 +638,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) bool bFree = false;
if (db_get_ts(hContact, "CList", "StatusMsg", &dbv) || !*dbv.ptszVal) {
int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
- title = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
+ title = pcli->pfnGetStatusModeDescription(status, 0);
}
else {
title = dbv.ptszVal;
diff --git a/plugins/MetaContacts/src/meta_options.cpp b/plugins/MetaContacts/src/meta_options.cpp index a64b36b891..a2e63ef375 100644 --- a/plugins/MetaContacts/src/meta_options.cpp +++ b/plugins/MetaContacts/src/meta_options.cpp @@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hw, CB_RESETCONTENT, 0, 0);
if (index == -1) {
for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, i, GCDNF_TCHAR));
+ index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pcli->pfnGetStatusModeDescription(i, 0));
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
}
}
@@ -522,7 +522,7 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
if (caps & Proto_Status2Flag(i)) {
- index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, i, GCDNF_TCHAR));
+ index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pcli->pfnGetStatusModeDescription(i, 0));
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
}
}
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index 79eb2d3f1c..66579ce31f 100755 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -722,19 +722,17 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) strcpy(buffer, "StatusString");
strcat(buffer, _itoa(contact_number, szId, 10));
- TCHAR *szStatus = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)dcws->value.wVal, GSMDF_TCHAR);
- db_set_ts(hMeta, META_PROTO, buffer, szStatus);
+ db_set_ts(hMeta, META_PROTO, buffer, pcli->pfnGetStatusModeDescription(dcws->value.wVal, 0));
// if the contact was forced, unforce it (which updates status)
- if ((HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) {
+ if ((HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam)
MetaAPI_UnforceSendContact((WPARAM)hMeta, 0);
- } else {
+ else {
// set status to that of most online contact
most_online = Meta_GetMostOnline(hMeta);
Meta_CopyContactNick(hMeta, most_online);
Meta_FixStatus(hMeta);
-
Meta_CopyData(hMeta);
}
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp index 11e273e11a..1a5998f574 100644 --- a/plugins/MetaContacts/src/meta_utils.cpp +++ b/plugins/MetaContacts/src/meta_utils.cpp @@ -314,7 +314,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) strcpy(buffer, "StatusString");
strcat(buffer, szId);
- TCHAR *szStatus = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR);
+ TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
db_set_ts(dest, META_PROTO, buffer, szStatus);
// Write the link in the contact
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index fd6aa4bb05..431447fbc6 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1111,8 +1111,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wStatus = db_get_w( dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
// log status change - should be moved to a separate place
if (dat->wStatus != wStatus && db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) {
- ptrT szOldStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR)));
- ptrT szNewStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) wStatus, GSMDF_TCHAR)));
+ ptrT szOldStatus( mir_tstrdup( pcli->pfnGetStatusModeDescription(dat->wStatus, 0)));
+ ptrT szNewStatus( mir_tstrdup( pcli->pfnGetStatusModeDescription(wStatus, 0)));
int iLen;
TCHAR buffer[512];
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 89df28fcc6..3261e4f48d 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -61,8 +61,7 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) if (hContact && szProto) {
tokens[0] = GetNickname(hContact, szProto);
tokenLen[0] = lstrlen(tokens[0]);
- tokens[1] = mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto ?
- db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, GSMDF_TCHAR));
+ tokens[1] = mir_tstrdup( pcli->pfnGetStatusModeDescription(szProto ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, 0));
tokenLen[1] = lstrlen(tokens[1]);
tokens[2] = db_get_tsa(hContact, "CList", "StatusMsg");
if (tokens[2] != NULL) {
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 2b518913d1..8fcef3f0ad 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -105,7 +105,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP TCHAR *contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)dat->hContact, GCDNF_TCHAR);
char *szProto = GetContactProto(dat->hContact);
WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
- TCHAR *status = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dwStatus, GSMDF_TCHAR);
+ TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
GetWindowText(hwndDlg, format, SIZEOF(format));
mir_sntprintf(str, SIZEOF(str), format, status, contactName);
@@ -388,7 +388,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) iHidden = 0;
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
clmi.hIcon = LoadSkinnedProtoIcon(szProto, iStatus);
- mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s Message"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iStatus, GSMDF_TCHAR));
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s Message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
clmi.ptszName = str;
}
}
@@ -414,7 +414,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) if (db_get_b(NULL, "SimpleStatusMsg", "ShowCopy", 1) && szMsg && *szMsg != '\0') {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
- mir_sntprintf(str, SIZEOF(str), TranslateT("Copy %s Message"), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iStatus, GSMDF_TCHAR));
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Copy %s Message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
clmi.ptszName = str;
}
}
@@ -424,7 +424,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) if (!iHidden) {
if (db_get_b(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) && StrFindURL(szMsg) != NULL) {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
- mir_sntprintf(str, SIZEOF(str), TranslateT("&Go to URL in %s Message"), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iStatus, GSMDF_TCHAR));
+ mir_sntprintf(str, SIZEOF(str), TranslateT("&Go to URL in %s Message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
clmi.ptszName = str;
}
mir_free(szMsg);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index a35c7c6a63..ad4e67970f 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -155,7 +155,7 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) {
if ((Proto_Status2Flag(ID_STATUS_OFFLINE + i) & data->m_iStatusModes) || i == 0)
{
- status_desc = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, ID_STATUS_OFFLINE + i, GSMDF_TCHAR);
+ status_desc = pcli->pfnGetStatusModeDescription(ID_STATUS_OFFLINE + i, 0);
cbei.iItem = j;
cbei.pszText = (LPTSTR)status_desc;
cbei.cchTextMax = sizeof(status_desc);
@@ -869,8 +869,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("%s Message (%s)"), (TCHAR*)buff, szProtoName);
}
- else
- mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("%s Message (%s)"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iStatus, GSMDF_TCHAR), szProtoName);
+ else mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("%s Message (%s)"), pcli->pfnGetStatusModeDescription(iStatus, 0), szProtoName);
SetWindowText(hwndDlg, szTitle);
if (iStatus == ID_STATUS_CURRENT)
@@ -997,8 +996,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA else
mir_sntprintf(szTitle, SIZEOF(szTitle), szFormat, TranslateT("<current>"), szProtoName);
}
- else
- mir_sntprintf(szTitle, SIZEOF(szTitle), szFormat, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, init_data->m_iStatus, GSMDF_TCHAR), szProtoName);
+ else mir_sntprintf(szTitle, SIZEOF(szTitle), szFormat, pcli->pfnGetStatusModeDescription(init_data->m_iStatus, 0), szProtoName);
SetWindowText(hwndDlg, szTitle);
int icoStatus = ID_STATUS_OFFLINE;
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index d17b66b39d..b2f5004e12 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -127,7 +127,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (accounts->statusMsgFlags & Proto_Status2Flag(i))
{
- index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, i, GSMDF_TCHAR));
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)pcli->pfnGetStatusModeDescription(i, 0));
if (index != CB_ERR && index != CB_ERRSPACE)
{
int j;
@@ -389,8 +389,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L int index;
if (status_modes & Proto_Status2Flag(l))
{
- index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
-
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)pcli->pfnGetStatusModeDescription(l, 0));
if (index != CB_ERR && index != CB_ERRSPACE)
{
SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_ONLINE);
@@ -1595,7 +1594,7 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa {
if (status_modes & Proto_Status2Flag(l) || l == ID_STATUS_OFFLINE)
{
- index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)pcli->pfnGetStatusModeDescription(l, 0));
if (index != LB_ERR && index != LB_ERRSPACE)
{
SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_OFFLINE);
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 2093489499..8220db57cb 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -70,7 +70,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if ( !( protoModeMsgFlags & Proto_Status2Flag( statusModeList[i] )))
continue;
- int j = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING,0,(LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,statusModeList[i],GSMDF_TCHAR));
+ int j = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(statusModeList[i], 0));
SendDlgItemMessage( hwndDlg, IDC_STATUS, CB_SETITEMDATA, j, statusModeList[i] );
settings = ( AAMSGSETTING** )realloc(settings, (count+1)*sizeof(AAMSGSETTING*));
settings[count] = ( AAMSGSETTING* )malloc(sizeof(AAMSGSETTING));
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index 329b83a986..9eb70c5307 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -136,8 +136,8 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM {
for ( int i=0; i < optionSettings->getCount(); i++ ) {
TAAAProtoSetting& p = (*optionSettings)[i];
- int item = SendDlgItemMessage( hwndDlg, IDC_PROTOCOL, CB_ADDSTRING, 0, ( LPARAM )p.tszAccName );
- SendDlgItemMessage( hwndDlg, IDC_PROTOCOL, CB_SETITEMDATA, item, (LPARAM)&p );
+ int item = SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)p.tszAccName );
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_SETITEMDATA, item, (LPARAM)&p );
}
}
// set cursor to first protocol
@@ -178,9 +178,9 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM else
flags = 0;
for(i=0;i<sizeof(statusModeList)/sizeof(statusModeList[0]);i++) {
- if ((flags&statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE) || (bSettingSame)) {
- lvItem.pszText = ( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, statusModeList[i], GSMDF_TCHAR );
- lvItem.lParam = ( LPARAM )statusModePf2List[i];
+ if ((flags&statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE) || (bSettingSame)) {
+ lvItem.pszText = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
+ lvItem.lParam = (LPARAM)statusModePf2List[i];
ListView_InsertItem(hList,&lvItem);
ListView_SetCheckState(hList, lvItem.iItem, setting->statusFlags&statusModePf2List[i]?TRUE:FALSE);
lvItem.iItem++;
@@ -202,11 +202,11 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_RESETCONTENT, 0, 0);
for ( i=0; i < SIZEOF(statusModeList); i++ ) {
if ( (flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame ) {
- TCHAR *statusMode = ( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, statusModeList[i], GSMDF_TCHAR );
- item = SendDlgItemMessage(hwndDlg,IDC_LV1STATUS,CB_ADDSTRING,0,(LPARAM)statusMode);
- item = SendDlgItemMessage(hwndDlg,IDC_LV2STATUS,CB_ADDSTRING,0,(LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg,IDC_LV1STATUS,CB_SETITEMDATA,item,(LPARAM)statusModeList[i]);
- SendDlgItemMessage(hwndDlg,IDC_LV2STATUS,CB_SETITEMDATA,item,(LPARAM)statusModeList[i]);
+ TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
+ item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
+ item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
+ SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
+ SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
if (statusModeList[i] == setting->lv1Status) {
SendDlgItemMessage(hwndDlg,IDC_LV1STATUS,CB_SETCURSEL,(WPARAM)item,0);
@@ -229,9 +229,8 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM setting->lv1Status = (int)SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_GETCURSEL, 0, 0), 0);
{
TCHAR setNaStr[256];
- mir_sntprintf(setNaStr, SIZEOF(setNaStr), TranslateT("minutes of %s mode"),
- CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, setting->lv1Status, GSMDF_TCHAR ));
- SetDlgItemText(hwndDlg,IDC_SETNASTR,setNaStr);
+ mir_sntprintf(setNaStr, SIZEOF(setNaStr), TranslateT("minutes of %s mode"), pcli->pfnGetStatusModeDescription(setting->lv1Status, 0));
+ SetDlgItemText(hwndDlg, IDC_SETNASTR, setNaStr);
}
break;
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 5e9ad4e953..1e710ba312 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -950,9 +950,8 @@ static int ProcessPopup(int reason, LPARAM lParam) PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX **)lParam;
for (int i = 0; i < connectionSettings.getCount(); i++)
if (_tcslen(ps[i]->tszAccName) > 0 && strlen(ps[i]->szName) > 0)
- if ( db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE))
- {
- mir_sntprintf(protoInfoLine, SIZEOF(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)ps[i]->status, GSMDF_TCHAR));
+ if ( db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
+ mir_sntprintf(protoInfoLine, SIZEOF(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, GSMDF_TCHAR));
_tcsncat(protoInfo, protoInfoLine, SIZEOF(protoInfo) - _tcslen(protoInfo)-1);
}
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 63394872ca..6da11df8f7 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -128,40 +128,33 @@ static char* GetCMDL(TSettingsList& protoSettings) /////////////////////////////////////////////////////////////////////////////////////////
// Link processing
-static char* GetLinkDescription(TSettingsList& protoSettings)
+static TCHAR* GetLinkDescription(TSettingsList& protoSettings)
{
if ( protoSettings.getCount() == 0 )
return NULL;
- char *pnt, *desc;
- pnt = desc = ( char* )malloc(strlen(SHORTCUT_DESC) + 1);
- strcpy(desc, SHORTCUT_DESC);
- pnt = desc + strlen(desc);
- for ( int i=0; i < protoSettings.getCount(); i++ ) {
- char szName[128];
- CallProtoService(protoSettings[i].szName, PS_GETNAME, sizeof(szName), (LPARAM)szName );
-
- char* status;
- if ( protoSettings[i].status == ID_STATUS_LAST )
- status = Translate("<last>");
- else if ( protoSettings[i].status == ID_STATUS_CURRENT )
- status = Translate("<current>");
- else if ( protoSettings[i].status >= MIN_STATUS && protoSettings[i].status <= MAX_STATUS )
- status = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)protoSettings[i].status, 0);
+ CMString result( _T(SHORTCUT_DESC));
+ for (int i=0; i < protoSettings.getCount(); i++) {
+ TSSSetting &p = protoSettings[i];
+
+ TCHAR *status;
+ if ( p.status == ID_STATUS_LAST)
+ status = TranslateT("<last>");
+ else if (p.status == ID_STATUS_CURRENT)
+ status = TranslateT("<current>");
+ else if (p.status >= MIN_STATUS && p.status <= MAX_STATUS )
+ status = pcli->pfnGetStatusModeDescription(p.status, 0);
if (status == NULL)
- status = "<unknown>";
-
- desc = ( char* )realloc(desc, strlen(desc) + strlen(szName) + strlen(status) + 4);
- pnt = desc + strlen(desc);
- *pnt++ = '\r';
- strcpy(pnt, szName);
- pnt += strlen(szName);
- *pnt++ = ':';
- *pnt++ = ' ';
- strcpy(pnt, status);
+ status = TranslateT("<unknown>");
+
+ result.AppendChar('\r');
+ result.Append(p.tszAccName);
+ result.AppendChar(':');
+ result.AppendChar(' ');
+ result.Append(status);
}
- return desc;
+ return mir_tstrndup(result, result.GetLength());
}
HRESULT CreateLink(TSettingsList& protoSettings)
@@ -170,7 +163,7 @@ HRESULT CreateLink(TSettingsList& protoSettings) IShellLink* psl;
TCHAR savePath[MAX_PATH];
char *args = GetCMDLArguments(protoSettings);
- char *desc = GetLinkDescription(protoSettings);
+ TCHAR *desc = GetLinkDescription(protoSettings);
if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
_tcscat(savePath, _T(SHORTCUT_FILENAME));
@@ -185,13 +178,8 @@ HRESULT CreateLink(TSettingsList& protoSettings) TCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, SIZEOF(path));
psl->SetPath(path);
-
- TCHAR* p = mir_a2t( desc );
- psl->SetDescription( p );
- mir_free( p );
- p = mir_a2t( args );
- psl->SetArguments( p );
- mir_free( p );
+ psl->SetDescription(desc);
+ psl->SetArguments( _A2T(args));
// Query IShellLink for the IPersistFile interface for saving the
// shortcut in persistent storage.
@@ -628,13 +616,12 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_RESETCONTENT, 0, 0);
for ( int i=0; i < SIZEOF(statusModeList); i++ ) {
if ( (flags&statusModePf2List[i]) || (statusModeList[i] == ID_STATUS_OFFLINE)) {
- TCHAR* szStatus = ( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, statusModeList[i], GSMDF_TCHAR);
- if ( szStatus != NULL ) {
- int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_ADDSTRING, 0, (LPARAM)szStatus);
- SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETITEMDATA, (WPARAM)item, (LPARAM)statusModeList[i]);
- if (ps->status == statusModeList[i])
- SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETCURSEL, (WPARAM)item, 0);
- } } }
+ int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(statusModeList[i], 0));
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETITEMDATA, (WPARAM)item, (LPARAM)statusModeList[i]);
+ if (ps->status == statusModeList[i])
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETCURSEL, (WPARAM)item, 0);
+ }
+ }
int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_ADDSTRING, 0, (LPARAM)TranslateT("<current>"));
SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETITEMDATA, (WPARAM)item, (LPARAM)ID_STATUS_CURRENT);
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index f7ab3e1b92..817fed7cc1 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -31,8 +31,8 @@ struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject
{
- TSSSetting( PROTOACCOUNT* pa );
- TSSSetting( int profile, PROTOACCOUNT* pa );
+ TSSSetting(PROTOACCOUNT *pa);
+ TSSSetting(int profile, PROTOACCOUNT *pa);
~TSSSetting();
};
diff --git a/plugins/StatusPlugins/commonstatus.h b/plugins/StatusPlugins/commonstatus.h index 9cd3eeb508..b04e095f21 100644 --- a/plugins/StatusPlugins/commonstatus.h +++ b/plugins/StatusPlugins/commonstatus.h @@ -38,6 +38,7 @@ #include <m_protosvc.h>
#include <m_clist.h>
#include <m_clistint.h>
+#include <m_string.h>
#include <m_langpack.h>
#include <m_popup.h>
#include <m_variables.h>
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index 5a0c1f5b41..33271696fb 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -68,10 +68,8 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam {
TCHAR desc[ 512 ];
- mir_sntprintf(desc, SIZEOF(desc),
- TranslateT("Set %s message for %s."),
- CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, GetActualStatus(protoSetting), GSMDF_TCHAR ),
- protoSetting->tszAccName );
+ mir_sntprintf(desc, SIZEOF(desc), TranslateT("Set %s message for %s."),
+ pcli->pfnGetStatusModeDescription(GetActualStatus(protoSetting), 0), protoSetting->tszAccName);
SetDlgItemText(hwndDlg, IDC_DESCRIPTION, desc);
}
break;
@@ -121,13 +119,13 @@ static int SetStatusList(HWND hwndDlg) ListView_InsertItem(hList,&lvItem);
int actualStatus;
- switch( (*confirmSettings)[i].status ) {
+ switch((*confirmSettings)[i].status) {
case ID_STATUS_LAST: actualStatus = (*confirmSettings)[i].lastStatus; break;
case ID_STATUS_CURRENT: actualStatus = CallProtoService((*confirmSettings)[i].szName,PS_GETSTATUS, 0, 0); break;
default: actualStatus = (*confirmSettings)[i].status;
}
- TCHAR* status = ( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, actualStatus, GSMDF_TCHAR );
- switch( (*confirmSettings)[i].status ) {
+ TCHAR* status = pcli->pfnGetStatusModeDescription(actualStatus, 0);
+ switch((*confirmSettings)[i].status) {
case ID_STATUS_LAST:
mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<last>"), status);
ListView_SetItemText(hList, lvItem.iItem, 1, buf);
@@ -271,9 +269,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA // LAST STATUS
if (proto->status == ID_STATUS_LAST) {
TCHAR last[80];
- mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"),
- TranslateT("<last>"),
- CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->lastStatus, GSMDF_TCHAR ));
+ mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, last);
actualStatus = proto->lastStatus;
}
@@ -282,14 +278,11 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA else if (proto->status == ID_STATUS_CURRENT) {
int currentStatus = CallProtoService(proto->szName,PS_GETSTATUS, 0, 0);
TCHAR current[80];
- mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"),
- TranslateT("<current>"),
- CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, currentStatus, GSMDF_TCHAR ));
+ mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, current);
actualStatus = currentStatus;
}
- else ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1,
- ( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR ));
+ else ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, pcli->pfnGetStatusModeDescription(proto->status, 0));
if ((!((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
@@ -351,7 +344,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA // last
TCHAR buf[100];
- mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, GSMDF_TCHAR));
+ mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
int item = SendDlgItemMessage( hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf );
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_LAST);
if (proto->status == ID_STATUS_LAST) {
@@ -361,23 +354,21 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA // current
int currentStatus = CallProtoService(proto->szName,PS_GETSTATUS, 0, 0);
- mir_sntprintf( buf, SIZEOF(buf), _T("%s (%s)"),
- TranslateT("<current>"),
- CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, currentStatus, GSMDF_TCHAR));
- item = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING, 0, (LPARAM)buf);
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETITEMDATA, item, ID_STATUS_CURRENT);
+ mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
+ item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf);
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_CURRENT);
if (proto->status == ID_STATUS_CURRENT) {
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL, item, 0);
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, item, 0);
actualStatus = currentStatus;
}
for (int i=0; i < SIZEOF(statusModeList); i++) {
if ( ((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags) & Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
- TCHAR* statusMode = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, statusModeList[i], GSMDF_TCHAR);
- item = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING, 0, (LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETITEMDATA, item, statusModeList[i]);
+ TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
+ item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, statusModeList[i]);
if (statusModeList[i] == proto->status)
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL, item, 0);
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, item, 0);
}
}
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index be07a9d47a..bc9340ee16 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -132,10 +132,7 @@ TCHAR* getContactInfoT(BYTE type, HANDLE hContact) return mir_a2t(protoname);
case CCNF_STATUS:
- return mir_tstrdup((TCHAR*)CallService(
- MS_CLIST_GETSTATUSMODEDESCRIPTION,
- db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE),
- GSMDF_UNICODE));
+ return mir_tstrdup((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), GSMDF_UNICODE));
case CCNF_INTERNALIP:
case CCNF_EXTERNALIP:
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 63b5c14735..b506525aaa 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -647,20 +647,17 @@ retry: TCHAR strFmt1[64];
TCHAR strFmt2[64];
- mir_sntprintf(strFmt2, SIZEOF(strFmt2), _T("%s"), (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status_gg2m(atoi(__status)), GSMDF_TCHAR));
- if (__city)
- {
+ _tcsncpy_s(strFmt2, SIZEOF(strFmt2), pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
+ if (__city) {
mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %s"), TranslateT("City:"), __city);
_tcsncat(strFmt2, strFmt1, SIZEOF(strFmt2) - _tcslen(strFmt2));
}
- if (__birthyear)
- {
+ if (__birthyear) {
time_t t = time(NULL);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
- if (br < (lt->tm_year + 1900) && br > 1900)
- {
+ if (br < (lt->tm_year + 1900) && br > 1900) {
mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %d"), TranslateT("Age:"), (lt->tm_year + 1900) - br);
_tcsncat(strFmt2, strFmt1, SIZEOF(strFmt2) - _tcslen(strFmt2));
}
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index a78fc38822..86f422c26a 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -283,11 +283,11 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_LEAVESTATUS), IsDlgButtonChecked(hwndDlg, IDC_LEAVESTATUSMSG));
EnableWindow(GetDlgItem(hwndDlg, IDC_IMGMETHOD), IsDlgButtonChecked(hwndDlg, IDC_IMGRECEIVE));
SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Last Status>")); // 0
- SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,ID_STATUS_ONLINE,GSMDF_TCHAR));
- SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,ID_STATUS_AWAY,GSMDF_TCHAR));
- SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,ID_STATUS_DND,GSMDF_TCHAR));
- SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,ID_STATUS_FREECHAT,GSMDF_TCHAR));
- SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,ID_STATUS_INVISIBLE,GSMDF_TCHAR));
+ SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_ONLINE, 0));
+ SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_AWAY, 0));
+ SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_DND, 0));
+ SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_FREECHAT, 0));
+ SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_INVISIBLE, 0));
switch(gg->getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) {
case ID_STATUS_ONLINE:
SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_SETCURSEL, 1, 0);
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index b6baeda2d0..44c285c446 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -400,8 +400,8 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) #endif
}
- if (capLen)
- { // Update the contact's capabilies if present in packet
+ if (capLen) {
+ // Update the contact's capabilies if present in packet
SetCapabilitiesFromBuffer(hContact, capBuf, capLen, wOldStatus == ID_STATUS_OFFLINE);
char *szCurrentClient = wOldStatus == ID_STATUS_OFFLINE ? NULL : getSettingStringUtf(hContact, "MirVer", NULL);
@@ -412,8 +412,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) szClient = (const char*)-1;
SAFE_FREE(&szCurrentClient);
}
- else if (wOldStatus == ID_STATUS_OFFLINE)
- {
+ else if (wOldStatus == ID_STATUS_OFFLINE) {
// Remove the contact's capabilities if coming from offline
ClearAllContactCapabilities(hContact);
@@ -422,11 +421,8 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, NULL, wVersion, dwFT1, dwFT2, dwFT3, nTCPFlag, dwDirectConnCookie, dwWebPort, NULL, capLen, &bClientId, szStrBuf);
}
- else
- {
- // Capabilities not present in update packet, do not touch
+ else // Capabilities not present in update packet, do not touch
szClient = (const char*)-1; // we don't want to client be overwritten
- }
// handle Xtraz status
char *moodData = NULL;
@@ -445,8 +441,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) ClearContactCapabilities(hContact, CAPF_STATUS_MESSAGES);
#ifdef _DEBUG
- if (wOldStatus == ID_STATUS_OFFLINE)
- {
+ if (wOldStatus == ID_STATUS_OFFLINE) {
if (CheckContactCapabilities(hContact, CAPF_SRV_RELAY))
NetLog_Server("Supports advanced messages");
else
@@ -454,8 +449,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) }
#endif
- if (!nIsICQ)
- {
+ if (!nIsICQ) {
// AIM clients does not advertise these, but do support them
SetContactCapabilities(hContact, CAPF_UTF | CAPF_TYPING);
// Server relayed messages are only supported by ICQ clients
@@ -465,8 +459,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) NetLog_Server("Logged in with AIM client");
}
- if (nIsICQ && wVersion < 8)
- {
+ if (nIsICQ && wVersion < 8) {
ClearContactCapabilities(hContact, CAPF_SRV_RELAY);
if (wOldStatus == ID_STATUS_OFFLINE)
NetLog_Server("Forcing simple messages due to compability issues");
@@ -486,8 +479,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) disposeChain(&pChain);
// Save contacts details in database
- if (hContact != NULL)
- {
+ if (hContact != NULL) {
setDword(hContact, "LogonTS", dwOnlineSince);
setDword(hContact, "AwayTS", dwAwaySince);
setDword(hContact, "IdleTS", tIdleTS);
@@ -495,39 +487,35 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) if (dwMemberSince)
setDword(hContact, "MemberTS", dwMemberSince);
- if (nIsICQ)
- { // on AIM these are not used
+ if (nIsICQ) {
+ // on AIM these are not used
setDword(hContact, "DirectCookie", dwDirectConnCookie);
setByte(hContact, "DCType", (BYTE)nTCPFlag);
setWord(hContact, "UserPort", (WORD)(dwPort & 0xffff));
setWord(hContact, "Version", wVersion);
}
- else
- {
+ else {
delSetting(hContact, "DirectCookie");
delSetting(hContact, "DCType");
delSetting(hContact, "UserPort");
delSetting(hContact, "Version");
}
+ // if no detection, set uknown
if (!szClient)
- {
- // if no detection, set uknown
szClient = (nIsICQ ? "Unknown" : "Unknown AIM");
- }
- if (szClient != (char*)-1)
- {
+
+ if (szClient != (char*)-1) {
db_set_utf(hContact, m_szModuleName, "MirVer", szClient);
setByte(hContact, "ClientID", bClientId);
}
- if (wOldStatus == ID_STATUS_OFFLINE)
- {
+ if (wOldStatus == ID_STATUS_OFFLINE) {
setDword(hContact, "IP", dwIP);
setDword(hContact, "RealIP", dwRealIP);
}
- else
- { // if not first notification only write significant information
+ else {
+ // if not first notification only write significant information
if (dwIP)
setDword(hContact, "IP", dwIP);
if (dwRealIP)
@@ -536,34 +524,33 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) setWord(hContact, "Status", (WORD)IcqStatusToMiranda(wStatus));
// Update info?
- if (dwUIN)
- { // check if the local copy of user details is up-to-date
+ if (dwUIN) {
+ // check if the local copy of user details is up-to-date
if (IsMetaInfoChanged(hContact))
icq_QueueUser(hContact);
}
}
- if (wOldStatus != IcqStatusToMiranda(wStatus))
- { // And a small log notice... if status was changed
+ LPCTSTR ptszStatus = pcli->pfnGetStatusModeDescription(IcqStatusToMiranda(wStatus), 0);
+ if (wOldStatus != IcqStatusToMiranda(wStatus)) {
+ // And a small log notice... if status was changed
if (nIsICQ)
- NetLog_Server("%u changed status to %s (v%d).", dwUIN, MirandaStatusToString(IcqStatusToMiranda(wStatus)), wVersion);
+ NetLog_Server("%u changed status to %S (v%d).", dwUIN, ptszStatus, wVersion);
else
- NetLog_Server("%s changed status to %s.", strUID(dwUIN, szUID), MirandaStatusToString(IcqStatusToMiranda(wStatus)));
+ NetLog_Server("%s changed status to %S.", strUID(dwUIN, szUID), ptszStatus);
}
#ifdef _DEBUG
- else
- {
+ else {
if (nIsICQ)
- NetLog_Server("%u has status %s (v%d).", dwUIN, MirandaStatusToString(IcqStatusToMiranda(wStatus)), wVersion);
+ NetLog_Server("%u has status %s (v%d).", dwUIN, ptszStatus, wVersion);
else
- NetLog_Server("%s has status %s.", strUID(dwUIN, szUID), MirandaStatusToString(IcqStatusToMiranda(wStatus)));
+ NetLog_Server("%s has status %s.", strUID(dwUIN, szUID), ptszStatus);
}
#endif
- if (szClient == cliSpamBot)
- {
- if (getByte("KillSpambots", DEFAULT_KILLSPAM_ENABLED) && db_get_b(hContact, "CList", "NotOnList", 0))
- { // kill spammer
+ if (szClient == cliSpamBot) {
+ if (getByte("KillSpambots", DEFAULT_KILLSPAM_ENABLED) && db_get_b(hContact, "CList", "NotOnList", 0)) {
+ // kill spammer
icq_DequeueUser(dwUIN);
icq_sendRemoveContact(dwUIN, NULL);
AddToSpammerList(dwUIN);
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 9f212cd271..7b6e87cf40 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -210,14 +210,9 @@ default: return nSupportedStatus;
}
-char *MirandaStatusToString(int mirandaStatus)
-{
- return (char*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, 0);
-}
-
-char *MirandaStatusToStringUtf(int mirandaStatus)
+char* MirandaStatusToStringUtf(int mirandaStatus)
{ // return miranda status description in utf-8, use unicode service is possible
- return tchar_to_utf8((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, GSMDF_TCHAR));
+ return tchar_to_utf8( pcli->pfnGetStatusModeDescription(mirandaStatus, 0));
}
char** CIcqProto::MirandaStatusToAwayMsg(int nStatus)
diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index de1274081b..336c0e8a8a 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -58,7 +58,6 @@ void icq_ShowMultipleControls(HWND hwndDlg, const UINT* controls, int cControls, int IcqStatusToMiranda(WORD wStatus);
WORD MirandaStatusToIcq(int nStatus);
int MirandaStatusToSupported(int nMirandaStatus);
-char *MirandaStatusToString(int);
char *MirandaStatusToStringUtf(int);
int AwayMsgTypeToStatus(int nMsgType);
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index efaddcfd34..ca07b67f0a 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -3,6 +3,7 @@ LIST<CMraProto> g_Instances(1, PtrKeySortT);
MRA_SETTINGS masMraSettings;
+CLIST_INTERFACE *pcli;
int hLangpack;
PLUGININFOEX pluginInfoEx = {
@@ -79,6 +80,7 @@ static int OnPreShutdown(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
+ mir_getCLI();
IconsLoad();
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index cf8a474842..b5ef8016e5 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -42,6 +42,7 @@ #include <m_system_cpp.h>
#include <m_protocols.h>
#include <m_clist.h>
+#include <m_clistint.h>
#include <m_cluiframes.h>
#include <m_clui.h>
#include <m_genmenu.h>
@@ -222,9 +223,6 @@ CMStringA MraGetSelfVersionString(); #define GetContactNameA(Contact) (LPSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)Contact, 0)
#define GetContactNameW(Contact) (LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)Contact, GCDNF_UNICODE)
-#define GetStatusModeDescriptionA(Status) (LPSTR)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)Status, 0)
-#define GetStatusModeDescriptionW(Status) (LPWSTR)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)Status, GSMDF_UNICODE)
-
#define SetBit(bytes, bitpos) bytes |= (1<<bitpos)
#define GetBit(bytes, bitpos) ((bytes&(1<<bitpos))? TRUE:FALSE)
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index e57266d7a8..23f9a039ae 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -390,7 +390,7 @@ bool CMraProto::CmdHelloAck(BinBuffer &buf) mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatusMir);
mraGetStringW(NULL, szValueName, wszStatusDesc);
}
- else wszStatusTitle = GetStatusModeDescriptionW(m_iDesiredStatus);
+ else wszStatusTitle = pcli->pfnGetStatusModeDescription(m_iDesiredStatus, 0);
CMStringA szSelfVersionString = MraGetSelfVersionString();
if ( !mraGetStringA(NULL, "MirVerCustom", szUserAgentFormatted))
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 48295be603..fa41da557a 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -880,7 +880,7 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C else wszStatusDesc = pwszStatusDesc;
}
else if (pwszStatusTitle.IsEmpty())
- wszStatusTitle = GetStatusModeDescriptionW(dwStatusMir);
+ wszStatusTitle = pcli->pfnGetStatusModeDescription(dwStatusMir, 0);
MraChangeStatus(dwStatus, lpcszStatusUri[dwXStatus], wszStatusTitle, wszStatusDesc, ((getByte("RTFReceiveEnable", MRA_DEFAULT_RTF_RECEIVE_ENABLE)? FEATURE_FLAG_RTF_MESSAGE:0)|MRA_FEATURE_FLAGS));
return 0;
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index e7f96840f9..07e8a80b28 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -24,6 +24,7 @@ HINSTANCE hInstance; HANDLE g_hNetlibUser;
+CLIST_INTERFACE *pcli;
int hLangpack;
PLUGININFOEX pluginInfo={
@@ -96,6 +97,7 @@ static int yahooProtoUninit( CYahooProto* ppro ) extern "C" int __declspec(dllexport)Load(void)
{
mir_getLP( &pluginInfo );
+ mir_getCLI();
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "YAHOO";
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 4769e91e22..22dfba71f1 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -420,7 +420,7 @@ int __cdecl CYahooProto::SetApparentMode( HANDLE hContact, int mode ) int __cdecl CYahooProto::SetStatus( int iNewStatus )
{
- LOG(("[SetStatus] New status %s", (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iNewStatus, 0)));
+ LOG(("[SetStatus] New status %S", pcli->pfnGetStatusModeDescription(iNewStatus, 0)));
if (iNewStatus == ID_STATUS_OFFLINE) {
@@ -609,7 +609,7 @@ int __cdecl CYahooProto::SetAwayMsg( int status, const PROTOCHAR* msg ) {
char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL;
- DebugLog("[YahooSetAwayMessage] Status: %s, Msg: %s",(char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0), (char*) c);
+ DebugLog("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c);
if (!m_bLoggedIn) {
if (m_iStatus == ID_STATUS_OFFLINE) {
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 7cd7556918..397f655ad2 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -71,9 +71,9 @@ void CYahooProto::BroadcastStatus(int s) m_iStatus = ID_STATUS_ONLINE;
}
- DebugLog("[yahoo_util_broadcaststatus] Old Status: %s (%d), New Status: %s (%d)",
- NEWSTR_ALLOCA((char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, oldStatus, 0)), oldStatus,
- NEWSTR_ALLOCA((char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, m_iStatus, 0)), m_iStatus);
+ DebugLog("[yahoo_util_broadcaststatus] Old Status: %S (%d), New Status: %S (%d)",
+ pcli->pfnGetStatusModeDescription(oldStatus, 0), oldStatus,
+ pcli->pfnGetStatusModeDescription(m_iStatus, 0), m_iStatus);
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, (LPARAM)m_iStatus);
}
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 025f3dfff7..ab43e226aa 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -108,13 +108,8 @@ TCHAR* fnGetStatusModeDescription(int mode, int flags) }
return NULL;
}
- if (noPrefixReqd || !(flags & GSMDF_PREFIXONLINE))
- return (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr);
- lstrcpy(szMode, TranslateT("Online"));
- lstrcat(szMode, _T(": "));
- lstrcat(szMode, (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr));
- return szMode;
+ return (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr);
}
static INT_PTR GetStatusModeDescription(WPARAM wParam, LPARAM lParam)
|