summaryrefslogtreecommitdiff
path: root/protocols/Weather/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-01-24 14:41:41 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-01-24 14:41:41 +0300
commit781beb2c50cea2ce2a3da799d8e4a70fa21d6fab (patch)
tree8715df52e062fbb03b789f448d3538c4a3848c63 /protocols/Weather/src
parentdc4281db051303af1f09bc151d00d64d010ce3f2 (diff)
Weather: INI file list removed
Diffstat (limited to 'protocols/Weather/src')
-rw-r--r--protocols/Weather/src/resource.h6
-rw-r--r--protocols/Weather/src/stdafx.h19
-rw-r--r--protocols/Weather/src/weather_contacts.cpp94
-rw-r--r--protocols/Weather/src/weather_info.cpp203
-rw-r--r--protocols/Weather/src/weather_opt.cpp30
-rw-r--r--protocols/Weather/src/weather_userinfo.cpp19
6 files changed, 61 insertions, 310 deletions
diff --git a/protocols/Weather/src/resource.h b/protocols/Weather/src/resource.h
index 25effcf355..f71cf3f9f5 100644
--- a/protocols/Weather/src/resource.h
+++ b/protocols/Weather/src/resource.h
@@ -21,7 +21,6 @@
#define IDR_TMENU 219
#define IDR_TMMENU 220
#define IDI_EDIT 222
-#define IDD_INFO 224
#define IDD_SEARCHCITY 225
#define IDC_NAME 2000
#define IDC_ID 2001
@@ -82,7 +81,6 @@
#define IDC_V1 2058
#define IDC_V2 2059
#define IDC_RESET2 2060
-#define IDC_SVCINFO 2061
#define IDC_GETNAME 2062
#define IDC_P1 2063
#define IDC_P2 2064
@@ -131,10 +129,6 @@
#define IDC_STEP2 2108
#define IDC_STEP3 2109
#define IDC_STEP4 2110
-#define IDC_INFOLIST 2117
-#define IDC_RELOADINI 2118
-#define IDC_MEMUSED 2119
-#define IDC_INICOUNT 2120
#define IDC_AVATARSPIN 2124
#define IDC_SEARCHCITY 2125
#define IDC_HEADERBAR 2126
diff --git a/protocols/Weather/src/stdafx.h b/protocols/Weather/src/stdafx.h
index a6992c2d62..7e119ab19f 100644
--- a/protocols/Weather/src/stdafx.h
+++ b/protocols/Weather/src/stdafx.h
@@ -287,28 +287,9 @@ bool LoadWIData(bool dial);
/////////////////////////////////////////////////////////////////////////////////////////
// functions in weather_info.c
-void GetINIInfo(wchar_t *pszSvc);
-wchar_t* GetINIVersionNum(int iVersion);
const wchar_t *GetDefaultText(int c);
-void MoreVarList();
-
/////////////////////////////////////////////////////////////////////////////////////////
// function from multiwin module
void UpdateMwinData(MCONTACT hContact);
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// UI Classes
-
-class WeatherMyDetailsDlg : public CUserInfoPageDlg
-{
- CCtrlButton btnReload;
-
-public:
- WeatherMyDetailsDlg();
-
- bool OnInitDialog() override;
-
- void onClick_Reload(CCtrlButton *);
-};
diff --git a/protocols/Weather/src/weather_contacts.cpp b/protocols/Weather/src/weather_contacts.cpp
index f63c4fa175..0c9cd20d74 100644
--- a/protocols/Weather/src/weather_contacts.cpp
+++ b/protocols/Weather/src/weather_contacts.cpp
@@ -35,7 +35,7 @@ static void OpenUrl(wchar_t *format, wchar_t *id)
bool CWeatherProto::IsMyContact(MCONTACT hContact)
{
- return !mir_strcmp(m_szModuleName, Proto_GetBaseAccountName(hContact));
+ return hContact && !mir_strcmp(m_szModuleName, Proto_GetBaseAccountName(hContact));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -106,18 +106,12 @@ INT_PTR CWeatherProto::WeatherMap(WPARAM wParam, LPARAM)
class CEditDlg : public CWeatherDlgBase
{
MCONTACT hContact;
- HICON hRename;
- HICON hUserDetail;
- HICON hFile;
- HICON hSrchAll;
CCtrlEdit edtID, edtName;
- CCtrlButton btnGetName, btnExternal, btnBrowse, btnView1, btnView2, btnReset1, btnReset2, btnSvcInfo, btnChange;
+ CCtrlButton btnExternal, btnChange;
+ CCtrlMButton btnGetName, btnBrowse, btnView1, btnView2, btnReset1, btnReset2;
- wchar_t str[MAX_DATA_LEN], str2[256], city[256], filter[256], *chop;
- char loc[512];
- OPENFILENAME ofn; // common dialog box structure
- WIDATA *sData;
+ wchar_t str[MAX_DATA_LEN], str2[256];
public:
CEditDlg(CWeatherProto *ppro, MCONTACT _1) :
@@ -125,14 +119,13 @@ public:
hContact(_1),
edtID(this, IDC_ID),
edtName(this, IDC_NAME),
- btnView1(this, IDC_VIEW1),
- btnView2(this, IDC_VIEW2),
- btnReset1(this, IDC_RESET1),
- btnReset2(this, IDC_RESET2),
- btnBrowse(this, IDC_BROWSE),
+ btnView1(this, IDC_VIEW1, SKINICON_OTHER_SEARCHALL, LPGEN("View webpage")),
+ btnView2(this, IDC_VIEW2, SKINICON_OTHER_SEARCHALL, LPGEN("View webpage")),
+ btnReset1(this, IDC_RESET1, SKINICON_OTHER_RENAME, LPGEN("Reset to default")),
+ btnReset2(this, IDC_RESET2, SKINICON_OTHER_RENAME, LPGEN("Reset to default")),
+ btnBrowse(this, IDC_BROWSE, SKINICON_EVENT_FILE, LPGEN("Browse")),
+ btnGetName(this, IDC_GETNAME, SKINICON_OTHER_RENAME, LPGEN("Get city name from ID")),
btnChange(this, IDC_CHANGE),
- btnGetName(this, IDC_GETNAME),
- btnSvcInfo(this, IDC_SVCINFO),
btnExternal(this, IDC_External)
{
edtID.OnChange = Callback(this, &CEditDlg::onChanged_ID);
@@ -145,43 +138,18 @@ public:
btnBrowse.OnClick = Callback(this, &CEditDlg::onClick_Browse);
btnChange.OnClick = Callback(this, &CEditDlg::onClick_Change);
btnGetName.OnClick = Callback(this, &CEditDlg::onClick_GetName);
- btnSvcInfo.OnClick = Callback(this, &CEditDlg::onClick_SvcInfo);
btnExternal.OnClick = Callback(this, &CEditDlg::onClick_External);
}
bool OnInitDialog() override
{
- hRename = Skin_LoadIcon(SKINICON_OTHER_RENAME);
- hUserDetail = Skin_LoadIcon(SKINICON_OTHER_USERDETAILS);
- hFile = Skin_LoadIcon(SKINICON_EVENT_FILE);
- hSrchAll = Skin_LoadIcon(SKINICON_OTHER_SEARCHALL);
-
- // set button images
- SendDlgItemMessage(m_hwnd, IDC_GETNAME, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hRename);
- SendDlgItemMessage(m_hwnd, IDC_SVCINFO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hUserDetail);
- SendDlgItemMessage(m_hwnd, IDC_BROWSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hFile);
- SendDlgItemMessage(m_hwnd, IDC_VIEW1, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hSrchAll);
- SendDlgItemMessage(m_hwnd, IDC_RESET1, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hRename);
- SendDlgItemMessage(m_hwnd, IDC_VIEW2, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hSrchAll);
- SendDlgItemMessage(m_hwnd, IDC_RESET2, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hRename);
-
// make all buttons flat
- SendDlgItemMessage(m_hwnd, IDC_GETNAME, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, IDC_SVCINFO, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, IDC_BROWSE, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, IDC_VIEW1, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, IDC_RESET1, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, IDC_VIEW2, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, IDC_RESET2, BUTTONSETASFLATBTN, TRUE, 0);
-
- // set tooltip for the buttons
- SendDlgItemMessage(m_hwnd, IDC_GETNAME, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Get city name from ID"), BATF_UNICODE);
- SendDlgItemMessage(m_hwnd, IDC_SVCINFO, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Weather INI information"), BATF_UNICODE);
- SendDlgItemMessage(m_hwnd, IDC_BROWSE, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Browse"), BATF_UNICODE);
- SendDlgItemMessage(m_hwnd, IDC_VIEW1, BUTTONADDTOOLTIP, (WPARAM)LPGENW("View webpage"), BATF_UNICODE);
- SendDlgItemMessage(m_hwnd, IDC_RESET1, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Reset to default"), BATF_UNICODE);
- SendDlgItemMessage(m_hwnd, IDC_VIEW2, BUTTONADDTOOLTIP, (WPARAM)LPGENW("View webpage"), BATF_UNICODE);
- SendDlgItemMessage(m_hwnd, IDC_RESET2, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Reset to default"), BATF_UNICODE);
+ btnView1.MakeFlat();
+ btnView2.MakeFlat();
+ btnReset1.MakeFlat();
+ btnReset2.MakeFlat();
+ btnBrowse.MakeFlat();
+ btnGetName.MakeFlat();
// save the handle for the contact
WindowList_Add(hWindowList, m_hwnd, hContact);
@@ -230,10 +198,6 @@ public:
void OnDestroy() override
{
- IcoLib_ReleaseIcon(hFile);
- IcoLib_ReleaseIcon(hRename);
- IcoLib_ReleaseIcon(hSrchAll);
- IcoLib_ReleaseIcon(hUserDetail);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
WindowList_Remove(hWindowList, m_hwnd);
@@ -245,11 +209,7 @@ public:
// check if there are 2 parts in the ID (svc/id) seperated by "/"
// if not, don't let user change the setting
GetDlgItemText(m_hwnd, IDC_ID, str, _countof(str));
- chop = wcschr(str, '/');
- if (chop == nullptr)
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHANGE), FALSE);
- else
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHANGE), TRUE);
+ btnChange.Enable(wcschr(str, '/') != nullptr);
}
void onChanged_Name(CCtrlEdit *)
@@ -270,13 +230,14 @@ public:
// get the weather update data using the string in the ID field
GetDlgItemText(m_hwnd, IDC_ID, str, _countof(str));
GetSvc(str);
- sData = GetWIData(str);
+ WIDATA *sData = GetWIData(str);
GetDlgItemText(m_hwnd, IDC_ID, str, _countof(str));
GetID(str);
// if ID search is available, do it
if (sData->IDSearch.Available) {
// load the page
+ char loc[512];
mir_snprintf(loc, sData->IDSearch.SearchURL, str);
str[0] = 0;
wchar_t *pData = nullptr;
@@ -313,13 +274,14 @@ public:
GetDlgItemText(m_hwnd, IDC_LOG, str, _countof(str));
// Initialize OPENFILENAME
- memset(&ofn, 0, sizeof(OPENFILENAME));
+ OPENFILENAME ofn = {};
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = m_hwnd;
ofn.lpstrFile = str;
ofn.nMaxFile = _countof(str);
// set filters
+ wchar_t filter[256];
mir_snwprintf(filter, L"%s (*.txt)%c*.txt%c%s (*.*)%c*.*%c%c", TranslateT("Text Files"), 0, 0, TranslateT("All Files"), 0, 0, 0);
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
@@ -361,7 +323,7 @@ public:
// reset the more info url to service default
GetDlgItemText(m_hwnd, IDC_ID, str, _countof(str));
GetSvc(str);
- sData = GetWIData(str);
+ WIDATA *sData = GetWIData(str);
SetDlgItemTextA(m_hwnd, IDC_IURL, sData->DefaultURL);
}
@@ -370,18 +332,10 @@ public:
// reset the weathe map url to service default
GetDlgItemText(m_hwnd, IDC_ID, str, _countof(str));
GetSvc(str);
- sData = GetWIData(str);
+ WIDATA *sData = GetWIData(str);
SetDlgItemText(m_hwnd, IDC_MURL, sData->DefaultMap);
}
- void onClick_SvcInfo(CCtrlButton *)
- {
- // display the information of the ini file used by the weather station
- GetDlgItemText(m_hwnd, IDC_ID, str, _countof(str));
- GetSvc(str);
- GetINIInfo(str);
- }
-
void onClick_Change(CCtrlButton *)
{
// temporary disable the protocol while applying the change
@@ -393,6 +347,8 @@ public:
m_proto->opt.DefStn = hContact;
m_proto->setWString("Default", m_proto->opt.Default);
}
+
+ wchar_t city[256];
GetDlgItemText(m_hwnd, IDC_NAME, city, _countof(city));
m_proto->setWString(hContact, "Nick", city);
mir_snwprintf(str2, TranslateT("Current weather information for %s."), city);
diff --git a/protocols/Weather/src/weather_info.cpp b/protocols/Weather/src/weather_info.cpp
deleted file mode 100644
index 5e4c79fb4a..0000000000
--- a/protocols/Weather/src/weather_info.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-Weather Protocol plugin for Miranda IM
-Copyright (c) 2012 Miranda NG team
-Copyright (c) 2005-2011 Boris Krasnovskiy All Rights Reserved
-Copyright (c) 2002-2005 Calvin Che
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-/*
-This file contain the source for displaying information for the
-ini files, as well as function that are used for debug purpose
-regrading the loading of ini contents
-*/
-
-#include "stdafx.h"
-
-//============ INI INFORMATION ============
-
-// List INI Information for all loaded INI files
-static void INIInfo(HWND hwndDlg)
-{
- wchar_t str[16];
- size_t memused = 0;
-
- HWND hIniList = GetDlgItem(hwndDlg, IDC_INFOLIST);
-
- ListView_DeleteAllItems(hIniList);
-
- LVITEM lvi = {};
- lvi.mask = LVIF_TEXT;
- lvi.iItem = 0;
- for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
- // get the data for the ini file
- lvi.iSubItem = 0;
- lvi.pszText = Item->Data.InternalName;
- ListView_InsertItem(hIniList, &lvi);
- lvi.iSubItem = 1;
- lvi.pszText = Item->Data.Author;
- ListView_SetItem(hIniList, &lvi);
- lvi.iSubItem = 2;
- lvi.pszText = Item->Data.Version;
- ListView_SetItem(hIniList, &lvi);
- lvi.iSubItem = 3;
- lvi.pszText = GetINIVersionNum(Item->Data.InternalVer);
- ListView_SetItem(hIniList, &lvi);
- lvi.iSubItem = 4;
- lvi.pszText = _ltow(Item->Data.UpdateDataCount, str, 10);
- ListView_SetItem(hIniList, &lvi);
- lvi.iSubItem = 5;
- lvi.pszText = Item->Data.DisplayName;
- ListView_SetItem(hIniList, &lvi);
- lvi.iSubItem = 6;
- lvi.pszText = Item->Data.ShortFileName;
- ListView_SetItem(hIniList, &lvi);
-
- memused += Item->Data.MemUsed;
-
- ++lvi.iItem;
- }
- SetDlgItemText(hwndDlg, IDC_INICOUNT, _itow(lvi.iItem, str, 10));
- SetDlgItemText(hwndDlg, IDC_MEMUSED, _ltow((long)memused, str, 10));
-}
-
-struct
-{
- const wchar_t *name;
- unsigned size;
-}
-static columns[] =
-{
- { LPGENW("Name"), 70 },
- { LPGENW("Author"), 100 },
- { LPGENW("File Version"), 70 },
- { LPGENW("INI Version"), 70 },
- { LPGENW("Items"), 40 },
- { LPGENW("Display Name"), 200 },
- { LPGENW("File Name"), 150 },
-};
-
-WeatherMyDetailsDlg::WeatherMyDetailsDlg() :
- CUserInfoPageDlg(g_plugin, IDD_INFO),
- btnReload(this, IDC_RELOADINI)
-{
- btnReload.OnClick = Callback(this, &WeatherMyDetailsDlg::onClick_Reload);
-}
-
-bool WeatherMyDetailsDlg::OnInitDialog()
-{
- HWND hIniList = GetDlgItem(m_hwnd, IDC_INFOLIST);
-
- LVCOLUMN lvc = {};
- lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
- lvc.fmt = LVCFMT_LEFT;
- for (auto &it : columns) {
- lvc.iSubItem = int(&it - columns);
- lvc.pszText = TranslateW(it.name);
- lvc.cx = it.size;
- ListView_InsertColumn(hIniList, lvc.iSubItem, &lvc);
- }
-
- INIInfo(m_hwnd);
- return true;
-}
-
-void WeatherMyDetailsDlg::onClick_Reload(CCtrlButton*)
-{
- DestroyWIList();
- LoadWIData(true);
- INIInfo(m_hwnd);
-}
-
-// get the info of individual ini file
-// pszSvc = the internal name of the service to get the data
-
-wchar_t* GetINIVersionNum(int iVersion)
-{
- switch (iVersion) {
- case 1: return L"1.0";
- case 2: return L"1.1";
- case 3: return L"1.1a";
- case 4: return L"1.2";
- case 5: return L"1.3";
- case 6: return L"1.4";
- case 7: return L"1.5";
- }
- return L"";
-}
-
-void GetINIInfo(wchar_t *pszSvc)
-{
- CMStringW str;
- WIDATA *sData = GetWIData(pszSvc);
- // if the service does not exist among the loaded INI's
- if (sData == nullptr) {
- str.Format(TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
- }
- // if exist, get the information
- else {
- str.AppendFormat(TranslateT("Weather INI information for \"%s\":"), pszSvc);
- str += L"\n\n";
- str.AppendFormat(L"%s\t%s\n", TranslateT("Name:"), sData->DisplayName);
- str.AppendFormat(L"%s\t%s\n", TranslateT("Internal Name:"), sData->InternalName);
- str.AppendFormat(L"%s\t%s\n", TranslateT("Author:"), sData->Author);
- str.AppendFormat(L"%s\t%s\n", TranslateT("Version:"), sData->Version);
- str.AppendFormat(L"%s\t%s\n", TranslateT("INI Version:"), GetINIVersionNum(sData->InternalVer));
- str.AppendFormat(L"%s\t%s\n", TranslateT("File Name:"), sData->ShortFileName);
- str.AppendFormat(L"%s\t%i\n", TranslateT("Item Count:"), sData->UpdateDataCount);
- str.AppendFormat(L"%s\t%i %s\n\n", TranslateT("Memory Used:"), (int)sData->MemUsed, TranslateT("bytes"));
- str.AppendFormat(L"%s\n%s", TranslateT("Description:"), sData->Description);
- }
-
- MessageBox(nullptr, str, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
-}
-
-//============ DISPLAY A LIST FOR CUSTOM VARIABLES ============
-//
-// a message box for displaying the list of custom variables
-// can be found when click on "More" in text option dialog
-void MoreVarList(void)
-{
- // heading
- CMStringW str(TranslateT("Here is a list of custom variables that are currently available"));
- str += L"\n\n";
-
- // loop through all weather services to find custom variables
- bool bFirst = true;
- for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
- // loop through all update items in a service
- for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != nullptr; WItem = WItem->Next) {
- // the custom variable is defined as "%[<variable name>]"
- // ignore the "hi" item and hidden items
- if (mir_wstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
- wchar_t tempstr[1024];
- mir_snwprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
- auto *find = wcsstr(str, tempstr);
- // if the custom variable does not exist in the list, add it to the list
- if (find == nullptr) {
- if (bFirst)
- bFirst = false;
- else
- str += L", ";
- str += tempstr;
- }
- }
- }
- }
-
- // display the list in a message box
- MessageBox(nullptr, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
-}
diff --git a/protocols/Weather/src/weather_opt.cpp b/protocols/Weather/src/weather_opt.cpp
index a5e747439f..ddda55a453 100644
--- a/protocols/Weather/src/weather_opt.cpp
+++ b/protocols/Weather/src/weather_opt.cpp
@@ -388,7 +388,35 @@ public:
void onClick_More(CCtrlButton *)
{
- MoreVarList();
+ // heading
+ CMStringW str(TranslateT("Here is a list of custom variables that are currently available"));
+ str += L"\n\n";
+
+ // loop through all weather services to find custom variables
+ bool bFirst = true;
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
+ // loop through all update items in a service
+ for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != nullptr; WItem = WItem->Next) {
+ // the custom variable is defined as "%[<variable name>]"
+ // ignore the "hi" item and hidden items
+ if (mir_wstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
+ wchar_t tempstr[1024];
+ mir_snwprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
+ auto *find = wcsstr(str, tempstr);
+ // if the custom variable does not exist in the list, add it to the list
+ if (find == nullptr) {
+ if (bFirst)
+ bFirst = false;
+ else
+ str += L", ";
+ str += tempstr;
+ }
+ }
+ }
+ }
+
+ // display the list in a message box
+ MessageBox(nullptr, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
}
void onClick_TM(CCtrlButton *pButton)
diff --git a/protocols/Weather/src/weather_userinfo.cpp b/protocols/Weather/src/weather_userinfo.cpp
index f24f600874..32cfd15439 100644
--- a/protocols/Weather/src/weather_userinfo.cpp
+++ b/protocols/Weather/src/weather_userinfo.cpp
@@ -314,19 +314,14 @@ public:
int CWeatherProto::UserInfoInit(WPARAM wParam, LPARAM hContact)
{
- USERINFOPAGE uip = {};
- uip.szTitle.a = m_szModuleName;
- uip.position = 100000000;
- uip.flags = ODPF_ICON;
- uip.dwInitParam = LPARAM(g_plugin.getIconHandle(IDI_ICON));
-
- if (hContact == 0) {
- uip.pDialog = new WeatherMyDetailsDlg();
- g_plugin.addUserInfo(wParam, &uip);
- }
- else if (IsMyContact(hContact)) { // check if it is a weather contact
+ // check if it is a weather contact
+ if (IsMyContact(hContact)) {
+ USERINFOPAGE uip = {};
+ uip.szTitle.a = m_szModuleName;
+ uip.position = 100000000;
+ uip.flags = ODPF_ICON | ODPF_BOLDGROUPS;
+ uip.dwInitParam = LPARAM(g_plugin.getIconHandle(IDI_ICON));
uip.pDialog = new WeatherUserInfoDlg();
- uip.flags |= ODPF_BOLDGROUPS;
g_plugin.addUserInfo(wParam, &uip);
}
return 0;