summaryrefslogtreecommitdiff
path: root/plugins/Weather/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Weather/src')
-rw-r--r--plugins/Weather/src/weather.h30
-rw-r--r--plugins/Weather/src/weather_addstn.cpp4
-rw-r--r--plugins/Weather/src/weather_contacts.cpp30
-rw-r--r--plugins/Weather/src/weather_conv.cpp2
-rw-r--r--plugins/Weather/src/weather_data.cpp14
-rw-r--r--plugins/Weather/src/weather_mwin.cpp22
-rw-r--r--plugins/Weather/src/weather_popup.cpp33
-rw-r--r--plugins/Weather/src/weather_svcs.cpp12
-rw-r--r--plugins/Weather/src/weather_update.cpp25
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp18
10 files changed, 91 insertions, 99 deletions
diff --git a/plugins/Weather/src/weather.h b/plugins/Weather/src/weather.h
index 0130a8e383..27fd3f82c7 100644
--- a/plugins/Weather/src/weather.h
+++ b/plugins/Weather/src/weather.h
@@ -226,7 +226,7 @@ struct MYOPTIONS
// other misc stuff
TCHAR Default[64];
- HANDLE DefStn;
+ HCONTACT DefStn;
};
void DestroyOptions(void);
@@ -234,7 +234,7 @@ void DestroyOptions(void);
//============ STRUCT USED TO MAKE AN UPDATE LIST ============
struct WCONTACTLIST {
- HANDLE hContact;
+ HCONTACT hContact;
struct WCONTACTLIST *next;
};
@@ -395,7 +395,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
int ContactDeleted(WPARAM wParam,LPARAM lParam);
-BOOL IsMyContact(HANDLE hContact);
+BOOL IsMyContact(HCONTACT hContact);
// functions in weather_conv.c
BOOL is_number(char *s);
@@ -422,10 +422,10 @@ void GetID(TCHAR *pszID);
TCHAR *GetError(int code);
// functions in weather_data.c
-void GetStationID(HANDLE hContact, TCHAR* id, size_t idlen);
-WEATHERINFO LoadWeatherInfo(HANDLE Change);
-int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv);
-int DBGetStaticString(HANDLE hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len);
+void GetStationID(HCONTACT hContact, TCHAR* id, size_t idlen);
+WEATHERINFO LoadWeatherInfo(HCONTACT Change);
+int DBGetData(HCONTACT hContact, char *setting, DBVARIANT *dbv);
+int DBGetStaticString(HCONTACT hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len);
void EraseAllInfo(void);
@@ -438,7 +438,7 @@ void wSetData(WCHAR **Data, const WCHAR *Value);
void wfree(char **Data);
void wfree(WCHAR **Data);
-void DBDataManage(HANDLE hContact, WORD Mode, WPARAM wParam, LPARAM lParam);
+void DBDataManage(HCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM lParam);
// functions in weather_http.c
int InternetDownloadFile (char *szUrl, char *cookie, TCHAR** szData);
@@ -498,12 +498,12 @@ INT_PTR WeatherLoadIcon(WPARAM wParam, LPARAM lParam);
void UpdateMenu(BOOL State);
void UpdatePopupMenu(BOOL State);
void AddMenuItems();
-void AvatarDownloaded(HANDLE hContact);
+void AvatarDownloaded(HCONTACT hContact);
// functions in weather_update.c
-int UpdateWeather(HANDLE hContact);
+int UpdateWeather(HCONTACT hContact);
-int RetrieveWeather(HANDLE hContact, WEATHERINFO *winfo);
+int RetrieveWeather(HCONTACT hContact, WEATHERINFO *winfo);
void UpdateAll(BOOL AutoUpdate, BOOL RemoveOld);
void UpdateThreadProc(LPVOID hWnd);
@@ -512,7 +512,7 @@ INT_PTR UpdateAllInfo(WPARAM wParam,LPARAM lParam);
INT_PTR UpdateSingleRemove(WPARAM wParam,LPARAM lParam);
INT_PTR UpdateAllRemove(WPARAM wParam,LPARAM lParam);
-int GetWeatherData(HANDLE hContact);
+int GetWeatherData(HCONTACT hContact);
void CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
void CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
@@ -522,8 +522,8 @@ void InitMwin(void);
void DestroyMwin(void);
INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM lParam);
int BuildContactMenu(WPARAM wparam, LPARAM lparam);
-void UpdateMwinData(HANDLE hContact);
-void removeWindow(HANDLE hContact);
+void UpdateMwinData(HCONTACT hContact);
+void removeWindow(HCONTACT hContact);
// functions in weather_userinfo.c
int UserInfoInit(WPARAM wParam, LPARAM lParam);
@@ -535,7 +535,7 @@ INT_PTR CALLBACK DlgProcINIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int BriefInfo(WPARAM wParam, LPARAM lParam);
INT_PTR BriefInfoSvc(WPARAM wParam, LPARAM lParam);
-void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact);
+void LoadBriefInfoText(HWND hwndDlg, HCONTACT hContact);
INT_PTR CALLBACK DlgProcBrief(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void InitIcons(void);
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 25e95846e6..a587b471a6 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -40,7 +40,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
return 0;
// search for existing contact
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
// check if it is a weather contact
if ( IsMyContact(hContact)) {
DBVARIANT dbv;
@@ -64,7 +64,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
// if contact with the same ID was not found, add it
if (psr->cbSize < sizeof(PROTOSEARCHRESULT)) return 0;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ HCONTACT hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)WEATHERPROTONAME);
// suppress online notification for the new contact
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp
index 9f93bd6a1a..13758addac 100644
--- a/plugins/Weather/src/weather_contacts.cpp
+++ b/plugins/Weather/src/weather_contacts.cpp
@@ -43,7 +43,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam)
{
// see if the log path is set
DBVARIANT dbv;
- if ( !db_get_ts((HANDLE)wParam, WEATHERPROTONAME, "Log", &dbv)) {
+ if (!db_get_ts((HCONTACT)wParam, WEATHERPROTONAME, "Log", &dbv)) {
if (dbv.pszVal[0] != 0)
ShellExecute((HWND)lParam, _T("open"), dbv.ptszVal, _T(""), _T(""), SW_SHOW);
db_free(&dbv);
@@ -59,10 +59,10 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam)
INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam)
{
TCHAR id[256], loc2[256];
- GetStationID((HANDLE)wParam, id, SIZEOF(id));
+ GetStationID((HCONTACT)wParam, id, SIZEOF(id));
if (id[0] != 0) {
// check if the complte forecast URL is set. If it is not, display warning and quit
- if ( DBGetStaticString((HANDLE)wParam, WEATHERPROTONAME, "InfoURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
+ if (DBGetStaticString((HCONTACT)wParam, WEATHERPROTONAME, "InfoURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
MessageBox(NULL, TranslateT("The URL for complete forcast have not been set. You can set it from the Edit Settings dialog."),
TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
@@ -78,10 +78,10 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam)
INT_PTR WeatherMap(WPARAM wParam, LPARAM lParam)
{
TCHAR id[256], loc2[256];
- GetStationID((HANDLE)wParam, id, SIZEOF(id));
+ GetStationID((HCONTACT)wParam, id, SIZEOF(id));
if (id[0] != 0) {
// check if the weather map URL is set. If it is not, display warning and quit
- if ( DBGetStaticString((HANDLE)wParam, WEATHERPROTONAME, "MapURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
+ if (DBGetStaticString((HCONTACT)wParam, WEATHERPROTONAME, "MapURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
MessageBox(NULL, TranslateT("The URL for weather map have not been set. You can set it from the Edit Settings dialog."), TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
@@ -99,7 +99,7 @@ INT_PTR WeatherMap(WPARAM wParam, LPARAM lParam)
// wParam = current contact
INT_PTR EditSettings(WPARAM wParam, LPARAM lParam)
{
- HWND hEditDlg = WindowList_Find(hWindowList, (HANDLE)wParam);
+ HWND hEditDlg = WindowList_Find(hWindowList, (HCONTACT)wParam);
// search the dialog list to prevent multiple instance of dialog for the same contact
if (hEditDlg != NULL) {
@@ -109,7 +109,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM lParam)
}
else {
// if the dialog box is not opened, open a new one
- if (IsMyContact((HANDLE)wParam))
+ if (IsMyContact((HCONTACT)wParam))
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), NULL, DlgProcChange, (LPARAM)wParam);
}
@@ -118,7 +118,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM lParam)
typedef struct
{
- HANDLE hContact;
+ HCONTACT hContact;
HICON hRename;
HICON hUserDetail;
HICON hFile;
@@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
TCHAR str[256], str2[256], city[256], filter[256], *pfilter, *chop;
char loc[512];
OPENFILENAME ofn; // common dialog box structure
- HANDLE hContact;
+ HCONTACT hContact;
WIDATA *sData;
CntSetWndDataType *wndData = NULL;
@@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
TranslateDialogDefault(hwndDlg);
wndData = ( CntSetWndDataType* )mir_alloc(sizeof(CntSetWndDataType));
- wndData->hContact = hContact = (HANDLE)lParam;
+ wndData->hContact = hContact = (HCONTACT)lParam;
wndData->hRename = LoadSkinnedIcon(SKINICON_OTHER_RENAME);
wndData->hUserDetail = LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS);
wndData->hFile = LoadSkinnedIcon(SKINICON_EVENT_FILE);
@@ -430,14 +430,14 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
// wParam = deleted contact
int ContactDeleted(WPARAM wParam, LPARAM lParam)
{
- if ( !IsMyContact((HANDLE)wParam))
+ if (!IsMyContact((HCONTACT)wParam))
return 0;
- removeWindow((HANDLE)wParam);
+ removeWindow((HCONTACT)wParam);
// exit this function if it is not default station
DBVARIANT dbv;
- if ( !db_get_ts((HANDLE)wParam, WEATHERPROTONAME, "ID", &dbv)) {
+ if (!db_get_ts((HCONTACT)wParam, WEATHERPROTONAME, "ID", &dbv)) {
if ( _tcscmp(dbv.ptszVal, opt.Default)) {
db_free(&dbv);
return 0;
@@ -448,7 +448,7 @@ 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(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ for (HCONTACT 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
@@ -475,7 +475,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam)
return 0;
}
-BOOL IsMyContact(HANDLE hContact)
+BOOL IsMyContact(HCONTACT hContact)
{
const char* szProto = GetContactProto(hContact);
return szProto != NULL && strcmp(WEATHERPROTONAME, szProto) == 0;
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp
index c986ab7530..7e18e3f749 100644
--- a/plugins/Weather/src/weather_conv.cpp
+++ b/plugins/Weather/src/weather_conv.cpp
@@ -572,7 +572,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str)
TCHAR svcReturnText[MAX_TEXT_SIZE];
INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam)
{
- WEATHERINFO winfo = LoadWeatherInfo((HANDLE)wParam);
+ WEATHERINFO winfo = LoadWeatherInfo((HCONTACT)wParam);
return (INT_PTR)GetDisplay(&winfo, (TCHAR*)lParam, svcReturnText);
}
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp
index 4f5aaaa0ad..288b415509 100644
--- a/plugins/Weather/src/weather_data.cpp
+++ b/plugins/Weather/src/weather_data.cpp
@@ -30,7 +30,7 @@ saving individual weather data for a weather contact.
// hContact = the current contact handle
// return value = the string for station ID
-void GetStationID(HANDLE hContact, TCHAR* id, size_t idlen)
+void GetStationID(HCONTACT hContact, TCHAR* id, size_t idlen)
{
// accessing the database
if (DBGetStaticString(hContact, WEATHERPROTONAME, "ID", id, idlen))
@@ -40,7 +40,7 @@ void GetStationID(HANDLE hContact, TCHAR* id, size_t idlen)
// initialize weather info by loading values from database
// hContact = current contact handle
// return value = the current weather information in WEATHERINFO struct
-WEATHERINFO LoadWeatherInfo(HANDLE hContact)
+WEATHERINFO LoadWeatherInfo(HCONTACT hContact)
{
// obtaining values from the DB
// assuming station ID must exist at all time, but others does not have to
@@ -86,7 +86,7 @@ WEATHERINFO LoadWeatherInfo(HANDLE hContact)
// getting weather setting from database
// return 0 on success
-int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv)
+int DBGetData(HCONTACT hContact, char *setting, DBVARIANT *dbv)
{
if ( db_get_ts(hContact, WEATHERCONDITION, setting, dbv)) {
size_t len = strlen(setting) + 1;
@@ -100,7 +100,7 @@ int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv)
return 0;
}
-int DBGetStaticString(HANDLE hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len)
+int DBGetStaticString(HCONTACT hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len)
{
DBVARIANT dbv;
if ( db_get_ts( hContact, szModule, valueName, &dbv ))
@@ -121,10 +121,10 @@ void EraseAllInfo()
{
TCHAR str[255];
int ContactCount = 0;
- HANDLE LastContact = NULL;
+ HCONTACT LastContact = NULL;
DBVARIANT dbv;
// loop through all contacts
- for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
db_set_w(hContact,WEATHERPROTONAME, "Status",ID_STATUS_OFFLINE);
db_set_w(hContact,WEATHERPROTONAME, "StatusIcon",ID_STATUS_OFFLINE);
db_unset(hContact, "CList", "MyHandle");
@@ -424,7 +424,7 @@ int GetWeatherDataFromDB(const char *szSetting, LPARAM lparam)
// remove or display the weather information for a contact
// hContact - the contact in which the info is going to be removed
-void DBDataManage(HANDLE hContact, WORD Mode, WPARAM wParam, LPARAM lParam)
+void DBDataManage(HCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM lParam)
{
LIST<char> arSettings(10);
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 6ccbfb19f0..8444644f7f 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -30,7 +30,7 @@ HGENMENU hMwinMenu;
typedef struct
{
- HANDLE hContact;
+ HCONTACT hContact;
HWND hAvt;
BOOL haveAvatar;
} MWinDataType;
@@ -47,7 +47,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
data = (MWinDataType*)mir_calloc(sizeof(MWinDataType));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
- data->hContact = (HANDLE)((LPCREATESTRUCT)lParam)->lpCreateParams;
+ data->hContact = (HCONTACT)((LPCREATESTRUCT)lParam)->lpCreateParams;
data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD,
0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, NULL, hInst, 0);
if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
@@ -246,7 +246,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
return(TRUE);
}
-static void addWindow(HANDLE hContact)
+static void addWindow(HCONTACT hContact)
{
DBVARIANT dbv;
db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv);
@@ -273,7 +273,7 @@ static void addWindow(HANDLE hContact)
db_set_b(hContact, "CList", "Hidden", TRUE);
}
-void removeWindow(HANDLE hContact)
+void removeWindow(HCONTACT hContact)
{
DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0);
@@ -284,7 +284,7 @@ void removeWindow(HANDLE hContact)
db_unset(hContact, "CList", "Hidden");
}
-void UpdateMwinData(HANDLE hContact)
+void UpdateMwinData(HCONTACT hContact)
{
HWND hwnd = WindowList_Find(hMwinWindowList, hContact);
if (hwnd != NULL)
@@ -294,11 +294,11 @@ void UpdateMwinData(HANDLE hContact)
INT_PTR Mwin_MenuClicked(WPARAM wParam,LPARAM lParam)
{
- BOOL addwnd = WindowList_Find(hMwinWindowList, (HANDLE)wParam) == NULL;
+ BOOL addwnd = WindowList_Find(hMwinWindowList, (HCONTACT)wParam) == NULL;
if (addwnd)
- addWindow((HANDLE)wParam);
+ addWindow((HCONTACT)wParam);
else
- removeWindow((HANDLE)wParam);
+ removeWindow((HCONTACT)wParam);
return 0;
}
@@ -307,7 +307,7 @@ int BuildContactMenu(WPARAM wparam,LPARAM lparam)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS |
- (db_get_dw((HANDLE)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0);
+ (db_get_dw((HCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0);
Menu_ModifyItem(hMwinMenu, &mi);
return 0;
}
@@ -372,7 +372,7 @@ void InitMwin(void)
strcpy(fontid.prefix, "fnt1");
FontRegisterT(&fontid);
- for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME))
+ for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME))
if (db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0))
addWindow(hContact);
@@ -381,7 +381,7 @@ void InitMwin(void)
void DestroyMwin(void)
{
- for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0);
if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index d8396532fd..27152b0d9b 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -36,26 +36,17 @@ int WeatherPopup(WPARAM wParam, LPARAM lParam)
{
// determine if the popup should display or not
if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) &&
- !db_get_b((HANDLE)wParam, WEATHERPROTONAME, "DPopUp", 0))
+ !db_get_b((HCONTACT)wParam, WEATHERPROTONAME, "DPopUp", 0))
{
- POPUPDATAT ppd = {0};
- WEATHERINFO winfo;
-
- // setup the popup
- ppd.lchContact = (HANDLE)wParam;
-// if ((HANDLE)wParam != NULL) { // for actual contact
- winfo = LoadWeatherInfo((HANDLE)wParam);
- ppd.PluginData = ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, winfo.status);
- GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName);
- GetDisplay(&winfo, opt.pText, ppd.lptzText);
- ppd.PluginWindowProc = PopupDlgProc;
-// }
-// else { // for preview
-// ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, ONLINE);
-// strcpy(ppd.lpzContactName, Translate("This is the name of the city"));
-// strcpy(ppd.lpzText, Translate("Here is a short weather description"));
-// ppd.PluginWindowProc = NULL;
-// }
+ WEATHERINFO winfo = LoadWeatherInfo((HCONTACT)wParam);
+
+ // setup the popup
+ POPUPDATAT ppd = { 0 };
+ ppd.lchContact = (HCONTACT)wParam;
+ ppd.PluginData = ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, winfo.status);
+ GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName);
+ GetDisplay(&winfo, opt.pText, ppd.lptzText);
+ ppd.PluginWindowProc = PopupDlgProc;
ppd.colorBack = (opt.UseWinColors)?GetSysColor(COLOR_BTNFACE):opt.BGColour;
ppd.colorText = (opt.UseWinColors)?GetSysColor(COLOR_WINDOWTEXT):opt.TextColour;
ppd.iSeconds = opt.pDelay;
@@ -129,7 +120,7 @@ int WPShowMessage(TCHAR* lpzText, WORD kind)
LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
DWORD ID = 0;
- HANDLE hContact;
+ HCONTACT hContact;
hContact = PUGetContact(hWnd);
switch(message) {
@@ -257,7 +248,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
HMENU hMenu, hMenu1;
RECT pos;
HWND button;
- HANDLE hContact;
+ HCONTACT hContact;
switch (msg) {
case WM_INITDIALOG:
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index a398b748b9..6362a9c65d 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -110,7 +110,7 @@ INT_PTR WeatherLoadIcon(WPARAM wParam,LPARAM lParam)
static void __cdecl AckThreadProc(HANDLE param)
{
Sleep(100);
- ProtoBroadcastAck(WEATHERPROTONAME, param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, (HCONTACT)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
// nothing to do here because weather proto do not need to retrieve contact info form network
@@ -163,7 +163,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
-void AvatarDownloaded(HANDLE hContact)
+void AvatarDownloaded(HCONTACT hContact)
{
PROTO_AVATAR_INFORMATIONT AI = {0};
AI.cbSize = sizeof(AI);
@@ -176,16 +176,16 @@ void AvatarDownloaded(HANDLE hContact)
}
-static void __cdecl WeatherGetAwayMsgThread(HANDLE hContact)
+static void __cdecl WeatherGetAwayMsgThread(void *hContact)
{
Sleep(100);
DBVARIANT dbv;
- if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
- ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
+ if (!db_get_ts((HCONTACT)hContact, "CList", "StatusMsg", &dbv)) {
+ ProtoBroadcastAck(WEATHERPROTONAME, (HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
db_free( &dbv );
}
- else ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ else ProtoBroadcastAck(WEATHERPROTONAME, (HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
static INT_PTR WeatherGetAwayMsg(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index ace0423881..a951d5980b 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -34,7 +34,7 @@ UPDATELIST *UpdateListTail;
// retrieve weather info and display / log them
// hContact = current contact
-int UpdateWeather(HANDLE hContact)
+int UpdateWeather(HCONTACT hContact)
{
TCHAR str[256], str2[MAX_TEXT_SIZE];
DBVARIANT dbv;
@@ -219,7 +219,7 @@ int UpdateWeather(HANDLE hContact)
// a linked list queue for updating weather station
// this function add a weather contact to the end of queue for update
// hContact = current contact
-void UpdateListAdd(HANDLE hContact)
+void UpdateListAdd(HCONTACT hContact)
{
UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST));
newItem->hContact = hContact;
@@ -236,9 +236,9 @@ void UpdateListAdd(HANDLE hContact)
// get the first item from the update queue and remove it from the queue
// return value = the contact for next update
-HANDLE UpdateGetFirst()
+HCONTACT UpdateGetFirst()
{
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
WaitForSingleObject(hUpdateMutex, INFINITE);
@@ -283,9 +283,10 @@ void DestroyUpdateList(void)
void UpdateAll(BOOL AutoUpdate, BOOL RemoveData)
{
// add all weather contact to the update queue list
- for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME))
+ for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME))
if ( !db_get_b(hContact,WEATHERPROTONAME, "AutoUpdate",FALSE) || !AutoUpdate) {
- if (RemoveData) DBDataManage((HANDLE)hContact, WDBM_REMOVE, 0, 0);
+ if (RemoveData)
+ DBDataManage((HCONTACT)hContact, WDBM_REMOVE, 0, 0);
UpdateListAdd(hContact);
}
@@ -299,9 +300,9 @@ void UpdateAll(BOOL AutoUpdate, BOOL RemoveData)
// wParam = handle for the weather station that is going to be updated
INT_PTR UpdateSingleStation(WPARAM wParam, LPARAM lParam)
{
- if (IsMyContact((HANDLE)wParam)) {
+ if (IsMyContact((HCONTACT)wParam)) {
// add the station to the end of the update queue
- UpdateListAdd((HANDLE)wParam);
+ UpdateListAdd((HCONTACT)wParam);
// if it is not updating, then start the update thread process
// if it is updating, the stations just added to the queue will get
@@ -317,10 +318,10 @@ INT_PTR UpdateSingleStation(WPARAM wParam, LPARAM lParam)
// wParam = handle for the weather station that is going to be updated
INT_PTR UpdateSingleRemove(WPARAM wParam, LPARAM lParam)
{
- if (IsMyContact((HANDLE)wParam)) {
+ if (IsMyContact((HCONTACT)wParam)) {
// add the station to the end of the update queue, and also remove old data
- DBDataManage((HANDLE)wParam, WDBM_REMOVE, 0, 0);
- UpdateListAdd((HANDLE)wParam);
+ DBDataManage((HCONTACT)wParam, WDBM_REMOVE, 0, 0);
+ UpdateListAdd((HCONTACT)wParam);
// if it is not updating, then start the update thread process
// if it is updating, the stations just added to the queue will get updated by the already-running process
@@ -372,7 +373,7 @@ INT_PTR UpdateAllRemove(WPARAM wParam,LPARAM lParam) {
// getting weather data and save them into the database
// hContact = the contact to get the data
-int GetWeatherData(HANDLE hContact)
+int GetWeatherData(HCONTACT hContact)
{
// get eacnh part of the id's
TCHAR id[256];
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index 955b46639b..827badd085 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -46,7 +46,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam)
}
else {
// check if it is a weather contact
- if (IsMyContact((HANDLE)lParam)) {
+ if (IsMyContact((HCONTACT)lParam)) {
// register the contact info page
odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
odp.pfnDlgProc = DlgProcUIPage;
@@ -64,16 +64,16 @@ INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
WEATHERINFO w;
TCHAR str[MAX_TEXT_SIZE];
- HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SendMessage(GetDlgItem(hwndDlg,IDC_MOREDETAIL), BUTTONSETASFLATBTN, TRUE, 0);
// save the contact handle for later use
- hContact = (HANDLE)lParam;
+ hContact = (HCONTACT)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
// load weather info for the contact
- w = LoadWeatherInfo((HANDLE)lParam);
+ w = LoadWeatherInfo((HCONTACT)lParam);
SetDlgItemText(hwndDlg, IDC_INFO1, GetDisplay(&w, TranslateT("Current condition for %n"), str));
SendDlgItemMessage(hwndDlg, IDC_INFOICON, STM_SETICON,
@@ -158,12 +158,12 @@ static int BriefDlgResizer(HWND hwnd, LPARAM lParam, UTILRESIZECONTROL *urc)
INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static const unsigned tabstops = 48;
- HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
// save the contact handle for later use
- hContact = (HANDLE)lParam;
+ hContact = (HCONTACT)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
SendDlgItemMessage(hwndDlg, IDC_MTEXT, EM_AUTOURLDETECT, (WPARAM) TRUE, 0);
@@ -327,7 +327,7 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
// set the title of the dialog and on the which rectangle
// also load brief info into message box
-void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact)
+void LoadBriefInfoText(HWND hwndDlg, HCONTACT hContact)
{
WEATHERINFO winfo;
TCHAR str[4096], str2[4096];
@@ -354,8 +354,8 @@ void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact)
int BriefInfo(WPARAM wParam, LPARAM lParam)
{
// make sure that the contact is actually a weather one
- if (IsMyContact((HANDLE)wParam)) {
- HWND hMoreDataDlg = WindowList_Find(hDataWindowList,(HANDLE)wParam);
+ if (IsMyContact((HCONTACT)wParam)) {
+ HWND hMoreDataDlg = WindowList_Find(hDataWindowList, (HCONTACT)wParam);
if (hMoreDataDlg != NULL) {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);