summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp5
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp5
-rw-r--r--plugins/TabSRMM/src/container.cpp2
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp107
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp24
-rw-r--r--plugins/TabSRMM/src/globals.cpp4
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp2
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp2
9 files changed, 73 insertions, 80 deletions
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index 73b9fcc1bd..5ce0ab9f9e 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -440,11 +440,6 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
}
else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname));
- char *szProto = GetContactProto(newData.hContact);
- WORD wStatus = (szProto == NULL) ? ID_STATUS_OFFLINE : db_get_w((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE);
- char *szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,
- (szProto == NULL) ? ID_STATUS_OFFLINE : db_get_w((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
-
newData.item.pszText = newcontactname;
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
newData.item.iImage = 0;
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 165af30def..f92e15b9a4 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -2062,11 +2062,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
dat->hTabIcon = dat->hTabStatusIcon;
if (dat->cache->getStatus() != dat->cache->getOldStatus()) {
+ _tcsncpy_s(dat->szStatus, SIZEOF(dat->szStatus), pcli->pfnGetStatusModeDescription(dat->wStatus, 0), _TRUNCATE);
+
TCITEM item = { 0 };
item.mask = TCIF_TEXT;
-
- lstrcpyn(dat->szStatus, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)dat->wStatus, GSMDF_TCHAR), 50);
- dat->szStatus[49] = 0;
item.pszText = dat->newtitle;
item.cchTextMax = 120;
TabCtrl_SetItem(hwndTab, dat->iTabID, &item);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 877b1d3804..ae938972e7 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -2513,7 +2513,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg)
nick = pcli->pfnGetContactDisplayName(hContact, 0);
mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i);
WORD wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0);
- szStatusText = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR);
+ szStatusText = pcli->pfnGetStatusModeDescription(wStatus, 0);
}
TCHAR szMenuLine[128];
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index 98bff873bf..cf6fb45ae4 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -761,67 +761,64 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced)
int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const TCHAR *szStatus, HANDLE hContact, DWORD fromEvent)
{
- if (PluginConfig.g_hMenuTrayUnread != 0 && hContact != 0 && szProto != NULL) {
- if (szProto == NULL)
- return 0; // should never happen...
-
- PROTOACCOUNT *acc = (PROTOACCOUNT *)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)szProto);
- TCHAR *tszFinalProto = (acc && acc->tszAccountName ? acc->tszAccountName : 0);
- if (tszFinalProto == 0)
- return 0; // should also NOT happen
-
- WORD wMyStatus = (wStatus == 0) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus;
- const TCHAR *szMyStatus = (szStatus == NULL) ? (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wMyStatus, GSMDF_TCHAR) : szStatus;
-
- MENUITEMINFO mii = {0};
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA | MIIM_ID | MIIM_BITMAP;
- mii.wID = (UINT)hContact;
- mii.hbmpItem = HBMMENU_CALLBACK;
-
- TCHAR szMenuEntry[80];
- const TCHAR *szNick = NULL;
- if (dat != 0) {
- szNick = dat->cache->getNick();
- GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
- mii.dwItemData++;
- if (fromEvent == 2) // from chat...
- mii.dwItemData |= 0x10000000;
- DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND);
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == NULL)
+ return 0;
+
+ PROTOACCOUNT *acc = (PROTOACCOUNT *)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)szProto);
+ TCHAR *tszFinalProto = (acc && acc->tszAccountName ? acc->tszAccountName : 0);
+ if (tszFinalProto == 0)
+ return 0;
+
+ WORD wMyStatus = (wStatus == 0) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus;
+ const TCHAR *szMyStatus = (szStatus == NULL) ? pcli->pfnGetStatusModeDescription(wMyStatus, 0) : szStatus;
+
+ MENUITEMINFO mii = { sizeof(mii) };
+ mii.fMask = MIIM_DATA | MIIM_ID | MIIM_BITMAP;
+ mii.wID = (UINT)hContact;
+ mii.hbmpItem = HBMMENU_CALLBACK;
+
+ TCHAR szMenuEntry[80];
+ const TCHAR *szNick = NULL;
+ if (dat != 0) {
+ szNick = dat->cache->getNick();
+ GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
+ mii.dwItemData++;
+ if (fromEvent == 2) // from chat...
+ mii.dwItemData |= 0x10000000;
+ DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND);
+ mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
+ PluginConfig.m_UnreadInTray++;
+ if (PluginConfig.m_UnreadInTray)
+ SetEvent(g_hEvent);
+ SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
+ }
+ else {
+ szNick = pcli->pfnGetContactDisplayName(hContact, 0);
+ if (CheckMenuItem(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == -1) {
+ mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
- PluginConfig.m_UnreadInTray++;
+ mii.dwItemData = fromEvent ? 1 : 0;
+ PluginConfig.m_UnreadInTray += (mii.dwItemData & 0x0000ffff);
if (PluginConfig.m_UnreadInTray)
SetEvent(g_hEvent);
- SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
+ if (fromEvent == 2)
+ mii.dwItemData |= 0x10000000;
}
else {
- szNick = pcli->pfnGetContactDisplayName(hContact, 0);
- if (CheckMenuItem(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == -1) {
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
- AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
- mii.dwItemData = fromEvent ? 1 : 0;
- PluginConfig.m_UnreadInTray += (mii.dwItemData & 0x0000ffff);
- if (PluginConfig.m_UnreadInTray)
- SetEvent(g_hEvent);
- if (fromEvent == 2)
- mii.dwItemData |= 0x10000000;
- }
- else {
- GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
- mii.dwItemData += (fromEvent ? 1 : 0);
- PluginConfig.m_UnreadInTray += (fromEvent ? 1 : 0);
- if (PluginConfig.m_UnreadInTray)
- SetEvent(g_hEvent);
- mii.fMask |= MIIM_STRING;
- if (fromEvent == 2)
- mii.dwItemData |= 0x10000000;
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
- mii.cch = lstrlen(szMenuEntry) + 1;
- mii.dwTypeData = (LPTSTR)szMenuEntry;
- }
- SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
+ GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
+ mii.dwItemData += (fromEvent ? 1 : 0);
+ PluginConfig.m_UnreadInTray += (fromEvent ? 1 : 0);
+ if (PluginConfig.m_UnreadInTray)
+ SetEvent(g_hEvent);
+ mii.fMask |= MIIM_STRING;
+ if (fromEvent == 2)
+ mii.dwItemData |= 0x10000000;
+ mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ mii.cch = lstrlen(szMenuEntry) + 1;
+ mii.dwTypeData = (LPTSTR)szMenuEntry;
}
+ SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
}
return 0;
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index dd136f9eb7..c874422d08 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1766,7 +1766,6 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
TCHAR newtitle[128];
TCHAR* pszNewTitleEnd;
TCHAR newcontactname[128];
- TCITEM item;
DWORD dwOldIdle = dat->idle;
const char* szActProto = 0;
HANDLE hActContact = 0;
@@ -1784,10 +1783,10 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
if (dat->iTabID == -1)
return;
- ZeroMemory((void*)&item, sizeof(item));
+ TCITEM item = { 0 };
+
if (dat->hContact) {
- TCHAR fulluin[256];
- const TCHAR* szNick = dat->cache->getNick();
+ const TCHAR *szNick = dat->cache->getNick();
if (dat->szProto) {
szActProto = dat->cache->getActiveProto();
@@ -1798,7 +1797,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
dat->dwFlagsEx = dat->idle ? dat->dwFlagsEx | MWF_SHOW_ISIDLE : dat->dwFlagsEx & ~MWF_SHOW_ISIDLE;
dat->wStatus = dat->cache->getStatus();
- mir_sntprintf(dat->szStatus, SIZEOF(dat->szStatus), _T("%s"), (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, GSMDF_TCHAR));
+ _tcsncpy_s(dat->szStatus, SIZEOF(dat->szStatus), pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
if (lParam != 0) {
if (PluginConfig.m_CutContactNameOnTabs)
@@ -1819,14 +1818,16 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
item.mask |= TCIF_TEXT;
}
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
+
+ TCHAR fulluin[256];
if (dat->bIsMeta)
mir_sntprintf(fulluin, SIZEOF(fulluin),
- TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nRight click for MetaContact control\nClick dropdown to add or remove user from your favorites."),
- bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
+ TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nRight click for MetaContact control\nClick dropdown to add or remove user from your favorites."),
+ bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
else
mir_sntprintf(fulluin, SIZEOF(fulluin),
- TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nClick dropdown to change this contact's favorite status."),
- bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
+ TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nClick dropdown to change this contact's favorite status."),
+ bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_TCHAR);
}
@@ -1853,10 +1854,11 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
UpdateTrayMenuState(dat, TRUE);
if (dat->cache->isFavorite())
AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus,
- LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 0, PluginConfig.g_hMenuFavorites);
+ LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 0, PluginConfig.g_hMenuFavorites);
+
if (dat->cache->isRecent())
AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus,
- LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 0, PluginConfig.g_hMenuRecent);
+ LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 0, PluginConfig.g_hMenuRecent);
dat->Panel->Invalidate();
if (dat->pWnd)
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 58493834fb..3d28031054 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -661,8 +661,8 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
TCHAR buffer[450];
- TCHAR *szOldStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wOldStatus, GSMDF_TCHAR);
- TCHAR *szNewStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus, GSMDF_TCHAR);
+ TCHAR *szOldStatus = pcli->pfnGetStatusModeDescription(wOldStatus, 0);
+ TCHAR *szNewStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
if (szOldStatus == 0 || szNewStatus == 0)
return;
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 7a5e3bdb72..6a4a2b5441 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -1659,7 +1659,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowText(hwndDlg, TranslateT("Choose status modes"));
{
for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- SetWindowText(GetDlgItem(hwndDlg, i), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, GSMDF_TCHAR));
+ SetWindowText(GetDlgItem(hwndDlg, i), pcli->pfnGetStatusModeDescription(i, GSMDF_TCHAR));
if (dwStatusMask != -1 && (dwStatusMask & (1 << (i - ID_STATUS_ONLINE))))
CheckDlgButton(hwndDlg, i, TRUE);
Utils::enableDlgControl(hwndDlg, i, dwStatusMask != -1);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 08a1407159..fa57f20786 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -713,7 +713,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, i
lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname));
WORD wStatus = (szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE));
- TCHAR *szStatus = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR);
+ TCHAR *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
if (M.GetByte("tabstatus", 1))
mir_sntprintf(tabtitle, SIZEOF(tabtitle), _T("%s (%s) "), newcontactname, szStatus);
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index 277c8fb887..6d38355acf 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -250,7 +250,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const
if (wStatus == 0)
wStatus = db_get_w((HANDLE)hContact, szProto, "Status", ID_STATUS_OFFLINE);
if (szStatus == NULL)
- szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR);
+ szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
}
else
return;