diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-15 18:02:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-15 18:02:40 +0000 |
commit | 06ed0d60176a4d3529999614825f3594b6cb54e9 (patch) | |
tree | e12b4593698d268b17f6668a5ab79f0d0a986827 /src | |
parent | 20a2d3dc9f8ab2e2e8833a1c83cf2dd30f25aa8e (diff) |
huge clutch sawed out of the MC engine
git-svn-id: http://svn.miranda-ng.org/main/trunk@8627 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/metacontacts/meta_api.cpp | 109 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_edit.cpp | 12 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_menu.cpp | 28 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_services.cpp | 21 | ||||
-rw-r--r-- | src/modules/metacontacts/metacontacts.h | 4 | ||||
-rw-r--r-- | src/resource.rc | 2 |
6 files changed, 3 insertions, 173 deletions
diff --git a/src/modules/metacontacts/meta_api.cpp b/src/modules/metacontacts/meta_api.cpp index beca03b5ec..cfca0ed968 100644 --- a/src/modules/metacontacts/meta_api.cpp +++ b/src/modules/metacontacts/meta_api.cpp @@ -38,110 +38,6 @@ static INT_PTR MetaAPI_GetMostOnline(WPARAM hMetaContact, LPARAM) return Meta_GetMostOnline(cc);
}
-// forces the metacontact to send using a specific subcontact, using the subcontact's contact number
-// wParam=(MCONTACT)hMetaContact
-// lParam=(DWORD)contact number
-// returns 0 on success
-
-static INT_PTR MetaAPI_ForceSendContactNum(WPARAM hMetaContact, LPARAM lParam)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- if (cc == NULL)
- return 1;
-
- MCONTACT hContact = Meta_GetContactHandle(cc, (int)lParam);
- if (!hContact || db_get_b(cc->contactID, META_PROTO, "ForceDefault", 0))
- return 1;
-
- db_set_dw(cc->contactID, META_PROTO, "ForceSend", hContact);
-
- NotifyEventHooks(hEventForceSend, hMetaContact, hContact);
- return 0;
-}
-
-// forces the metacontact to send using a specific subcontact, using the subcontact's handle
-// wParam=(MCONTACT)hMetaContact
-// lParam=(MCONTACT)hSubcontact
-// returns 0 on success (will fail if 'force default' is in effect)
-
-static INT_PTR MetaAPI_ForceSendContact(WPARAM hMetaContact, LPARAM lParam)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- if (cc == NULL)
- return 1;
-
- if (Meta_GetContactNumber(cc, lParam) == -1)
- return 1;
-
- if (!db_get_b(cc->contactID, META_PROTO, "ForceDefault", 0))
- return 1;
-
- db_set_dw(cc->contactID, META_PROTO, "ForceSend", lParam);
-
- NotifyEventHooks(hEventForceSend, hMetaContact, lParam);
- return 0;
-}
-
-// 'unforces' the metacontact to send using a specific subcontact
-// wParam=(MCONTACT)hMetaContact
-// lParam=0
-// returns 0 on success (will fail if 'force default' is in effect)
-
-INT_PTR MetaAPI_UnforceSendContact(WPARAM hMetaContact, LPARAM lParam)
-{
- if (db_get_b(hMetaContact, META_PROTO, "ForceDefault", 0))
- return 1;
-
- db_set_dw(hMetaContact, META_PROTO, "ForceSend", 0);
-
- NotifyEventHooks(hEventUnforceSend, hMetaContact, lParam);
- return 0;
-}
-
-//'forces' or 'unforces' (i.e. toggles) the metacontact to send using it's default contact
-// overrides 'force send' above, and will even force use of offline contacts
-// will send ME_MC_FORCESEND event
-//
-// wParam=(MCONTACT)hMetaContact
-// lParam=0
-// returns 1(true) or 0(false) representing new state of 'force default'
-
-INT_PTR MetaAPI_ForceDefault(WPARAM hMetaContact, LPARAM lParam)
-{
- // forward to menu function
- Meta_ForceDefault(hMetaContact, lParam);
- return db_get_b(hMetaContact, META_PROTO, "ForceDefault", 0);
-}
-
-// method to get state of 'force' for a metacontact
-// wParam=(MCONTACT)hMetaContact
-// lParam= (DWORD)&contact_number or NULL
-// if lparam supplied, the contact_number of the contatct 'in force' will be copied to the address it points to,
-// or if none is in force, the value INVALID_CONTACT_ID will be copied
-// (v0.8.0.8+ returns 1 if 'force default' is true with *lParam == default contact number, else returns 0 with *lParam as above)
-
-INT_PTR MetaAPI_GetForceState(WPARAM hMetaContact, LPARAM lParam)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- if (cc == NULL)
- return 0;
-
- if (db_get_b(hMetaContact, META_PROTO, "ForceDefault", 0)) {
- if (lParam) *(DWORD *)lParam = cc->nDefault;
- return 1;
- }
-
- MCONTACT hContact = (MCONTACT)db_get_dw(hMetaContact, META_PROTO, "ForceSend", 0);
- if (!hContact) {
- if (lParam) *(DWORD *)lParam = -1;
- }
- else {
- if (lParam) *(DWORD *)lParam = (DWORD)Meta_GetContactNumber(cc, hContact);
- }
-
- return 0;
-}
-
// wParam=(HANDLE)hContact
// lParam=0
// convert a given contact into a metacontact
@@ -173,11 +69,6 @@ static INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam) void CreateApiServices()
{
CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
- CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum);
- CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact);
- CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact);
- CreateServiceFunction(MS_MC_GETFORCESTATE, MetaAPI_GetForceState);
-
CreateServiceFunction(MS_MC_CONVERTTOMETA, MetaAPI_ConvertToMeta);
CreateServiceFunction(MS_MC_ADDTOMETA, MetaAPI_AddToMeta);
CreateServiceFunction(MS_MC_REMOVEFROMMETA, MetaAPI_RemoveFromMeta);
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index c950ca2569..b0ce85dfce 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -35,7 +35,6 @@ struct num_contacts; // DWORD number of contacts
MCONTACT hDeletedContacts[MAX_CONTACTS]; // HANDLEs of the subcontacts to be removed from this metacontact
MCONTACT hContact[MAX_CONTACTS]; // HANDLEs of the subcontacts, in the order they should be in
- int force_default;
}
static g_data; // global CHANGES structure
@@ -173,9 +172,6 @@ static void ApplyChanges() if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
db_set_ts(g_data.hMeta, "ContactPhoto", "File", AI.filename);
}
-
- if (MetaAPI_GetForceState(g_data.hMeta, 0) != g_data.force_default)
- MetaAPI_ForceDefault(g_data.hMeta, 0);
}
LRESULT ProcessCustomDraw(LPARAM lParam)
@@ -274,12 +270,9 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara g_data.hOfflineContact = Meta_GetContactHandle(g_data.cc, offline_contact_number);
for (i = 0; i < cc->nSubs; i++)
g_data.hContact[i] = Meta_GetContactHandle(g_data.cc, i);
- g_data.force_default = MetaAPI_GetForceState(lParam, 0);
SendMessage(hwndDlg, WMU_SETTITLE, 0, lParam);
- CheckDlgButton(hwndDlg, IDC_CHK_FORCEDEFAULT, g_data.force_default);
-
FillContactList(hwndDlg);
}
return TRUE;
@@ -435,11 +428,6 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), (sel < g_data.num_contacts - 1));
EnableWindow(GetDlgItem(hwndDlg, IDC_VALIDATE), TRUE);
return TRUE;
-
- case IDC_CHK_FORCEDEFAULT:
- g_data.force_default = IsDlgButtonChecked(hwndDlg, IDC_CHK_FORCEDEFAULT);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VALIDATE), TRUE);
- return TRUE;
}
}
break;
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index c185867947..f6116a03ea 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -224,34 +224,6 @@ INT_PTR Meta_Default(WPARAM hSub, LPARAM wParam) return 0;
}
-/** Set/unset (i.e. toggle) contact to force use of default contact
-*
-* Set the given contact to be the default one for the metacontact to which it is linked.
-*
-* @param wParam : HANDLE to the MetaContact to be set as default
-* @param lParam :HWND to the clist window
-(This means the function has been called via the contact menu).
-*/
-
-INT_PTR Meta_ForceDefault(WPARAM hMeta, LPARAM)
-{
- // the wParam is a MetaContact
- DBCachedContact *cc = CheckMeta(hMeta);
- if (cc) {
- BOOL current = db_get_b(hMeta, META_PROTO, "ForceDefault", 0);
- current = !current;
- db_set_b(hMeta, META_PROTO, "ForceDefault", (BYTE)current);
-
- db_set_dw(hMeta, META_PROTO, "ForceSend", 0);
-
- if (current)
- NotifyEventHooks(hEventForceSend, hMeta, Meta_GetContactHandle(cc, cc->nDefault));
- else
- NotifyEventHooks(hEventUnforceSend, hMeta, 0);
- }
- return 0;
-}
-
/** Called when the context-menu of a contact is about to be displayed
*
* This will test which of the 4 menu item should be displayed, depending
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index c30b633790..ad51900526 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -34,8 +34,6 @@ int previousMode, // Previous status of the MetaContacts Protocol mcStatus; // Current status of the MetaContacts Protocol
HANDLE
- hEventForceSend, // HANDLE to the 'force send' event
- hEventUnforceSend, // HANDLE to the 'unforce send' event
hSubcontactsChanged, // HANDLE to the 'contacts changed' event
hEventNudge;
@@ -444,14 +442,9 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) strcat(buffer, _itoa(contact_number, szId, 10));
db_set_ts(ccMeta->contactID, META_PROTO, buffer, cli.pfnGetStatusModeDescription(dcws->value.wVal, 0));
- // if the contact was forced, unforce it (which updates status)
- if (db_get_dw(ccMeta->contactID, META_PROTO, "ForceSend", 0) == hContact)
- MetaAPI_UnforceSendContact(ccMeta->contactID, 0);
- else {
- // set status to that of most online contact
- Meta_CopyContactNick(ccMeta, Meta_GetMostOnline(ccMeta));
- Meta_FixStatus(ccMeta);
- }
+ // set status to that of most online contact
+ Meta_CopyContactNick(ccMeta, Meta_GetMostOnline(ccMeta));
+ Meta_FixStatus(ccMeta);
// most online contact with avatar support might have changed - update avatar
MCONTACT most_online = Meta_GetMostOnlineSupporting(ccMeta, PFLAGNUM_4, PF4_AVATARS);
@@ -837,7 +830,6 @@ void Meta_InitServices() 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
for (int i = 0; i < MAX_CONTACTS; i++) {
@@ -875,8 +867,6 @@ void Meta_InitServices() CreateProtoServiceFunction(META_PROTO, PS_SEND_NUDGE, Meta_SendNudge);
// create our hookable events
- hEventForceSend = CreateHookableEvent(ME_MC_FORCESEND);
- hEventUnforceSend = CreateHookableEvent(ME_MC_UNFORCESEND);
hSubcontactsChanged = CreateHookableEvent(ME_MC_SUBCONTACTSCHANGED);
// hook other module events we need
@@ -890,8 +880,6 @@ void Meta_InitServices() // hook our own events, used to call Meta_GetMostOnline which sets nick for metacontact
HookEvent(ME_MC_DEFAULTTCHANGED, Meta_CallMostOnline);
- HookEvent(ME_MC_FORCESEND, Meta_CallMostOnline);
- HookEvent(ME_MC_UNFORCESEND, Meta_CallMostOnline);
// redirect nudge events
hEventNudge = CreateHookableEvent(META_PROTO "/Nudge");
@@ -900,9 +888,6 @@ void Meta_InitServices() //! Unregister all hooks and services from Miranda
void Meta_CloseHandles()
{
- // destroy our hookable events
- DestroyHookableEvent(hEventForceSend);
- DestroyHookableEvent(hEventUnforceSend);
DestroyHookableEvent(hSubcontactsChanged);
DestroyHookableEvent(hEventNudge);
}
diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h index 170d83da49..f323791ee9 100644 --- a/src/modules/metacontacts/metacontacts.h +++ b/src/modules/metacontacts/metacontacts.h @@ -33,7 +33,6 @@ INT_PTR Meta_AddTo(WPARAM wParam,LPARAM lParam); INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam);
-INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam);
int Meta_ModifyMenu(WPARAM wParam,LPARAM lParam);
@@ -98,9 +97,6 @@ int GetRealPriority(char *proto, int status); // API function headers
void CreateApiServices();
-INT_PTR MetaAPI_GetForceState(WPARAM, LPARAM);
-INT_PTR MetaAPI_ForceDefault(WPARAM hMetaContact, LPARAM);
-INT_PTR MetaAPI_UnforceSendContact(WPARAM hMetaContact, LPARAM);
// extended db get/write setting functions, that handle unicode
INT_PTR Mydb_get(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
diff --git a/src/resource.rc b/src/resource.rc index d3974a4e6e..b1b875aa12 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -766,8 +766,6 @@ BEGIN PUSHBUTTON "Move &Down",IDC_BTN_DOWN,319,216,54,14
EDITTEXT IDC_ED_NAME,129,15,183,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
CONTROL "List1",IDC_LST_CONTACTS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,10,43,363,169,WS_EX_CLIENTEDGE
- CONTROL "Force use of default for sending (even if offline)",IDC_CHK_FORCEDEFAULT,
- "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,4,243,213,10
PUSHBUTTON "Send &Offline",IDC_BTN_SETOFFLINE,203,216,54,14
END
|