summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-08 15:29:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-08 15:29:44 +0300
commit99962115431435cf17dfae4d3b7c8d7d55d824bf (patch)
tree1c80a533f5d3d4ba9d3b894a9a38b9167fe3047e /protocols
parenta23186175cff579d5aeb231372e87b0b852bdb38 (diff)
life is too short to remember whether this structure is zeroed or not
Diffstat (limited to 'protocols')
-rw-r--r--protocols/CloudFile/src/utils.cpp2
-rw-r--r--protocols/ConnectionNotify/src/ConnectionNotify.cpp13
-rw-r--r--protocols/FacebookRM/src/process.cpp26
-rw-r--r--protocols/GmailNotifier/src/notify.cpp3
-rw-r--r--protocols/LotusNotify/src/LotusNotify.cpp26
-rw-r--r--protocols/Steam/src/steam_utils.cpp2
-rw-r--r--protocols/Tox/src/tox_utils.cpp2
-rw-r--r--protocols/Weather/src/weather_popup.cpp4
-rw-r--r--protocols/WebView/src/webview_alerts.cpp2
-rw-r--r--protocols/WebView/src/webview_opts.cpp2
-rw-r--r--protocols/YAMN/src/browser/badconnect.cpp2
-rw-r--r--protocols/YAMN/src/browser/mailbrowser.cpp6
-rw-r--r--protocols/YAMN/src/proto/pop3/pop3opt.cpp9
13 files changed, 33 insertions, 66 deletions
diff --git a/protocols/CloudFile/src/utils.cpp b/protocols/CloudFile/src/utils.cpp
index 3e02092e9a..baef1e9c65 100644
--- a/protocols/CloudFile/src/utils.cpp
+++ b/protocols/CloudFile/src/utils.cpp
@@ -6,7 +6,7 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags,
return;
if (Popup_Enabled()) {
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE);
diff --git a/protocols/ConnectionNotify/src/ConnectionNotify.cpp b/protocols/ConnectionNotify/src/ConnectionNotify.cpp
index 9a2a3d5122..2ea63878f5 100644
--- a/protocols/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/protocols/ConnectionNotify/src/ConnectionNotify.cpp
@@ -750,23 +750,12 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
return DefWindowProc(hWnd, message, wParam, lParam);
}
-
//show popup
void showMsg(wchar_t *pName, DWORD pid, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state)
{
+ struct CONNECTION *mpd = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION));
POPUPDATAW ppd;
- //hContact = A_VALID_HANDLE_YOU_GOT_FROM_SOMEWHERE;
- //hIcon = A_VALID_HANDLE_YOU_GOT_SOMEWHERE;
- //char * lpzContactName = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lhContact,0);
- //99% of the times you'll just copy this line.
- //1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
- //char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; mir_wstrcpy(lpzText, "Hello world!"); It's your choice.
-
- struct CONNECTION *mpd = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION));
- //MessageBox(NULL,"aaa","aaa",1);
- memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL;//(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON1));
if (settingResolveIp) {
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 21293f11b3..b63006bea3 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -321,14 +321,14 @@ void FacebookProto::LoadHistory(void *pParam)
// Mark we're loading history, so we can behave differently (e.g., stickers won't be refreshed as it slows the whole process down drastically)
facy.loading_history = true;
- POPUPDATAW pd = { sizeof(pd) };
- pd.iSeconds = 5;
- pd.lchContact = hContact;
- pd.lchIcon = IcoLib_GetIconByHandle(GetIconHandle("conversation")); // TODO: Use better icon
- wcsncpy(pd.lpwzContactName, m_tszUserName, MAX_CONTACTNAME);
- wcsncpy(pd.lpwzText, TranslateT("Loading history started."), MAX_SECONDLINE);
+ POPUPDATAW ppd;
+ ppd.iSeconds = 5;
+ ppd.lchContact = hContact;
+ ppd.lchIcon = IcoLib_GetIconByHandle(GetIconHandle("conversation")); // TODO: Use better icon
+ wcsncpy(ppd.lpwzContactName, m_tszUserName, MAX_CONTACTNAME);
+ wcsncpy(ppd.lpwzText, TranslateT("Loading history started."), MAX_SECONDLINE);
- HWND popupHwnd = (HWND)PUAddPopupW(&pd, (LPARAM)APF_RETURN_HWND);
+ HWND popupHwnd = (HWND)PUAddPopupW(&ppd, (LPARAM)APF_RETURN_HWND);
std::vector<facebook_message> messages;
std::string firstTimestamp;
@@ -409,9 +409,9 @@ void FacebookProto::LoadHistory(void *pParam)
if (popupHwnd)
PUChangeTextW(popupHwnd, text);
else {
- wcsncpy(pd.lpwzText, text, MAX_SECONDLINE);
- pd.iSeconds = 1;
- popupHwnd = (HWND)PUAddPopupW(&pd);
+ wcsncpy(ppd.lpwzText, text, MAX_SECONDLINE);
+ ppd.iSeconds = 1;
+ popupHwnd = (HWND)PUAddPopupW(&ppd);
}
// There is no more messages
@@ -430,9 +430,9 @@ void FacebookProto::LoadHistory(void *pParam)
if (popupHwnd)
PUChangeTextW(popupHwnd, TranslateT("Loading history completed."));
else {
- pd.iSeconds = 5;
- wcsncpy(pd.lpwzText, TranslateT("Loading history completed."), MAX_SECONDLINE);
- popupHwnd = (HWND)PUAddPopupW(&pd);
+ ppd.iSeconds = 5;
+ wcsncpy(ppd.lpwzText, TranslateT("Loading history completed."), MAX_SECONDLINE);
+ popupHwnd = (HWND)PUAddPopupW(&ppd);
}
}
diff --git a/protocols/GmailNotifier/src/notify.cpp b/protocols/GmailNotifier/src/notify.cpp
index 54b47560a6..232614a7f8 100644
--- a/protocols/GmailNotifier/src/notify.cpp
+++ b/protocols/GmailNotifier/src/notify.cpp
@@ -169,8 +169,7 @@ void NotifyUser(Account *curAcc)
}
if (opt.notifierOnPop&&newMails > 0) {
- POPUPDATA ppd = { 0 };
-
+ POPUPDATA ppd;
ppd.lchContact = curAcc->hContact;
ppd.lchIcon = Skin_LoadProtoIcon(MODULENAME, ID_STATUS_OCCUPIED);
mir_strcpy(ppd.lpzContactName, curAcc->results.content);
diff --git a/protocols/LotusNotify/src/LotusNotify.cpp b/protocols/LotusNotify/src/LotusNotify.cpp
index 29dc2d91e6..4da1bb7c6f 100644
--- a/protocols/LotusNotify/src/LotusNotify.cpp
+++ b/protocols/LotusNotify/src/LotusNotify.cpp
@@ -446,39 +446,21 @@ BOOL checkNotesIniFile(BOOL bInfo)
//popup plugin to show popup function
void showMsg(wchar_t* sender,wchar_t* text, DWORD id, char *strUID)
{
+ POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
+ mpd->id = id;
+ strncpy_s(mpd->strNote, _countof(mpd->strNote), strUID, mir_strlen(strUID));
POPUPDATAW ppd;
- //hContact = A_VALID_HANDLE_YOU_GOT_FROM_SOMEWHERE;
- //hIcon = A_VALID_HANDLE_YOU_GOT_SOMEWHERE;
- //char * lpzContactName = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lhContact,0);
- //99% of the times you'll just copy this line.
- //1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
- //char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; mir_wstrcpy(lpzText, "Hello world!"); It's your choice.
-
- POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
- memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
- ppd.lchContact = NULL; //(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON1));
wcscpy_s(ppd.lpwzContactName, _countof(ppd.lpwzContactName), sender);
wcscpy_s(ppd.lpwzText, _countof(ppd.lpwzText), text);
- if(settingSetColours)
- {
+ if(settingSetColours) {
ppd.colorBack = settingBgColor;
ppd.colorText = settingFgColor;
}
ppd.PluginWindowProc = PopupDlgProc;
-
ppd.iSeconds=settingInterval1;
- //Now the "additional" data.
- mpd->id = id;
- strncpy_s(mpd->strNote, _countof(mpd->strNote), strUID, mir_strlen(strUID));
- //mpd->newStatus = ID_STATUS_ONLINE;
-
- //Now that the plugin data has been filled, we add it to the PopUpData.
ppd.PluginData = mpd;
-
- //Now that every field has been filled, we want to see the popup.
PUAddPopupW(&ppd);
}
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp
index ea3c6d20ed..47cd289725 100644
--- a/protocols/Steam/src/steam_utils.cpp
+++ b/protocols/Steam/src/steam_utils.cpp
@@ -52,7 +52,7 @@ void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *messag
return;
if (Popup_Enabled()) {
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE);
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp
index e2839a8a55..8019ddc741 100644
--- a/protocols/Tox/src/tox_utils.cpp
+++ b/protocols/Tox/src/tox_utils.cpp
@@ -105,7 +105,7 @@ void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message,
}
if (Popup_Enabled()) {
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE);
diff --git a/protocols/Weather/src/weather_popup.cpp b/protocols/Weather/src/weather_popup.cpp
index 6e72d5595e..41f95eb743 100644
--- a/protocols/Weather/src/weather_popup.cpp
+++ b/protocols/Weather/src/weather_popup.cpp
@@ -47,7 +47,7 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
else if ((DWORD)lParam == SM_NOTIFY)
PUShowMessageW(tszMsg, SM_NOTIFY);
else if ((DWORD)lParam == SM_WEATHERALERT) {
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
wchar_t str1[512], str2[512];
// get the 2 strings
@@ -129,7 +129,7 @@ int WeatherPopup(WPARAM hContact, LPARAM lParam)
WEATHERINFO winfo = LoadWeatherInfo(hContact);
// setup the popup
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
ppd.lchContact = hContact;
ppd.PluginData = ppd.lchIcon = Skin_LoadProtoIcon(MODULENAME, winfo.status);
GetDisplay(&winfo, opt.pTitle, ppd.lpwzContactName);
diff --git a/protocols/WebView/src/webview_alerts.cpp b/protocols/WebView/src/webview_alerts.cpp
index 776b100181..d03742bdb9 100644
--- a/protocols/WebView/src/webview_alerts.cpp
+++ b/protocols/WebView/src/webview_alerts.cpp
@@ -111,7 +111,7 @@ int WAlertOSD(MCONTACT hContact, wchar_t *displaytext)
/*****************************************************************************/
int PopupAlert(WPARAM hContact, LPARAM lParam)
{
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
if (hContact != 0)
mir_wstrncpy(ppd.lpwzContactName, ptrW(g_plugin.getWStringA(hContact, PRESERVE_NAME_KEY)), _countof(ppd.lpwzContactName));
diff --git a/protocols/WebView/src/webview_opts.cpp b/protocols/WebView/src/webview_opts.cpp
index 35b47b8110..9d9a75830d 100644
--- a/protocols/WebView/src/webview_opts.cpp
+++ b/protocols/WebView/src/webview_opts.cpp
@@ -187,7 +187,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_PREVIEW:
wchar_t str3[512];
- POPUPDATAW ppd = { 0 };
+ POPUPDATAW ppd;
GetDlgItemText(hdlg, IDC_DELAY, str3, _countof(str3));
diff --git a/protocols/YAMN/src/browser/badconnect.cpp b/protocols/YAMN/src/browser/badconnect.cpp
index 29b1fd285c..02db99b77d 100644
--- a/protocols/YAMN/src/browser/badconnect.cpp
+++ b/protocols/YAMN/src/browser/badconnect.cpp
@@ -84,7 +84,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP
char* TitleStrA;
char *Message1A = nullptr;
wchar_t *Message1W = nullptr;
- POPUPDATAW BadConnectPopup;
+ POPUPDATAW BadConnectPopup = {};
ActualAccount = ((struct BadConnectionParam *)lParam)->account;
ErrorCode = ((struct BadConnectionParam *)lParam)->errcode;
diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp
index d9c3af6f6c..78007bc5b2 100644
--- a/protocols/YAMN/src/browser/mailbrowser.cpp
+++ b/protocols/YAMN/src/browser/mailbrowser.cpp
@@ -495,7 +495,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags)
lfoundi = 0;
}
- POPUPDATAW NewMailPopup = { 0 };
+ POPUPDATAW NewMailPopup = {};
NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
NewMailPopup.lchIcon = g_LoadIconEx(2);
if (nflags & YAMN_ACC_POPC) {
@@ -656,7 +656,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
if ((nflags & YAMN_ACC_POP) &&
!(ActualAccount->Flags & YAMN_ACC_POPN) &&
(MN->Real.PopupRun + MN->Virtual.PopupRun)) {
- POPUPDATAW NewMailPopup = { 0 };
+ POPUPDATAW NewMailPopup;
NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
NewMailPopup.lchIcon = g_LoadIconEx(2);
@@ -744,7 +744,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
Skin_PlaySound(YAMN_NEWMAILSOUND);
if ((nnflags & YAMN_ACC_POP) && (MN->Real.PopupRun + MN->Virtual.PopupRun == 0)) {
- POPUPDATAW NoNewMailPopup;
+ POPUPDATAW NoNewMailPopup = {};
NoNewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
NoNewMailPopup.lchIcon = g_LoadIconEx(1);
diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
index fe5d7dd0a3..83551a631c 100644
--- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
@@ -1270,16 +1270,13 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_PREVIEW:
{
- POPUPDATAW Tester;
- POPUPDATAW TesterF;
- POPUPDATAW TesterN;
+ POPUPDATAW Tester = {};
+ POPUPDATAW TesterF = {};
+ POPUPDATAW TesterN = {};
BOOL TesterC = (IsDlgButtonChecked(hDlg, IDC_CHECKCOL) == BST_CHECKED);
BOOL TesterFC = (IsDlgButtonChecked(hDlg, IDC_CHECKFCOL) == BST_CHECKED);
BOOL TesterNC = (IsDlgButtonChecked(hDlg, IDC_CHECKNCOL) == BST_CHECKED);
- memset(&Tester, 0, sizeof(Tester));
- memset(&TesterF, 0, sizeof(TesterF));
- memset(&TesterN, 0, sizeof(TesterN));
Tester.lchIcon = g_LoadIconEx(2);
TesterF.lchIcon = g_LoadIconEx(3);
TesterN.lchIcon = g_LoadIconEx(1);