diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-09 15:00:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-09 15:00:10 +0000 |
commit | ad0169e0110232390474d23274bdc5dc2d385a9a (patch) | |
tree | 244d8c2a7d6d9db8d5fc2562003f4aec3d053c8a | |
parent | a23d6936522260197b5b3b13e468c1cddd6d8ed8 (diff) |
- unused variables wiped out of tabSRMM
- enhanced mc support
git-svn-id: http://svn.miranda-ng.org/main/trunk@8503 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/TabSRMM/src/contactcache.cpp | 118 | ||||
-rw-r--r-- | plugins/TabSRMM/src/contactcache.h | 59 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 34 | ||||
-rw-r--r-- | plugins/TabSRMM/src/infopanel.cpp | 11 | ||||
-rw-r--r-- | plugins/TabSRMM/src/mim.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.cpp | 42 | ||||
-rw-r--r-- | plugins/TabSRMM/src/utils.cpp | 6 |
10 files changed, 115 insertions, 168 deletions
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 2f9451f2ec..605a3bcfa2 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -40,17 +40,14 @@ static OBJLIST<CContactCache> arContacts(50, NumericKeySortT); CContactCache::CContactCache(const MCONTACT hContact)
{
m_hContact = hContact;
- m_wOldStatus = m_wStatus = m_wMetaStatus = ID_STATUS_OFFLINE;
+ m_wOldStatus = m_wStatus = ID_STATUS_OFFLINE;
if (hContact) {
m_szProto = ::GetContactProto(m_hContact);
- if (m_szProto)
- m_tszProto = mir_a2t(m_szProto);
initPhaseTwo();
}
else {
m_szProto = C_INVALID_PROTO;
- m_tszProto = C_INVALID_PROTO_T;
m_szAccount = C_INVALID_ACCOUNT;
m_isMeta = false;
m_Valid = false;
@@ -81,7 +78,6 @@ void CContactCache::initPhaseTwo() }
else {
m_szProto = C_INVALID_PROTO;
- m_tszProto = C_INVALID_PROTO_T;
m_szAccount = C_INVALID_ACCOUNT;
m_isMeta = false;
}
@@ -96,7 +92,6 @@ void CContactCache::resetMeta() m_isMeta = false;
m_szMetaProto = 0;
m_hSubContact = 0;
- m_tszMetaProto[0] = 0;
initPhaseTwo();
}
@@ -131,7 +126,7 @@ bool CContactCache::updateNick() fChanged = (_tcscmp(m_szNick, tszNick) ? true : false);
mir_sntprintf(m_szNick, 80, _T("%s"), tszNick ? tszNick : _T("<undef>"));
}
- return(fChanged);
+ return fChanged;
}
/**
@@ -155,24 +150,13 @@ bool CContactCache::updateStatus() */
void CContactCache::updateMeta(bool fForce)
{
- if (m_Valid) {
- MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)m_hContact, 0);
- if (hSubContact && (hSubContact != m_hSubContact || fForce)) {
- m_hSubContact = hSubContact;
- m_szMetaProto = GetContactProto(m_hSubContact);
- if (m_szMetaProto) {
- PROTOACCOUNT *acc = reinterpret_cast<PROTOACCOUNT *>(::CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)m_szMetaProto));
- if (acc && acc->tszAccountName)
- m_szAccount = acc->tszAccountName;
- m_wMetaStatus = db_get_w(m_hSubContact, m_szMetaProto, "Status", ID_STATUS_OFFLINE);
- MultiByteToWideChar(CP_ACP, 0, m_szMetaProto, -1, m_tszMetaProto, 40);
- m_tszMetaProto[39] = 0;
- }
- else {
- m_wMetaStatus = ID_STATUS_OFFLINE;
- m_tszMetaProto[0] = 0;
- }
- }
+ if (!m_Valid)
+ return;
+
+ MCONTACT hSubContact = CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)m_hContact, 0);
+ if (hSubContact && (hSubContact != m_hSubContact || fForce)) {
+ m_hSubContact = hSubContact;
+ m_szMetaProto = GetContactProto(m_hSubContact);
}
}
@@ -408,25 +392,19 @@ void CContactCache::allocHistory() */
void CContactCache::releaseAlloced()
{
- int i;
-
if (m_stats) {
delete m_stats;
m_stats = 0;
}
if (m_history) {
- for (i=0; i <= m_iHistorySize; i++) {
- if (m_history[i].szText != 0) {
- mir_free(m_history[i].szText);
- }
- }
+ for (int i = 0; i <= m_iHistorySize; i++)
+ mir_free(m_history[i].szText);
+
mir_free(m_history);
m_history = 0;
}
- if ( lstrcmp( m_tszProto, C_INVALID_PROTO_T ))
- mir_free(m_tszProto);
- m_tszProto = NULL;
+
mir_free(m_szStatusMsg);
m_szStatusMsg = NULL;
}
@@ -463,10 +441,6 @@ void CContactCache::updateFavorite() */
void CContactCache::updateStatusMsg(const char *szKey)
{
- DBVARIANT dbv = {0};
- BYTE bStatusMsgValid = 0;
- INT_PTR res = 0;
-
if (!m_Valid)
return;
@@ -474,31 +448,25 @@ void CContactCache::updateStatusMsg(const char *szKey) if (m_szStatusMsg)
mir_free(m_szStatusMsg);
m_szStatusMsg = 0;
- res = db_get_ts(m_hContact, "CList", "StatusMsg", &dbv);
- if (res == 0) {
- m_szStatusMsg = (lstrlen(dbv.ptszVal) > 0 ? getNormalizedStatusMsg(dbv.ptszVal) : 0);
- db_free(&dbv);
- }
+ ptrT szStatus(db_get_tsa(m_hContact, "CList", "StatusMsg"));
+ if (szStatus != 0)
+ m_szStatusMsg = (lstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : 0);
}
if (szKey == 0 || (szKey && !strcmp("ListeningTo", szKey))) {
if (m_ListeningInfo)
mir_free(m_ListeningInfo);
m_ListeningInfo = 0;
- res = db_get_ts(m_hContact, m_szProto, "ListeningTo", &dbv);
- if (res == 0) {
- m_ListeningInfo = (lstrlen(dbv.ptszVal) > 0 ? mir_tstrdup(dbv.ptszVal) : 0);
- db_free(&dbv);
- }
+ ptrT szListeningTo(db_get_tsa(m_hContact, m_szProto, "ListeningTo"));
+ if (szListeningTo != 0 && *szListeningTo)
+ m_ListeningInfo = szListeningTo.detouch();
}
if (szKey == 0 || (szKey && !strcmp("XStatusMsg", szKey))) {
if (m_xStatusMsg)
mir_free(m_xStatusMsg);
m_xStatusMsg = 0;
- res = db_get_ts(m_hContact, m_szProto, "XStatusMsg", &dbv);
- if (res == 0) {
- m_xStatusMsg = (lstrlen(dbv.ptszVal) > 0 ? mir_tstrdup(dbv.ptszVal) : 0);
- db_free(&dbv);
- }
+ ptrT szXStatusMsg(db_get_tsa(m_hContact, m_szProto, "XStatusMsg"));
+ if (szXStatusMsg != 0 && *szXStatusMsg)
+ m_xStatusMsg = szXStatusMsg.detouch();
}
m_xStatus = db_get_b(m_hContact, m_szProto, "XStatusId", 0);
}
@@ -587,7 +555,7 @@ TCHAR* CContactCache::getNormalizedStatusMsg(const TCHAR *src, bool fStripAll) _tcscpy(tszResult, dest.c_str());
tszResult[dest.length()] = 0;
}
- return(tszResult);
+ return tszResult;
}
/**
@@ -595,29 +563,23 @@ TCHAR* CContactCache::getNormalizedStatusMsg(const TCHAR *src, bool fStripAll) */
HICON CContactCache::getIcon(int& iSize) const
{
- HICON hIcon;
-
- if (m_dat && m_hwnd) {
- if (m_dat->dwFlags & MWF_ERRORSTATE)
- hIcon = PluginConfig.g_iconErr;
- else if (m_dat->mayFlashTab)
- hIcon = m_dat->iFlashIcon;
- else {
- if (m_dat->si && m_dat->iFlashIcon) {
- int sizeX, sizeY;
-
- hIcon = m_dat->iFlashIcon;
- Utils::getIconSize(hIcon, sizeX, sizeY);
- iSize = sizeX;
- } else if (m_dat->hTabIcon == m_dat->hTabStatusIcon && m_dat->hXStatusIcon)
- hIcon = m_dat->hXStatusIcon;
- else
- hIcon = m_dat->hTabIcon;
- }
+ if (!m_dat || !m_hwnd)
+ return LoadSkinnedProtoIcon(m_szProto, m_wStatus);
+
+ if (m_dat->dwFlags & MWF_ERRORSTATE)
+ return PluginConfig.g_iconErr;
+ if (m_dat->mayFlashTab)
+ return m_dat->iFlashIcon;
+
+ if (m_dat->si && m_dat->iFlashIcon) {
+ int sizeX, sizeY;
+ Utils::getIconSize(m_dat->iFlashIcon, sizeX, sizeY);
+ iSize = sizeX;
+ return m_dat->iFlashIcon;
}
- else
- hIcon = LoadSkinnedProtoIcon(m_szProto, m_wStatus);
- return(hIcon);
+ if (m_dat->hTabIcon == m_dat->hTabStatusIcon && m_dat->hXStatusIcon)
+ return m_dat->hXStatusIcon;
+ return m_dat->hTabIcon;
}
int CContactCache::getMaxMessageLength()
@@ -642,5 +604,5 @@ int CContactCache::getMaxMessageLength() m_nMax = 20000;
}
}
- return(m_nMax);
+ return m_nMax;
}
diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 46212cd706..193acb8ec9 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -71,40 +71,35 @@ struct CContactCache : public MZeroedObject releaseAlloced();
}
- const bool isValid() const { return(m_Valid); }
- const WORD getStatus() const { return(m_wStatus); }
- const WORD getMetaStatus() const { return(m_wMetaStatus); }
- const WORD getActiveStatus() const { return(m_isMeta ? m_wMetaStatus : m_wStatus); }
- const WORD getOldStatus() const { return(m_wOldStatus); }
- const TCHAR* getNick() const { return(m_szNick); }
- const MCONTACT getContact() const { return(m_hContact); }
- const MCONTACT getActiveContact() const { return(m_isMeta ? (m_hSubContact ? m_hSubContact : m_hContact) : m_hContact); }
- const DWORD getIdleTS() const { return(m_idleTS); }
- const char* getProto() const { return(m_szProto); }
- const TCHAR* getProtoT() const { return(m_tszProto); }
- const char* getMetaProto() const { return(m_szMetaProto ? m_szMetaProto : C_INVALID_PROTO); }
- const TCHAR* getMetaProtoT() const { return(m_szMetaProto ? m_tszMetaProto : C_INVALID_PROTO_T); }
- const char* getActiveProto() const { return(m_isMeta ? (m_szMetaProto ? m_szMetaProto : m_szProto) : m_szProto); }
- const TCHAR* getActiveProtoT() const { return(m_isMeta ? (m_szMetaProto ? m_tszMetaProto : m_tszProto) : m_tszProto); }
- bool isMeta() const { return(m_isMeta); }
- bool isSubContact() const { return(m_isSubcontact); }
- bool isFavorite() const { return(m_isFavorite); }
- bool isRecent() const { return(m_isRecent); }
- const TCHAR* getRealAccount() const { return(m_szAccount ? m_szAccount : C_INVALID_ACCOUNT); }
- const TCHAR* getUIN() const { return(m_szUIN); }
- const TCHAR* getStatusMsg() const { return(m_szStatusMsg); }
- const TCHAR* getXStatusMsg() const { return(m_xStatusMsg); }
- const TCHAR* getListeningInfo() const { return(m_ListeningInfo); }
- BYTE getXStatusId() const { return(m_xStatus); }
- const HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return(m_hwnd); }
- const HWND getHwnd() const { return(m_hwnd); }
+ const bool isValid() const { return m_Valid; }
+ const WORD getStatus() const { return m_wStatus; }
+ const WORD getActiveStatus() const { return m_wStatus; }
+ const WORD getOldStatus() const { return m_wOldStatus; }
+ const TCHAR* getNick() const { return m_szNick; }
+ const MCONTACT getContact() const { return m_hContact; }
+ const MCONTACT getActiveContact() const { return m_isMeta ? (m_hSubContact ? m_hSubContact : m_hContact) : m_hContact; }
+ const DWORD getIdleTS() const { return m_idleTS; }
+ const char* getProto() const { return m_szProto; }
+ const char* getActiveProto() const { return m_isMeta ? (m_szMetaProto ? m_szMetaProto : m_szProto) : m_szProto; }
+ bool isMeta() const { return m_isMeta; }
+ bool isSubContact() const { return m_isSubcontact; }
+ bool isFavorite() const { return m_isFavorite; }
+ bool isRecent() const { return m_isRecent; }
+ const TCHAR* getRealAccount() const { return m_szAccount ? m_szAccount : C_INVALID_ACCOUNT; }
+ const TCHAR* getUIN() const { return m_szUIN; }
+ const TCHAR* getStatusMsg() const { return m_szStatusMsg; }
+ const TCHAR* getXStatusMsg() const { return m_xStatusMsg; }
+ const TCHAR* getListeningInfo() const { return m_ListeningInfo; }
+ BYTE getXStatusId() const { return m_xStatus; }
+ const HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return m_hwnd; }
+ const HWND getHwnd() const { return m_hwnd; }
int getMaxMessageLength();
- TWindowData* getDat() const { return(m_dat); }
+ TWindowData* getDat() const { return m_dat; }
void updateStats(int iType, size_t value = 0);
- const DWORD getSessionStart() const { return(m_stats->started); }
- const int getSessionMsgCount() const { return((int)m_stats->messageCount); }
+ const DWORD getSessionStart() const { return m_stats->started; }
+ const int getSessionMsgCount() const { return (int)m_stats->messageCount; }
////////////////////////////////////////////////////////////////////////////
@@ -139,10 +134,8 @@ private: MCONTACT m_hContact;
MCONTACT m_hSubContact;
- WORD m_wStatus, m_wMetaStatus;
- WORD m_wOldStatus;
+ WORD m_wStatus, m_wOldStatus;
char* m_szProto, *m_szMetaProto;
- TCHAR* m_tszProto, m_tszMetaProto[40];
TCHAR* m_szAccount;
TCHAR m_szNick[80], m_szUIN[80];
TCHAR* m_szStatusMsg, *m_xStatusMsg, *m_ListeningInfo;
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 22dfafc9f1..1c66b5294b 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1703,7 +1703,7 @@ panel_found: {
TWindowData *dat = (TWindowData*)wParam;
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
- HICON hIconBig = (dat && dat->cache) ? LoadSkinnedProtoIconBig(dat->cache->getActiveProto(), dat->cache->getActiveStatus()) : 0;
+ HICON hIconBig = (dat && dat->cache) ? LoadSkinnedProtoIconBig(dat->cache->getProto(), dat->cache->getStatus()) : 0;
if (Win7Taskbar->haveLargeIcons()) {
if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING] || (HICON)lParam == hIconMsg) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 0bca9aa4cd..decc0c712d 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -307,7 +307,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, case IDC_SMILEYBTN:
if (dat->doSmileys && PluginConfig.g_SmileyAddAvail) {
MCONTACT hContact = dat->cache->getActiveContact();
- if (CheckValidSmileyPack(dat->cache->getActiveProto(), hContact) != 0) {
+ if (CheckValidSmileyPack(dat->cache->getProto(), hContact) != 0) {
SMADD_SHOWSEL3 smaddInfo = {0};
if (lParam == 0)
@@ -318,7 +318,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
smaddInfo.targetMessage = EM_REPLACESEL;
smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = const_cast<char *>(dat->cache->getActiveProto());
+ smaddInfo.Protocolname = const_cast<char *>(dat->cache->getProto());
smaddInfo.Direction = 0;
smaddInfo.xPosition = rc.left;
smaddInfo.yPosition = rc.top + 24;
@@ -430,7 +430,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, switch(iSelection) {
case ID_FAVORITES_ADDCONTACTTOFAVORITES:
db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 1);
- AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getActiveProto(), dat->szStatus, dat->wStatus, LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 1, PluginConfig.g_hMenuFavorites);
+ AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getProto(), dat->szStatus, dat->wStatus, LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()), 1, PluginConfig.g_hMenuFavorites);
break;
case ID_FAVORITES_REMOVECONTACTFROMFAVORITES:
db_set_b(dat->hContact, SRMSGMOD_T, "isFavorite", 0);
@@ -1801,22 +1801,18 @@ void TSAPI DM_HandleAutoSizeRequest(TWindowData *dat, REQRESIZE* rr) void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
- TCHAR newtitle[128];
- TCHAR* pszNewTitleEnd;
- TCHAR newcontactname[128];
- DWORD dwOldIdle = dat->idle;
- const char* szActProto = 0;
-
- HWND hwndDlg = dat->hwnd;
- HWND hwndTab = GetParent(hwndDlg);
- HWND hwndContainer = dat->pContainer->hwnd;
+ TCHAR newtitle[128], newcontactname[128];
+ DWORD dwOldIdle = dat->idle;
+ const char *szActProto = 0;
+
+ HWND hwndDlg = dat->hwnd;
+ HWND hwndTab = GetParent(hwndDlg);
+ HWND hwndContainer = dat->pContainer->hwnd;
TContainerData* m_pContainer = dat->pContainer;
- ZeroMemory(newcontactname, sizeof(newcontactname));
+ newcontactname[0] = 0;
dat->szStatus[0] = 0;
- pszNewTitleEnd = _T("Message Session");
-
if (dat->iTabID == -1)
return;
@@ -1826,7 +1822,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) const TCHAR *szNick = dat->cache->getNick();
if (dat->szProto) {
- szActProto = dat->cache->getActiveProto();
+ szActProto = dat->cache->getProto();
MCONTACT hActContact = dat->hContact;
bool bHasName = (dat->cache->getUIN()[0] != 0);
@@ -1869,7 +1865,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_TCHAR);
}
}
- else lstrcpyn(newtitle, pszNewTitleEnd, SIZEOF(newtitle));
+ else lstrcpyn(newtitle, _T("Message Session"), SIZEOF(newtitle));
if (dat->idle != dwOldIdle || lParam != 0) {
if (item.mask & TCIF_TEXT) {
@@ -1891,11 +1887,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->getProto(), dat->cache->getStatus()), 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->getProto(), dat->cache->getStatus()), 0, PluginConfig.g_hMenuRecent);
dat->Panel->Invalidate();
if (dat->pWnd)
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 80b4fdf7d3..464f870051 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -509,12 +509,11 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) if (M.GetByte("ShowClientDescription", 1)) {
TCHAR temp[256];
- DBVARIANT dbv = { 0 };
- if (!db_get_ts(m_dat->cache->getActiveContact(), m_dat->cache->getActiveProto(), "MirVer", &dbv)) {
- mir_sntprintf(temp, SIZEOF(temp), TranslateT(" Client: %s"), dbv.ptszVal);
- ::db_free(&dbv);
- }
- else mir_sntprintf(temp, SIZEOF(temp), TranslateT(" Client not cached yet"));
+ ptrT szVersion(db_get_tsa(m_dat->cache->getActiveContact(), m_dat->cache->getActiveProto(), "MirVer"));
+ if (szVersion)
+ mir_sntprintf(temp, SIZEOF(temp), TranslateT(" Client: %s"), szVersion);
+ else
+ mir_sntprintf(temp, SIZEOF(temp), TranslateT(" Client not cached yet"));
_tcscat_s(szBuf, 256, temp);
}
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index c87d4aec9b..e858d37ff3 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -439,8 +439,12 @@ int CMimAPI::ProtoAck(WPARAM wParam, LPARAM lParam) SendJob *jobs = sendQueue->getJobByIndex(0);
if (pAck->type == ACKTYPE_MESSAGE) {
+ MCONTACT hOwner = db_mc_getMeta(pAck->hContact);
+ if (hOwner == 0)
+ hOwner = pAck->hContact;
+
for (j = 0; j < SendQueue::NR_SENDJOBS; j++) {
- if (pAck->hProcess == jobs[j].hSendId && pAck->hContact == jobs[j].hOwner) {
+ if (pAck->hProcess == jobs[j].hSendId && hOwner == jobs[j].hOwner) {
TWindowData *dat = jobs[j].hwndOwner ? (TWindowData*)GetWindowLongPtr(jobs[j].hwndOwner, GWLP_USERDATA) : NULL;
if (dat) {
if (dat->hContact == jobs[j].hOwner) {
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 8de1d4aa7e..7df0424184 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2223,7 +2223,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->hXStatusIcon = 0;
}
- if (LPCSTR szProto = dat->cache->getActiveProto()) {
+ if (LPCSTR szProto = dat->cache->getProto()) {
dat->hTabIcon = dat->hTabStatusIcon = MY_GetContactIcon(dat);
if (M.GetByte("use_xicons", 1))
dat->hXStatusIcon = GetXStatusIcon(dat);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 91e977e721..842648bd23 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -2218,8 +2218,7 @@ void TSAPI GetMyNick(TWindowData *dat) HICON TSAPI MY_GetContactIcon(const TWindowData *dat)
{
- return(LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()));
- //return(LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getStatus()));
+ return(LoadSkinnedProtoIcon(dat->cache->getProto(), dat->cache->getStatus()));
}
/**
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 859b821378..bf0ef923e9 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -42,35 +42,33 @@ SendQueue *sendQueue = 0; int SendQueue::findNextFailed(const TWindowData *dat) const
{
- if (dat) {
- int i;
-
- for (i=0; i < NR_SENDJOBS; i++) {
+ if (dat)
+ for (int i=0; i < NR_SENDJOBS; i++)
if (m_jobs[i].hOwner == dat->hContact && m_jobs[i].iStatus == SQ_ERROR)
return i;
- }
- return -1;
- }
+
return -1;
}
void SendQueue::handleError(TWindowData *dat, const int iEntry) const
{
- if (dat) {
- TCHAR szErrorMsg[500];
-
- dat->iCurrentQueueError = iEntry;
- mir_sntprintf(szErrorMsg, 500, _T("%s"), m_jobs[iEntry].szErrorMsg);
- logError(dat, iEntry, szErrorMsg);
- recallFailed(dat, iEntry);
- showErrorControls(dat, TRUE);
- ::HandleIconFeedback(dat, PluginConfig.g_iconErr);
- }
+ if (!dat) return;
+
+ TCHAR szErrorMsg[500];
+
+ dat->iCurrentQueueError = iEntry;
+ mir_sntprintf(szErrorMsg, 500, _T("%s"), m_jobs[iEntry].szErrorMsg);
+ logError(dat, iEntry, szErrorMsg);
+ recallFailed(dat, iEntry);
+ showErrorControls(dat, TRUE);
+ ::HandleIconFeedback(dat, PluginConfig.g_iconErr);
}
+
/*
* add a message to the sending queue.
* iLen = required size of the memory block to hold the message
*/
+
int SendQueue::addTo(TWindowData *dat, const int iLen, int dwFlags)
{
int i;
@@ -364,12 +362,8 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) db_set_b(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "UnicodeSend", 1);
if (M.GetByte("autosplit", 0) && !(dat->sendMode & SMODE_SENDLATER)) {
- BOOL fSplit = FALSE;
- DWORD dwOldFlags;
-
- /*
- * determine send buffer length
- */
+ // determine send buffer length
+ BOOL fSplit = FALSE;
if (getSendLength(iEntry, dat->sendMode) >= dat->nMax)
fSplit = true;
@@ -382,7 +376,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) m_jobs[iEntry].iAcksNeeded = 1;
m_jobs[iEntry].chunkSize = dat->nMax;
- dwOldFlags = m_jobs[iEntry].dwFlags;
+ DWORD dwOldFlags = m_jobs[iEntry].dwFlags;
if (dat->sendMode & SMODE_FORCEANSI)
m_jobs[iEntry].dwFlags &= ~PREF_UNICODE;
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index f328f1dfc8..776afac70b 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -326,11 +326,11 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat break;
}
case 'o': {
- const TCHAR* szProto = dat->cache->getActiveProtoT();
+ const char *szProto = dat->cache->getActiveProto();
if (szProto)
- title.insert(tempmark + 2, szProto);
+ title.insert(tempmark + 2, _A2T(szProto));
title.erase(tempmark, 2);
- curpos = tempmark + (szProto ? lstrlen(szProto) : 0);
+ curpos = tempmark + (szProto ? lstrlenA(szProto) : 0);
break;
}
case 'x': {
|