diff options
Diffstat (limited to 'plugins/ContactsPlus/src')
-rw-r--r-- | plugins/ContactsPlus/src/main.cpp | 63 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/send.cpp | 43 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/utils.cpp | 10 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/utils.h | 2 |
4 files changed, 40 insertions, 78 deletions
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index c64acaf38a..d6aff5d371 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -107,48 +107,37 @@ static int HookDBEventAdded(WPARAM wParam, LPARAM lParam) static void ProcessUnreadEvents(void)
{
- DBEVENTINFO dbei = {0};
- HANDLE hDbEvent,hContact;
-
- dbei.cbSize = sizeof(dbei);
-
- hContact = SRCFindFirstContact();
- while (hContact)
- {
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);
-
- while (hDbEvent)
- {
- dbei.cbBlob=0;
- CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_CONTACTS)
- { //process the event
- HookDBEventAdded((WPARAM)hContact, (LPARAM)hDbEvent);
- }
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
- }
- hContact = SRCFindNextContact(hContact);
- }
+ DBEVENTINFO dbei = {0};
+ dbei.cbSize = sizeof(dbei);
+
+ HANDLE hContact = db_find_first();
+ while (hContact)
+ {
+ HANDLE hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);
+
+ while (hDbEvent)
+ {
+ dbei.cbBlob=0;
+ CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
+ if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_CONTACTS)
+ {
+ //process the event
+ HookDBEventAdded((WPARAM)hContact, (LPARAM)hDbEvent);
+ }
+ hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
+ }
+ hContact = db_find_next(hContact);
+ }
}
static bool CheckContactsServiceSupport(const char* szProto)
{
- if (g_NewProtoAPI)
- { // there is no way to determine if the service exists (only proto_interface call is supported by 0.8+)
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_CONTACTSEND)
- return true;
- }
- else
- { // check the real send service (only 0.7.x and older)
- char serstr[MAX_PATH+30];
-
- strcpy(serstr, szProto);
- strcat(serstr, PSS_CONTACTS);
- if (ServiceExists(serstr))
- return true;
- }
- return false;
+ // there is no way to determine if the service exists (only proto_interface call is supported by 0.8+)
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_CONTACTSEND)
+ return true;
+ else
+ return false;
}
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index c09284a2eb..86f70079c4 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -188,31 +188,31 @@ static void ResetListOptions(HWND hwndList) static HANDLE FindNextClistContact(HWND hList, HANDLE hContact, HANDLE *phItem)
{
- HANDLE hNextContact = SRCFindNextContact(hContact);
- HANDLE hNextItem = NULL;
+ HANDLE hNextContact = db_find_next(hContact);
+ HANDLE hNextItem = NULL;
- while (hNextContact && !(hNextItem = (HANDLE)SendMessageT(hList, CLM_FINDCONTACT, (WPARAM)hNextContact,0)))
- hNextContact = SRCFindNextContact(hNextContact);
+ while (hNextContact && !(hNextItem = (HANDLE)SendMessageT(hList, CLM_FINDCONTACT, (WPARAM)hNextContact,0)))
+ hNextContact = db_find_next(hNextContact);
- if (phItem)
- *phItem = hNextItem;
+ if (phItem)
+ *phItem = hNextItem;
- return hNextContact;
+ return hNextContact;
}
static HANDLE FindFirstClistContact(HWND hList, HANDLE *phItem)
{
- HANDLE hContact = SRCFindFirstContact();
- HANDLE hItem = (HANDLE)SendMessageT(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ HANDLE hContact = db_find_first();
+ HANDLE hItem = (HANDLE)SendMessageT(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hContact && !hItem)
- return FindNextClistContact(hList, hContact, phItem);
+ if (hContact && !hItem)
+ return FindNextClistContact(hList, hContact, phItem);
- if (phItem)
- *phItem = hItem;
+ if (phItem)
+ *phItem = hItem;
- return hContact;
+ return hContact;
}
@@ -299,21 +299,6 @@ INT_PTR CALLBACK SendDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_TIMER:
if (wParam == TIMERID_MSGSEND)
{
- if (!g_SendAckSupported)
- { // old Miranda has this ack unimplemented, we need to send it by ourselves
- ACKDATA ack = {0};
-
- ack.cbSize = sizeof(ACKDATA);
- ack.type = ACKTYPE_CONTACTS;
- ack.result = ACKRESULT_SUCCESS;
- ack.hContact = wndData->hContact;
- while (wndData->uacklist.Count)
- { // the uack gets empty after processing all messages :)
- ack.hProcess = wndData->uacklist.Items[0];
- SendMessageT(hwndDlg, HM_EVENTSENT, NULL, (WPARAM)&ack); // this removes the ack from our array
- }
- break;
- }
KillTimer(hwndDlg,wParam);
wndData->ShowErrorDlg(hwndDlg, "The contacts send timed out.", TRUE);
}
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 18b80b9d3f..c51aa9e37f 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -115,16 +115,6 @@ TCHAR* MirandaStatusToStringT(int mirandaStatus) return (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, g_UnicodeCore ? GSMDF_UNICODE : 0);
}
-HANDLE __fastcall SRCFindFirstContact()
-{
- return db_find_first();
-}
-
-HANDLE __fastcall SRCFindNextContact(HANDLE hContact)
-{
- return db_find_next(hContact);
-}
-
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv)
{
if (ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index c9d89e9f24..ecc0df3349 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -37,8 +37,6 @@ char *GetContactUID(HANDLE hContact, int bTchar); TCHAR *GetContactDisplayNameT(HANDLE hContact);
TCHAR* MirandaStatusToStringT(int mirandaStatus);
-HANDLE __fastcall SRCFindFirstContact();
-HANDLE __fastcall SRCFindNextContact(HANDLE hContact);
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv);
TCHAR* DBGetContactSettingStringT(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef);
int DBWriteContactSettingStringT(HANDLE hContact, const char *szModule, const char* szSetting, TCHAR* szValue);
|