diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-08-02 15:29:00 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-08-02 15:29:00 +0000 |
commit | e82bfee6d62bce298ae1f69653470969f8c2a8ca (patch) | |
tree | d2bab634e3e44446a5d4c01f8b66e52e127f6d70 /src/core/stdmsg | |
parent | fb51bcef9844639acab51ec98ea93eda910939da (diff) |
Fixed displaying status changed (fixes #553)
git-svn-id: http://svn.miranda-ng.org/main/trunk@10024 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 6 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 66 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 2 |
3 files changed, 21 insertions, 53 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index dd9f9621bf..073839130d 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -790,7 +790,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBEVENTINFO dbei = { sizeof(dbei) };
dat->hDbEventFirst = hPrevEvent;
db_event_get(hPrevEvent, &dbei);
- if (!DbEventIsShown(&dbei, dat))
+ if (!DbEventIsShown(&dbei))
i++;
}
break;
@@ -1312,8 +1312,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
- if (DbEventIsShown(&dbei, dat) && !(dbei.flags & DBEF_READ)) {
- if ((dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT)) {
+ if (DbEventIsShown(&dbei) && !(dbei.flags & DBEF_READ)) {
+ if ((dbei.eventType == EVENTTYPE_MESSAGE) && !(dbei.flags & DBEF_SENT)) {
if (GetForegroundWindow() == hwndDlg)
SkinPlaySound("RecvMsgActive");
else
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index b5c4d6c1fa..558a61ed54 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -168,27 +168,22 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA static char *CreateRTFHeader(SrmmWindowData *dat)
{
- char *buffer;
- int bufferAlloced, bufferEnd;
- int i;
- LOGFONT lf;
- COLORREF colour;
- HDC hdc;
-
- hdc = GetDC(NULL);
+ HDC hdc = GetDC(NULL);
logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
- bufferEnd = 0;
- bufferAlloced = 1024;
- buffer = (char *)mir_alloc(bufferAlloced);
+ int bufferEnd = 0;
+ int bufferAlloced = 1024;
+ char *buffer = (char *)mir_alloc(bufferAlloced);
buffer[0] = '\0';
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "{\\rtf1\\ansi\\deff0{\\fonttbl");
- for (i = 0; LoadMsgDlgFont(i, &lf, NULL); i++)
+ LOGFONT lf;
+ for (int i = 0; LoadMsgDlgFont(i, &lf, NULL); i++)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, FONT_FORMAT, i, lf.lfCharSet, lf.lfFaceName);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}{\\colortbl ");
- for (i = 0; LoadMsgDlgFont(i, NULL, &colour); i++)
+ COLORREF colour;
+ for (int i = 0; LoadMsgDlgFont(i, NULL, &colour); i++)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL)
@@ -204,12 +199,9 @@ static char *CreateRTFHeader(SrmmWindowData *dat) //mir_free() the return value
static char *CreateRTFTail(SrmmWindowData *dat)
{
- char *buffer;
- int bufferAlloced, bufferEnd;
-
- bufferEnd = 0;
- bufferAlloced = 1024;
- buffer = (char *)mir_alloc(bufferAlloced);
+ int bufferEnd = 0;
+ int bufferAlloced = 1024;
+ char *buffer = (char *)mir_alloc(bufferAlloced);
buffer[0] = '\0';
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}");
return buffer;
@@ -232,17 +224,9 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && (et->flags & DETF_MSGWINDOW);
}
-int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat)
+int DbEventIsShown(DBEVENTINFO *dbei)
{
- switch (dbei->eventType) {
- case EVENTTYPE_MESSAGE:
- return 1;
- case EVENTTYPE_JABBER_CHATSTATES:
- case EVENTTYPE_JABBER_PRESENCE:
- case EVENTTYPE_FILE:
- return (dbei->flags & DBEF_READ) == 0;
- }
- return DbEventIsForMsgWindow(dbei);
+ return (dbei->eventType==EVENTTYPE_MESSAGE) || DbEventIsForMsgWindow(dbei);
}
//mir_free() the return value
@@ -259,7 +243,7 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, HANDLE dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
db_event_get(hDbEvent, &dbei);
- if (!DbEventIsShown(&dbei, dat)) {
+ if (!DbEventIsShown(&dbei)) {
mir_free(dbei.pBlob);
return NULL;
}
@@ -294,23 +278,8 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, HANDLE }
if (g_dat.flags & SMF_SHOWICONS) {
- int i;
-
- switch (dbei.eventType) {
- case EVENTTYPE_MESSAGE:
- if (dbei.flags & DBEF_SENT)
- i = LOGICON_MSG_OUT;
- else
- i = LOGICON_MSG_IN;
- break;
-
- case EVENTTYPE_JABBER_CHATSTATES:
- case EVENTTYPE_JABBER_PRESENCE:
- case EVENTTYPE_FILE:
- default:
- i = LOGICON_MSG_NOTICE;
- break;
- }
+ int i = (dbei.eventType ? ((dbei.flags & DBEF_SENT) ? LOGICON_MSG_OUT : LOGICON_MSG_IN): LOGICON_MSG_NOTICE);
+
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < logIconBmpSize[i])
bufferAlloced += 1024;
@@ -594,7 +563,6 @@ void LoadMsgLogIcons(void) void FreeMsgLogIcons(void)
{
- int i;
- for (i = 0; i < SIZEOF(pLogIconBmpBits); i++)
+ for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++)
mir_free(pLogIconBmpBits[i]);
}
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 9c1887fcd0..b23c7180cd 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -123,7 +123,7 @@ struct CREOleCallback : public IRichEditOleCallback INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
-int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat);
+int DbEventIsShown(DBEVENTINFO * dbei);
void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend);
HANDLE SendMessageDirect(const TCHAR *szMsg, MCONTACT hContact, char *szProto);
|