summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SeenPlugin/src/file.cpp36
-rw-r--r--plugins/SeenPlugin/src/history.cpp159
-rw-r--r--plugins/SeenPlugin/src/main.cpp60
-rw-r--r--plugins/SeenPlugin/src/menu.cpp28
-rw-r--r--plugins/SeenPlugin/src/missed.cpp50
-rw-r--r--plugins/SeenPlugin/src/options.cpp294
-rw-r--r--plugins/SeenPlugin/src/seen.h15
-rw-r--r--plugins/SeenPlugin/src/userinfo.cpp44
-rw-r--r--plugins/SeenPlugin/src/utils.cpp414
-rw-r--r--plugins/SeenPlugin/src/version.h16
10 files changed, 578 insertions, 538 deletions
diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp
index e6ce08c2ac..f8afc15c8d 100644
--- a/plugins/SeenPlugin/src/file.cpp
+++ b/plugins/SeenPlugin/src/file.cpp
@@ -19,60 +19,58 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "seen.h"
-/*
-Prepares the log file:
-- calculates the absolute path (and store it in the db)
-- creates the directory
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// Prepares the log file:
+// - calculates the absolute path (and store it in the db)
+// - creates the directory
+
int InitFileOutput(void)
{
TCHAR szfpath[MAX_PATH], szmpath[MAX_PATH];
GetModuleFileName(NULL, szmpath, MAX_PATH);
DBVARIANT dbv;
- if(!db_get_ts(NULL, S_MOD, "FileName", &dbv))
- {
+ if (!db_get_ts(NULL, S_MOD, "FileName", &dbv)) {
_tcsncpy(szfpath, dbv.ptszVal, MAX_PATH);
db_free(&dbv);
}
else _tcsncpy(szfpath, DEFAULT_FILENAME, MAX_PATH);
if (szfpath[0] == '\\')
- _tcsncpy(szfpath, szfpath+1, MAX_PATH);
+ _tcsncpy(szfpath, szfpath + 1, MAX_PATH);
TCHAR *str = _tcsrchr(szmpath, '\\');
if (str != NULL)
- *++str=0;
+ *++str = 0;
_tcsncat(szmpath, szfpath, MAX_PATH);
_tcsncpy(szfpath, szmpath, MAX_PATH);
str = _tcsrchr(szmpath, '\\');
if (str != NULL)
- *++str=0;
+ *++str = 0;
db_set_ts(NULL, S_MOD, "PathToFile", szfpath);
return 0;
}
-/*
-Writes a line into the log.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// Writes a line into the log.
+
void FileWrite(MCONTACT hcontact)
{
TCHAR szout[1024];
DBVARIANT dbv;
- if(!db_get_ts(NULL, S_MOD, "PathToFile", &dbv))
- {
+ if (!db_get_ts(NULL, S_MOD, "PathToFile", &dbv)) {
_tcsncpy(szout, ParseString(dbv.ptszVal, hcontact, 1), SIZEOF(szout));
db_free(&dbv);
}
else _tcsncpy(szout, DEFAULT_FILENAME, SIZEOF(szout));
HANDLE fhout = CreateFile(szout, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL);
- if (fhout == INVALID_HANDLE_VALUE){
+ if (fhout == INVALID_HANDLE_VALUE) {
TCHAR fullpath[1024];
_tcsncpy(fullpath, szout, SIZEOF(fullpath));
TCHAR *dirpath = _tcsrchr(fullpath, '\\');
@@ -83,14 +81,14 @@ void FileWrite(MCONTACT hcontact)
if (fhout == INVALID_HANDLE_VALUE)
return;
}
- SetFilePointer(fhout,0,0,FILE_END);
+ SetFilePointer(fhout, 0, 0, FILE_END);
- if ( !db_get_ts(NULL, S_MOD,"FileStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "FileStamp", &dbv)) {
_tcsncpy(szout, ParseString(dbv.ptszVal, hcontact, 1), SIZEOF(szout));
db_free(&dbv);
}
else _tcsncpy(szout, ParseString(DEFAULT_FILESTAMP, hcontact, 1), SIZEOF(szout));
-
+
DWORD byteswritten;
WriteFile(fhout, _T2A(szout), (DWORD)_tcslen(szout), &byteswritten, NULL);
WriteFile(fhout, "\r\n", 2, &byteswritten, NULL);
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp
index 18010ebab2..b14c59a970 100644
--- a/plugins/SeenPlugin/src/history.cpp
+++ b/plugins/SeenPlugin/src/history.cpp
@@ -22,7 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static HANDLE hWindowList;
-char* BuildSetting(int historyLast) {
+char* BuildSetting(int historyLast)
+{
static char setting[15];
static char sztemp[15];
*setting = '\0';
@@ -35,59 +36,59 @@ void HistoryWrite(MCONTACT hContact)
{
int historyMax = db_get_w(NULL, S_MOD, "HistoryMax", 10);
if (historyMax < 0)
- historyMax=0;
+ historyMax = 0;
else if (historyMax > 99)
historyMax = 99;
if (historyMax == 0)
return;
int historyFirst = db_get_w(hContact, S_MOD, "HistoryFirst", 0);
- if (historyFirst >= historyMax)
+ if (historyFirst >= historyMax)
historyFirst = 0;
int historyLast = db_get_w(hContact, S_MOD, "HistoryLast", 0);
if (historyLast >= historyMax)
- historyLast = historyMax-1;
+ historyLast = historyMax - 1;
TCHAR *ptszString;
DBVARIANT dbv;
- if ( !db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
ptszString = ParseString(dbv.ptszVal, hContact, 0);
db_free(&dbv);
}
else ptszString = ParseString(DEFAULT_HISTORYSTAMP, hContact, 0);
db_set_ts(hContact, S_MOD, BuildSetting(historyLast), ptszString);
- historyLast = (historyLast+1) % historyMax;
+ historyLast = (historyLast + 1) % historyMax;
db_set_w(hContact, S_MOD, "HistoryLast", historyLast);
if (historyLast == historyFirst)
- db_set_w(hContact, S_MOD, "HistoryFirst", (historyFirst+1) % historyMax);
+ db_set_w(hContact, S_MOD, "HistoryFirst", (historyFirst + 1) % historyMax);
}
void LoadHistoryList(MCONTACT hContact, HWND hwnd, int nList)
{
SendDlgItemMessage(hwnd, nList, LB_RESETCONTENT, 0, 0);
- int historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10);
+ 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;
-
- int historyFirst = db_get_w(hContact,S_MOD,"HistoryFirst",0);
+
+ 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);
+
+ 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;
-
+ historyLast = historyMax - 1;
+
+ for (int i = historyLast; i != historyFirst;) {
+ i = (i - 1 + historyMax) % historyMax;
+
DBVARIANT dbv;
- if ( !db_get_ts(hContact, S_MOD, BuildSetting(i), &dbv)) {
+ if (!db_get_ts(hContact, S_MOD, BuildSetting(i), &dbv)) {
SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
}
@@ -96,16 +97,16 @@ void LoadHistoryList(MCONTACT hContact, HWND hwnd, int nList)
}
-HDWP MyResizeWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl,
- int nHorizontalOffset, int nVerticalOffset,
- int nWidthOffset, int nHeightOffset)
+HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl,
+ int nHorizontalOffset, int nVerticalOffset,
+ int nWidthOffset, int nHeightOffset)
{
POINT pt;
RECT rcinit;
// get current bounding rectangle
GetWindowRect(hwndControl, &rcinit);
-
+
// get current top left point
pt.x = rcinit.left;
pt.y = rcinit.top;
@@ -113,25 +114,25 @@ HDWP MyResizeWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl,
// resize control
return DeferWindowPos(hDwp, hwndControl, NULL,
- pt.x + nHorizontalOffset,
- pt.y + nVerticalOffset,
- rcinit.right - rcinit.left + nWidthOffset,
- rcinit.bottom - rcinit.top + nHeightOffset,
- SWP_NOZORDER);
+ pt.x + nHorizontalOffset,
+ pt.y + nVerticalOffset,
+ rcinit.right - rcinit.left + nWidthOffset,
+ rcinit.bottom - rcinit.top + nHeightOffset,
+ SWP_NOZORDER);
}
-HDWP MyHorizCenterWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl,
- int nClientWidth, int nVerticalOffset,
- int nHeightOffset)
+HDWP MyHorizCenterWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl,
+ int nClientWidth, int nVerticalOffset,
+ int nHeightOffset)
{
POINT pt;
RECT rcinit;
// get current bounding rectangle
GetWindowRect(hwndControl, &rcinit);
-
+
// get current top left point
pt.x = rcinit.left;
pt.y = rcinit.top;
@@ -139,21 +140,21 @@ HDWP MyHorizCenterWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl,
// resize control
return DeferWindowPos(hDwp, hwndControl, NULL,
- (int) ((nClientWidth - (rcinit.right - rcinit.left))/2),
- pt.y + nVerticalOffset,
- rcinit.right - rcinit.left,
- rcinit.bottom - rcinit.top + nHeightOffset,
- SWP_NOZORDER);
+ (int)((nClientWidth - (rcinit.right - rcinit.left)) / 2),
+ pt.y + nVerticalOffset,
+ rcinit.right - rcinit.left,
+ rcinit.bottom - rcinit.top + nHeightOffset,
+ SWP_NOZORDER);
}
-void MyResizeGetOffset (HWND hwndDlg, HWND hwndControl, int nWidth, int nHeight, int* nDx, int* nDy)
+void MyResizeGetOffset(HWND hwndDlg, HWND hwndControl, int nWidth, int nHeight, int* nDx, int* nDy)
{
RECT rcinit;
// get current bounding rectangle
GetWindowRect(hwndControl, &rcinit);
-
+
// calculate offsets
*nDx = nWidth - (rcinit.right - rcinit.left);
*nDy = nHeight - (rcinit.bottom - rcinit.top);
@@ -164,82 +165,82 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
MCONTACT hContact;
TCHAR sztemp[1024];
- switch(Message) {
+ switch (Message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
hContact = (MCONTACT)lparam;
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lparam);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lparam);
mir_sntprintf(sztemp, SIZEOF(sztemp), _T("%s: %s"),
- CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_TCHAR),
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR),
TranslateT("last seen history"));
SetWindowText(hwndDlg, sztemp);
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
- if (db_get_b(hContact,S_MOD,"OnlineAlert", 0))
+ if (db_get_b(hContact, S_MOD, "OnlineAlert", 0))
CheckDlgButton(hwndDlg, IDC_STATUSCHANGE, BST_CHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS));
+
+ SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS));
SendDlgItemMessage(hwndDlg, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_OTHER_DOWNARROW));
- SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
+ SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
//set-up tooltips
- SendDlgItemMessage(hwndDlg, IDC_DETAILS, BUTTONADDTOOLTIP, (WPARAM)TranslateT("View User's Details"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_DETAILS, BUTTONADDTOOLTIP, (WPARAM)TranslateT("View User's Details"), BATF_TCHAR);
SendDlgItemMessage(hwndDlg, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)TranslateT("User Menu"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Send Instant Message"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Send Instant Message"), BATF_TCHAR);
- Utils_RestoreWindowPositionNoMove(hwndDlg,NULL,S_MOD,"History_");
+ Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, S_MOD, "History_");
ShowWindow(hwndDlg, SW_SHOW);
return TRUE;
case WM_MEASUREITEM:
- return CallService(MS_CLIST_MENUMEASUREITEM,wparam,lparam);
+ return CallService(MS_CLIST_MENUMEASUREITEM, wparam, lparam);
case WM_DRAWITEM:
- return CallService(MS_CLIST_MENUDRAWITEM,wparam,lparam);
+ return CallService(MS_CLIST_MENUDRAWITEM, wparam, lparam);
case WM_COMMAND:
- hContact=(MCONTACT)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wparam),MPCF_CONTACTMENU), hContact))
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wparam), MPCF_CONTACTMENU), hContact))
break;
- switch(LOWORD(wparam)) {
+ switch (LOWORD(wparam)) {
case IDCANCEL:
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
case IDOK:
if (IsDlgButtonChecked(hwndDlg, IDC_STATUSCHANGE) == BST_CHECKED)
- db_set_b(hContact,S_MOD,"OnlineAlert",1);
+ db_set_b(hContact, S_MOD, "OnlineAlert", 1);
else
- db_set_b(hContact,S_MOD,"OnlineAlert",0);
+ db_set_b(hContact, S_MOD, "OnlineAlert", 0);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
case IDC_USERMENU:
- {
+ {
RECT rc;
- HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,hContact,0);
- GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU),&rc);
- TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
break;
case IDC_DETAILS:
- CallService(MS_USERINFO_SHOWDIALOG,hContact,0);
+ CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
break;
case IDC_SENDMSG:
- CallService(MS_MSG_SENDMESSAGE,hContact,0);
+ CallService(MS_MSG_SENDMESSAGE, hContact, 0);
break;
case IDC_TEST:
- debug( ParseString( LPGENT("Date: %d.%m.%y(%Y) \n Date desc: %W - %w - %E - %e \n Time: %H:%M:%S (%h-%p) \n user: %n - %u \n Status: %s \n IP: %i - %r"), hContact, 0));
+ debug(ParseString(LPGENT("Date: %d.%m.%y(%Y) \n Date desc: %W - %w - %E - %e \n Time: %H:%M:%S (%h-%p) \n user: %n - %u \n Status: %s \n IP: %i - %r"), hContact, 0));
break;
}
break;
case WM_SIZE:
+ int dx, dy;
{
- int dx, dy;
HDWP hDwp = BeginDeferWindowPos(6);
- MyResizeGetOffset(hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST), LOWORD(lparam)-15, HIWORD(lparam)-99, &dx, &dy);
+ MyResizeGetOffset(hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST), LOWORD(lparam) - 15, HIWORD(lparam) - 99, &dx, &dy);
hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_USERMENU), dx, 0, 0, 0);
hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_DETAILS), dx, 0, 0, 0);
hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_SENDMSG), dx, 0, 0, 0);
@@ -247,30 +248,30 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_STATUSCHANGE), 0, dy, dx, 0);
hDwp = MyHorizCenterWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDOK), LOWORD(lparam), dy, 0);
EndDeferWindowPos(hDwp);
- }
+ }
break;
case WM_GETMINMAXINFO:
+ MINMAXINFO mmi;
{
- MINMAXINFO mmi;
- memcpy (&mmi, (LPMINMAXINFO) lparam, sizeof (MINMAXINFO));
+ memcpy(&mmi, (LPMINMAXINFO)lparam, sizeof(MINMAXINFO));
/* The minimum width in points*/
mmi.ptMinTrackSize.x = 200;
/* The minimum height in points*/
mmi.ptMinTrackSize.y = 190;
- memcpy ((LPMINMAXINFO) lparam, &mmi, sizeof (MINMAXINFO));
+ memcpy((LPMINMAXINFO)lparam, &mmi, sizeof(MINMAXINFO));
}
break;
case WM_CLOSE:
DestroyWindow(hwndDlg);
- WindowList_Remove(hWindowList,hwndDlg);
+ WindowList_Remove(hWindowList, hwndDlg);
break;
case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg,NULL,S_MOD,"History_");
+ Utils_SaveWindowPosition(hwndDlg, NULL, S_MOD, "History_");
DestroyIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
DestroyIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
break;
@@ -280,19 +281,19 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
void ShowHistory(MCONTACT hContact, BYTE isAlert)
{
- HWND hHistoryDlg = WindowList_Find(hWindowList,hContact);
+ HWND hHistoryDlg = WindowList_Find(hWindowList, hContact);
if (hHistoryDlg == NULL) {
- hHistoryDlg = CreateDialogParam(hInstance,MAKEINTRESOURCE(IDD_HISTORY),NULL,HistoryDlgProc,hContact);
+ hHistoryDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryDlgProc, hContact);
LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST);
- WindowList_Add(hWindowList,hHistoryDlg,hContact);
- }
+ WindowList_Add(hWindowList, hHistoryDlg, hContact);
+ }
else {
SetForegroundWindow(hHistoryDlg);
LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST);
SetFocus(hHistoryDlg);
}
-
- if (isAlert)
+
+ if (isAlert)
SkinPlaySound("LastSeenTrackedStatusChange");
}
@@ -304,4 +305,4 @@ void InitHistoryDialog(void)
void UninitHistoryDialog(void)
{
WindowList_Destroy(hWindowList);
-} \ No newline at end of file
+}
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp
index c59b7927e7..ad6f81bfad 100644
--- a/plugins/SeenPlugin/src/main.cpp
+++ b/plugins/SeenPlugin/src/main.cpp
@@ -22,11 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HINSTANCE hInstance;
HANDLE ehmissed = NULL, ehuserinfo = NULL, ehmissed_proto = NULL;
-HANDLE g_hShutdownEvent;
+HANDLE g_hShutdownEvent, g_pUserInfo;
int hLangpack;
-PLUGININFOEX pluginInfo={
+PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -37,25 +37,36 @@ PLUGININFOEX pluginInfo={
__AUTHORWEB,
UNICODE_AWARE,
// {2D506D46-C94E-4EF8-8537-F11233A80381}
- {0x2d506d46, 0xc94e, 0x4ef8, {0x85, 0x37, 0xf1, 0x12, 0x33, 0xa8, 0x03, 0x81}}
+ { 0x2d506d46, 0xc94e, 0x4ef8, { 0x85, 0x37, 0xf1, 0x12, 0x33, 0xa8, 0x03, 0x81 } }
};
#define TRANSNUMBER 2
-DBVTranslation idleTr[TRANSNUMBER]={
- {any_to_IdleNotidleUnknown, _T("Any to Idle/Not Idle/Unknown"),0},
- {any_to_Idle, _T("Any to /Idle or empty"),0}
+DBVTranslation idleTr[TRANSNUMBER] = {
+ { any_to_IdleNotidleUnknown, _T("Any to Idle/Not Idle/Unknown"), 0 },
+ { any_to_Idle, _T("Any to /Idle or empty"), 0 }
};
+static int CompareProtos(const char *p1, const char *p2)
+{ return mir_strcmp(p1, p2);
+}
+
BOOL includeIdle;
+LIST<char> arWatchedProtos(10, CompareProtos);
LIST<logthread_info> arContacts(16, NumericKeySortT);
-CRITICAL_SECTION csContacts;
+mir_cs csContacts;
void UninitHistoryDialog(void);
-int MainInit(WPARAM,LPARAM)
+int MainInit(WPARAM, LPARAM)
{
- if ( ServiceExists(MS_TIPPER_ADDTRANSLATION))
- for (int i=0; i < TRANSNUMBER; i++)
+ if (db_get_b(NULL, S_MOD, "MenuItem", 1))
+ InitMenuitem();
+
+ if (db_get_b(NULL, S_MOD, "UserinfoTab", 1))
+ ehuserinfo = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit);
+
+ if (ServiceExists(MS_TIPPER_ADDTRANSLATION))
+ for (int i = 0; i < TRANSNUMBER; i++)
CallService(MS_TIPPER_ADDTRANSLATION, 0, (LPARAM)&idleTr[i]);
return 0;
@@ -71,28 +82,24 @@ extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
- g_hShutdownEvent = CreateEvent(0, TRUE, FALSE, 0);
- InitializeCriticalSection(&csContacts);
+ g_pUserInfo = WindowList_Create();
+ g_hShutdownEvent = CreateEvent(0, TRUE, FALSE, 0);
HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues);
- HookEvent(ME_PROTO_ACK,ModeChange);
+ HookEvent(ME_PROTO_ACK, ModeChange);
- includeIdle = (BOOL )db_get_b(NULL,S_MOD,"IdleSupport",1);
-
- if ( db_get_b(NULL,S_MOD,"MenuItem",1))
- InitMenuitem();
-
- if ( db_get_b(NULL,S_MOD,"UserinfoTab",1))
- ehuserinfo = HookEvent(ME_USERINFO_INITIALISE,UserinfoInit);
+ includeIdle = (BOOL)db_get_b(NULL, S_MOD, "IdleSupport", 1);
- if ( db_get_b(NULL,S_MOD,"FileOutput",0))
+ if (db_get_b(NULL, S_MOD, "FileOutput", 0))
InitFileOutput();
- if ( db_get_b(NULL,S_MOD,"MissedOnes",0))
- ehmissed_proto = HookEvent(ME_PROTO_ACK,ModeChange_mo);
+ if (db_get_b(NULL, S_MOD, "MissedOnes", 0))
+ ehmissed_proto = HookEvent(ME_PROTO_ACK, ModeChange_mo);
+
+ LoadWatchedProtos();
SkinAddNewSoundExT("LastSeenTrackedStatusChange", LPGENT("LastSeen"), LPGENT("User status change"));
SkinAddNewSoundExT("LastSeenTrackedStatusOnline", LPGENT("LastSeen"), LPGENT("Changed to Online"));
@@ -108,10 +115,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD)
extern "C" __declspec(dllexport) int Unload(void)
{
+ UnloadWatchedProtos();
+
+ WindowList_Destroy(g_pUserInfo);
+
if (ehmissed)
UnhookEvent(ehmissed);
- DeleteCriticalSection(&csContacts);
CloseHandle(g_hShutdownEvent);
UninitHistoryDialog();
return 0;
@@ -119,6 +129,6 @@ extern "C" __declspec(dllexport) int Unload(void)
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
{
- hInstance=hinst;
+ hInstance = hinst;
return 1;
}
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp
index bf8e1e2709..1e07d649d7 100644
--- a/plugins/SeenPlugin/src/menu.cpp
+++ b/plugins/SeenPlugin/src/menu.cpp
@@ -25,16 +25,16 @@ HGENMENU hmenuitem = NULL;
void InitHistoryDialog(void);
-/*
-Handles the messages sent by clicking the contact's menu item
-*/
-INT_PTR MenuitemClicked(WPARAM wparam,LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Handles the messages sent by clicking the contact's menu item
+
+INT_PTR MenuitemClicked(WPARAM wparam, LPARAM)
{
ShowHistory((MCONTACT)wparam, 0);
return 0;
}
-int BuildContactMenu(WPARAM wparam,LPARAM)
+int BuildContactMenu(WPARAM wparam, LPARAM)
{
int id = -1, isetting;
MCONTACT hContact = (MCONTACT)wparam;
@@ -48,21 +48,21 @@ int BuildContactMenu(WPARAM wparam,LPARAM)
cmi.hIcon = NULL;
DBVARIANT dbv;
- if ( !db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
cmi.ptszName = ParseString(dbv.ptszVal, (MCONTACT)wparam, 0);
db_free(&dbv);
}
else cmi.ptszName = ParseString(DEFAULT_MENUSTAMP, (MCONTACT)wparam, 0);
-
- if ( !_tcscmp(cmi.ptszName, TranslateT("<unknown>"))) {
- if ( IsWatchedProtocol(szProto))
+
+ if (!_tcscmp(cmi.ptszName, TranslateT("<unknown>"))) {
+ if (IsWatchedProtocol(szProto))
cmi.flags |= CMIF_GRAYED;
else
- cmi.flags |= CMIF_HIDDEN;
+ cmi.flags |= CMIF_HIDDEN;
}
- else if ( db_get_b(NULL, S_MOD, "ShowIcon",1)) {
+ else if (db_get_b(NULL, S_MOD, "ShowIcon", 1)) {
isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1);
- cmi.hIcon = LoadSkinnedProtoIcon(szProto, isetting|0x8000);
+ cmi.hIcon = LoadSkinnedProtoIcon(szProto, isetting | 0x8000);
}
}
@@ -80,8 +80,8 @@ void InitMenuitem()
cmi.ptszName = LPGENT("<none>");
cmi.pszService = "LastSeenUserDetails";
hmenuitem = Menu_AddContactMenuItem(&cmi);
-
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildContactMenu);
+
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, BuildContactMenu);
InitHistoryDialog();
}
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp
index 0bdf701aa1..9ab533a554 100644
--- a/plugins/SeenPlugin/src/missed.cpp
+++ b/plugins/SeenPlugin/src/missed.cpp
@@ -24,7 +24,7 @@ MISSEDCONTACTS mcs;
WPARAM IsUserMissed(WPARAM contact)
{
- for (int loop=0; loop < mcs.count; loop++)
+ for (int loop = 0; loop < mcs.count; loop++)
if (mcs.wpcontact[loop] == contact)
return MAKEWPARAM(1, loop);
@@ -33,8 +33,8 @@ WPARAM IsUserMissed(WPARAM contact)
int RemoveUser(int pos)
{
- for(int loop=pos; loop < mcs.count-1; loop++)
- mcs.wpcontact[loop] = mcs.wpcontact[loop+1];
+ for (int loop = pos; loop < mcs.count - 1; loop++)
+ mcs.wpcontact[loop] = mcs.wpcontact[loop + 1];
mcs.count--;
return 0;
@@ -52,25 +52,25 @@ int ResetMissed(void)
int CheckIfOnline(void)
{
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if ( CallService(MS_CLIST_GETCONTACTICON, hContact, 0) != ICON_OFFLINE)
+ if (CallService(MS_CLIST_GETCONTACTICON, hContact, 0) != ICON_OFFLINE)
db_set_b(hContact, S_MOD, "Missed", 2);
return 0;
}
-INT_PTR CALLBACK MissedDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+INT_PTR CALLBACK MissedDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
POINT pt;
- RECT rcinit,rcresized,rcb,rcd;
+ RECT rcinit, rcresized, rcb, rcd;
HWND htemp;
-
- switch(msg) {
+
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
htemp = GetDlgItem(hdlg, IDC_CONTACTS);
GetWindowRect(htemp, &rcinit);
- SetWindowPos(htemp,NULL,0,0,rcinit.right-rcinit.left,mcs.count*(rcinit.bottom-rcinit.top)/2,SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
+ 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);
@@ -79,9 +79,9 @@ INT_PTR CALLBACK MissedDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
pt.y = rcb.top;
ScreenToClient(hdlg, &pt);
- MoveWindow(htemp,pt.x,pt.y+(rcresized.bottom-rcinit.bottom),(rcb.right-rcb.left),(rcb.bottom-rcb.top),FALSE);
+ 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);
@@ -106,9 +106,9 @@ int ShowMissed(void)
return 0;
TCHAR sztemp[1024], szcount[7];
- for (int loop=0; loop < mcs.count; loop++) {
+ for (int loop = 0; loop < mcs.count; loop++) {
_tcsncat(sztemp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, mcs.wpcontact[loop], GCDNF_TCHAR), SIZEOF(sztemp));
- if ( db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) {
+ if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) {
mir_sntprintf(szcount, SIZEOF(szcount), _T(" [%i]"), mcs.times[loop]);
_tcscat(sztemp, szcount);
}
@@ -120,28 +120,28 @@ int ShowMissed(void)
return 0;
}
-int Test(WPARAM wparam,LPARAM lparam)
+int Test(WPARAM wparam, LPARAM lparam)
{
if (lparam < ICON_OFFLINE || lparam > ICON_INVIS)
return 0;
- if (CallService(MS_IGNORE_ISIGNORED,wparam,IGNOREEVENT_USERONLINE))
+ if (CallService(MS_IGNORE_ISIGNORED, wparam, IGNOREEVENT_USERONLINE))
return 0;
- if ( db_get_b((MCONTACT)wparam,S_MOD,"Missed",0)==2)
+ if (db_get_b((MCONTACT)wparam, S_MOD, "Missed", 0) == 2)
return 0;
- switch(lparam) {
+ switch (lparam) {
case ICON_OFFLINE:
- if ( db_get_b((MCONTACT)wparam,S_MOD,"Missed",0) == 1) {
+ if (db_get_b((MCONTACT)wparam, S_MOD, "Missed", 0) == 1) {
WORD missed = IsUserMissed(wparam);
if (!LOWORD(missed)) {
- mcs.times[mcs.count]=1;
- mcs.wpcontact[mcs.count++]=wparam;
+ mcs.times[mcs.count] = 1;
+ mcs.wpcontact[mcs.count++] = wparam;
}
else mcs.times[HIWORD(missed)]++;
- db_set_b((MCONTACT)wparam,S_MOD,"Missed",0);
+ db_set_b((MCONTACT)wparam, S_MOD, "Missed", 0);
}
break;
@@ -152,21 +152,21 @@ int Test(WPARAM wparam,LPARAM lparam)
case ICON_DND:
case ICON_FREE:
case ICON_INVIS:
- db_set_b((MCONTACT)wparam,S_MOD,"Missed",1);
+ db_set_b((MCONTACT)wparam, S_MOD, "Missed", 1);
break;
}
-
+
return 0;
}
-int ModeChange_mo(WPARAM,LPARAM lparam)
+int ModeChange_mo(WPARAM, LPARAM lparam)
{
ACKDATA *ack = (ACKDATA *)lparam;
if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS || ack->hContact != NULL)
return 0;
int isetting = CallProtoService(ack->szModule, PS_GETSTATUS, 0, 0);
- switch(isetting) {
+ switch (isetting) {
case ID_STATUS_AWAY:
case ID_STATUS_DND:
case ID_STATUS_NA:
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp
index 0ff04ffa9c..1d84184131 100644
--- a/plugins/SeenPlugin/src/options.cpp
+++ b/plugins/SeenPlugin/src/options.cpp
@@ -30,48 +30,49 @@ int ModeChange_mo(WPARAM,LPARAM);
int CheckIfOnline(void);
int ResetMissed(void);
-INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
DBVARIANT dbv;
TCHAR szstamp[256];
BOOL hasPopups;
BYTE bchecked;
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
if (hasPopups = (ServiceExists(MS_POPUP_QUERY)) != 0)
- hasPopups = CallService(MS_POPUP_QUERY,PUQS_GETSTATUS,0);
+ hasPopups = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
+
TranslateDialogDefault(hdlg);
- 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) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hdlg, IDC_POPUPS),hasPopups);
+ 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) ? BST_CHECKED : BST_UNCHECKED);
+ 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++) {
+ 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];
mir_snprintf(szSetting, SIZEOF(szSetting), "Col_%d", i - ID_STATUS_OFFLINE);
- DWORD 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);
+ SendDlgItemMessage(hdlg, i + 20, CPM_SETCOLOUR, 0, text);
+ EnableWindow(GetDlgItem(hdlg, i), hasPopups);
+ EnableWindow(GetDlgItem(hdlg, i + 20), hasPopups);
}
- if ( !db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_POPUPSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_POPUPSTAMP, DEFAULT_POPUPSTAMP);
- if ( !db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) {
SetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, dbv.ptszVal);
db_free(&dbv);
}
@@ -79,54 +80,54 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
break;
case WM_COMMAND:
- if (( HIWORD(wparam) == BN_CLICKED || HIWORD(wparam) == EN_CHANGE) && GetFocus() == (HWND)lparam)
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ if ((HIWORD(wparam) == BN_CLICKED || HIWORD(wparam) == EN_CHANGE) && GetFocus() == (HWND)lparam)
+ SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
else if (HIWORD(wparam) == CPN_COLOURCHANGED) {
WORD idText, idBack;
- POPUPDATAT ppd = {0};
- DBVARIANT dbv = {0};
+ POPUPDATAT ppd = { 0 };
+ DBVARIANT dbv = { 0 };
DWORD temp;
if (LOWORD(wparam) > ID_STATUS_OUTTOLUNCH) // we have clicked a text color
- idText = wparam, idBack = wparam-20;
+ idText = wparam, idBack = wparam - 20;
else
- idText = wparam+20, idBack = wparam;
-
- 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);
+ idText = wparam + 20, idBack = wparam;
+
+ 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);
ppd.lchIcon = LoadSkinnedProtoIcon(NULL, idBack);
GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
- _tcsncpy(ppd.lptzContactName, ParseString(szstamp,NULL,0), MAX_CONTACTNAME);
+ _tcsncpy(ppd.lptzContactName, ParseString(szstamp, NULL, 0), MAX_CONTACTNAME);
GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
- _tcsncpy(ppd.lptzText, ParseString(szstamp,NULL,0), MAX_SECONDLINE);
+ _tcsncpy(ppd.lptzText, ParseString(szstamp, NULL, 0), MAX_SECONDLINE);
PUAddPopupT(&ppd);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
- }
+ }
if (HIWORD(wparam) == BN_CLICKED) {
- switch(LOWORD(wparam)) {
+ switch (LOWORD(wparam)) {
case IDC_POPUPS:
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);
+ 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 (int i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- DWORD sett = StatusColors15bits[i-ID_STATUS_OFFLINE];
+ 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);
SendDlgItemMessage(hdlg, i, CPM_SETCOLOUR, 0, back);
- SendDlgItemMessage(hdlg, i+20, CPM_SETCOLOUR, 0, text);
+ SendDlgItemMessage(hdlg, i + 20, CPM_SETCOLOUR, 0, text);
}
break;
}
@@ -134,28 +135,28 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
break; //case WM_COMMAND
case WM_NOTIFY:
- switch(((LPNMHDR)lparam)->idFrom) {
- case 0:
+ switch (((LPNMHDR)lparam)->idFrom) {
+ case 0:
switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
db_set_ts(NULL, S_MOD, "PopupStamp", szstamp);
-
+
GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
db_set_ts(NULL, S_MOD, "PopupStampText", szstamp);
bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_POPUPS);
- if ( db_get_b(NULL,S_MOD,"UsePopups",0) != bchecked)
+ if (db_get_b(NULL, S_MOD, "UsePopups", 0) != bchecked)
db_set_b(NULL, S_MOD, "UsePopups", bchecked);
- for (int i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ 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);
+ COLORREF text = SendDlgItemMessage(hdlg, i + 20, CPM_GETCOLOUR, 0, 0);
DWORD sett = GetDWordFromColors(back, text);
char szSetting[100];
mir_snprintf(szSetting, SIZEOF(szSetting), "Col_%d", i - ID_STATUS_OFFLINE);
- if (sett != StatusColors15bits[i-ID_STATUS_OFFLINE])
+ if (sett != StatusColors15bits[i - ID_STATUS_OFFLINE])
db_set_dw(NULL, S_MOD, szSetting, sett);
else
db_unset(NULL, S_MOD, szSetting);
@@ -170,70 +171,70 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara
return 0;
}
-INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
DBVARIANT dbv;
TCHAR szstamp[256];
BYTE bchecked;
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- CheckDlgButton(hdlg, IDC_MENUITEM,db_get_b(NULL,S_MOD,"MenuItem",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_USERINFO,db_get_b(NULL,S_MOD,"UserinfoTab",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_FILE,db_get_b(NULL,S_MOD,"FileOutput",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_HISTORY,db_get_b(NULL,S_MOD,"KeepHistory",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_IGNOREOFFLINE,db_get_b(NULL,S_MOD,"IgnoreOffline",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_MISSEDONES,db_get_b(NULL,S_MOD,"MissedOnes",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_SHOWICON,db_get_b(NULL,S_MOD,"ShowIcon",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_COUNT,db_get_b(NULL,S_MOD,"MissedOnes_Count",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_IDLESUPPORT,db_get_b(NULL,S_MOD,"IdleSupport",1) ? BST_CHECKED : BST_UNCHECKED);
-
- 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 ( !db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
+ CheckDlgButton(hdlg, IDC_MENUITEM, db_get_b(NULL, S_MOD, "MenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_USERINFO, db_get_b(NULL, S_MOD, "UserinfoTab", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_FILE, db_get_b(NULL, S_MOD, "FileOutput", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_HISTORY, db_get_b(NULL, S_MOD, "KeepHistory", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_IGNOREOFFLINE, db_get_b(NULL, S_MOD, "IgnoreOffline", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_MISSEDONES, db_get_b(NULL, S_MOD, "MissedOnes", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_SHOWICON, db_get_b(NULL, S_MOD, "ShowIcon", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_COUNT, db_get_b(NULL, S_MOD, "MissedOnes_Count", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_IDLESUPPORT, db_get_b(NULL, S_MOD, "IdleSupport", 1) ? BST_CHECKED : BST_UNCHECKED);
+
+ 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 (!db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_MENUSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_MENUSTAMP, DEFAULT_MENUSTAMP);
- if ( !db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_USERSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_USERSTAMP, DEFAULT_USERSTAMP);
- if ( !db_get_ts(NULL, S_MOD, "FileStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "FileStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_FILESTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_FILESTAMP, DEFAULT_FILESTAMP);
- if ( !db_get_ts(NULL, S_MOD, "FileName", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "FileName", &dbv)) {
SetDlgItemText(hdlg, IDC_FILENAME, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_FILENAME, DEFAULT_FILENAME);
- if ( !db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_HISTORYSTAMP, dbv.ptszVal);
db_free(&dbv);
}
else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, 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;
tvis.hInsertAfter = TVI_LAST;
@@ -244,14 +245,14 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
int numberOfProtocols;
ProtoEnumAccounts(&numberOfProtocols, &protos);
- for (int i=0; i < numberOfProtocols; i++) {
- if ( CallProtoService(protos[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
+ for (int i = 0; i < numberOfProtocols; i++) {
+ if (CallProtoService(protos[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
continue;
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);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK(IsWatchedProtocol(protos[i]->szModuleName) + 1);
+ TreeView_InsertItem(GetDlgItem(hdlg, IDC_PROTOCOLLIST), &tvis);
}
}
break;
@@ -259,27 +260,27 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
case WM_COMMAND:
if ((HIWORD(wparam) == BN_CLICKED || HIWORD(wparam) == EN_CHANGE) && GetFocus() == (HWND)lparam)
if (LOWORD(wparam) != IDC_VARIABLES)
- SendMessage( GetParent(hdlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
if (HIWORD(wparam) == BN_CLICKED) {
- switch(LOWORD(wparam)) {
+ 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;
}
}
@@ -292,8 +293,8 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
break; //case WM_COMMAND
case WM_NOTIFY:
- switch(((LPNMHDR)lparam)->idFrom) {
- case 0:
+ switch (((LPNMHDR)lparam)->idFrom) {
+ case 0:
switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
GetDlgItemText(hdlg, IDC_MENUSTAMP, szstamp, SIZEOF(szstamp));
@@ -311,67 +312,66 @@ 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);
- if ( db_get_b(NULL,S_MOD,"MenuItem",1) != bchecked) {
- db_set_b(NULL,S_MOD,"MenuItem",bchecked);
+ 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);
- if ( db_get_b(NULL,S_MOD,"UserinfoTab",1) != bchecked) {
- db_set_b(NULL,S_MOD,"UserinfoTab",bchecked);
+ if (db_get_b(NULL, S_MOD, "UserinfoTab", 1) != bchecked) {
+ db_set_b(NULL, S_MOD, "UserinfoTab", bchecked);
if (bchecked)
- ehuserinfo = HookEvent(ME_USERINFO_INITIALISE,UserinfoInit);
+ ehuserinfo = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit);
else
UnhookEvent(ehuserinfo);
}
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 (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);
- if ( db_get_b(NULL,S_MOD,"KeepHistory",0) != bchecked)
- db_set_b(NULL,S_MOD,"KeepHistory",bchecked);
+ if (db_get_b(NULL, S_MOD, "KeepHistory", 0) != bchecked)
+ db_set_b(NULL, S_MOD, "KeepHistory", bchecked);
bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_IGNOREOFFLINE);
- if ( db_get_b(NULL,S_MOD,"IgnoreOffline",1) != bchecked)
- db_set_b(NULL,S_MOD,"IgnoreOffline",bchecked);
+ if (db_get_b(NULL, S_MOD, "IgnoreOffline", 1) != bchecked)
+ db_set_b(NULL, S_MOD, "IgnoreOffline", bchecked);
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 (db_get_b(NULL, S_MOD, "MissedOnes", 0) != bchecked) {
+ db_set_b(NULL, S_MOD, "MissedOnes", bchecked);
if (bchecked)
- ehmissed_proto = HookEvent(ME_PROTO_ACK,ModeChange_mo);
+ ehmissed_proto = HookEvent(ME_PROTO_ACK, ModeChange_mo);
else
UnhookEvent(ehmissed_proto);
}
bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_SHOWICON);
- if ( db_get_b(NULL,S_MOD,"ShowIcon",1) != bchecked)
- db_set_b(NULL,S_MOD,"ShowIcon",bchecked);
+ if (db_get_b(NULL, S_MOD, "ShowIcon", 1) != bchecked)
+ db_set_b(NULL, S_MOD, "ShowIcon", bchecked);
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);
+ 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);
- if ( db_get_b(NULL,S_MOD,"IdleSupport",1) != includeIdle)
- db_set_b(NULL,S_MOD,"IdleSupport",(BYTE)includeIdle);
+ 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);
char *protocol;
- int size=1;
+ int size = 1;
- char *watchedProtocols = (char *)malloc(sizeof(char));
- *watchedProtocols = '\0';
+ CMStringA watchedProtocols;
HTREEITEM hItem = TreeView_GetRoot(hwndTreeView);
TVITEM tvItem;
@@ -382,32 +382,34 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
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, " ");
+ if ((BOOL)(tvItem.state >> 12) - 1) {
+ size += (int)strlen(protocol) + 2;
+ if (!watchedProtocols.IsEmpty())
+ watchedProtocols.AppendChar(' ');
+ watchedProtocols.Append(protocol);
}
hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
}
- db_set_s(NULL,S_MOD,"WatchedProtocols",watchedProtocols);
- free(watchedProtocols);
+ db_set_s(NULL, S_MOD, "WatchedProtocols", watchedProtocols);
+
+ UnloadWatchedProtos();
+ LoadWatchedProtos();
}
break; //case 0
case IDC_PROTOCOLLIST:
if (((LPNMHDR)lparam)->code == NM_CLICK) {
- HWND hTree=((LPNMHDR)lparam)->hwndFrom;
+ 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)
+ 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);
}
}
@@ -416,18 +418,16 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
case WM_DESTROY:
// free protocol list
- {
- HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST);
- HTREEITEM hItem = TreeView_GetRoot(hwndTreeView);
- TVITEM tvItem;
- tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
-
- while (hItem != NULL) {
- tvItem.hItem = hItem;
- TreeView_GetItem(hwndTreeView, &tvItem);
- mir_free((void *)tvItem.lParam);
- hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
- }
+ HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST);
+ HTREEITEM hItem = TreeView_GetRoot(hwndTreeView);
+ TVITEM tvItem;
+ tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
+
+ while (hItem != NULL) {
+ tvItem.hItem = hItem;
+ TreeView_GetItem(hwndTreeView, &tvItem);
+ mir_free((void *)tvItem.lParam);
+ hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
}
break;
}
@@ -435,19 +435,19 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa
return 0;
}
-int OptionsInit(WPARAM wparam,LPARAM)
+int OptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
odp.hInstance = hInstance;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETTINGS);
odp.ptszGroup = LPGENT("Contacts");
odp.ptszTitle = LPGENT("Last seen");
odp.pfnDlgProc = OptsSettingsDlgProc;
Options_AddPage(wparam, &odp);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS);
odp.ptszGroup = LPGENT("Popups");
odp.ptszTitle = LPGENT("Last seen");
diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h
index fb548780f9..543ea214d0 100644
--- a/plugins/SeenPlugin/src/seen.h
+++ b/plugins/SeenPlugin/src/seen.h
@@ -46,6 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_popup.h>
#include <m_ignore.h>
#include <m_button.h>
+#include <m_string.h>
#include <m_tipper.h>
@@ -74,7 +75,9 @@ WCHAR *any_to_Idle(MCONTACT hContact, const char *module_name, const char *setti
#define ICON_OCC 17
#define ICON_DND 18
#define ICON_FREE 19
-#define ICON_INVIS 20
+#define ICON_INVIS 20
+
+#define WM_REFRESH_UI (WM_USER+10)
#define DEFAULT_MENUSTAMP _T("%d.%m.%Y - %H:%M [%s]")
#define DEFAULT_POPUPSTAMP TranslateT("%n is %s (%u)")
@@ -118,10 +121,14 @@ struct logthread_info
extern HINSTANCE hInstance;
extern DWORD StatusColors15bits[];
extern BOOL includeIdle;
-extern HANDLE ehmissed;
-extern HANDLE ehuserinfo, ehmissed_proto;
+extern HANDLE ehmissed, ehuserinfo, ehmissed_proto;
+extern HANDLE g_pUserInfo;
extern HGENMENU hmenuitem;
extern DWORD dwmirver;
+void LoadWatchedProtos();
+void UnloadWatchedProtos();
+extern LIST<char> arWatchedProtos;
+
extern LIST<logthread_info> arContacts;
-extern CRITICAL_SECTION csContacts; \ No newline at end of file
+extern mir_cs csContacts;
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp
index db6760389a..197d2d290c 100644
--- a/plugins/SeenPlugin/src/userinfo.cpp
+++ b/plugins/SeenPlugin/src/userinfo.cpp
@@ -20,47 +20,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "seen.h"
-LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+LRESULT CALLBACK EditProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- switch(msg){
+ switch (msg) {
case WM_SETCURSOR:
- SetCursor(LoadCursor(NULL,IDC_ARROW));
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
return 1;
}
return mir_callNextSubclass(hdlg, EditProc, msg, wparam, lparam);
}
-INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- DBVARIANT dbv;
-
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
- mir_subclassWindow( GetDlgItem(hdlg, IDC_INFOTEXT), EditProc);
+ mir_subclassWindow(GetDlgItem(hdlg, IDC_INFOTEXT), EditProc);
+ WindowList_Add(g_pUserInfo, hdlg, lparam);
+ SendMessage(hdlg, WM_REFRESH_UI, lparam, 0);
+ break;
+
+ case WM_REFRESH_UI:
{
- TCHAR *szout;
- if ( !db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) {
- szout = ParseString(dbv.ptszVal, (MCONTACT)lparam, 0);
- db_free(&dbv);
- }
- else szout = ParseString(DEFAULT_USERSTAMP, (MCONTACT)lparam, 0);
+ ptrT szout(db_get_tsa(NULL, S_MOD, "UserStamp"));
+ TCHAR *str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, wparam, 0);
+ SetDlgItemText(hdlg, IDC_INFOTEXT, str);
- SetDlgItemText(hdlg, IDC_INFOTEXT, szout);
- if ( !mir_tstrcmp(szout, TranslateT("<unknown>")))
- EnableWindow( GetDlgItem(hdlg, IDC_INFOTEXT), FALSE);
+ if (!mir_tstrcmp(str, TranslateT("<unknown>")))
+ EnableWindow(GetDlgItem(hdlg, IDC_INFOTEXT), FALSE);
}
break;
case WM_COMMAND:
if (HIWORD(wparam) == EN_SETFOCUS)
- SetFocus( GetParent(hdlg));
+ SetFocus(GetParent(hdlg));
+ break;
+
+ case WM_DESTROY:
+ WindowList_Remove(g_pUserInfo, hdlg);
break;
}
return 0;
}
-int UserinfoInit(WPARAM wparam,LPARAM lparam)
+int UserinfoInit(WPARAM wparam, LPARAM lparam)
{
MCONTACT hContact = (MCONTACT)lparam;
char *szProto = GetContactProto(hContact);
@@ -69,8 +72,7 @@ int UserinfoInit(WPARAM wparam,LPARAM lparam)
OPTIONSDIALOGPAGE uip = { sizeof(uip) };
uip.hInstance = hInstance;
uip.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
- uip.flags = ODPF_TCHAR;
- uip.ptszTitle = LPGENT("Last seen");
+ uip.pszTitle = LPGEN("Last seen");
uip.pfnDlgProc = UserinfoDlgProc;
UserInfo_AddPage(wparam, &uip);
}
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index a0e28b90e1..ea830618b1 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -24,36 +24,37 @@ void FileWrite(MCONTACT);
void HistoryWrite(MCONTACT hcontact);
extern HANDLE g_hShutdownEvent;
-char * courProtoName = 0;
+char *courProtoName = 0;
+
+void LoadWatchedProtos()
+{
+ ptrA szProtos(db_get_sa(NULL, S_MOD, "WatchedProtocols"));
+ if (szProtos == NULL)
+ return;
+
+ for (char *p = strtok(szProtos, " "); p != NULL; p = strtok(NULL, " "))
+ arWatchedProtos.insert(mir_strdup(p));
+}
+
+void UnloadWatchedProtos()
+{
+ for (int i = 0; i < arWatchedProtos.getCount(); i++)
+ mir_free(arWatchedProtos[i]);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Returns true if the protocols is to be monitored
-/*
-Returns true if the protocols is to be monitored
-*/
int IsWatchedProtocol(const char* szProto)
{
if (szProto == NULL)
return 0;
-
+
PROTOACCOUNT *pd = ProtoGetAccount(szProto);
if (pd == NULL || CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
return 0;
- int iProtoLen = (int)strlen(szProto);
- char *szWatched;
- DBVARIANT dbv;
- if ( db_get_s(NULL, S_MOD, "WatchedProtocols", &dbv))
- szWatched = DEFAULT_WATCHEDPROTOCOLS;
- else {
- szWatched = NEWSTR_ALLOCA(dbv.pszVal);
- db_free(&dbv);
- }
-
- if (*szWatched == '\0')
- return 1; //empty string: all protocols are watched
-
- char sTemp[MAXMODULELABELLENGTH+1];
- mir_snprintf(sTemp, SIZEOF(sTemp), "%s ", szProto);
- return strstr(szWatched, sTemp) != NULL;
+ return arWatchedProtos.find((char*)szProto) != NULL;
}
BOOL isYahoo(char *protoname)
@@ -100,10 +101,10 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st)
{
FILETIME ft;
ULONGLONG ll;
- DWORD res = db_get_dw(hcontact,S_MOD,"seenTS",0);
+ DWORD res = db_get_dw(hcontact, S_MOD, "seenTS", 0);
if (res) {
if (st) {
- ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,res,0), 10000000) + NUM100NANOSEC;
+ ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, res, 0), 10000000) + NUM100NANOSEC;
ft.dwLowDateTime = (DWORD)ll;
ft.dwHighDateTime = (DWORD)(ll >> 32);
FileTimeToSystemTime(&ft, st);
@@ -113,26 +114,28 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st)
SYSTEMTIME lst;
memset(&lst, 0, sizeof(lst));
- if (lst.wYear = db_get_w(hcontact,S_MOD,"Year",0)) {
- if (lst.wMonth = db_get_w(hcontact,S_MOD,"Month",0)) {
- if (lst.wDay = db_get_w(hcontact,S_MOD,"Day",0)) {
- lst.wDayOfWeek = db_get_w(hcontact,S_MOD,"WeekDay",0);
- lst.wHour = db_get_w(hcontact,S_MOD,"Hours",0);
- lst.wMinute = db_get_w(hcontact,S_MOD,"Minutes",0);
- lst.wSecond = db_get_w(hcontact,S_MOD,"Seconds",0);
- if (SystemTimeToFileTime(&lst,&ft)) {
- ll = ((LONGLONG)ft.dwHighDateTime<<32)|((LONGLONG)ft.dwLowDateTime);
+ if (lst.wYear = db_get_w(hcontact, S_MOD, "Year", 0)) {
+ if (lst.wMonth = db_get_w(hcontact, S_MOD, "Month", 0)) {
+ if (lst.wDay = db_get_w(hcontact, S_MOD, "Day", 0)) {
+ lst.wDayOfWeek = db_get_w(hcontact, S_MOD, "WeekDay", 0);
+ lst.wHour = db_get_w(hcontact, S_MOD, "Hours", 0);
+ lst.wMinute = db_get_w(hcontact, S_MOD, "Minutes", 0);
+ lst.wSecond = db_get_w(hcontact, S_MOD, "Seconds", 0);
+ if (SystemTimeToFileTime(&lst, &ft)) {
+ ll = ((LONGLONG)ft.dwHighDateTime << 32) | ((LONGLONG)ft.dwLowDateTime);
ll -= NUM100NANOSEC;
ll /= 10000000;
//perform LOCALTOTIMESTAMP
- res = (DWORD)ll - CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,0,0);
+ res = (DWORD)ll - CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, 0, 0);
//nevel look for Year/Month/Day/Hour/Minute/Second again
- db_set_dw(hcontact,S_MOD,"seenTS",res);
+ db_set_dw(hcontact, S_MOD, "seenTS", res);
}
- } } }
+ }
+ }
+ }
if (st)
- memcpy (st, &lst, sizeof (SYSTEMTIME));
+ memcpy(st, &lst, sizeof(SYSTEMTIME));
return res;
}
@@ -145,18 +148,18 @@ TCHAR *mnames_short[] = { LPGENT("Jan."), LPGENT("Feb."), LPGENT("Mar."), LPGENT
TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
{
#define MAXSIZE 1024
- static TCHAR sztemp[MAXSIZE+1];
+ static TCHAR sztemp[MAXSIZE + 1];
TCHAR szdbsetting[128];
TCHAR *charPtr;
- int isetting=0;
- DWORD dwsetting=0;
+ int isetting = 0;
+ DWORD dwsetting = 0;
struct in_addr ia;
DBVARIANT dbv;
sztemp[0] = '\0';
SYSTEMTIME st;
- if ( !isSeen(hcontact, &st)) {
+ if (!isSeen(hcontact, &st)) {
_tcscat(sztemp, TranslateT("<never seen>"));
return sztemp;
}
@@ -170,13 +173,13 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
if (d >= sztemp + MAXSIZE)
break;
- if (*p != '%' && *p !='#') {
+ if (*p != '%' && *p != '#') {
*d++ = *p;
continue;
}
- bool wantempty = *p =='#';
- switch(*++p) {
+ bool wantempty = *p == '#';
+ switch (*++p) {
case 'Y':
if (!st.wYear) goto LBL_noData;
d += _stprintf(d, _T("%04i"), st.wYear); //!!!!!!!!!!!!
@@ -188,8 +191,8 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
break;
case 'm':
- if (!(isetting=st.wMonth)) goto LBL_noData;
-LBL_2DigNum:
+ if (!(isetting = st.wMonth)) goto LBL_noData;
+ LBL_2DigNum:
d += _stprintf(d, _T("%02i"), isetting); //!!!!!!!!!!!!
break;
@@ -199,30 +202,30 @@ LBL_2DigNum:
case 'W':
isetting = st.wDayOfWeek;
- if (isetting == -1){
-LBL_noData:
+ if (isetting == -1) {
+ LBL_noData:
charPtr = wantempty ? _T("") : TranslateT("<unknown>");
goto LBL_charPtr;
}
charPtr = TranslateTS(weekdays[isetting]);
-LBL_charPtr:
- d += mir_sntprintf(d, MAXSIZE-(d-sztemp), _T("%s"), charPtr);
+ LBL_charPtr:
+ d += mir_sntprintf(d, MAXSIZE - (d - sztemp), _T("%s"), charPtr);
break;
case 'w':
isetting = st.wDayOfWeek;
if (isetting == -1) goto LBL_noData;
- charPtr = TranslateTS( wdays_short[isetting] );
+ charPtr = TranslateTS(wdays_short[isetting]);
goto LBL_charPtr;
case 'E':
- if ( !(isetting = st.wMonth)) goto LBL_noData;
- charPtr = TranslateTS( monthnames[isetting-1] );
+ if (!(isetting = st.wMonth)) goto LBL_noData;
+ charPtr = TranslateTS(monthnames[isetting - 1]);
goto LBL_charPtr;
case 'e':
- if ( !(isetting = st.wMonth)) goto LBL_noData;
- charPtr = TranslateTS( mnames_short[isetting-1] );
+ if (!(isetting = st.wMonth)) goto LBL_noData;
+ charPtr = TranslateTS(mnames_short[isetting - 1]);
goto LBL_charPtr;
case 'H':
@@ -232,7 +235,7 @@ LBL_charPtr:
case 'h':
if ((isetting = st.wHour) == -1) goto LBL_noData;
if (!isetting) isetting = 12;
- isetting = isetting-((isetting>12)?12:0);
+ isetting = isetting - ((isetting > 12) ? 12 : 0);
goto LBL_2DigNum;
case 'p':
@@ -254,14 +257,14 @@ LBL_charPtr:
case 'N':
ci.dwFlag = CNF_NICK | CNF_TCHAR;
- if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
charPtr = ci.pszVal;
goto LBL_charPtr;
}
goto LBL_noData;
case 'G':
- if ( !db_get_ts(hcontact, "CList", "Group", &dbv)) {
+ if (!db_get_ts(hcontact, "CList", "Group", &dbv)) {
_tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
db_free(&dbv);
charPtr = szdbsetting;
@@ -271,8 +274,8 @@ LBL_charPtr:
case 'u':
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
- if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
- switch(ci.type) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ switch (ci.type) {
case CNFT_BYTE:
_ltot(ci.bVal, szdbsetting, 10);
break;
@@ -292,9 +295,9 @@ LBL_charPtr:
goto LBL_charPtr;
case 's':
- if (isetting = db_get_w(hcontact,S_MOD,hcontact ? "StatusTriger" : courProtoName, 0)) {
- _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting|0x8000), GSMDF_TCHAR), SIZEOF(szdbsetting));
- if ( !(isetting & 0x8000)) {
+ if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "StatusTriger" : courProtoName, 0)) {
+ _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting | 0x8000), GSMDF_TCHAR), SIZEOF(szdbsetting));
+ if (!(isetting & 0x8000)) {
_tcsncat(szdbsetting, _T("/"), SIZEOF(szdbsetting));
_tcsncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting));
}
@@ -304,16 +307,16 @@ LBL_charPtr:
goto LBL_noData;
case 'T':
- if ( db_get_ts(hcontact, "CList", "StatusMsg", &dbv))
+ if (db_get_ts(hcontact, "CList", "StatusMsg", &dbv))
goto LBL_noData;
- d += mir_sntprintf(d, MAXSIZE-(d-sztemp), _T("%s"), dbv.ptszVal);
+ d += mir_sntprintf(d, MAXSIZE - (d - sztemp), _T("%s"), dbv.ptszVal);
db_free(&dbv);
break;
case 'o':
if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) {
- _tcsncpy(szdbsetting, (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), SIZEOF(szdbsetting));
if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) {
_tcsncat(szdbsetting, _T("/"), SIZEOF(szdbsetting));
_tcsncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting));
@@ -325,8 +328,8 @@ LBL_charPtr:
case 'i':
case 'r':
- if ( isJabber(ci.szProto)) {
- if ( db_get_ts(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
+ if (isJabber(ci.szProto)) {
+ if (db_get_ts(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
goto LBL_noData;
_tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
@@ -339,7 +342,7 @@ LBL_charPtr:
goto LBL_noData;
ia.S_un.S_addr = htonl(dwsetting);
- _tcsncpy(szdbsetting, _A2T( inet_ntoa(ia)), SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, _A2T(inet_ntoa(ia)), SIZEOF(szdbsetting));
charPtr = szdbsetting;
}
goto LBL_charPtr;
@@ -354,7 +357,7 @@ LBL_charPtr:
goto LBL_charPtr;
case 'C': // Get Client Info
- if ( !db_get_ts(hcontact, ci.szProto, "MirVer", &dbv)) {
+ if (!db_get_ts(hcontact, ci.szProto, "MirVer", &dbv)) {
_tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
db_free(&dbv);
}
@@ -367,14 +370,14 @@ LBL_charPtr:
goto LBL_charPtr;
case 'A':
- {
+ {
PROTOACCOUNT *pa = ProtoGetAccount(ci.szProto);
- if(!pa) goto LBL_noData;
+ if (!pa) goto LBL_noData;
_tcsncpy(szdbsetting, pa->tszAccountName, SIZEOF(szdbsetting));
charPtr = szdbsetting;
goto LBL_charPtr;
- }
-
+ }
+
default:
*d++ = p[-1];
@@ -388,39 +391,41 @@ LBL_charPtr:
void _DBWriteTime(SYSTEMTIME *st, MCONTACT hcontact)
{
- db_set_w(hcontact,S_MOD,"Day",st->wDay);
- db_set_w(hcontact,S_MOD,"Month",st->wMonth);
- db_set_w(hcontact,S_MOD,"Year",st->wYear);
- db_set_w(hcontact,S_MOD,"Hours",st->wHour);
- db_set_w(hcontact,S_MOD,"Minutes",st->wMinute);
- db_set_w(hcontact,S_MOD,"Seconds",st->wSecond);
- db_set_w(hcontact,S_MOD,"WeekDay",st->wDayOfWeek);
+ db_set_w(hcontact, S_MOD, "Day", st->wDay);
+ db_set_w(hcontact, S_MOD, "Month", st->wMonth);
+ db_set_w(hcontact, S_MOD, "Year", st->wYear);
+ db_set_w(hcontact, S_MOD, "Hours", st->wHour);
+ db_set_w(hcontact, S_MOD, "Minutes", st->wMinute);
+ db_set_w(hcontact, S_MOD, "Seconds", st->wSecond);
+ db_set_w(hcontact, S_MOD, "WeekDay", st->wDayOfWeek);
}
-void DBWriteTimeTS(DWORD t, MCONTACT hcontact){
+void DBWriteTimeTS(DWORD t, MCONTACT hcontact)
+{
SYSTEMTIME st;
FILETIME ft;
- ULONGLONG ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,t,0), 10000000) + NUM100NANOSEC;
+ ULONGLONG ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, t, 0), 10000000) + NUM100NANOSEC;
ft.dwLowDateTime = (DWORD)ll;
ft.dwHighDateTime = (DWORD)(ll >> 32);
FileTimeToSystemTime(&ft, &st);
- db_set_dw(hcontact,S_MOD,"seenTS",t);
+ db_set_dw(hcontact, S_MOD, "seenTS", t);
_DBWriteTime(&st, hcontact);
}
-void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword){
+void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword)
+{
WORD temp;
- COLORREF res=0;
- temp = (WORD)(colDword>>16);
- res |= ((temp & 0x1F) <<3);
- res |= ((temp & 0x3E0) <<6);
- res |= ((temp & 0x7C00) <<9);
+ COLORREF res = 0;
+ temp = (WORD)(colDword >> 16);
+ res |= ((temp & 0x1F) << 3);
+ res |= ((temp & 0x3E0) << 6);
+ res |= ((temp & 0x7C00) << 9);
if (First) *First = res;
res = 0;
temp = (WORD)colDword;
- res |= ((temp & 0x1F) <<3);
- res |= ((temp & 0x3E0) <<6);
- res |= ((temp & 0x7C00) <<9);
+ res |= ((temp & 0x1F) << 3);
+ res |= ((temp & 0x3E0) << 6);
+ res |= ((temp & 0x7C00) << 9);
if (Second) *Second = res;
}
@@ -437,63 +442,65 @@ DWORD StatusColors15bits[] = {
0x5EFD0000, // 0x00B8B8E8, 0x00000000, Out to lunch
};
-DWORD GetDWordFromColors(COLORREF First, COLORREF Second){
+DWORD GetDWordFromColors(COLORREF First, COLORREF Second)
+{
DWORD res = 0;
- res |= (First&0xF8)>>3;
- res |= (First&0xF800)>>6;
- res |= (First&0xF80000)>>9;
+ res |= (First & 0xF8) >> 3;
+ res |= (First & 0xF800) >> 6;
+ res |= (First & 0xF80000) >> 9;
res <<= 16;
- res |= (Second&0xF8)>>3;
- res |= (Second&0xF800)>>6;
- res |= (Second&0xF80000)>>9;
+ res |= (Second & 0xF8) >> 3;
+ res |= (Second & 0xF800) >> 6;
+ res |= (Second & 0xF80000) >> 9;
return res;
}
-LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
+LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
- switch(message) {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED){
- MCONTACT hContact = PUGetContact(hwnd);
- if (hContact > 0) CallService(MS_MSG_SENDMESSAGE,hContact,0);
- }
- case WM_CONTEXTMENU:
- PUDeletePopup(hwnd);
- break;
- case UM_INITPOPUP: return 0;
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ MCONTACT hContact = PUGetContact(hwnd);
+ if (hContact > 0) CallService(MS_MSG_SENDMESSAGE, hContact, 0);
+ }
+ case WM_CONTEXTMENU:
+ PUDeletePopup(hwnd);
+ break;
+ case UM_INITPOPUP: return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
};
void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus)
{
- if ( CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE))
+ if (CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE))
return;
- if ( !ServiceExists(MS_POPUP_QUERY))
+ if (!ServiceExists(MS_POPUP_QUERY))
return;
- if ( !db_get_b(NULL, S_MOD, "UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0))
+ if (!db_get_b(NULL, S_MOD, "UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0))
return;
DBVARIANT dbv;
char szSetting[10];
mir_snprintf(szSetting, SIZEOF(szSetting), "Col_%d", newStatus - ID_STATUS_OFFLINE);
- DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[newStatus-ID_STATUS_OFFLINE]);
+ DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[newStatus - ID_STATUS_OFFLINE]);
- POPUPDATAT ppd = {0};
- GetColorsFromDWord(&ppd.colorBack,&ppd.colorText,sett);
+ POPUPDATAT ppd = { 0 };
+ GetColorsFromDWord(&ppd.colorBack, &ppd.colorText, sett);
ppd.lchContact = hcontact;
ppd.lchIcon = LoadSkinnedProtoIcon(lpzProto, newStatus);
- if ( !db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) {
_tcsncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact, 0), MAX_CONTACTNAME);
db_free(&dbv);
}
else _tcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact, 0), MAX_CONTACTNAME);
- if ( !db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) {
+ if (!db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) {
_tcsncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact, 0), MAX_SECONDLINE);
db_free(&dbv);
}
@@ -504,7 +511,7 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus)
void myPlaySound(MCONTACT hcontact, WORD newStatus, WORD oldStatus)
{
- if (CallService(MS_IGNORE_ISIGNORED,(WPARAM)hcontact,IGNOREEVENT_USERONLINE)) return;
+ if (CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE)) return;
//oldStatus and hcontact are not used yet
char *soundname = NULL;
if ((newStatus == ID_STATUS_ONLINE) || (newStatus == ID_STATUS_FREECHAT)) soundname = "LastSeenTrackedStatusOnline";
@@ -515,25 +522,25 @@ void myPlaySound(MCONTACT hcontact, WORD newStatus, WORD oldStatus)
SkinPlaySound(soundname);
}
-//will add hContact to queue and will return position;
+// will add hContact to queue and will return position;
static void waitThread(void *param)
{
logthread_info* infoParam = (logthread_info*)param;
- WORD prevStatus = db_get_w(infoParam->hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE);
-
+ WORD prevStatus = db_get_w(infoParam->hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE);
+
// I hope in 1.5 second all the needed info will be set
- if ( WaitForSingleObject(g_hShutdownEvent, 1500) == WAIT_TIMEOUT) {
+ if (WaitForSingleObject(g_hShutdownEvent, 1500) == WAIT_TIMEOUT) {
if (includeIdle)
- if (db_get_dw(infoParam->hContact,infoParam->sProtoName,"IdleTS",0))
- infoParam->currStatus &=0x7FFF;
+ if (db_get_dw(infoParam->hContact, infoParam->sProtoName, "IdleTS", 0))
+ infoParam->currStatus &= 0x7FFF;
- if (infoParam->currStatus != prevStatus){
- db_set_w(infoParam->hContact,S_MOD,"OldStatus",(WORD)(prevStatus|0x8000));
+ if (infoParam->currStatus != prevStatus) {
+ db_set_w(infoParam->hContact, S_MOD, "OldStatus", (WORD)(prevStatus | 0x8000));
if (includeIdle)
- db_set_b(infoParam->hContact,S_MOD,"OldIdle",(BYTE)((prevStatus&0x8000)==0));
+ db_set_b(infoParam->hContact, S_MOD, "OldIdle", (BYTE)((prevStatus & 0x8000) == 0));
- db_set_w(infoParam->hContact,S_MOD,"StatusTriger",infoParam->currStatus);
+ db_set_w(infoParam->hContact, S_MOD, "StatusTriger", infoParam->currStatus);
}
}
{
@@ -543,64 +550,74 @@ static void waitThread(void *param)
mir_free(infoParam);
}
-int UpdateValues(WPARAM hContact,LPARAM lparam)
+int UpdateValues(WPARAM hContact, LPARAM lparam)
{
// to make this code faster
if (!hContact)
return 0;
- DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING *)lparam;
- //if (CallService(MS_IGNORE_ISIGNORED,hContact,IGNOREEVENT_USERONLINE)) return 0;
- BOOL isIdleEvent = includeIdle?(strcmp(cws->szSetting,"IdleTS")==0):0;
- if (strcmp(cws->szSetting,"Status") && strcmp(cws->szSetting,"StatusTriger") && (isIdleEvent==0)) return 0;
- if (!strcmp(cws->szModule,S_MOD)) {
- //here we will come when Settings/SeenModule/StatusTriger is changed
- WORD prevStatus=db_get_w(hContact, S_MOD, "OldStatus", ID_STATUS_OFFLINE);
- if (includeIdle){
- if ( db_get_b(hContact, S_MOD, "OldIdle", 0)) prevStatus &= 0x7FFF;
- else prevStatus |= 0x8000;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lparam;
+ char *szProto = GetContactProto(hContact);
+
+ if (cws->value.type == DBVT_DWORD && !strcmp(cws->szSetting, "LastSeen") && !mir_strcmp(cws->szModule, szProto)) {
+ DBWriteTimeTS(cws->value.dVal, hContact);
+
+ HWND hwnd = WindowList_Find(g_pUserInfo, hContact);
+ if (hwnd != NULL)
+ SendMessage(hwnd, WM_REFRESH_UI, hContact, 0);
+ return 0;
+ }
+
+ BOOL isIdleEvent = includeIdle ? (strcmp(cws->szSetting, "IdleTS") == 0) : 0;
+ if (strcmp(cws->szSetting, "Status") && strcmp(cws->szSetting, "StatusTriger") && (isIdleEvent == 0))
+ return 0;
+
+ if (!strcmp(cws->szModule, S_MOD)) {
+ // here we will come when Settings/SeenModule/StatusTriger is changed
+ WORD prevStatus = db_get_w(hContact, S_MOD, "OldStatus", ID_STATUS_OFFLINE);
+ if (includeIdle) {
+ if (db_get_b(hContact, S_MOD, "OldIdle", 0))
+ prevStatus &= 0x7FFF;
+ else
+ prevStatus |= 0x8000;
}
- if ((cws->value.wVal|0x8000)<=ID_STATUS_OFFLINE)
- {
+ if ((cws->value.wVal | 0x8000) <= ID_STATUS_OFFLINE) {
// avoid repeating the offline status
- if ((prevStatus|0x8000)<=ID_STATUS_OFFLINE)
+ if ((prevStatus | 0x8000) <= ID_STATUS_OFFLINE)
return 0;
- char *proto = GetContactProto(hContact);
db_set_b(hContact, S_MOD, "Offline", 1);
{
- DWORD t;
char str[MAXMODULELABELLENGTH + 9];
- mir_snprintf(str, SIZEOF(str), "OffTime-%s", proto);
- t = db_get_dw(NULL, S_MOD, str, 0);
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", szProto);
+ DWORD t = db_get_dw(NULL, S_MOD, str, 0);
if (!t)
t = time(NULL);
DBWriteTimeTS(t, hContact);
}
- if (!db_get_b(NULL,S_MOD,"IgnoreOffline",1))
- {
- if ( db_get_b(NULL,S_MOD,"FileOutput",0))
+ if (!db_get_b(NULL, S_MOD, "IgnoreOffline", 1)) {
+ if (db_get_b(NULL, S_MOD, "FileOutput", 0))
FileWrite(hContact);
char *sProto = GetContactProto(hContact);
- if (CallProtoService(sProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
+ if (CallProtoService(sProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
myPlaySound(hContact, ID_STATUS_OFFLINE, prevStatus);
- if ( db_get_b(NULL, S_MOD, "UsePopups", 0))
+ if (db_get_b(NULL, S_MOD, "UsePopups", 0))
ShowPopup(hContact, sProto, ID_STATUS_OFFLINE);
}
- if ( db_get_b(NULL, S_MOD, "KeepHistory", 0))
+ if (db_get_b(NULL, S_MOD, "KeepHistory", 0))
HistoryWrite(hContact);
- if ( db_get_b(hContact, S_MOD, "OnlineAlert", 0))
+ if (db_get_b(hContact, S_MOD, "OnlineAlert", 0))
ShowHistory(hContact, 1);
}
- } else {
-
- if (cws->value.wVal==prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0))
+ }
+ else {
+ if (cws->value.wVal == prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0))
return 0;
DBWriteTimeTS(time(NULL), hContact);
@@ -611,7 +628,7 @@ int UpdateValues(WPARAM hContact,LPARAM lparam)
if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus);
if (db_get_b(NULL, S_MOD, "UsePopups", 0))
if (prevStatus != cws->value.wVal)
- ShowPopup(hContact, GetContactProto(hContact), cws->value.wVal|0x8000);
+ ShowPopup(hContact, GetContactProto(hContact), cws->value.wVal | 0x8000);
if (db_get_b(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact);
if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) ShowHistory(hContact, 1);
@@ -619,8 +636,8 @@ int UpdateValues(WPARAM hContact,LPARAM lparam)
}
}
else if (hContact && IsWatchedProtocol(cws->szModule) && !db_get_b(hContact, cws->szModule, "ChatRoom", false)) {
- //here we will come when <User>/<module>/Status is changed or it is idle event and if <module> is watched
- if ( CallProtoService(cws->szModule,PS_GETSTATUS,0,0) > ID_STATUS_OFFLINE){
+ // here we will come when <User>/<module>/Status is changed or it is idle event and if <module> is watched
+ if (CallProtoService(cws->szModule, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
mir_cslock lck(csContacts);
logthread_info *p = arContacts.find((logthread_info*)&hContact);
if (p == NULL) {
@@ -631,7 +648,8 @@ int UpdateValues(WPARAM hContact,LPARAM lparam)
mir_forkthread(waitThread, p);
}
p->currStatus = isIdleEvent ? db_get_w(hContact, cws->szModule, "Status", ID_STATUS_OFFLINE) : cws->value.wVal;
- } }
+ }
+ }
return 0;
}
@@ -642,14 +660,14 @@ static void cleanThread(void *param)
char *szProto = infoParam->sProtoName;
// I hope in 10 secons all logged-in contacts will be listed
- if ( WaitForSingleObject(g_hShutdownEvent, 10000) == WAIT_TIMEOUT) {
+ if (WaitForSingleObject(g_hShutdownEvent, 10000) == WAIT_TIMEOUT) {
for (MCONTACT hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) {
- WORD oldStatus = db_get_w(hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE) | 0x8000;
+ WORD oldStatus = db_get_w(hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE) | 0x8000;
if (oldStatus > ID_STATUS_OFFLINE) {
- if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){
- db_set_w(hContact,S_MOD,"OldStatus",(WORD)(oldStatus|0x8000));
- if (includeIdle)db_set_b(hContact,S_MOD,"OldIdle",(BYTE)((oldStatus&0x8000)?0:1));
- db_set_w(hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) {
+ db_set_w(hContact, S_MOD, "OldStatus", (WORD)(oldStatus | 0x8000));
+ if (includeIdle)db_set_b(hContact, S_MOD, "OldIdle", (BYTE)((oldStatus & 0x8000) ? 0 : 1));
+ db_set_w(hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE);
}
}
}
@@ -661,33 +679,33 @@ static void cleanThread(void *param)
free(infoParam);
}
-int ModeChange(WPARAM wparam,LPARAM lparam)
+int ModeChange(WPARAM wparam, LPARAM lparam)
{
- ACKDATA *ack=(ACKDATA *)lparam;
+ ACKDATA *ack = (ACKDATA *)lparam;
- if (ack->type!=ACKTYPE_STATUS || ack->result!=ACKRESULT_SUCCESS || ack->hContact!=NULL) return 0;
+ if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS || ack->hContact != NULL) return 0;
courProtoName = (char *)ack->szModule;
- if (!IsWatchedProtocol(courProtoName) && strncmp(courProtoName,"MetaContacts",12))
+ if (!IsWatchedProtocol(courProtoName) && strncmp(courProtoName, "MetaContacts", 12))
return 0;
- DBWriteTimeTS(time(NULL),NULL);
+ DBWriteTimeTS(time(NULL), NULL);
-// isetting=CallProtoService(ack->szModule,PS_GETSTATUS,0,0);
- WORD isetting=(WORD)ack->lParam;
- if (isetting<ID_STATUS_OFFLINE) isetting = ID_STATUS_OFFLINE;
- if ((isetting>ID_STATUS_OFFLINE)&&((WORD)ack->hProcess<=ID_STATUS_OFFLINE)) {
+ // isetting=CallProtoService(ack->szModule,PS_GETSTATUS,0,0);
+ WORD isetting = (WORD)ack->lParam;
+ if (isetting < ID_STATUS_OFFLINE) isetting = ID_STATUS_OFFLINE;
+ if ((isetting > ID_STATUS_OFFLINE) && ((WORD)ack->hProcess <= ID_STATUS_OFFLINE)) {
//we have just loged-in
db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
if (!Miranda_Terminated() && IsWatchedProtocol(ack->szModule)) {
logthread_info *info = (logthread_info *)malloc(sizeof(logthread_info));
- strncpy(info->sProtoName,courProtoName,MAXMODULELABELLENGTH);
+ strncpy(info->sProtoName, courProtoName, MAXMODULELABELLENGTH);
info->hContact = 0;
info->currStatus = 0;
mir_forkthread(cleanThread, info);
}
}
- else if ((isetting==ID_STATUS_OFFLINE)&&((WORD)ack->hProcess>ID_STATUS_OFFLINE)) {
+ else if ((isetting == ID_STATUS_OFFLINE) && ((WORD)ack->hProcess > ID_STATUS_OFFLINE)) {
//we have just loged-off
if (IsWatchedProtocol(ack->szModule)) {
char str[MAXMODULELABELLENGTH + 9];
@@ -698,13 +716,13 @@ int ModeChange(WPARAM wparam,LPARAM lparam)
db_set_dw(NULL, S_MOD, str, t);
}
}
-
- if (isetting==db_get_w(NULL,S_MOD,courProtoName,ID_STATUS_OFFLINE))
+
+ if (isetting == db_get_w(NULL, S_MOD, courProtoName, ID_STATUS_OFFLINE))
return 0;
- db_set_w(NULL,S_MOD,courProtoName,isetting);
+ db_set_w(NULL, S_MOD, courProtoName, isetting);
- if ( db_get_b(NULL,S_MOD,"FileOutput",0))
+ if (db_get_b(NULL, S_MOD, "FileOutput", 0))
FileWrite(NULL);
courProtoName = NULL;
@@ -714,37 +732,41 @@ int ModeChange(WPARAM wparam,LPARAM lparam)
short int isDbZero(MCONTACT hContact, const char *module_name, const char *setting_name)
{
DBVARIANT dbv;
- if ( !db_get(hContact, module_name, setting_name, &dbv)) {
+ if (!db_get(hContact, module_name, setting_name, &dbv)) {
short int res = 0;
switch (dbv.type) {
- case DBVT_BYTE: res=dbv.bVal==0; break;
- case DBVT_WORD: res=dbv.wVal==0; break;
- case DBVT_DWORD: res=dbv.dVal==0; break;
- case DBVT_BLOB: res=dbv.cpbVal==0; break;
- default: res=dbv.pszVal[0]==0; break;
+ case DBVT_BYTE: res = dbv.bVal == 0; break;
+ case DBVT_WORD: res = dbv.wVal == 0; break;
+ case DBVT_DWORD: res = dbv.dVal == 0; break;
+ case DBVT_BLOB: res = dbv.cpbVal == 0; break;
+ default: res = dbv.pszVal[0] == 0; break;
}
- db_free(&dbv);
+ db_free(&dbv);
return res;
}
return -1;
}
-TCHAR *any_to_IdleNotidleUnknown(MCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) {
+TCHAR* any_to_IdleNotidleUnknown(MCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen)
+{
short int r = isDbZero(hContact, module_name, setting_name);
- if (r==-1){
+ if (r == -1) {
_tcsncpy(buff, TranslateT("Unknown"), bufflen);
- } else {
+ }
+ else {
_tcsncpy(buff, r ? TranslateT("Not Idle") : TranslateT("Idle"), bufflen);
};
buff[bufflen - 1] = 0;
return buff;
}
-TCHAR *any_to_Idle(MCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) {
- if (isDbZero(hContact, module_name, setting_name)==0) { //DB setting is NOT zero and exists
+TCHAR* any_to_Idle(MCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen)
+{
+ if (isDbZero(hContact, module_name, setting_name) == 0) { //DB setting is NOT zero and exists
buff[0] = L'/';
- _tcsncpy(&buff[1], TranslateT("Idle"), bufflen-1);
- } else buff[0] = 0;
+ _tcsncpy(&buff[1], TranslateT("Idle"), bufflen - 1);
+ }
+ else buff[0] = 0;
buff[bufflen - 1] = 0;
return buff;
}
diff --git a/plugins/SeenPlugin/src/version.h b/plugins/SeenPlugin/src/version.h
index 169ceab2a3..03e0885d88 100644
--- a/plugins/SeenPlugin/src/version.h
+++ b/plugins/SeenPlugin/src/version.h
@@ -19,17 +19,17 @@ along with this program (AssocMgr-License.txt); if not, write to the Free Softwa
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define __MAJOR_VERSION 5
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 4
-#define __BUILD_NUM 9
+#define __MAJOR_VERSION 5
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 5
+#define __BUILD_NUM 1
#include <stdver.h>
#define __PLUGIN_NAME "Last seen"
#define __FILENAME "SeenPlugin.dll"
-#define __DESCRIPTION "Logs when a user was last seen online and which users were online while you were away."
-#define __AUTHOR "Heiko Schillinger, YB"
+#define __DESCRIPTION "Logs when a user was last seen online and which users were online while you were away."
+#define __AUTHOR "Heiko Schillinger, YB"
#define __AUTHOREMAIL "y_b@saaplugin.no-ip.info"
-#define __AUTHORWEB "http://miranda-ng.org/p/SeenPlugin/"
-#define __COPYRIGHT "© 2001-2002 Heiko Schillinger, 2003 modified by Bruno Rino, 2005-7 Modified by YB"
+#define __AUTHORWEB "http://miranda-ng.org/p/SeenPlugin/"
+#define __COPYRIGHT "© 2001-2002 Heiko Schillinger, 2003 modified by Bruno Rino, 2005-7 Modified by YB"