summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-24 19:34:52 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-24 19:34:52 +0300
commita1d6a1f6dc12e1303a2d80c1a25070bf38fa64c4 (patch)
tree9ff217e7ff7d1ed596aa797d99c9208e4f20cdc1 /plugins
parentd55e216357d008439f1a65de4a47742ef4d60ffd (diff)
SmileyAdd: unused variables removed from MsgWndData
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp27
-rw-r--r--plugins/SmileyAdd/src/general.cpp5
2 files changed, 10 insertions, 22 deletions
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 1d6b9c57f5..9a5792651d 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -26,25 +26,22 @@ static mir_cs csWndList;
struct MsgWndData : public MZeroedObject
{
CSrmmBaseDialog *pDlg;
- int idxLastChar;
- bool doSmileyReplace;
- char ProtocolName[52];
+ char *szProto;
MsgWndData(CSrmmBaseDialog *p) :
pDlg(p)
- {}
+ {
+ szProto = Proto_GetBaseAccountName(DecodeMetaContact(pDlg->m_hContact));
+ }
void CreateSmileyButton(void)
{
- SmileyPackType *SmileyPack = FindSmileyPack(ProtocolName, pDlg->m_hContact);
- bool doSmileyButton = SmileyPack != nullptr && SmileyPack->VisibleSmileyCount() != 0;
-
- doSmileyReplace = true;
+ SmileyPackType *SmileyPack = FindSmileyPack(szProto, pDlg->m_hContact);
+ bool doSmileyButton = SmileyPack && SmileyPack->VisibleSmileyCount() != 0;
- if (ProtocolName[0] != 0) {
- INT_PTR cap = CallProtoService(ProtocolName, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (szProto) {
+ INT_PTR cap = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
doSmileyButton &= ((cap & (PF1_IMSEND | PF1_CHAT)) != 0);
- doSmileyReplace &= ((cap & (PF1_IMRECV | PF1_CHAT)) != 0);
}
BBButton bbd = {};
@@ -118,7 +115,7 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam)
return 0;
SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
- stwp->pSmileyPack = FindSmileyPack(dat->ProtocolName, dat->pDlg->m_hContact);
+ stwp->pSmileyPack = FindSmileyPack(dat->szProto, dat->pDlg->m_hContact);
stwp->hWndParent = pcbc->hwndFrom;
stwp->hWndTarget = dat->pDlg->GetInput();
stwp->targetMessage = EM_REPLACESEL;
@@ -142,12 +139,6 @@ static int MsgDlgHook(WPARAM uType, LPARAM lParam)
case MSG_WINDOW_EVT_OPENING:
{
MsgWndData *msgwnd = new MsgWndData(pDlg);
-
- // Get the protocol for this contact to display correct smileys.
- char *protonam = Proto_GetBaseAccountName(DecodeMetaContact(pDlg->m_hContact));
- if (protonam)
- strncpy_s(msgwnd->ProtocolName, protonam, _TRUNCATE);
-
msgwnd->CreateSmileyButton();
mir_cslock lck(csWndList);
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp
index 7c669ca5ec..c0a73d55f7 100644
--- a/plugins/SmileyAdd/src/general.cpp
+++ b/plugins/SmileyAdd/src/general.cpp
@@ -134,10 +134,7 @@ MCONTACT DecodeMetaContact(MCONTACT hContact)
return 0;
MCONTACT hReal = db_mc_getMostOnline(hContact);
- if (hReal == 0 || (INT_PTR)hReal == CALLSERVICE_NOTFOUND)
- hReal = hContact;
-
- return hReal;
+ return (hReal == 0) ? hContact : hReal;
}
bool IsSmileyProto(char *proto)