diff options
Diffstat (limited to 'plugins/Weather/src')
-rw-r--r-- | plugins/Weather/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/Weather/src/weather.h | 68 | ||||
-rw-r--r-- | plugins/Weather/src/weather_addstn.cpp | 4 | ||||
-rw-r--r-- | plugins/Weather/src/weather_contacts.cpp | 20 | ||||
-rw-r--r-- | plugins/Weather/src/weather_conv.cpp | 2 | ||||
-rw-r--r-- | plugins/Weather/src/weather_data.cpp | 20 | ||||
-rw-r--r-- | plugins/Weather/src/weather_ini.cpp | 2 | ||||
-rw-r--r-- | plugins/Weather/src/weather_mwin.cpp | 4 | ||||
-rw-r--r-- | plugins/Weather/src/weather_opt.cpp | 86 | ||||
-rw-r--r-- | plugins/Weather/src/weather_svcs.cpp | 4 | ||||
-rw-r--r-- | plugins/Weather/src/weather_update.cpp | 17 |
11 files changed, 117 insertions, 111 deletions
diff --git a/plugins/Weather/src/resource.h b/plugins/Weather/src/resource.h index e88e4c19de..8a6bcd57d7 100644 --- a/plugins/Weather/src/resource.h +++ b/plugins/Weather/src/resource.h @@ -58,7 +58,6 @@ #define IDC_HTEXT 2028
#define IDC_DPop 2029
#define IDC_DAutoUpdate 2030
-#define IDC_NEWWIN 2031
#define IDC_IURL 2032
#define IDC_MURL 2033
#define IDC_PROTOCOND 2034
diff --git a/plugins/Weather/src/weather.h b/plugins/Weather/src/weather.h index 95a7d5bf49..e4acc35e04 100644 --- a/plugins/Weather/src/weather.h +++ b/plugins/Weather/src/weather.h @@ -174,19 +174,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //============ OPTION STRUCT ============
// option struct
-typedef struct {
-// main options
- BOOL AutoUpdate;
- BOOL CAutoUpdate;
- BOOL StartupUpdate;
+struct MYOPTIONS
+{
+ // main options
+ BYTE AutoUpdate;
+ BYTE CAutoUpdate;
+ BYTE StartupUpdate;
+ BYTE NoProtoCondition;
+ BYTE UpdateOnlyConditionChanged;
+ BYTE RemoveOldData;
+ BYTE MakeItalic;
+
WORD UpdateTime;
WORD AvatarSize;
- BOOL NewBrowserWin;
- BOOL NoProtoCondition;
- BOOL UpdateOnlyConditionChanged;
- BOOL RemoveOldData;
- BOOL MakeItalic;
-// units
+
+ // units
WORD tUnit;
WORD wUnit;
WORD vUnit;
@@ -194,9 +196,10 @@ typedef struct { WORD dUnit;
WORD eUnit;
TCHAR DegreeSign[4];
- BOOL DoNotAppendUnit;
- BOOL NoFrac;
-// texts
+ BYTE DoNotAppendUnit;
+ BYTE NoFrac;
+
+ // texts
TCHAR *cText;
TCHAR *bTitle;
TCHAR *bText;
@@ -205,30 +208,37 @@ typedef struct { TCHAR *hText;
TCHAR *xText;
TCHAR *sText;
-// advanced
- BOOL DisCondIcon;
-// popup options
- BOOL UsePopup;
- BOOL UpdatePopup;
- BOOL AlertPopup;
- BOOL PopupOnChange;
- BOOL ShowWarnings;
-// popup colors
- BOOL UseWinColors;
+
+ // advanced
+ BYTE DisCondIcon;
+
+ // popup options
+ BYTE UsePopup;
+ BYTE UpdatePopup;
+ BYTE AlertPopup;
+ BYTE PopupOnChange;
+ BYTE ShowWarnings;
+
+ // popup colors
+ BYTE UseWinColors;
COLORREF BGColour;
COLORREF TextColour;
-// popup actions
+
+ // popup actions
DWORD LeftClickAction;
DWORD RightClickAction;
-// popup delay
+
+ // popup delay
DWORD pDelay;
-// popup texts
+
+ // popup texts
TCHAR *pTitle;
TCHAR *pText;
-// other misc stuff
+
+ // other misc stuff
TCHAR Default[64];
HANDLE DefStn;
-} MYOPTIONS;
+};
void DestroyOptions(void);
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 9a3f1fd19f..4cc2a34a90 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -44,7 +44,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) if ( IsMyContact(hContact)) {
DBVARIANT dbv;
// check ID to see if the contact already exist in the database
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "ID", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
if ( !_tcsicmp(psr->email, dbv.ptszVal)) {
// remove the flag for not on list and hidden, thus make the contact visible
// and add them on the list
@@ -108,7 +108,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) GetStationID(hContact, opt.Default, SIZEOF(opt.Default));
opt.DefStn = hContact;
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
// notification message box
wsprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 4c049f5d26..c43f3332d4 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -32,7 +32,7 @@ static void OpenUrl( TCHAR* format, TCHAR* id ) GetID( id );
mir_sntprintf( loc, SIZEOF(loc), format, id );
- CallService(MS_UTILS_OPENURL, opt.NewBrowserWin | OUF_TCHAR, (LPARAM)loc );
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)loc );
}
//============ BASIC CONTACTS FUNCTIONS AND LINKS ============
@@ -43,7 +43,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam) {
// see if the log path is set
DBVARIANT dbv;
- if ( !DBGetContactSettingTString((HANDLE)wParam, WEATHERPROTONAME, "Log", &dbv)) {
+ if ( !db_get_ts((HANDLE)wParam, WEATHERPROTONAME, "Log", &dbv)) {
if (dbv.pszVal[0] != 0)
ShellExecute((HWND)lParam, _T("open"), dbv.ptszVal, _T(""), _T(""), SW_SHOW);
db_free(&dbv);
@@ -182,17 +182,17 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa // start to get the settings
// if the setting not exist, leave the dialog box blank
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "ID", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
SetDlgItemText(hwndDlg, IDC_ID, dbv.ptszVal);
// check if the station is a default station
CheckDlgButton(hwndDlg, IDC_DEFA, _tcscmp(dbv.ptszVal, opt.Default) != 0);
db_free(&dbv);
}
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_NAME, dbv.ptszVal);
db_free(&dbv);
}
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Log", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "Log", &dbv)) {
SetDlgItemText(hwndDlg, IDC_LOG, dbv.ptszVal);
// if the log path is not empty, check the checkbox for external log
if (dbv.ptszVal[0]) CheckDlgButton(hwndDlg, IDC_External, TRUE);
@@ -206,11 +206,11 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa CheckDlgButton(hwndDlg, IDC_DAutoUpdate, db_get_b(hContact, WEATHERPROTONAME, "DAutoUpdate", FALSE));
CheckDlgButton(hwndDlg, IDC_Internal, db_get_b(hContact, WEATHERPROTONAME, "History", 0));
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "InfoURL", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "InfoURL", &dbv)) {
SetDlgItemText(hwndDlg, IDC_IURL, dbv.ptszVal);
db_free(&dbv);
}
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "MapURL", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "MapURL", &dbv)) {
SetDlgItemText(hwndDlg, IDC_MURL, dbv.ptszVal);
db_free(&dbv);
}
@@ -437,7 +437,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam) // exit this function if it is not default station
DBVARIANT dbv;
- if ( !DBGetContactSettingTString((HANDLE)wParam, WEATHERPROTONAME, "ID", &dbv)) {
+ if ( !db_get_ts((HANDLE)wParam, WEATHERPROTONAME, "ID", &dbv)) {
if ( _tcscmp(dbv.ptszVal, opt.Default)) {
db_free(&dbv);
return 0;
@@ -451,14 +451,14 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam) HANDLE hContact = db_find_first();
while(hContact) {
if (IsMyContact(hContact)) {
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "ID", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
// if the station is not a default station, set it as the new default station
// this is the first weather station encountered from the search
if ( _tcscmp(opt.Default, dbv.ptszVal)) {
_tcscpy(opt.Default, dbv.ptszVal);
opt.DefStn = hContact;
db_free(&dbv);
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
TCHAR str[255];
mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index 780253b8ac..565def07cb 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -554,7 +554,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) strcat(name, temp);
}
// access the database to get its value
- if ( !DBGetContactSettingTString(w->hContact, WEATHERCONDITION, name, &dbv)) {
+ if ( !db_get_ts(w->hContact, WEATHERCONDITION, name, &dbv)) {
if (dbv.ptszVal != TranslateTS(NODATA) && dbv.ptszVal != TranslateT("<Error>"))
_tcscat(str, dbv.ptszVal);
db_free(&dbv);
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index 09fd7f849e..cc7a4e93b9 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -88,13 +88,13 @@ WEATHERINFO LoadWeatherInfo(HANDLE hContact) // return 0 on success
int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv)
{
- if ( DBGetContactSettingTString(hContact, WEATHERCONDITION, setting, dbv)) {
+ if ( db_get_ts(hContact, WEATHERCONDITION, setting, dbv)) {
size_t len = strlen(setting) + 1;
char *set = (char*)alloca(len + 1);
*set = '#';
memcpy(set + 1, setting, len);
- if ( DBGetContactSettingTString(hContact, WEATHERCONDITION, set, dbv))
+ if ( db_get_ts(hContact, WEATHERCONDITION, set, dbv))
return 1;
}
return 0;
@@ -103,7 +103,7 @@ int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv) int DBGetStaticString(HANDLE hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len)
{
DBVARIANT dbv;
- if ( DBGetContactSettingTString( hContact, szModule, valueName, &dbv ))
+ if ( db_get_ts( hContact, szModule, valueName, &dbv ))
return 1;
_tcsncpy( dest, dbv.ptszVal, dest_len );
@@ -132,7 +132,7 @@ void EraseAllInfo() db_set_w(hContact,WEATHERPROTONAME, "StatusIcon",ID_STATUS_OFFLINE);
db_unset(hContact, "CList", "MyHandle");
// clear all data
- if ( DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+ if ( db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
db_set_ts(hContact, WEATHERPROTONAME, "Nick", TranslateT("<Enter city name here>"));
db_set_s(hContact, WEATHERPROTONAME, "LastLog", "never");
db_set_s(hContact, WEATHERPROTONAME, "LastCondition", "None");
@@ -145,7 +145,7 @@ void EraseAllInfo() // reset update tag
db_set_b(hContact,WEATHERPROTONAME, "IsUpdated",FALSE);
// reset logging settings
- if ( !DBGetContactSettingTString(hContact,WEATHERPROTONAME, "Log", &dbv)) {
+ if ( !db_get_ts(hContact,WEATHERPROTONAME, "Log", &dbv)) {
db_set_b(hContact,WEATHERPROTONAME, "File",(BYTE)(dbv.ptszVal[0] != 0));
db_free(&dbv);
}
@@ -156,7 +156,7 @@ void EraseAllInfo() GetStationID(hContact, opt.Default, SIZEOF(opt.Default));
opt.DefStn = hContact;
- if ( !DBGetContactSettingTString(hContact,WEATHERPROTONAME, "Nick",&dbv)) {
+ if ( !db_get_ts(hContact,WEATHERPROTONAME, "Nick",&dbv)) {
wsprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION);
@@ -164,7 +164,7 @@ void EraseAllInfo() }
// get the handle of the default station
if (opt.DefStn == NULL) {
- if ( !DBGetContactSettingTString(hContact,WEATHERPROTONAME, "ID",&dbv)) {
+ if ( !db_get_ts(hContact,WEATHERPROTONAME, "ID",&dbv)) {
if ( !_tcscmp(dbv.ptszVal, opt.Default))
opt.DefStn = hContact;
db_free(&dbv);
@@ -180,12 +180,12 @@ void EraseAllInfo() // if (ContactCount != 0) status = ONLINE;
// in case where the default station is missing
if (opt.DefStn == NULL && ContactCount != 0) {
- if ( !DBGetContactSettingTString(LastContact, WEATHERPROTONAME, "ID", &dbv)) {
+ if ( !db_get_ts(LastContact, WEATHERPROTONAME, "ID", &dbv)) {
_tcscpy(opt.Default, dbv.ptszVal);
db_free(&dbv);
}
opt.DefStn = LastContact;
- if ( !DBGetContactSettingTString(LastContact,WEATHERPROTONAME, "Nick",&dbv)) {
+ if ( !db_get_ts(LastContact,WEATHERPROTONAME, "Nick",&dbv)) {
wsprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION);
@@ -439,7 +439,7 @@ void DBDataManage(HANDLE hContact, WORD Mode, WPARAM wParam, LPARAM lParam) char *szSetting = arSettings[i];
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, WEATHERCONDITION, szSetting, &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERCONDITION, szSetting, &dbv)) {
switch (Mode) {
case WDBM_REMOVE:
db_unset(hContact, WEATHERCONDITION, szSetting);
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 69f9ba40bb..027331408c 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -567,7 +567,7 @@ INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar {
case IDC_STEP1:
// update current data
- CallService(MS_UTILS_OPENURL, opt.NewBrowserWin | OUF_TCHAR, (WPARAM)_T("http://miranda-ng.org/"));
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (WPARAM)_T("http://miranda-ng.org/"));
break;
case IDC_STEP2:
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index f5f305109f..9e6288cd34 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -180,7 +180,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara fntc1 = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt1);
}
- DBGetContactSettingTString(data->hContact, WEATHERCONDITION, "WeatherInfo", &dbv);
+ db_get_ts(data->hContact, WEATHERCONDITION, "WeatherInfo", &dbv);
GetClientRect(hwnd, &rc);
@@ -254,7 +254,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara static void addWindow(HANDLE hContact)
{
DBVARIANT dbv;
- DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Nick", &dbv);
+ db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv);
TCHAR winname[512];
mir_sntprintf(winname, SIZEOF(winname), _T("Weather: %s"), dbv.ptszVal);
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 31ddc72e2d..6a3e7a00da 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -104,19 +104,18 @@ void DestroyOptions(void) // load options from database + set default if the setting does not exist
void LoadOptions(void)
{
- DBVARIANT dbv;
ZeroMemory(&opt, sizeof(opt));
// main options
- opt.StartupUpdate = db_get_b(NULL, WEATHERPROTONAME, "StartupUpdate",TRUE);
- opt.AutoUpdate = db_get_b(NULL, WEATHERPROTONAME, "AutoUpdate",TRUE);
- opt.UpdateTime = db_get_w(NULL, WEATHERPROTONAME, "UpdateTime",30);
- opt.NewBrowserWin = db_get_b(NULL, WEATHERPROTONAME, "NewWindow",TRUE);
- opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus",TRUE);
- opt.UpdateOnlyConditionChanged = db_get_b(NULL, WEATHERPROTONAME, "CondChangeAsUpdate",TRUE);
- opt.RemoveOldData = db_get_b(NULL, WEATHERPROTONAME, "RemoveOld",FALSE);
- opt.MakeItalic = db_get_b(NULL, WEATHERPROTONAME, "MakeItalic",TRUE);
+ opt.StartupUpdate = db_get_b(NULL, WEATHERPROTONAME, "StartupUpdate", true);
+ opt.AutoUpdate = db_get_b(NULL, WEATHERPROTONAME, "AutoUpdate", true);
+ opt.UpdateTime = db_get_w(NULL, WEATHERPROTONAME, "UpdateTime", 30);
+ opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
+ opt.UpdateOnlyConditionChanged = db_get_b(NULL, WEATHERPROTONAME, "CondChangeAsUpdate", true);
+ opt.RemoveOldData = db_get_b(NULL, WEATHERPROTONAME, "RemoveOld", false);
+ opt.MakeItalic = db_get_b(NULL, WEATHERPROTONAME, "MakeItalic", true);
opt.AvatarSize = db_get_b(NULL, WEATHERPROTONAME, "AvatarSize", 128);
+
// units
opt.tUnit = db_get_w(NULL, WEATHERPROTONAME, "tUnit", 1);
opt.wUnit = db_get_w(NULL, WEATHERPROTONAME, "wUnit", 2);
@@ -124,7 +123,9 @@ void LoadOptions(void) opt.pUnit = db_get_w(NULL, WEATHERPROTONAME, "pUnit", 4);
opt.dUnit = db_get_w(NULL, WEATHERPROTONAME, "dUnit", 1);
opt.eUnit = db_get_w(NULL, WEATHERPROTONAME, "eUnit", 2);
- if (DBGetContactSettingTString(NULL, WEATHERPROTONAME, "DegreeSign",&dbv))
+
+ DBVARIANT dbv;
+ if (db_get_ts(NULL, WEATHERPROTONAME, "DegreeSign",&dbv))
_tcscpy(opt.DegreeSign, _T(""));
else {
_tcscpy(opt.DegreeSign, dbv.ptszVal);
@@ -133,86 +134,86 @@ void LoadOptions(void) opt.DoNotAppendUnit = db_get_b(NULL, WEATHERPROTONAME, "DoNotAppendUnit", 0);
opt.NoFrac = db_get_b(NULL, WEATHERPROTONAME, "NoFractions", 0);
// texts
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "DisplayText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "DisplayText", &dbv)) {
wSetData(&opt.cText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("C");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "BriefTextTitle",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "BriefTextTitle", &dbv)) {
wSetData(&opt.bTitle, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("b");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "BriefText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "BriefText", &dbv)) {
wSetData(&opt.bText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("B");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "NoteText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "NoteText", &dbv)) {
wSetData(&opt.nText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("N");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "ExtText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "ExtText", &dbv)) {
wSetData(&opt.eText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("E");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "HistoryText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "HistoryText", &dbv)) {
wSetData(&opt.hText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("H");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "ExtraText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "ExtraText", &dbv)) {
wSetData(&opt.xText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("X");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "StatusText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "StatusText", &dbv)) {
wSetData(&opt.sText, TranslateTS(dbv.ptszVal));
db_free(&dbv);
}
else SetTextDefault("S");
// advanced
- opt.DisCondIcon = db_get_b(NULL, WEATHERPROTONAME, "DisableConditionIcon",FALSE);
+ opt.DisCondIcon = db_get_b(NULL, WEATHERPROTONAME, "DisableConditionIcon", false);
// popup options
- opt.UsePopup = db_get_b(NULL, WEATHERPROTONAME, "UsePopUp",TRUE);
- opt.UpdatePopup = db_get_b(NULL, WEATHERPROTONAME, "UpdatePopup",TRUE);
- opt.AlertPopup = db_get_b(NULL, WEATHERPROTONAME, "AlertPopup",TRUE);
- opt.PopupOnChange = db_get_b(NULL, WEATHERPROTONAME, "PopUpOnChange",TRUE);
- opt.ShowWarnings = db_get_b(NULL, WEATHERPROTONAME, "ShowWarnings",TRUE);
+ opt.UsePopup = db_get_b(NULL, WEATHERPROTONAME, "UsePopUp", true);
+ opt.UpdatePopup = db_get_b(NULL, WEATHERPROTONAME, "UpdatePopup", true);
+ opt.AlertPopup = db_get_b(NULL, WEATHERPROTONAME, "AlertPopup", true);
+ opt.PopupOnChange = db_get_b(NULL, WEATHERPROTONAME, "PopUpOnChange", true);
+ opt.ShowWarnings = db_get_b(NULL, WEATHERPROTONAME, "ShowWarnings", true);
// popup colors
- opt.BGColour = db_get_dw(NULL, WEATHERPROTONAME, "BackgroundColour",GetSysColor(COLOR_BTNFACE));
- opt.TextColour = db_get_dw(NULL, WEATHERPROTONAME, "TextColour",GetSysColor(COLOR_WINDOWTEXT));
- opt.UseWinColors = (BOOL)db_get_b(NULL, WEATHERPROTONAME, "UseWinColors", FALSE);
+ opt.BGColour = db_get_dw(NULL, WEATHERPROTONAME, "BackgroundColour", GetSysColor(COLOR_BTNFACE));
+ opt.TextColour = db_get_dw(NULL, WEATHERPROTONAME, "TextColour", GetSysColor(COLOR_WINDOWTEXT));
+ opt.UseWinColors = (BOOL)db_get_b(NULL, WEATHERPROTONAME, "UseWinColors", false);
// popup actions
- opt.LeftClickAction = db_get_dw(NULL, WEATHERPROTONAME, "LeftClickAction",IDM_M2);
- opt.RightClickAction = db_get_dw(NULL, WEATHERPROTONAME, "RightClickAction",IDM_M1);
+ opt.LeftClickAction = db_get_dw(NULL, WEATHERPROTONAME, "LeftClickAction", IDM_M2);
+ opt.RightClickAction = db_get_dw(NULL, WEATHERPROTONAME, "RightClickAction", IDM_M1);
// popup delay
- opt.pDelay = db_get_dw(NULL, WEATHERPROTONAME, "PopupDelay",0);
+ opt.pDelay = db_get_dw(NULL, WEATHERPROTONAME, "PopupDelay", 0);
// popup texts
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "PopupTitle",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "PopupTitle",&dbv)) {
wSetData(&opt.pTitle, dbv.ptszVal);
db_free(&dbv);
}
else SetTextDefault("P");
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "PopupText",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "PopupText",&dbv)) {
wSetData(&opt.pText, dbv.ptszVal);
db_free(&dbv);
}
else SetTextDefault("p");
// misc
- if ( !DBGetContactSettingTString(NULL, WEATHERPROTONAME, "Default",&dbv)) {
+ if ( !db_get_ts(NULL, WEATHERPROTONAME, "Default",&dbv)) {
_tcscpy(opt.Default, dbv.ptszVal);
db_free(&dbv);
}
@@ -226,7 +227,6 @@ void SaveOptions(void) db_set_b(NULL, WEATHERPROTONAME, "StartupUpdate", (BYTE)opt.StartupUpdate);
db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)opt.AutoUpdate);
db_set_w(NULL, WEATHERPROTONAME, "UpdateTime", opt.UpdateTime);
- db_set_b(NULL, WEATHERPROTONAME, "NewWindow", (BYTE)opt.NewBrowserWin);
db_set_b(NULL, WEATHERPROTONAME, "NoStatus", (BYTE)opt.NoProtoCondition);
db_set_b(NULL, WEATHERPROTONAME, "CondChangeAsUpdate", (BYTE)opt.UpdateOnlyConditionChanged);
db_set_b(NULL, WEATHERPROTONAME, "RemoveOld", (BYTE)opt.RemoveOldData);
@@ -334,16 +334,15 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) SendDlgItemMessage(hdlg, IDC_AVATARSPIN, UDM_SETPOS, 0, opt.AvatarSize);
SendDlgItemMessage(hdlg, IDC_AVATARSIZE, EM_LIMITTEXT, 3, 0);
- CheckDlgButton(hdlg, IDC_STARTUPUPD, opt.StartupUpdate);
- CheckDlgButton(hdlg, IDC_UPDATE, opt.AutoUpdate);
- CheckDlgButton(hdlg, IDC_PROTOCOND, !opt.NoProtoCondition);
- CheckDlgButton(hdlg, IDC_UPDCONDCHG, opt.UpdateOnlyConditionChanged);
- CheckDlgButton(hdlg, IDC_NEWWIN, opt.NewBrowserWin);
- CheckDlgButton(hdlg, IDC_REMOVEOLD, opt.RemoveOldData);
- CheckDlgButton(hdlg, IDC_MAKEI, opt.MakeItalic);
- CheckDlgButton(hdlg, IDC_DISCONDICON, opt.DisCondIcon);
+ CheckDlgButton(hdlg, IDC_STARTUPUPD, opt.StartupUpdate);
+ CheckDlgButton(hdlg, IDC_UPDATE, opt.AutoUpdate);
+ CheckDlgButton(hdlg, IDC_PROTOCOND, !opt.NoProtoCondition);
+ CheckDlgButton(hdlg, IDC_UPDCONDCHG, opt.UpdateOnlyConditionChanged);
+ CheckDlgButton(hdlg, IDC_REMOVEOLD, opt.RemoveOldData);
+ CheckDlgButton(hdlg, IDC_MAKEI, opt.MakeItalic);
+ CheckDlgButton(hdlg, IDC_DISCONDICON, opt.DisCondIcon);
CheckDlgButton(hdlg, IDC_DONOTAPPUNITS, opt.DoNotAppendUnit);
- CheckDlgButton(hdlg, IDC_NOFRAC, opt.NoFrac);
+ CheckDlgButton(hdlg, IDC_NOFRAC, opt.NoFrac);
// load units
switch (opt.tUnit) { // temperature
@@ -409,7 +408,6 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, sizeof(opt.DegreeSign));
opt.StartupUpdate = IsDlgButtonChecked(hdlg, IDC_STARTUPUPD);
opt.AutoUpdate = IsDlgButtonChecked(hdlg, IDC_UPDATE);
- opt.NewBrowserWin = IsDlgButtonChecked(hdlg, IDC_NEWWIN);
opt.NoProtoCondition = !IsDlgButtonChecked(hdlg, IDC_PROTOCOND);
opt.DisCondIcon = IsDlgButtonChecked(hdlg, IDC_DISCONDICON);
opt.UpdateOnlyConditionChanged = (BYTE)IsDlgButtonChecked(hdlg, IDC_UPDCONDCHG);
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index 3872760fc6..ee0948bf4c 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -37,7 +37,7 @@ INT_PTR WeatherSetStatus(WPARAM new_status, LPARAM lParam) new_status = new_status != ID_STATUS_OFFLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
// if we don't want to show status for default station
- if (opt.NoProtoCondition && status != new_status) {
+ if (!opt.NoProtoCondition && status != new_status) {
old_status = status;
status = new_status != ID_STATUS_OFFLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
@@ -181,7 +181,7 @@ static void __cdecl WeatherGetAwayMsgThread(HANDLE hContact) Sleep(100);
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
db_free( &dbv );
}
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index d07af7865b..aa60678ccd 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -47,7 +47,7 @@ int UpdateWeather(HANDLE hContact) // log to netlib log for debug purpose
Netlib_LogfT(hNetlibUser, _T("************************************************************************"));
- int dbres = DBGetContactSettingTString(hContact, WEATHERPROTONAME, "Nick", &dbv);
+ int dbres = db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv);
Netlib_LogfT(hNetlibUser, _T("<-- Start update for station -->"));
@@ -81,19 +81,19 @@ int UpdateWeather(HANDLE hContact) // compare the old condition and determine if the weather had changed
if (opt.UpdateOnlyConditionChanged) { // consider condition change
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "LastCondition", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "LastCondition", &dbv)) {
if (_tcsicmp(winfo.cond, dbv.ptszVal)) Ch = TRUE; // the weather condition is changed
db_free(&dbv);
}
else Ch = TRUE;
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "LastTemperature", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "LastTemperature", &dbv)) {
if (_tcsicmp(winfo.temp, dbv.ptszVal)) Ch = TRUE; // the temperature is changed
db_free(&dbv);
}
else Ch = TRUE;
}
else { // consider update time change
- if ( !DBGetContactSettingTString(hContact, WEATHERPROTONAME, "LastUpdate", &dbv)) {
+ if ( !db_get_ts(hContact, WEATHERPROTONAME, "LastUpdate", &dbv)) {
if (_tcsicmp(winfo.update, dbv.ptszVal)) Ch = TRUE; // the update time is changed
db_free(&dbv);
}
@@ -101,7 +101,7 @@ int UpdateWeather(HANDLE hContact) }
// have weather alert issued?
- dbres = DBGetContactSettingTString(hContact, WEATHERCONDITION, "Alert", &dbv);
+ dbres = db_get_ts(hContact, WEATHERCONDITION, "Alert", &dbv);
if ( !dbres && dbv.ptszVal[0] != 0) {
if (opt.AlertPopup && !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0) && Ch) {
// display alert popup
@@ -167,7 +167,7 @@ int UpdateWeather(HANDLE hContact) if (db_get_b(hContact, WEATHERPROTONAME, "File", 0)) {
// external log
- if ( !DBGetContactSettingTString(hContact,WEATHERPROTONAME, "Log",&dbv)) {
+ if ( !db_get_ts(hContact,WEATHERPROTONAME, "Log",&dbv)) {
// for the option for overwriting the file, delete old file first
if (db_get_b(hContact,WEATHERPROTONAME, "Overwrite",0))
DeleteFile(dbv.ptszVal);
@@ -594,8 +594,7 @@ int GetWeatherData(HANDLE hContact) void CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
// only run if it is not current updating and the auto update option is enabled
- if ( !ThreadRunning && opt.CAutoUpdate && !Miranda_Terminated() &&
- (!opt.NoProtoCondition || status == ID_STATUS_ONLINE))
+ if ( !ThreadRunning && opt.CAutoUpdate && !Miranda_Terminated() && (opt.NoProtoCondition || status == ID_STATUS_ONLINE))
UpdateAll(TRUE, FALSE);
}
@@ -607,7 +606,7 @@ void CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) ThreadRunning = FALSE;
if ( !Miranda_Terminated()) {
- if (opt.StartupUpdate && !opt.NoProtoCondition)
+ if (opt.StartupUpdate)
UpdateAll(FALSE, FALSE);
timerId = SetTimer(NULL, 0, ((int)opt.UpdateTime)*60000, (TIMERPROC)timerProc);
}
|