diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-09 21:40:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-09 21:40:22 +0000 |
commit | 3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c (patch) | |
tree | efee912ee654baafeb98efcd117921db6b7489bc /plugins/Weather/src/weather_contacts.cpp | |
parent | bcb27264ba737778e5d3edad36088bacf74f0236 (diff) |
- the kernel filters out contacts by proto names much faster than a plugin;
- database cycles simplified
git-svn-id: http://svn.miranda-ng.org/main/trunk@4404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Weather/src/weather_contacts.cpp')
-rw-r--r-- | plugins/Weather/src/weather_contacts.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index a52727f002..2cc4187bf1 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -448,26 +448,24 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam) // now the default station is deleted, try to get a new one
// start looking for other weather stations
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (IsMyContact(hContact)) {
- 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;
+ for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ 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 ( !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);
- 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);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
- }
- db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
- return 0; // exit this function quickly
+ MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
- db_free(&dbv);
+ db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ return 0; // exit this function quickly
}
+ db_free(&dbv);
}
}
// got here if no more weather station left
|