summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-28 14:21:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-28 14:21:33 +0300
commiteccbb5307a048e70ac4adb0d3fd333be28245fa8 (patch)
treea9a2c92c13391a5cf288c9e0d841833c54f3cd5e
parent6a9e3738066370dac38f5f6768b8a6f61fe709e0 (diff)
massive cleanup of useless cbSize fields
-rw-r--r--include/delphi/m_message.inc23
-rw-r--r--include/m_message.h46
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp7
-rw-r--r--plugins/Dropbox/src/dropbox_events.cpp4
-rw-r--r--plugins/Dropbox/src/dropbox_options.cpp4
-rw-r--r--plugins/FavContacts/src/services.cpp6
-rw-r--r--plugins/FingerprintNG/src/fingerprint.cpp6
-rw-r--r--plugins/HistorySweeperLight/src/historysweeperlight.cpp1
-rw-r--r--plugins/HistorySweeperLight/src/main.cpp4
-rw-r--r--plugins/HistorySweeperLight/src/options.cpp1
-rw-r--r--plugins/MessageState/src/messagestate.cpp4
-rw-r--r--plugins/MirFox/src/MirandaUtils.cpp2
-rw-r--r--plugins/MirLua/src/m_message.cpp1
-rw-r--r--plugins/MirOTR/src/svcs_srmm.cpp12
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/MsgEventAdded.cpp7
-rw-r--r--plugins/NewEventNotify/src/main.cpp5
-rw-r--r--plugins/NewXstatusNotify/src/utils.cpp2
-rw-r--r--plugins/New_GPG/src/icons.cpp2
-rw-r--r--plugins/New_GPG/src/init.cpp2
-rw-r--r--plugins/NoHistory/src/dllmain.cpp8
-rw-r--r--plugins/Nudge/src/shake.cpp5
-rw-r--r--plugins/Popup/src/srmm_menu.cpp4
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp20
-rw-r--r--plugins/Scriver/src/chat_window.cpp2
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/input.cpp1
-rw-r--r--plugins/Scriver/src/msgdialog.cpp4
-rw-r--r--plugins/Scriver/src/msgs.cpp10
-rw-r--r--plugins/SecureIM/src/crypt_icons.cpp2
-rw-r--r--plugins/SecureIM/src/svcs_srmm.cpp2
-rw-r--r--plugins/Sessions/Src/Main.cpp13
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp37
-rw-r--r--plugins/SpellChecker/src/spellchecker.cpp4
-rw-r--r--plugins/SpellChecker/src/utils.cpp7
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp1
-rw-r--r--plugins/TabSRMM/src/msgs.cpp6
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp2
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp26
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp6
-rw-r--r--plugins/Utils.pas/mircontacts.pas13
-rw-r--r--plugins/WinterSpeak/src/SpeakAnnounce.cpp3
-rw-r--r--protocols/FacebookRM/src/json.cpp3
-rw-r--r--protocols/FacebookRM/src/proto.cpp1
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp7
-rw-r--r--protocols/MSN/src/msn_proto.h6
-rw-r--r--protocols/MSN/src/msn_svcs.cpp32
-rw-r--r--protocols/Omegle/src/communication.cpp2
-rw-r--r--protocols/VKontakte/src/misc.cpp1
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp10
-rw-r--r--protocols/WhatsApp/src/utils.cpp1
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp16
-rw-r--r--src/mir_app/src/meta_services.cpp2
-rw-r--r--src/mir_app/src/meta_utils.cpp2
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp11
59 files changed, 144 insertions, 277 deletions
diff --git a/include/delphi/m_message.inc b/include/delphi/m_message.inc
index 1a50da7c6f..f8b51e8bea 100644
--- a/include/delphi/m_message.inc
+++ b/include/delphi/m_message.inc
@@ -53,22 +53,6 @@ const
MSG_WINDOW_UFLAG_MSG_TO = $00000002;
MSG_WINDOW_UFLAG_MSG_BOTH = $00000004;
-type
- PMessageWindowEventData = ^TMessageWindowEventData;
- TMessageWindowEventData = record
- cbSize : int;
- hContact : TMCONTACT;
- hwndWindow: HWND; // top level window for the contact
- szModule : PAnsiChar; // used to get plugin type (which means you could use
- // local if needed)
- uType : uint; // see event types above
- uFlags : uint; // used to indicate message direction for all event
- // types except custom
- local : pointer; // used to store pointer to custom data
- hwndInput : HWND; // input area window for the contact (or NULL if there is none)
- hwndLog : HWND; // log area window for the contact (or NULL if there is none)
- end;
-
const
{ wparam=0
lparam=0
@@ -86,7 +70,6 @@ const
type
PMessageWindowInputData = ^TMessageWindowInputData;
TMessageWindowInputData = record
- cbSize : int;
hContact: TMCONTACT;
uFlags : int; // see uflags above
end;
@@ -101,7 +84,6 @@ const
type
PMessageWindowOutputData = ^TMessageWindowOutputData;
TMessageWindowOutputData = record
- cbSize : int;
hContact : TMCONTACT;
uFlags : int; // should be same as input data unless 0, then it
// will be the actual type
@@ -123,7 +105,6 @@ const
type
PStatusTextData = ^TStatusTextData;
TStatusTextData = record
- cbSize :int;
hIcon :HICON;
tszText:array [0..99] of WideChar;
end;
@@ -138,7 +119,6 @@ const
type
pMessageWindowEvent = ^tMessageWindowEvent;
tMessageWindowEvent = record
- cbSize :int;
seq :int; // number returned by PSS_MESSAGE
hContact :TMCONTACT;
dbei :PDBEVENTINFO; // database event written on the basis of message sent
@@ -167,7 +147,6 @@ const
type
tMessageWindowPopupData = record
- cbSize :int;
uType :uint; // see popup types above
uFlags :uint; // used to indicate in which window the popup was requested
hContact :TMCONTACT;
@@ -186,7 +165,6 @@ const
type
pStatusIconData = ^tStatusIconData;
tStatusIconData = record
- cbSize :int; // must be equal to sizeof(StatusIconData)
szModule :PAnsiChar; // used in combo with the dwId below to create a unique identifier
dwId :dword; // uniquely defines a button inside a module
hIcon,
@@ -202,7 +180,6 @@ const
type
pStatusIconClickData = ^tStatusIconClickData;
tStatusIconClickData = record
- cbSize :int;
clickLocation:TPOINT; // click location, in screen coordinates
szModule :PAnsiChar;
dwId :dword;
diff --git a/include/m_message.h b/include/m_message.h
index a3cfee132e..43c7612cda 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -43,59 +43,58 @@ extern int hLangpack;
#define ME_MSG_WINDOWEVENT "MessageAPI/WindowEvent"
// wparam = 0
// lparam = (WPARAM)(MessageWindowEventData*)hWindowEvent;
+
// Event types
#define MSG_WINDOW_EVT_OPENING 1 //window is about to be opened
#define MSG_WINDOW_EVT_OPEN 2 //window has been opened
#define MSG_WINDOW_EVT_CLOSING 3 //window is about to be closed
#define MSG_WINDOW_EVT_CLOSE 4 //window has been closed
-#define MSG_WINDOW_EVT_CUSTOM 5 //custom event for message plugins to use (custom uFlags may be used)
#define MSG_WINDOW_UFLAG_MSG_FROM 0x00000001
#define MSG_WINDOW_UFLAG_MSG_TO 0x00000002
#define MSG_WINDOW_UFLAG_MSG_BOTH 0x00000004
-typedef struct {
- int cbSize;
+struct MessageWindowEventData
+{
MCONTACT hContact;
HWND hwndWindow; // top level window for the contact
- const char* szModule; // used to get plugin type (which means you could use local if needed)
unsigned int uType; // see event types above
unsigned int uFlags; // used to indicate message direction for all event types except custom
void *local; // used to store pointer to custom data
HWND hwndInput; // input area window for the contact (or NULL if there is none)
HWND hwndLog; // log area window for the contact (or NULL if there is none)
-} MessageWindowEventData;
+};
-typedef struct {
- int cbSize;
+struct StatusTextData
+{
HICON hIcon;
wchar_t tszText[100];
-} StatusTextData;
+};
// wparam = (MCONTACT)hContact
// lparam = (StatusTextData*) or NULL to clear statusbar
// Sets a statusbar line text for the appropriate contact
#define MS_MSG_SETSTATUSTEXT "MessageAPI/SetStatusText"
-typedef struct {
- int cbSize;
+struct MessageWindowInputData
+{
MCONTACT hContact;
int uFlags; // see uflags above
-} MessageWindowInputData;
+};
#define MSG_WINDOW_STATE_EXISTS 0x00000001 // Window exists should always be true if hwndWindow exists
#define MSG_WINDOW_STATE_VISIBLE 0x00000002
#define MSG_WINDOW_STATE_FOCUS 0x00000004
#define MSG_WINDOW_STATE_ICONIC 0x00000008
-typedef struct {
- int cbSize;
+struct MessageWindowData
+{
MCONTACT hContact;
int uFlags; // should be same as input data unless 0, then it will be the actual type
HWND hwndWindow; //top level window for the contact or NULL if no window exists
int uState; // see window states
void *local; // used to store pointer to custom data
-} MessageWindowData;
+};
// wparam = (MessageWindowInputData*)
// lparam = (MessageWindowData*)
@@ -107,12 +106,12 @@ typedef struct {
// fired before SRMM writes an entered message into the database
#define ME_MSG_PRECREATEEVENT "MessageAPI/PreCreateEvent"
-typedef struct {
- int cbSize;
+struct MessageWindowEvent
+{
int seq; // number returned by PSS_MESSAGE
MCONTACT hContact;
DBEVENTINFO *dbei; // database event written on the basis of message sent
-} MessageWindowEvent;
+};
/////////////////////////////////////////////////////////////////////////////////////////
// SRMM popup menu
@@ -131,8 +130,8 @@ typedef struct {
#define MSG_WINDOWPOPUP_INPUT 1
#define MSG_WINDOWPOPUP_LOG 2
-typedef struct {
- int cbSize;
+struct MessageWindowPopupData
+{
unsigned int uType; // see popup types above
unsigned int uFlags; // used to indicate in which window the popup was requested
MCONTACT hContact;
@@ -140,7 +139,7 @@ typedef struct {
HMENU hMenu; // The handle to the menu
POINT pt; // The point, in screen coords
int selection; // The menu control id or 0 if no one was selected
-} MessageWindowPopupData;
+};
/////////////////////////////////////////////////////////////////////////////////////////
// status icons
@@ -149,8 +148,8 @@ typedef struct {
#define MBF_HIDDEN 0x02
#define MBF_UNICODE 0x04
-typedef struct {
- int cbSize; // must be equal to sizeof(StatusIconData)
+struct StatusIconData
+{
char *szModule; // used in combo with the dwId below to create a unique identifier
DWORD dwId; // uniquely defines a button inside a module
HICON hIcon, hIconDisabled; // hIconDisabled is optional - if null, will use hIcon in the disabled state
@@ -160,7 +159,7 @@ typedef struct {
wchar_t *tszTooltip;
wchar_t *wszTooltip;
};
-} StatusIconData;
+};
#define MBCF_RIGHTBUTTON 0x01 // if this flag is specified, the click was a right button - otherwize it was a left click
@@ -186,7 +185,6 @@ EXTERN_C MIR_APP_DLL(StatusIconData*) Srmm_GetNthIcon(MCONTACT hContact, int ind
struct StatusIconClickData
{
- int cbSize;
POINT clickLocation; // click location, in screen coordinates
char *szModule;
DWORD dwId;
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp
index 1ab9cbd72d..0683405bb6 100644
--- a/plugins/CountryFlags/src/extraimg.cpp
+++ b/plugins/CountryFlags/src/extraimg.cpp
@@ -89,7 +89,7 @@ void UpdateExtraImages()
// always call in context of main thread
static void __fastcall SetStatusIcon(MCONTACT hContact,int countryNumber)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
if (countryNumber != 0xFFFF || bUseUnknown) {
@@ -108,7 +108,7 @@ static void __fastcall SetStatusIcon(MCONTACT hContact,int countryNumber)
// always call in context of main thread
static void __fastcall UnsetStatusIcon(MCONTACT hContact)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.flags = MBF_HIDDEN;
Srmm_ModifyIcon(hContact, &sid);
@@ -141,7 +141,6 @@ void CALLBACK UpdateStatusIcons(LPARAM)
while (msgwi.hContact != NULL) {
/* is a message window opened for this contact? */
MessageWindowData msgw; /* output */
- msgw.cbSize = sizeof(msgw);
if (!CallService(MS_MSG_GETWINDOWDATA,(WPARAM)&msgwi,(LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
if (bShowStatusIcon) {
int countryNumber = ServiceDetectContactOriginCountry((WPARAM)msgwi.hContact, 0);
@@ -180,7 +179,7 @@ static int ExtraImgSettingChanged(WPARAM hContact, LPARAM lParam)
static int ExtraImgModulesLoaded(WPARAM, LPARAM)
{
/* Status Icon */
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME; // dwID = 0
sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid);
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp
index 77f5e2c820..13413a56dd 100644
--- a/plugins/Dropbox/src/dropbox_events.cpp
+++ b/plugins/Dropbox/src/dropbox_events.cpp
@@ -109,15 +109,13 @@ int CDropbox::OnProtoAck(WPARAM, LPARAM lParam)
WORD status = ack->lParam;
bool canSendOffline = (CallProtoService(ack->szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0;
- MessageWindowInputData msgwi = { sizeof(msgwi) };
+ MessageWindowInputData msgwi;
msgwi.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) {
msgwi.hContact = hContact;
MessageWindowData msgw;
- msgw.cbSize = sizeof(msgw);
-
if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
BBButton bbd = {};
bbd.pszModuleName = MODULE;
diff --git a/plugins/Dropbox/src/dropbox_options.cpp b/plugins/Dropbox/src/dropbox_options.cpp
index 8403890397..68c6d0316e 100644
--- a/plugins/Dropbox/src/dropbox_options.cpp
+++ b/plugins/Dropbox/src/dropbox_options.cpp
@@ -123,15 +123,13 @@ void CDropboxOptionsInterception::OnApply()
interceptedProtos.AppendFormat("%s\t", acc->szModuleName);
// hide tabsrmm button for intercepted accounts
- MessageWindowInputData msgwi = { sizeof(msgwi) };
+ MessageWindowInputData msgwi;
msgwi.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
for (MCONTACT hContact = db_find_first(acc->szModuleName); hContact; hContact = db_find_next(hContact, acc->szModuleName)) {
msgwi.hContact = hContact;
MessageWindowData msgw;
- msgw.cbSize = sizeof(msgw);
-
if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
BBButton bbd = {};
bbd.pszModuleName = MODULE;
diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp
index c4e450a1d8..e61459db72 100644
--- a/plugins/FavContacts/src/services.cpp
+++ b/plugins/FavContacts/src/services.cpp
@@ -52,7 +52,7 @@ int ProcessSrmmEvent(WPARAM, LPARAM lParam)
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
BYTE fav = db_get_b(event->hContact, "FavContacts", "IsFavourite", 0);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = "FavContacts";
sid.flags = fav ? 0 : MBF_DISABLED;
Srmm_ModifyIcon(event->hContact, &sid);
@@ -92,7 +92,7 @@ int ProcessSrmmIconClick(WPARAM hContact, LPARAM lParam)
db_set_b(hContact, "FavContacts", "IsFavourite", fav);
if (fav) CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = "FavContacts";
sid.flags = fav ? 0 : MBF_DISABLED;
Srmm_ModifyIcon(hContact, &sid);
@@ -146,7 +146,7 @@ int ProcessModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_TTB_MODULELOADED, ProcessTBLoaded);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = "FavContacts";
sid.szTooltip = LPGEN("Favorite Contacts");
sid.hIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp
index e3acda5536..1858cde76c 100644
--- a/plugins/FingerprintNG/src/fingerprint.cpp
+++ b/plugins/FingerprintNG/src/fingerprint.cpp
@@ -141,7 +141,7 @@ void RegisterIcons()
static void SetSrmmIcon(MCONTACT hContact, LPTSTR ptszMirver)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.dwId = 1;
sid.flags = MBF_UNICODE;
@@ -889,7 +889,7 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam)
return 0;
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
- if (event == NULL || event->cbSize < sizeof(MessageWindowEventData))
+ if (event == NULL)
return 0;
if (event->uType == MSG_WINDOW_EVT_OPEN) {
@@ -928,7 +928,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
RegisterIcons();
if (db_get_b(NULL, MODULENAME, "StatusBarIcon", 1)) {
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.flags = MBF_HIDDEN;
sid.dwId = 1;
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
index e9b7316f25..87e42974f6 100644
--- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp
+++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
@@ -238,7 +238,6 @@ void SetSrmmIcon(MCONTACT hContact)
int sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0);
StatusIconData sid = { 0 };
- sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
for (int i = 0; i < 4; i++) {
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp
index 990f957d9c..ade9f3e678 100644
--- a/plugins/HistorySweeperLight/src/main.cpp
+++ b/plugins/HistorySweeperLight/src/main.cpp
@@ -55,7 +55,7 @@ int OnIconPressed(WPARAM hContact, LPARAM lParam)
if (!(sicd->flags & MBCF_RIGHTBUTTON) && !mir_strcmp(sicd->szModule, ModuleName) && db_get_b(NULL, ModuleName, "ChangeInMW", 0)) {
int nh = sicd->dwId;
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = ModuleName;
sid.dwId = nh;
sid.flags = MBF_HIDDEN;
@@ -75,7 +75,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
{
int sweep = db_get_b(NULL, ModuleName, "SweepHistory", 0);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = ModuleName;
sid.hIcon = LoadIconEx("actG");
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp
index 36dcd48c01..d2b68c7a12 100644
--- a/plugins/HistorySweeperLight/src/options.cpp
+++ b/plugins/HistorySweeperLight/src/options.cpp
@@ -169,7 +169,6 @@ void SaveSettings(HWND hwndDlg)
int st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
StatusIconData sid = { 0 };
- sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
sid.dwId = 0;
sid.hIcon = LoadIconEx("actG");
diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp
index b9dee446e2..cace9a53ed 100644
--- a/plugins/MessageState/src/messagestate.cpp
+++ b/plugins/MessageState/src/messagestate.cpp
@@ -19,7 +19,7 @@ const wchar_t* Tooltips[] =
void SetSRMMIcon(MCONTACT hContact, SRMM_ICON_TYPE type, time_t time)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.dwId = 1;
sid.flags = MBF_UNICODE;
@@ -101,7 +101,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
Icon_Register(g_hInst, MODULENAME, Icons, _countof(Icons));
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.flags = MBF_HIDDEN;
sid.dwId = 1;
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp
index c0bbeded82..c16eca6fe4 100644
--- a/plugins/MirFox/src/MirandaUtils.cpp
+++ b/plugins/MirFox/src/MirandaUtils.cpp
@@ -357,12 +357,10 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam)
}
MessageWindowData mwd;
- mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = (UINT_PTR)param->targetHandle;
mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
MessageWindowInputData mwid;
- mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact = (UINT_PTR)param->targetHandle;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp
index 05a064eedf..f9782b1945 100644
--- a/plugins/MirLua/src/m_message.cpp
+++ b/plugins/MirLua/src/m_message.cpp
@@ -72,7 +72,6 @@ LUAMOD_API int luaopen_m_message(lua_State *L)
luaL_newlib(L, messageApi);
MT<MessageWindowEventData>(L, "MessageWindowEventData")
- .Field(&MessageWindowEventData::szModule, "Module", LUA_TSTRINGA)
.Field(&MessageWindowEventData::uType, "Type", LUA_TINTEGER)
.Field(&MessageWindowEventData::hContact, "hContact", LUA_TINTEGER)
.Field(&MessageWindowEventData::uFlags, "Flags", LUA_TINTEGER);
diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp
index 882d0eaf70..785556dfcf 100644
--- a/plugins/MirOTR/src/svcs_srmm.cpp
+++ b/plugins/MirOTR/src/svcs_srmm.cpp
@@ -6,16 +6,14 @@ BBButton OTRButton;
int SVC_IconPressed(WPARAM hContact, LPARAM lParam)
{
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if(sicd->cbSize < sizeof(StatusIconClickData))
- return 0;
- if(mir_strcmp(sicd->szModule, MODULENAME) == 0) {
+ if (mir_strcmp(sicd->szModule, MODULENAME) == 0) {
char *proto = GetContactProto(hContact);
- if(proto && db_get_b(hContact, proto, "ChatRoom", 0))
+ if (proto && db_get_b(hContact, proto, "ChatRoom", 0))
return 0;
ShowOTRMenu(hContact, sicd->clickLocation);
}
-
+
return 0;
}
@@ -27,7 +25,7 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level)
BBButton button = OTRButton;
- StatusIconData sid = { sizeof(sid) }, sid2 = { sizeof(sid) };
+ StatusIconData sid = {}, sid2 = {};
sid.szModule = MODULENAME;
sid.dwId = 0;
sid.flags = MBF_HIDDEN;
@@ -117,7 +115,7 @@ void InitSRMM()
hIconPrivate = IcoLib_GetIcon(ICON_PRIVATE, 0);
hIconUnverified = IcoLib_GetIcon(ICON_UNVERIFIED, 0);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.hIcon = hIconFinished;
sid.hIconDisabled = hIconNotSecure;
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index bc1bf2957f..ad9bdc133b 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -789,12 +789,10 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag
bool CAppletManager::IsMessageWindowOpen(MCONTACT hContact)
{
MessageWindowInputData mwid;
- mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact = hContact;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
MessageWindowData mwd;
- mwd.cbSize = sizeof(MessageWindowData);
CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd);
if (mwd.uState & MSG_WINDOW_STATE_EXISTS)
return true;
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
index 3752fad651..08adac9ee3 100644
--- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
+++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
@@ -85,12 +85,11 @@ void __cdecl AutoreplyDelayThread(void *_ad)
int IsSRMsgWindowOpen(MCONTACT hContact, int DefaultRetVal)
{
if (ServiceExists(MS_MSG_GETWINDOWDATA)) {
- MessageWindowData mwd = { 0 };
- mwd.cbSize = sizeof(mwd);
- MessageWindowInputData mwid = { 0 };
- mwid.cbSize = sizeof(mwid);
+ MessageWindowInputData mwid = {};
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
mwid.hContact = hContact;
+
+ MessageWindowData mwd = {};
return !CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd) && mwd.hwndWindow;
}
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp
index b9ef026ca1..5161e03586 100644
--- a/plugins/NewEventNotify/src/main.cpp
+++ b/plugins/NewEventNotify/src/main.cpp
@@ -170,12 +170,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
int CheckMsgWnd(MCONTACT hContact)
{
if (g_IsSrmmWindowAPI) {
- MessageWindowData mwd;
MessageWindowInputData mwid;
- mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact = hContact;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwd.cbSize = sizeof(MessageWindowData);
+
+ MessageWindowData mwd;
mwd.hContact = hContact;
if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM) &mwid, (LPARAM) &mwd))
if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp
index 88a457b780..e9f5cae71d 100644
--- a/plugins/NewXstatusNotify/src/utils.cpp
+++ b/plugins/NewXstatusNotify/src/utils.cpp
@@ -25,12 +25,10 @@
bool CheckMsgWnd(MCONTACT hContact)
{
MessageWindowInputData mwid;
- mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact = hContact;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
MessageWindowData mwd;
- mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = hContact;
if (CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd) != NULL)
return false;
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index d003b7da23..64c9208d97 100644
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -51,7 +51,7 @@ void setSrmmIcon(MCONTACT h)
bool enabled = isContactSecured(hContact);
MCONTACT hMC = db_mc_tryMeta(hContact);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = szGPGModuleName;
sid.hIcon = IcoLib_GetIcon("secured");
sid.dwId = 1;
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 6fb74f3807..79a68b4bba 100644
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -124,7 +124,7 @@ static int OnModulesLoaded(WPARAM, LPARAM)
if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1))
InitCheck();
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = szGPGModuleName;
sid.flags = MBF_HIDDEN;
sid.dwId = 0x00000001;
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp
index 3e735690ae..3d95c96dd8 100644
--- a/plugins/NoHistory/src/dllmain.cpp
+++ b/plugins/NoHistory/src/dllmain.cpp
@@ -165,7 +165,7 @@ INT_PTR ServiceToggle(WPARAM hContact, LPARAM)
remove = !remove;
db_set_b(hContact, MODULE, DBSETTING_REMOVE, remove != 0);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULE;
for (int i = 0; i < 2; ++i) {
@@ -191,7 +191,7 @@ int WindowEvent(WPARAM, LPARAM lParam)
bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
int remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0;
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULE;
for (int i=0; i < 2; ++i) {
sid.dwId = i;
@@ -206,7 +206,7 @@ int WindowEvent(WPARAM, LPARAM lParam)
int IconPressed(WPARAM hContact, LPARAM lParam)
{
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if (sicd->cbSize < sizeof(StatusIconClickData))
+ if (sicd == nullptr)
return 0;
if (sicd->flags & MBCF_RIGHTBUTTON) return 0; // ignore right-clicks
@@ -224,7 +224,7 @@ int IconPressed(WPARAM hContact, LPARAM lParam)
// add icon to srmm status icons
void SrmmMenu_Load()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULE;
sid.dwId = 0;
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp
index 2bce93d0e1..50982fdde2 100644
--- a/plugins/Nudge/src/shake.cpp
+++ b/plugins/Nudge/src/shake.cpp
@@ -41,13 +41,10 @@ INT_PTR ShakeChat(WPARAM wParam, LPARAM)
//char srmmName[100];
MessageWindowData mwd;
- MessageWindowInputData mwid;
-
- mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = db_mc_tryMeta(wParam);
mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwid.cbSize = sizeof(MessageWindowInputData);
+ MessageWindowInputData mwid;
mwid.hContact = mwd.hContact;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd);
diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp
index b21f96f2d6..a13216a0f7 100644
--- a/plugins/Popup/src/srmm_menu.cpp
+++ b/plugins/Popup/src/srmm_menu.cpp
@@ -38,7 +38,7 @@ static void SrmmMenu_UpdateIcon(MCONTACT hContact)
int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULNAME;
for (int i = 0; i < 4; i++) {
@@ -104,7 +104,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM hContact, LPARAM lParam)
void SrmmMenu_Load()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULNAME;
sid.dwId = 0;
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp
index d2570e7a55..4148295222 100644
--- a/plugins/RecentContacts/src/RecentContacts.cpp
+++ b/plugins/RecentContacts/src/RecentContacts.cpp
@@ -483,17 +483,16 @@ BOOL SaveLastUsedTimeStamp(MCONTACT hContact)
int OnMsgEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *ed = (MessageWindowEventData *)lParam;
- if (ed->hContact == NULL)
- return 0;
-
- if (ed->uType == MSG_WINDOW_EVT_OPEN)
+ if (ed->hContact != 0 && ed->uType == MSG_WINDOW_EVT_OPEN)
SaveLastUsedTimeStamp(ed->hContact);
- else if (ed->uType == MSG_WINDOW_EVT_CUSTOM) {
- struct TABSRMM_SessionInfo *si = (struct TABSRMM_SessionInfo*) ed->local;
- if (si != NULL)
- if (si->evtCode == tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND)
- SaveLastUsedTimeStamp(ed->hContact);
- }
+ return 0;
+}
+
+int OnProtoBroadcast(WPARAM, LPARAM lParam)
+{
+ ACKDATA *ack = (ACKDATA*)lParam;
+ if (ack->type == ACKTYPE_MESSAGE && ack->result == ACKRESULT_SUCCESS)
+ SaveLastUsedTimeStamp(ack->hContact);
return 0;
}
@@ -555,6 +554,7 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_MSG_WINDOWEVENT, OnMsgEvent);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged );
HookEvent(ME_OPT_INITIALISE, onOptInitialise);
+ HookEvent(ME_PROTO_ACK, OnProtoBroadcast);
return 0;
}
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index 970d78429a..596828869b 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -536,7 +536,7 @@ void CChatRoomDlg::UpdateStatusBar()
sbd.pszText = L"";
SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = SRMM_MODULE;
Srmm_ModifyIcon(m_hContact, &sid);
}
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index b01c9cc288..36cd2601c6 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -151,7 +151,7 @@ static int ackevent(WPARAM, LPARAM lParam)
dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1;
dbei.pBlob = (PBYTE)item->sendBuffer;
- MessageWindowEvent evt = { sizeof(evt), item->hSendId, hContact, &dbei };
+ MessageWindowEvent evt = { item->hSendId, hContact, &dbei };
NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
item->sendBuffer = (char *)dbei.pBlob;
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp
index 3ba984c959..0698cdf2d9 100644
--- a/plugins/Scriver/src/input.cpp
+++ b/plugins/Scriver/src/input.cpp
@@ -65,7 +65,6 @@ void InputAreaContextMenu(HWND hwnd, WPARAM, LPARAM lParam, MCONTACT hContact)
// First notification
MessageWindowPopupData mwpd;
- mwpd.cbSize = sizeof(mwpd);
mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
mwpd.uFlags = MSG_WINDOWPOPUP_INPUT;
mwpd.hContact = hContact;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index a798d00868..82ec8e9851 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -773,7 +773,7 @@ void CSrmmWindow::UpdateStatusBar()
SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
UpdateReadChars();
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = SRMM_MODULE;
sid.flags = MBF_DISABLED;
Srmm_ModifyIcon(m_hContact, &sid);
@@ -1304,7 +1304,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case DM_SWITCHTYPING:
if (IsTypingNotificationSupported()) {
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = SRMM_MODULE;
sid.dwId = 1;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index b6478dc16b..30776f7aa5 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -286,11 +286,11 @@ static void RestoreUnreadMessageAlerts(void)
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
- if (mwid == nullptr || mwid->cbSize != sizeof(MessageWindowInputData) || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
+ if (mwid == nullptr || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
return 1;
MessageWindowData *mwd = (MessageWindowData*)lParam;
- if (mwd == nullptr || mwd->cbSize != sizeof(MessageWindowData))
+ if (mwd == nullptr)
return 1;
HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact);
@@ -306,7 +306,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
{
StatusTextData *st = (StatusTextData*)lParam;
- if (st != nullptr && st->cbSize != sizeof(StatusTextData))
+ if (st == nullptr)
return 1;
HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
@@ -431,7 +431,7 @@ void CScriverWindow::Reattach(HWND hwndContainer)
static void RegisterStatusIcons()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = SRMM_MODULE;
sid.dwId = 1;
sid.hIcon = GetCachedIcon("scriver_TYPING");
@@ -442,7 +442,7 @@ static void RegisterStatusIcons()
void ChangeStatusIcons()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = SRMM_MODULE;
sid.dwId = 1;
sid.hIcon = GetCachedIcon("scriver_TYPING");
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp
index b636464e38..3d7a74ac46 100644
--- a/plugins/SecureIM/src/crypt_icons.cpp
+++ b/plugins/SecureIM/src/crypt_icons.cpp
@@ -79,7 +79,7 @@ void ShowStatusIcon(MCONTACT hContact, int mode)
ExtraIcon_Clear(g_hCLIcon, hMC);
}
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = (char*)MODULENAME;
for (int i = MODE_NATIVE; i < MODE_CNT; i++) {
sid.dwId = i;
diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp
index e2583947d2..7977d0932e 100644
--- a/plugins/SecureIM/src/svcs_srmm.cpp
+++ b/plugins/SecureIM/src/svcs_srmm.cpp
@@ -31,7 +31,7 @@ int __cdecl onIconPressed(WPARAM hContact, LPARAM lParam)
void InitSRMMIcons()
{
// add icon to srmm status icons
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULENAME;
sid.flags = MBF_DISABLED | MBF_HIDDEN;
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp
index ba1cbaf64d..7a813390f3 100644
--- a/plugins/Sessions/Src/Main.cpp
+++ b/plugins/Sessions/Src/Main.cpp
@@ -41,7 +41,7 @@ bool g_bIncompletedSave;
HWND g_hDlg;
HWND g_hSDlg;
bool DONT = false;
-bool StartUp, isLastTRUE = false, g_mode, bSC = false;
+bool StartUp, isLastTRUE = false, bSC = false;
MCONTACT session_list[255] = { 0 };
MCONTACT user_session_list[255] = { 0 };
@@ -394,25 +394,17 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
INT_PTR CloseCurrentSession(WPARAM, LPARAM)
{
- HWND hWnd;
MessageWindowInputData mwid;
MessageWindowData mwd;
while (session_list[0] != 0) {
- mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact = session_list[0];
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = mwid.hContact;
mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd);
-
- if (g_mode) {
- hWnd = GetAncestor(mwd.hwndWindow, GA_ROOT);
- SendMessage(hWnd, WM_CLOSE, 0, 1);
- }
- else SendMessage(mwd.hwndWindow, WM_CLOSE, 0, 0);
+ SendMessage(mwd.hwndWindow, WM_CLOSE, 0, 0);
}
memset(session_list, 0, sizeof(session_list));
return 0;
@@ -685,7 +677,6 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam;
if (MWeventdata->uType == MSG_WINDOW_EVT_OPEN) {
- if (strstr(MWeventdata->szModule, "tabSRMsg")) g_mode = 1;
AddToCurSession(MWeventdata->hContact, 0);
if (g_bCrashRecovery)
db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 1);
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 5fddca1ebe..9f8eab1afe 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -190,7 +190,7 @@ static int MsgDlgHook(WPARAM, LPARAM lParam)
const MessageWindowEventData *wndEvtData = (MessageWindowEventData*)lParam;
switch (wndEvtData->uType) {
case MSG_WINDOW_EVT_OPENING:
- if (wndEvtData->cbSize >= sizeof(MessageWindowEventData)) {
+ {
MsgWndData *msgwnd = new MsgWndData();
msgwnd->hwnd = wndEvtData->hwndWindow;
msgwnd->hContact = wndEvtData->hContact;
@@ -204,34 +204,31 @@ static int MsgDlgHook(WPARAM, LPARAM lParam)
mir_subclassWindow(msgwnd->hwnd, MessageDlgSubclass);
msgwnd->CreateSmileyButton();
- {
- mir_cslock lck(csWndList);
- g_MsgWndList.insert(msgwnd);
- }
- SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog);
-
- if (wndEvtData->hwndLog)
- SetRichCallback(wndEvtData->hwndLog, wndEvtData->hContact, false, false);
- if (wndEvtData->hwndInput)
- SetRichCallback(wndEvtData->hwndInput, wndEvtData->hContact, false, false);
+ mir_cslock lck(csWndList);
+ g_MsgWndList.insert(msgwnd);
}
+
+ SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog);
+
+ if (wndEvtData->hwndLog)
+ SetRichCallback(wndEvtData->hwndLog, wndEvtData->hContact, false, false);
+ if (wndEvtData->hwndInput)
+ SetRichCallback(wndEvtData->hwndInput, wndEvtData->hContact, false, false);
break;
case MSG_WINDOW_EVT_OPEN:
- if (wndEvtData->cbSize >= sizeof(MessageWindowEventData)) {
- SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog);
- if (wndEvtData->hwndLog)
- SetRichCallback(wndEvtData->hwndLog, wndEvtData->hContact, true, true);
- if (wndEvtData->hwndInput) {
- SetRichCallback(wndEvtData->hwndInput, wndEvtData->hContact, true, true);
- SendMessage(wndEvtData->hwndInput, WM_REMAKERICH, 0, 0);
- }
+ SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog);
+ if (wndEvtData->hwndLog)
+ SetRichCallback(wndEvtData->hwndLog, wndEvtData->hContact, true, true);
+ if (wndEvtData->hwndInput) {
+ SetRichCallback(wndEvtData->hwndInput, wndEvtData->hContact, true, true);
+ SendMessage(wndEvtData->hwndInput, WM_REMAKERICH, 0, 0);
}
break;
case MSG_WINDOW_EVT_CLOSE:
- if (wndEvtData->cbSize >= sizeof(MessageWindowEventData) && wndEvtData->hwndLog) {
+ if (wndEvtData->hwndLog) {
CloseRichCallback(wndEvtData->hwndLog);
CloseRichOwnerCallback(wndEvtData->hwndWindow);
}
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp
index 1706817874..63d7ab3304 100644
--- a/plugins/SpellChecker/src/spellchecker.cpp
+++ b/plugins/SpellChecker/src/spellchecker.cpp
@@ -71,7 +71,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
static int IconsChanged(WPARAM, LPARAM)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULE_NAME;
sid.hIconDisabled = IcoLib_GetIcon("spellchecker_disabled");
sid.flags = MBF_HIDDEN | MBF_UNICODE;
@@ -196,7 +196,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_MSG_WINDOWPOPUP, MsgWindowPopup);
HookEvent(ME_MSG_ICONPRESSED, IconPressed);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULE_NAME;
sid.hIconDisabled = IcoLib_GetIcon("spellchecker_disabled");
sid.flags = MBF_UNICODE | MBF_HIDDEN;
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index 3c5a4a65e8..6c1e6dd82c 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -844,7 +844,7 @@ void GetContactLanguage(Dialog *dlg)
void ModifyIcon(Dialog *dlg)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODULE_NAME;
for (int i = 0; i < languages.getCount(); i++) {
@@ -1280,7 +1280,7 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection)
int MsgWindowPopup(WPARAM, LPARAM lParam)
{
MessageWindowPopupData *mwpd = (MessageWindowPopupData *)lParam;
- if (mwpd == NULL || mwpd->cbSize < sizeof(MessageWindowPopupData) || mwpd->uFlags != MSG_WINDOWPOPUP_INPUT)
+ if (mwpd == NULL || mwpd->uFlags != MSG_WINDOWPOPUP_INPUT)
return 0;
DialogMapType::iterator dlgit = dialogs.find(mwpd->hwnd);
@@ -1353,9 +1353,6 @@ int MsgWindowEvent(WPARAM, LPARAM lParam)
if (event == NULL)
return 0;
- if (event->cbSize < sizeof(MessageWindowEventData))
- return 0;
-
if (event->uType == MSG_WINDOW_EVT_OPEN)
AddContactTextBox(event->hContact, event->hwndInput, "DefaultSRMM", TRUE, event->hwndWindow);
else if (event->uType == MSG_WINDOW_EVT_CLOSING)
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 8d4bc0ecbf..f507994631 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1527,7 +1527,7 @@ void CTabBaseDlg::DM_ErrorDetected(int type, int flag)
int SI_InitStatusIcons()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MSG_ICON_MODULE;
sid.dwId = MSG_ICON_SOUND; // Sounds
Srmm_AddIcon(&sid);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 8c856fbdc8..9646963098 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -103,7 +103,6 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt)
MessageWindowPopupData mwpd;
// First notification
- mwpd.cbSize = sizeof(mwpd);
mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
mwpd.uFlags = (pCtrl.GetCtrlId() == IDC_SRMM_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
mwpd.hContact = m_hContact;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index f9f02f9703..f0e8c76e7f 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -67,11 +67,11 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM)
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
- if (mwid == nullptr || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == 0) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH))
+ if (mwid == nullptr || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
return 1;
MessageWindowData *mwd = (MessageWindowData*)lParam;
- if (mwd == nullptr || (mwd->cbSize != sizeof(MessageWindowData)))
+ if (mwd == nullptr)
return 1;
HWND hwnd = M.FindWindow(mwid->hContact);
@@ -349,7 +349,7 @@ static void SetStatusTextWorker(CTabBaseDlg *dat, StatusTextData *st)
dat->m_sbCustom = nullptr;
}
- if (st != nullptr && st->cbSize == sizeof(StatusTextData))
+ if (st != nullptr)
dat->m_sbCustom = new StatusTextData(*st);
dat->tabUpdateStatusBar();
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 3af62c305b..afaa5a663e 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -499,7 +499,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam)
dbei.flags |= DBEF_UTF;
dbei.pBlob = (PBYTE)job.szSendBuffer;
- MessageWindowEvent evt = { sizeof(evt), job.iSendId, job.hContact, &dbei };
+ MessageWindowEvent evt = { job.iSendId, job.hContact, &dbei };
NotifyEventHooks(PluginConfig.m_event_WriteEvent, 0, (LPARAM)&evt);
job.szSendBuffer = (char*)dbei.pBlob;
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index cbd8e04625..c538f898c1 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -39,8 +39,7 @@ static void TrayAnimThread(LPVOID)
{
Thread_SetName("TabSRMM: TrayAnimThread");
- int iAnimMode = (PluginConfig.m_AnimTrayIcons[0] && PluginConfig.m_AnimTrayIcons[1] && PluginConfig.m_AnimTrayIcons[2] &&
- PluginConfig.m_AnimTrayIcons[3]);
+ int iAnimMode = (PluginConfig.m_AnimTrayIcons[0] && PluginConfig.m_AnimTrayIcons[1] && PluginConfig.m_AnimTrayIcons[2] && PluginConfig.m_AnimTrayIcons[3]);
DWORD dwElapsed = 0, dwAnimStep = 0;
HICON hIconDefault = iAnimMode ? PluginConfig.m_AnimTrayIcons[0] : PluginConfig.g_iconContainer;
DWORD idleTimer = 0;
@@ -101,10 +100,8 @@ void TSAPI CreateTrayMenus(int mode)
PluginConfig.g_hMenuFavorites = CreatePopupMenu();
PluginConfig.g_hMenuRecent = CreatePopupMenu();
PluginConfig.g_hMenuTrayContext = GetSubMenu(PluginConfig.g_hMenuContext, 6);
- ModifyMenu(PluginConfig.g_hMenuTrayContext, 0, MF_BYPOSITION | MF_POPUP,
- (UINT_PTR)PluginConfig.g_hMenuFavorites, TranslateT("Favorites"));
- ModifyMenu(PluginConfig.g_hMenuTrayContext, 2, MF_BYPOSITION | MF_POPUP,
- (UINT_PTR)PluginConfig.g_hMenuRecent, TranslateT("Recent sessions"));
+ ModifyMenu(PluginConfig.g_hMenuTrayContext, 0, MF_BYPOSITION | MF_POPUP, (UINT_PTR)PluginConfig.g_hMenuFavorites, TranslateT("Favorites"));
+ ModifyMenu(PluginConfig.g_hMenuTrayContext, 2, MF_BYPOSITION | MF_POPUP, (UINT_PTR)PluginConfig.g_hMenuRecent, TranslateT("Recent sessions"));
LoadFavoritesAndRecent();
}
else {
@@ -135,7 +132,6 @@ void TSAPI CreateTrayMenus(int mode)
void TSAPI CreateSystrayIcon(int create)
{
NOTIFYICONDATA nim;
-
nim.cbSize = sizeof(nim);
nim.hWnd = PluginConfig.g_hwndHotkeyHandler;
nim.uID = 100;
@@ -192,7 +188,7 @@ void TSAPI FlashTrayIcon(HICON hIcon)
void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, const char *szProto, wchar_t *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu)
{
wchar_t szMenuEntry[80];
- wchar_t szFinalNick[100];
+ wchar_t szFinalNick[100];
if (szNickname == nullptr)
wcsncpy_s(szFinalNick, pcli->pfnGetContactDisplayName(hContact, 0), _TRUNCATE);
@@ -201,15 +197,15 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c
if (szProto == nullptr)
szProto = GetContactProto(hContact);
- if (szProto) {
- if (wStatus == 0)
- wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- if (szStatus == nullptr)
- szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
- }
- else
+ if (szProto == nullptr)
return;
+ if (wStatus == 0)
+ wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+
+ if (szStatus == nullptr)
+ szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
+
if (hIcon == 0)
hIcon = Skin_LoadProtoIcon(szProto, wStatus);
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index 13b9fb893f..0960b61b54 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -97,7 +97,7 @@ MsgWndData::~MsgWndData()
void MsgWndData::FlagsIconSet()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODNAMEFLAGS;
if (!g_bShowStatusIconFlag)
sid.flags = MBF_HIDDEN;
@@ -112,7 +112,7 @@ void MsgWndData::FlagsIconSet()
void UpdateStatusIcons()
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODNAMEFLAGS;
if (!g_bShowStatusIconFlag)
sid.flags = MBF_HIDDEN;
@@ -234,7 +234,7 @@ void SvcFlagsLoadModule()
void SvcFlagsOnModulesLoaded()
{
/* Status Icon */
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = MODNAMEFLAGS;
if (!g_bShowStatusIconFlag)
sid.flags = MBF_HIDDEN;
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas
index 8cc128ab2f..293b954174 100644
--- a/plugins/Utils.pas/mircontacts.pas
+++ b/plugins/Utils.pas/mircontacts.pas
@@ -414,18 +414,14 @@ var
begin
wnd:=GetParent(wnd); //!!
hContact:=db_find_first();
- with mwid do
- begin
- cbSize:=SizeOf(mwid);
- uFlags:=MSG_WINDOW_UFLAG_MSG_BOTH;
- end;
- mwod.cbSize:=SizeOf(mwod);
+ mwid.uFlags:=MSG_WINDOW_UFLAG_MSG_BOTH;
+
while hContact<>0 do
begin
mwid.hContact:=hContact;
if CallService(MS_MSG_GETWINDOWDATA,wparam(@mwid),lparam(@mwod))=0 then
begin
- if {((mwod.uState and MSG_WINDOW_STATE_FOCUS)<>0) and} (mwod.hwndWindow=wnd) then
+ if mwod.hwndWindow=wnd then
begin
result:=mwid.hContact;
exit;
@@ -455,9 +451,6 @@ procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boo
var
pc:array [0..127] of AnsiChar;
begin
-{
-CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0);
-}
if (hContact<>0) and (db_is_contact(hContact)<>0) then
begin
if StrCopy(pc,GetContactProto(hContact))<>nil then
diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp
index ebd0949832..a9070f595d 100644
--- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp
+++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp
@@ -148,11 +148,10 @@ bool SpeakAnnounce::readMessage(MCONTACT contact)
if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen) || m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused)) {
// Do not notify if window is already open
MessageWindowInputData mwid;
- mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact = contact;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
+
MessageWindowData mwd;
- mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = contact;
//returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
if (CallService(MS_MSG_GETWINDOWDATA, (WPARAM) &mwid, (LPARAM) &mwd) == 0) {
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 2491db2d94..3c1602d593 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -836,10 +836,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
if (st_.as_int() == 1) {
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
-
mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), name);
-
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
else CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 62adf63216..8cc10e531d 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -1146,7 +1146,6 @@ void FacebookProto::MessageRead(MCONTACT hContact)
wcsftime(ttime, _countof(ttime), L"%X", localtime(&time));
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("read"));
if (isChatRoom(hContact)) {
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index bdded58115..5af6eaa2b9 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -926,7 +926,7 @@ void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item)
if (!hContact)
return;
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = m_szModuleName;
sid.flags = item->arResources.getCount() ? 0 : MBF_DISABLED;
Srmm_ModifyIcon(hContact, &sid);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 19813ac138..8960a70166 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -216,7 +216,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
HookProtoEvent(ME_GC_EVENT, &CJabberProto::JabberGcEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CJabberProto::JabberGcMenuHook);
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = m_szModuleName;
sid.hIcon = LoadIconEx("main");
sid.flags = MBF_HIDDEN;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 615524ec03..637ef68518 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -1308,11 +1308,8 @@ bool CMsnProto::MSN_IsMeByContact(MCONTACT hContact, char* szEmail)
bool MSN_MsgWndExist(MCONTACT hContact)
{
- MessageWindowInputData msgWinInData =
- { sizeof(MessageWindowInputData), hContact, MSG_WINDOW_UFLAG_MSG_BOTH };
- MessageWindowData msgWinData = { 0 };
- msgWinData.cbSize = sizeof(MessageWindowData);
-
+ MessageWindowData msgWinData = {};
+ MessageWindowInputData msgWinInData = { hContact, MSG_WINDOW_UFLAG_MSG_BOTH };
bool res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
res = res || msgWinData.hwndWindow;
if (res) {
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index e210889035..9aeb60b56b 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -88,8 +88,6 @@ struct CMsnProto : public PROTO<CMsnProto>
INT_PTR __cdecl GetUnreadEmailCount(WPARAM wParam, LPARAM lParam);
- INT_PTR __cdecl ManageAccount(WPARAM wParam, LPARAM lParam);
-
INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM lParam);
//====| Events |======================================================================
@@ -102,10 +100,6 @@ struct CMsnProto : public PROTO<CMsnProto>
int __cdecl OnPreShutdown(WPARAM wParam,LPARAM lParam);
int __cdecl OnContactDoubleClicked(WPARAM wParam,LPARAM lParam);
int __cdecl OnDbSettingChanged(WPARAM wParam,LPARAM lParam);
- int __cdecl OnUserInfoInit(WPARAM wParam,LPARAM lParam);
-#ifdef OBSOLETE
- int __cdecl OnWindowEvent(WPARAM wParam, LPARAM lParam);
-#endif
int __cdecl OnWindowPopup(WPARAM wParam, LPARAM lParam);
//====| Data |========================================================================
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index 76eeb339ac..b0be81b0f1 100644
--- a/protocols/MSN/src/msn_svcs.cpp
+++ b/protocols/MSN/src/msn_svcs.cpp
@@ -523,38 +523,6 @@ int CMsnProto::OnIdleChanged(WPARAM, LPARAM lParam)
return 0;
}
-#ifdef OBSOLETE
-/////////////////////////////////////////////////////////////////////////////////////////
-// OnWindowEvent - creates session on window open
-
-int CMsnProto::OnWindowEvent(WPARAM, LPARAM lParam)
-{
- MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam;
-
- if (msgEvData->uType == MSG_WINDOW_EVT_OPENING) {
- if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_INVISIBLE)
- return 0;
-
- if (!MSN_IsMyContact(msgEvData->hContact)) return 0;
-
- char tEmail[MSN_MAX_EMAIL_LEN];
- if (MSN_IsMeByContact(msgEvData->hContact, tEmail)) return 0;
-
- int netId = Lists_GetNetId(tEmail);
- if (netId != NETID_MSN && netId != NETID_LCS) return 0;
-
- if (Lists_IsInList(LIST_BL, tEmail)) return 0;
-
- bool isOffline;
- ThreadData* thread = MSN_StartSB(tEmail, isOffline);
-
- if (thread == NULL && !isOffline)
- MsgQueue_Add(tEmail, 'X', NULL, 0);
- }
- return 0;
-}
-#endif
-
/////////////////////////////////////////////////////////////////////////////////////////
// OnWindowEvent - creates session on window open
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index 827560e378..527a42705f 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -553,7 +553,6 @@ bool Omegle_client::events()
SkinPlaySound("StrangerTyp");
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on"));
ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger"));
@@ -566,7 +565,6 @@ bool Omegle_client::events()
SkinPlaySound("StrangerTypStop");
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off"));
ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger"));
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 3ae47bcf21..975e3c141a 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -737,7 +737,6 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact)
_free_locale(locale);
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 484602e265..725e48d25f 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -842,9 +842,7 @@ void CVkProto::ChatContactTypingThread(void *p)
m_ChatsTyping.insert(param);
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_wszNick);
-
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
@@ -874,18 +872,10 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId)
m_ChatsTyping.remove(cp);
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
mir_snwprintf(st.tszText, L" ");
-
- // CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, NULL) clears statusbar very slowly.
- // (1-10 sec(!!!) for me on tabSRMM O_o)
- // So I call MS_MSG_SETSTATUSTEXT with st.wszText = " " for cleaning of "... is typing a message..." string.
- // It works instantly!
-
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
// After that I call standard cleaning procedure:
-
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact);
}
}
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index c131dda0f8..c0bfdfc558 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -49,7 +49,6 @@ void utils::setStatusMessage(MCONTACT hContact, const wchar_t *ptszMessage)
{
if (ptszMessage != NULL) {
StatusTextData st = { 0 };
- st.cbSize = sizeof(st);
st.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
wcsncpy_s(st.tszText, ptszMessage, _TRUNCATE);
CallService(MS_MSG_SETSTATUSTEXT, hContact, (LPARAM)&st);
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index d334eb19ef..9c615e3271 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -100,7 +100,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz
dbei.cbBlob = (DWORD)(mir_strlen(p->szMsg) + 1);
dbei.pBlob = (PBYTE)p->szMsg;
- MessageWindowEvent evt = { sizeof(evt), id, hContact, &dbei };
+ MessageWindowEvent evt = { id, hContact, &dbei };
NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
p->szMsg = (char*)dbei.pBlob;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 0c049ff6f6..48b8832a70 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -30,7 +30,7 @@ const CLSID IID_IRichEditOleCallback = { 0x00020D03, 0x00, 0x00, { 0xC0, 0x00, 0
int OnCheckPlugins(WPARAM, LPARAM);
-HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite;
+HANDLE hHookWinPopup, hHookWinWrite;
HGENMENU hMsgMenuItem;
HMODULE hMsftEdit;
@@ -479,6 +479,10 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM)
static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
{
+ StatusTextData *st = (StatusTextData*)lParam;
+ if (st == NULL)
+ return 1;
+
HWND hwnd = WindowList_Find(pci->hWindowList, wParam);
if (hwnd == NULL)
return 1;
@@ -487,10 +491,6 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
if (dat == NULL)
return 1;
- StatusTextData *st = (StatusTextData*)lParam;
- if (st != NULL && st->cbSize != sizeof(StatusTextData))
- return 1;
-
dat->SetStatusData(st);
return 0;
}
@@ -498,11 +498,11 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
- if (mwid == NULL || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == NULL) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH))
+ if (mwid == NULL || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
return 1;
MessageWindowData *mwd = (MessageWindowData*)lParam;
- if(mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData)))
+ if(mwd == NULL)
return 1;
HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact);
@@ -547,7 +547,6 @@ int LoadSendRecvMessageModule(void)
CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
- hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
@@ -565,7 +564,6 @@ int LoadSendRecvMessageModule(void)
void SplitmsgShutdown(void)
{
- DestroyHookableEvent(hHookWinEvt);
DestroyHookableEvent(hHookWinPopup);
DestroyHookableEvent(hHookWinWrite);
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 327136abbb..5943c196cc 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -645,7 +645,7 @@ int Meta_ModulesLoaded(WPARAM, LPARAM)
InitMenus();
// create srmm icon
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = META_PROTO;
sid.flags = MBF_UNICODE;
sid.tszTooltip = LPGENW("Select metacontact");
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index 1192b28693..4ae42c329b 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -545,7 +545,7 @@ void Meta_FixStatus(DBCachedContact *ccMeta)
void Meta_UpdateSrmmIcon(DBCachedContact *ccMeta, int)
{
- StatusIconData sid = { sizeof(sid) };
+ StatusIconData sid = {};
sid.szModule = META_PROTO;
sid.flags = (ccMeta->IsMeta()) ? 0 : MBF_HIDDEN;
Srmm_ModifyIcon(ccMeta->contactID, &sid);
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index 9b2f37207f..f7887095fe 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -79,13 +79,13 @@ static int CompareIcons(const StatusIconMain *p1, const StatusIconMain *p2)
static OBJLIST<StatusIconMain> arIcons(3, CompareIcons);
-static HANDLE hHookIconsChanged;
+HANDLE hHookIconsChanged, hHookSrmmEvent;
/////////////////////////////////////////////////////////////////////////////////////////
MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack)
{
- if (sid == nullptr || sid->cbSize != sizeof(StatusIconData))
+ if (sid == nullptr)
return 1;
StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
@@ -110,7 +110,7 @@ MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack)
MIR_APP_DLL(int) Srmm_ModifyIcon(MCONTACT hContact, StatusIconData *sid)
{
- if (sid == nullptr || sid->cbSize != sizeof(StatusIconData))
+ if (sid == nullptr)
return 1;
StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
@@ -151,7 +151,7 @@ MIR_APP_DLL(int) Srmm_ModifyIcon(MCONTACT hContact, StatusIconData *sid)
MIR_APP_DLL(void) Srmm_RemoveIcon(const char *szProto, DWORD iconId)
{
- StatusIconData tmp = { sizeof(tmp), (char*)szProto, iconId };
+ StatusIconData tmp = { (char*)szProto, iconId };
StatusIconMain *p = arIcons.find((StatusIconMain*)&tmp);
if (p != nullptr)
arIcons.remove(p);
@@ -211,6 +211,7 @@ int LoadSrmmModule()
LoadSrmmToolbarModule();
+ hHookSrmmEvent = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED);
return 0;
}
@@ -219,7 +220,9 @@ void UnloadSrmmModule()
{
arIcons.destroy();
NotifyEventHooks(hHookIconsChanged, 0, 0);
+
DestroyHookableEvent(hHookIconsChanged);
+ DestroyHookableEvent(hHookSrmmEvent);
DestroyCursor(g_hCurHyperlinkHand);