summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-28 12:33:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-28 12:33:59 +0000
commit205c3f661328bac2583bf5ed2b3c140a1619db4a (patch)
treea9c101fef83d531fb45041a2e9fdce2636a529b5 /plugins
parent81dfe1bf71946f983584f6241d97046d5f897857 (diff)
- PROTOTYPE_VIRTUAL returned back;
- unused code wiped out; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@2537 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MetaContacts/src/addto.cpp8
-rw-r--r--plugins/MetaContacts/src/meta_api.cpp8
-rw-r--r--plugins/MetaContacts/src/meta_main.cpp3
-rw-r--r--plugins/MetaContacts/src/meta_menu.cpp67
-rw-r--r--plugins/MetaContacts/src/meta_options.cpp12
-rw-r--r--plugins/MetaContacts/src/meta_services.cpp793
-rw-r--r--plugins/MetaContacts/src/meta_utils.cpp144
7 files changed, 477 insertions, 558 deletions
diff --git a/plugins/MetaContacts/src/addto.cpp b/plugins/MetaContacts/src/addto.cpp
index 1c4213137f..7be0f40a6f 100644
--- a/plugins/MetaContacts/src/addto.cpp
+++ b/plugins/MetaContacts/src/addto.cpp
@@ -61,7 +61,7 @@ int FillList(HWND list, BOOL sort)
while(hMetaUser) // The DB is searched through, to get all the metacontacts
{
- if ((metaID = db_get_dw(hMetaUser,META_PROTO,META_ID,(DWORD)-1))==(DWORD)-1)
+ if ((metaID = db_get_dw(hMetaUser, META_PROTO, META_ID,(DWORD)-1))==(DWORD)-1)
{
// This isn't a MetaContact, go to the next
hMetaUser = db_find_next(hMetaUser);
@@ -171,14 +171,14 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
TranslateDialogDefault( hwndDlg );
- if (db_get_dw((HANDLE)lParam,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1)
+ if (db_get_dw((HANDLE)lParam, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1)
{
MessageBox(hwndDlg,Translate("This contact is a MetaContact.\nYou can't add a MetaContact to another MetaContact.\n\nPlease choose another."),
Translate("MetaContact Conflict"),MB_ICONERROR);
DestroyWindow(hwndDlg);
return TRUE;
}
- if (db_get_dw((HANDLE)lParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1)
+ if (db_get_dw((HANDLE)lParam, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1)
{
MessageBox(hwndDlg,Translate("This contact is already associated to a MetaContact.\nYou cannot add a contact to multiple MetaContacts."),
Translate("Multiple MetaContacts"),MB_ICONERROR);
@@ -262,7 +262,7 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
hMeta = (HANDLE)SendMessage(GetDlgItem(hwndDlg, IDC_METALIST), LB_GETITEMDATA, (WPARAM)item, 0);
{
- if (!Meta_Assign(hContact,hMeta, FALSE))
+ if ( !Meta_Assign(hContact,hMeta, FALSE))
{
MessageBox(hwndDlg, Translate("Assignment to the MetaContact failed."), Translate("Assignment failure"),MB_ICONERROR);
}
diff --git a/plugins/MetaContacts/src/meta_api.cpp b/plugins/MetaContacts/src/meta_api.cpp
index f147f41251..8835733c15 100644
--- a/plugins/MetaContacts/src/meta_api.cpp
+++ b/plugins/MetaContacts/src/meta_api.cpp
@@ -120,7 +120,7 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) {
INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, (int)lParam);
HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0);
- if (!hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
+ if ( !hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
return 1;
db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact);
@@ -136,7 +136,7 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) {
INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)lParam;
HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0);
- if (!hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
+ if ( !hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
return 1;
db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact);
@@ -182,7 +182,7 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) {
HANDLE hMeta = (HANDLE)wParam;
HANDLE hContact;
- if (!hMeta) return 0;
+ if ( !hMeta) return 0;
if (db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) {
if (lParam) *(DWORD *)lParam = db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1);
@@ -191,7 +191,7 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) {
hContact = (HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0);
- if (!hContact) {
+ if ( !hContact) {
if (lParam) *(DWORD *)lParam = -1;
} else {
if (lParam) *(DWORD *)lParam = (DWORD)Meta_GetContactNumber(hContact);
diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp
index 8096857d7d..5e4cea2186 100644
--- a/plugins/MetaContacts/src/meta_main.cpp
+++ b/plugins/MetaContacts/src/meta_main.cpp
@@ -188,7 +188,7 @@ extern "C" __declspec(dllexport) int Load(void)
// that metacontacts: have the correct number of subcontacts, and have reasonable defaults
if (Meta_SetHandles()) {
// error - db corruption
- if (!db_get_b(0, META_PROTO, "DisabledMessageShown", 0)) {
+ if ( !db_get_b(0, META_PROTO, "DisabledMessageShown", 0)) {
MessageBox(0, Translate("Error - Database corruption.\nPlugin disabled."), Translate("MetaContacts"), MB_OK | MB_ICONERROR);
db_set_b(0, META_PROTO, "DisabledMessageShown", 1);
}
@@ -227,6 +227,5 @@ extern "C" __declspec(dllexport) int Load(void)
// for clist_meta_mw - write hidden group name to DB
db_set_s(0, META_PROTO, "HiddenGroupName", META_HIDDEN_GROUP);
-
return 0;
}
diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp
index 3fffdd01b6..743b25c838 100644
--- a/plugins/MetaContacts/src/meta_menu.cpp
+++ b/plugins/MetaContacts/src/meta_menu.cpp
@@ -43,7 +43,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam)
// Get some information about the selected contact.
// proto = GetContactProto(wParam,0);
- if (!DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) {
+ if ( !DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) {
group = _strdup(dbv.pszVal);
db_free(&dbv);
}
@@ -55,9 +55,9 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam)
if (hMetaContact)
{
- db_set_dw(hMetaContact,META_PROTO,META_ID,nextMetaID);
- db_set_dw(hMetaContact,META_PROTO,"NumContacts",0);
- db_set_dw(NULL,META_PROTO,"NextMetaID",++nextMetaID);
+ db_set_dw(hMetaContact, META_PROTO, META_ID,nextMetaID);
+ db_set_dw(hMetaContact, META_PROTO, "NumContacts",0);
+ db_set_dw(NULL, META_PROTO, "NextMetaID",++nextMetaID);
// Add the MetaContact protocol to the new meta contact
CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hMetaContact, ( LPARAM )META_PROTO );
@@ -70,14 +70,14 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam)
}
// Assign the contact to the MetaContact just created (and make default).
- if (!Meta_Assign((HANDLE)wParam,hMetaContact,TRUE)) {
+ if ( !Meta_Assign((HANDLE)wParam,hMetaContact,TRUE)) {
MessageBox(0,Translate("There was a problem in assigning the contact to the MetaContact"),Translate("Error"),MB_ICONEXCLAMATION);
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hMetaContact, 0);
return 0;
}
// hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled)
- if (!Meta_IsEnabled())
+ if ( !Meta_IsEnabled())
db_set_b(hMetaContact, "CList", "Hidden", 1);
}
@@ -114,7 +114,7 @@ INT_PTR Meta_AddTo(WPARAM wParam, LPARAM lParam)
INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam)
{
HWND clui = (HWND)CallService(MS_CLUI_GETHWND,0,0);
- DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_METAEDIT),clui,Meta_EditDialogProc,(LPARAM)wParam);
+ DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_METAEDIT),clui, Meta_EditDialogProc,(LPARAM)wParam);
return 0;
}
@@ -139,7 +139,8 @@ Triggers a db/contact/settingchanged event just before it returns.
//} DBCONTACTWRITESETTING;
//#define MS_DB_CONTACT_WRITESETTING "DB/Contact/WriteSetting"
-void Meta_RemoveContactNumber(HANDLE hMeta, int number) {
+void Meta_RemoveContactNumber(HANDLE hMeta, int number)
+{
int i, num_contacts, default_contact;
HANDLE hContact;//, handle;
@@ -153,18 +154,17 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) {
hContact = Meta_GetContactHandle(hMeta, number);
// make sure this contact thinks it's part of this metacontact
- if ((HANDLE)db_get_dw(hContact,META_PROTO,"Handle", 0) == hMeta) {
+ if ((HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0) == hMeta) {
// remove link to meta contact
- db_unset(hContact,META_PROTO,"IsSubcontact");
- db_unset(hContact,META_PROTO,META_LINK);
- db_unset(hContact,META_PROTO,"Handle");
- db_unset(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact, META_PROTO, "IsSubcontact");
+ db_unset(hContact, META_PROTO, META_LINK);
+ db_unset(hContact, META_PROTO, "Handle");
+ db_unset(hContact, META_PROTO, "ContactNumber");
// unhide - must be done after removing link (see meta_services.c:Meta_ChangeStatus)
Meta_RestoreGroup(hContact);
- db_unset(hContact,META_PROTO,"OldCListGroup");
- //CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_PROTO);
- CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
+ db_unset(hContact, META_PROTO, "OldCListGroup");
+
// stop ignoring, if we were
if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
@@ -250,9 +250,9 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam)
DWORD metaID;
HANDLE hContact;
- if ((metaID=db_get_dw((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1)
+ if ((metaID=db_get_dw((HANDLE)wParam, META_PROTO, META_ID,(DWORD)-1))!=(DWORD)-1)
{// The wParam is a metacontact
- if (!lParam) { // check from recursion - see second half of this function
+ if ( !lParam) { // check from recursion - see second half of this function
if (MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0),Translate("This will remove the MetaContact permanently.\n\nProceed Anyway?"),
Translate("Are you sure?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2)!=IDYES)
{
@@ -263,17 +263,16 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam)
hContact = db_find_first();
while(hContact)
{ // Scans the database to get all the contacts that have been previously linked to this MetaContact
- if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
+ if (db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1)==metaID)
{ // This contact is assigned to the MetaContact that will be deleted, clear the "MetaContacts" information
- db_unset(hContact,META_PROTO,"IsSubcontact");
- db_unset(hContact,META_PROTO,META_LINK);
- db_unset(hContact,META_PROTO,"Handle");
- db_unset(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact, META_PROTO, "IsSubcontact");
+ db_unset(hContact, META_PROTO, META_LINK);
+ db_unset(hContact, META_PROTO, "Handle");
+ db_unset(hContact, META_PROTO, "ContactNumber");
// unhide - must be done after removing link (see meta_services.c:Meta_ChangeStatus)
Meta_RestoreGroup(hContact);
- db_unset(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact, META_PROTO, "OldCListGroup");
- CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
@@ -307,9 +306,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam)
return 0;
}
- Meta_RemoveContactNumber(hMeta, db_get_dw((HANDLE)wParam,META_PROTO,"ContactNumber", -1));
-
- CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)wParam,(LPARAM)META_FILTER);
+ Meta_RemoveContactNumber(hMeta, db_get_dw((HANDLE)wParam, META_PROTO, "ContactNumber", -1));
}
}
return 0;
@@ -327,7 +324,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam)
{
HANDLE hMeta;
- if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam,META_PROTO,"Handle",0)) != 0)
+ if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle",0)) != 0)
{ // the wParam is a subcontact
db_set_dw(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HANDLE)wParam));
NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)(HANDLE)wParam);
@@ -345,7 +342,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam)
*/
INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam)
{
- if (db_get_dw((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
+ if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
{ // the wParam is a MetaContact
BOOL current = db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
@@ -408,7 +405,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam)
mi.flags = CMIM_FLAGS;
mi.cbSize = sizeof(CLISTMENUITEM);
- if (db_get_dw((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
+ if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID,-1) != (DWORD)-1)
{
int num_contacts, i;
@@ -439,7 +436,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam)
hContact = Meta_GetContactHandle((HANDLE)wParam, i);
proto = _strdup(GetContactProto(hContact));
- if (!proto)
+ if ( !proto)
status = ID_STATUS_OFFLINE;
else
status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
@@ -448,7 +445,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam)
strcpy(buf, "Login");
strcat(buf, _itoa(i, buffer2, 10));
- db_get((HANDLE)wParam,META_PROTO,buf,&dbv);
+ db_get((HANDLE)wParam, META_PROTO, buf,&dbv);
switch(dbv.type)
{
case DBVT_ASCIIZ:
@@ -512,7 +509,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam)
}
else
{// This is a simple contact
- if (!Meta_IsEnabled())
+ if ( !Meta_IsEnabled())
{
// groups disabled - all meta menu options hidden
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
@@ -526,7 +523,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam)
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
- } else if (db_get_dw((HANDLE)wParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (db_get_dw((HANDLE)wParam, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) {
// The contact is affected to a metacontact.
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
mi.flags |= CMIM_NAME;
diff --git a/plugins/MetaContacts/src/meta_options.cpp b/plugins/MetaContacts/src/meta_options.cpp
index f254e82171..0db9eed1b0 100644
--- a/plugins/MetaContacts/src/meta_options.cpp
+++ b/plugins/MetaContacts/src/meta_options.cpp
@@ -65,7 +65,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
CheckDlgButton(hwndDlg, IDC_CHK_SUBHISTORY, options_changes.subhistory ? TRUE : FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_COPYDATA, options_changes.copydata ? TRUE : FALSE);
- if (!options_changes.subcontact_windows) {
+ if ( !options_changes.subcontact_windows) {
hw = GetDlgItem(hwndDlg, IDC_CHK_METAHISTORY);
EnableWindow(hw, FALSE);
} else {
@@ -257,7 +257,7 @@ int Meta_WriteOptions(MetaOptions *opt) {
db_set_b(NULL, META_PROTO, "MetaMessageIcon", (BYTE)(opt->flash_meta_message_icon ? 1 : 0));
db_set_b(NULL, META_PROTO, "CopyUserInfo", (BYTE)(opt->copy_userinfo ? 1 : 0));
- if (!opt->subcontact_windows)
+ if ( !opt->subcontact_windows)
db_set_b(NULL, META_PROTO, "MetaHistory", 1);
else
db_set_b(NULL, META_PROTO, "MetaHistory", (BYTE)(opt->metahistory ? 1 : 0));
@@ -289,7 +289,7 @@ int Meta_ReadOptions(MetaOptions *opt) {
opt->flash_meta_message_icon = (db_get_b(NULL, META_PROTO, "MetaMessageIcon", 1) == 1 ? TRUE : FALSE);
opt->copy_userinfo = (db_get_b(NULL, META_PROTO, "CopyUserInfo", 1) == 1 ? TRUE : FALSE);
- if (!opt->subcontact_windows)
+ if ( !opt->subcontact_windows)
opt->metahistory = TRUE;
else
opt->metahistory = (db_get_b(NULL, META_PROTO, "MetaHistory", 1) == 1 ? TRUE : FALSE);
@@ -340,7 +340,7 @@ ProtoStatusPrio *priorities = 0;
int GetRealPriority(char *proto, int status) {
char szSetting[256];
- if (!proto) {
+ if ( !proto) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", status);
return db_get_w(0, META_PROTO, szSetting, GetDefaultPrio(status));
} else {
@@ -401,7 +401,7 @@ void WritePriorities() {
current = priorities + (i + 1);
for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szModuleName, j);
- if (!current->def[j - ID_STATUS_OFFLINE])
+ if ( !current->def[j - ID_STATUS_OFFLINE])
db_set_w(0, META_PROTO, szSetting, (WORD)current->prio[j - ID_STATUS_OFFLINE]);
else
db_unset(0, META_PROTO, szSetting);
@@ -438,7 +438,7 @@ void SetPriority(int proto_index, int status, BOOL def, int prio) {
} else {
current = priorities + (proto_index + 1);
current->def[status - ID_STATUS_OFFLINE] = def;
- if (!def) {
+ if ( !def) {
current->prio[status - ID_STATUS_OFFLINE] = prio;
}
}
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp
index ead0bd10c8..d48d187d85 100644
--- a/plugins/MetaContacts/src/meta_services.cpp
+++ b/plugins/MetaContacts/src/meta_services.cpp
@@ -74,43 +74,41 @@ BOOL firstSetOnline = TRUE; // see Meta_SetStatus function
INT_PTR Meta_GetCaps(WPARAM wParam,LPARAM lParam)
{
int ret = 0;
- switch (wParam) {
- case PFLAGNUM_1:
- //ret = PF1_IM | PF1_URL | PF1_FILE | PF1_MODEMSG | PF1_AUTHREQ | PF1_ADDED;
- //ret = PF1_IMSEND | PF1_URLSEND | PF1_FILESEND | PF1_MODEMSGSEND;
- ret = PF1_IM | PF1_CHAT | PF1_FILESEND | PF1_MODEMSGRECV | PF1_NUMERICUSERID;
- break;
- case PFLAGNUM_2:
- if (!options.suppress_proto) {
- ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND
- | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
- }
- //ret = PF2_ONLINE;
- break;
- case PFLAGNUM_3:
- //ret = PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND;
- ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND
- | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
- break;
- case PFLAGNUM_4:
- //ret = PF4_FORCEAUTH;
- ret = PF4_SUPPORTTYPING | PF4_AVATARS;
- break;
- case PFLAGNUM_5:
- ret = PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND
- | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
- break;
- case PFLAG_UNIQUEIDTEXT:
- ret = (INT_PTR) Translate("Meta ID");
- break;
- case PFLAG_MAXLENOFMESSAGE:
- ret = 2000;
- break;
- case PFLAG_UNIQUEIDSETTING:
- ret = (INT_PTR) META_ID;
- break;
- }
- return ret;
+ switch (wParam) {
+ case PFLAGNUM_1:
+ ret = PF1_IM | PF1_CHAT | PF1_FILESEND | PF1_MODEMSGRECV | PF1_NUMERICUSERID;
+ break;
+
+ case PFLAGNUM_2:
+ if ( !options.suppress_proto)
+ ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ break;
+
+ case PFLAGNUM_3:
+ ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ break;
+
+ case PFLAGNUM_4:
+ ret = PF4_SUPPORTTYPING | PF4_AVATARS;
+ break;
+
+ case PFLAGNUM_5:
+ ret = PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ break;
+
+ case PFLAG_UNIQUEIDTEXT:
+ ret = (INT_PTR) Translate("Meta ID");
+ break;
+
+ case PFLAG_MAXLENOFMESSAGE:
+ ret = 2000;
+ break;
+
+ case PFLAG_UNIQUEIDSETTING:
+ ret = (INT_PTR)META_ID;
+ break;
+ }
+ return ret;
}
/** Copy the name of the protocole into lParam
@@ -136,40 +134,33 @@ INT_PTR Meta_GetName(WPARAM wParam,LPARAM lParam)
INT_PTR Meta_LoadIcon(WPARAM wParam,LPARAM lParam)
{
UINT id;
- switch (wParam & 0xFFFF)
- {
- case PLI_PROTOCOL:
- id = IDI_MCMENU;
- break;
- case PLI_ONLINE:
- id = IDI_MCMENU;
- break;
- case PLI_OFFLINE:
- id = IDI_MCMENU;
- break;
- default:
- return 0;
- }
-
- return (INT_PTR) LoadImage(hInstance, MAKEINTRESOURCE(id), IMAGE_ICON,
- GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
- GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ switch (wParam & 0xFFFF) {
+ case PLI_PROTOCOL:
+ id = IDI_MCMENU;
+ break;
+ case PLI_ONLINE:
+ id = IDI_MCMENU;
+ break;
+ case PLI_OFFLINE:
+ id = IDI_MCMENU;
+ break;
+ default:
+ return 0;
+ }
+ return (INT_PTR) LoadImage(hInstance, MAKEINTRESOURCE(id), IMAGE_ICON,
+ GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
+ GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
-
//static DWORD CALLBACK SetStatusThread( LPVOID param )
void CALLBACK SetStatusThread(HWND hWnd, UINT msg, UINT_PTR id, DWORD dw)
{
-
previousMode = mcStatus;
- //Sleep(options.set_status_from_offline_delay);
-
mcStatus = (int)ID_STATUS_ONLINE;
- ProtoBroadcastAck(META_PROTO,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
+ ProtoBroadcastAck(META_PROTO, NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
- //return 0;
KillTimer(0, setStatusTimerId);
}
@@ -177,6 +168,7 @@ void CALLBACK SetStatusThread(HWND hWnd, UINT msg, UINT_PTR id, DWORD dw)
* @param wParam : The new mode
* @param lParam : Allways set to 0.
*/
+
INT_PTR Meta_SetStatus(WPARAM wParam,LPARAM lParam)
{
// firstSetOnline starts out true - used to delay metacontact's 'onlineness' to prevent double status notifications on startup
@@ -188,7 +180,7 @@ INT_PTR Meta_SetStatus(WPARAM wParam,LPARAM lParam)
} else {
previousMode = mcStatus;
mcStatus = (int)wParam;
- ProtoBroadcastAck(META_PROTO,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
+ ProtoBroadcastAck(META_PROTO, NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
}
return 0;
}
@@ -203,28 +195,14 @@ INT_PTR Meta_GetStatus(WPARAM wParam,LPARAM lParam)
//////////////////////////////////////////////////////////
/// Copied from MSN plugin - sent acks need to be from different thread :(
//////////////////////////////////////////////////////////
-typedef struct tag_TFakeAckParams
+
+struct TFakeAckParams
{
HANDLE hEvent;
HANDLE hContact;
LONG id;
char msg[512];
-} TFakeAckParams;
-
-/*
-static DWORD CALLBACK sttFakeAckSuccess( LPVOID param )
-{
- TFakeAckParams *tParam = ( TFakeAckParams* )param;
- WaitForSingleObject( tParam->hEvent, INFINITE );
-
- Sleep( 100 );
- ProtoBroadcastAck(META_PROTO, tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, ( HANDLE )tParam->id, 0 );
-
- CloseHandle( tParam->hEvent );
- free(tParam);
- return 0;
-}
-*/
+};
static DWORD CALLBACK sttFakeAckFail( LPVOID param )
{
@@ -251,13 +229,11 @@ static DWORD CALLBACK sttFakeAckFail( LPVOID param )
INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam)
{
- DBEVENTINFO dbei;
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *) lParam;
HANDLE hMeta;
- if ((hMeta = (HANDLE)db_get_dw(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) {
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // Can't find the MetaID of the metacontact linked to
- }
+ if ((hMeta = (HANDLE)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0)
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // Can't find the MetaID of the metacontact linked to
// if subcontact sending, add db event to keep metacontact history correct
if (options.metahistory && !(ccs->wParam & PREF_METANODB)) {
@@ -274,8 +250,7 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam)
if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "?OTR", 4) == 0)
return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = META_PROTO;
dbei.flags = DBEF_SENT;
dbei.timestamp = time(NULL);
@@ -295,16 +270,13 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam)
INT_PTR Meta_SendNudge(WPARAM wParam,LPARAM lParam)
{
- HANDLE hMeta = (HANDLE)wParam,
- hSubContact = Meta_GetMostOnline(hMeta);
+ HANDLE hMeta = (HANDLE)wParam, hSubContact = Meta_GetMostOnline(hMeta);
char servicefunction[ 100 ];
char *protoName = GetContactProto(hSubContact);
sprintf(servicefunction, "%s/SendNudge", protoName);
return CallService(servicefunction, (WPARAM)hSubContact, lParam);
-
- //return CallService("NUDGE/Send", (WPARAM)hSubContact, lParam);
}
/////////////////////////////////////////////////////////////////
@@ -325,8 +297,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam)
char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
- {
+ if ((default_contact_number = db_get_dw(ccs->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1) {
// This is a simple contact, let through the stack of protocols
// (this should normally not happen, since linked contacts do not appear on the list.)
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
@@ -335,13 +306,13 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam)
char szServiceName[100];
HANDLE most_online = Meta_GetMostOnline(ccs->hContact);
- if (!most_online) {
+ if ( !most_online) {
DWORD dwThreadId;
HANDLE hEvent;
TFakeAckParams *tfap;
// send failure to notify user of reason
- hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
+ hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
tfap = (TFakeAckParams *)mir_alloc(sizeof(TFakeAckParams));
tfap->hContact = ccs->hContact;
@@ -407,18 +378,17 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam)
*
* @return 0 on success, 1 otherwise.
*/
+
INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
{
- DBEVENTINFO dbei;
- CCSDATA *ccs = (CCSDATA *) lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+ DBEVENTINFO dbei;
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
HANDLE hMeta;
- if ((hMeta = (HANDLE)db_get_dw(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) {
- CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // Can't find the MetaID of the metacontact linked to
- // this contact, let through the protocol chain
- return 0;
- }
+ // Can't find the MetaID of the metacontact linked to this contact, let through the protocol chain
+ if ((hMeta = (HANDLE)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0)
+ return CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs);
if (options.set_default_on_recv) {
if (options.temp_default && db_get_dw(hMeta, META_PROTO, "SavedDefault", (DWORD)-1) == (DWORD)-1)
@@ -429,23 +399,18 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
// if meta disabled (now message api) or window open (message api), or using subcontact windows,
// let through but add db event for metacontact history
- if (!Meta_IsEnabled()
- || db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1
- || options.subcontact_windows)
- {
+ if ( !Meta_IsEnabled() || db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1 || options.subcontact_windows) {
// add a clist event, so that e.g. there is an icon flashing
// (only add it when message api available, 'cause then we can remove the event when the message window is opened)
- if (message_window_api_enabled
+ if (message_window_api_enabled
&& db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 0
&& db_get_b(hMeta, META_PROTO, "WindowOpen", 0) == 0
&& options.flash_meta_message_icon)
{
- CLISTEVENT cle;
char toolTip[256], *contactName;
- ZeroMemory(&cle, sizeof(cle));
- cle.cbSize = sizeof(cle);
+ CLISTEVENT cle = { sizeof(cle) };
cle.hContact = hMeta;
cle.hDbEvent = ccs->hContact; // use subcontact handle as key - then we can remove all events if the subcontact window is opened
cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
@@ -457,12 +422,10 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
}
if (options.metahistory) {
-
BOOL added = FALSE;
// should be able to do this, but some protos mess with the memory
- if (options.use_proto_recv)
- {
+ if (options.use_proto_recv) {
// use the subcontact's protocol 'recv' service to add the meta's history (AIMOSCAR removes HTML here!) if possible
char *proto = GetContactProto(ccs->hContact);
if (proto) {
@@ -479,7 +442,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
}
}
- if (!added) {
+ if ( !added) {
// otherwise add raw db event
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
@@ -499,43 +462,18 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
}
}
- CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs);
- return 0;
- } // else:
-
- /*
- // add event to subcontact history (would do it in meta_recvmessage, but here we have the hcontact)
- // should be able to use the method below, except some protos can mess with the memory
- if (options.subhistory) {
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = GetContactProto(ccs->hContact, 0);
- dbei.timestamp = pre->timestamp;
- dbei.flags = (db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
- if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = strlen(pre->szMessage) + 1;
- if ( pre->flags & PREF_UNICODE )
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE) pre->szMessage;
-
- CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM)&dbei);
+ return CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs);
}
- */
-
- {
- HANDLE hSub = ccs->hContact;
- ccs->hContact = hMeta; // Forward to the associated MetaContact.
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)ccs);
- ccs->hContact = hSub;
- }
+ HANDLE hSub = ccs->hContact;
+ ccs->hContact = hMeta; // Forward to the associated MetaContact.
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)ccs);
+ ccs->hContact = hSub;
if (options.subhistory && !(ccs->wParam & PREF_METANODB)) {
// allow event pass through and thereby be added to subcontact history
pre->flags |= (db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
- CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // pass through as normal
- return 0;
+ return CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // pass through as normal
}
return 1; // Stop further processing.
@@ -547,19 +485,17 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
*/
INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO dbei;
- CCSDATA *ccs = (CCSDATA *) lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+ DBEVENTINFO dbei;
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
char *proto = GetContactProto(ccs->hContact);
// contact is not a meta proto contact - just leave it
- if (!proto || strcmp(proto, META_PROTO)) {
+ if ( !proto || strcmp(proto, META_PROTO))
return 0;
- }
- if (options.use_proto_recv)
- {
+ if (options.use_proto_recv) {
// use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!)
HANDLE most_online = Meta_GetMostOnline(ccs->hContact);
char *proto = GetContactProto(most_online);
@@ -573,22 +509,22 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
// otherwise, add event to db directly
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = META_PROTO;
- dbei.timestamp = pre->timestamp;
- dbei.flags = (pre->flags & PREF_CREATEREAD ? DBEF_READ : 0);
+ ZeroMemory(&dbei, sizeof(dbei));
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = META_PROTO;
+ dbei.timestamp = pre->timestamp;
+ dbei.flags = (pre->flags & PREF_CREATEREAD ? DBEF_READ : 0);
if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
- dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
if ( pre->flags & PREF_UNICODE )
dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE) pre->szMessage;
+ dbei.pBlob = (PBYTE) pre->szMessage;
CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM)&dbei);
- return 0;
+ return 0;
}
@@ -600,7 +536,7 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
*
* @param wParam : Allways set to 0.
* @param lParam : Reference to a ACKDATA that contains
- information about the ACK.
+information about the ACK.
* @return 0 on success, 1 otherwise.
*/
int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
@@ -608,11 +544,11 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
ACKDATA *ack = (ACKDATA*) lParam;
HANDLE hUser;
- if (ack->hContact == 0 || (hUser = (HANDLE)db_get_dw(ack->hContact,META_PROTO,"Handle",0)) == 0)
+ if (ack->hContact == 0 || (hUser = (HANDLE)db_get_dw(ack->hContact, META_PROTO, "Handle",0)) == 0)
return 0; // Can't find the MetaID, let through the protocol chain
- if (!strcmp(ack->szModule, META_PROTO)) {
+ if ( !strcmp(ack->szModule, META_PROTO)) {
return 0; // don't rebroadcast our own acks
}
@@ -624,7 +560,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
return 0;
}
- // change the hContact in the avatar info struct, if it's the avatar we're using - else drop it
+ // change the hContact in the avatar info struct, if it's the avatar we're using - else drop it
if (ack->type == ACKTYPE_AVATAR) {
if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED || ack->result == ACKRESULT_STATUS) {
HANDLE most_online;
@@ -637,8 +573,8 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
return 0;
}
- //if (!db_get(AI.hContact, "ContactPhoto", "File", &dbv)) {
- if (!db_get(ack->hContact, "ContactPhoto", "File", &dbv)) {
+ //if ( !db_get(AI.hContact, "ContactPhoto", "File", &dbv)) {
+ if ( !db_get(ack->hContact, "ContactPhoto", "File", &dbv)) {
DBWriteContactSettingTString(hUser, "ContactPhoto", "File", dbv.ptszVal);
db_free(&dbv);
}
@@ -649,13 +585,13 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
if (AI.hContact)
AI.hContact = hUser;
- return ProtoBroadcastAck(META_PROTO,hUser,ack->type,ack->result, (HANDLE)&AI, ack->lParam);
+ return ProtoBroadcastAck(META_PROTO, hUser,ack->type,ack->result, (HANDLE)&AI, ack->lParam);
} else
- return ProtoBroadcastAck(META_PROTO,hUser,ack->type,ack->result, 0, ack->lParam);
+ return ProtoBroadcastAck(META_PROTO, hUser,ack->type,ack->result, 0, ack->lParam);
}
}
- return ProtoBroadcastAck(META_PROTO,hUser,ack->type,ack->result,ack->hProcess,ack->lParam);
+ return ProtoBroadcastAck(META_PROTO, hUser,ack->type,ack->result,ack->hProcess,ack->lParam);
}
// hiding contacts on "CList/UseGroups" setting changed can cause a crash - do it in a seperate thread during idle time
@@ -681,7 +617,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
// hide metacontacts when groups disabled
if (wParam == 0
&& ((strcmp(dcws->szModule, "CList") == 0 && strcmp(dcws->szSetting, "UseGroups") == 0)
- || (strcmp(dcws->szModule, META_PROTO) == 0 && strcmp(dcws->szSetting, "Enabled") == 0)))
+ || (strcmp(dcws->szModule, META_PROTO) == 0 && strcmp(dcws->szSetting, "Enabled") == 0)))
{
sttHideContacts(!Meta_IsEnabled());
return 0;
@@ -696,7 +632,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
HANDLE hContact = db_find_first();
int meta_id;
while ( hContact != NULL ) {
- if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1))!=(DWORD)-1) {
Meta_CopyData(hContact);
}
hContact = db_find_next(hContact);
@@ -717,7 +653,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
// from here on, we're just interested in contact settings
if (wParam == 0) return 0;
- if ((hMeta=(HANDLE)db_get_dw((HANDLE)wParam,META_PROTO,"Handle",0))!=0
+ if ((hMeta=(HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle",0))!=0
&& CallService(MS_DB_CONTACT_IS, (WPARAM)hMeta, 0)) // just to be safe
{ // This contact is attached to a MetaContact.
@@ -725,176 +661,176 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
contact_number = Meta_GetContactNumber((HANDLE)wParam);
if (contact_number == -1) return 0; // exit - db corruption
- if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") &&
- Meta_IsEnabled() && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) {
- if ((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) {
- // subcontact group reassigned - copy to saved group
- MyDBWriteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value);
- db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
- } else if (dcws->value.type == DBVT_DELETED) {
- db_unset((HANDLE)wParam, META_PROTO, "OldCListGroup");
- db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
- }
- } else
-
- // copy IP
- if (!strcmp(dcws->szSetting, "IP")) {
- if (dcws->value.type == DBVT_DWORD)
- db_set_dw(hMeta, META_PROTO, "IP", dcws->value.dVal);
- else
- db_unset(hMeta, META_PROTO, "IP");
- } else
-
- // copy RealIP
- if (!strcmp(dcws->szSetting, "RealIP")) {
- if (dcws->value.type == DBVT_DWORD)
- db_set_dw(hMeta, META_PROTO, "RealIP", dcws->value.dVal);
- else
- db_unset(hMeta, META_PROTO, "RealIP");
-
- } else
- // copy ListeningTo
- if (!strcmp(dcws->szSetting, "ListeningTo")) {
- switch(dcws->value.type) {
- case DBVT_ASCIIZ:
- db_set_s(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
- break;
- case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
- break;
- case DBVT_WCHAR:
- DBWriteContactSettingWString(hMeta, META_PROTO, "ListeningTo", dcws->value.pwszVal);
- break;
- case DBVT_DELETED:
- db_unset(hMeta, META_PROTO, "ListeningTo");
- break;
- }
- } else
-
- if (!strcmp(dcws->szSetting, "Nick") && !dcws->value.type == DBVT_DELETED) {
- DBVARIANT dbv;
- HANDLE most_online;
-
- // subcontact nick has changed - update metacontact
- strcpy(buffer, "Nick");
- strcat(buffer, _itoa(contact_number, buffer2, 10));
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
-
- if (Mydb_get((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
- strcpy(buffer, "CListName");
- strcat(buffer, _itoa(contact_number, buffer2, 10));
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
- } else {
- db_free(&dbv);
- }
-
- // copy nick to metacontact, if it's the most online
- most_online = Meta_GetMostOnline(hMeta);
- Meta_CopyContactNick(hMeta, most_online);
-
- return 0;
- } else
-
- if (!strcmp(dcws->szSetting, "IdleTS")) {
- if (dcws->value.type == DBVT_DWORD)
- db_set_dw(hMeta, META_PROTO, "IdleTS", dcws->value.dVal);
- else if (dcws->value.type == DBVT_DELETED)
- db_set_dw(hMeta, META_PROTO, "IdleTS", 0);
- } else
-
- if (!strcmp(dcws->szSetting, "LogonTS")) {
- if (dcws->value.type == DBVT_DWORD)
- db_set_dw(hMeta, META_PROTO, "LogonTS", dcws->value.dVal);
- else if (dcws->value.type == DBVT_DELETED)
- db_set_dw(hMeta, META_PROTO, "LogonTS", 0);
- } else
-
- if (!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) {
- HANDLE most_online;
-
- if (dcws->value.type == DBVT_DELETED) {
- DBVARIANT dbv;
-
- char *proto = GetContactProto((HANDLE)wParam);
- strcpy(buffer, "CListName");
- strcat(buffer, _itoa(contact_number, buffer2, 10));
- if (proto && !Mydb_get((HANDLE)wParam, proto, "Nick", &dbv)) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dbv);
- db_free(&dbv);
- } else {
- db_unset(hMeta, META_PROTO, buffer);
+ if ( !meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") &&
+ Meta_IsEnabled() && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) {
+ if ((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) {
+ // subcontact group reassigned - copy to saved group
+ MyDBWriteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value);
+ db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
+ } else if (dcws->value.type == DBVT_DELETED) {
+ db_unset((HANDLE)wParam, META_PROTO, "OldCListGroup");
+ db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
}
- } else {
- // subcontact clist displayname has changed - update metacontact
- strcpy(buffer, "CListName");
- strcat(buffer, _itoa(contact_number, buffer2, 10));
-
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
- }
-
- // copy nick to metacontact, if it's the most online
- most_online = Meta_GetMostOnline(hMeta);
- Meta_CopyContactNick(hMeta, most_online);
-
- return 0;
- } else
-
- if (!strcmp(dcws->szSetting, "Status") && !dcws->value.type == DBVT_DELETED) {
- // subcontact changing status
-
- // update subcontact status setting
- strcpy(buffer, "Status");
- strcat(buffer, _itoa(contact_number, buffer2, 10));
- db_set_w(hMeta, META_PROTO, buffer, dcws->value.wVal);
- strcpy(buffer, "StatusString");
- strcat(buffer, _itoa(contact_number, buffer2, 10));
- Meta_GetStatusString(dcws->value.wVal, buffer2, 512);
- db_set_s(hMeta, META_PROTO, buffer, buffer2);
-
- // if the contact was forced, unforce it (which updates status)
- if ((HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) {
- MetaAPI_UnforceSendContact((WPARAM)hMeta, 0);
- } else {
- // set status to that of most online contact
- most_online = Meta_GetMostOnline(hMeta);
- Meta_CopyContactNick(hMeta, most_online);
-
- Meta_FixStatus(hMeta);
-
- Meta_CopyData(hMeta);
- }
-
- // most online contact with avatar support might have changed - update avatar
- most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
- if (most_online) {
- PROTO_AVATAR_INFORMATIONT AI;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = hMeta;
- AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
-
- if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingTString(hMeta, "ContactPhoto", "File",AI.filename);
- }
} else
- if (strcmp(dcws->szSetting, "XStatusId") == 0 || strcmp(dcws->szSetting, "XStatusMsg") == 0 || strcmp(dcws->szSetting, "XStatusName") == 0 || strcmp(dcws->szSetting, "StatusMsg") == 0) {
- Meta_CopyData(hMeta);
- } else
-
- if (strcmp(dcws->szSetting, "MirVer") == 0) {
- Meta_CopyData(hMeta);
- } else
+ // copy IP
+ if ( !strcmp(dcws->szSetting, "IP")) {
+ if (dcws->value.type == DBVT_DWORD)
+ db_set_dw(hMeta, META_PROTO, "IP", dcws->value.dVal);
+ else
+ db_unset(hMeta, META_PROTO, "IP");
+ } else
- if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Hidden")) {
- if ((dcws->value.type == DBVT_DELETED || db_get_b((HANDLE)wParam, "CList", "Hidden", 0) == 0)
- && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 1)
- {
- // a subcontact we hid (e.g. jabber) has been unhidden - hide it again :(
- db_set_b((HANDLE)wParam, "CList", "Hidden", 1);
- }
- }
+ // copy RealIP
+ if ( !strcmp(dcws->szSetting, "RealIP")) {
+ if (dcws->value.type == DBVT_DWORD)
+ db_set_dw(hMeta, META_PROTO, "RealIP", dcws->value.dVal);
+ else
+ db_unset(hMeta, META_PROTO, "RealIP");
+
+ } else
+ // copy ListeningTo
+ if ( !strcmp(dcws->szSetting, "ListeningTo")) {
+ switch(dcws->value.type) {
+ case DBVT_ASCIIZ:
+ db_set_s(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
+ break;
+ case DBVT_UTF8:
+ DBWriteContactSettingStringUtf(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
+ break;
+ case DBVT_WCHAR:
+ DBWriteContactSettingWString(hMeta, META_PROTO, "ListeningTo", dcws->value.pwszVal);
+ break;
+ case DBVT_DELETED:
+ db_unset(hMeta, META_PROTO, "ListeningTo");
+ break;
+ }
+ } else
+
+ if ( !strcmp(dcws->szSetting, "Nick") && !dcws->value.type == DBVT_DELETED) {
+ DBVARIANT dbv;
+ HANDLE most_online;
+
+ // subcontact nick has changed - update metacontact
+ strcpy(buffer, "Nick");
+ strcat(buffer, _itoa(contact_number, buffer2, 10));
+ MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
+
+ if (Mydb_get((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
+ strcpy(buffer, "CListName");
+ strcat(buffer, _itoa(contact_number, buffer2, 10));
+ MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
+ } else {
+ db_free(&dbv);
+ }
+
+ // copy nick to metacontact, if it's the most online
+ most_online = Meta_GetMostOnline(hMeta);
+ Meta_CopyContactNick(hMeta, most_online);
+
+ return 0;
+ } else
+
+ if ( !strcmp(dcws->szSetting, "IdleTS")) {
+ if (dcws->value.type == DBVT_DWORD)
+ db_set_dw(hMeta, META_PROTO, "IdleTS", dcws->value.dVal);
+ else if (dcws->value.type == DBVT_DELETED)
+ db_set_dw(hMeta, META_PROTO, "IdleTS", 0);
+ } else
+
+ if ( !strcmp(dcws->szSetting, "LogonTS")) {
+ if (dcws->value.type == DBVT_DWORD)
+ db_set_dw(hMeta, META_PROTO, "LogonTS", dcws->value.dVal);
+ else if (dcws->value.type == DBVT_DELETED)
+ db_set_dw(hMeta, META_PROTO, "LogonTS", 0);
+ } else
+
+ if ( !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) {
+ HANDLE most_online;
+
+ if (dcws->value.type == DBVT_DELETED) {
+ DBVARIANT dbv;
+
+ char *proto = GetContactProto((HANDLE)wParam);
+ strcpy(buffer, "CListName");
+ strcat(buffer, _itoa(contact_number, buffer2, 10));
+ if (proto && !Mydb_get((HANDLE)wParam, proto, "Nick", &dbv)) {
+ MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dbv);
+ db_free(&dbv);
+ } else {
+ db_unset(hMeta, META_PROTO, buffer);
+ }
+ } else {
+ // subcontact clist displayname has changed - update metacontact
+ strcpy(buffer, "CListName");
+ strcat(buffer, _itoa(contact_number, buffer2, 10));
+
+ MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
+ }
+
+ // copy nick to metacontact, if it's the most online
+ most_online = Meta_GetMostOnline(hMeta);
+ Meta_CopyContactNick(hMeta, most_online);
+
+ return 0;
+ } else
+
+ if ( !strcmp(dcws->szSetting, "Status") && !dcws->value.type == DBVT_DELETED) {
+ // subcontact changing status
+
+ // update subcontact status setting
+ strcpy(buffer, "Status");
+ strcat(buffer, _itoa(contact_number, buffer2, 10));
+ db_set_w(hMeta, META_PROTO, buffer, dcws->value.wVal);
+ strcpy(buffer, "StatusString");
+ strcat(buffer, _itoa(contact_number, buffer2, 10));
+ Meta_GetStatusString(dcws->value.wVal, buffer2, 512);
+ db_set_s(hMeta, META_PROTO, buffer, buffer2);
+
+ // if the contact was forced, unforce it (which updates status)
+ if ((HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) {
+ MetaAPI_UnforceSendContact((WPARAM)hMeta, 0);
+ } else {
+ // set status to that of most online contact
+ most_online = Meta_GetMostOnline(hMeta);
+ Meta_CopyContactNick(hMeta, most_online);
+
+ Meta_FixStatus(hMeta);
+
+ Meta_CopyData(hMeta);
+ }
+
+ // most online contact with avatar support might have changed - update avatar
+ most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
+ if (most_online) {
+ PROTO_AVATAR_INFORMATIONT AI;
+
+ AI.cbSize = sizeof(AI);
+ AI.hContact = hMeta;
+ AI.format = PA_FORMAT_UNKNOWN;
+ _tcscpy(AI.filename, _T("X"));
+
+ if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
+ DBWriteContactSettingTString(hMeta, "ContactPhoto", "File",AI.filename);
+ }
+ } else
+
+ if (strcmp(dcws->szSetting, "XStatusId") == 0 || strcmp(dcws->szSetting, "XStatusMsg") == 0 || strcmp(dcws->szSetting, "XStatusName") == 0 || strcmp(dcws->szSetting, "StatusMsg") == 0) {
+ Meta_CopyData(hMeta);
+ } else
+
+ if (strcmp(dcws->szSetting, "MirVer") == 0) {
+ Meta_CopyData(hMeta);
+ } else
+
+ if ( !meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Hidden")) {
+ if ((dcws->value.type == DBVT_DELETED || db_get_b((HANDLE)wParam, "CList", "Hidden", 0) == 0)
+ && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 1)
+ {
+ // a subcontact we hid (e.g. jabber) has been unhidden - hide it again :(
+ db_set_b((HANDLE)wParam, "CList", "Hidden", 1);
+ }
+ }
}
return 0;
@@ -923,14 +859,13 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) {
if (hContact && (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) {
if (db_get_b(hContact, META_PROTO, "IsSubcontact", 0) == 1)
- db_unset(hContact,META_PROTO,"IsSubcontact");
- db_unset(hContact,META_PROTO,META_LINK);
- db_unset(hContact,META_PROTO,"Handle");
- db_unset(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact, META_PROTO, "IsSubcontact");
+ db_unset(hContact, META_PROTO, META_LINK);
+ db_unset(hContact, META_PROTO, "Handle");
+ db_unset(hContact, META_PROTO, "ContactNumber");
Meta_RestoreGroup(hContact);
- db_unset(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact, META_PROTO, "OldCListGroup");
- CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)META_FILTER);
// stop ignoring, if we were
if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
@@ -953,7 +888,7 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam)
char *proto;
char buff[512];
- if (db_get_dw((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1) == (DWORD)-1)
+ if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID,(DWORD)-1) == (DWORD)-1)
{
// This is a simple contact, let through the stack of protocols
return 0;
@@ -965,7 +900,7 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam)
HANDLE most_online = Meta_GetMostOnline((HANDLE)wParam);
Meta_CopyContactNick((HANDLE)wParam, most_online);
- if (!most_online) return 0;
+ if ( !most_online) return 0;
proto = GetContactProto(most_online);
if (proto) {
@@ -990,12 +925,12 @@ int Meta_ContactIsTyping(WPARAM wParam, LPARAM lParam)
{
HANDLE hMeta;
- if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam,META_PROTO,"Handle",(DWORD)0)) != 0
- // check metacontacts enabled
- && Meta_IsEnabled()
+ if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle",0)) != 0
+ // check metacontacts enabled
+ && Meta_IsEnabled()
)
{ // This contact is attached to a MetaContact.
- if (!options.subcontact_windows) { // we don't want clicking on the clist notification icon to open the metacontact message window
+ if ( !options.subcontact_windows) { // we don't want clicking on the clist notification icon to open the metacontact message window
// try to remove any clist events we added for subcontact
CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1);
@@ -1047,7 +982,7 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) {
}
} else if (mwed->uType == MSG_WINDOW_EVT_CLOSE || mwed->uType == MSG_WINDOW_EVT_CLOSING) {
db_set_b(mwed->hContact, META_PROTO, "WindowOpen", 0);
- if (!hMeta) { // hMeta is 0 for metacontact (sorry)
+ if ( !hMeta) { // hMeta is 0 for metacontact (sorry)
DWORD saved_def;
MetaAPI_UnforceSendContact((WPARAM)mwed->hContact, 0);
@@ -1071,7 +1006,7 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) {
int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam)
{
- if (db_get_dw((HANDLE)wParam,META_PROTO,"Default",(WORD)-1) == (WORD)-1)
+ if (db_get_dw((HANDLE)wParam, META_PROTO, "Default",(WORD)-1) == (WORD)-1)
{
// This is a simple contact
return 0;
@@ -1080,12 +1015,12 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam)
{
// -1 indicates no specific capability but respect 'ForceDefault'
HANDLE most_online = Meta_GetMostOnlineSupporting((HANDLE)wParam, PFLAGNUM_1, -1);
- //DBEVENTINFO dbei;
+ //DBEVENTINFO dbei;
char *proto;
char buffer[512];
int caps;
- if (!most_online)
+ if ( !most_online)
return 0;
if (options.subcontact_windows) {
@@ -1135,9 +1070,9 @@ INT_PTR Meta_ClistMessageEventClicked(WPARAM wParam, LPARAM lParam) {
int NudgeRecieved(WPARAM wParam, LPARAM lParam) {
/*
// already being forwarded by someone
- HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)wParam,META_PROTO, "Handle", (DWORD)0);
+ HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0);
if (hMeta)
- NotifyEventHooks(hEventNudge, (WPARAM)hMeta, 0);
+ NotifyEventHooks(hEventNudge, (WPARAM)hMeta, 0);
*/
return 0;
}
@@ -1164,7 +1099,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
// for database editor++ ver 3+
if (ServiceExists("DBEditorpp/RegisterSingleModule"))
- CallService("DBEditorpp/RegisterSingleModule",(WPARAM)META_PROTO,0);
+ CallService("DBEditorpp/RegisterSingleModule",(WPARAM)META_PROTO, 0);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu);
HookEvent(ME_CLIST_DOUBLECLICKED, Meta_ClistDoubleClicked );
@@ -1226,7 +1161,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
hMenuContact[i] = Menu_AddContactMenuItem(&mi);
}
- nextMetaID = db_get_dw(NULL,META_PROTO,"NextMetaID",(DWORD)0);
+ nextMetaID = db_get_dw(NULL, META_PROTO, "NextMetaID",0);
// attemp to subsume userinfo...(returning 1 does not prevent dialog - so disabled)
//hHooks[] = (HANDLE)HookEvent(ME_USERINFO_INITIALISE, Meta_UserInfo);
@@ -1236,7 +1171,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
HANDLE hContact = db_find_first();
int meta_id;
while ( hContact != NULL ) {
- if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1))!=(DWORD)-1) {
Meta_CopyData(hContact);
}
hContact = db_find_next(hContact);
@@ -1247,7 +1182,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
InitIcons();
- if (!Meta_IsEnabled())
+ if ( !Meta_IsEnabled())
{
// modify main menu item
mi.flags = CMIM_NAME;
@@ -1350,11 +1285,11 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) {
INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam)
{
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1364,12 +1299,12 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam)
else
{
HANDLE most_online;
- //DBEVENTINFO dbei;
+ //DBEVENTINFO dbei;
//char szServiceName[100];
most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILESEND);
- if (!most_online) {
+ if ( !most_online) {
//PUShowMessage("no most online for ft", SM_NOTIFY);
return 0;
}
@@ -1385,21 +1320,21 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam)
//_snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILE);
//if (ServiceExists(szServiceName)) {
// PUShowMessage("sending to subcontact", SM_NOTIFY);
- return (int)(CallContactService(most_online, PSS_FILE, ccs->wParam, ccs->lParam));
+ return (int)(CallContactService(most_online, PSS_FILE, ccs->wParam, ccs->lParam));
//} else
// PUShowMessage("no service", SM_NOTIFY);
} //else
- //PUShowMessage("no proto for subcontact", SM_NOTIFY);
+ //PUShowMessage("no proto for subcontact", SM_NOTIFY);
}
return 0; // fail
}
INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1411,11 +1346,11 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) {
most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_MODEMSGRECV);
- if (!most_online)
+ if ( !most_online)
return 0;
proto = GetContactProto(most_online);
- if (!proto) return 0;
+ if ( !proto) return 0;
//Meta_CopyContactNick(ccs->hContact, most_online, proto);
@@ -1428,11 +1363,11 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) {
}
INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
- PROTO_AVATAR_INFORMATIONT *AI = (PROTO_AVATAR_INFORMATIONT *) lParam;
+ PROTO_AVATAR_INFORMATIONT *AI = (PROTO_AVATAR_INFORMATIONT *) lParam;
char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = db_get_dw(AI->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(AI->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1447,11 +1382,11 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
hMeta = AI->hContact;
hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS);
- if (!hSub)
+ if ( !hSub)
return GAIR_NOAVATAR;
proto = GetContactProto(hSub);
- if (!proto) return GAIR_NOAVATAR;
+ if ( !proto) return GAIR_NOAVATAR;
AI->hContact = hSub;
@@ -1464,11 +1399,11 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
}
INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1482,23 +1417,23 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) {
most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS);
- if (!most_online)
+ if ( !most_online)
return 0;
proto = GetContactProto(most_online);
- if (!proto) return 0;
+ if ( !proto) return 0;
AI.cbSize = sizeof(AI);
AI.hContact = ccs->hContact;
AI.format = PA_FORMAT_UNKNOWN;
_tcscpy(AI.filename, _T("X"));
if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingTString(ccs->hContact, "ContactPhoto", "File",AI.filename);
+ DBWriteContactSettingTString(ccs->hContact, "ContactPhoto", "File",AI.filename);
most_online = Meta_GetMostOnline(ccs->hContact);
Meta_CopyContactNick(ccs->hContact, most_online);
- if (!most_online)
+ if ( !most_online)
return 0;
//Meta_CopyContactNick(ccs->hContact, most_online, proto);
@@ -1601,10 +1536,6 @@ int Meta_OkToExit(WPARAM wParam, LPARAM lParam) {
return 0;
}
-int Meta_OnIdleChanged(WPARAM wParam, LPARAM lParam) {
- return 0;
-}
-
/** Initializes all services provided by the plugin
*
* Creates every function and hooks the event desired.
@@ -1613,61 +1544,61 @@ void Meta_InitServices()
{
previousMode = mcStatus = ID_STATUS_OFFLINE;
- CreateServiceFunction("MetaContacts/Convert",Meta_Convert);
- CreateServiceFunction("MetaContacts/AddTo",Meta_AddTo);
- CreateServiceFunction("MetaContacts/Edit",Meta_Edit);
- CreateServiceFunction("MetaContacts/Delete",Meta_Delete);
- CreateServiceFunction("MetaContacts/Default",Meta_Default);
- CreateServiceFunction("MetaContacts/ForceDefault",Meta_ForceDefault);
+ CreateServiceFunction("MetaContacts/Convert", Meta_Convert);
+ CreateServiceFunction("MetaContacts/AddTo", Meta_AddTo);
+ CreateServiceFunction("MetaContacts/Edit", Meta_Edit);
+ CreateServiceFunction("MetaContacts/Delete", Meta_Delete);
+ CreateServiceFunction("MetaContacts/Default", Meta_Default);
+ CreateServiceFunction("MetaContacts/ForceDefault", Meta_ForceDefault);
// hidden contact menu items...ho hum
- CreateServiceFunction("MetaContacts/MenuFunc0",MenuFunc0);
- CreateServiceFunction("MetaContacts/MenuFunc1",MenuFunc1);
- CreateServiceFunction("MetaContacts/MenuFunc2",MenuFunc2);
- CreateServiceFunction("MetaContacts/MenuFunc3",MenuFunc3);
- CreateServiceFunction("MetaContacts/MenuFunc4",MenuFunc4);
- CreateServiceFunction("MetaContacts/MenuFunc5",MenuFunc5);
- CreateServiceFunction("MetaContacts/MenuFunc6",MenuFunc6);
- CreateServiceFunction("MetaContacts/MenuFunc7",MenuFunc7);
- CreateServiceFunction("MetaContacts/MenuFunc8",MenuFunc8);
- CreateServiceFunction("MetaContacts/MenuFunc9",MenuFunc9);
- CreateServiceFunction("MetaContacts/MenuFunc10",MenuFunc10);
- CreateServiceFunction("MetaContacts/MenuFunc11",MenuFunc11);
- CreateServiceFunction("MetaContacts/MenuFunc12",MenuFunc12);
- CreateServiceFunction("MetaContacts/MenuFunc13",MenuFunc13);
- CreateServiceFunction("MetaContacts/MenuFunc14",MenuFunc14);
- CreateServiceFunction("MetaContacts/MenuFunc15",MenuFunc15);
- CreateServiceFunction("MetaContacts/MenuFunc16",MenuFunc16);
- CreateServiceFunction("MetaContacts/MenuFunc17",MenuFunc17);
- CreateServiceFunction("MetaContacts/MenuFunc18",MenuFunc18);
- CreateServiceFunction("MetaContacts/MenuFunc19",MenuFunc19);
-
- CreateProtoServiceFunction(META_PROTO,PS_GETCAPS,Meta_GetCaps);
- CreateProtoServiceFunction(META_PROTO,PS_GETNAME,Meta_GetName);
- CreateProtoServiceFunction(META_PROTO,PS_LOADICON,Meta_LoadIcon);
-
- CreateProtoServiceFunction(META_PROTO,PS_SETSTATUS,Meta_SetStatus);
-
- CreateProtoServiceFunction(META_PROTO,PS_GETSTATUS,Meta_GetStatus);
- CreateProtoServiceFunction(META_PROTO,PSS_MESSAGE,Meta_SendMessage);
- CreateProtoServiceFunction(META_PROTO,PSS_MESSAGE"W",Meta_SendMessage); // unicode send (same send func as above line, checks for PREF_UNICODE)
-
- CreateProtoServiceFunction(META_PROTO,PSS_USERISTYPING,Meta_UserIsTyping );
-
- CreateProtoServiceFunction(META_PROTO,PSR_MESSAGE,Meta_RecvMessage);
+ CreateServiceFunction("MetaContacts/MenuFunc0", MenuFunc0);
+ CreateServiceFunction("MetaContacts/MenuFunc1", MenuFunc1);
+ CreateServiceFunction("MetaContacts/MenuFunc2", MenuFunc2);
+ CreateServiceFunction("MetaContacts/MenuFunc3", MenuFunc3);
+ CreateServiceFunction("MetaContacts/MenuFunc4", MenuFunc4);
+ CreateServiceFunction("MetaContacts/MenuFunc5", MenuFunc5);
+ CreateServiceFunction("MetaContacts/MenuFunc6", MenuFunc6);
+ CreateServiceFunction("MetaContacts/MenuFunc7", MenuFunc7);
+ CreateServiceFunction("MetaContacts/MenuFunc8", MenuFunc8);
+ CreateServiceFunction("MetaContacts/MenuFunc9", MenuFunc9);
+ CreateServiceFunction("MetaContacts/MenuFunc10", MenuFunc10);
+ CreateServiceFunction("MetaContacts/MenuFunc11", MenuFunc11);
+ CreateServiceFunction("MetaContacts/MenuFunc12", MenuFunc12);
+ CreateServiceFunction("MetaContacts/MenuFunc13", MenuFunc13);
+ CreateServiceFunction("MetaContacts/MenuFunc14", MenuFunc14);
+ CreateServiceFunction("MetaContacts/MenuFunc15", MenuFunc15);
+ CreateServiceFunction("MetaContacts/MenuFunc16", MenuFunc16);
+ CreateServiceFunction("MetaContacts/MenuFunc17", MenuFunc17);
+ CreateServiceFunction("MetaContacts/MenuFunc18", MenuFunc18);
+ CreateServiceFunction("MetaContacts/MenuFunc19", MenuFunc19);
+
+ CreateProtoServiceFunction(META_PROTO, PS_GETCAPS, Meta_GetCaps);
+ CreateProtoServiceFunction(META_PROTO, PS_GETNAME, Meta_GetName);
+ CreateProtoServiceFunction(META_PROTO, PS_LOADICON, Meta_LoadIcon);
+
+ CreateProtoServiceFunction(META_PROTO, PS_SETSTATUS, Meta_SetStatus);
+
+ CreateProtoServiceFunction(META_PROTO, PS_GETSTATUS, Meta_GetStatus);
+ CreateProtoServiceFunction(META_PROTO, PSS_MESSAGE, Meta_SendMessage);
+ CreateProtoServiceFunction(META_PROTO, PSS_MESSAGE"W", Meta_SendMessage); // unicode send (same send func as above line, checks for PREF_UNICODE)
+
+ CreateProtoServiceFunction(META_PROTO, PSS_USERISTYPING, Meta_UserIsTyping );
+
+ CreateProtoServiceFunction(META_PROTO, PSR_MESSAGE, Meta_RecvMessage);
// file recv is done by subcontacts
- CreateProtoServiceFunction(META_PROTO,PSS_FILE, Meta_FileSend);
+ CreateProtoServiceFunction(META_PROTO, PSS_FILE, Meta_FileSend);
- CreateProtoServiceFunction(META_PROTO,PSS_GETAWAYMSG,Meta_GetAwayMsg);
+ CreateProtoServiceFunction(META_PROTO, PSS_GETAWAYMSG, Meta_GetAwayMsg);
- CreateProtoServiceFunction(META_PROTO,PS_GETAVATARINFOT,Meta_GetAvatarInfo);
+ CreateProtoServiceFunction(META_PROTO, PS_GETAVATARINFOT, Meta_GetAvatarInfo);
- CreateProtoServiceFunction(META_PROTO,PSS_GETINFO,Meta_GetInfo);
+ CreateProtoServiceFunction(META_PROTO, PSS_GETINFO, Meta_GetInfo);
- CreateProtoServiceFunction(META_FILTER,PSR_MESSAGE,MetaFilter_RecvMessage);
- CreateProtoServiceFunction(META_FILTER,PSS_MESSAGE,MetaFilter_SendMessage);
- CreateProtoServiceFunction(META_FILTER,PSS_MESSAGE"W",MetaFilter_SendMessage);
+ CreateProtoServiceFunction(META_FILTER, PSR_MESSAGE, MetaFilter_RecvMessage);
+ CreateProtoServiceFunction(META_FILTER, PSS_MESSAGE, MetaFilter_SendMessage);
+ CreateProtoServiceFunction(META_FILTER, PSS_MESSAGE"W", MetaFilter_SendMessage);
// API services and events
CreateServiceFunction(MS_MC_GETMETACONTACT, MetaAPI_GetMeta);
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp
index 3160e67543..a11f28b90b 100644
--- a/plugins/MetaContacts/src/meta_utils.cpp
+++ b/plugins/MetaContacts/src/meta_utils.cpp
@@ -40,7 +40,7 @@ INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, D
static BOOL strsvc, strsvcset = FALSE;
memset(dbv, 0, sizeof(DBVARIANT));
- if (!strsvcset) {strsvc = ServiceExists(MS_DB_CONTACT_GETSETTING_STR); strsvcset = TRUE;}
+ if ( !strsvcset) {strsvc = ServiceExists(MS_DB_CONTACT_GETSETTING_STR); strsvcset = TRUE;}
// preserve unicode strings - this service should return other data types unchanged
if (strsvc) return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
@@ -70,10 +70,10 @@ int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) {
break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
- if (!strcmp(dbv->pszVal,id->pszVal))
+ if ( !strcmp(dbv->pszVal,id->pszVal))
return 1;
case DBVT_WCHAR:
- if (!wcscmp(dbv->pwszVal,id->pwszVal))
+ if ( !wcscmp(dbv->pwszVal,id->pwszVal))
return 1;
case DBVT_BLOB:
if (dbv->cpbVal == id->cpbVal)
@@ -110,14 +110,14 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id)
char str[MAXMODULELABELLENGTH];
strcpy(str,protocol);
strcat(str,PS_GETCAPS);
- if (!ServiceExists(str))
+ if ( !ServiceExists(str))
return NULL;
field = (char *)CallProtoService(protocol,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
hUser = db_find_first();
while(hUser) {
// Scan the database and retrieve the field for each contact
- if (!db_get(hUser,protocol,field,&dbv)) {
+ if ( !db_get(hUser,protocol,field,&dbv)) {
if (dbv.type == id->type) {
// If the id parameter and the value returned by the db_get
// are the same, this is the correct HANDLE, return it.
@@ -138,7 +138,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id)
break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
- if (!strcmp(dbv.pszVal,id->pszVal)) {
+ if ( !strcmp(dbv.pszVal,id->pszVal)) {
db_free(&dbv);
return hUser;
}
@@ -146,7 +146,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id)
break;
case DBVT_WCHAR:
- if (!wcscmp(dbv.pwszVal,id->pwszVal)) {
+ if ( !wcscmp(dbv.pwszVal,id->pwszVal)) {
db_free(&dbv);
return hUser;
}
@@ -196,24 +196,24 @@ int Meta_SetNick(char *proto)
switch(ci.type) {
case CNFT_BYTE:
- if ( db_set_b(NULL,META_PROTO,"Nick",ci.bVal))
+ if ( db_set_b(NULL, META_PROTO, "Nick",ci.bVal))
return 1;
break;
case CNFT_WORD:
- if ( db_set_w(NULL,META_PROTO,"Nick",ci.wVal))
+ if ( db_set_w(NULL, META_PROTO, "Nick",ci.wVal))
return 1;
break;
case CNFT_DWORD:
- if ( db_set_dw(NULL,META_PROTO,"Nick",ci.dVal))
+ if ( db_set_dw(NULL, META_PROTO, "Nick",ci.dVal))
return 1;
break;
case CNFT_ASCIIZ:
- if ( db_set_s(NULL,META_PROTO,"Nick",ci.pszVal))
+ if ( db_set_s(NULL, META_PROTO, "Nick",ci.pszVal))
return 1;
mir_free(ci.pszVal);
break;
default:
- if ( db_set_s(NULL,META_PROTO,"Nick",(char *)Translate("Sender")))
+ if ( db_set_s(NULL, META_PROTO, "Nick",(char *)Translate("Sender")))
return 1;
break;
}
@@ -239,15 +239,15 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
WORD status;
HANDLE most_online;
- if ((metaID=db_get_dw(dest,META_PROTO,META_ID,(DWORD)-1))==-1) {
+ if ((metaID=db_get_dw(dest, META_PROTO, META_ID,(DWORD)-1))==-1) {
MessageBox(0, Translate("Could not get MetaContact id"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
- if ((num_contacts=db_get_dw(dest,META_PROTO,"NumContacts",(DWORD)-1))==-1) {
+ if ((num_contacts=db_get_dw(dest, META_PROTO, "NumContacts",(DWORD)-1))==-1) {
MessageBox(0, Translate("Could not retreive MetaContact contact count"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
- if (!(proto = GetContactProto(src))) {
+ if ( !(proto = GetContactProto(src))) {
MessageBox(0, Translate("Could not retreive contact protocol"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -299,7 +299,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
db_free(&cws.value);
// If we can get the nickname of the subcontact...
- if (!db_get(src,proto,"Nick",&cws.value)) {
+ if ( !db_get(src,proto,"Nick",&cws.value)) {
// write the nickname
strcpy(buffer, "Nick");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
@@ -330,7 +330,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
db_set_s(dest, META_PROTO, buffer, name);
// Get the status
- if (!proto)
+ if ( !proto)
status = ID_STATUS_OFFLINE;
else
status = db_get_w(src, proto, "Status", ID_STATUS_OFFLINE);
@@ -362,25 +362,25 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
}
// Write the link in the contact
- if (db_set_dw(src,META_PROTO,META_LINK,metaID)) {
+ if (db_set_dw(src, META_PROTO, META_LINK,metaID)) {
MessageBox(0, Translate("Could not write MetaContact id to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the contact number in the contact
- if (db_set_dw(src,META_PROTO,"ContactNumber",(DWORD)(num_contacts - 1))) {
+ if (db_set_dw(src, META_PROTO, "ContactNumber",(DWORD)(num_contacts - 1))) {
MessageBox(0, Translate("Could not write MetaContact contact number to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the handle in the contact
- if (db_set_dw(src,META_PROTO,"Handle",(DWORD)dest)) {
+ if (db_set_dw(src, META_PROTO, "Handle",(DWORD)dest)) {
MessageBox(0, Translate("Could not write MetaContact contact number to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// update count of contacts
- if (db_set_dw(dest,META_PROTO,"NumContacts",num_contacts)) {
+ if (db_set_dw(dest, META_PROTO, "NumContacts",num_contacts)) {
MessageBox(0, Translate("Could not write contact count to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -453,7 +453,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca
char *proto, *most_online_proto;
// you can't get more online than having the default contact ONLINE - so check that first
- if ((default_contact_number = db_get_dw(hMeta,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(hMeta, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact - return NULL to signify error.
// (this should normally not happen, since all meta contacts have a default contact)
@@ -507,7 +507,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca
hContact = Meta_GetContactHandle(hMeta, i);
proto = GetContactProto(hContact);
- if (!proto || CallProtoService(proto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // proto offline or connecting
+ if ( !proto || CallProtoService(proto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // proto offline or connecting
continue;
caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
@@ -595,9 +595,9 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) {
hContact = Meta_GetContactHandle(hMeta, j);
if (hContact) {
- if (!module) {
+ if ( !module) {
used_mod = GetContactProto(hContact);
- if (!used_mod)
+ if ( !used_mod)
continue; // next contact
}
else used_mod = module;
@@ -611,14 +611,14 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) {
if (strcmp(settings[i], "MirVer") == 0) {
if (db_get_w(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- if (!free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) {
+ if ( !free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) {
MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
bDataWritten = TRUE; //only break if found something to copy
}
}
}
else {
- if (!free || !dbv_same(&dbv1, &dbv2)) {
+ if ( !free || !dbv_same(&dbv1, &dbv2)) {
MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
if (dbv2.type == DBVT_ASCIIZ || dbv2.type == DBVT_UTF8) {
if (dbv2.pszVal != NULL && strcmp(dbv2.pszVal, "") != 0)
@@ -690,7 +690,7 @@ void CopyStatusData(HANDLE hMeta)
char *proto = GetContactProto(hContact);
if (proto && db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) {
- if (!bDoneStatus && !Mydb_get(hContact, "CList", "StatusMsg", &dbv)) {
+ if ( !bDoneStatus && !Mydb_get(hContact, "CList", "StatusMsg", &dbv)) {
MyDBWriteContactSetting(hMeta, "CList", "StatusMsg", &dbv);
db_free(&dbv);
bDoneStatus = TRUE;
@@ -700,11 +700,11 @@ void CopyStatusData(HANDLE hMeta)
MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusId", &dbv);
db_free(&dbv);
- if (!Mydb_get(hContact, proto, "XStatusMsg", &dbv)) {
+ if ( !Mydb_get(hContact, proto, "XStatusMsg", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusMsg", &dbv);
db_free(&dbv);
}
- if (!Mydb_get(hContact, proto, "XStatusName", &dbv)) {
+ if ( !Mydb_get(hContact, proto, "XStatusName", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusName", &dbv);
db_free(&dbv);
}
@@ -715,8 +715,8 @@ void CopyStatusData(HANDLE hMeta)
if (bDoneStatus && bDoneXStatus) break;
}
- if (!bDoneStatus) db_unset(hMeta, "CList", "StatusMsg");
- if (!bDoneXStatus) {
+ if ( !bDoneStatus) db_unset(hMeta, "CList", "StatusMsg");
+ if ( !bDoneXStatus) {
db_unset(hMeta, META_PROTO, "XStatusId");
db_unset(hMeta, META_PROTO, "XStatusMsg");
db_unset(hMeta, META_PROTO, "XStatusName");
@@ -758,7 +758,7 @@ int Meta_SetHandles(void) {
BOOL found;
while ( hContact != NULL ) {
- if ((meta_id = db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1))!=(DWORD)-1) {
// is a subcontact
// get nick for debug messages
@@ -789,7 +789,7 @@ int Meta_SetHandles(void) {
hContact2 = db_find_first();
while ( hContact2 != NULL ) {
- if (db_get_dw(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
+ if (db_get_dw(hContact2, META_PROTO, META_ID,(DWORD)-1) == meta_id) {
found = TRUE;
// set handle
@@ -822,32 +822,31 @@ int Meta_SetHandles(void) {
hContact2 = db_find_next(hContact2);
}
- if (!found) {
+ if ( !found) {
// problem - subcontact's meta not found
MessageBox(0, Translate("Subcontact's MetaContact not found - deleting MetaContact data"), nick_buffer, MB_OK | MB_ICONERROR);
// delete meta data
- db_unset(hContact,META_PROTO,"IsSubcontact");
- db_unset(hContact,META_PROTO,META_LINK);
- db_unset(hContact,META_PROTO,"Handle");
- db_unset(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact, META_PROTO, "IsSubcontact");
+ db_unset(hContact, META_PROTO, META_LINK);
+ db_unset(hContact, META_PROTO, "Handle");
+ db_unset(hContact, META_PROTO, "ContactNumber");
Meta_RestoreGroup(hContact);
- db_unset(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact, META_PROTO, "OldCListGroup");
- CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)META_FILTER);
// stop ignoring, if we were
if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
} else {
- if (!db_get_b(hContact, META_PROTO, "IsSubcontact", 0))
+ if ( !db_get_b(hContact, META_PROTO, "IsSubcontact", 0))
db_set_b(hContact, META_PROTO, "IsSubcontact", 1);
}
} else
db_unset(hContact, META_PROTO, "Handle");
- if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1))!=(DWORD)-1) {
// is a metacontact
// get nick for debug messages
@@ -890,7 +889,7 @@ int Meta_SetHandles(void) {
// loop through one more time - check contact counts match
hContact = db_find_first();
while ( hContact != NULL ) {
- if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1))!=(DWORD)-1) {
// get nick for debug messages
strcpy(nick_buffer, Translate("MetaId: "));
strcat(nick_buffer, _itoa(meta_id, buffer2, 10));
@@ -933,7 +932,7 @@ int Meta_HideLinkedContacts(void) {
// ensure the hidden group does not exist (how this occurs i wonder but there have been reports!)
// (sometimes protocol server side groups are to blame - msn and icq)
- if (!meta_group_hack_disabled) do {
+ if ( !meta_group_hack_disabled) do {
group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0);
if (group_name && !strcmp(group_name, META_HIDDEN_GROUP)) {
// disabled because it shows a message box
@@ -952,14 +951,7 @@ int Meta_HideLinkedContacts(void) {
while ( hContact != NULL ) {
- if ((meta_id = db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) {
- // is a subcontact
-
- // * ensure filter present
- if ( !CallService( MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, ( LPARAM )META_FILTER ))
- CallService( MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, ( LPARAM )META_FILTER );
-
-
+ if ((meta_id = db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1))!=(DWORD)-1) {
// get contact number
contact_number = db_get_dw(hContact, META_PROTO, "ContactNumber", (DWORD)-1);
@@ -973,11 +965,11 @@ int Meta_HideLinkedContacts(void) {
hContact2 = db_find_first();
while ( hContact2 != NULL ) {
- if (db_get_dw(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
+ if (db_get_dw(hContact2, META_PROTO, META_ID,(DWORD)-1) == meta_id) {
num_contacts = db_get_dw(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
if (contact_number >= 0 && contact_number < num_contacts) {
- if (!proto)
+ if ( !proto)
status = ID_STATUS_OFFLINE;
else
status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
@@ -1004,7 +996,7 @@ int Meta_HideLinkedContacts(void) {
db_free(&dbv);
} else {
- if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
+ if ( !db_get(hContact, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
@@ -1027,7 +1019,7 @@ int Meta_HideLinkedContacts(void) {
// do metacontacts after handles set properly above
hContact = db_find_first();
while ( hContact != NULL ) {
- if (db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
HANDLE hMostOnline = Meta_GetMostOnline(hContact); // set nick
Meta_CopyContactNick(hContact, hMostOnline);
@@ -1050,7 +1042,7 @@ int Meta_UnhideLinkedContacts(void) {
HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
- if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) {
// has a link - unhide it
// restore old group
Meta_RestoreGroup(hContact);
@@ -1059,7 +1051,7 @@ int Meta_UnhideLinkedContacts(void) {
hContact = db_find_next(hContact);
}
- if (!CallService(MS_SYSTEM_TERMINATED, 0, 0))
+ if ( !CallService(MS_SYSTEM_TERMINATED, 0, 0))
CallService(MS_CLUI_SORTLIST, 0, 0);
return 0;
}
@@ -1072,7 +1064,7 @@ int Meta_HideMetaContacts(int hide) {
else Meta_SuppressStatus(options.suppress_status);
while ( hContact != NULL ) {
- if (db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
if (hide)
@@ -1080,7 +1072,7 @@ int Meta_HideMetaContacts(int hide) {
else
db_unset(hContact, "CList", "Hidden");
- } else if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) {
// when metacontacts are hidden, show subcontacts, and vice versa
if (hide) {
Meta_RestoreGroup(hContact);
@@ -1092,7 +1084,7 @@ int Meta_HideMetaContacts(int hide) {
hContact = db_find_next(hContact);
}
- if (!CallService(MS_SYSTEM_TERMINATED, 0, 0))
+ if ( !CallService(MS_SYSTEM_TERMINATED, 0, 0))
CallService(MS_CLUI_SORTLIST, 0, 0);
return 0;
}
@@ -1116,7 +1108,7 @@ void Meta_RestoreGroup(HANDLE hContact) {
} else {
DBCONTACTWRITESETTING cws;
- if (!db_get(hContact, META_PROTO, "OldCListGroup", &cws.value)) {
+ if ( !db_get(hContact, META_PROTO, "OldCListGroup", &cws.value)) {
if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
db_unset(hContact, "CList", "Group");
@@ -1153,7 +1145,7 @@ void Meta_RestoreGroup(HANDLE hContact) {
}
db_unset(hContact, META_PROTO, "OldCListGroup");
- if (!db_get(hContact, "CList", "Group", &cws.value)) {
+ if ( !db_get(hContact, "CList", "Group", &cws.value)) {
if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
db_unset(hContact, "CList", "Group");
}
@@ -1185,7 +1177,7 @@ void Meta_SetGroup(HANDLE hContact) {
} else {
DBCONTACTWRITESETTING cws;
// save old group and move to invisible group (i.e. non-existent group)
- if (!Mydb_get(hContact, "CList", "Group", &cws.value)) {
+ if ( !Mydb_get(hContact, "CList", "Group", &cws.value)) {
if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
// it's already in the group (shouldn't be - but maybe a crash)
} else {
@@ -1246,7 +1238,7 @@ int Meta_SuppressStatus(BOOL suppress) {
HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
- if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) {
// is a subcontact
if (suppress)
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
@@ -1268,15 +1260,15 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) {
hContact = Meta_GetContactHandle(hMeta, 0);
}
- if (!hContact) return 1;
+ if ( !hContact) return 1;
//proto = GetContactProto(hContact);
// read proto direct from db, since we do this on load and other proto plugins may not be loaded yet
- if (!db_get(hContact, "Protocol", "p", &dbv_proto)) {
+ if ( !db_get(hContact, "Protocol", "p", &dbv_proto)) {
proto = dbv_proto.pszVal;
if (options.clist_contact_name == CNNT_NICK && proto) {
- if (!Mydb_get(hContact, proto, "Nick", &dbv)) {
+ if ( !Mydb_get(hContact, proto, "Nick", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "Nick", &dbv);
db_free(&dbv);
//CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)hMeta, 0);
@@ -1312,7 +1304,7 @@ int Meta_SetAllNicks() {
HANDLE hContact = db_find_first(), most_online;
while ( hContact != NULL ) {
- if (db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1) {
most_online = Meta_GetMostOnline(hContact);
Meta_CopyContactNick(hContact, most_online);
Meta_FixStatus(hContact);
@@ -1500,10 +1492,10 @@ void copyHistory(HANDLE hContactFrom,HANDLE hContactTo)
BYTE *buffer = 0;
HWND progress_dialog, prog;
- if (!hContactFrom || !hContactTo) return;
+ if ( !hContactFrom || !hContactTo) return;
//id = Meta_GetUniqueIdentifier(hContactFrom, &id_length);
- //if (!id) return;
+ //if ( !id) return;
progress_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcNull);
ShowWindow(progress_dialog, SW_SHOW);
@@ -1566,10 +1558,10 @@ void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource) {
DWORD time_now = time(0), earliest_time = time_now;
HWND progress_dialog, prog;
- if (!hContactRemoveFrom || !hContactSource) return;
+ if ( !hContactRemoveFrom || !hContactSource) return;
id = Meta_GetUniqueIdentifier(hContactSource, &id_length);
- if (!id) return;
+ if ( !id) return;
progress_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DELPROGRESS), 0, DlgProcNull);
ShowWindow(progress_dialog, SW_SHOW);
@@ -1635,7 +1627,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) {
id = (char *)mir_alloc(256);
- if (!proto) return 0;
+ if ( !proto) return 0;
strncpy(id, proto, 127);
strcat(id, "*"); // seperate proto & proto id with asterisk to make one long comparable string
@@ -1643,7 +1635,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) {
used = strlen(id);
field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
- if (!field) return 0;
+ if ( !field) return 0;
db_get(hContact,proto,field,&dbv);
switch(dbv.type)