diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-14 15:51:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-14 15:51:34 +0000 |
commit | e58823d961a630eb62e60d2ccb443761ba5f1704 (patch) | |
tree | 62d071be480d57af2a53f154a1468abe0b9449ff /plugins/MetaContacts/meta_menu.c | |
parent | 721aea0764451e985d575236205808bbef298244 (diff) |
- all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs.
- massive cleanup of the menu-related code
git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MetaContacts/meta_menu.c')
-rw-r--r-- | plugins/MetaContacts/meta_menu.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/plugins/MetaContacts/meta_menu.c b/plugins/MetaContacts/meta_menu.c index 37ceb1116a..6e7ad9f1c6 100644 --- a/plugins/MetaContacts/meta_menu.c +++ b/plugins/MetaContacts/meta_menu.c @@ -52,7 +52,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) hMetaContact = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
// Add the info for the metacontact
- if(hMetaContact)
+ if (hMetaContact)
{
DBWriteContactSettingDword(hMetaContact,META_PROTO,META_ID,nextMetaID);
@@ -62,8 +62,8 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) // Add the MetaContact protocol to the new meta contact
CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hMetaContact, ( LPARAM )META_PROTO );
- if(group) {
- if(ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
+ if (group) {
+ if (ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
DBWriteContactSettingStringUtf(hMetaContact,"CList","Group",group);
else
DBWriteContactSettingString(hMetaContact,"CList","Group",group);
@@ -147,7 +147,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0);
default_contact = DBGetContactSettingDword(hMeta, META_PROTO, "Default", -1);
- if(number >= 0 && number < num_contacts) {
+ if (number >= 0 && number < num_contacts) {
// get the handle
hContact = Meta_GetContactHandle(hMeta, number);
@@ -166,7 +166,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { //CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_PROTO);
CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
@@ -175,7 +175,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { // each contact from 'number' upwards will be moved down one
// and the last one will be deleted
- for(i = number + 1; i < num_contacts; i++) {
+ for (i = number + 1; i < num_contacts; i++) {
Meta_SwapContacts(hMeta, i, i-1);
}
@@ -203,9 +203,9 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { DBDeleteContactSetting(hMeta, META_PROTO, buffer);
// if the default contact was equal to or greater than 'number', decrement it (and deal with ends)
- if(default_contact >= number) {
+ if (default_contact >= number) {
default_contact--;
- if(default_contact < 0)
+ if (default_contact < 0)
default_contact = 0;
DBWriteContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)default_contact);
@@ -223,7 +223,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { // fix avatar
hContact = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(hContact) {
+ if (hContact) {
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
@@ -253,7 +253,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) if ((metaID=DBGetContactSettingDword((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(MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0),Translate("This will remove the MetaContact permanently.\n\nProceed Anyway?"),
+ 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)
{
return 0;
@@ -263,7 +263,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
while(hContact)
{ // Scans the database to get all the contacts that have been previously linked to this MetaContact
- if(DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
{ // This contact is assigned to the MetaContact that will be deleted, clear the "MetaContacts" information
DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
@@ -275,7 +275,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
@@ -288,7 +288,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) }
else
{// The wParam is a simple contact
- //if(lParam == 0)
+ //if (lParam == 0)
// return 1; // The function has been called by the menu of a simple contact. Should not happen.
//else
{// The function has been called by the edit dialog
@@ -297,8 +297,8 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) DWORD num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", -1);
- if(num_contacts == 1) {
- if(MessageBox(0,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
+ if (num_contacts == 1) {
+ if (MessageBox(0,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)==IDYES)
{
// recurse - once
@@ -345,7 +345,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) */
INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam)
{
- if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
{ // the wParam is a MetaContact
BOOL current = DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
@@ -354,7 +354,7 @@ INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam) DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "ForceSend", 0);
- if(current) NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1)));
+ if (current) NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1)));
else NotifyEventHooks(hEventUnforceSend, wParam, 0);
}
return 0;
@@ -408,7 +408,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) mi.flags = CMIM_FLAGS;
mi.cbSize = sizeof(CLISTMENUITEM);
- if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
{
int num_contacts, i;
@@ -418,7 +418,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) // This is a MetaContact, show the edit, force default, and the delete menu, and hide the others
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
//mi.flags |= CMIM_NAME;
- //if(DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
+ //if (DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
// mi.pszName = Translate("Unforce Default");
//else
// mi.pszName = Translate("Force Default");
@@ -434,8 +434,8 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) //show subcontact menu items
num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", 0);
- for(i = 0; i < MAX_CONTACTS; i++) {
- if(i < num_contacts) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
+ if (i < num_contacts) {
hContact = Meta_GetContactHandle((HANDLE)wParam, i);
proto = _strdup((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0));
@@ -444,7 +444,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) else
status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
- if(options.menu_contact_label == DNT_UID) {
+ if (options.menu_contact_label == DNT_UID) {
strcpy(buf, "Login");
strcat(buf, _itoa(i, buffer2, 10));
@@ -473,7 +473,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) char *name = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
char *wname = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_UNICODE);
- if(wname && strncmp(name, wname, strlen(name)) != 0) {
+ if (wname && strncmp(name, wname, strlen(name)) != 0) {
mi.pszName = wname;
mi.flags = CMIF_UNICODE;
}
@@ -522,12 +522,12 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
- for(i = 0; i < MAX_CONTACTS; i++) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
- } else if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (DBGetContactSettingDword((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;
@@ -537,7 +537,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
- for(i = 0; i < MAX_CONTACTS; i++) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
@@ -549,7 +549,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
- for(i = 0; i < MAX_CONTACTS; i++) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
|