diff options
author | George Hazan <ghazan@miranda.im> | 2019-12-04 16:08:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-12-04 16:08:03 +0300 |
commit | 3bb16e798cb51d5764aacbefd4edf26f52d8c4f0 (patch) | |
tree | 59dbb53fc9496d660ec2ef2846a4eab0f1720b88 /plugins/NewAwaySysMod/src | |
parent | 3216d8df5cb355f34c82ed10b7e40bab7525b697 (diff) |
GetContactProto: useless duplicate function replaced with standard Proto_GetBaseAccountName
Diffstat (limited to 'plugins/NewAwaySysMod/src')
-rw-r--r-- | plugins/NewAwaySysMod/src/AwayOpt.cpp | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/AwaySys.cpp | 14 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 4 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.cpp | 4 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.h | 4 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 8 |
7 files changed, 19 insertions, 19 deletions
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 66c463d752..9bcca8f929 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -904,7 +904,7 @@ INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) hItemUnknown = (HANDLE)SendMessage(hwndList, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
for (auto &hContact : Contacts()) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
int Flag1 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if ((Flag1 & PF1_IM) != PF1_IM && !(Flag1 & PF1_INDIVMODEMSG)) // does contact's protocol supports message sending/receiving or individual status messages?
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 596f77e72f..a0641ae1c2 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -108,7 +108,7 @@ TCString GetDynamicStatMsg(MCONTACT hContact, char *szProto, DWORD UIN, int iSta VarParseData.Message = CProtoSettings(szProto, iStatus).GetMsgFormat(iStatus ? GMF_LASTORDEFAULT : GMF_ANYCURRENT);
TCString sTime;
- VarParseData.szProto = szProto ? szProto : ((hContact && hContact != INVALID_CONTACT_ID) ? GetContactProto(hContact) : nullptr);
+ VarParseData.szProto = szProto ? szProto : ((hContact && hContact != INVALID_CONTACT_ID) ? Proto_GetBaseAccountName(hContact) : nullptr);
VarParseData.UIN = UIN;
VarParseData.Flags = 0;
if (ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) {
@@ -227,7 +227,7 @@ static int IdleChangeEvent(WPARAM, LPARAM lParam) int PreBuildContactMenu(WPARAM hContact, LPARAM)
{
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
int iMode = szProto ? Proto_GetStatus(szProto) : 0;
int Flag1 = szProto ? CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) : 0;
int iContactMode = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -302,7 +302,7 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM) SetAwayMsgData *dat = new SetAwayMsgData;
memset(dat, 0, sizeof(SetAwayMsgData));
dat->hInitContact = hContact;
- dat->szProtocol = GetContactProto(hContact);
+ dat->szProtocol = Proto_GetBaseAccountName(hContact);
dat->IsModeless = false;
DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
return 0;
@@ -311,7 +311,7 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM) INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM)
{
// used only for the global setting
- CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : nullptr].m_status, hContact).Autoreply.Toggle();
+ CContactSettings(g_ProtoStates[hContact ? Proto_GetBaseAccountName(hContact) : nullptr].m_status, hContact).Autoreply.Toggle();
if (hContact == NULL) {
int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].m_status).Autoreply;
@@ -330,19 +330,19 @@ INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM) INT_PTR srvAutoreplyOn(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = 1;
+ CContactSettings(g_ProtoStates[Proto_GetBaseAccountName(hContact)].m_status, hContact).Autoreply = 1;
return 0;
}
INT_PTR srvAutoreplyOff(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = 0;
+ CContactSettings(g_ProtoStates[Proto_GetBaseAccountName(hContact)].m_status, hContact).Autoreply = 0;
return 0;
}
INT_PTR srvAutoreplyUseDefault(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = VAL_USEDEFAULT;
+ CContactSettings(g_ProtoStates[Proto_GetBaseAccountName(hContact)].m_status, hContact).Autoreply = VAL_USEDEFAULT;
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 8cc39f69e8..ff4d1c35d4 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -53,7 +53,7 @@ void __cdecl AutoreplyDelayThread(CAutoreplyData *ad) Thread_SetName("NewAwaySysMod: AutoreplyDelayThread");
_ASSERT(ad && ad->hContact && ad->Reply.GetLen());
- char *szProto = GetContactProto(ad->hContact);
+ char *szProto = Proto_GetBaseAccountName(ad->hContact);
if (!szProto) {
_ASSERT(0);
return;
@@ -116,7 +116,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) if (time(0) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages
return 0;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (!szProto)
return 0;
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index e4e1e2b22d..0e13472bf0 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -36,7 +36,7 @@ void ResetSettingsOnStatusChange(const char *szProto = nullptr, int bResetPerson for (auto &hContact : Contacts()) {
const char *szCurProto;
- if (!szProto || ((szCurProto = GetContactProto(hContact)) && !mir_strcmp(szProto, szCurProto))) {
+ if (!szProto || ((szCurProto = Proto_GetBaseAccountName(hContact)) && !mir_strcmp(szProto, szCurProto))) {
ResetContactSettingsOnStatusChange(hContact);
if (bResetPersonalMsgs)
CContactSettings(Status, hContact).SetMsgFormat(SMF_PERSONAL, nullptr); // TODO: delete only when SAM dialog opens?
@@ -135,7 +135,7 @@ TCString CContactSettings::GetMsgFormat(int Flags, int *pOrder, char *szProtoOve Message = db_get_s(m_hContact, MODULENAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (wchar_t*)NULL);
if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL | GMF_TEMPORARY) && Message.IsEmpty()) {
- char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? GetContactProto(m_hContact) : nullptr);
+ char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? Proto_GetBaseAccountName(m_hContact) : nullptr);
// we mustn't pass here by GMF_TEMPORARY flag, as otherwise we'll handle GMF_TEMPORARY | GMF_PERSONAL combination incorrectly,
// which is supposed to get only per-contact messages, and at the same time also may be used with NULL contact to get the global status message
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index 09790acdb5..3dca12f34d 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -455,7 +455,7 @@ public: _ASSERT((Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
int m_value = *this;
if (m_value == VAL_USEDEFAULT) {
- const char *szProto = (Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) ? GetContactProto(Parent->m_hContact) : szProtoOverride;
+ const char *szProto = (Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) ? Proto_GetBaseAccountName(Parent->m_hContact) : szProtoOverride;
return CProtoSettings(szProto).Autoreply.IncludingParents();
}
return m_value;
@@ -483,7 +483,7 @@ public: {
if (!Status) {
_ASSERT(m_hContact != INVALID_CONTACT_ID);
- char *szProto = m_hContact ? GetContactProto(m_hContact) : nullptr;
+ char *szProto = m_hContact ? Proto_GetBaseAccountName(m_hContact) : nullptr;
Status = (szProto || !m_hContact) ? g_ProtoStates[szProto].m_status : ID_STATUS_AWAY;
}
return Status;
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 71108da370..241d1777d0 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -64,7 +64,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam wchar_t str[256], format[128];
wchar_t *contactName = Clist_GetContactDisplayName(awayData->hContact);
- char *szProto = GetContactProto(awayData->hContact);
+ char *szProto = Proto_GetBaseAccountName(awayData->hContact);
wchar_t *status = Clist_GetStatusModeDescription(db_get_w(awayData->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
GetWindowText(hwndDlg, format, _countof(format));
mir_snwprintf(str, format, status, contactName);
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index db8c03f9f8..33ea5908cf 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -479,7 +479,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA g_SetAwayMsgPage.SetWnd(hwndDlg);
g_SetAwayMsgPage.DBToMemToPage();
- char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
+ char *szProto = dat->hInitContact ? Proto_GetBaseAccountName(dat->hInitContact) : dat->szProtocol;
int Status = 0;
Status = g_ProtoStates[dat->szProtocol].m_status;
@@ -559,7 +559,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // init message tree
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT) && g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSMRM)) {
- char *szInitProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
+ char *szInitProto = dat->hInitContact ? Proto_GetBaseAccountName(dat->hInitContact) : dat->szProtocol;
int ID = GetRecentGroupID((szInitProto || !dat->hInitContact) ? g_ProtoStates[szInitProto].m_status : ID_STATUS_AWAY);
CBaseTreeItem* pTreeItem = MsgTree->GetNextItem(MTGN_CHILD | MTGN_BYID, (CBaseTreeItem*)g_Messages_RecentRootID);
while (pTreeItem) {
@@ -712,7 +712,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (ItemType == MCLCIT_CONTACT) {
hContact = CList->GethContact(hItem);
_ASSERT(hContact);
- szProto = GetContactProto(hContact);
+ szProto = Proto_GetBaseAccountName(hContact);
_ASSERT(szProto);
}
else if (ItemType == MCLCIT_INFO)
@@ -865,7 +865,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA CList->SetRedraw(false);
for (auto &hContact : Contacts()) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
int Flag1 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if ((Flag1 & PF1_IM) == PF1_IM || Flag1 & PF1_INDIVMODEMSG) { // check if the protocol supports message sending/receiving or individual status messages before adding this contact
|