summaryrefslogtreecommitdiff
path: root/plugins/BuddyExpectator/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 20:47:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 20:47:51 +0000
commit68d3fd47bb9b75e65859d14199ffee01f16ac9a7 (patch)
treefcc340ad7067561e57733b287f193a7dbed93dd4 /plugins/BuddyExpectator/src
parent7193759b046338c6f47ff2edb34743a1465791cd (diff)
HCONTACT is not needed anymore
git-svn-id: http://svn.miranda-ng.org/main/trunk@8086 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BuddyExpectator/src')
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp52
-rw-r--r--plugins/BuddyExpectator/src/options.cpp24
2 files changed, 38 insertions, 38 deletions
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index ecf709b150..d60229c7fc 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -67,19 +67,19 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
-time_t getLastSeen(HCONTACT hContact)
+time_t getLastSeen(MCONTACT hContact)
{
return db_get_dw(hContact, MODULE_NAME, "LastSeen", db_get_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)-1));
}
-void setLastSeen(HCONTACT hContact)
+void setLastSeen(MCONTACT hContact)
{
db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL));
if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
}
-time_t getLastInputMsg(HCONTACT hContact)
+time_t getLastInputMsg(MCONTACT hContact)
{
HANDLE hDbEvent = db_event_last(hContact);
while (hDbEvent) {
@@ -212,7 +212,7 @@ LRESULT CALLBACK PopupDlgProcNoSet(HWND hWnd, UINT message, WPARAM wParam, LPARA
/**
* Checks - whether user has been gone for specified number of days
*/
-bool isContactGoneFor(HCONTACT hContact, int days)
+bool isContactGoneFor(MCONTACT hContact, int days)
{
time_t lastSeen = getLastSeen(hContact);
time_t lastInputMsg = getLastInputMsg(hContact);
@@ -257,7 +257,7 @@ bool isContactGoneFor(HCONTACT hContact, int days)
return (daysSinceOnline >= days && (daysSinceMessage == -1 || daysSinceMessage >= days));
}
-void ReturnNotify(HCONTACT hContact, TCHAR *message)
+void ReturnNotify(MCONTACT hContact, TCHAR *message)
{
if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || db_get_b(hContact, "CList", "Hidden", 0) == 1)
return;
@@ -297,7 +297,7 @@ void ReturnNotify(HCONTACT hContact, TCHAR *message)
}
}
-void GoneNotify(HCONTACT hContact, TCHAR *message)
+void GoneNotify(MCONTACT hContact, TCHAR *message)
{
if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || db_get_b(hContact, "CList", "Hidden", 0) == 1)
return;
@@ -343,12 +343,12 @@ void GoneNotify(HCONTACT hContact, TCHAR *message)
*/
INT_PTR MissYouAction(WPARAM wParam, LPARAM lParam)
{
- HCONTACT hContact;
+ MCONTACT hContact;
if (lParam) {
CLISTEVENT* cle = (CLISTEVENT*)lParam;
hContact = cle->hContact;
}
- else hContact = (HCONTACT)wParam;
+ else hContact = (MCONTACT)wParam;
CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
return 0;
@@ -361,12 +361,12 @@ INT_PTR MissYouAction(WPARAM wParam, LPARAM lParam)
*/
INT_PTR ContactReturnedAction(WPARAM wParam, LPARAM lParam)
{
- HCONTACT hContact;
+ MCONTACT hContact;
if (lParam) {
CLISTEVENT* cle = (CLISTEVENT*)lParam;
hContact = cle->hContact;
}
- else hContact = (HCONTACT)wParam;
+ else hContact = (MCONTACT)wParam;
if (options.iShowMessageWindow>0)
CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
@@ -385,12 +385,12 @@ INT_PTR ContactReturnedAction(WPARAM wParam, LPARAM lParam)
*/
INT_PTR ContactStillAbsentAction(WPARAM wParam, LPARAM lParam)
{
- HCONTACT hContact;
+ MCONTACT hContact;
if (lParam) {
CLISTEVENT* cle = (CLISTEVENT*)lParam;
hContact = cle->hContact;
}
- else hContact = (HCONTACT)wParam;
+ else hContact = (MCONTACT)wParam;
switch (options.action2) {
case GCA_DELETE:
@@ -423,15 +423,15 @@ int onIconsChanged(WPARAM wParam, LPARAM lParam)
*/
INT_PTR MenuMissYouClick(WPARAM wParam, LPARAM lParam)
{
- if (db_get_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0)) {
- db_set_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0);
+ if (db_get_b((MCONTACT)wParam, MODULE_NAME, "MissYou", 0)) {
+ db_set_b((MCONTACT)wParam, MODULE_NAME, "MissYou", 0);
if (options.MissYouIcon)
- ExtraIcon_Clear(hExtraIcon, (HCONTACT)wParam);
+ ExtraIcon_Clear(hExtraIcon, (MCONTACT)wParam);
}
else {
- db_set_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 1);
+ db_set_b((MCONTACT)wParam, MODULE_NAME, "MissYou", 1);
if (options.MissYouIcon)
- ExtraIcon_SetIcon(hExtraIcon, (HCONTACT)wParam, "enabled_icon");
+ ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)wParam, "enabled_icon");
}
return 0;
@@ -442,13 +442,13 @@ INT_PTR MenuMissYouClick(WPARAM wParam, LPARAM lParam)
*/
int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- char *proto = GetContactProto((HCONTACT)wParam);
+ char *proto = GetContactProto((MCONTACT)wParam);
if (!proto)
return 0;
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR;
- if (db_get_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0)) {
+ if (db_get_b((MCONTACT)wParam, MODULE_NAME, "MissYou", 0)) {
mi.ptszName = LPGENT("Disable Miss You");
mi.icolibItem = iconList[1].hIcolib;
}
@@ -457,14 +457,14 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
mi.icolibItem = iconList[2].hIcolib;
}
Menu_ModifyItem(hContactMenu, &mi);
- Menu_ShowItem(hContactMenu, !db_get_b((HCONTACT)wParam, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND));
+ Menu_ShowItem(hContactMenu, !db_get_b((MCONTACT)wParam, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND));
return 0;
}
int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
{
- if ( db_get_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0))
- ExtraIcon_SetIcon(hExtraIcon, (HCONTACT)wParam, "enabled_icon");
+ if ( db_get_b((MCONTACT)wParam, MODULE_NAME, "MissYou", 0))
+ ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)wParam, "enabled_icon");
return 0;
}
@@ -474,7 +474,7 @@ int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
*/
int SettingChanged(WPARAM wParam, LPARAM lParam)
{
- HCONTACT hContact = (HCONTACT) wParam;
+ MCONTACT hContact = (MCONTACT) wParam;
DBCONTACTWRITESETTING *inf = (DBCONTACTWRITESETTING *) lParam;
if (hContact == NULL || inf->value.type == DBVT_DELETED || strcmp(inf->szSetting, "Status") != 0)
@@ -565,7 +565,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam)
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *proto = GetContactProto(hContact);
if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0) == 0))
{
@@ -671,7 +671,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
int ContactAdded(WPARAM wParam, LPARAM lParam)
{
- db_set_dw((HCONTACT)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0));
+ db_set_dw((MCONTACT)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0));
return 0;
}
@@ -709,7 +709,7 @@ extern "C" int __declspec(dllexport) Load(void)
DBVARIANT dbv;
DWORD current_time = (DWORD)time(0);
- for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if ( !db_get(hContact, MODULE_NAME, "CreationTime", &dbv))
db_free(&dbv);
else
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp
index 7d710ce26c..7fe24fdf46 100644
--- a/plugins/BuddyExpectator/src/options.cpp
+++ b/plugins/BuddyExpectator/src/options.cpp
@@ -25,9 +25,9 @@
#define DEF_COLOR_FORE 0x000000
extern HICON hIcon;
-extern time_t getLastSeen(HCONTACT);
-extern time_t getLastInputMsg(HCONTACT);
-extern bool isContactGoneFor(HCONTACT, int);
+extern time_t getLastSeen(MCONTACT);
+extern time_t getLastInputMsg(MCONTACT);
+extern bool isContactGoneFor(MCONTACT, int);
Options options;
void LoadOptions()
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
SaveOptions();
// clear all notified settings
- for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
if(db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
@@ -458,7 +458,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar
{
time_t tmpTime;
TCHAR tmpBuf[51] = {0};
- tmpTime = getLastSeen((HCONTACT)lparam);
+ tmpTime = getLastSeen((MCONTACT)lparam);
if (tmpTime == -1)
SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, TranslateT("not detected"));
else {
@@ -466,7 +466,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar
SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, tmpBuf);
}
- tmpTime = getLastInputMsg((HCONTACT)lparam);
+ tmpTime = getLastInputMsg((MCONTACT)lparam);
if (tmpTime == -1)
SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, TranslateT("not found"));
else {
@@ -474,19 +474,19 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar
SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, tmpBuf);
}
- unsigned int AbsencePeriod = db_get_dw((HCONTACT)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ unsigned int AbsencePeriod = db_get_dw((MCONTACT)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
SendDlgItemMessage(hdlg, IDC_SPINABSENCE, UDM_SETRANGE, 0, MAKELONG(999, 1));
SetDlgItemInt(hdlg, IDC_EDITABSENCE, AbsencePeriod, FALSE);
- if (isContactGoneFor((HCONTACT)lparam, options.iAbsencePeriod2))
+ if (isContactGoneFor((MCONTACT)lparam, options.iAbsencePeriod2))
SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, TranslateT("This contact has been absent for an extended period of time."));
else
SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, _T(""));
- SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, db_get_b((HCONTACT)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, db_get_b((HCONTACT)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
- SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, db_get_b((HCONTACT)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, db_get_b((MCONTACT)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, db_get_b((MCONTACT)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, db_get_b((MCONTACT)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
TranslateDialogDefault(hdlg);
return TRUE;
@@ -500,7 +500,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar
{
case (PSN_APPLY):
{
- HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lparam)->lParam;
+ MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lparam)->lParam;
if (hContact)
{
db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE));