summaryrefslogtreecommitdiff
path: root/plugins/SeenPlugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SeenPlugin/src')
-rw-r--r--plugins/SeenPlugin/src/history.cpp65
-rw-r--r--plugins/SeenPlugin/src/main.cpp29
-rw-r--r--plugins/SeenPlugin/src/menu.cpp1
-rw-r--r--plugins/SeenPlugin/src/missed.cpp4
-rw-r--r--plugins/SeenPlugin/src/options.cpp252
-rw-r--r--plugins/SeenPlugin/src/seen.h1
-rw-r--r--plugins/SeenPlugin/src/userinfo.cpp4
-rw-r--r--plugins/SeenPlugin/src/utils.cpp10
8 files changed, 170 insertions, 196 deletions
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp
index 289fe676b4..ffb26a26c2 100644
--- a/plugins/SeenPlugin/src/history.cpp
+++ b/plugins/SeenPlugin/src/history.cpp
@@ -24,7 +24,6 @@ Last change by : $Author: y_b $
*/
#include "seen.h"
-
extern HINSTANCE hInstance;
static HANDLE hWindowList;
@@ -40,22 +39,24 @@ char* BuildSetting(int historyLast) {
void HistoryWrite(HANDLE hContact)
{
- short historyFirst, historyLast, historyMax;
- DBVARIANT dbv;
-
- historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10);
- if (historyMax < 0) historyMax=0; else if (historyMax > 99) historyMax = 99;
+ int historyMax = db_get_w(NULL, S_MOD, "HistoryMax", 10);
+ if (historyMax < 0)
+ historyMax=0;
+ else if (historyMax > 99)
+ historyMax = 99;
if (historyMax == 0)
return;
- historyFirst = db_get_w(hContact, S_MOD, "HistoryFirst", 0);
+ int historyFirst = db_get_w(hContact, S_MOD, "HistoryFirst", 0);
if (historyFirst >= historyMax)
historyFirst = 0;
- historyLast = db_get_w(hContact, S_MOD, "HistoryLast", 0);
+
+ int historyLast = db_get_w(hContact, S_MOD, "HistoryLast", 0);
if (historyLast >= historyMax)
historyLast = historyMax-1;
TCHAR *ptszString;
+ DBVARIANT dbv;
if ( !DBGetContactSettingTString(NULL, S_MOD, "HistoryStamp", &dbv)) {
ptszString = ParseString(dbv.ptszVal, hContact, 0);
db_free(&dbv);
@@ -64,30 +65,34 @@ void HistoryWrite(HANDLE hContact)
db_set_ts(hContact, S_MOD, BuildSetting(historyLast), ptszString);
historyLast = (historyLast+1) % historyMax;
- db_set_w(hContact,S_MOD,"HistoryLast",historyLast);
+ db_set_w(hContact, S_MOD, "HistoryLast", historyLast);
if (historyLast == historyFirst)
db_set_w(hContact, S_MOD, "HistoryFirst", (historyFirst+1) % historyMax);
}
void LoadHistoryList(HANDLE hContact, HWND hwnd, int nList)
{
- short historyFirst, historyLast, historyMax;
- short i;
- DBVARIANT dbv;
-
SendDlgItemMessage(hwnd, nList, LB_RESETCONTENT, 0, 0);
- historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10);
- if (historyMax < 0) historyMax = 0; else if (historyMax > 99) historyMax = 99;
- if (historyMax == 0) return;
- historyFirst = db_get_w(hContact,S_MOD,"HistoryFirst",0);
- if (historyFirst >= historyMax) historyFirst = 0;
- historyLast = db_get_w(hContact,S_MOD,"HistoryLast",0);
- if (historyLast >= historyMax) historyLast = historyMax-1;
+ int historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10);
+ if (historyMax < 0)
+ historyMax = 0;
+ else if (historyMax > 99)
+ historyMax = 99;
+ if (historyMax == 0)
+ return;
- i = historyLast;
- while (i != historyFirst) {
+ int historyFirst = db_get_w(hContact,S_MOD,"HistoryFirst",0);
+ if (historyFirst >= historyMax)
+ historyFirst = 0;
+
+ int historyLast = db_get_w(hContact,S_MOD,"HistoryLast",0);
+ if (historyLast >= historyMax)
+ historyLast = historyMax-1;
+
+ for (int i = historyLast; i != historyFirst; ) {
i = (i-1+historyMax) % historyMax;
+ DBVARIANT dbv;
if ( !DBGetContactSettingTString(hContact, S_MOD, BuildSetting(i), &dbv)) {
SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
@@ -147,6 +152,7 @@ HDWP MyHorizCenterWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl,
SWP_NOZORDER);
}
+
void MyResizeGetOffset (HWND hwndDlg, HWND hwndControl, int nWidth, int nHeight, int* nDx, int* nDy)
{
RECT rcinit;
@@ -280,30 +286,23 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
void ShowHistory(HANDLE hContact, BYTE isAlert)
{
- HWND hHistoryDlg;
-
- hHistoryDlg = WindowList_Find(hWindowList,hContact);
- if (hHistoryDlg == NULL)
- {
+ HWND hHistoryDlg = WindowList_Find(hWindowList,hContact);
+ if (hHistoryDlg == NULL) {
hHistoryDlg = CreateDialogParam(hInstance,MAKEINTRESOURCE(IDD_HISTORY),NULL,HistoryDlgProc,(LPARAM)hContact);
LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST);
WindowList_Add(hWindowList,hHistoryDlg,hContact);
}
- else
- {
+ else {
SetForegroundWindow(hHistoryDlg);
LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST);
SetFocus(hHistoryDlg);
}
if (isAlert)
- {
SkinPlaySound("LastSeenTrackedStatusChange");
- }
}
-
void InitHistoryDialog(void)
{
- hWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
+ hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
}
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp
index 9280f550ad..9dea392cfd 100644
--- a/plugins/SeenPlugin/src/main.cpp
+++ b/plugins/SeenPlugin/src/main.cpp
@@ -26,7 +26,7 @@ Last change by : $Author: y_b $
#include "version.h"
HINSTANCE hInstance;
-HANDLE ehdb = NULL, ehproto = NULL, ehmissed = NULL, ehuserinfo = NULL, ehmissed_proto = NULL, hOptInit = NULL, hMainInit = NULL;
+HANDLE ehmissed = NULL, ehuserinfo = NULL, ehmissed_proto = NULL;
int hLangpack;
@@ -60,7 +60,7 @@ int MainInit(WPARAM wparam,LPARAM lparam)
memset(&contactQueue[0], 0, contactQueueSize);
contactQueueSize = 16;
includeIdle = (BOOL )db_get_b(NULL,S_MOD,"IdleSupport",1);
- hOptInit = HookEvent(ME_OPT_INITIALISE, OptionsInit);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
if ( db_get_b(NULL,S_MOD,"MenuItem",1))
InitMenuitem();
@@ -72,10 +72,10 @@ int MainInit(WPARAM wparam,LPARAM lparam)
InitFileOutput();
if ( db_get_b(NULL,S_MOD,"MissedOnes",0))
- ehmissed_proto=HookEvent(ME_PROTO_ACK,ModeChange_mo);
+ ehmissed_proto = HookEvent(ME_PROTO_ACK,ModeChange_mo);
- ehdb = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues);
- ehproto = HookEvent(ME_PROTO_ACK,ModeChange);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues);
+ HookEvent(ME_PROTO_ACK,ModeChange);
SkinAddNewSoundExT("LastSeenTrackedStatusChange", LPGENT("LastSeen"), LPGENT("User status change"));
SkinAddNewSoundExT("LastSeenTrackedStatusOnline", LPGENT("LastSeen"), LPGENT("Changed to Online"));
@@ -88,11 +88,9 @@ int MainInit(WPARAM wparam,LPARAM lparam)
db_set_s(NULL,"Uninstall",Translate("Last seen"),S_MOD);
- if ( ServiceExists(MS_TIPPER_ADDTRANSLATION)) {
- int i;
- for (i=0; i < TRANSNUMBER; i++)
+ if ( ServiceExists(MS_TIPPER_ADDTRANSLATION))
+ for (int i=0; i < TRANSNUMBER; i++)
CallService(MS_TIPPER_ADDTRANSLATION, 0, (LPARAM)&idleTr[i]);
- }
return 0;
}
@@ -104,15 +102,10 @@ extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirand
extern "C" __declspec(dllexport) int Unload(void)
{
- UnhookEvent(ehdb);
- if (ehmissed) UnhookEvent(ehmissed);
- UnhookEvent(ehproto);
- if (ehmissed_proto) UnhookEvent(ehmissed_proto);
- UnhookEvent(hOptInit);
- UnhookEvent(hMainInit);
- if (ehuserinfo) UnhookEvent(ehuserinfo);
+ if (ehmissed)
+ UnhookEvent(ehmissed);
+
UninitMenuitem();
-// free(contactQueue);
return 0;
}
@@ -131,6 +124,6 @@ extern "C" __declspec(dllexport) int Load(void)
// I decided to hook all events after
// everything is loaded because it seems
// to be safer in my opinion
- hMainInit = HookEvent(ME_SYSTEM_MODULESLOADED,MainInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED,MainInit);
return 0;
} \ No newline at end of file
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp
index 010f960e5e..473917ce49 100644
--- a/plugins/SeenPlugin/src/menu.cpp
+++ b/plugins/SeenPlugin/src/menu.cpp
@@ -26,7 +26,6 @@ Last change by : $Author: y_b $
HANDLE hmenuitem=NULL, hLSUserDet = NULL, hBuildMenu = NULL;
-void ShowHistory(HANDLE hContact, BYTE isAlert);
void InitHistoryDialog(void);
/*
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp
index 62acb570c9..4735fae6d3 100644
--- a/plugins/SeenPlugin/src/missed.cpp
+++ b/plugins/SeenPlugin/src/missed.cpp
@@ -86,7 +86,7 @@ INT_PTR CALLBACK MissedDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
SetWindowPos(htemp,NULL,0,0,rcinit.right-rcinit.left,mcs.count*(rcinit.bottom-rcinit.top)/2,SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
GetWindowRect(htemp, &rcresized);
- htemp = GetDlgItem(hdlg,IDOK);
+ htemp = GetDlgItem(hdlg, IDOK);
GetWindowRect(htemp, &rcb);
pt.x = rcb.left;
pt.y = rcb.top;
@@ -94,7 +94,7 @@ INT_PTR CALLBACK MissedDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
ScreenToClient(hdlg, &pt);
MoveWindow(htemp,pt.x,pt.y+(rcresized.bottom-rcinit.bottom),(rcb.right-rcb.left),(rcb.bottom-rcb.top),FALSE);
GetWindowRect(hdlg, &rcd);
- SetWindowPos(hdlg,NULL,0,0,rcd.right-rcd.left,rcd.bottom-rcd.top+(rcresized.bottom-rcinit.bottom),SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
+ SetWindowPos(hdlg, NULL,0,0,rcd.right-rcd.left,rcd.bottom-rcd.top+(rcresized.bottom-rcinit.bottom),SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
SetDlgItemText(hdlg, IDC_CONTACTS, (LPCTSTR)lparam);
ShowWindow(hdlg, SW_SHOWNOACTIVATE);
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp
index 5ffd4e9420..c2482036fc 100644
--- a/plugins/SeenPlugin/src/options.cpp
+++ b/plugins/SeenPlugin/src/options.cpp
@@ -36,13 +36,10 @@ void InitMenuitem(void);
int ModeChange_mo(WPARAM,LPARAM);
int CheckIfOnline(void);
int ResetMissed(void);
-static BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
DBVARIANT dbv;
- int i;
- char szSetting[100];
TCHAR szstamp[256];
BOOL hasPopups;
BYTE bchecked;
@@ -52,27 +49,28 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
if (hasPopups = (ServiceExists(MS_POPUP_QUERY)) != 0)
hasPopups = CallService(MS_POPUP_QUERY,PUQS_GETSTATUS,0);
TranslateDialogDefault(hdlg);
- ShowWindow(GetDlgItem(hdlg,IDC_MISSPOPUP),hasPopups?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hdlg,IDC_POPUPS),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_LABTEXT),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_LABTTITLE),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups?SW_SHOW:SW_HIDE);
- CheckDlgButton(hdlg,IDC_POPUPS,db_get_b(NULL,S_MOD,"UsePopups",0)&hasPopups);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPS),hasPopups);
- hasPopups = IsDlgButtonChecked(hdlg,IDC_POPUPS);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups);
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
- DWORD sett;
- COLORREF back, text;
+ ShowWindow(GetDlgItem(hdlg, IDC_MISSPOPUP),hasPopups?SW_HIDE:SW_SHOW);
+ ShowWindow(GetDlgItem(hdlg, IDC_POPUPS),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, IDC_LABTEXT),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, IDC_LABTTITLE),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT),hasPopups?SW_SHOW:SW_HIDE);
+ CheckDlgButton(hdlg, IDC_POPUPS,db_get_b(NULL,S_MOD,"UsePopups",0)&hasPopups);
+ EnableWindow(GetDlgItem(hdlg, IDC_POPUPS),hasPopups);
+ hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS);
+ EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP),hasPopups);
+ EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT),hasPopups);
+ for (int i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ char szSetting[100];
sprintf(szSetting, "Col_%d",i-ID_STATUS_OFFLINE);
- sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[i-ID_STATUS_OFFLINE]);
+ DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[i-ID_STATUS_OFFLINE]);
+
+ COLORREF back, text;
GetColorsFromDWord(&back, &text, sett);
SendDlgItemMessage(hdlg, i, CPM_SETCOLOUR, 0, back);
SendDlgItemMessage(hdlg, i+20, CPM_SETCOLOUR, 0, text);
- EnableWindow( GetDlgItem(hdlg,i), hasPopups);
- EnableWindow( GetDlgItem(hdlg,i+20), hasPopups);
+ EnableWindow( GetDlgItem(hdlg, i), hasPopups);
+ EnableWindow( GetDlgItem(hdlg, i+20), hasPopups);
}
if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStamp", &dbv)) {
@@ -101,12 +99,12 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
else
idText = wparam+20, idBack = wparam;
- ppd.colorBack = SendDlgItemMessage(hdlg,idBack,CPM_GETCOLOUR,0,0);
- ppd.colorText = SendDlgItemMessage(hdlg,idText,CPM_GETCOLOUR,0,0);
+ ppd.colorBack = SendDlgItemMessage(hdlg, idBack,CPM_GETCOLOUR,0,0);
+ ppd.colorText = SendDlgItemMessage(hdlg, idText,CPM_GETCOLOUR,0,0);
temp = GetDWordFromColors(ppd.colorBack,ppd.colorText);
GetColorsFromDWord(&ppd.colorBack,&ppd.colorText,temp);
- SendDlgItemMessage(hdlg,idBack,CPM_SETCOLOUR,0,ppd.colorBack);
- SendDlgItemMessage(hdlg,idText,CPM_SETCOLOUR,0,ppd.colorText);
+ SendDlgItemMessage(hdlg, idBack,CPM_SETCOLOUR,0,ppd.colorBack);
+ SendDlgItemMessage(hdlg, idText,CPM_SETCOLOUR,0,ppd.colorText);
ppd.lchIcon = LoadSkinnedProtoIcon(NULL, idBack);
GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
@@ -122,16 +120,16 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
if (HIWORD(wparam) == BN_CLICKED) {
switch(LOWORD(wparam)) {
case IDC_POPUPS:
- hasPopups = IsDlgButtonChecked(hdlg,IDC_POPUPS);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups);
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
- EnableWindow(GetDlgItem(hdlg,i),hasPopups);
- EnableWindow(GetDlgItem(hdlg,i+20),hasPopups);
+ hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS);
+ EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP),hasPopups);
+ EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT),hasPopups);
+ for (int i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ EnableWindow(GetDlgItem(hdlg, i),hasPopups);
+ EnableWindow(GetDlgItem(hdlg, i+20),hasPopups);
}
break;
case IDC_DEFAULTCOL:
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
+ for (int i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
DWORD sett = StatusColors15bits[i-ID_STATUS_OFFLINE];
COLORREF back, text;
GetColorsFromDWord(&back, &text, sett);
@@ -154,21 +152,21 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
db_set_ts(NULL, S_MOD, "PopupStampText", szstamp);
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_POPUPS);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_POPUPS);
if ( db_get_b(NULL,S_MOD,"UsePopups",0) != bchecked)
db_set_b(NULL, S_MOD, "UsePopups", bchecked);
- for (i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- DWORD sett;
- COLORREF back=0, text=0;
+ for (int i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ COLORREF back = SendDlgItemMessage(hdlg, i, CPM_GETCOLOUR, 0, 0);
+ COLORREF text = SendDlgItemMessage(hdlg, i+20, CPM_GETCOLOUR, 0, 0);
+ DWORD sett = GetDWordFromColors(back, text);
+
+ char szSetting[100];
sprintf(szSetting, "Col_%d", i-ID_STATUS_OFFLINE);
- back = SendDlgItemMessage(hdlg, i, CPM_GETCOLOUR, 0, 0);
- text = SendDlgItemMessage(hdlg, i+20, CPM_GETCOLOUR, 0, 0);
- sett = GetDWordFromColors(back, text);
if (sett != StatusColors15bits[i-ID_STATUS_OFFLINE])
- DBWriteContactSettingDword(NULL, S_MOD, szSetting, sett);
+ db_set_dw(NULL, S_MOD, szSetting, sett);
else
- DBDeleteContactSetting(NULL, S_MOD, szSetting);
+ db_unset(NULL, S_MOD, szSetting);
}
break; //case PSN_APPLY
}
@@ -190,24 +188,24 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- CheckDlgButton(hdlg,IDC_MENUITEM,db_get_b(NULL,S_MOD,"MenuItem",1));
- CheckDlgButton(hdlg,IDC_USERINFO,db_get_b(NULL,S_MOD,"UserinfoTab",1));
- CheckDlgButton(hdlg,IDC_FILE,db_get_b(NULL,S_MOD,"FileOutput",0));
- CheckDlgButton(hdlg,IDC_HISTORY,db_get_b(NULL,S_MOD,"KeepHistory",0));
- CheckDlgButton(hdlg,IDC_IGNOREOFFLINE,db_get_b(NULL,S_MOD,"IgnoreOffline",1));
- CheckDlgButton(hdlg,IDC_MISSEDONES,db_get_b(NULL,S_MOD,"MissedOnes",0));
- CheckDlgButton(hdlg,IDC_SHOWICON,db_get_b(NULL,S_MOD,"ShowIcon",1));
- CheckDlgButton(hdlg,IDC_COUNT,db_get_b(NULL,S_MOD,"MissedOnes_Count",0));
- CheckDlgButton(hdlg,IDC_IDLESUPPORT,db_get_b(NULL,S_MOD,"IdleSupport",1));
-
- EnableWindow(GetDlgItem(hdlg,IDC_MENUSTAMP),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- EnableWindow(GetDlgItem(hdlg,IDC_SHOWICON),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- EnableWindow(GetDlgItem(hdlg,IDC_USERSTAMP),IsDlgButtonChecked(hdlg,IDC_USERINFO));
- EnableWindow(GetDlgItem(hdlg,IDC_FILESTAMP),IsDlgButtonChecked(hdlg,IDC_FILE));
- EnableWindow(GetDlgItem(hdlg,IDC_FILENAME),IsDlgButtonChecked(hdlg,IDC_FILE));
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- EnableWindow(GetDlgItem(hdlg,IDC_COUNT),IsDlgButtonChecked(hdlg,IDC_MISSEDONES));
+ CheckDlgButton(hdlg, IDC_MENUITEM,db_get_b(NULL,S_MOD,"MenuItem",1));
+ CheckDlgButton(hdlg, IDC_USERINFO,db_get_b(NULL,S_MOD,"UserinfoTab",1));
+ CheckDlgButton(hdlg, IDC_FILE,db_get_b(NULL,S_MOD,"FileOutput",0));
+ CheckDlgButton(hdlg, IDC_HISTORY,db_get_b(NULL,S_MOD,"KeepHistory",0));
+ CheckDlgButton(hdlg, IDC_IGNOREOFFLINE,db_get_b(NULL,S_MOD,"IgnoreOffline",1));
+ CheckDlgButton(hdlg, IDC_MISSEDONES,db_get_b(NULL,S_MOD,"MissedOnes",0));
+ CheckDlgButton(hdlg, IDC_SHOWICON,db_get_b(NULL,S_MOD,"ShowIcon",1));
+ CheckDlgButton(hdlg, IDC_COUNT,db_get_b(NULL,S_MOD,"MissedOnes_Count",0));
+ CheckDlgButton(hdlg, IDC_IDLESUPPORT,db_get_b(NULL,S_MOD,"IdleSupport",1));
+
+ EnableWindow(GetDlgItem(hdlg, IDC_MENUSTAMP),IsDlgButtonChecked(hdlg, IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg, IDC_SHOWICON),IsDlgButtonChecked(hdlg, IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg, IDC_USERSTAMP),IsDlgButtonChecked(hdlg, IDC_USERINFO));
+ EnableWindow(GetDlgItem(hdlg, IDC_FILESTAMP),IsDlgButtonChecked(hdlg, IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg, IDC_FILENAME),IsDlgButtonChecked(hdlg, IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg, IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg, IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg, IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg, IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg, IDC_COUNT),IsDlgButtonChecked(hdlg, IDC_MISSEDONES));
if ( !DBGetContactSettingTString(NULL, S_MOD, "MenuStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_MENUSTAMP, dbv.ptszVal);
@@ -239,10 +237,10 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
}
else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, _T(DEFAULT_HISTORYSTAMP));
- SetDlgItemInt(hdlg,IDC_HISTORYSIZE,db_get_w(NULL,S_MOD,"HistoryMax",10-1)-1,FALSE);
+ SetDlgItemInt(hdlg, IDC_HISTORYSIZE,db_get_w(NULL,S_MOD,"HistoryMax",10-1)-1,FALSE);
// load protocol list
- SetWindowLongPtr(GetDlgItem(hdlg,IDC_PROTOCOLLIST),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hdlg,IDC_PROTOCOLLIST),GWL_STYLE)|TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST),GWL_STYLE)|TVS_CHECKBOXES);
{
TVINSERTSTRUCT tvis;
tvis.hParent = NULL;
@@ -261,7 +259,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
tvis.item.pszText = protos[i]->tszAccountName;
tvis.item.lParam = (LPARAM)mir_strdup(protos[i]->szModuleName);
tvis.item.state = INDEXTOSTATEIMAGEMASK( IsWatchedProtocol(protos[i]->szModuleName)+1);
- TreeView_InsertItem( GetDlgItem(hdlg,IDC_PROTOCOLLIST), &tvis);
+ TreeView_InsertItem( GetDlgItem(hdlg, IDC_PROTOCOLLIST), &tvis);
}
}
break;
@@ -274,22 +272,22 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
if (HIWORD(wparam) == BN_CLICKED) {
switch(LOWORD(wparam)) {
case IDC_MENUITEM:
- EnableWindow(GetDlgItem(hdlg,IDC_MENUSTAMP),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- EnableWindow(GetDlgItem(hdlg,IDC_SHOWICON),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg, IDC_MENUSTAMP),IsDlgButtonChecked(hdlg, IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg, IDC_SHOWICON),IsDlgButtonChecked(hdlg, IDC_MENUITEM));
break;
case IDC_USERINFO:
- EnableWindow(GetDlgItem(hdlg,IDC_USERSTAMP),IsDlgButtonChecked(hdlg,IDC_USERINFO));
+ EnableWindow(GetDlgItem(hdlg, IDC_USERSTAMP),IsDlgButtonChecked(hdlg, IDC_USERINFO));
break;
case IDC_FILE:
- EnableWindow(GetDlgItem(hdlg,IDC_FILESTAMP),IsDlgButtonChecked(hdlg,IDC_FILE));
- EnableWindow(GetDlgItem(hdlg,IDC_FILENAME),IsDlgButtonChecked(hdlg,IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg, IDC_FILESTAMP),IsDlgButtonChecked(hdlg, IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg, IDC_FILENAME),IsDlgButtonChecked(hdlg, IDC_FILE));
break;
case IDC_HISTORY:
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg,IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg, IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg, IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg, IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg, IDC_HISTORY));
break;
case IDC_MISSEDONES:
- EnableWindow(GetDlgItem(hdlg,IDC_COUNT),IsDlgButtonChecked(hdlg,IDC_MISSEDONES));
+ EnableWindow(GetDlgItem(hdlg, IDC_COUNT),IsDlgButtonChecked(hdlg, IDC_MISSEDONES));
break;
}
}
@@ -321,16 +319,16 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, SIZEOF(szstamp));
db_set_ts(NULL, S_MOD, "HistoryStamp", szstamp);
- db_set_w(NULL, S_MOD, "HistoryMax",(WORD)(GetDlgItemInt(hdlg,IDC_HISTORYSIZE,NULL,FALSE)+1));
+ db_set_w(NULL, S_MOD, "HistoryMax",(WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE,NULL,FALSE)+1));
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_MENUITEM);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_MENUITEM);
if ( db_get_b(NULL,S_MOD,"MenuItem",1) != bchecked) {
db_set_b(NULL,S_MOD,"MenuItem",bchecked);
if (hmenuitem == NULL && bchecked)
InitMenuitem();
}
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_USERINFO);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_USERINFO);
if ( db_get_b(NULL,S_MOD,"UserinfoTab",1) != bchecked) {
db_set_b(NULL,S_MOD,"UserinfoTab",bchecked);
if (bchecked)
@@ -339,22 +337,22 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
UnhookEvent(ehuserinfo);
}
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_FILE);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_FILE);
if ( db_get_b(NULL,S_MOD,"FileOutput",0) != bchecked) {
db_set_b(NULL,S_MOD,"FileOutput",bchecked);
if (bchecked)
InitFileOutput();
}
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_HISTORY);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_HISTORY);
if ( db_get_b(NULL,S_MOD,"KeepHistory",0) != bchecked)
db_set_b(NULL,S_MOD,"KeepHistory",bchecked);
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_IGNOREOFFLINE);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_IGNOREOFFLINE);
if ( db_get_b(NULL,S_MOD,"IgnoreOffline",1) != bchecked)
db_set_b(NULL,S_MOD,"IgnoreOffline",bchecked);
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_MISSEDONES);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_MISSEDONES);
if ( db_get_b(NULL,S_MOD,"MissedOnes",0) != bchecked) {
db_set_b(NULL,S_MOD,"MissedOnes",bchecked);
if (bchecked)
@@ -363,80 +361,72 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
UnhookEvent(ehmissed_proto);
}
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_SHOWICON);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_SHOWICON);
if ( db_get_b(NULL,S_MOD,"ShowIcon",1) != bchecked)
db_set_b(NULL,S_MOD,"ShowIcon",bchecked);
- bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_COUNT);
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_COUNT);
if ( db_get_b(NULL,S_MOD,"MissedOnes_Count",0) != bchecked)
db_set_b(NULL,S_MOD,"MissedOnes_Count",bchecked);
- includeIdle = (BYTE)IsDlgButtonChecked(hdlg,IDC_IDLESUPPORT);
+ includeIdle = (BYTE)IsDlgButtonChecked(hdlg, IDC_IDLESUPPORT);
if ( db_get_b(NULL,S_MOD,"IdleSupport",1) != includeIdle)
db_set_b(NULL,S_MOD,"IdleSupport",(BYTE)includeIdle);
// save protocol list
- {
- HWND hwndTreeView = GetDlgItem(hdlg,IDC_PROTOCOLLIST);
- HTREEITEM hItem;
- TVITEM tvItem;
- char *watchedProtocols;
- char *protocol;
- int size=1;
-
- watchedProtocols = (char *)malloc(sizeof(char));
- *watchedProtocols = '\0';
- hItem = TreeView_GetRoot(hwndTreeView);
- tvItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
- tvItem.stateMask = TVIS_STATEIMAGEMASK;
-
- while (hItem != NULL) {
- tvItem.hItem = hItem;
- TreeView_GetItem(hwndTreeView, &tvItem);
- protocol = (char*)tvItem.lParam;
- if ((BOOL)(tvItem.state >> 12) -1) {
- size += (int)strlen(protocol)+2;
- watchedProtocols = (char *)realloc(watchedProtocols, size);
- strcat(watchedProtocols, protocol);
- strcat(watchedProtocols, " ");
- }
- hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
+ HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST);
+ HTREEITEM hItem;
+ TVITEM tvItem;
+ char *watchedProtocols;
+ char *protocol;
+ int size=1;
+
+ watchedProtocols = (char *)malloc(sizeof(char));
+ *watchedProtocols = '\0';
+ hItem = TreeView_GetRoot(hwndTreeView);
+ tvItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
+ tvItem.stateMask = TVIS_STATEIMAGEMASK;
+
+ while (hItem != NULL) {
+ tvItem.hItem = hItem;
+ TreeView_GetItem(hwndTreeView, &tvItem);
+ protocol = (char*)tvItem.lParam;
+ if ((BOOL)(tvItem.state >> 12) -1) {
+ size += (int)strlen(protocol)+2;
+ watchedProtocols = (char *)realloc(watchedProtocols, size);
+ strcat(watchedProtocols, protocol);
+ strcat(watchedProtocols, " ");
}
- db_set_s(NULL,S_MOD,"WatchedProtocols",watchedProtocols);
- free(watchedProtocols);
+ hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
}
- break; //case PSN_APPLY
+ db_set_s(NULL,S_MOD,"WatchedProtocols",watchedProtocols);
+ free(watchedProtocols);
}
break; //case 0
case IDC_PROTOCOLLIST:
- switch (((LPNMHDR)lparam)->code) {
- case NM_CLICK:
- {
- HWND hTree=((LPNMHDR)lparam)->hwndFrom;
- HTREEITEM hItem;
-
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(hTree, &hti.pt);
- if (hItem=TreeView_HitTest(hTree, &hti)) {
- if (hti.flags & TVHT_ONITEM)
- TreeView_SelectItem(hTree,hItem);
- if (hti.flags & TVHT_ONITEMSTATEICON)
- SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
- }
+ if (((LPNMHDR)lparam)->code == NM_CLICK) {
+ HWND hTree=((LPNMHDR)lparam)->hwndFrom;
+ HTREEITEM hItem;
+
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(hTree, &hti.pt);
+ if (hItem=TreeView_HitTest(hTree, &hti)) {
+ if (hti.flags & TVHT_ONITEM)
+ TreeView_SelectItem(hTree,hItem);
+ if (hti.flags & TVHT_ONITEMSTATEICON)
+ SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
- break;
}
- break; //case IDC_PROTOCOLLIST
}
break;//case WM_NOTIFY
case WM_DESTROY:
// free protocol list
{
- HWND hwndTreeView = GetDlgItem(hdlg,IDC_PROTOCOLLIST);
+ HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST);
HTREEITEM hItem = TreeView_GetRoot(hwndTreeView);
TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -456,12 +446,6 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
int OptionsInit(WPARAM wparam,LPARAM lparam)
{
- if (IsWinVerXPPlus()) {
- HMODULE hUxTheme = GetModuleHandle( _T("uxtheme.dll"));
- if (hUxTheme)
- pfnEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
- }
-
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
odp.hInstance = hInstance;
@@ -470,14 +454,14 @@ int OptionsInit(WPARAM wparam,LPARAM lparam)
odp.ptszGroup = LPGENT("Contacts");
odp.ptszTitle = LPGENT("Last seen");
odp.pfnDlgProc = OptsSettingsDlgProc;
- Options_AddPage(wparam,&odp);
+ Options_AddPage(wparam, &odp);
if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS);
odp.ptszGroup = LPGENT("PopUps");
odp.ptszTitle = LPGENT("Last seen");
odp.pfnDlgProc = OptsPopUpsDlgProc;
- Options_AddPage(wparam,&odp);
+ Options_AddPage(wparam, &odp);
}
return 0;
}
diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h
index 692bc2ea38..a7a196cd91 100644
--- a/plugins/SeenPlugin/src/seen.h
+++ b/plugins/SeenPlugin/src/seen.h
@@ -122,6 +122,7 @@ void SetOffline(void);
int ModeChange_mo(WPARAM,LPARAM);
int CheckIfOnline(void);
void UninitMenuitem();
+void ShowHistory(HANDLE hContact, BYTE isAlert);
extern BOOL includeIdle;
typedef struct logthread_info {
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp
index 2bf3649a02..3bae7a700e 100644
--- a/plugins/SeenPlugin/src/userinfo.cpp
+++ b/plugins/SeenPlugin/src/userinfo.cpp
@@ -51,7 +51,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
switch(msg) {
case WM_INITDIALOG:
- MainProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hdlg,IDC_INFOTEXT),GWLP_WNDPROC,(LONG)EditProc);
+ MainProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hdlg, IDC_INFOTEXT),GWLP_WNDPROC,(LONG)EditProc);
{
TCHAR *szout;
if ( !DBGetContactSettingTString(NULL, S_MOD, "UserStamp", &dbv)) {
@@ -62,7 +62,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
SetDlgItemText(hdlg, IDC_INFOTEXT, szout);
if ( !lstrcmp(szout, TranslateT("<unknown>")))
- EnableWindow( GetDlgItem(hdlg,IDC_INFOTEXT), FALSE);
+ EnableWindow( GetDlgItem(hdlg, IDC_INFOTEXT), FALSE);
}
break;
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 8983ac53e0..8758b3acd3 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -26,8 +26,6 @@ Last change by : $Author: y_b $
void FileWrite(HANDLE);
void HistoryWrite(HANDLE hcontact);
-//void SetOffline(void);
-void ShowHistory(HANDLE hContact, BYTE isAlert);
char * courProtoName = 0;
@@ -132,7 +130,7 @@ DWORD isSeen(HANDLE hcontact, SYSTEMTIME *st)
//perform LOCALTOTIMESTAMP
res = (DWORD)ll - CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,0,0);
//nevel look for Year/Month/Day/Hour/Minute/Second again
- DBWriteContactSettingDword(hcontact,S_MOD,"seenTS",res);
+ db_set_dw(hcontact,S_MOD,"seenTS",res);
}
} } }
@@ -420,7 +418,7 @@ void DBWriteTimeTS(DWORD t, HANDLE hcontact){
ft.dwLowDateTime = (DWORD)ll;
ft.dwHighDateTime = (DWORD)(ll >> 32);
FileTimeToSystemTime(&ft, &st);
- DBWriteContactSettingDword(hcontact,S_MOD,"seenTS",t);
+ db_set_dw(hcontact,S_MOD,"seenTS",t);
_DBWriteTime(&st, hcontact);
}
void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword){
@@ -704,7 +702,7 @@ static DWORD __stdcall cleanThread(logthread_info* infoParam)
char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",infoParam->sProtoName);
- DBDeleteContactSetting(NULL,S_MOD,str);
+ db_unset(NULL,S_MOD,str);
free(str);
free(infoParam);
@@ -748,7 +746,7 @@ int ModeChange(WPARAM wparam,LPARAM lparam)
time_t t;
time(&t);
mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",ack->szModule);
- DBWriteContactSettingDword(NULL,S_MOD,str,t);
+ db_set_dw(NULL,S_MOD,str,t);
free(str);
} }
if (isetting==db_get_w(NULL,S_MOD,courProtoName,ID_STATUS_OFFLINE)) return 0;