diff options
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/text_operations.cpp | 3 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_ieview.h | 251 | ||||
-rw-r--r-- | plugins/IEHistory/src/dlgHandlers.cpp | 13 | ||||
-rw-r--r-- | plugins/IEView/src/ChatHTMLBuilder.cpp | 8 | ||||
-rw-r--r-- | plugins/IEView/src/HTMLBuilder.cpp | 49 | ||||
-rw-r--r-- | plugins/IEView/src/HistoryHTMLBuilder.cpp | 8 | ||||
-rw-r--r-- | plugins/IEView/src/IEView.cpp | 10 | ||||
-rw-r--r-- | plugins/IEView/src/MUCCHTMLBuilder.cpp | 16 | ||||
-rw-r--r-- | plugins/IEView/src/ScriverHTMLBuilder.cpp | 8 | ||||
-rw-r--r-- | plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 8 | ||||
-rw-r--r-- | plugins/IEView/src/TemplateHTMLBuilder.cpp | 12 | ||||
-rw-r--r-- | plugins/Popup/src/history.cpp | 51 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 8 | ||||
-rw-r--r-- | plugins/TranslitSwitcher/src/Layoutproc.cpp | 6 | ||||
-rw-r--r-- | src/core/stdpopup/src/yapp_history_dlg.cpp | 175 |
17 files changed, 267 insertions, 366 deletions
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 5ccd7e39c1..06a6da11e2 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -234,8 +234,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) return 0;
//--------------Определяем тип окна-----------------
- IEVIEWEVENT ieEvent = { 0 };
- ieEvent.cbSize = sizeof(IEVIEWEVENT);
+ IEVIEWEVENT ieEvent = {};
ieEvent.iType = IEE_GET_SELECTION;
if (ServiceExists(MS_HPP_EG_EVENT)) {
diff --git a/plugins/ExternalAPI/m_ieview.h b/plugins/ExternalAPI/m_ieview.h index e5fd6c713b..107ff4edac 100644 --- a/plugins/ExternalAPI/m_ieview.h +++ b/plugins/ExternalAPI/m_ieview.h @@ -42,152 +42,135 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IEWM_HISTORY 6 // history viewer
#define IEWM_BROWSER 256 // empty browser window
-typedef struct {
- int cbSize; // size of the strusture
- int iType; // one of IEW_* values
- DWORD dwMode; // compatibility mode - one of IEWM_* values
- DWORD dwFlags; // flags, one of IEWF_* values
- HWND parent; // parent window HWND
- HWND hwnd; // IEW_CREATE returns WebBrowser control's HWND here
- int x; // IE control horizontal position
- int y; // IE control vertical position
- int cx; // IE control horizontal size
- int cy; // IE control vertical size
-
-} IEVIEWWINDOW;
-
-#define IEEDF_UNICODE 0x00000001 // if set pszText is a pointer to wchar_t string instead of char string
-#define IEEDF_UNICODE_TEXT 0x00000001 // if set pszText is a pointer to wchar_t string instead of char string
-#define IEEDF_UNICODE_NICK 0x00000002 // if set pszNick is a pointer to wchar_t string instead of char string
-#define IEEDF_UNICODE_TEXT2 0x00000004 // if set pszText2 is a pointer to wchar_t string instead of char string
+struct IEVIEWWINDOW
+{
+ int cbSize; // size of the strusture
+ int iType; // one of IEW_* values
+ DWORD dwMode; // compatibility mode - one of IEWM_* values
+ DWORD dwFlags; // flags, one of IEWF_* values
+ HWND parent; // parent window HWND
+ HWND hwnd; // IEW_CREATE returns WebBrowser control's HWND here
+ int x; // IE control horizontal position
+ int y; // IE control vertical position
+ int cx; // IE control horizontal size
+ int cy; // IE control vertical size
+
+};
+
+#define IEEDF_UNICODE 0x00000001 // if set pszText is a pointer to wchar_t string instead of char string
+#define IEEDF_UNICODE_TEXT 0x00000001 // if set pszText is a pointer to wchar_t string instead of char string
+#define IEEDF_UNICODE_NICK 0x00000002 // if set pszNick is a pointer to wchar_t string instead of char string
+#define IEEDF_UNICODE_TEXT2 0x00000004 // if set pszText2 is a pointer to wchar_t string instead of char string
/* The following flags are valid only for message events (IEED_EVENT_MESSAGE) */
-#define IEEDF_FORMAT_FONT 0x00000100 // if set pszFont (font name) is valid and should be used
-#define IEEDF_FORMAT_SIZE 0x00000200 // if set fontSize is valid and should be used
-#define IEEDF_FORMAT_COLOR 0x00000400 // if set color is valid and should be used
-#define IEEDF_FORMAT_STYLE 0x00000800 // if set fontSize is valid and should be used
-
-#define IEEDF_READ 0x00001000 // if set
-#define IEEDF_SENT 0x00002000 // if set
-#define IEEDF_RTL 0x00004000 // if set
-
-#define IEED_EVENT_MESSAGE 0x0001 // message
-#define IEED_EVENT_STATUSCHANGE 0x0002 // status change
-#define IEED_EVENT_FILE 0x0003 // file
-#define IEED_EVENT_ERRMSG 0x0005 // error message
-#define IEED_EVENT_SYSTEM 0x0006 // system event
-
-#define IEED_MUCC_EVENT_MESSAGE 0x0001 // message
-#define IEED_MUCC_EVENT_TOPIC 0x0002 // topic change
-#define IEED_MUCC_EVENT_JOINED 0x0003 // user joined
-#define IEED_MUCC_EVENT_LEFT 0x0004 // user left
-#define IEED_MUCC_EVENT_ERROR 0x0005 // error
+#define IEEDF_FORMAT_FONT 0x00000100 // if set pszFont (font name) is valid and should be used
+#define IEEDF_FORMAT_SIZE 0x00000200 // if set fontSize is valid and should be used
+#define IEEDF_FORMAT_COLOR 0x00000400 // if set color is valid and should be used
+#define IEEDF_FORMAT_STYLE 0x00000800 // if set fontSize is valid and should be used
+
+#define IEEDF_READ 0x00001000 // if set
+#define IEEDF_SENT 0x00002000 // if set
+#define IEEDF_RTL 0x00004000 // if set
+
+#define IEED_EVENT_MESSAGE 0x0001 // message
+#define IEED_EVENT_STATUSCHANGE 0x0002 // status change
+#define IEED_EVENT_FILE 0x0003 // file
+#define IEED_EVENT_ERRMSG 0x0005 // error message
+#define IEED_EVENT_SYSTEM 0x0006 // system event
+
+#define IEED_MUCC_EVENT_MESSAGE 0x0001 // message
+#define IEED_MUCC_EVENT_TOPIC 0x0002 // topic change
+#define IEED_MUCC_EVENT_JOINED 0x0003 // user joined
+#define IEED_MUCC_EVENT_LEFT 0x0004 // user left
+#define IEED_MUCC_EVENT_ERROR 0x0005 // error
/* MUCC-related dwData bit flags */
-#define IEEDD_MUCC_SHOW_NICK 0x00000001
-#define IEEDD_MUCC_MSG_ON_NEW_LINE 0x00000002
-#define IEEDD_MUCC_SHOW_DATE 0x00000010
-#define IEEDD_MUCC_SHOW_TIME 0x00000020
-#define IEEDD_MUCC_SECONDS 0x00000040
-#define IEEDD_MUCC_LONG_DATE 0x00000080
-
-#define IEED_GC_EVENT_HIGHLIGHT 0x8000
-#define IEED_GC_EVENT_MESSAGE 0x0001
-#define IEED_GC_EVENT_TOPIC 0x0002
-#define IEED_GC_EVENT_JOIN 0x0003
-#define IEED_GC_EVENT_PART 0x0004
-#define IEED_GC_EVENT_QUIT 0x0006
-#define IEED_GC_EVENT_NICK 0x0007
-#define IEED_GC_EVENT_ACTION 0x0008
-#define IEED_GC_EVENT_KICK 0x0009
-#define IEED_GC_EVENT_NOTICE 0x000A
-#define IEED_GC_EVENT_INFORMATION 0x000B
-#define IEED_GC_EVENT_ADDSTATUS 0x000C
-#define IEED_GC_EVENT_REMOVESTATUS 0x000D
+#define IEEDD_MUCC_SHOW_NICK 0x00000001
+#define IEEDD_MUCC_MSG_ON_NEW_LINE 0x00000002
+#define IEEDD_MUCC_SHOW_DATE 0x00000010
+#define IEEDD_MUCC_SHOW_TIME 0x00000020
+#define IEEDD_MUCC_SECONDS 0x00000040
+#define IEEDD_MUCC_LONG_DATE 0x00000080
+
+#define IEED_GC_EVENT_HIGHLIGHT 0x8000
+#define IEED_GC_EVENT_MESSAGE 0x0001
+#define IEED_GC_EVENT_TOPIC 0x0002
+#define IEED_GC_EVENT_JOIN 0x0003
+#define IEED_GC_EVENT_PART 0x0004
+#define IEED_GC_EVENT_QUIT 0x0006
+#define IEED_GC_EVENT_NICK 0x0007
+#define IEED_GC_EVENT_ACTION 0x0008
+#define IEED_GC_EVENT_KICK 0x0009
+#define IEED_GC_EVENT_NOTICE 0x000A
+#define IEED_GC_EVENT_INFORMATION 0x000B
+#define IEED_GC_EVENT_ADDSTATUS 0x000C
+#define IEED_GC_EVENT_REMOVESTATUS 0x000D
/* GC-related dwData bit flags */
-#define IEEDD_GC_SHOW_NICK 0x00000001
-#define IEEDD_GC_SHOW_TIME 0x00000002
-#define IEEDD_GC_SHOW_ICON 0x00000004
-#define IEEDD_GC_MSG_ON_NEW_LINE 0x00001000
-
-#define IE_FONT_BOLD 0x000100 // Bold font flag
-#define IE_FONT_ITALIC 0x000200 // Italic font flag
-#define IE_FONT_UNDERLINE 0x000400 // Underlined font flags
-
-typedef struct tagIEVIEWEVENTDATA {
- int cbSize;
- int iType; // Event type, one of MUCC_EVENT_* values
- DWORD dwFlags; // Event flags - IEEF_*
- const char *fontName; // Text font name
- int fontSize; // Text font size (in pixels)
- int fontStyle; // Text font style (combination of IE_FONT_* flags)
- COLORREF color; // Text color
- union {
- const TCHAR *ptszNick; // Nick, usage depends on type of event
- const char *pszNick; // Nick - ANSII
- const wchar_t *pszNickW; // Nick - Unicode
- };
- union {
- const TCHAR *ptszText; // Text, usage depends on type of event
- const char *pszText; // Text - ANSII
- const wchar_t *pszTextW; // Text - Unicode
- };
- DWORD dwData; // DWORD data e.g. status see IEEDD_* values
- BOOL bIsMe; // TRUE if the event is related to the user
- DWORD time; // Time of the event
- struct tagIEVIEWEVENTDATA *next;
- union {
- const TCHAR *ptszText2; // Text2, usage depends on type of event
- const char *pszText2; // Text2 - ANSII
- const wchar_t *pszText2W; // Text2 - Unicode
- };
-} IEVIEWEVENTDATA;
+#define IEEDD_GC_SHOW_NICK 0x00000001
+#define IEEDD_GC_SHOW_TIME 0x00000002
+#define IEEDD_GC_SHOW_ICON 0x00000004
+#define IEEDD_GC_MSG_ON_NEW_LINE 0x00001000
+
+#define IE_FONT_BOLD 0x000100 // Bold font flag
+#define IE_FONT_ITALIC 0x000200 // Italic font flag
+#define IE_FONT_UNDERLINE 0x000400 // Underlined font flags
+
+struct IEVIEWEVENTDATA
+{
+ int iType; // Event type, one of MUCC_EVENT_* values
+ DWORD dwFlags; // Event flags - IEEF_*
+ const char *fontName; // Text font name
+ int fontSize; // Text font size (in pixels)
+ int fontStyle; // Text font style (combination of IE_FONT_* flags)
+ COLORREF color; // Text color
+ MAllCStrings szNick; // Nick, usage depends on type of event
+ MAllCStrings szText; // Text, usage depends on type of event
+ DWORD dwData; // DWORD data e.g. status see IEEDD_* values
+ BOOL bIsMe; // TRUE if the event is related to the user
+ DWORD time; // Time of the event
+ IEVIEWEVENTDATA *next;
+ MAllCStrings szText2;
+};
/* IEView events */
-#define IEE_LOG_DB_EVENTS 1 // log specified number of DB events
-#define IEE_CLEAR_LOG 2 // clear log
-#define IEE_GET_SELECTION 3 // get selected text
-#define IEE_SAVE_DOCUMENT 4 // save current document
-#define IEE_LOG_MEM_EVENTS 5 // log specified number of IEView events
+#define IEE_LOG_DB_EVENTS 1 // log specified number of DB events
+#define IEE_CLEAR_LOG 2 // clear log
+#define IEE_GET_SELECTION 3 // get selected text
+#define IEE_SAVE_DOCUMENT 4 // save current document
+#define IEE_LOG_MEM_EVENTS 5 // log specified number of IEView events
/* IEView event flags */
-#define IEEF_RTL 1 // turn on RTL support
-#define IEEF_NO_UNICODE 2 // disable Unicode support - valid for IEE_LOG_DB_EVENTS and IEE_GET_SELECTION events
-
-#define IEVIEWEVENT_SIZE_V1 28
-#define IEVIEWEVENT_SIZE_V2 32
-#define IEVIEWEVENT_SIZE_V3 36
-
-typedef struct {
- int cbSize; // size of the strusture
- int iType; // one of IEE_* values
- DWORD dwFlags; // one of IEEF_* values
- HWND hwnd; // HWND returned by IEW_CREATE
- MCONTACT hContact; // contact
- union {
- MEVENT hDbEventFirst; // first event to log, when IEE_LOG_EVENTS returns it will contain
- // the last event actually logged or NULL if no event was logged (IEE_LOG_EVENTS)
- IEVIEWEVENTDATA *eventData; // the pointer to an array of IEVIEWEVENTDATA objects (IEE_LOG_IEV_EVENTS)
- };
- int count; // number of events to log
- int codepage; // ANSI codepage
- const char *pszProto; // Name of the protocol
-} IEVIEWEVENT;
-
-#define IEN_NAVIGATE 1 // navigate to the given destination
-#define IENF_UNICODE 1 // if set urlW is used instead of urlW
-
-typedef struct {
- int cbSize; // size of the strusture
- int iType; // one of IEN_* values
- DWORD dwFlags; // one of IEEF_* values
- HWND hwnd; // HWND returned by IEW_CREATE
+#define IEEF_RTL 1 // turn on RTL support
+#define IEEF_NO_UNICODE 2 // disable Unicode support - valid for IEE_LOG_DB_EVENTS and IEE_GET_SELECTION events
+
+struct IEVIEWEVENT
+{
+ int iType; // one of IEE_* values
+ DWORD dwFlags; // one of IEEF_* values
+ HWND hwnd; // HWND returned by IEW_CREATE
+ MCONTACT hContact; // contact
union {
- const char *url; // Text, usage depends on type of event
- const wchar_t *urlW; // Text - Unicode
+ MEVENT hDbEventFirst; // first event to log, when IEE_LOG_EVENTS returns it will contain
+ // the last event actually logged or NULL if no event was logged (IEE_LOG_EVENTS)
+ IEVIEWEVENTDATA *eventData; // the pointer to an array of IEVIEWEVENTDATA objects (IEE_LOG_IEV_EVENTS)
};
-} IEVIEWNAVIGATE;
+ int count; // number of events to log
+ int codepage; // ANSI codepage
+ const char *pszProto; // Name of the protocol
+};
+
+#define IEN_NAVIGATE 1 // navigate to the given destination
+#define IENF_UNICODE 1 // if set urlW is used instead of urlW
+
+struct IEVIEWNAVIGATE
+{
+ int cbSize; // size of the strusture
+ int iType; // one of IEN_* values
+ DWORD dwFlags; // one of IEEF_* values
+ HWND hwnd; // HWND returned by IEW_CREATE
+ MAllCStrings url; // Text, usage depends on type of event
+};
#endif
diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 441495a4f6..3feef25f7b 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -131,19 +131,17 @@ void FillIEViewInfo(IEVIEWEVENTDATA *fillData, DBEVENTINFO dbInfo, PBYTE blob) break;
}
- fillData->pszNick = "<nick here>";
+ fillData->szNick.a = "<nick here>";
fillData->bIsMe = (dbInfo.flags & DBEF_SENT);
fillData->dwFlags = (dbInfo.flags & DBEF_SENT) ? IEEDF_SENT : 0;
fillData->time = dbInfo.timestamp;
size_t len = mir_strlen((char *)blob) + 1;
PBYTE pos;
- fillData->pszText = (char *)blob;
- // fillData.pszText2 = (char *) blob;
+ fillData->szText.a = (char *)blob;
if (len < dbInfo.cbBlob) {
pos = blob + len;
- fillData->pszTextW = (wchar_t *)pos;
- // fillData->pszText2W = (wchar_t *) pos;
+ fillData->szText.w = (wchar_t *)pos;
fillData->dwFlags |= IEEDF_UNICODE_TEXT;
}
}
@@ -161,10 +159,9 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) IEVIEWEVENTDATA ieData[LOAD_COUNT] = { 0 };
PBYTE messages[LOAD_COUNT] = {};
MEVENT dbEvent = data->ieEvent.hDbEventFirst;
- for (i = 0; i < LOAD_COUNT; i++) {
- ieData[i].cbSize = sizeof(IEVIEWEVENTDATA); //set the cbsize here, no need to do it every time
+ for (i = 0; i < LOAD_COUNT; i++)
ieData[i].next = &ieData[i + 1]; //it's a vector, so v[i]'s next element is v[i + 1]
- }
+
ieData[LOAD_COUNT - 1].next = nullptr;
IEVIEWEVENT ieEvent = data->ieEvent;
ieEvent.iType = IEE_LOG_MEM_EVENTS;
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 9e8b8cc5a7..33f0f9e1f1 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -170,14 +170,14 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) ptrA szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszTextW, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szText.w, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
else
- szText = encodeUTF8(NULL, event->pszProto, (char *)eventData->pszText, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szText.a, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
- szName = encodeUTF8(NULL, event->pszProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(NULL, event->pszProto, eventData->szNick.w, ENF_NAMESMILEYS, true);
else
- szName = encodeUTF8(NULL, event->pszProto, (char *)eventData->pszNick, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(NULL, event->pszProto, eventData->szNick.a, ENF_NAMESMILEYS, true);
if (eventData->iType == IEED_GC_EVENT_MESSAGE) {
iconFile = isSent ? "message_out_chat.gif" : "message_in_chat.gif";
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index e8aaaf2119..5995a342b3 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -25,7 +25,6 @@ int HTMLBuilder::mimFlags = 0; HTMLBuilder::HTMLBuilder()
{
- lastIEViewEvent.cbSize = sizeof(IEVIEWEVENT);
lastIEViewEvent.iType = IEE_LOG_MEM_EVENTS;
lastIEViewEvent.codepage = CP_ACP;
lastIEViewEvent.pszProto = nullptr;
@@ -228,7 +227,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) event->hDbEventFirst = NULL;
ptrA szProto;
- if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != nullptr)
+ if (event->pszProto != nullptr)
szProto = mir_strdup(event->pszProto);
else
szProto = getProto(event->hContact);
@@ -236,8 +235,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) IEVIEWEVENT newEvent = { sizeof(IEVIEWEVENT) };
newEvent.iType = IEE_LOG_MEM_EVENTS;
newEvent.codepage = CP_ACP;
- if (event->cbSize >= IEVIEWEVENT_SIZE_V2)
- newEvent.codepage = event->codepage;
+ newEvent.codepage = event->codepage;
newEvent.pszProto = szProto;
newEvent.count = 0;
newEvent.dwFlags = event->dwFlags;
@@ -263,55 +261,53 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) hDbEvent = db_event_next(event->hContact, hDbEvent);
continue;
}
+
IEVIEWEVENTDATA *eventData = new IEVIEWEVENTDATA;
- eventData->cbSize = sizeof(IEVIEWEVENTDATA);
eventData->dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2 |
(dbei.flags & DBEF_READ ? IEEDF_READ : 0) | (dbei.flags & DBEF_SENT ? IEEDF_SENT : 0) | (dbei.flags & DBEF_RTL ? IEEDF_RTL : 0);
if (event->dwFlags & IEEF_RTL)
eventData->dwFlags |= IEEDF_RTL;
eventData->time = dbei.timestamp;
- eventData->pszNickW = nullptr;
- eventData->pszTextW = nullptr;
- eventData->pszText2W = nullptr;
+ eventData->szNick.a = eventData->szText.a = eventData->szText2.a = nullptr;
if (dbei.flags & DBEF_SENT) {
- eventData->pszNickW = getContactName(NULL, szProto);
+ eventData->szNick.w = getContactName(NULL, szProto);
eventData->bIsMe = TRUE;
}
else {
- eventData->pszNickW = getContactName(event->hContact, szProto);
+ eventData->szNick.w = getContactName(event->hContact, szProto);
eventData->bIsMe = FALSE;
}
if (dbei.eventType == EVENTTYPE_MESSAGE || Utils::DbEventIsForMsgWindow(&dbei)) {
- eventData->pszTextW = DbEvent_GetTextW(&dbei, newEvent.codepage);
+ eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
if (dbei.eventType == EVENTTYPE_MESSAGE)
eventData->iType = IEED_EVENT_MESSAGE;
else
eventData->iType = IEED_EVENT_STATUSCHANGE;
}
else if (dbei.eventType == EVENTTYPE_FILE) {
- //blob is: sequenceid(DWORD),filename(ASCIIZ),description(ASCIIZ)
+ // blob is: sequenceid(DWORD),filename(ASCIIZ),description(ASCIIZ)
char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
char* descr = filename + mir_strlen(filename) + 1;
- eventData->ptszText = DbEvent_GetString(&dbei, filename);
+ eventData->szText.w = DbEvent_GetString(&dbei, filename);
if (*descr != '\0')
- eventData->ptszText2 = DbEvent_GetString(&dbei, descr);
+ eventData->szText.w = DbEvent_GetString(&dbei, descr);
eventData->iType = IEED_EVENT_FILE;
}
else if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
- //blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- eventData->ptszText = mir_wstrdup(TranslateT(" requested authorization"));
- eventData->ptszNick = DbEvent_GetString(&dbei, (char *)dbei.pBlob + 8);
+ // blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
+ eventData->szText.w = mir_wstrdup(TranslateT(" requested authorization"));
+ eventData->szNick.w = DbEvent_GetString(&dbei, (char *)dbei.pBlob + 8);
eventData->iType = IEED_EVENT_SYSTEM;
}
else if (dbei.eventType == EVENTTYPE_ADDED) {
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- eventData->ptszText = mir_wstrdup(TranslateT(" was added."));
- eventData->ptszNick = DbEvent_GetString(&dbei, (char *)dbei.pBlob + 8);
+ eventData->szText.w = mir_wstrdup(TranslateT(" was added."));
+ eventData->szNick.w = DbEvent_GetString(&dbei, (char *)dbei.pBlob + 8);
eventData->iType = IEED_EVENT_SYSTEM;
}
else { // custom event
- eventData->pszTextW = DbEvent_GetTextW(&dbei, newEvent.codepage);
+ eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
eventData->iType = IEED_EVENT_MESSAGE;
}
free(dbei.pBlob);
@@ -329,9 +325,9 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) appendEventNew(view, &newEvent);
for (IEVIEWEVENTDATA* eventData2 = newEvent.eventData; eventData2 != nullptr;) {
IEVIEWEVENTDATA *eventData = eventData2->next;
- mir_free((void*)eventData2->pszTextW);
- mir_free((void*)eventData2->pszText2W);
- mir_free((void*)eventData2->pszNickW);
+ mir_free((void*)eventData2->szText.w);
+ mir_free((void*)eventData2->szText2.w);
+ mir_free((void*)eventData2->szNick.w);
delete eventData2;
eventData2 = eventData;
}
@@ -384,12 +380,9 @@ ProtocolSettings* HTMLBuilder::getChatProtocolSettings(MCONTACT hContact) void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event)
{
- lastIEViewEvent.cbSize = sizeof(IEVIEWEVENT);
lastIEViewEvent.iType = event->iType;
lastIEViewEvent.codepage = CP_ACP;
- if (event->cbSize >= IEVIEWEVENT_SIZE_V2)
- lastIEViewEvent.codepage = event->codepage;
-
+ lastIEViewEvent.codepage = event->codepage;
lastIEViewEvent.count = 0;
lastIEViewEvent.dwFlags = event->dwFlags;
lastIEViewEvent.hContact = event->hContact;
@@ -398,7 +391,7 @@ void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event) if (lastIEViewEvent.pszProto != nullptr)
mir_free((void*)lastIEViewEvent.pszProto);
- if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != nullptr)
+ if (event->pszProto != nullptr)
lastIEViewEvent.pszProto = mir_strdup(event->pszProto);
else
lastIEViewEvent.pszProto = getProto(event->hContact);
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index e119e4c84a..254da8de27 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -230,14 +230,14 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event {
ptrA szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.w, ENF_NAMESMILEYS, true);
else
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNick, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.a, ENF_NAMESMILEYS, true);
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszTextW, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.w, ENF_ALL, isSent);
else
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszText, event->codepage, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.a, event->codepage, ENF_ALL, isSent);
/* History++-specific formatting */
const char *iconFile = nullptr;
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 260b9b007d..fdce55d149 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -979,11 +979,7 @@ void* IEView::getSelection(IEVIEWEVENT *event) return nullptr;
if (event->dwFlags & IEEF_NO_UNICODE) {
- int cp = CP_ACP;
- if (event->cbSize >= IEVIEWEVENT_SIZE_V2)
- cp = event->codepage;
-
- char *str = mir_u2a_cp(selectedText, cp);
+ char *str = mir_u2a_cp(selectedText, event->codepage);
mir_free(selectedText);
selectedText = (BSTR)str;
}
@@ -1131,7 +1127,7 @@ void IEView::saveDocument() void IEView::navigate(IEVIEWNAVIGATE *nav)
{
if (nav->dwFlags & IENF_UNICODE)
- navigate(nav->urlW);
+ navigate(nav->url.w);
else
- navigate(nav->url);
+ navigate(nav->url.a);
}
\ No newline at end of file diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index b2bd3968f4..dfe6f525eb 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -188,14 +188,14 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) ptrA szName, szText;
if (eventData->iType == IEED_MUCC_EVENT_MESSAGE) {
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszTextW, ENF_ALL, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szText.w, ENF_ALL, isSent);
else
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszText, ENF_ALL, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szText.a, ENF_ALL, isSent);
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
- szName = encodeUTF8(NULL, event->pszProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(NULL, event->pszProto, eventData->szNick.w, ENF_NAMESMILEYS, true);
else
- szName = encodeUTF8(NULL, event->pszProto, eventData->pszNick, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(NULL, event->pszProto, eventData->szNick.a, ENF_NAMESMILEYS, true);
str.AppendFormat("<div class=\"%s\">", isSent ? "divOut" : "divIn");
if (dwData & IEEDD_MUCC_SHOW_TIME || dwData & IEEDD_MUCC_SHOW_DATE)
@@ -231,19 +231,19 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) className = "userJoined";
divName = "divUserJoined";
eventText = LPGEN("%s has joined.");
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszNick, ENF_NONE, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szNick.a, ENF_NONE, isSent);
}
else if (eventData->iType == IEED_MUCC_EVENT_LEFT) {
className = "userLeft";
divName = "divUserJoined";
eventText = LPGEN("%s has left.");
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszNick, ENF_NONE, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szNick.a, ENF_NONE, isSent);
}
else {
className = "topicChange";
divName = "divTopicChange";
eventText = LPGEN("The topic is %s.");
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszText, ENF_ALL, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szText.a, ENF_ALL, isSent);
}
str.AppendFormat("<div class=\"%s\">", divName);
if (dwData & IEEDD_MUCC_SHOW_TIME || dwData & IEEDD_MUCC_SHOW_DATE)
@@ -256,7 +256,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) }
else if (eventData->iType == IEED_MUCC_EVENT_ERROR) {
const char *className = "error";
- szText = encodeUTF8(NULL, event->pszProto, eventData->pszText, ENF_NONE, isSent);
+ szText = encodeUTF8(NULL, event->pszProto, eventData->szText.a, ENF_NONE, isSent);
str.AppendFormat("<div class=\"%s\">", "divError");
str.AppendFormat("<span class=\"%s\"> %s: %s</span>", className, Translate("Error"), szText.get());
str.Append("</div>\n");
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 7086f35447..a47915f720 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -290,14 +290,14 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event }
ptrA szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.w, ENF_NAMESMILEYS, true);
else
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNick, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.a, ENF_NAMESMILEYS, true);
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszTextW, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.w, ENF_ALL, isSent);
else
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszText, event->codepage, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.a, event->codepage, ENF_ALL, isSent);
/* Scriver-specific formatting */
if ((dwFlags & SMF_LOG_DRAWLINES) && isGroupBreak && getLastEventType() != -1) {
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index 1b51148521..67b32c90f1 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -316,14 +316,14 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event ptrA szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.w, ENF_NAMESMILEYS, true);
else
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNick, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.a, ENF_NAMESMILEYS, true);
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszTextW, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.w, ENF_ALL, isSent);
else
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszText, event->codepage, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.a, event->codepage, ENF_ALL, isSent);
/* TabSRMM-specific formatting */
CMStringA str;
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index b1c07e4feb..30dc664cc2 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -390,18 +390,18 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, char *szName = nullptr, *szText = nullptr, *szFileDesc = nullptr;
if (event->eventData->dwFlags & IEEDF_UNICODE_NICK)
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.w, ENF_NAMESMILEYS, true);
else
- szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNick, ENF_NAMESMILEYS, true);
+ szName = encodeUTF8(event->hContact, szRealProto, eventData->szNick.a, ENF_NAMESMILEYS, true);
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszTextW, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.w, ENF_ALL, isSent);
else
- szText = encodeUTF8(event->hContact, szRealProto, eventData->pszText, event->codepage, ENF_ALL, isSent);
+ szText = encodeUTF8(event->hContact, szRealProto, eventData->szText.a, event->codepage, ENF_ALL, isSent);
if (eventData->dwFlags & IEEDF_UNICODE_TEXT2)
- szFileDesc = encodeUTF8(event->hContact, szRealProto, eventData->pszText2W, 0, isSent);
+ szFileDesc = encodeUTF8(event->hContact, szRealProto, eventData->szText2.w, 0, isSent);
else
- szFileDesc = encodeUTF8(event->hContact, szRealProto, eventData->pszText2, event->codepage, 0, isSent);
+ szFileDesc = encodeUTF8(event->hContact, szRealProto, eventData->szText2.a, event->codepage, 0, isSent);
if (eventData->iType == IEED_EVENT_MESSAGE) {
if (!isRTL) {
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index db4f52baa2..92afe9a947 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -168,39 +168,28 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieWindow.cy = rcLst.bottom - rcLst.top;
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- IEVIEWEVENTDATA ieData;
+ IEVIEWEVENTDATA ieData = {};
- IEVIEWEVENT ieEvent;
- ieEvent.cbSize = sizeof(ieEvent);
+ IEVIEWEVENT ieEvent = {};
ieEvent.iType = IEE_LOG_MEM_EVENTS;
- ieEvent.dwFlags = 0;
ieEvent.hwnd = hwndLog;
ieEvent.eventData = &ieData;
ieEvent.count = 1;
- ieEvent.codepage = 0;
- ieEvent.pszProto = nullptr;
for (auto &ppd : arPopupHistory) {
- ieData.cbSize = sizeof(ieData);
ieData.iType = IEED_EVENT_SYSTEM;
- ieData.dwFlags = 0;
ieData.color = ppd->colorText;
if (ppd->flags & PU2_UNICODE) {
- ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->szTitle.w;
- ieData.pszTextW = ppd->szText.w;
- ieData.pszText2W = nullptr;
+ ieData.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
+ ieData.szNick.w = ppd->szTitle.w;
+ ieData.szText.w = ppd->szText.w;
}
else {
- ieData.dwFlags |= 0;
- ieData.pszNick = ppd->szTitle.a;
- ieData.pszText = ppd->szText.a;
- ieData.pszText2 = nullptr;
+ ieData.dwFlags = 0;
+ ieData.szNick.a = ppd->szTitle.a;
+ ieData.szText.a = ppd->szText.a;
}
- ieData.bIsMe = FALSE;
ieData.time = ppd->dwTimestamp;
- ieData.dwData = 0;
- ieData.next = nullptr;
CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent);
}
}
@@ -353,38 +342,26 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara if (logType == LOG_HPP) {
POPUPDATA2 *ppd = (POPUPDATA2 *)lParam;
- IEVIEWEVENTDATA ieData;
+ IEVIEWEVENTDATA ieData = {};
- IEVIEWEVENT ieEvent;
- ieEvent.cbSize = sizeof(ieEvent);
+ IEVIEWEVENT ieEvent = {};
ieEvent.iType = IEE_LOG_MEM_EVENTS;
- ieEvent.dwFlags = 0;
ieEvent.hwnd = hwndLog;
ieEvent.eventData = &ieData;
ieEvent.count = 1;
- ieEvent.codepage = 0;
- ieEvent.pszProto = nullptr;
- ieData.cbSize = sizeof(ieData);
- ieData.dwFlags = 0;
ieData.iType = IEED_EVENT_SYSTEM;
ieData.color = ppd->colorText;
if (ppd->flags & PU2_UNICODE) {
ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->szTitle.w;
- ieData.pszTextW = ppd->szText.w;
- ieData.pszText2W = nullptr;
+ ieData.szNick.w = ppd->szTitle.w;
+ ieData.szText.w = ppd->szText.w;
}
else {
- ieData.dwFlags |= 0;
- ieData.pszNick = ppd->szTitle.a;
- ieData.pszText = ppd->szText.a;
- ieData.pszText2 = nullptr;
+ ieData.szNick.a = ppd->szTitle.a;
+ ieData.szText.a = ppd->szText.a;
}
- ieData.bIsMe = FALSE;
ieData.time = ppd->dwTimestamp;
- ieData.dwData = 0;
- ieData.next = nullptr;
CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent);
}
else if (logType == LOG_DEFAULT) {
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index f249f03755..02224330c0 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -631,9 +631,7 @@ void CMsgDialog::StreamInEvents(MEVENT hDbEventFirst, int count, int bAppend) // IEVIew MOD Begin
if (m_hwndIeview != nullptr) {
IEVIEWEVENT evt;
- IEVIEWWINDOW ieWindow;
- memset(&evt, 0, sizeof(evt));
- evt.cbSize = sizeof(evt);
+ IEVIEWWINDOW ieWindow = {};
evt.dwFlags = (m_bUseRtl) ? IEEF_RTL : 0;
evt.hwnd = m_hwndIeview;
evt.hContact = m_hContact;
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index e53df65031..f2a45e76d1 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1870,8 +1870,7 @@ void CMsgDialog::tabClearLog() } else { if (m_hwndIEView || m_hwndHPP) { - IEVIEWEVENT event; - event.cbSize = sizeof(IEVIEWEVENT); + IEVIEWEVENT event = {}; event.iType = IEE_CLEAR_LOG; event.dwFlags = (m_dwFlags & MWF_LOG_RTL) ? IEEF_RTL : 0; event.hContact = m_hContact; diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index dfbf83e653..a709216efd 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1193,8 +1193,7 @@ void CMsgDialog::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DB if (m_hwndIEView != nullptr || m_hwndHPP != nullptr) {
const char *pszService;
- IEVIEWEVENT event = { 0 };
- event.cbSize = sizeof(IEVIEWEVENT);
+ IEVIEWEVENT event = {};
event.hContact = m_hContact;
if (m_hwndIEView != nullptr) {
event.pszProto = m_szProto;
@@ -1216,7 +1215,6 @@ void CMsgDialog::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DB IEVIEWEVENTDATA evData = { 0 };
if (dbei_s != nullptr && hDbEventFirst == 0) {
- evData.cbSize = sizeof(evData);
event.iType = IEE_LOG_MEM_EVENTS;
if (dbei_s->flags & DBEF_SENT) {
evData.dwFlags = IEEDF_SENT;
@@ -1224,7 +1222,7 @@ void CMsgDialog::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DB }
else {
evData.dwFlags = IEEDF_UNICODE_NICK;
- evData.ptszNick = Clist_GetContactDisplayName(m_hContact);
+ evData.szNick.w = Clist_GetContactDisplayName(m_hContact);
}
switch (dbei_s->eventType) {
case EVENTTYPE_STATUSCHANGE: evData.iType = IEED_EVENT_STATUSCHANGE; break;
@@ -1232,7 +1230,7 @@ void CMsgDialog::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DB case EVENTTYPE_ERRMSG: evData.iType = IEED_EVENT_ERRMSG; break;
default: evData.iType = IEED_EVENT_MESSAGE; break;
}
- evData.pszText = (char*)dbei_s->pBlob;
+ evData.szText.a = (char*)dbei_s->pBlob;
evData.time = dbei_s->timestamp;
event.eventData = &evData;
event.codepage = CP_UTF8;
diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp index 58b1600b3a..33fe4c32a2 100644 --- a/plugins/TranslitSwitcher/src/Layoutproc.cpp +++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp @@ -381,12 +381,8 @@ void SwitchLayout(bool lastword) if ((mir_wstrcmp(szClassName, L"THppRichEdit.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"THistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"TExtHistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0)) {
wchar_t buf[2048];
if (mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0) {
- IEVIEWEVENT event;
HWND hwnd3 = GetParent(GetParent(hwnd2));
- memset(&event, 0, sizeof(event));
- event.cbSize = sizeof(IEVIEWEVENT);
- event.hContact = 0;
- event.dwFlags = 0;
+ IEVIEWEVENT event = {};
event.iType = IEE_GET_SELECTION;
event.hwnd = hwnd3;
wchar_t *selected = (wchar_t *)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
diff --git a/src/core/stdpopup/src/yapp_history_dlg.cpp b/src/core/stdpopup/src/yapp_history_dlg.cpp index 8bc36875b0..7822753c7e 100644 --- a/src/core/stdpopup/src/yapp_history_dlg.cpp +++ b/src/core/stdpopup/src/yapp_history_dlg.cpp @@ -293,33 +293,23 @@ void UnloadRenderer(HWND hWnd, int renderer) void DeleteOldEvents(HWND hWnd, int renderer) { - switch (renderer) - { - case RENDER_HISTORYPP: - case RENDER_IEVIEW: - { - PopupHistoryWindowData *data = (PopupHistoryWindowData *) GetWindowLongPtr(hWnd, GWLP_USERDATA); - if (data) - { - IEVIEWEVENT ieEvent = {0}; - ieEvent.cbSize = sizeof(IEVIEWEVENT); - ieEvent.hwnd = data->hIEView; - ieEvent.iType = IEE_CLEAR_LOG; - - CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_EVENT : MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent); - } - - break; - } - - case RENDER_DEFAULT: - default: - { - ListView_DeleteAllItems(GetDlgItem(hWnd, IDC_LST_HISTORY)); - - break; + PopupHistoryWindowData *data = (PopupHistoryWindowData *)GetWindowLongPtr(hWnd, GWLP_USERDATA); + + switch (renderer) { + case RENDER_HISTORYPP: + case RENDER_IEVIEW: + if (data) { + IEVIEWEVENT ieEvent = {}; + ieEvent.hwnd = data->hIEView; + ieEvent.iType = IEE_CLEAR_LOG; + CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_EVENT : MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent); } + break; + case RENDER_DEFAULT: + default: + ListView_DeleteAllItems(GetDlgItem(hWnd, IDC_LST_HISTORY)); + break; } } @@ -328,34 +318,27 @@ typedef void (*SIG_ADDEVENTS)(HWND hWnd, int renderer, wchar_t *filter, SIG_MATC IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem) { - IEVIEWEVENTDATA *eventData = (IEVIEWEVENTDATA *) mir_calloc(sizeof(IEVIEWEVENTDATA)); - if (eventData) - { - eventData->cbSize = sizeof(IEVIEWEVENTDATA); + IEVIEWEVENTDATA *eventData = (IEVIEWEVENTDATA *)mir_calloc(sizeof(IEVIEWEVENTDATA)); + if (eventData) { eventData->iType = IEED_EVENT_MESSAGE; - eventData->dwFlags = IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT | IEEDF_UNICODE_TEXT2; - eventData->pszNickW = popupItem->titleW; - eventData->pszTextW = popupItem->messageW; + eventData->szNick.w = popupItem->titleW; + eventData->szText.w = popupItem->messageW; - eventData->time = (DWORD) popupItem->timestamp; + eventData->time = (DWORD)popupItem->timestamp; eventData->next = nullptr; } - + return eventData; } void AddEventsCustomControl(HWND hWnd, int renderer, wchar_t *filter, SIG_MATCHESFILTER MatchesFilter) { - PopupHistoryWindowData *pwData = (PopupHistoryWindowData *) GetWindowLongPtr(hWnd, GWLP_USERDATA); - if (pwData) - { - IEVIEWEVENT ieEvent = {0}; - ieEvent.cbSize = sizeof(IEVIEWEVENT); + PopupHistoryWindowData *pwData = (PopupHistoryWindowData *)GetWindowLongPtr(hWnd, GWLP_USERDATA); + if (pwData) { + IEVIEWEVENT ieEvent = {}; ieEvent.hwnd = pwData->hIEView; - ieEvent.codepage = CP_ACP; ieEvent.iType = IEE_LOG_MEM_EVENTS; - ieEvent.hContact = NULL; IEVIEWEVENTDATA *eventData = nullptr; IEVIEWEVENTDATA *cED = nullptr; @@ -366,34 +349,27 @@ void AddEventsCustomControl(HWND hWnd, int renderer, wchar_t *filter, SIG_MATCHE int size = lstPopupHistory.Count(); PopupHistoryData *popupItem; - for (i = 0; i < size; i++) - { + for (i = 0; i < size; i++) { popupItem = lstPopupHistory.Get(i); - if (MatchesFilter(filter, popupItem)) - { + if (MatchesFilter(filter, popupItem)) { cED = CreateAndFillEventData(popupItem); - if (cED) - { + if (cED) { count++; if (!eventData) - { eventData = cED; - } - else{ + else prevED->next = cED; - } - + prevED = cED; } } } + ieEvent.count = count; ieEvent.eventData = eventData; - CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_EVENT : MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent); - while (eventData) - { + while (eventData) { cED = eventData; eventData = eventData->next; mir_free(cED); @@ -406,15 +382,14 @@ void AddEventsDefault(HWND hWnd, int, wchar_t *filter, SIG_MATCHESFILTER Matches HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY); wchar_t buffer[1024]; struct tm *myTime; - - LVITEM item = {0}; + + LVITEM item = { 0 }; item.mask = LVIF_TEXT; int i, lIndex; lIndex = 0; PopupHistoryData *popupItem; - for (i = 0; i < lstPopupHistory.Count(); i++) - { + for (i = 0; i < lstPopupHistory.Count(); i++) { item.iItem = lIndex; popupItem = lstPopupHistory.Get(i); if (MatchesFilter(filter, popupItem)) @@ -431,7 +406,9 @@ void AddEventsDefault(HWND hWnd, int, wchar_t *filter, SIG_MATCHESFILTER Matches void RefreshPopupHistory(HWND hWnd, int renderer) { - if (!hWnd) { return; } + if (!hWnd) + return; + const int MAX_FILTER_SIZE = 1024; SIG_MATCHESFILTER MatchesFilter = (IsDlgButtonChecked(hWnd, IDC_HISTORY_FILTER_CASESENSITIVE)) ? MatchesFilterCS : MatchesFilterCI; //case sensitive compare or not ? @@ -439,33 +416,29 @@ void RefreshPopupHistory(HWND hWnd, int renderer) wchar_t filter[MAX_FILTER_SIZE]; DeleteOldEvents(hWnd, renderer); //delete events - + GetDlgItemText(hWnd, IDC_HISTORY_FILTER, filter, _countof(filter)); //get filter text - + AddEvents(hWnd, renderer, filter, MatchesFilter); - - if (renderer == RENDER_DEFAULT) - { + + if (renderer == RENDER_DEFAULT) { HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY); SortParams params = {}; params.hList = hHistoryList; params.column = lastColumn; - + ListView_SortItemsEx(hHistoryList, PopupsCompare, ¶ms); } } void CopyPopupDataToClipboard(HWND hList, int selection) { - if (!selection) - { + if (!selection) { return; } - - if (!GetOpenClipboardWindow()) - { - if (OpenClipboard(hList)) - { + + if (!GetOpenClipboardWindow()) { + if (OpenClipboard(hList)) { wchar_t buffer[2048]; buffer[0] = '\0'; wchar_t *clipboard; @@ -476,38 +449,34 @@ void CopyPopupDataToClipboard(HWND hList, int selection) textType = CF_UNICODETEXT; - - for (i = 0; i < count; i++) - { - if (ListView_GetItemState(hList, i, LVIS_SELECTED)) - { + + for (i = 0; i < count; i++) { + if (ListView_GetItemState(hList, i, LVIS_SELECTED)) { ListView_GetItemText(hList, i, selection - 100, buffer, _countof(buffer)); found = 1; break; } } - if (found) - { + if (found) { EmptyClipboard(); int len = (int)mir_wstrlen(buffer); - + HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(wchar_t)); - clipboard = (wchar_t *) GlobalLock(hData); + clipboard = (wchar_t *)GlobalLock(hData); wcsncpy(clipboard, buffer, len); clipboard[len] = '\0'; GlobalUnlock(hData); - if (!SetClipboardData(textType, hData)) - { + if (!SetClipboardData(textType, hData)) { PUShowMessage("Could not set clipboard data", SM_WARNING); } } CloseClipboard(); } - else{ + else { PUShowMessage("Could not open clipboard", SM_WARNING); } } - else{ + else { PUShowMessage("The clipboard is not available", SM_WARNING); } } @@ -519,7 +488,7 @@ static LRESULT CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wPara case WM_CONTEXTMENU: { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - int selection; + int selection; HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard")); @@ -527,8 +496,7 @@ static LRESULT CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wPara AppendMenu(hMenu, MF_STRING, POPUPMENU_TIMESTAMP, TranslateT("Copy timestamp to clipboard")); selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, nullptr); DestroyMenu(hMenu); - if (selection) - { + if (selection) { CopyPopupDataToClipboard(hWnd, selection); } @@ -563,16 +531,15 @@ void LoadHistoryColumns(HWND hHistoryList) LVCOLUMN col; col.mask = LVCF_TEXT | LVCF_WIDTH; int i; - - for (i = 0; i < cHistoryColumns; i++) - { + + for (i = 0; i < cHistoryColumns; i++) { col.pszText = TranslateW(szHistoryColumns[i]); col.cx = cxHistoryColumns[i]; ListView_InsertColumn(hHistoryList, i, &col); } } -//this is the history list window handler +// this is the history list window handler INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int bInitializing; @@ -610,7 +577,7 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_WINDOWPOSCHANGING: { - WINDOWPOS *wndPos = (WINDOWPOS *) lParam; + WINDOWPOS *wndPos = (WINDOWPOS *)lParam; if (wndPos->cx < MIN_HISTORY_WIDTH) wndPos->cx = MIN_HISTORY_WIDTH; @@ -650,22 +617,20 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case IDC_LST_HISTORY: switch (((LPNMHDR)lParam)->code) { case LVN_COLUMNCLICK: - { - LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam; - int column = lv->iSubItem; - SortParams params = {}; - params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY); - params.column = column; + LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam; + int column = lv->iSubItem; + SortParams params = {}; + params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY); + params.column = column; - ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM) ¶ms); - lastColumn = (params.column == lastColumn) ? -1 : params.column; + ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM)¶ms); + lastColumn = (params.column == lastColumn) ? -1 : params.column; - break; - } + break; } } break; |