summaryrefslogtreecommitdiff
path: root/plugins/Weather/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-18 11:49:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-18 11:49:54 +0000
commit878d72910cccf4f84c7cb45bb4c11134920f3166 (patch)
tree251fba89632c389309ff9b2451850aa949efb8d0 /plugins/Weather/src
parent871410044ecbac0d2dd67a7c98f8bcd2df9410eb (diff)
- naming conflict;
- warning fixes; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14988 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Weather/src')
-rw-r--r--plugins/Weather/src/weather_addstn.cpp32
-rw-r--r--plugins/Weather/src/weather_mwin.cpp84
-rw-r--r--plugins/Weather/src/weather_svcs.cpp48
3 files changed, 77 insertions, 87 deletions
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index f8d54ad42e..e8e8dc25c3 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -25,7 +25,7 @@ to the contact list. Contain code for both name and ID search.
#include "stdafx.h"
// variables used for weather_addstn.c
-static int searchId = -1;
+static int sttSearchId = -1;
static TCHAR name1[256];
// ============ ADDING NEW STATION ============
@@ -133,7 +133,7 @@ BOOL CheckSearch() {
// ============ BASIC ID SEARCH ============
-static TCHAR sID[32];
+static TCHAR sttSID[32];
// A timer process for the ID search (threaded)
static void __cdecl BasicSearchTimerProc(LPVOID)
@@ -141,26 +141,26 @@ static void __cdecl BasicSearchTimerProc(LPVOID)
int result;
// search only when it's not current updating weather.
if (CheckSearch())
- result = IDSearch(sID, searchId);
+ result = IDSearch(sttSID, sttSearchId);
// broadcast the search result
- ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)searchId, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId, 0);
// exit the search
- searchId = -1;
+ sttSearchId = -1;
}
// the service function for ID search
// lParam = ID search string
INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
{
- if (searchId != -1) return 0; //only one search at a time
- _tcsncpy(sID, ( TCHAR* )lParam, _countof(sID));
- sID[_countof(sID)-1] = 0;
- searchId = 1;
+ if (sttSearchId != -1) return 0; //only one search at a time
+ _tcsncpy(sttSID, ( TCHAR* )lParam, _countof(sttSID));
+ sttSID[_countof(sttSID)-1] = 0;
+ sttSearchId = 1;
// create a thread for the ID search
mir_forkthread(BasicSearchTimerProc, NULL);
- return searchId;
+ return sttSearchId;
}
// ============ NAME SEARCH ============
@@ -171,13 +171,13 @@ static void __cdecl NameSearchTimerProc(LPVOID)
// search only when it's not current updating weather.
if (CheckSearch())
if (name1[0] != 0)
- NameSearch(name1, searchId); // search nickname field
+ NameSearch(name1, sttSearchId); // search nickname field
// broadcast the result
- ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)searchId, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId, 0);
// exit the search
- searchId = -1;
+ sttSearchId = -1;
}
static INT_PTR CALLBACK WeatherSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
@@ -207,14 +207,14 @@ INT_PTR WeatherCreateAdvancedSearchUI(WPARAM, LPARAM lParam)
// service function for name search
INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
{
- if (searchId != -1) return 0; //only one search at a time
+ if (sttSearchId != -1) return 0; //only one search at a time
- searchId = 1;
+ sttSearchId = 1;
GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
// search for the weather station using a thread
mir_forkthread(NameSearchTimerProc, NULL);
- return searchId;
+ return sttSearchId;
}
// ============ SEARCH FOR A WEATHER STATION USING ID ============
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 4390e86058..b92291fa17 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -41,13 +41,12 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
{
MWinDataType *data = (MWinDataType*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch(msg)
- {
+ switch (msg) {
case WM_CREATE:
data = (MWinDataType*)mir_calloc(sizeof(MWinDataType));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
- data->hContact = (MCONTACT)((LPCREATESTRUCT)lParam)->lpCreateParams;
+ data->hContact = (DWORD_PTR)((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);
@@ -69,14 +68,13 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_MOUSEMOVE:
{
- TRACKMOUSEEVENT tme = {0};
+ TRACKMOUSEEVENT tme = { 0 };
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.hwndTrack = hwnd;
tme.dwFlags = TME_QUERY;
TrackMouseEvent(&tme);
- if (tme.dwFlags == 0)
- {
+ if (tme.dwFlags == 0) {
tme.dwFlags = TME_HOVER | TME_LEAVE;
tme.hwndTrack = hwnd;
tme.dwHoverTime = CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
@@ -88,7 +86,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_MOUSEHOVER:
{
POINT pt;
- CLCINFOTIP ti = {0};
+ CLCINFOTIP ti = { 0 };
GetCursorPos(&pt);
GetWindowRect(hwnd, &ti.rcItem);
@@ -106,7 +104,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
break;
case WM_COMMAND: //Needed by the contact's context menu
- if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU), (LPARAM)data->hContact))
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)data->hContact))
break;
return FALSE;
@@ -117,11 +115,9 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam);
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED)
- {
+ if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED) {
BOOL newava = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0) != 0;
- if (newava != data->haveAvatar)
- {
+ if (newava != data->haveAvatar) {
LONG_PTR style = GetWindowLongPtr(data->hAvt, GWL_STYLE);
data->haveAvatar = newava;
SetWindowLongPtr(data->hAvt, GWL_STYLE, newava ? (style | WS_VISIBLE) : (style & ~WS_VISIBLE));
@@ -139,9 +135,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
{
RECT r, rc;
- if (GetUpdateRect(hwnd, &r, FALSE))
- {
- DBVARIANT dbv = {0};
+ if (GetUpdateRect(hwnd, &r, FALSE)) {
+ DBVARIANT dbv = { 0 };
PAINTSTRUCT ps;
LOGFONT lfnt, lfnt1;
COLORREF fntc, fntc1;
@@ -149,14 +144,12 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
int picSize = opt.AvatarSize;
HICON hIcon = NULL;
- if ( !data->haveAvatar)
- {
+ if (!data->haveAvatar) {
int statusIcon = db_get_w(data->hContact, WEATHERPROTONAME, "Status", 0);
picSize = GetSystemMetrics(SM_CXICON);
hIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon, true);
- if ((INT_PTR)hIcon == CALLSERVICE_NOTFOUND)
- {
+ if ((INT_PTR)hIcon == CALLSERVICE_NOTFOUND) {
picSize = GetSystemMetrics(SM_CXSMICON);
hIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon);
}
@@ -165,7 +158,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
clr = db_get_dw(NULL, WEATHERPROTONAME, "ColorMwinFrame", GetSysColor(COLOR_3DFACE));
{
- FontIDT fntid = {0};
+ FontIDT fntid = { 0 };
mir_tstrcpy(fntid.group, _T(WEATHERPROTONAME));
mir_tstrcpy(fntid.name, LPGENT("Frame Font"));
fntc = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt);
@@ -180,7 +173,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
HDC hdc = BeginPaint(hwnd, &ps);
- if ( ServiceExists(MS_SKIN_DRAWGLYPH)) {
+ if (ServiceExists(MS_SKIN_DRAWGLYPH)) {
SKINDRAWREQUEST rq;
memset(&rq, 0, sizeof(rq));
rq.hDC = hdc;
@@ -197,16 +190,16 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
DeleteObject(hBkgBrush);
}
- if ( !data->haveAvatar)
+ if (!data->haveAvatar)
DrawIconEx(hdc, 1, 1, hIcon, 0, 0, 0, NULL, DI_NORMAL);
SetBkMode(hdc, TRANSPARENT);
HFONT hfnt = CreateFontIndirect(&lfnt1);
- HFONT hfntold = ( HFONT )SelectObject(hdc, hfnt);
+ HFONT hfntold = (HFONT)SelectObject(hdc, hfnt);
SIZE fontSize;
- TCHAR *nick = ( TCHAR* )pcli->pfnGetContactDisplayName(data->hContact, 0);
+ TCHAR *nick = (TCHAR*)pcli->pfnGetContactDisplayName(data->hContact, 0);
GetTextExtentPoint32(hdc, _T("|"), 1, &fontSize);
@@ -221,16 +214,15 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
SelectObject(hdc, hfntold);
DeleteObject(hfnt);
- if (dbv.pszVal)
- {
- HFONT hfnt = CreateFontIndirect(&lfnt);
- HFONT hfntold = ( HFONT )SelectObject(hdc, hfnt);
+ if (dbv.pszVal) {
+ HFONT hFont = CreateFontIndirect(&lfnt);
+ HFONT hFontOld = (HFONT)SelectObject(hdc, hFont);
SetTextColor(hdc, fntc);
DrawText(hdc, dbv.ptszVal, -1, &rc, DT_LEFT | DT_EXPANDTABS);
- SelectObject(hdc, hfntold);
- DeleteObject(hfnt);
+ SelectObject(hdc, hFontOld);
+ DeleteObject(hFont);
}
EndPaint(hwnd, &ps);
IcoLib_ReleaseIcon(hIcon);
@@ -254,13 +246,13 @@ static void addWindow(MCONTACT hContact)
mir_sntprintf(winname, _countof(winname), _T("Weather: %s"), dbv.ptszVal);
db_free(&dbv);
- HWND hWnd = CreateWindow( _T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE,
+ HWND hWnd = CreateWindow(_T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE,
0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, (void*)hContact);
WindowList_Add(hMwinWindowList, hWnd, hContact);
- CLISTFrame Frame = {0};
+ CLISTFrame Frame = { 0 };
Frame.tname = winname;
- Frame.hIcon = LoadIconEx("main",FALSE);
+ Frame.hIcon = LoadIconEx("main", FALSE);
Frame.cbSize = sizeof(Frame);
Frame.hWnd = hWnd;
Frame.align = alBottom;
@@ -302,7 +294,7 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM)
}
-int BuildContactMenu(WPARAM wparam,LPARAM)
+int BuildContactMenu(WPARAM wparam, LPARAM)
{
int flags = db_get_dw((MCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0;
Menu_ModifyItem(hMwinMenu, NULL, INVALID_HANDLE_VALUE, flags);
@@ -319,25 +311,25 @@ int RedrawFrame(WPARAM, LPARAM)
void InitMwin(void)
{
- if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
return;
hMwinWindowList = WindowList_Create();
WNDCLASS wndclass;
- wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = wndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+ wndclass.lpfnWndProc = wndProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInst;
+ wndclass.hIcon = NULL;
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = _T("WeatherFrame");
RegisterClass(&wndclass);
- ColourIDT colourid = {0};
+ ColourIDT colourid = { 0 };
colourid.cbSize = sizeof(ColourIDT);
mir_strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME);
mir_strcpy(colourid.setting, "ColorMwinFrame");
@@ -346,7 +338,7 @@ void InitMwin(void)
colourid.defcolour = GetSysColor(COLOR_3DFACE);
ColourRegisterT(&colourid);
- FontIDT fontid = {0};
+ FontIDT fontid = { 0 };
fontid.cbSize = sizeof(FontIDT);
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
mir_strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME);
@@ -383,7 +375,7 @@ void DestroyMwin(void)
if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
}
- UnregisterClass( _T("WeatherFrame"), hInst);
+ UnregisterClass(_T("WeatherFrame"), hInst);
WindowList_Destroy(hMwinWindowList);
UnhookEvent(hFontHook);
}
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index 09af852326..f1a027ae19 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -55,7 +55,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
{
INT_PTR ret = 0;
- switch(wParam) {
+ switch (wParam) {
case PFLAGNUM_1:
// support search and visible list
ret = PF1_BASICSEARCH | PF1_ADDSEARCHRES | PF1_EXTSEARCH | PF1_VISLIST | PF1_MODEMSGRECV;
@@ -63,17 +63,17 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
case PFLAGNUM_2:
ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND |
- PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
break;
case PFLAGNUM_4:
ret = PF4_AVATARS | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_FORCEADDED |
- PF4_FORCEAUTH;
+ PF4_FORCEAUTH;
break;
case PFLAGNUM_5: /* this is PFLAGNUM_5 change when alpha SDK is released */
ret = PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND |
- PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
break;
case PFLAG_UNIQUEIDTEXT:
@@ -88,10 +88,10 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
}
// protocol service function to get weather protocol name
-INT_PTR WeatherGetName(WPARAM wParam,LPARAM lParam)
+INT_PTR WeatherGetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam,WEATHERPROTOTEXT,wParam-1);
- *((char*)lParam + wParam-1) = 0;
+ strncpy((char*)lParam, WEATHERPROTOTEXT, wParam - 1);
+ *((char*)lParam + wParam - 1) = 0;
return 0;
}
@@ -102,7 +102,7 @@ INT_PTR WeatherGetStatus(WPARAM, LPARAM)
}
// protocol service function to get the icon of the protocol
-INT_PTR WeatherLoadIcon(WPARAM wParam,LPARAM)
+INT_PTR WeatherLoadIcon(WPARAM wParam, LPARAM)
{
return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx("main", FALSE)) : 0;
}
@@ -110,14 +110,14 @@ INT_PTR WeatherLoadIcon(WPARAM wParam,LPARAM)
static void __cdecl AckThreadProc(HANDLE param)
{
Sleep(100);
- ProtoBroadcastAck(WEATHERPROTONAME, (MCONTACT)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, (DWORD_PTR)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
// nothing to do here because weather proto do not need to retrieve contact info form network
// so just return a 0
-INT_PTR WeatherGetInfo(WPARAM,LPARAM lParam)
+INT_PTR WeatherGetInfo(WPARAM, LPARAM lParam)
{
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *)lParam;
mir_forkthread(AckThreadProc, (void*)ccs->hContact);
return 0;
}
@@ -129,7 +129,6 @@ static const WORD statusValue[] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN, PC
INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
{
TCHAR szSearchPath[MAX_PATH], *chop;
- WORD status;
unsigned i;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
@@ -139,9 +138,9 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
if (chop) *chop = '\0';
else szSearchPath[0] = 0;
- status = (WORD)db_get_w(pai->hContact, WEATHERPROTONAME, "StatusIcon",0);
- for (i=0; i<10; i++)
- if (statusValue[i] == status)
+ int iStatus = db_get_w(pai->hContact, WEATHERPROTONAME, "StatusIcon", 0);
+ for (i = 0; i < 10; i++)
+ if (statusValue[i] == iStatus)
break;
if (i >= 10)
@@ -149,12 +148,12 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
pai->format = PA_FORMAT_PNG;
mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]);
- if ( _taccess(pai->filename, 4) == 0)
+ if (_taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_GIF;
mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]);
- if ( _taccess(pai->filename, 4) == 0)
+ if (_taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_UNKNOWN;
@@ -162,7 +161,6 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
return GAIR_NOAVATAR;
}
-
void AvatarDownloaded(MCONTACT hContact)
{
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -174,17 +172,17 @@ void AvatarDownloaded(MCONTACT hContact)
ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
-
-static void __cdecl WeatherGetAwayMsgThread(void *hContact)
+static void __cdecl WeatherGetAwayMsgThread(void *arg)
{
Sleep(100);
+ MCONTACT hContact = (DWORD_PTR)arg;
DBVARIANT dbv;
- if (!db_get_ts((MCONTACT)hContact, "CList", "StatusMsg", &dbv)) {
- ProtoBroadcastAck(WEATHERPROTONAME, (MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
- db_free( &dbv );
+ if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
}
- else ProtoBroadcastAck(WEATHERPROTONAME, (MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ else ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
static INT_PTR WeatherGetAwayMsg(WPARAM, LPARAM lParam)
@@ -251,7 +249,7 @@ void UpdatePopupMenu(BOOL State)
}
// update the weather auto-update menu item when click on it
-INT_PTR EnableDisableCmd(WPARAM wParam,LPARAM lParam)
+INT_PTR EnableDisableCmd(WPARAM wParam, LPARAM lParam)
{
UpdateMenu(wParam == TRUE ? (BOOL)lParam : !opt.CAutoUpdate);
return 0;