diff options
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 97 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 5 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 6 |
3 files changed, 62 insertions, 46 deletions
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index f65644f92b..2e761e01be 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -23,10 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. GlobalMessageData g_dat;
-static int dbaddedevent(WPARAM wParam, LPARAM lParam);
-static int ackevent(WPARAM wParam, LPARAM lParam);
-static int AvatarChanged(WPARAM wParam, LPARAM lParam);
-
IconItem iconList[] =
{
{ LPGEN("Incoming message (10x10)"), "INCOMING", IDI_INCOMING, 10 },
@@ -39,7 +35,7 @@ static void InitIcons(void) Icon_Register(g_hInst, LPGEN("Messaging"), iconList, SIZEOF(iconList), "SRMM");
}
-static int IconsChanged(WPARAM wParam, LPARAM lParam)
+static int IconsChanged(WPARAM, LPARAM)
{
FreeMsgLogIcons();
LoadMsgLogIcons();
@@ -52,20 +48,53 @@ static int OnShutdown(WPARAM, LPARAM) return 0;
}
-void InitGlobals()
+static int OnMetaChanged(WPARAM hMeta, LPARAM)
{
- g_dat.hMessageWindowList = WindowList_Create();
-
- HookEvent(ME_DB_EVENT_ADDED, dbaddedevent);
- HookEvent(ME_PROTO_ACK, ackevent);
- HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
- HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
- HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
+ if (hMeta) {
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hMeta);
+ if (hwnd != NULL)
+ SendMessage(hwnd, DM_GETAVATAR, 0, 0);
+ }
+ return 0;
+}
- ReloadGlobals();
- InitIcons();
+static int dbaddedevent(WPARAM hContact, LPARAM lParam)
+{
+ if (hContact) {
+ HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ if (h)
+ SendMessage(h, HM_DBEVENTADDED, hContact, lParam);
+
+ MCONTACT hEventContact = db_event_getContact((HANDLE)lParam);
+ if (hEventContact != hContact)
+ if ((h = WindowList_Find(g_dat.hMessageWindowList, hEventContact)) != NULL)
+ SendMessage(h, HM_DBEVENTADDED, hEventContact, lParam);
+ }
+ return 0;
+}
+
+static int ackevent(WPARAM wParam, LPARAM lParam)
+{
+ ACKDATA *pAck = (ACKDATA *)lParam;
+ if (pAck && pAck->type == ACKTYPE_MESSAGE) {
+ msgQueue_processack(pAck->hContact, (int)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam);
+
+ if (pAck->result == ACKRESULT_SUCCESS)
+ SkinPlaySound("SendMsg");
+ }
+ return 0;
+}
+
+int AvatarChanged(WPARAM hContact, LPARAM lParam)
+{
+ HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ if (h)
+ SendMessage(h, HM_AVATARACK, hContact, lParam);
+ return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void ReloadGlobals()
{
g_dat.flags = 0;
@@ -119,35 +148,17 @@ void ReloadGlobals() if (g_dat.msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat.msgTimeout = SRMSGDEFSET_MSGTIMEOUT;
}
-static int dbaddedevent(WPARAM hContact, LPARAM lParam)
-{
- if (hContact) {
- HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
- if (h == NULL)
- h = WindowList_Find(g_dat.hMessageWindowList, hContact = db_event_getContact((HANDLE)lParam));
-
- if (h)
- SendMessage(h, HM_DBEVENTADDED, hContact, lParam);
- }
- return 0;
-}
-
-static int ackevent(WPARAM wParam, LPARAM lParam)
+void InitGlobals()
{
- ACKDATA *pAck = (ACKDATA *)lParam;
- if (pAck && pAck->type == ACKTYPE_MESSAGE) {
- msgQueue_processack(pAck->hContact, (int)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam);
+ g_dat.hMessageWindowList = WindowList_Create();
- if (pAck->result == ACKRESULT_SUCCESS)
- SkinPlaySound("SendMsg");
- }
- return 0;
-}
+ HookEvent(ME_DB_EVENT_ADDED, dbaddedevent);
+ HookEvent(ME_PROTO_ACK, ackevent);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
+ HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
+ HookEvent(ME_MC_DEFAULTTCHANGED, OnMetaChanged);
-int AvatarChanged(WPARAM hContact, LPARAM lParam)
-{
- HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
- if (h)
- SendMessage(h, HM_AVATARACK, hContact, lParam);
- return 0;
+ ReloadGlobals();
+ InitIcons();
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 636a8b6d98..dd9f9621bf 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -609,7 +609,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat)
{
if (g_dat.flags & SMF_AVATAR) {
- AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->hContact, 0);
+ AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->getActiveContact(), 0);
if (ace && (INT_PTR)ace != CALLSERVICE_NOTFOUND && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST))
dat->avatarPic = ace->hbmPic;
else
@@ -693,6 +693,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->hContact = newData->hContact;
+ dat->bIsMeta = db_mc_isMeta(dat->hContact) != 0;
dat->hTimeZone = tmi.createByContact(dat->hContact, 0, TZF_KNOWNONLY);
dat->wMinute = 61;
@@ -701,7 +702,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int len;
if (newData->isWchar)
- SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText);
+ SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR*)newData->szInitialText);
else
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 135afd3b3d..9c1887fcd0 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -65,8 +65,12 @@ struct SrmmWindowData : public MZeroedObject WORD wOldStatus;
int cmdListInd;
LIST<TCHAR> cmdList;
- int bIsAutoRTL;
+ bool bIsAutoRTL, bIsMeta;
WORD wMinute;
+
+ __forceinline MCONTACT getActiveContact() const
+ { return (bIsMeta) ? db_mc_getSrmmSub(hContact) : hContact;
+ }
};
#define DM_REMAKELOG (WM_USER+11)
|