diff options
274 files changed, 7547 insertions, 7632 deletions
diff --git a/include/m_button.h b/include/m_button.h index 293d30c893..cb2528c4ce 100644 --- a/include/m_button.h +++ b/include/m_button.h @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_BUTTON_H__
#define M_BUTTON_H__ 1
-#define MIRANDABUTTONCLASS _T( "MButtonClass" ) // Class of the control
+#define MIRANDABUTTONCLASS _T("MButtonClass") // Class of the control
// Sets whether a dropdown arrow is used
@@ -58,7 +58,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // lParam = not used
// Usage: SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)"My Tip", BATF_* flags);
#define BATF_UNICODE 1
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define BATF_TCHAR BATF_UNICODE
#else
#define BATF_TCHAR 0
diff --git a/include/m_clc.h b/include/m_clc.h index e2b6cd036a..4463b584b9 100644 --- a/include/m_clc.h +++ b/include/m_clc.h @@ -162,7 +162,7 @@ typedef struct { #define CLM_ADDINFOITEMA (CLM_FIRST+48) //lParam=&cii, returns hItem
#define CLM_ADDINFOITEMW (CLM_FIRST+53) //lParam=&cii, returns hItem
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define CLM_ADDINFOITEM CLM_ADDINFOITEMW
#else
#define CLM_ADDINFOITEM CLM_ADDINFOITEMA
diff --git a/include/m_clist.h b/include/m_clist.h index 40288608e5..7289f778f2 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -63,7 +63,7 @@ extern int hLangpack; #define GSMDF_PREFIXONLINE 1 //prefix "Online: " to all status modes that
//imply online, eg "Online: Away"
#define GSMDF_UNICODE 2 //will return TCHAR* instead of char*
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define GSMDF_TCHAR GSMDF_UNICODE //will return TCHAR* instead of char*
#else
#define GSMDF_TCHAR 0 //will return char*, as usual
@@ -119,7 +119,7 @@ typedef struct { #define CLISTMENUITEM_OLDSIZE_V1 (offsetof(CLISTMENUITEM,hLangpack))
-#define HGENMENU_ROOT (( HGENMENU )-1)
+#define HGENMENU_ROOT ((HGENMENU)-1)
#define CMIF_GRAYED 1
#define CMIF_CHECKED 2
@@ -131,7 +131,7 @@ typedef struct { #define CMIF_ROOTHANDLE 384 //means that hParentMenu member is set
#define CMIF_UNICODE 512 //will return TCHAR* instead of char*
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define CMIF_TCHAR CMIF_UNICODE //will return TCHAR* instead of char*
#else
#define CMIF_TCHAR 0 //will return char*, as usual
@@ -242,7 +242,7 @@ sense to store all this information in memory, etc. #define GCDNF_UNICODE 2 //will return TCHAR* instead of char*
#define GCDNF_NOCACHE 4 //will not use the cache
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define GCDNF_TCHAR GCDNF_UNICODE //will return TCHAR* instead of char*
#else
#define GCDNF_TCHAR 0 //will return char*, as usual
@@ -297,7 +297,7 @@ typedef struct { #define CLEF_PROTOCOLGLOBAL 8 //set event globally for protocol, hContact has to be NULL,
//lpszProtocol the protocol ID name to be set
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define CLEF_TCHAR CLEF_UNICODE //will use TCHAR* instead of char*
#else
#define CLEF_TCHAR 0 //will return char*, as usual
diff --git a/include/m_clistint.h b/include/m_clistint.h index 625289d709..fc628e8f50 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -186,7 +186,7 @@ typedef struct {
HANDLE hContact;
TCHAR* name;
- #if defined( _UNICODE )
+ #if defined(_UNICODE)
char* szName;
#endif
TCHAR* group;
@@ -206,134 +206,134 @@ typedef struct ClcProtoStatus *clcProto;
/* clc.h */
- void ( *pfnClcOptionsChanged )( void );
- void ( *pfnClcBroadcast )( int, WPARAM, LPARAM );
- HMENU ( *pfnBuildGroupPopupMenu )( struct ClcGroup* );
+ void (*pfnClcOptionsChanged)(void);
+ void (*pfnClcBroadcast)(int, WPARAM, LPARAM);
+ HMENU (*pfnBuildGroupPopupMenu)(struct ClcGroup*);
- LRESULT ( CALLBACK *pfnContactListControlWndProc )( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT (CALLBACK *pfnContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcfiledrop.c */
- void ( *pfnRegisterFileDropping )( HWND hwnd );
- void ( *pfnUnregisterFileDropping )( HWND hwnd );
+ void (*pfnRegisterFileDropping)(HWND hwnd);
+ void (*pfnUnregisterFileDropping)(HWND hwnd);
/* clcidents.c */
- int ( *pfnGetRowsPriorTo )( struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex );
- int ( *pfnFindItem )( HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible );
- int ( *pfnGetRowByIndex )( struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup );
- HANDLE ( *pfnContactToHItem )( struct ClcContact* contact );
- HANDLE ( *pfnContactToItemHandle )( struct ClcContact * contact, DWORD * nmFlags );
+ int (*pfnGetRowsPriorTo)(struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex);
+ int (*pfnFindItem)(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible);
+ int (*pfnGetRowByIndex)(struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup);
+ HANDLE (*pfnContactToHItem)(struct ClcContact* contact);
+ HANDLE (*pfnContactToItemHandle)(struct ClcContact * contact, DWORD * nmFlags);
/* clcitems.c */
- struct ClcContact* ( *pfnCreateClcContact )( void );
- struct ClcGroup* ( *pfnAddGroup )( HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers );
- struct ClcGroup* ( *pfnRemoveItemFromGroup )(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
-
- void ( *pfnFreeContact )( struct ClcContact *contact );
- void ( *pfnFreeGroup )( struct ClcGroup *group );
-
- int ( *pfnAddInfoItemToGroup )(struct ClcGroup *group, int flags, const TCHAR *pszText);
- int ( *pfnAddItemToGroup )( struct ClcGroup *group, int iAboveItem );
- int ( *pfnAddContactToGroup )( struct ClcData *dat, struct ClcGroup *group, HANDLE hContact );
- void ( *pfnAddContactToTree )( HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
- void ( *pfnDeleteItemFromTree )( HWND hwnd, HANDLE hItem );
- void ( *pfnRebuildEntireList )( HWND hwnd, struct ClcData *dat );
- int ( *pfnGetGroupContentsCount )( struct ClcGroup *group, int visibleOnly );
- void ( *pfnSortCLC )( HWND hwnd, struct ClcData *dat, int useInsertionSort );
- void ( *pfnSaveStateAndRebuildList )(HWND hwnd, struct ClcData *dat);
+ struct ClcContact* (*pfnCreateClcContact)(void);
+ struct ClcGroup* (*pfnAddGroup)(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
+ struct ClcGroup* (*pfnRemoveItemFromGroup)(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
+
+ void (*pfnFreeContact)(struct ClcContact *contact);
+ void (*pfnFreeGroup)(struct ClcGroup *group);
+
+ int (*pfnAddInfoItemToGroup)(struct ClcGroup *group, int flags, const TCHAR *pszText);
+ int (*pfnAddItemToGroup)(struct ClcGroup *group, int iAboveItem);
+ int (*pfnAddContactToGroup)(struct ClcData *dat, struct ClcGroup *group, HANDLE hContact);
+ void (*pfnAddContactToTree)(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
+ void (*pfnDeleteItemFromTree)(HWND hwnd, HANDLE hItem);
+ void (*pfnRebuildEntireList)(HWND hwnd, struct ClcData *dat);
+ int (*pfnGetGroupContentsCount)(struct ClcGroup *group, int visibleOnly);
+ void (*pfnSortCLC)(HWND hwnd, struct ClcData *dat, int useInsertionSort);
+ void (*pfnSaveStateAndRebuildList)(HWND hwnd, struct ClcData *dat);
/* clcmsgs.c */
- LRESULT ( *pfnProcessExternalMessages )(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT (*pfnProcessExternalMessages)(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcpaint.c */
- void ( *pfnPaintClc )( HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint );
+ void (*pfnPaintClc)(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint);
/* clcutils.c */
- char* ( *pfnGetGroupCountsText )(struct ClcData *dat, struct ClcContact *contact );
- int ( *pfnHitTest )( HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags );
- void ( *pfnScrollTo )( HWND hwnd, struct ClcData *dat, int desty, int noSmooth );
- void ( *pfnEnsureVisible )(HWND hwnd, struct ClcData *dat, int iItem, int partialOk );
- void ( *pfnRecalcScrollBar )( HWND hwnd, struct ClcData *dat );
- void ( *pfnSetGroupExpand )( HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState );
- void ( *pfnDoSelectionDefaultAction )( HWND hwnd, struct ClcData *dat );
- int ( *pfnFindRowByText )(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk );
- void ( *pfnEndRename )(HWND hwnd, struct ClcData *dat, int save );
- void ( *pfnDeleteFromContactList )( HWND hwnd, struct ClcData *dat );
- void ( *pfnBeginRenameSelection )( HWND hwnd, struct ClcData *dat );
- void ( *pfnCalcEipPosition )( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
- int ( *pfnGetDropTargetInformation )( HWND hwnd, struct ClcData *dat, POINT pt );
- int ( *pfnClcStatusToPf2 )( int status );
- int ( *pfnIsHiddenMode )( struct ClcData *dat, int status );
- void ( *pfnHideInfoTip )( HWND hwnd, struct ClcData *dat );
- void ( *pfnNotifyNewContact )( HWND hwnd, HANDLE hContact );
- DWORD ( *pfnGetDefaultExStyle )( void );
- void ( *pfnGetDefaultFontSetting )( int i, LOGFONT* lf, COLORREF* colour );
- void ( *pfnGetFontSetting )( int i, LOGFONT* lf, COLORREF* colour );
- void ( *pfnLoadClcOptions )( HWND hwnd, struct ClcData *dat );
- void ( *pfnRecalculateGroupCheckboxes )( HWND hwnd, struct ClcData *dat );
- void ( *pfnSetGroupChildCheckboxes )( struct ClcGroup *group, int checked );
- void ( *pfnInvalidateItem )( HWND hwnd, struct ClcData *dat, int iItem );
-
- int ( *pfnGetRowBottomY )(struct ClcData *dat, int item);
- int ( *pfnGetRowHeight )(struct ClcData *dat, int item);
- int ( *pfnGetRowTopY )(struct ClcData *dat, int item);
- int ( *pfnGetRowTotalHeight )(struct ClcData *dat);
- int ( *pfnRowHitTest )(struct ClcData *dat, int y);
+ char* (*pfnGetGroupCountsText)(struct ClcData *dat, struct ClcContact *contact);
+ int (*pfnHitTest)(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags);
+ void (*pfnScrollTo)(HWND hwnd, struct ClcData *dat, int desty, int noSmooth);
+ void (*pfnEnsureVisible)(HWND hwnd, struct ClcData *dat, int iItem, int partialOk);
+ void (*pfnRecalcScrollBar)(HWND hwnd, struct ClcData *dat);
+ void (*pfnSetGroupExpand)(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState);
+ void (*pfnDoSelectionDefaultAction)(HWND hwnd, struct ClcData *dat);
+ int (*pfnFindRowByText)(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
+ void (*pfnEndRename)(HWND hwnd, struct ClcData *dat, int save);
+ void (*pfnDeleteFromContactList)(HWND hwnd, struct ClcData *dat);
+ void (*pfnBeginRenameSelection)(HWND hwnd, struct ClcData *dat);
+ void (*pfnCalcEipPosition)(struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
+ int (*pfnGetDropTargetInformation)(HWND hwnd, struct ClcData *dat, POINT pt);
+ int (*pfnClcStatusToPf2)(int status);
+ int (*pfnIsHiddenMode)(struct ClcData *dat, int status);
+ void (*pfnHideInfoTip)(HWND hwnd, struct ClcData *dat);
+ void (*pfnNotifyNewContact)(HWND hwnd, HANDLE hContact);
+ DWORD (*pfnGetDefaultExStyle)(void);
+ void (*pfnGetDefaultFontSetting)(int i, LOGFONT* lf, COLORREF* colour);
+ void (*pfnGetFontSetting)(int i, LOGFONT* lf, COLORREF* colour);
+ void (*pfnLoadClcOptions)(HWND hwnd, struct ClcData *dat);
+ void (*pfnRecalculateGroupCheckboxes)(HWND hwnd, struct ClcData *dat);
+ void (*pfnSetGroupChildCheckboxes)(struct ClcGroup *group, int checked);
+ void (*pfnInvalidateItem)(HWND hwnd, struct ClcData *dat, int iItem);
+
+ int (*pfnGetRowBottomY)(struct ClcData *dat, int item);
+ int (*pfnGetRowHeight)(struct ClcData *dat, int item);
+ int (*pfnGetRowTopY)(struct ClcData *dat, int item);
+ int (*pfnGetRowTotalHeight)(struct ClcData *dat);
+ int (*pfnRowHitTest)(struct ClcData *dat, int y);
/* clistevents.c */
- int ( *pfnEventsProcessContactDoubleClick )( HANDLE hContact );
- int ( *pfnEventsProcessTrayDoubleClick )( int );
+ int (*pfnEventsProcessContactDoubleClick)(HANDLE hContact);
+ int (*pfnEventsProcessTrayDoubleClick)(int);
/* clistmod.c */
- int ( *pfnIconFromStatusMode )( const char *szProto, int status, HANDLE hContact );
- int ( *pfnShowHide )( WPARAM, LPARAM );
- TCHAR* ( *pfnGetStatusModeDescription )( int mode, int flags );
+ int (*pfnIconFromStatusMode)(const char *szProto, int status, HANDLE hContact);
+ int (*pfnShowHide)(WPARAM, LPARAM);
+ TCHAR* (*pfnGetStatusModeDescription)(int mode, int flags);
/* clistsettings.c */
- ClcCacheEntryBase* ( *pfnGetCacheEntry )( HANDLE hContact );
- ClcCacheEntryBase* ( *pfnCreateCacheItem )( HANDLE hContact );
- void ( *pfnCheckCacheItem )( ClcCacheEntryBase* );
- void ( *pfnFreeCacheItem )( ClcCacheEntryBase* );
+ ClcCacheEntryBase* (*pfnGetCacheEntry)(HANDLE hContact);
+ ClcCacheEntryBase* (*pfnCreateCacheItem)(HANDLE hContact);
+ void (*pfnCheckCacheItem)(ClcCacheEntryBase*);
+ void (*pfnFreeCacheItem)(ClcCacheEntryBase*);
- TCHAR* ( *pfnGetContactDisplayName )( HANDLE hContact, int mode );
- void ( *pfnInvalidateDisplayNameCacheEntry )( HANDLE hContact );
+ TCHAR* (*pfnGetContactDisplayName)(HANDLE hContact, int mode);
+ void (*pfnInvalidateDisplayNameCacheEntry)(HANDLE hContact);
/* clisttray.c */
- void ( *pfnTrayIconUpdateWithImageList )( int iImage, const TCHAR *szNewTip, char *szPreferredProto );
- void ( *pfnTrayIconUpdateBase )( const char *szChangedProto );
- void ( *pfnTrayIconSetToBase )( char *szPreferredProto );
- void ( *pfnTrayIconIconsChanged )( void );
- int ( *pfnTrayIconPauseAutoHide )( WPARAM wParam, LPARAM lParam );
- INT_PTR ( *pfnTrayIconProcessMessage )( WPARAM wParam, LPARAM lParam );
- int ( *pfnCListTrayNotify )( MIRANDASYSTRAYNOTIFY* );
+ void (*pfnTrayIconUpdateWithImageList)(int iImage, const TCHAR *szNewTip, char *szPreferredProto);
+ void (*pfnTrayIconUpdateBase)(const char *szChangedProto);
+ void (*pfnTrayIconSetToBase)(char *szPreferredProto);
+ void (*pfnTrayIconIconsChanged)(void);
+ int (*pfnTrayIconPauseAutoHide)(WPARAM wParam, LPARAM lParam);
+ INT_PTR (*pfnTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam);
+ int (*pfnCListTrayNotify)(MIRANDASYSTRAYNOTIFY*);
/* clui.c */
- LRESULT ( CALLBACK *pfnContactListWndProc )( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT (CALLBACK *pfnContactListWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- void ( *pfnCluiProtocolStatusChanged )( int status, const char* szProto );
- void ( *pfnDrawMenuItem )( LPDRAWITEMSTRUCT, HICON, HICON );
- void ( *pfnLoadCluiGlobalOpts )( void );
- BOOL ( *pfnInvalidateRect )( HWND hwnd, CONST RECT* lpRect, BOOL bErase );
- void ( *pfnOnCreateClc )( void );
+ void (*pfnCluiProtocolStatusChanged)(int status, const char* szProto);
+ void (*pfnDrawMenuItem)(LPDRAWITEMSTRUCT, HICON, HICON);
+ void (*pfnLoadCluiGlobalOpts)(void);
+ BOOL (*pfnInvalidateRect)(HWND hwnd, CONST RECT* lpRect, BOOL bErase);
+ void (*pfnOnCreateClc)(void);
/* contact.c */
- void ( *pfnChangeContactIcon )( HANDLE hContact, int iIcon, int add );
- void ( *pfnLoadContactTree )( void );
- int ( *pfnCompareContacts )( const struct ClcContact *contact1, const struct ClcContact *contact2 );
- void ( *pfnSortContacts )( void );
- int ( *pfnSetHideOffline )( WPARAM wParam, LPARAM lParam );
+ void (*pfnChangeContactIcon)(HANDLE hContact, int iIcon, int add);
+ void (*pfnLoadContactTree)(void);
+ int (*pfnCompareContacts)(const struct ClcContact *contact1, const struct ClcContact *contact2);
+ void (*pfnSortContacts)(void);
+ int (*pfnSetHideOffline)(WPARAM wParam, LPARAM lParam);
/* docking.c */
- int ( *pfnDocking_ProcessWindowMessage )( WPARAM wParam, LPARAM lParam );
+ int (*pfnDocking_ProcessWindowMessage)(WPARAM wParam, LPARAM lParam);
/* group.c */
- TCHAR* ( *pfnGetGroupName )( int idx, DWORD* pdwFlags );
- int ( *pfnRenameGroup )( int groupID, TCHAR* newName );
+ TCHAR* (*pfnGetGroupName)(int idx, DWORD* pdwFlags);
+ int (*pfnRenameGroup)(int groupID, TCHAR* newName);
/* keyboard.c */
- int ( *pfnHotKeysRegister )( HWND hwnd );
- void ( *pfnHotKeysUnregister )( HWND hwnd );
- int ( *pfnHotKeysProcess )( HWND hwnd, WPARAM wParam, LPARAM lParam );
- int ( *pfnHotkeysProcessMessage )( WPARAM wParam, LPARAM lParam );
+ int (*pfnHotKeysRegister)(HWND hwnd);
+ void (*pfnHotKeysUnregister)(HWND hwnd);
+ int (*pfnHotKeysProcess)(HWND hwnd, WPARAM wParam, LPARAM lParam);
+ int (*pfnHotkeysProcessMessage)(WPARAM wParam, LPARAM lParam);
/*************************************************************************************
* version 2 - events processing
@@ -341,20 +341,20 @@ typedef struct EventList events;
- struct CListEvent* ( *pfnCreateEvent )( void );
- void ( *pfnFreeEvent )( struct CListEvent* );
+ struct CListEvent* (*pfnCreateEvent)(void);
+ void (*pfnFreeEvent)(struct CListEvent*);
- struct CListEvent* ( *pfnAddEvent )( CLISTEVENT* );
- CLISTEVENT* ( *pfnGetEvent )( HANDLE hContact, int idx );
+ struct CListEvent* (*pfnAddEvent)(CLISTEVENT*);
+ CLISTEVENT* (*pfnGetEvent)(HANDLE hContact, int idx);
- int ( *pfnRemoveEvent )( HANDLE hContact, HANDLE hDbEvent );
- int ( *pfnGetImlIconIndex )( HICON hIcon );
+ int (*pfnRemoveEvent)(HANDLE hContact, HANDLE hDbEvent);
+ int (*pfnGetImlIconIndex)(HICON hIcon);
/*************************************************************************************
* version 3 additions
*************************************************************************************/
- int ( *pfnGetWindowVisibleState )( HWND hWnd, int iStepX, int iStepY );
+ int (*pfnGetWindowVisibleState)(HWND hWnd, int iStepX, int iStepY);
/*************************************************************************************
* version 4 additions (0.7.0.x) - genmenu
@@ -367,12 +367,12 @@ typedef struct int currentStatusMenuItem, currentDesiredStatusMode;
BOOL bDisplayLocked;
- HGENMENU ( *pfnGetProtocolMenu )( const char* );
- int ( *pfnStub2 )( int );
+ HGENMENU (*pfnGetProtocolMenu)(const char*);
+ int (*pfnStub2)(int);
- int ( *pfnGetProtocolVisibility )( const char* );
- int ( *pfnGetProtoIndexByPos )( PROTOCOLDESCRIPTOR** proto, int protoCnt, int Pos);
- void ( *pfnReloadProtoMenus )( void );
+ int (*pfnGetProtocolVisibility)(const char*);
+ int (*pfnGetProtoIndexByPos)(PROTOCOLDESCRIPTOR** proto, int protoCnt, int Pos);
+ void (*pfnReloadProtoMenus)(void);
/*************************************************************************************
* version 5 additions (0.7.0.x) - tray icons
@@ -386,29 +386,29 @@ typedef struct TCHAR* szTip;
BOOL bTrayMenuOnScreen;
- HICON ( *pfnGetIconFromStatusMode )( HANDLE hContact, const char *szProto, int status );
+ HICON (*pfnGetIconFromStatusMode)(HANDLE hContact, const char *szProto, int status);
- void ( *pfnInitTray )( void );
- int ( *pfnTrayIconAdd )( HWND hwnd, const char *szProto, const char *szIconProto, int status );
- int ( *pfnTrayIconDestroy )( HWND hwnd );
- int ( *pfnTrayIconInit )( HWND hwnd );
- TCHAR* ( *pfnTrayIconMakeTooltip )( const TCHAR *szPrefix, const char *szProto );
- void ( *pfnTrayIconRemove )( HWND hwnd, const char *szProto );
- int ( *pfnTrayIconSetBaseInfo )( HICON hIcon, const char *szPreferredProto );
- void ( *pfnTrayIconTaskbarCreated )( HWND hwnd );
- int ( *pfnTrayIconUpdate )( HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase );
+ void (*pfnInitTray)(void);
+ int (*pfnTrayIconAdd)(HWND hwnd, const char *szProto, const char *szIconProto, int status);
+ int (*pfnTrayIconDestroy)(HWND hwnd);
+ int (*pfnTrayIconInit)(HWND hwnd);
+ TCHAR* (*pfnTrayIconMakeTooltip)(const TCHAR *szPrefix, const char *szProto);
+ void (*pfnTrayIconRemove)(HWND hwnd, const char *szProto);
+ int (*pfnTrayIconSetBaseInfo)(HICON hIcon, const char *szPreferredProto);
+ void (*pfnTrayIconTaskbarCreated)(HWND hwnd);
+ int (*pfnTrayIconUpdate)(HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase);
- void ( *pfnUninitTray )( void );
- void ( *pfnLockTray )( void );
- void ( *pfnUnlockTray )( void );
+ void (*pfnUninitTray)(void);
+ void (*pfnLockTray)(void);
+ void (*pfnUnlockTray)(void);
- VOID ( CALLBACK *pfnTrayCycleTimerProc )( HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime );
+ VOID (CALLBACK *pfnTrayCycleTimerProc)(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
/*************************************************************************************
* version 6 additions (0.8.0.x) - accounts
*************************************************************************************/
- int ( *pfnGetAccountIndexByPos )( int pos );
- int ( *pfnConvertMenu )( CLISTMENUITEM*, TMO_MenuItem* );
+ int (*pfnGetAccountIndexByPos)(int pos);
+ int (*pfnConvertMenu)(CLISTMENUITEM*, TMO_MenuItem*);
}
CLIST_INTERFACE;
diff --git a/include/m_contacts.h b/include/m_contacts.h index 549c9d589e..dd14dfd39d 100644 --- a/include/m_contacts.h +++ b/include/m_contacts.h @@ -88,7 +88,7 @@ typedef struct { // Add this flag if you want to get the Unicode info
#define CNF_UNICODE 0x80
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define CNF_TCHAR CNF_UNICODE // will use TCHAR* instead of char*
#else
#define CNF_TCHAR 0 // will return char*, as usual
diff --git a/include/m_database.h b/include/m_database.h index 2675b5e148..f23fbbbe21 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -87,7 +87,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DBVT_BLOB 254 //cpbVal and pbVal are valid
#define DBVT_UTF8 253 //pszVal is valid
#define DBVT_WCHAR 252 //pszVal is valid
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define DBVT_TCHAR DBVT_WCHAR
#else
#define DBVT_TCHAR DBVT_ASCIIZ
@@ -145,7 +145,7 @@ Returns 0 on success or nonzero otherwise #define MS_DB_GETPROFILEPATH "DB/GetProfilePath"
#define MS_DB_GETPROFILEPATHW "DB/GetProfilePathW"
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define MS_DB_GETPROFILEPATHT MS_DB_GETPROFILEPATHW
#define MS_DB_GETPROFILENAMET MS_DB_GETPROFILENAMEW
#else
@@ -514,17 +514,17 @@ typedef struct { #define MS_DB_EVENT_GETTEXT "DB/Event/GetText"
-__inline static char* DbGetEventTextA( DBEVENTINFO* dbei, int codepage )
+__inline static char* DbGetEventTextA(DBEVENTINFO* dbei, int codepage)
{ DBEVENTGETTEXT temp = { dbei, DBVT_ASCIIZ, codepage };
return (char*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&temp);
}
-__inline static WCHAR* DbGetEventTextW( DBEVENTINFO* dbei, int codepage )
+__inline static WCHAR* DbGetEventTextW(DBEVENTINFO* dbei, int codepage)
{ DBEVENTGETTEXT temp = { dbei, DBVT_WCHAR, codepage };
return (WCHAR*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&temp);
}
-__inline static TCHAR* DbGetEventTextT( DBEVENTINFO* dbei, int codepage )
+__inline static TCHAR* DbGetEventTextT(DBEVENTINFO* dbei, int codepage)
{ DBEVENTGETTEXT temp = { dbei, DBVT_TCHAR, codepage };
return (TCHAR*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&temp);
}
@@ -555,9 +555,9 @@ Caller must free the result using mir_free #define MS_DB_EVENT_GETSTRINGT "DB/Event/GetStringT"
-__inline static TCHAR* DbGetEventStringT( DBEVENTINFO* dbei, const char* str )
+__inline static TCHAR* DbGetEventStringT(DBEVENTINFO* dbei, const char* str)
{
- return (TCHAR*)CallService( MS_DB_EVENT_GETSTRINGT, (WPARAM)dbei, (LPARAM)str );
+ return (TCHAR*)CallService(MS_DB_EVENT_GETSTRINGT, (WPARAM)dbei, (LPARAM)str);
}
/* DB/Event/MarkRead
@@ -675,7 +675,7 @@ it would have been at the time and date the stamp contains. This service isn't nearly as useful as db/time/TimestampToString below and I
recommend avoiding its use when possible so that you don't get your timezones
mixed up (like I did. Living at GMT makes things easier for me, but has certain
-disadvantages :-) ).
+disadvantages :-)).
*/
#define MS_DB_TIME_TIMESTAMPTOLOCAL "DB/Time/TimestampToLocal"
diff --git a/include/m_hotkeys.h b/include/m_hotkeys.h index 5522f49bc9..6bb568d618 100644 --- a/include/m_hotkeys.h +++ b/include/m_hotkeys.h @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HKD_UNICODE 0x0001
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define HKD_TCHAR HKD_UNICODE
#else
#define HKD_TCHAR 0
diff --git a/include/m_langpack.h b/include/m_langpack.h index e601b58c49..d1dfb9d326 100644 --- a/include/m_langpack.h +++ b/include/m_langpack.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_LANGPACK_H__
#define M_LANGPACK_H__
-#if !defined( _STATIC )
+#if !defined(_STATIC)
#define MIRANDA_CUSTOM_LP
#endif
@@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //these versions, I pity them.
#define MS_LANGPACK_TRANSLATESTRING "LangPack/TranslateString"
-#if defined( MIRANDA_CUSTOM_LP )
+#if defined(MIRANDA_CUSTOM_LP)
extern int hLangpack;
@@ -105,7 +105,7 @@ typedef struct { #define MS_LANGPACK_TRANSLATEDIALOG "LangPack/TranslateDialog"
-#if defined( MIRANDA_CUSTOM_LP )
+#if defined(MIRANDA_CUSTOM_LP)
__inline static INT_PTR TranslateDialogDefault(HWND hwndDlg)
{
@@ -137,7 +137,7 @@ __inline static INT_PTR TranslateDialogDefault(HWND hwndDlg) //returns 0 on success, nonzero on failure
#define MS_LANGPACK_TRANSLATEMENU "LangPack/TranslateMenu"
-#if defined( MIRANDA_CUSTOM_LP )
+#if defined(MIRANDA_CUSTOM_LP)
__inline static INT_PTR TranslateMenu(HMENU hMenu)
{ return CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hMenu, hLangpack);
@@ -170,7 +170,7 @@ __inline static INT_PTR TranslateMenu(HMENU hMenu) //This string should be freed using mir_free() then
#define MS_LANGPACK_PCHARTOTCHAR "LangPack/PcharToTchar"
-#if defined( MIRANDA_CUSTOM_LP )
+#if defined(MIRANDA_CUSTOM_LP)
__inline static INT_PTR Langpack_PCharToTChar(const char* str)
{ return CallService(MS_LANGPACK_PCHARTOTCHAR, hLangpack, (LPARAM)str);
@@ -190,8 +190,8 @@ __inline static INT_PTR Langpack_PCharToTChar(const char* str) //always returns 0
#define MS_LANGPACK_REGISTER "LangPack/Register"
-#if defined( MIRANDA_CUSTOM_LP )
-__forceinline void mir_getLP( const PLUGININFOEX* pInfo )
+#if defined(MIRANDA_CUSTOM_LP)
+__forceinline void mir_getLP(const PLUGININFOEX* pInfo)
{ CallService(MS_LANGPACK_REGISTER, (WPARAM)&hLangpack, (LPARAM)pInfo);
}
#endif
diff --git a/include/m_netlib.h b/include/m_netlib.h index 689d352ea9..20db435de5 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -174,7 +174,7 @@ should use the MSG_DUMPPROXY flag so that the logging is neat. //Gets the user-configured settings for a netlib user
//wParam=(WPARAM)(HANDLE)hUser
//lParam=(LPARAM)(NETLIBUSERSETTINGS*)&nlus
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//The pointers referred to in the returned struct will remain valid until
//the hUser handle is closed, or until the user changes the settings in the
//options page, so it's best not to rely on them for too long.
@@ -207,7 +207,7 @@ typedef struct { //Changes the user-configurable settings for a netlib user
//wParam=(WPARAM)(HANDLE)hUser
//lParam=(LPARAM)(NETLIBUSERSETTINGS*)&nlus
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//This function is only really useful for people that specify NUF_NOOPTIONS
//and want to create their own options.
//Even if a setting is not active (eg szProxyAuthPassword when useProxyAuth is
@@ -218,7 +218,7 @@ typedef struct { //Closes a netlib handle
//wParam=(WPARAM)(HANDLE)hNetlibHandle
//lParam=0
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//This function should be called on all handles returned by netlib functions
//once you are done with them. If it's called on a socket-type handle, the
//socket will be closed.
@@ -351,7 +351,7 @@ struct NETLIBOPENCONNECTION_tag { //Sets the required information for an HTTP proxy connection
//wParam=(WPARAM)(HANDLE)hConnection
//lParam=(LPARAM)(NETLIBHTTPPROXYINFO*)&nlhpi
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//This function is designed to be called from within pfnHttpGatewayInit
//See notes below MS_NETLIB_REGISTERUSER.
//Errors: ERROR_INVALID_PARAMETER
@@ -392,7 +392,7 @@ typedef struct { //Base64 decode a string. See rfc1421.
//wParam=0
//lParam=(LPARAM)(NETLIBBASE64*)&nlb64
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//nlb64.pszEncoded and nlb64.cchEncoded contain the input string and its length
//(excluding terminating zero).
//nlb64.pbDecoded and nlb64.cbDecoded contain the buffer in which to put the
@@ -412,7 +412,7 @@ typedef struct { //Base64 encode a string. See rfc1421.
//wParam=0
//lParam=(LPARAM)(NETLIBBASE64*)&nlb64
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//nlb64.pbDecoded and nlb64.cbDecoded contain the input buffer and its length
//nlb64.pszEncoded and nlb64.cchEncoded contain the buffer in which to put the
//output and the length of this buffer. The maximum output size for a given
@@ -546,7 +546,7 @@ struct NETLIBHTTPREQUEST_tag { //Free the memory used by a NETLIBHTTPREQUEST structure
//wParam=0
//lParam=(LPARAM)(NETLIBHTTPREQUEST*)pnlhr
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//This should only be called on structures returned by
//MS_NETLIB_RECVHTTPHEADERS or MS_NETLIB_HTTPTRANSACTION. Calling it on an
//arbitrary structure will have disastrous results.
@@ -721,7 +721,7 @@ typedef struct { //Add a message to the log (if it's running)
//wParam=(WPARAM)(HANDLE)hUser
//lParam=(LPARAM)(const char *)szMessage
-//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Returns nonzero on success, 0 on failure ( !! this is different to most of the rest of Miranda, but consistent with netlib)
//Do not include a final line ending in szMessage.
//Errors: ERROR_INVALID_PARAMETER
#define MS_NETLIB_LOG "Netlib/Log"
@@ -751,7 +751,7 @@ typedef struct //here's a handy piece of code to let you log using printf-style specifiers:
//#include <stdarg.h> and <stdio.h> before including this header in order to
//use it.
-#if defined va_start && (defined _STDIO_DEFINED || defined _STDIO_H_) && (!defined NETLIB_NOLOGGING)
+#if defined va_start && (defined _STDIO_DEFINED || defined _STDIO_H_) && ( !defined NETLIB_NOLOGGING)
static INT_PTR Netlib_Logf(HANDLE hUser, const char *fmt, ...)
{
va_list va;
@@ -807,9 +807,9 @@ static INT_PTR Netlib_Logf(HANDLE hUser, const char *fmt, ...) // Known providers: Basic, NTLM, Negotiate, Kerberos, GSSAPI - (Kerberos SASL)
#define MS_NETLIB_INITSECURITYPROVIDER "Netlib/InitSecurityProvider"
-static __inline HANDLE Netlib_InitSecurityProvider( char* szProviderName )
+static __inline HANDLE Netlib_InitSecurityProvider(char* szProviderName)
{
- return (HANDLE)CallService( MS_NETLIB_INITSECURITYPROVIDER, 0, (LPARAM)szProviderName );
+ return (HANDLE)CallService(MS_NETLIB_INITSECURITYPROVIDER, 0, (LPARAM)szProviderName);
}
typedef struct {
@@ -822,10 +822,10 @@ typedef struct { #define MS_NETLIB_INITSECURITYPROVIDER2 "Netlib/InitSecurityProvider2"
-static __inline HANDLE Netlib_InitSecurityProvider2( const TCHAR* szProviderName, const TCHAR* szPrincipal )
+static __inline HANDLE Netlib_InitSecurityProvider2(const TCHAR* szProviderName, const TCHAR* szPrincipal)
{
NETLIBNTLMINIT2 temp = { sizeof(temp), szProviderName, szPrincipal, NNR_TCHAR };
- return (HANDLE)CallService( MS_NETLIB_INITSECURITYPROVIDER2, 0, (LPARAM)&temp );
+ return (HANDLE)CallService(MS_NETLIB_INITSECURITYPROVIDER2, 0, (LPARAM)&temp);
}
@@ -833,9 +833,9 @@ static __inline HANDLE Netlib_InitSecurityProvider2( const TCHAR* szProviderName // Right now only NTLM is supported
#define MS_NETLIB_DESTROYSECURITYPROVIDER "Netlib/DestroySecurityProvider"
-static __inline void Netlib_DestroySecurityProvider( char* szProviderName, HANDLE hProvider )
+static __inline void Netlib_DestroySecurityProvider(char* szProviderName, HANDLE hProvider)
{
- CallService( MS_NETLIB_DESTROYSECURITYPROVIDER, (WPARAM)szProviderName, (LPARAM)hProvider );
+ CallService(MS_NETLIB_DESTROYSECURITYPROVIDER, (WPARAM)szProviderName, (LPARAM)hProvider);
}
// Returns the NTLM response string. The result value should be freed using mir_free
@@ -849,10 +849,10 @@ typedef struct { #define MS_NETLIB_NTLMCREATERESPONSE "Netlib/NtlmCreateResponse"
-static __inline char* Netlib_NtlmCreateResponse( HANDLE hProvider, char* szChallenge, char* login, char* psw )
+static __inline char* Netlib_NtlmCreateResponse(HANDLE hProvider, char* szChallenge, char* login, char* psw)
{
NETLIBNTLMREQUEST temp = { szChallenge, login, psw };
- return (char*)CallService( MS_NETLIB_NTLMCREATERESPONSE, (WPARAM)hProvider, (LPARAM)&temp );
+ return (char*)CallService(MS_NETLIB_NTLMCREATERESPONSE, (WPARAM)hProvider, (LPARAM)&temp);
}
typedef struct {
@@ -867,10 +867,10 @@ typedef struct { #define MS_NETLIB_NTLMCREATERESPONSE2 "Netlib/NtlmCreateResponse2"
-static __inline char* Netlib_NtlmCreateResponse2( HANDLE hProvider, char* szChallenge, TCHAR* szLogin, TCHAR* szPass, unsigned *complete )
+static __inline char* Netlib_NtlmCreateResponse2(HANDLE hProvider, char* szChallenge, TCHAR* szLogin, TCHAR* szPass, unsigned *complete)
{
NETLIBNTLMREQUEST2 temp = { sizeof(temp), szChallenge, szLogin, szPass, *complete, NNR_TCHAR };
- char* res = (char*)CallService( MS_NETLIB_NTLMCREATERESPONSE2, (WPARAM)hProvider, (LPARAM)&temp );
+ char* res = (char*)CallService(MS_NETLIB_NTLMCREATERESPONSE2, (WPARAM)hProvider, (LPARAM)&temp);
*complete = temp.complete;
return res;
}
diff --git a/include/m_options.h b/include/m_options.h index 75c2df4057..5da817a71a 100644 --- a/include/m_options.h +++ b/include/m_options.h @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_OPTIONS_H__
#define M_OPTIONS_H__
+extern int hLangpack;
+
/* Opt/Initialise
The user opened the options dialog. Modules should do whatever initialisation
they need and call opt/addpage one or more times if they want pages displayed
@@ -77,18 +79,15 @@ typedef struct { int nExpertOnlyControls; //v0.1.2.1+ these controls will be hidden in simple mode. Array must remain valid for duration of dlg.
union {
- char* pszTab; //v0.6.0.0+ [TRANSLATED-BY-CORE]
- TCHAR* ptszTab; //v0.6.0.0+
- };
+ char* pszTab; //v0.6.0.0+ [TRANSLATED-BY-CORE]
+ TCHAR* ptszTab; //v0.6.0.0+
+ };
LPARAM dwInitParam; //v0.8.0.0+ a value to pass to lParam of WM_INITDIALOG message
+ int hLangpack;
}
OPTIONSDIALOGPAGE;
-#define OPTIONPAGE_OLD_SIZE (offsetof(OPTIONSDIALOGPAGE, flags))
-#define OPTIONPAGE_OLD_SIZE2 (offsetof(OPTIONSDIALOGPAGE, pszTab))
-#define OPTIONPAGE_OLD_SIZE3 (offsetof(OPTIONSDIALOGPAGE, dwInitParam))
-
#define ODPF_SIMPLEONLY 1 // page is only shown when in simple mode
#define ODPF_EXPERTONLY 2 // " expert mode
#define ODPF_BOLDGROUPS 4 // give group box titles a bold font
@@ -96,7 +95,7 @@ typedef struct { #define ODPF_USERINFOTAB 16 // options page is tabbed
#define ODPF_DONTTRANSLATE 32 // do not translate option page title
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define ODPF_TCHAR ODPF_UNICODE
#else
#define ODPF_TCHAR 0
@@ -105,7 +104,11 @@ typedef struct { #define PSN_EXPERTCHANGED 2 //sent to pages via WM_NOTIFY when the expert checkbox is clicked. lParam=new state
#define PSM_ISEXPERT (WM_USER+101) //returns true/false
#define PSM_GETBOLDFONT (WM_USER+102) //returns HFONT used for group box titles
-#define MS_OPT_ADDPAGE "Opt/AddPage"
+
+__inline static INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE* odp)
+{ odp->hLangpack = hLangpack;
+ return CallService("Opt/AddPage", wParam, (LPARAM)odp);
+}
//Opens the options dialog, optionally at the specified page v0.1.2.1+
//wParam=0
@@ -120,7 +123,9 @@ typedef struct { //specific page
const char *pszTab; //set to NULL to just open the options at no
//specific tab
-} OPENOPTIONSDIALOG;
+}
+ OPENOPTIONSDIALOG;
+
#define MS_OPT_OPENOPTIONS "Opt/OpenOptions"
//Opens the options dialog, with only specified page v0.8.0.x+
diff --git a/include/m_plugins.h b/include/m_plugins.h index 402da041d7..95657cd1bb 100644 --- a/include/m_plugins.h +++ b/include/m_plugins.h @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct PLUGIN_DB_ENUM {
int cbSize;
// 0 = continue, 1 = found, -1 = stop now
- int (*pfnEnumCallback) ( const char * pluginname, /*DATABASELINK*/ void * link, LPARAM lParam);
+ int (*pfnEnumCallback) (const char * pluginname, /*DATABASELINK*/ void * link, LPARAM lParam);
LPARAM lParam;
} PLUGIN_DB_ENUM;
#define MS_PLUGINS_ENUMDBPLUGINS "Plugins/DbEnumerate"
diff --git a/include/m_protocols.h b/include/m_protocols.h index 8ee54722c2..88553d6ae0 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -108,7 +108,7 @@ typedef struct { #define PFTS_UNICODE 2
#define PFTS_UTF 4
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define PFTS_TCHAR PFTS_UNICODE
#else
#define PFTS_TCHAR 0
@@ -173,13 +173,13 @@ PROTOFILETRANSFERSTATUS; #define PROTOCOLDESCRIPTOR_V3_SIZE (sizeof(size_t)+sizeof(INT_PTR)+sizeof(char*))
// initializes an empty account
-typedef struct tagPROTO_INTERFACE* ( *pfnInitProto )( const char* szModuleName, const TCHAR* szUserName );
+typedef struct tagPROTO_INTERFACE* (*pfnInitProto)(const char* szModuleName, const TCHAR* szUserName);
// deallocates an account instance
-typedef int ( *pfnUninitProto )( struct tagPROTO_INTERFACE* );
+typedef int (*pfnUninitProto)(struct tagPROTO_INTERFACE*);
// removes an account from the database
-typedef int ( *pfnDestroyProto )( struct tagPROTO_INTERFACE* );
+typedef int (*pfnDestroyProto)(struct tagPROTO_INTERFACE*);
typedef struct {
size_t cbSize;
@@ -293,8 +293,8 @@ typedef struct tagACCOUNT //lParam=(LPARAM)(PROTOACCOUNT**)paAccounts
#define MS_PROTO_ENUMACCOUNTS "Proto/EnumAccounts"
-__inline static INT_PTR ProtoEnumAccounts( int* accNumber, PROTOACCOUNT*** accArray )
-{ return CallService( MS_PROTO_ENUMACCOUNTS, ( WPARAM )accNumber, (LPARAM)accArray );
+__inline static INT_PTR ProtoEnumAccounts(int* accNumber, PROTOACCOUNT*** accArray)
+{ return CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)accNumber, (LPARAM)accArray);
}
//retrieves an account's interface by its physical name (database module)
@@ -303,8 +303,8 @@ __inline static INT_PTR ProtoEnumAccounts( int* accNumber, PROTOACCOUNT*** accAr //return value = PROTOACCOUNT* or NULL
#define MS_PROTO_GETACCOUNT "Proto/GetAccount"
-__inline static PROTOACCOUNT* ProtoGetAccount( const char* accName )
-{ return (PROTOACCOUNT*)CallService( MS_PROTO_GETACCOUNT, 0, (LPARAM)accName );
+__inline static PROTOACCOUNT* ProtoGetAccount(const char* accName)
+{ return (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accName);
}
//this event is fired when the accounts list gets changed
@@ -331,9 +331,9 @@ __inline static PROTOACCOUNT* ProtoGetAccount( const char* accName ) //Returns 1 if an account is valid and enabled, 0 otherwise
#define MS_PROTO_ISACCOUNTENABLED "Proto/IsAccountEnabled"
-__inline static int IsAccountEnabled( const PROTOACCOUNT* pa )
+__inline static int IsAccountEnabled(const PROTOACCOUNT* pa)
{
- return (int)CallService( MS_PROTO_ISACCOUNTENABLED, 0, (LPARAM)pa );
+ return (int)CallService(MS_PROTO_ISACCOUNTENABLED, 0, (LPARAM)pa);
}
//determines if an account is locked or not
diff --git a/include/m_protoint.h b/include/m_protoint.h index 0eac0f0015..d4c7c73b91 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -44,52 +44,52 @@ typedef enum #ifndef __cplusplus
typedef struct tagPROTO_INTERFACE_VTBL
{
- HANDLE ( *AddToList )( struct tagPROTO_INTERFACE*, int flags, PROTOSEARCHRESULT* psr );
- HANDLE ( *AddToListByEvent )( struct tagPROTO_INTERFACE*, int flags, int iContact, HANDLE hDbEvent );
+ HANDLE (*AddToList)(struct tagPROTO_INTERFACE*, int flags, PROTOSEARCHRESULT* psr);
+ HANDLE (*AddToListByEvent)(struct tagPROTO_INTERFACE*, int flags, int iContact, HANDLE hDbEvent);
- int ( *Authorize )( struct tagPROTO_INTERFACE*, HANDLE hContact );
- int ( *AuthDeny )( struct tagPROTO_INTERFACE*, HANDLE hContact, const TCHAR* szReason );
- int ( *AuthRecv )( struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT* );
- int ( *AuthRequest )( struct tagPROTO_INTERFACE*, HANDLE hContact, const TCHAR* szMessage );
+ int (*Authorize)(struct tagPROTO_INTERFACE*, HANDLE hContact);
+ int (*AuthDeny)(struct tagPROTO_INTERFACE*, HANDLE hContact, const TCHAR* szReason);
+ int (*AuthRecv)(struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT*);
+ int (*AuthRequest)(struct tagPROTO_INTERFACE*, HANDLE hContact, const TCHAR* szMessage);
- HANDLE ( *ChangeInfo )( struct tagPROTO_INTERFACE*, int iInfoType, void* pInfoData );
+ HANDLE (*ChangeInfo)(struct tagPROTO_INTERFACE*, int iInfoType, void* pInfoData);
- HANDLE ( *FileAllow )( struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath );
- int ( *FileCancel )( struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hTransfer );
- int ( *FileDeny )( struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason );
- int ( *FileResume )( struct tagPROTO_INTERFACE*, HANDLE hTransfer, int* action, const PROTOCHAR** szFilename );
+ HANDLE (*FileAllow)(struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath);
+ int (*FileCancel)(struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hTransfer);
+ int (*FileDeny)(struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason);
+ int (*FileResume)(struct tagPROTO_INTERFACE*, HANDLE hTransfer, int* action, const PROTOCHAR** szFilename);
- DWORD_PTR ( *GetCaps )( struct tagPROTO_INTERFACE*, int type, HANDLE hContact );
- HICON ( *GetIcon )( struct tagPROTO_INTERFACE*, int iconIndex );
- int ( *GetInfo )( struct tagPROTO_INTERFACE*, HANDLE hContact, int infoType );
+ DWORD_PTR (*GetCaps)(struct tagPROTO_INTERFACE*, int type, HANDLE hContact);
+ HICON (*GetIcon)(struct tagPROTO_INTERFACE*, int iconIndex);
+ int (*GetInfo)(struct tagPROTO_INTERFACE*, HANDLE hContact, int infoType);
- HANDLE ( *SearchBasic )( struct tagPROTO_INTERFACE*, const PROTOCHAR* id );
- HANDLE ( *SearchByEmail )( struct tagPROTO_INTERFACE*, const PROTOCHAR* email );
- HANDLE ( *SearchByName )( struct tagPROTO_INTERFACE*, const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName );
- HWND ( *SearchAdvanced )( struct tagPROTO_INTERFACE*, HWND owner );
- HWND ( *CreateExtendedSearchUI )( struct tagPROTO_INTERFACE*, HWND owner );
+ HANDLE (*SearchBasic)(struct tagPROTO_INTERFACE*, const PROTOCHAR* id);
+ HANDLE (*SearchByEmail)(struct tagPROTO_INTERFACE*, const PROTOCHAR* email);
+ HANDLE (*SearchByName)(struct tagPROTO_INTERFACE*, const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName);
+ HWND (*SearchAdvanced)(struct tagPROTO_INTERFACE*, HWND owner);
+ HWND (*CreateExtendedSearchUI)(struct tagPROTO_INTERFACE*, HWND owner);
- int ( *RecvContacts )( struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT* );
- int ( *RecvFile )( struct tagPROTO_INTERFACE*, HANDLE hContact, PROTOFILEEVENT* );
- int ( *RecvMsg )( struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT* );
- int ( *RecvUrl )( struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT* );
+ int (*RecvContacts)(struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT*);
+ int (*RecvFile)(struct tagPROTO_INTERFACE*, HANDLE hContact, PROTOFILEEVENT*);
+ int (*RecvMsg)(struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT*);
+ int (*RecvUrl)(struct tagPROTO_INTERFACE*, HANDLE hContact, PROTORECVEVENT*);
- int ( *SendContacts )( struct tagPROTO_INTERFACE*, HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList );
- HANDLE ( *SendFile )( struct tagPROTO_INTERFACE*, HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles );
- int ( *SendMsg )( struct tagPROTO_INTERFACE*, HANDLE hContact, int flags, const char* msg );
- int ( *SendUrl )( struct tagPROTO_INTERFACE*, HANDLE hContact, int flags, const char* url );
+ int (*SendContacts)(struct tagPROTO_INTERFACE*, HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList);
+ HANDLE (*SendFile)(struct tagPROTO_INTERFACE*, HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles);
+ int (*SendMsg)(struct tagPROTO_INTERFACE*, HANDLE hContact, int flags, const char* msg);
+ int (*SendUrl)(struct tagPROTO_INTERFACE*, HANDLE hContact, int flags, const char* url);
- int ( *SetApparentMode )( struct tagPROTO_INTERFACE*, HANDLE hContact, int mode );
- int ( *SetStatus )( struct tagPROTO_INTERFACE*, int iNewStatus );
+ int (*SetApparentMode)(struct tagPROTO_INTERFACE*, HANDLE hContact, int mode);
+ int (*SetStatus)(struct tagPROTO_INTERFACE*, int iNewStatus);
- HANDLE ( *GetAwayMsg )( struct tagPROTO_INTERFACE*, HANDLE hContact );
- int ( *RecvAwayMsg )( struct tagPROTO_INTERFACE*, HANDLE hContact, int mode, PROTORECVEVENT* evt );
- int ( *SendAwayMsg )( struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hProcess, const char* msg );
- int ( *SetAwayMsg )( struct tagPROTO_INTERFACE*, int iStatus, const PROTOCHAR* msg );
+ HANDLE (*GetAwayMsg)(struct tagPROTO_INTERFACE*, HANDLE hContact);
+ int (*RecvAwayMsg)(struct tagPROTO_INTERFACE*, HANDLE hContact, int mode, PROTORECVEVENT* evt);
+ int (*SendAwayMsg)(struct tagPROTO_INTERFACE*, HANDLE hContact, HANDLE hProcess, const char* msg);
+ int (*SetAwayMsg)(struct tagPROTO_INTERFACE*, int iStatus, const PROTOCHAR* msg);
- int ( *UserIsTyping )( struct tagPROTO_INTERFACE*, HANDLE hContact, int type );
+ int (*UserIsTyping)(struct tagPROTO_INTERFACE*, HANDLE hContact, int type);
- int ( *OnEvent )( struct tagPROTO_INTERFACE*, PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam );
+ int (*OnEvent)(struct tagPROTO_INTERFACE*, PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
}
PROTO_INTERFACE_VTBL;
#endif
@@ -111,52 +111,52 @@ typedef struct tagPROTO_INTERFACE DWORD reserved[ 40 ];
#ifdef __cplusplus
- virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ) = 0;
- virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ) = 0;
+ virtual HANDLE __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr) = 0;
+ virtual HANDLE __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) = 0;
- virtual int __cdecl Authorize( HANDLE hDbEvent ) = 0;
- virtual int __cdecl AuthDeny( HANDLE hDbEvent, const PROTOCHAR* szReason ) = 0;
- virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ) = 0;
- virtual int __cdecl AuthRequest( HANDLE hContact, const PROTOCHAR* szMessage ) = 0;
+ virtual int __cdecl Authorize(HANDLE hDbEvent) = 0;
+ virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) = 0;
+ virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*) = 0;
+ virtual int __cdecl AuthRequest(HANDLE hContact, const PROTOCHAR* szMessage) = 0;
- virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ) = 0;
+ virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData) = 0;
- virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) = 0;
- virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ) = 0;
- virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) = 0;
- virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ) = 0;
+ virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) = 0;
+ virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer) = 0;
+ virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason) = 0;
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename) = 0;
- virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ) = 0;
- virtual HICON __cdecl GetIcon( int iconIndex ) = 0;
- virtual int __cdecl GetInfo( HANDLE hContact, int infoType ) = 0;
+ virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL) = 0;
+ virtual HICON __cdecl GetIcon(int iconIndex) = 0;
+ virtual int __cdecl GetInfo(HANDLE hContact, int infoType) = 0;
- virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ) = 0;
- virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ) = 0;
- virtual HANDLE __cdecl SearchByName( const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName ) = 0;
- virtual HWND __cdecl SearchAdvanced( HWND owner ) = 0;
- virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ) = 0;
+ virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id) = 0;
+ virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email) = 0;
+ virtual HANDLE __cdecl SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName) = 0;
+ virtual HWND __cdecl SearchAdvanced(HWND owner) = 0;
+ virtual HWND __cdecl CreateExtendedSearchUI(HWND owner) = 0;
- virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ) = 0;
- virtual int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* ) = 0;
- virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ) = 0;
- virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ) = 0;
+ virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*) = 0;
+ virtual int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT*) = 0;
+ virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*) = 0;
+ virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*) = 0;
- virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) = 0;
- virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) = 0;
- virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ) = 0;
- virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ) = 0;
+ virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) = 0;
+ virtual HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) = 0;
+ virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg) = 0;
+ virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url) = 0;
- virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ) = 0;
- virtual int __cdecl SetStatus( int iNewStatus ) = 0;
+ virtual int __cdecl SetApparentMode(HANDLE hContact, int mode) = 0;
+ virtual int __cdecl SetStatus(int iNewStatus) = 0;
- virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ) = 0;
- virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ) = 0;
- virtual int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ) = 0;
- virtual int __cdecl SetAwayMsg( int iStatus, const PROTOCHAR* msg ) = 0;
+ virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact) = 0;
+ virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt) = 0;
+ virtual int __cdecl SendAwayMsg(HANDLE hContact, HANDLE hProcess, const char* msg) = 0;
+ virtual int __cdecl SetAwayMsg(int iStatus, const PROTOCHAR* msg) = 0;
- virtual int __cdecl UserIsTyping( HANDLE hContact, int type ) = 0;
+ virtual int __cdecl UserIsTyping(HANDLE hContact, int type) = 0;
- virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam ) = 0;
+ virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) = 0;
#endif
}
PROTO_INTERFACE;
diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 3eb934b532..264adac76d 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -316,7 +316,7 @@ will pick this up and everything will be good. //the ack is complete.
#define PSR_UNICODE 1 // return Unicode status
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define PSR_TCHAR PSR_UNICODE
#else
#define PSR_TCHAR 0
@@ -495,7 +495,7 @@ typedef struct { // Remember to mir_free the return value
#define SGMA_UNICODE 1 // return Unicode status
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define SGMA_TCHAR SGMA_UNICODE
#else
#define SGMA_TCHAR 0
@@ -509,7 +509,7 @@ typedef struct { // return=0 for success
#define SMNN_UNICODE 1 // return Unicode status
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define SMNN_TCHAR SMNN_UNICODE
#else
#define SMNN_TCHAR 0
@@ -526,7 +526,7 @@ typedef struct { // WAYD = What are you doing
#define WAYD_UNICODE 1 // return Unicode texts
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define WAYD_TCHAR WAYD_UNICODE
#else
#define WAYD_TCHAR 0
@@ -723,7 +723,7 @@ typedef struct { #define PREF_RTL 4 // 0.5+ addition: support for right-to-left messages
#define PREF_UTF 8 // message is in utf-8 (0.7.0+)
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define PREF_TCHAR PREF_UNICODE
#else
#define PREF_TCHAR 0
diff --git a/include/m_skin.h b/include/m_skin.h index 31fd5e2361..0a5da39889 100644 --- a/include/m_skin.h +++ b/include/m_skin.h @@ -121,7 +121,7 @@ __inline static HICON LoadSkinnedProtoIconBig(const char *szProto, int status) { #define SSDF_UNICODE 0x0001
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define SSDF_TCHAR SSDF_UNICODE
#else
#define SSDF_TCHAR 0
diff --git a/include/m_system.h b/include/m_system.h index 1b2ed6f11f..d17896a0a5 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -58,7 +58,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //wParam=lParam=0
#define ME_SYSTEM_SHUTDOWN "Miranda/System/Shutdown"
-//restarts miranda ( 0.8+ )
+//restarts miranda (0.8+)
//wParam=lParam=0
#define MS_SYSTEM_RESTART "Miranda/System/Restart"
@@ -157,15 +157,15 @@ struct MM_INTERFACE wchar_t* (*mir_a2u_cp) (const char* src, int codepage);
wchar_t* (*mir_a2u)(const char* src);
char* (*mir_u2a_cp)(const wchar_t* src, int codepage);
- char* (*mir_u2a)( const wchar_t* src);
+ char* (*mir_u2a)(const wchar_t* src);
};
#define MS_SYSTEM_GET_MMI "Miranda/System/GetMMI"
-__forceinline INT_PTR mir_getMMI( struct MM_INTERFACE* dest )
+__forceinline INT_PTR mir_getMMI(struct MM_INTERFACE* dest)
{
dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_MMI, 0, (LPARAM)dest );
+ return CallService(MS_SYSTEM_GET_MMI, 0, (LPARAM)dest);
}
#ifndef _STATIC
@@ -191,7 +191,7 @@ __forceinline INT_PTR mir_getMMI( struct MM_INTERFACE* dest ) WCHAR* mir_wstrdup(const WCHAR *src);
#endif
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define mir_tstrdup mir_wstrdup
#else
#define mir_tstrdup mir_strdup
@@ -210,7 +210,7 @@ wParam=0, lParam = (LPARAM)LIST_INTERFACE* #define LIST_INTERFACE_V2_SIZE (sizeof(size_t)+9*sizeof(void*))
#define LIST_INTERFACE_V3_SIZE (sizeof(size_t)+11*sizeof(void*))
-typedef int ( *FSortFunc )( void*, void* );
+typedef int (*FSortFunc)(void*, void*);
// Assumes first 32 bit value of the data is the numeric key
// and uses it to perform sort/search operations, this results
@@ -235,28 +235,28 @@ struct LIST_INTERFACE {
size_t cbSize;
- SortedList* ( *List_Create )( int, int );
- void ( *List_Destroy )( SortedList* );
+ SortedList* (*List_Create)(int, int);
+ void (*List_Destroy)(SortedList*);
- void* ( *List_Find )( SortedList*, void* );
- int ( *List_GetIndex )( SortedList*, void*, int* );
- int ( *List_Insert )( SortedList*, void*, int );
- int ( *List_Remove )( SortedList*, int );
- int ( *List_IndexOf )( SortedList*, void* );
+ void* (*List_Find)(SortedList*, void*);
+ int (*List_GetIndex)(SortedList*, void*, int*);
+ int (*List_Insert)(SortedList*, void*, int);
+ int (*List_Remove)(SortedList*, int);
+ int (*List_IndexOf)(SortedList*, void*);
- int ( *List_InsertPtr)( SortedList* list, void* p );
- int ( *List_RemovePtr)( SortedList* list, void* p );
+ int (*List_InsertPtr)(SortedList* list, void* p);
+ int (*List_RemovePtr)(SortedList* list, void* p);
- void ( *List_Copy )( SortedList* src, SortedList* dst, size_t );
- void ( *List_ObjCopy )( SortedList* src, SortedList* dst, size_t );
+ void (*List_Copy)(SortedList* src, SortedList* dst, size_t);
+ void (*List_ObjCopy)(SortedList* src, SortedList* dst, size_t);
};
#define MS_SYSTEM_GET_LI "Miranda/System/GetLI"
-__forceinline INT_PTR mir_getLI( struct LIST_INTERFACE* dest )
+__forceinline INT_PTR mir_getLI(struct LIST_INTERFACE* dest)
{
dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_LI, 0, (LPARAM)dest );
+ return CallService(MS_SYSTEM_GET_LI, 0, (LPARAM)dest);
}
/*
@@ -276,33 +276,33 @@ struct UTF8_INTERFACE // if the second parameter is present, the additional wchar_t* string gets allocated,
// and filled with the decoded utf8 content without any information loss.
// this string should be freed using mir_free()
- char* ( *utf8_decode )( char* str, wchar_t** ucs2 );
- char* ( *utf8_decodecp )( char* str, int codepage, wchar_t** ucs2 );
+ char* (*utf8_decode)(char* str, wchar_t** ucs2);
+ char* (*utf8_decodecp)(char* str, int codepage, wchar_t** ucs2);
// encodes an ANSI string into a utf8 format using the current langpack code page,
// or CP_ACP, if lanpack is missing
// the resulting string should be freed using mir_free
- char* ( *utf8_encode )( const char* src );
- char* ( *utf8_encodecp )( const char* src, int codepage );
+ char* (*utf8_encode)(const char* src);
+ char* (*utf8_encodecp)(const char* src, int codepage);
// encodes an WCHAR string into a utf8 format
// the resulting string should be freed using mir_free
- char* ( *utf8_encodeW )( const wchar_t* src );
+ char* (*utf8_encodeW)(const wchar_t* src);
// decodes utf8 and returns the result as wchar_t* that should be freed using mir_free()
// the input buffer remains unchanged
- wchar_t* ( *utf8_decodeW )( const char* str );
+ wchar_t* (*utf8_decodeW)(const char* str);
// returns the predicted length of the utf-8 string
- int ( *utf8_lenW )( const wchar_t* src );
+ int (*utf8_lenW)(const wchar_t* src);
};
#define MS_SYSTEM_GET_UTFI "Miranda/System/GetUTFI"
-__forceinline INT_PTR mir_getUTFI( struct UTF8_INTERFACE* dest )
+__forceinline INT_PTR mir_getUTFI(struct UTF8_INTERFACE* dest)
{
dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_UTFI, 0, (LPARAM)dest );
+ return CallService(MS_SYSTEM_GET_UTFI, 0, (LPARAM)dest);
}
extern struct UTF8_INTERFACE utfi;
@@ -322,7 +322,7 @@ __forceinline char* mir_utf8decodeA(const char* src) return tmp;
}
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define mir_utf8decodeT mir_utf8decodeW
#define mir_utf8encodeT mir_utf8encodeW
#else
@@ -429,9 +429,9 @@ typedef void (__cdecl *pThreadFunc)(void*); #define MS_SYSTEM_FORK_THREAD "Miranda/Thread/Fork"
-__forceinline HANDLE mir_forkthread( pThreadFunc aFunc, void* arg )
+__forceinline HANDLE mir_forkthread(pThreadFunc aFunc, void* arg)
{
- return (HANDLE)CallService( MS_SYSTEM_FORK_THREAD, (WPARAM)aFunc, (LPARAM)arg );
+ return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD, (WPARAM)aFunc, (LPARAM)arg);
}
/* 0.5.2+
@@ -457,14 +457,14 @@ typedef struct #define MS_SYSTEM_FORK_THREAD_EX "Miranda/Thread/ForkEx"
-static __inline HANDLE mir_forkthreadex( pThreadFuncEx aFunc, void* arg, int stackSize, unsigned* pThreadID )
+static __inline HANDLE mir_forkthreadex(pThreadFuncEx aFunc, void* arg, int stackSize, unsigned* pThreadID)
{
FORK_THREADEX_PARAMS params;
params.pFunc = aFunc;
params.arg = arg;
params.iStackSize = stackSize;
params.threadID = pThreadID;
- return (HANDLE)CallService( MS_SYSTEM_FORK_THREAD_EX, 0, (LPARAM)¶ms );
+ return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, 0, (LPARAM)¶ms);
}
/* 0.8.0+
@@ -476,14 +476,14 @@ passes the owner info and extended parameters info and returns the thread id */
-static __inline HANDLE mir_forkthreadowner( pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID )
+static __inline HANDLE mir_forkthreadowner(pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID)
{
FORK_THREADEX_PARAMS params;
- params.pFunc = ( pThreadFuncEx )aFunc;
+ params.pFunc = (pThreadFuncEx)aFunc;
params.arg = arg;
params.iStackSize = 0;
params.threadID = pThreadID;
- return (HANDLE)CallService( MS_SYSTEM_FORK_THREAD_EX, (WPARAM)owner, (LPARAM)¶ms );
+ return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, (WPARAM)owner, (LPARAM)¶ms);
}
@@ -608,18 +608,18 @@ obtain this filter and call it inside the __except section 0.8.0+ addition (2008/07/20)
*/
-typedef DWORD ( __cdecl *pfnExceptionFilter )( DWORD code, EXCEPTION_POINTERS* info );
+typedef DWORD (__cdecl *pfnExceptionFilter)(DWORD code, EXCEPTION_POINTERS* info);
#define MS_SYSTEM_GETEXCEPTFILTER "System/GetExceptFilter"
-__inline static pfnExceptionFilter Miranda_GetExceptFilter( void )
-{ return ( pfnExceptionFilter )CallService( MS_SYSTEM_GETEXCEPTFILTER, 0, 0 );
+__inline static pfnExceptionFilter Miranda_GetExceptFilter(void)
+{ return (pfnExceptionFilter)CallService(MS_SYSTEM_GETEXCEPTFILTER, 0, 0);
}
#define MS_SYSTEM_SETEXCEPTFILTER "System/SetExceptFilter"
-__inline static pfnExceptionFilter Miranda_SetExceptFilter( pfnExceptionFilter foo )
-{ return ( pfnExceptionFilter )CallService( MS_SYSTEM_SETEXCEPTFILTER, 0, (LPARAM)foo );
+__inline static pfnExceptionFilter Miranda_SetExceptFilter(pfnExceptionFilter foo)
+{ return (pfnExceptionFilter)CallService(MS_SYSTEM_SETEXCEPTFILTER, 0, (LPARAM)foo);
}
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 3187948810..1a6cb833f2 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -25,13 +25,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_system.h"
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define tstring wstring
#else
#define tstring string
#endif
-#if defined( __cplusplus )
+#if defined(__cplusplus)
extern LIST_INTERFACE li;
#define NumericKeySortT -1
@@ -40,64 +40,64 @@ extern LIST_INTERFACE li; template<class T> struct LIST
{
- typedef int ( *FTSortFunc )( const T* p1, const T* p2 );
+ typedef int (*FTSortFunc)(const T* p1, const T* p2);
- __inline LIST( int aincr, FTSortFunc afunc = NULL )
- { memset( this, 0, sizeof( *this ));
+ __inline LIST(int aincr, FTSortFunc afunc = NULL)
+ { memset(this, 0, sizeof(*this));
increment = aincr;
sortFunc = afunc;
}
- __inline LIST( int aincr, INT_PTR id )
- { memset( this, 0, sizeof( *this ));
+ __inline LIST(int aincr, INT_PTR id)
+ { memset(this, 0, sizeof(*this));
increment = aincr;
- sortFunc = FTSortFunc( id );
+ sortFunc = FTSortFunc(id);
}
- __inline T* operator[]( int idx ) const { return ( idx >= 0 && idx < count ) ? items[idx] : NULL; }
- __inline int getCount( void ) const { return count; }
- __inline T** getArray( void ) const { return items; }
+ __inline T* operator[](int idx) const { return (idx >= 0 && idx < count) ? items[idx] : NULL; }
+ __inline int getCount(void) const { return count; }
+ __inline T** getArray(void) const { return items; }
- #if defined( _STATIC )
- __inline LIST( const LIST& x )
+ #if defined(_STATIC)
+ __inline LIST(const LIST& x)
{ items = NULL;
- List_Copy(( SortedList* )&x, ( SortedList* )this, sizeof( T ));
+ List_Copy((SortedList*)&x, (SortedList*)this, sizeof(T));
}
- __inline int getIndex( T* p ) const
+ __inline int getIndex(T* p) const
{ int idx;
- return ( !List_GetIndex(( SortedList* )this, p, &idx )) ? -1 : idx;
+ return ( !List_GetIndex((SortedList*)this, p, &idx)) ? -1 : idx;
}
- __inline void destroy( void ) { List_Destroy(( SortedList* )this ); }
+ __inline void destroy(void) { List_Destroy((SortedList*)this); }
- __inline T* find( T* p ) { return ( T* )List_Find(( SortedList* )this, p ); }
- __inline int indexOf( T* p ) { return List_IndexOf(( SortedList* )this, p ); }
- __inline int insert( T* p, int idx ) { return List_Insert(( SortedList* )this, p, idx ); }
- __inline int remove( int idx ) { return List_Remove(( SortedList* )this, idx ); }
+ __inline T* find(T* p) { return (T*)List_Find((SortedList*)this, p); }
+ __inline int indexOf(T* p) { return List_IndexOf((SortedList*)this, p); }
+ __inline int insert(T* p, int idx) { return List_Insert((SortedList*)this, p, idx); }
+ __inline int remove(int idx) { return List_Remove((SortedList*)this, idx); }
- __inline int insert( T* p ) { return List_InsertPtr(( SortedList* )this, p ); }
- __inline int remove( T* p ) { return List_RemovePtr(( SortedList* )this, p ); }
+ __inline int insert(T* p) { return List_InsertPtr((SortedList*)this, p); }
+ __inline int remove(T* p) { return List_RemovePtr((SortedList*)this, p); }
#else
- __inline LIST( const LIST& x )
+ __inline LIST(const LIST& x)
{ items = NULL;
- li.List_Copy(( SortedList* )&x, ( SortedList* )this, sizeof( T ));
+ li.List_Copy((SortedList*)&x, (SortedList*)this, sizeof(T));
}
- __inline int getIndex( T* p ) const
+ __inline int getIndex(T* p) const
{ int idx;
- return ( !li.List_GetIndex(( SortedList* )this, p, &idx )) ? -1 : idx;
+ return ( !li.List_GetIndex((SortedList*)this, p, &idx)) ? -1 : idx;
}
- __inline void destroy( void ) { li.List_Destroy(( SortedList* )this ); }
+ __inline void destroy(void) { li.List_Destroy((SortedList*)this); }
- __inline T* find( T* p ) { return ( T* )li.List_Find(( SortedList* )this, p ); }
- __inline int indexOf( T* p ) { return li.List_IndexOf(( SortedList* )this, p ); }
- __inline int insert( T* p, int idx ) { return li.List_Insert(( SortedList* )this, p, idx ); }
- __inline int remove( int idx ) { return li.List_Remove(( SortedList* )this, idx ); }
+ __inline T* find(T* p) { return (T*)li.List_Find((SortedList*)this, p); }
+ __inline int indexOf(T* p) { return li.List_IndexOf((SortedList*)this, p); }
+ __inline int insert(T* p, int idx) { return li.List_Insert((SortedList*)this, p, idx); }
+ __inline int remove(int idx) { return li.List_Remove((SortedList*)this, idx); }
- __inline int insert( T* p ) { return li.List_InsertPtr(( SortedList* )this, p ); }
- __inline int remove( T* p ) { return li.List_RemovePtr(( SortedList* )this, p ); }
+ __inline int insert(T* p) { return li.List_InsertPtr((SortedList*)this, p); }
+ __inline int remove(T* p) { return li.List_RemovePtr((SortedList*)this, p); }
#endif
protected:
@@ -108,71 +108,71 @@ protected: template<class T> struct OBJLIST : public LIST<T>
{
- typedef int ( *FTSortFunc )( const T* p1, const T* p2 );
+ typedef int (*FTSortFunc)(const T* p1, const T* p2);
- __inline OBJLIST( int aincr, FTSortFunc afunc = NULL ) :
- LIST<T>( aincr, afunc )
+ __inline OBJLIST(int aincr, FTSortFunc afunc = NULL) :
+ LIST<T>(aincr, afunc)
{}
- __inline OBJLIST( int aincr, INT_PTR id ) :
- LIST<T>( aincr, ( FTSortFunc ) id )
+ __inline OBJLIST(int aincr, INT_PTR id) :
+ LIST<T>(aincr, (FTSortFunc) id)
{}
- __inline OBJLIST( const OBJLIST& x ) :
- LIST<T>( x.increment, x.sortFunc )
+ __inline OBJLIST(const OBJLIST& x) :
+ LIST<T>(x.increment, x.sortFunc)
{ items = NULL;
- #if defined( _STATIC )
- List_ObjCopy(( SortedList* )&x, ( SortedList* )this, sizeof( T ));
+ #if defined(_STATIC)
+ List_ObjCopy((SortedList*)&x, (SortedList*)this, sizeof(T));
#else
- li.List_ObjCopy(( SortedList* )&x, ( SortedList* )this, sizeof( T ));
+ li.List_ObjCopy((SortedList*)&x, (SortedList*)this, sizeof(T));
#endif
}
- __inline OBJLIST& operator=( const OBJLIST& x )
+ __inline OBJLIST& operator=(const OBJLIST& x)
{ destroy();
- #if defined( _STATIC )
- List_ObjCopy(( SortedList* )&x, ( SortedList* )this, sizeof( T ));
+ #if defined(_STATIC)
+ List_ObjCopy((SortedList*)&x, (SortedList*)this, sizeof(T));
#else
- li.List_ObjCopy(( SortedList* )&x, ( SortedList* )this, sizeof( T ));
+ li.List_ObjCopy((SortedList*)&x, (SortedList*)this, sizeof(T));
#endif
return *this;
}
~OBJLIST()
{
- #if !defined( _STATIC )
+ #if !defined(_STATIC)
if (li.cbSize != 0)
#endif
destroy();
}
- __inline void destroy( void )
+ __inline void destroy(void)
{
- for ( int i=0; i < this->count; i++ )
+ for (int i=0; i < this->count; i++)
delete this->items[i];
- #if defined( _STATIC )
- List_Destroy(( SortedList* )this );
+ #if defined(_STATIC)
+ List_Destroy((SortedList*)this);
#else
- li.List_Destroy(( SortedList* )this );
+ li.List_Destroy((SortedList*)this);
#endif
}
- __inline int remove( int idx ) {
+ __inline int remove(int idx) {
delete this->items[idx];
- #if defined( _STATIC )
- return List_Remove(( SortedList* )this, idx );
+ #if defined(_STATIC)
+ return List_Remove((SortedList*)this, idx);
#else
- return li.List_Remove(( SortedList* )this, idx );
+ return li.List_Remove((SortedList*)this, idx);
#endif
}
- __inline int remove( T* p )
+ __inline int remove(T* p)
{
- #if defined( _STATIC )
- if ( li.List_RemovePtr(( SortedList* )this, p ) != -1 )
+ #if defined(_STATIC)
+ if (li.List_RemovePtr((SortedList*)this, p) != -1)
#else
- if ( li.List_RemovePtr(( SortedList* )this, p ) != -1 )
+ if (li.List_RemovePtr((SortedList*)this, p) != -1)
#endif
{
delete p;
@@ -181,7 +181,7 @@ template<class T> struct OBJLIST : public LIST<T> return 0;
}
- __inline T& operator[]( int idx ) const { return *this->items[idx]; }
+ __inline T& operator[](int idx) const { return *this->items[idx]; }
};
#endif
diff --git a/include/m_timezones.h b/include/m_timezones.h index 335cce00f2..39681cef1c 100644 --- a/include/m_timezones.h +++ b/include/m_timezones.h @@ -37,22 +37,22 @@ typedef struct {
size_t cbSize;
- HANDLE ( *createByName )( LPCTSTR tszName, DWORD dwFlags );
- HANDLE ( *createByContact )( HANDLE hContact, DWORD dwFlags );
- void ( *storeByContact )( HANDLE hContact, HANDLE hTZ );
+ HANDLE (*createByName)(LPCTSTR tszName, DWORD dwFlags);
+ HANDLE (*createByContact)(HANDLE hContact, DWORD dwFlags);
+ void (*storeByContact)(HANDLE hContact, HANDLE hTZ);
- int ( *printDateTime )( HANDLE hTZ, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags );
- int ( *printTimeStamp )( HANDLE hTZ, time_t ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags );
+ int (*printDateTime)(HANDLE hTZ, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags);
+ int (*printTimeStamp)(HANDLE hTZ, time_t ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags);
- int ( *prepareList )( HANDLE hContact, HWND hWnd, DWORD dwFlags );
- int ( *selectListItem )( HANDLE hContact, HWND hWnd, DWORD dwFlags );
- void ( *storeListResults )( HANDLE hContact, HWND hWnd, DWORD dwFlags );
+ int (*prepareList)(HANDLE hContact, HWND hWnd, DWORD dwFlags);
+ int (*selectListItem)(HANDLE hContact, HWND hWnd, DWORD dwFlags);
+ void (*storeListResults)(HANDLE hContact, HWND hWnd, DWORD dwFlags);
- int ( *getTimeZoneTime )( HANDLE hTZ, SYSTEMTIME *st );
- time_t ( *timeStampToTimeZoneTimeStamp )( HANDLE hTZ, time_t ts );
+ int (*getTimeZoneTime)(HANDLE hTZ, SYSTEMTIME *st);
+ time_t (*timeStampToTimeZoneTimeStamp)(HANDLE hTZ, time_t ts);
- LPTIME_ZONE_INFORMATION ( *getTzi )( HANDLE hTZ );
- LPCTSTR ( *getTzName )( HANDLE hTZ );
+ LPTIME_ZONE_INFORMATION (*getTzi)(HANDLE hTZ);
+ LPCTSTR (*getTzName)(HANDLE hTZ);
#ifdef __cplusplus
int printDateTimeByContact (HANDLE hContact, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags)
diff --git a/include/m_userinfo.h b/include/m_userinfo.h index bb11722b1c..0456fb70e8 100644 --- a/include/m_userinfo.h +++ b/include/m_userinfo.h @@ -70,7 +70,12 @@ All PSN_ WM_NOTIFY messages have PSHNOTIFY.lParam=(LPARAM)hContact #define PSN_INFOCHANGED 1
#define PSN_PARAMCHANGED 2
#define PSM_FORCECHANGED (WM_USER+100) //force-send a PSN_INFOCHANGED to all pages
-#define MS_USERINFO_ADDPAGE "UserInfo/AddPage"
-#endif // M_USERINFO_H__
+extern int hLangpack;
+
+__inline static INT_PTR UserInfo_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE* odp)
+{ odp->hLangpack = hLangpack;
+ return CallService("UserInfo/AddPage", wParam, (LPARAM)odp);
+}
+#endif // M_USERINFO_H__
diff --git a/include/m_utils.h b/include/m_utils.h index 4d5ee302a7..34d82594e8 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -448,10 +448,10 @@ struct MD5_INTERFACE #define MS_SYSTEM_GET_MD5I "Miranda/System/GetMD5I"
-static __inline INT_PTR mir_getMD5I( struct MD5_INTERFACE* dest )
+static __inline INT_PTR mir_getMD5I(struct MD5_INTERFACE* dest)
{
dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_MD5I, 0, (LPARAM)dest );
+ return CallService(MS_SYSTEM_GET_MD5I, 0, (LPARAM)dest);
}
extern struct MD5_INTERFACE md5i;
@@ -488,10 +488,10 @@ struct SHA1_INTERFACE #define MS_SYSTEM_GET_SHA1I "Miranda/System/GetSHA1I"
-static __inline INT_PTR mir_getSHA1I( struct SHA1_INTERFACE* dest )
+static __inline INT_PTR mir_getSHA1I(struct SHA1_INTERFACE* dest)
{
dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_SHA1I, 0, (LPARAM)dest );
+ return CallService(MS_SYSTEM_GET_SHA1I, 0, (LPARAM)dest);
}
extern struct SHA1_INTERFACE sha1i;
@@ -502,7 +502,7 @@ extern struct SHA1_INTERFACE sha1i; #define mir_sha1_hash(A,B,C) sha1i.sha1_hash(A,B,C)
// allows to include TCHAR* strings into mir_snprintf and NetLib_Logf calls
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define TCHAR_STR_PARAM "%S"
#else
#define TCHAR_STR_PARAM "%s"
@@ -530,14 +530,14 @@ extern struct SHA1_INTERFACE sha1i; #define mir_u2t_cp(s,c) mir_u2a_cp(s,c)
#endif
-#if defined( __cplusplus )
+#if defined(__cplusplus)
#ifdef _STATIC
- void mir_free( void* );
+ void mir_free(void*);
WCHAR* mir_a2u_cp(const char* src, int codepage);
WCHAR* mir_a2u(const char* src);
char* mir_u2a_cp(const wchar_t* src, int codepage);
- char* mir_u2a( const wchar_t* src);
+ char* mir_u2a(const wchar_t* src);
#endif
class _A2T
@@ -545,8 +545,8 @@ class _A2T TCHAR* buf;
public:
- __forceinline _A2T( const char* s ) : buf( mir_a2t( s )) {}
- __forceinline _A2T( const char* s, int cp ) : buf( mir_a2t_cp( s, cp )) {}
+ __forceinline _A2T(const char* s) : buf(mir_a2t(s)) {}
+ __forceinline _A2T(const char* s, int cp) : buf(mir_a2t_cp(s, cp)) {}
~_A2T() { mir_free(buf); }
__forceinline operator TCHAR*() const
@@ -559,8 +559,8 @@ class _T2A char* buf;
public:
- __forceinline _T2A( const TCHAR* s ) : buf( mir_t2a( s )) {}
- __forceinline _T2A( const TCHAR* s, int cp ) : buf( mir_t2a_cp( s, cp )) {}
+ __forceinline _T2A(const TCHAR* s) : buf(mir_t2a(s)) {}
+ __forceinline _T2A(const TCHAR* s, int cp) : buf(mir_t2a_cp(s, cp)) {}
__forceinline ~_T2A() { mir_free(buf); }
__forceinline operator char*() const
diff --git a/include/m_xml.h b/include/m_xml.h index 0ad119d326..fe6932a41c 100644 --- a/include/m_xml.h +++ b/include/m_xml.h @@ -43,55 +43,55 @@ typedef struct {
size_t cbSize;
- HXML ( *createNode )( LPCTSTR name, LPCTSTR text, char isDeclaration );
- void ( *destroyNode )( HXML node );
-
- HXML ( *parseString )( LPCTSTR string, int* datalen, LPCTSTR tag );
- LPTSTR ( *toString )( HXML node, int* datalen );
-
- HXML ( *addChild )( HXML parent, LPCTSTR name, LPCTSTR text );
- void ( *addChild2 )( HXML child, HXML parent );
- HXML ( *copyNode )( HXML parent );
- HXML ( *getChild )( HXML parent, int number );
- int ( *getChildCount )( HXML );
- HXML ( *getChildByAttrValue )( HXML parent, LPCTSTR name, LPCTSTR attrName, LPCTSTR attrValue );
- HXML ( *getFirstChild )( HXML parent );
- HXML ( *getNthChild )( HXML parent, LPCTSTR name, int i );
- HXML ( *getNextChild )( HXML parent, LPCTSTR name, int *i );
- HXML ( *getChildByPath )( HXML parent, LPCTSTR path, char createNodeIfMissing );
- HXML ( *getNextNode )( HXML node );
- LPCTSTR ( *getName )( HXML );
- HXML ( *getParent )( HXML );
- LPCTSTR ( *getText )( HXML ); // = getTextByIndex(HXML, 0)
- void ( *setText )( HXML, LPCTSTR ); // = setTextByIndex(HXML, LPCTSTR, 0)
-
- LPCTSTR ( *getAttr )( HXML, int i );
- LPCTSTR ( *getAttrName )( HXML, int i );
- LPCTSTR ( *getAttrValue )( HXML, LPCTSTR attrName );
- int ( *getAttrCount )( HXML );
- void ( *addAttr )( HXML, LPCTSTR attrName, LPCTSTR attrValue );
- void ( *addAttrInt )( HXML, LPCTSTR attrName, int attrValue );
-
- void ( *freeMem )( void* );
+ HXML (*createNode)(LPCTSTR name, LPCTSTR text, char isDeclaration);
+ void (*destroyNode)(HXML node);
+
+ HXML (*parseString)(LPCTSTR string, int* datalen, LPCTSTR tag);
+ LPTSTR (*toString)(HXML node, int* datalen);
+
+ HXML (*addChild)(HXML parent, LPCTSTR name, LPCTSTR text);
+ void (*addChild2)(HXML child, HXML parent);
+ HXML (*copyNode)(HXML parent);
+ HXML (*getChild)(HXML parent, int number);
+ int (*getChildCount)(HXML);
+ HXML (*getChildByAttrValue)(HXML parent, LPCTSTR name, LPCTSTR attrName, LPCTSTR attrValue);
+ HXML (*getFirstChild)(HXML parent);
+ HXML (*getNthChild)(HXML parent, LPCTSTR name, int i);
+ HXML (*getNextChild)(HXML parent, LPCTSTR name, int *i);
+ HXML (*getChildByPath)(HXML parent, LPCTSTR path, char createNodeIfMissing);
+ HXML (*getNextNode)(HXML node);
+ LPCTSTR (*getName)(HXML);
+ HXML (*getParent)(HXML);
+ LPCTSTR (*getText)(HXML); // = getTextByIndex(HXML, 0)
+ void (*setText)(HXML, LPCTSTR); // = setTextByIndex(HXML, LPCTSTR, 0)
+
+ LPCTSTR (*getAttr)(HXML, int i);
+ LPCTSTR (*getAttrName)(HXML, int i);
+ LPCTSTR (*getAttrValue)(HXML, LPCTSTR attrName);
+ int (*getAttrCount)(HXML);
+ void (*addAttr)(HXML, LPCTSTR attrName, LPCTSTR attrValue);
+ void (*addAttrInt)(HXML, LPCTSTR attrName, int attrValue);
+
+ void (*freeMem)(void*);
// methods added in XML API v2
- char ( *isDeclaration )( HXML );
- LPTSTR ( *toStringWithFormatting )( HXML node, int* datalen );
- HXML ( *deepCopy )( HXML );
- void ( *setAttrByIndex )( HXML, int i, LPCTSTR value );
- void ( *setAttrByName )( HXML, LPCTSTR name, LPCTSTR value );
- HXML ( *addChildEx )( HXML parent, LPCTSTR name, char isDeclaration, XML_ELEMENT_POS n );
- void ( *addChildEx2 )( HXML child, HXML parent, XML_ELEMENT_POS n );
- int ( *getTextCount )( HXML );
- LPCTSTR ( *getTextByIndex )( HXML, int i );
- void ( *addText )( HXML, LPCTSTR, XML_ELEMENT_POS n );
- void ( *setTextByIndex )( HXML, int i, LPCTSTR );
- int ( *getClearCount )( HXML );
- LPCTSTR ( *getClear )( HXML, int i, LPCTSTR *openTag, LPCTSTR *closeTag );
- void ( *addClear )( HXML, LPCTSTR lpszValue, LPCTSTR openTag, LPCTSTR closeTag, XML_ELEMENT_POS n );
- void ( *setClear )( HXML, int i, LPCTSTR lpszValue );
- int ( *getElementCount )( HXML );
- int ( *getElement )( HXML, XML_ELEMENT_POS n, XML_ELEMENT_TYPE *type, HXML *child, LPCTSTR *value, LPCTSTR *name, LPCTSTR *openTag, LPCTSTR *closeTag );
+ char (*isDeclaration)(HXML);
+ LPTSTR (*toStringWithFormatting)(HXML node, int* datalen);
+ HXML (*deepCopy)(HXML);
+ void (*setAttrByIndex)(HXML, int i, LPCTSTR value);
+ void (*setAttrByName)(HXML, LPCTSTR name, LPCTSTR value);
+ HXML (*addChildEx)(HXML parent, LPCTSTR name, char isDeclaration, XML_ELEMENT_POS n);
+ void (*addChildEx2)(HXML child, HXML parent, XML_ELEMENT_POS n);
+ int (*getTextCount)(HXML);
+ LPCTSTR (*getTextByIndex)(HXML, int i);
+ void (*addText)(HXML, LPCTSTR, XML_ELEMENT_POS n);
+ void (*setTextByIndex)(HXML, int i, LPCTSTR);
+ int (*getClearCount)(HXML);
+ LPCTSTR (*getClear)(HXML, int i, LPCTSTR *openTag, LPCTSTR *closeTag);
+ void (*addClear)(HXML, LPCTSTR lpszValue, LPCTSTR openTag, LPCTSTR closeTag, XML_ELEMENT_POS n);
+ void (*setClear)(HXML, int i, LPCTSTR lpszValue);
+ int (*getElementCount)(HXML);
+ int (*getElement)(HXML, XML_ELEMENT_POS n, XML_ELEMENT_TYPE *type, HXML *child, LPCTSTR *value, LPCTSTR *name, LPCTSTR *openTag, LPCTSTR *closeTag);
// With getElement() it's possible to enumerate all the different contents (attribute, child, text, clear) of the current node. The order is reflecting the order of the original file/string. NOTE: 0 <= i < getElementCount().
// type, child, value, name, openTag, closeTag will be filled on return, depending on type:
// for XML_ELEM_TYPE_CHILD, child is valid;
@@ -99,17 +99,17 @@ typedef struct // for XML_ELEM_TYPE_TEXT, value is valid;
// for XML_ELEM_TYPE_CLEAR, value, openTag and closeTag are valid.
- void ( *deleteNodeContent )( HXML ); // forces the deletion of the content of this node and the subtree
- void ( *deleteAttrByIndex )( HXML, int i );
- void ( *deleteAttrByName )( HXML, LPCTSTR name );
- void ( *deleteText )( HXML, int i );
- void ( *deleteClear )( HXML, int i );
-
- XML_ELEMENT_POS ( *positionOfChildByIndex )( HXML, int i );
- XML_ELEMENT_POS ( *positionOfChildByNode )( HXML, HXML );
- XML_ELEMENT_POS ( *positionOfChildByName )( HXML, LPCTSTR name, int i );
- XML_ELEMENT_POS ( *positionOfText )( HXML, int i );
- XML_ELEMENT_POS ( *positionOfClear )( HXML, int i );
+ void (*deleteNodeContent)(HXML); // forces the deletion of the content of this node and the subtree
+ void (*deleteAttrByIndex)(HXML, int i);
+ void (*deleteAttrByName)(HXML, LPCTSTR name);
+ void (*deleteText)(HXML, int i);
+ void (*deleteClear)(HXML, int i);
+
+ XML_ELEMENT_POS (*positionOfChildByIndex)(HXML, int i);
+ XML_ELEMENT_POS (*positionOfChildByNode)(HXML, HXML);
+ XML_ELEMENT_POS (*positionOfChildByName)(HXML, LPCTSTR name, int i);
+ XML_ELEMENT_POS (*positionOfText)(HXML, int i);
+ XML_ELEMENT_POS (*positionOfClear)(HXML, int i);
}
XML_API;
@@ -129,10 +129,10 @@ returns TRUE if all is Ok, and FALSE otherwise #define MS_SYSTEM_GET_XI "Miranda/System/GetXmlApi"
-__forceinline int mir_getXI( XML_API* dest )
+__forceinline int mir_getXI(XML_API* dest)
{
dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_XI, 0, (LPARAM)dest );
+ return CallService(MS_SYSTEM_GET_XI, 0, (LPARAM)dest);
}
#endif // M_XML_H__
diff --git a/include/newpluginapi.h b/include/newpluginapi.h index a8a5c619c7..0f2a6aa8d7 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -29,30 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PLUGIN_MAKE_VERSION(a, b, c, d) (((((DWORD)(a))&0xFF)<<24)|((((DWORD)(b))&0xFF)<<16)|((((DWORD)(c))&0xFF)<<8)|(((DWORD)(d))&0xFF))
#define MAXMODULELABELLENGTH 64
-#if defined( _UNICODE )
+#if defined(_UNICODE)
#define UNICODE_AWARE 1
#else
#define UNICODE_AWARE 0
#endif
-typedef struct {
- int cbSize;
- char *shortName;
- DWORD version;
- char *description; // [TRANSLATED-BY-CORE]
- char *author;
- char *authorEmail;
- char *copyright;
- char *homepage;
- BYTE flags; // right now the only flag, UNICODE_AWARE, is recognized here
- int replacesDefaultModule; //one of the DEFMOD_ constants in m_plugins.h or zero
- //if non-zero, this will supress the loading of the specified built-in module
- //with the implication that this plugin provides back-end-compatible features
-} PLUGININFO;
-
-/* 0.7+
- New plugin loader implementation
-*/
/* The UUID structure below is used to for plugin UUID's and module type definitions */
typedef struct _MUUID {
unsigned long a;
@@ -67,30 +49,30 @@ typedef struct _MUUID { /* Replaceable internal modules interface ids */
#define MIID_HISTORY {0x5ca0cbc1, 0x999a, 0x4ea2, {0x8b, 0x44, 0xf8, 0xf6, 0x7d, 0x7f, 0x8e, 0xbe}}
-#define MIID_UIFINDADD {0xb22c528d, 0x6852, 0x48eb, {0xa2, 0x94, 0xe, 0x26, 0xa9, 0x16, 0x12, 0x13}}
+#define MIID_UIFINDADD {0xb22c528d, 0x6852, 0x48eb, {0xa2, 0x94, 0x0e, 0x26, 0xa9, 0x16, 0x12, 0x13}}
#define MIID_UIUSERINFO {0x570b931c, 0x9af8, 0x48f1, {0xad, 0x9f, 0xc4, 0x49, 0x8c, 0x61, 0x8a, 0x77}}
#define MIID_SRURL {0x5192445c, 0xf5e8, 0x46c0, {0x8f, 0x9e, 0x2b, 0x6d, 0x43, 0xe5, 0xc7, 0x53}}
#define MIID_SRAUTH {0x377780b9, 0x2b3b, 0x405b, {0x9f, 0x36, 0xb3, 0xc4, 0x87, 0x8e, 0x6f, 0x33}}
-#define MIID_SRAWAY {0x5ab54c76, 0x1b4c, 0x4a00, {0xb4, 0x4, 0x48, 0xcb, 0xea, 0x5f, 0xef, 0xe7}}
-#define MIID_SREMAIL {0xd005b5a6, 0x1b66, 0x445a, {0xb6, 0x3, 0x74, 0xd4, 0xd4, 0x55, 0x2d, 0xe2}}
+#define MIID_SRAWAY {0x5ab54c76, 0x1b4c, 0x4a00, {0xb4, 0x04, 0x48, 0xcb, 0xea, 0x5f, 0xef, 0xe7}}
+#define MIID_SREMAIL {0xd005b5a6, 0x1b66, 0x445a, {0xb6, 0x03, 0x74, 0xd4, 0xd4, 0x55, 0x2d, 0xe2}}
#define MIID_SRFILE {0x989d104d, 0xacb7, 0x4ee0, {0xb9, 0x6d, 0x67, 0xce, 0x46, 0x53, 0xb6, 0x95}}
-#define MIID_UIHELP {0xf2d35c3c, 0x861a, 0x4cc3, {0xa7, 0x8f, 0xd1, 0xf7, 0x85, 0x4, 0x41, 0xcb}}
+#define MIID_UIHELP {0xf2d35c3c, 0x861a, 0x4cc3, {0xa7, 0x8f, 0xd1, 0xf7, 0x85, 0x04, 0x41, 0xcb}}
#define MIID_UIHISTORY {0x7f7e3d98, 0xce1f, 0x4962, {0x82, 0x84, 0x96, 0x85, 0x50, 0xf1, 0xd3, 0xd9}}
#define MIID_AUTOAWAY {0x9c87f7dc, 0x3bd7, 0x4983, {0xb7, 0xfb, 0xb8, 0x48, 0xfd, 0xbc, 0x91, 0xf0}}
#define MIID_USERONLINE {0x130829e0, 0x2463, 0x4ff8, {0xbb, 0xc8, 0xce, 0x73, 0xc0, 0x18, 0x84, 0x42}}
-#define MIID_IDLE {0x296f9f3b, 0x5b6f, 0x40e5, {0x8f, 0xb0, 0xa6, 0x49, 0x6c, 0x18, 0xbf, 0xa}}
+#define MIID_IDLE {0x296f9f3b, 0x5b6f, 0x40e5, {0x8f, 0xb0, 0xa6, 0x49, 0x6c, 0x18, 0xbf, 0x0a}}
#define MIID_FONTSERVICE {0x56f39112, 0xe37f, 0x4234, {0xa9, 0xe6, 0x7a, 0x81, 0x17, 0x45, 0xc1, 0x75}}
-#define MIID_UPDATENOTIFY {0x4e68b12a, 0x6b54, 0x44de, {0x86, 0x37, 0xf1, 0x12, 0xd, 0xb6, 0x81, 0x40}}
+#define MIID_UPDATENOTIFY {0x4e68b12a, 0x6b54, 0x44de, {0x86, 0x37, 0xf1, 0x12, 0x0d, 0xb6, 0x81, 0x40}}
#define MIID_CRYPTO {0x415ca6e1, 0x895f, 0x40e6, {0x87, 0xbd, 0x9b, 0x39, 0x60, 0x16, 0xd0, 0xe5}}
/* Common plugin interfaces (core plugins) */
-#define MIID_DATABASE {0xae77fd33, 0xe484, 0x4dc7, {0x8c, 0xbc, 0x9, 0x9f, 0xed, 0xcc, 0xcf, 0xdd}}
-#define MIID_CLIST {0x9d8da8bf, 0x665b, 0x4908, {0x9e, 0x61, 0x9f, 0x75, 0x98, 0xae, 0x33, 0xe}}
+#define MIID_DATABASE {0xae77fd33, 0xe484, 0x4dc7, {0x8c, 0xbc, 0x09, 0x9f, 0xed, 0xcc, 0xcf, 0xdd}}
+#define MIID_CLIST {0x9d8da8bf, 0x665b, 0x4908, {0x9e, 0x61, 0x9f, 0x75, 0x98, 0xae, 0x33, 0x0e}}
#define MIID_CHAT {0x23576a43, 0x3a26, 0x4357, {0x9b, 0x1b, 0x4a, 0x71, 0x9e, 0x42, 0x5d, 0x48}}
#define MIID_SRMM {0x58c7eea6, 0xf9db, 0x4dd9, {0x80, 0x36, 0xae, 0x80, 0x2b, 0xc0, 0x41, 0x4c}}
-#define MIID_IMPORT {0x5f3bcad4, 0x75f8, 0x476e, {0xb3, 0x6b, 0x2b, 0x30, 0x70, 0x32, 0x49, 0xc}}
+#define MIID_IMPORT {0x5f3bcad4, 0x75f8, 0x476e, {0xb3, 0x6b, 0x2b, 0x30, 0x70, 0x32, 0x49, 0x0c}}
#define MIID_IMGSERVICES {0xf3974915, 0xc9d5, 0x4c87, {0x85, 0x64, 0xa0, 0xeb, 0xf9, 0xd2, 0x5a, 0xa0}}
-#define MIID_TESTPLUGIN {0x53b974f4, 0x3c74, 0x4dba, {0x8f, 0xc2, 0x6f, 0x92, 0xfe, 0x1, 0x3b, 0x8c}}
+#define MIID_TESTPLUGIN {0x53b974f4, 0x3c74, 0x4dba, {0x8f, 0xc2, 0x6f, 0x92, 0xfe, 0x01, 0x3b, 0x8c}}
/* Common plugin interfaces (non-core plugins) */
#define MIID_VERSIONINFO {0xcfeb6325, 0x334e, 0x4052, {0xa6, 0x45, 0x56, 0x21, 0x93, 0xdf, 0xcc, 0x77}}
@@ -101,12 +83,12 @@ typedef struct _MUUID { #define MIID_MIRPY {0xcff91a5c, 0x1786, 0x41c1, {0x88, 0x86, 0x09, 0x4b, 0x14, 0x28, 0x1f, 0x15}}
#define MIID_SERVICESLIST {0xcf4bdf02, 0x5d27, 0x4241, {0x99, 0xe5, 0x19, 0x51, 0xaa, 0xb0, 0xc4, 0x54}}
#define MIID_TRANSLATOR {0xcfb637b0, 0x7217, 0x4c1e, {0xb2, 0x2a, 0xd9, 0x22, 0x32, 0x3a, 0x5d, 0x0b}}
-#define MIID_TOOLTIPS {0xbcbda043, 0x2716, 0x4404, {0xb0, 0xfa, 0x3d, 0x2d, 0x93, 0x81, 0x9e, 0x3}}
-#define MIID_POPUPS {0x33299069, 0x1919, 0x4ff8, {0xb1, 0x31, 0x1d, 0x7, 0x21, 0x78, 0xa7, 0x66}}
-#define MIID_LOGWINDOW {0xc53afb90, 0xfa44, 0x4304, {0xbc, 0x9d, 0x6a, 0x84, 0x1c, 0x39, 0x05, 0xf5}}
+#define MIID_TOOLTIPS {0xbcbda043, 0x2716, 0x4404, {0xb0, 0xfa, 0x3d, 0x2d, 0x93, 0x81, 0x9e, 0x03}}
+#define MIID_POPUPS {0x33299069, 0x1919, 0x4ff8, {0xb1, 0x31, 0x1d, 0x07, 0x21, 0x78, 0xa7, 0x66}}
+#define MIID_LOGWINDOW {0xc53afb90, 0xfa44, 0x4304, {0xbc, 0x9d, 0x6a, 0x84, 0x1c, 0x39, 0x05, 0xf5}}
#define MIID_EVENTNOTIFY {0xF3D7EC5A, 0xF7EF, 0x45DD, {0x8C, 0xA5, 0xB0, 0xF6, 0xBA, 0x18, 0x64, 0x7B}}
#define MIID_SRCONTACTS {0x7CA6050E, 0xBAF7, 0x42D2, {0xB9, 0x36, 0x0D, 0xB9, 0xDF, 0x57, 0x2B, 0x95}}
-#define MIID_HISTORYEXPORT {0x18fa2ade, 0xe31b, 0x4b5d, {0x95, 0x3d, 0xa, 0xb2, 0x57, 0x81, 0xc6, 0x4}}
+#define MIID_HISTORYEXPORT {0x18fa2ade, 0xe31b, 0x4b5d, {0x95, 0x3d, 0x0a, 0xb2, 0x57, 0x81, 0xc6, 0x04}}
/* Special exception interface for protocols.
This interface allows more than one plugin to implement it at the same time
@@ -184,10 +166,10 @@ typedef struct tagPLUGINLINK { int (*SetHookDefaultForHookableEvent) (HANDLE, MIRANDAHOOK); // v0.3.4 (2004/09/15)
HANDLE (*CreateServiceFunctionParam)(const char *, MIRANDASERVICEPARAM, LPARAM); // v0.7+ (2007/04/24)
int (*NotifyEventHooksDirect)(HANDLE, WPARAM, LPARAM); // v0.7+
- INT_PTR (*CallProtoService)(const char *, const char *, WPARAM, LPARAM );
- INT_PTR (*CallContactService)( HANDLE, const char *, WPARAM, LPARAM );
+ INT_PTR (*CallProtoService)(const char *, const char *, WPARAM, LPARAM);
+ INT_PTR (*CallContactService)(HANDLE, const char *, WPARAM, LPARAM);
HANDLE (*HookEventParam)(const char *, MIRANDAHOOKPARAM, LPARAM);
- HANDLE (*HookEventObj)(const char *, MIRANDAHOOKOBJ, void* );
+ HANDLE (*HookEventObj)(const char *, MIRANDAHOOKOBJ, void*);
HANDLE (*HookEventObjParam)(const char *, MIRANDAHOOKOBJPARAM, void*, LPARAM);
HANDLE (*CreateServiceFunctionObj)(const char *, MIRANDASERVICEOBJ, void*);
HANDLE (*CreateServiceFunctionObjParam)(const char *, MIRANDASERVICEOBJPARAM, void*, LPARAM);
@@ -247,7 +229,7 @@ typedef struct { /*
returns what the driver can do given the flag
*/
- int (*getCapability) ( int flag );
+ int (*getCapability) (int flag);
/*
buf: pointer to a string buffer
@@ -257,7 +239,7 @@ typedef struct { e.g. "Database driver for 3.xx profiles"
Returns: 0 on success, non zero on failure
*/
- int (*getFriendlyName) ( char * buf, size_t cch, int shortName );
+ int (*getFriendlyName) (char * buf, size_t cch, int shortName);
/*
profile: pointer to a string which contains full path + name
@@ -267,7 +249,7 @@ typedef struct { Note: Do not initialise internal data structures at this point!
Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_*
*/
- int (*makeDatabase) ( char * profile, int * error );
+ int (*makeDatabase) (char * profile, int * error);
/*
profile: [in] a null terminated string to file path of selected profile
@@ -279,21 +261,21 @@ typedef struct { etc.
Returns: 0 on success, non zero on failure
*/
- int (*grokHeader) ( char * profile, int * error );
+ int (*grokHeader) (char * profile, int * error);
/*
Affect: Tell the database to create all services/hooks that a 3.xx legecy database might support into link,
which is a PLUGINLINK structure
Returns: 0 on success, nonzero on failure
*/
- int (*Load) ( char * profile, void * link );
+ int (*Load) (char * profile, void * link);
/*
Affect: The database plugin should shutdown, unloading things from the core and freeing internal structures
Returns: 0 on success, nonzero on failure
Note: Unload() might be called even if Load() was never called, wasLoaded is set to 1 if Load() was ever called.
*/
- int (*Unload) ( int wasLoaded );
+ int (*Unload) (int wasLoaded);
} DATABASELINK;
diff --git a/include/win2k.h b/include/win2k.h index d71504dc2b..9ff57530b0 100644 --- a/include/win2k.h +++ b/include/win2k.h @@ -107,7 +107,7 @@ File created by Christian Kästner, and tweaked a bit by Richard Hughes*/ RECT rcClip; // clipping rectangle
} DTBGOPTS, *PDTBGOPTS;
#endif
- #if !defined( DTT_COMPOSITED )
+ #if !defined(DTT_COMPOSITED)
#define DTT_TEXTCOLOR (1UL << 0) // crText has been specified
#define DTT_BORDERCOLOR (1UL << 1) // crBorder has been specified
#define DTT_SHADOWCOLOR (1UL << 2) // crShadow has been specified
@@ -313,7 +313,7 @@ File created by Christian Kästner, and tweaked a bit by Richard Hughes*/ #define NIN_BALLOONTIMEOUT (WM_USER + 4)
#define NIN_BALLOONUSERCLICK (WM_USER + 5)
// SDK isn't present or some older VC compiler was used, include missing things.
-#elif !defined(NOWIN2K) && (!defined WS_EX_LAYERED || !defined IDC_HAND)
+#elif !defined(NOWIN2K) && ( !defined WS_EX_LAYERED || !defined IDC_HAND)
#pragma message("win2k.h")
@@ -427,12 +427,12 @@ File created by Christian Kästner, and tweaked a bit by Richard Hughes*/ #ifndef IDropTargetHelper
DEFINE_GUID(CLSID_DragDropHelper, 0x4657278a, 0x411b, 0x11d2, 0x83, 0x9a, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0);
#define INTERFACE IDropTargetHelper
- DECLARE_INTERFACE_( IDropTargetHelper, IUnknown )
+ DECLARE_INTERFACE_(IDropTargetHelper, IUnknown)
{
// IUnknown methods
STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
- STDMETHOD_(ULONG, Release) ( THIS ) PURE;
+ STDMETHOD_(ULONG, AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG, Release) (THIS) PURE;
// IDropTargetHelper
STDMETHOD (DragEnter)(THIS_ HWND hwndTarget, IDataObject* pDataObject,
@@ -515,15 +515,15 @@ File created by Christian Kästner, and tweaked a bit by Richard Hughes*/ #undef INTERFACE
#endif
#define INTERFACE ITaskbarList3
- DECLARE_INTERFACE_( ITaskbarList3, ITaskbarList2 )
+ DECLARE_INTERFACE_(ITaskbarList3, ITaskbarList2)
{
// IUnknown methods
STDMETHOD (QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS ) PURE;
- STDMETHOD_(ULONG, Release) (THIS ) PURE;
+ STDMETHOD_(ULONG, AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG, Release) (THIS) PURE;
// overloaded ITaskbarList2 members
- STDMETHOD (HrInit) (THIS ) PURE;
+ STDMETHOD (HrInit) (THIS) PURE;
STDMETHOD (AddTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (DeleteTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (ActivateTab) (THIS_ HWND hwnd) PURE;
diff --git a/plugins/AVS/main.cpp b/plugins/AVS/main.cpp index 70372a2f0d..5137944b00 100644 --- a/plugins/AVS/main.cpp +++ b/plugins/AVS/main.cpp @@ -2180,17 +2180,17 @@ static int OptInit(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("Protocols");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PICTS);
odp.pfnDlgProc = DlgProcOptionsProtos;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Contact Avatars");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_AVATARS);
odp.pfnDlgProc = DlgProcOptionsAvatars;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Own Avatars");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_OWN);
odp.pfnDlgProc = DlgProcOptionsOwn;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -2383,7 +2383,7 @@ static int OnDetailsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcAvatarProtoInfo;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROTO_AVATARS);
odp.ptszTitle = LPGENT("Avatar");
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
else
{
@@ -2400,7 +2400,7 @@ static int OnDetailsInit(WPARAM wParam, LPARAM lParam) odp.position = -2000000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_USER_AVATAR);
odp.ptszTitle = LPGENT("Avatar");
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
}
return 0;
diff --git a/plugins/Alarms/options.cpp b/plugins/Alarms/options.cpp index 9f2b9d1222..8d88a7004d 100644 --- a/plugins/Alarms/options.cpp +++ b/plugins/Alarms/options.cpp @@ -1156,7 +1156,7 @@ int OptInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS;
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOpts;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/AssocMgr/assoclist.cpp b/plugins/AssocMgr/assoclist.cpp index 4cedcb519c..761aa9f05d 100644 --- a/plugins/AssocMgr/assoclist.cpp +++ b/plugins/AssocMgr/assoclist.cpp @@ -980,7 +980,7 @@ static int AssocListOptInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle = _T("Associations"); /* autotranslated */
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY|ODPF_TCHAR;
odp.pfnDlgProc = AssocListOptDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/AuthState/options.cpp b/plugins/AuthState/options.cpp index 37dbdca812..cc3e2d8934 100644 --- a/plugins/AuthState/options.cpp +++ b/plugins/AuthState/options.cpp @@ -148,7 +148,7 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.ptszTitle = _T("Auth State");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/AutoRun/main.c b/plugins/AutoRun/main.c index 84745d3b11..696027f1d8 100644 --- a/plugins/AutoRun/main.c +++ b/plugins/AutoRun/main.c @@ -138,7 +138,7 @@ static int AutorunOptInitialise(WPARAM wParam,LPARAM lParam) odp.pszGroup=Translate("Plugins");
odp.pfnDlgProc=DlgProcAutorunOpts;
odp.flags=ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
//==========================================================================
diff --git a/plugins/BASS_interface/Main.cpp b/plugins/BASS_interface/Main.cpp index 4a5cdfbf03..2c45df6ab3 100644 --- a/plugins/BASS_interface/Main.cpp +++ b/plugins/BASS_interface/Main.cpp @@ -350,7 +350,7 @@ int OptionsInit(WPARAM wParam, LPARAM lParam) odp.ptszGroup = _T("Customize");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/BasicHistory/Options.cpp b/plugins/BasicHistory/Options.cpp index 86abbf88c1..bcc4f424ad 100644 --- a/plugins/BasicHistory/Options.cpp +++ b/plugins/BasicHistory/Options.cpp @@ -130,32 +130,32 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("Group list");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GROUPLIST);
odp.pfnDlgProc = Options::DlgProcOptsGroupList;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Messages");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MESSAGES);
odp.pfnDlgProc = Options::DlgProcOptsMessages;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Searching");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SEARCHING);
odp.pfnDlgProc = Options::DlgProcOptsSearching;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Export");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXPORT);
odp.pfnDlgProc = Options::DlgProcOptsExport;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Scheduler");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SCHEDULER);
odp.pfnDlgProc = Options::DlgProcOptsScheduler;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN);
odp.pfnDlgProc = Options::DlgProcOptsMain;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Boltun/boltun.cpp b/plugins/Boltun/boltun.cpp index 9d7d9b6fb5..6efebc906f 100644 --- a/plugins/Boltun/boltun.cpp +++ b/plugins/Boltun/boltun.cpp @@ -528,11 +528,11 @@ static int MessageOptInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = MainDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN);
odp.pszTab = TAB_GENERAL;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.pfnDlgProc = EngineDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_ENGINE);
odp.pszTab = TAB_ENGINE;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Bonsai/hooked_events.cpp b/plugins/Bonsai/hooked_events.cpp index ba1ee85d91..2c32516c83 100644 --- a/plugins/Bonsai/hooked_events.cpp +++ b/plugins/Bonsai/hooked_events.cpp @@ -86,7 +86,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.groupPosition = 810000000;
odp.flags=ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgProcOptions;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/BossKeyPlus/Options.cpp b/plugins/BossKeyPlus/Options.cpp index 0f83079593..7d5b103450 100644 --- a/plugins/BossKeyPlus/Options.cpp +++ b/plugins/BossKeyPlus/Options.cpp @@ -405,13 +405,13 @@ int OptsDlgInit(WPARAM wParam,LPARAM lParam) optDi.ptszTab = _T("Main");
optDi.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
optDi.flags |= ODPF_EXPERTONLY;
optDi.pfnDlgProc = AdvOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGADV);
optDi.ptszTab = _T("Advanced");
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
return(0);
}
diff --git a/plugins/BuddyExpectator/options.cpp b/plugins/BuddyExpectator/options.cpp index 84b9eef9e2..fa0af1b535 100644 --- a/plugins/BuddyExpectator/options.cpp +++ b/plugins/BuddyExpectator/options.cpp @@ -498,14 +498,14 @@ static int OptionsInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = Translate("Buddy Expectator");
odp.pfnDlgProc = OptionsFrameProc;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUP))
{
odp.pszGroup = Translate("PopUps");
odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUPPANEL);
odp.pfnDlgProc = PopUpOptionsFrameProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
@@ -609,7 +609,7 @@ int UserinfoInit(WPARAM wparam, LPARAM lparam) uip.pszTitle = Translate("Buddy Expectator");
uip.pfnDlgProc = UserinfoDlgProc;
- CallService(MS_USERINFO_ADDPAGE, wparam, (LPARAM)&uip);
+ UserInfo_AddPage(wparam, &uip);
}
return 0;
}
diff --git a/plugins/CSList/cslist.cpp b/plugins/CSList/cslist.cpp index edb87b0175..c842881603 100644 --- a/plugins/CSList/cslist.cpp +++ b/plugins/CSList/cslist.cpp @@ -200,7 +200,7 @@ int CSList::initOptions( WPARAM wparam, LPARAM lparam ) odp.pfnDlgProc = ( DLGPROC )CSOptionsProc;
odp.ptszGroup = _T("Status");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService( MS_OPT_ADDPAGE, wparam, ( LPARAM )&odp );
+ Options_AddPage(wparam, &odp);
return FALSE;
}
diff --git a/plugins/ChangeKeyboardLayout/commonheaders.h b/plugins/ChangeKeyboardLayout/commonheaders.h index 8eb8f3671e..e7d8c78283 100644 --- a/plugins/ChangeKeyboardLayout/commonheaders.h +++ b/plugins/ChangeKeyboardLayout/commonheaders.h @@ -94,7 +94,6 @@ typedef struct } PopupOptions;
PLUGININFOEX pluginInfoEx;
-PLUGININFO pluginInfo;
HINSTANCE hInst;
diff --git a/plugins/ChangeKeyboardLayout/hook_events.c b/plugins/ChangeKeyboardLayout/hook_events.c index 4afad800d1..b3e97159f0 100644 --- a/plugins/ChangeKeyboardLayout/hook_events.c +++ b/plugins/ChangeKeyboardLayout/hook_events.c @@ -199,19 +199,8 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) }
OnIconsChanged(0, 0);
RegPopupActions();
-
- //Ïîääåðæêà Àïäåéòåðà
- if(ServiceExists(MS_UPDATE_REGISTERFL))
- {
-
- CallService(MS_UPDATE_REGISTERFL, (WPARAM)3632, (LPARAM)&pluginInfo);
-
- }
-
DBWriteContactSettingDword(NULL, ModuleName, "CurrentVer", VERSION);
-
-
return 0;
}
@@ -226,7 +215,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.pszGroup = Translate("Plugins");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgMainProcOptions;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUP))
{
@@ -238,7 +227,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.pszGroup = Translate("PopUps");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgPopupsProcOptions;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
}
diff --git a/plugins/Chat/options.c b/plugins/Chat/options.c index 54d1f30f39..73f1bc364b 100644 --- a/plugins/Chat/options.c +++ b/plugins/Chat/options.c @@ -937,13 +937,13 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.pszTab = LPGEN("General");
odp.pfnDlgProc = DlgProcOptions1;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.position = 910000001;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
odp.pszTab = LPGEN("Chat Log");
odp.pfnDlgProc = DlgProcOptions2;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
if (PopUpInstalled) {
odp.position = 910000002;
@@ -952,7 +952,7 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.pszGroup = LPGEN("Popups");
odp.pszTab = NULL;
odp.pfnDlgProc = DlgProcOptionsPopup;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
}
diff --git a/plugins/ClientChangeNotify/OptDlg.cpp b/plugins/ClientChangeNotify/OptDlg.cpp index 95224fb672..164e51e795 100644 --- a/plugins/ClientChangeNotify/OptDlg.cpp +++ b/plugins/ClientChangeNotify/OptDlg.cpp @@ -183,7 +183,7 @@ int OptionsDlgInit(WPARAM wParam, LPARAM lParam) optDi.hInstance = g_hInstance;
optDi.ptszGroup = LPGENT("PopUps");
optDi.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
return 0;
}
diff --git a/plugins/Clist/clcopts.c b/plugins/Clist/clcopts.c index 7e1fc9d3d9..51f9c8a08b 100644 --- a/plugins/Clist/clcopts.c +++ b/plugins/Clist/clcopts.c @@ -441,13 +441,13 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("List");
odp.pfnDlgProc = DlgProcClcMainOpts;
odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG);
odp.pszTitle = LPGEN("List Background");
odp.pfnDlgProc = DlgProcClcBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Clist/clistopts.c b/plugins/Clist/clistopts.c index 7aef5c297a..33e880e3fc 100644 --- a/plugins/Clist/clistopts.c +++ b/plugins/Clist/clistopts.c @@ -249,7 +249,7 @@ int CListOptInit(WPARAM wParam, LPARAM lParam) odp.nIDBottomSimpleControl = IDC_STCLISTGROUP;
odp.expertOnlyControls = expertOnlyControls;
odp.nExpertOnlyControls = SIZEOF(expertOnlyControls);
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Clist/cluiopts.c b/plugins/Clist/cluiopts.c index c101f0db8b..2094716a07 100644 --- a/plugins/Clist/cluiopts.c +++ b/plugins/Clist/cluiopts.c @@ -351,7 +351,7 @@ int CluiOptInit(WPARAM wParam, LPARAM lParam) odp.nIDBottomSimpleControl = IDC_STWINDOWGROUP;
odp.expertOnlyControls = expertOnlyControls;
odp.nExpertOnlyControls = SIZEOF(expertOnlyControls);
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR);
odp.pszTitle = LPGEN("Status Bar");
@@ -360,7 +360,7 @@ int CluiOptInit(WPARAM wParam, LPARAM lParam) odp.nIDBottomSimpleControl = 0;
odp.nExpertOnlyControls = 0;
odp.expertOnlyControls = NULL;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Clist_modern/modern_clcopts.cpp b/plugins/Clist_modern/modern_clcopts.cpp index 91b3f15bf8..1fcf7dbb0b 100644 --- a/plugins/Clist_modern/modern_clcopts.cpp +++ b/plugins/Clist_modern/modern_clcopts.cpp @@ -286,7 +286,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.ptszTitle=LPGENT("Contact List");
odp.pfnDlgProc=DlgProcClistListOpts;
odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR;
- //CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ //Options_AddPage(wParam,&odp);
{
int i;
for (i=0; clist_opt_items[i].id!=0; i++)
@@ -297,7 +297,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR|clist_opt_items[i].flag;
odp.expertOnlyControls = clist_opt_items[i].expertControls;
odp.nExpertOnlyControls = clist_opt_items[i].nExpertControls;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
}
@@ -309,7 +309,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("List Background");
odp.pfnDlgProc = DlgProcClcBkgOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/plugins/Clist_modern/modern_clistopts.cpp b/plugins/Clist_modern/modern_clistopts.cpp index 07092018a0..73c7c8c7e7 100644 --- a/plugins/Clist_modern/modern_clistopts.cpp +++ b/plugins/Clist_modern/modern_clistopts.cpp @@ -72,7 +72,7 @@ int CListOptInit(WPARAM wParam,LPARAM lParam) odp.ptszGroup=LPGENT("Contact List");
odp.ptszTitle=LPGENT("Row items");
odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR;
- // CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ // Options_AddPage(wParam,&odp);
{
BOOL hasExtraIconsService = ServiceExists("ExtraIcon/Register");
@@ -85,7 +85,7 @@ int CListOptInit(WPARAM wParam,LPARAM lParam) odp.pszTemplate=MAKEINTRESOURCEA(row_opt_items[i].id);
odp.ptszTab=row_opt_items[i].name;
odp.pfnDlgProc=row_opt_items[i].wnd_proc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
}
diff --git a/plugins/Clist_modern/modern_skinopt.cpp b/plugins/Clist_modern/modern_skinopt.cpp index adbbc6a895..021691db9f 100644 --- a/plugins/Clist_modern/modern_skinopt.cpp +++ b/plugins/Clist_modern/modern_skinopt.cpp @@ -65,7 +65,7 @@ int SkinOptInit( WPARAM wParam, LPARAM lParam ) odp.ptszTitle = LPGENT( "Contact List" );
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
odp.ptszTab = LPGENT( "Load/Save" );
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
if ( ModernGetSettingByte( NULL, "ModernData", "EnableSkinEditor", SETTING_ENABLESKINEDITOR_DEFAULT ) )
{
@@ -73,7 +73,7 @@ int SkinOptInit( WPARAM wParam, LPARAM lParam ) odp.pfnDlgProc = DlgSkinEditorOpts;
odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_SKINEDITOR );
odp.ptszTab = LPGENT( "Object Editor" );
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
}
}
return 0;
diff --git a/plugins/Clist_modern/modern_toolbar.cpp b/plugins/Clist_modern/modern_toolbar.cpp index 2c59d750f0..0c3e9e868b 100644 --- a/plugins/Clist_modern/modern_toolbar.cpp +++ b/plugins/Clist_modern/modern_toolbar.cpp @@ -298,7 +298,7 @@ static int ehhToolbarOptInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle=LPGENT("ToolBar");
odp.pfnDlgProc=(DLGPROC)ToolBar_OptDlgProc;
odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
static INT_PTR svcToolBarAddButton(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Clist_mw/BkgrCfg.cpp b/plugins/Clist_mw/BkgrCfg.cpp index c24974ccc7..b08a833aca 100644 --- a/plugins/Clist_mw/BkgrCfg.cpp +++ b/plugins/Clist_mw/BkgrCfg.cpp @@ -291,7 +291,7 @@ int OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/Clist_mw/clcopts.cpp b/plugins/Clist_mw/clcopts.cpp index 32de8b13f6..f7567594b1 100644 --- a/plugins/Clist_mw/clcopts.cpp +++ b/plugins/Clist_mw/clcopts.cpp @@ -59,20 +59,20 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.pszTitle = LPGEN("List");
odp.pfnDlgProc = DlgProcClcMainOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG);
odp.pszTitle = LPGEN("List Background");
odp.pfnDlgProc = DlgProcClcBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_META_CLC);
odp.pszTitle = LPGEN("List MetaContacts");
odp.pfnDlgProc = DlgProcClcMetaOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER))
{
@@ -80,7 +80,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.pszTitle = LPGEN("StatusBar Background");
odp.pfnDlgProc = DlgProcStatusBarBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
return 0;
diff --git a/plugins/Clist_mw/clistopts.cpp b/plugins/Clist_mw/clistopts.cpp index 947d68da69..508a356d45 100644 --- a/plugins/Clist_mw/clistopts.cpp +++ b/plugins/Clist_mw/clistopts.cpp @@ -48,7 +48,7 @@ int CListOptInit(WPARAM wParam,LPARAM lParam) odp.nIDBottomSimpleControl = IDC_STCLISTGROUP;
odp.expertOnlyControls = expertOnlyControls;
odp.nExpertOnlyControls = sizeof(expertOnlyControls)/sizeof(expertOnlyControls[0]);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/Clist_mw/cluiopts.cpp b/plugins/Clist_mw/cluiopts.cpp index 33fc3abaf4..27c7a1defe 100644 --- a/plugins/Clist_mw/cluiopts.cpp +++ b/plugins/Clist_mw/cluiopts.cpp @@ -50,7 +50,7 @@ int CluiOptInit(WPARAM wParam,LPARAM lParam) odp.nIDBottomSimpleControl = IDC_STWINDOWGROUP;
odp.expertOnlyControls = expertOnlyControls;
odp.nExpertOnlyControls = sizeof(expertOnlyControls)/sizeof(expertOnlyControls[0]);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR);
odp.pszTitle = LPGEN("Status Bar");
odp.pfnDlgProc = DlgProcSBarOpts;
@@ -58,7 +58,7 @@ int CluiOptInit(WPARAM wParam,LPARAM lParam) odp.nIDBottomSimpleControl = 0;
odp.nExpertOnlyControls = 0;
odp.expertOnlyControls = NULL;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/Clist_nicer/SRC/clcopts.cpp b/plugins/Clist_nicer/SRC/clcopts.cpp index 0b59425f65..3a243e6084 100644 --- a/plugins/Clist_nicer/SRC/clcopts.cpp +++ b/plugins/Clist_nicer/SRC/clcopts.cpp @@ -1421,20 +1421,20 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Contact rows");
odp.pfnDlgProc = DlgProcDspProfiles;
odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FLOATING);
odp.pszTitle = LPGEN("Floating contacts");
odp.pfnDlgProc = DlgProcFloatingContacts;
odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.pszGroup = LPGEN("Skins");
odp.pszTitle = LPGEN("Contact list");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = OptionsDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.position = -1000000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSDIALOG);
@@ -1443,7 +1443,7 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = TabOptionsDlgProc;
odp.flags = ODPF_BOLDGROUPS;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Clist_nicer/SRC/clui.cpp b/plugins/Clist_nicer/SRC/clui.cpp index ed0c228011..03b9f7ab97 100644 --- a/plugins/Clist_nicer/SRC/clui.cpp +++ b/plugins/Clist_nicer/SRC/clui.cpp @@ -106,6 +106,34 @@ static HBITMAP hbmLockedPoint = 0, hbmOldLockedPoint = 0; HICON overlayicons[10];
+struct {
+ HICON hIcon, hAltIcon;
+ UINT idIcon, idAltIcon;
+ char *szIcoLibIcon, *szIcoLibAltIcon;
+ DWORD visibilityOrder;
+ TCHAR *szTooltip;
+}
+static top_buttons[] =
+{
+ { 0, 0, IDI_TBTOPMENU, 0, "CLN_topmenu", NULL, 1, LPGENT("Show menu") },
+ { 0, 0, IDI_HIDEOFFLINE, 0, "CLN_online", NULL, 2, LPGENT("Show / hide offline contacts") },
+ { 0, 0, IDI_HIDEGROUPS, 0, "CLN_groups", NULL, 4, LPGENT("Toggle group mode") },
+ { 0, 0, IDI_FINDANDADD, 0, "CLN_findadd", NULL, 8, LPGENT("Find and add contacts") },
+ { 0, 0, IDI_TBACCOUNTS, 0, "CLN_accounts", NULL, 8192, LPGENT("Accounts") },
+ { 0, 0, IDI_TBOPTIONS, 0, "CLN_options", NULL, 16, LPGENT("Open preferences") },
+ { 0, 0, IDI_SOUNDSON, IDI_SOUNDSOFF, "CLN_sound", "CLN_soundsoff", 32, LPGENT("Toggle sounds") },
+ { 0, 0, IDI_MINIMIZE, 0, "CLN_minimize", NULL, 64, LPGENT("Minimize contact list") },
+ { 0, 0, 0, 0, "CLN_topstatus", NULL, 128, LPGENT("Status menu") },
+ { 0, 0, IDI_TABSRMMSESSIONLIST, 0, "CLN_slist", NULL, 256, LPGENT("tabSRMM session list") },
+ { 0, 0, IDI_TABSRMMMENU, 0, "CLN_menu", NULL, 512, LPGENT("tabSRMM Menu") },
+
+ { 0, 0, IDI_CLVM_SELECT, 0, "CLN_CLVM_select", NULL, 1024, LPGENT("Select view mode") },
+ { 0, 0, IDI_CLVM_OPTIONS, 0, "CLN_CLVM_options", NULL, 2048, LPGENT("Setup view modes") },
+ { 0, 0, IDI_DELETE, 0, "CLN_CLVM_reset", NULL, 4096, LPGENT("Clear view mode") },
+
+ { 0, 0, IDI_MINIMIZE, 0, "", NULL, 0, LPGENT("Open main menu") }
+};
+
HWND hTbMenu, hTbGlobalStatus;
/*
diff --git a/plugins/Console/Console.c b/plugins/Console/Console.c index 877dc28c30..54bc0af80f 100644 --- a/plugins/Console/Console.c +++ b/plugins/Console/Console.c @@ -1196,7 +1196,7 @@ static int OptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = OptDlgProc;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.expertOnlyControls = NULL;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/CountryFlags/extraimg.c b/plugins/CountryFlags/extraimg.c index 8484da05d1..43f2930848 100644 --- a/plugins/CountryFlags/extraimg.c +++ b/plugins/CountryFlags/extraimg.c @@ -388,7 +388,7 @@ static int ExtraImgOptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc=ExtraImgOptDlgProc;
odp.expertOnlyControls=expertOnlyControls;
odp.nExpertOnlyControls=SIZEOF(expertOnlyControls);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/Db_autobackups/options.c b/plugins/Db_autobackups/options.c index acb6072718..06051a940a 100644 --- a/plugins/Db_autobackups/options.c +++ b/plugins/Db_autobackups/options.c @@ -354,7 +354,7 @@ int OptionsInit(WPARAM wParam, LPARAM lParam) odp.ptszGroup = LPGENT("Services");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcOptions;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Dbx_mmap_SA/dialogs.c b/plugins/Dbx_mmap_SA/dialogs.c index eda06729d6..26c15790c6 100644 --- a/plugins/Dbx_mmap_SA/dialogs.c +++ b/plugins/Dbx_mmap_SA/dialogs.c @@ -59,7 +59,7 @@ static int OptionsInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle = TranslateT("Database Features");
odp.ptszGroup = TranslateT("Services");
odp.pfnDlgProc = DlgProcOptions;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/ExternalAPI/m_updater.h b/plugins/ExternalAPI/m_updater.h index 488d3722ce..9f6a92b5e2 100644 --- a/plugins/ExternalAPI/m_updater.h +++ b/plugins/ExternalAPI/m_updater.h @@ -59,10 +59,6 @@ __inline static char *CreateVersionString(DWORD version, char *buf) { return buf;
}
-__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) {
- return CreateVersionString(pluginInfo->version, buf);
-}
-
__inline static char *CreateVersionStringPluginEx(PLUGININFOEX *pluginInfo, char *buf) {
return CreateVersionString(pluginInfo->version, buf);
}
diff --git a/plugins/ExtraIcons/extraicons.cpp b/plugins/ExtraIcons/extraicons.cpp index ea3f803a32..8479bccdbd 100644 --- a/plugins/ExtraIcons/extraicons.cpp +++ b/plugins/ExtraIcons/extraicons.cpp @@ -155,7 +155,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) upd.cpbBetaVersionPrefix = (int)strlen((char *) upd.pbBetaVersionPrefix);
upd.szBetaUpdateURL = "http://pescuma.org/miranda/extraicons.zip";
- upd.pbVersion = (BYTE *) CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion);
+ upd.pbVersion = (BYTE *) CreateVersionStringPluginEx((PLUGININFOEX*) &pluginInfo, szCurrentVersion);
upd.cpbVersion = (int)strlen((char *) upd.pbVersion);
CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd);
diff --git a/plugins/ExtraIcons/options.cpp b/plugins/ExtraIcons/options.cpp index 1d325d0e87..a47450a7fe 100644 --- a/plugins/ExtraIcons/options.cpp +++ b/plugins/ExtraIcons/options.cpp @@ -44,7 +44,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = OptionsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 77711caee3..0fb5757e54 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -297,7 +297,7 @@ int ProcessOptInitialise(WPARAM wParam, LPARAM lParam) odp.groupPosition = 910000000;
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
odp.pfnDlgProc = OptionsDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/FingerPrintModPlus/src/fingerprint.cpp b/plugins/FingerPrintModPlus/src/fingerprint.cpp index 429e9defb6..7ef43072b5 100644 --- a/plugins/FingerPrintModPlus/src/fingerprint.cpp +++ b/plugins/FingerPrintModPlus/src/fingerprint.cpp @@ -949,7 +949,7 @@ int OnOptInitialise(WPARAM wParam, LPARAM lParam) odp.ptszTitle = LPGENT("Fingerprint");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/FloatingContacts/options.cpp b/plugins/FloatingContacts/options.cpp index f4c2c6371c..2779b22804 100644 --- a/plugins/FloatingContacts/options.cpp +++ b/plugins/FloatingContacts/options.cpp @@ -114,7 +114,7 @@ OnOptionsInitialize odp.ptszTab = _T("Main Features");
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
odp.pfnDlgProc = (DLGPROC)OptWndProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
ZeroMemory(&odp, sizeof(odp));
odp.cbSize = sizeof(odp);
@@ -125,7 +125,7 @@ OnOptionsInitialize odp.ptszTab = _T("Appearance");
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
odp.pfnDlgProc = (DLGPROC)OptSknWndProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Folders/hooked_events.cpp b/plugins/Folders/hooked_events.cpp index 78439bb3da..20ba19d4ec 100644 --- a/plugins/Folders/hooked_events.cpp +++ b/plugins/Folders/hooked_events.cpp @@ -80,7 +80,7 @@ int OnOptionsInitialize(WPARAM wParam, LPARAM lParam) odp.groupPosition = 910000000;
odp.flags=ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgProcOpts;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/Gender/options.cpp b/plugins/Gender/options.cpp index 32d919c020..cc9ab8d59f 100644 --- a/plugins/Gender/options.cpp +++ b/plugins/Gender/options.cpp @@ -161,7 +161,7 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.ptszTitle = LPGENT("Gender");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/HistoryLinkListPlus/linklist.c b/plugins/HistoryLinkListPlus/linklist.c index d6e3462d7f..bcf72add92 100644 --- a/plugins/HistoryLinkListPlus/linklist.c +++ b/plugins/HistoryLinkListPlus/linklist.c @@ -174,7 +174,7 @@ int InitOptionsDlg(WPARAM wParam, LPARAM lParam) optionsDialog.expertOnlyControls = NULL;
optionsDialog.nExpertOnlyControls = 0;
optionsDialog.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optionsDialog);
+ Options_AddPage(wParam, (LPARAM)&optionsDialog);
return 0;
}
diff --git a/plugins/HistorySweeperLight/options.c b/plugins/HistorySweeperLight/options.c index eb32f12b83..601c768201 100644 --- a/plugins/HistorySweeperLight/options.c +++ b/plugins/HistorySweeperLight/options.c @@ -350,7 +350,7 @@ int HSOptInitialise(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcHSOpts;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/IEView/Options.cpp b/plugins/IEView/Options.cpp index 9ab5bfe63c..4c1948d60e 100644 --- a/plugins/IEView/Options.cpp +++ b/plugins/IEView/Options.cpp @@ -434,14 +434,14 @@ int IEViewOptInit(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(tabPages[0].dlgId);
odp.pfnDlgProc = tabPages[0].dlgProc;
odp.ptszTab = tabPages[0].tabName;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.ptszGroup = _T("Skins");
odp.ptszTitle = _T("IEView");
for (i = 1; i < SIZEOF(tabPages); i++) {
odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId);
odp.pfnDlgProc = tabPages[i].dlgProc;
odp.ptszTab = tabPages[i].tabName;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
}
diff --git a/plugins/IgnoreState/options.cpp b/plugins/IgnoreState/options.cpp index 685ad239b9..83ebefa587 100644 --- a/plugins/IgnoreState/options.cpp +++ b/plugins/IgnoreState/options.cpp @@ -275,7 +275,7 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_RATE_OPT);
odp.ptszTitle = _T(MODULENAME);
odp.pfnDlgProc = DlgProcOptions;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/KeyboardNotify/options.cpp b/plugins/KeyboardNotify/options.cpp index fe48da9162..c196a84ec3 100644 --- a/plugins/KeyboardNotify/options.cpp +++ b/plugins/KeyboardNotify/options.cpp @@ -176,7 +176,7 @@ int InitializeOptions(WPARAM wParam,LPARAM lParam) odp.flags=ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgProcOptions;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE,wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/LangMan/options.cpp b/plugins/LangMan/options.cpp index a0c6aa70e0..bd3d421726 100644 --- a/plugins/LangMan/options.cpp +++ b/plugins/LangMan/options.cpp @@ -658,7 +658,7 @@ static int LangOptInit(WPARAM wParam, LPARAM lParam) // odp.ptszTab = _T("Language"); /* autotranslated, can be made a tab */
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LANG);
odp.pfnDlgProc = LangOptDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/ListeningTo/options.cpp b/plugins/ListeningTo/options.cpp index 3c93cf9855..babbbe7ebd 100644 --- a/plugins/ListeningTo/options.cpp +++ b/plugins/ListeningTo/options.cpp @@ -93,19 +93,19 @@ int InitOptionsCallback(WPARAM wParam,LPARAM lParam) odp.expertOnlyControls = optionsExpertControls;
odp.nExpertOnlyControls = MAX_REGS(optionsExpertControls);
odp.nIDBottomSimpleControl = IDC_LISTENING_G;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = TranslateT("Format");
odp.pfnDlgProc = FormatDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_FORMAT);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = TranslateT("Players");
odp.pfnDlgProc = PlayersDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PLAYERS);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/MenuItemEx/options.c b/plugins/MenuItemEx/options.c index 6b3944d0c2..70626f64d6 100644 --- a/plugins/MenuItemEx/options.c +++ b/plugins/MenuItemEx/options.c @@ -132,6 +132,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.ptszGroup=_T("Customize");
odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
return 0;
}
diff --git a/plugins/MetaContacts/meta_services.c b/plugins/MetaContacts/meta_services.c index 92e503568d..e066ef8709 100644 --- a/plugins/MetaContacts/meta_services.c +++ b/plugins/MetaContacts/meta_services.c @@ -1859,21 +1859,21 @@ int Meta_OptInit(WPARAM wParam, LPARAM lParam) { odp.pszGroup = "Contact List";
odp.pszTab = "General";
odp.pfnDlgProc = DlgProcOpts;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCE(IDD_PRIORITIES);
odp.pszTitle = "MetaContacts";
odp.pszGroup = "Contact List";
odp.pszTab = "Priorities";
odp.pfnDlgProc = DlgProcOptsPriorities;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCE(IDD_HISTORY);
odp.pszTitle = "MetaContacts";
odp.pszGroup = "Contact List";
odp.pszTab = "History";
odp.pfnDlgProc = DlgProcOpts;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/NewAwaySysMod/AwayOpt.cpp b/plugins/NewAwaySysMod/AwayOpt.cpp index aa135f890d..dc8ed83d56 100644 --- a/plugins/NewAwaySysMod/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/AwayOpt.cpp @@ -1764,7 +1764,7 @@ int OptsDlgInit(WPARAM wParam, LPARAM lParam) optDi.pfnDlgProc = PopupOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPOPTDLG);
optDi.ptszGroup = OPT_POPUPGROUP;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
*/
// optDi.ptszTitle = OPT_TITLE;
optDi.ptszTitle = OPT_MAINGROUP;
@@ -1773,22 +1773,22 @@ int OptsDlgInit(WPARAM wParam, LPARAM lParam) optDi.pfnDlgProc = MessagesOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_MESSAGES);
optDi.ptszTab = LPGENT("Statuses messages");
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
optDi.pfnDlgProc = MoreOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_MOREOPTDIALOG);
optDi.ptszTab = LPGENT("Main options");
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
optDi.pfnDlgProc = AutoreplyOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_AUTOREPLY);
optDi.ptszTab = LPGENT("Autoreply");
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
optDi.pfnDlgProc = ContactsOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACTSOPTDLG);
optDi.ptszTab = LPGENT("Contacts");
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&optDi);
+ Options_AddPage(wParam, &optDi);
return 0;
}
@@ -1799,34 +1799,6 @@ COptPage g_MsgTreePage(MOD_NAME, NULL); void InitOptions()
{
InitThemes();
- /*g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_USEPOPUPS, DB_POPUPNOTIFY, DBVT_BYTE, POPUP_DEF_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Edit(IDC_POPUPOPTDLG_POPUPFORMAT, "PopupsFormat", AWAY_MSGDATA_MAX, POPUP_DEF_POPUP_FORMAT, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_POPUPPREVIEW, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_VARS, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_EXTRATEXT, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Combobox(IDC_POPUPOPTDLG_LCLICK_ACTION, "PopupLClickAction", DBVT_BYTE, POPUP_DEF_LCLICKACTION, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Combobox(IDC_POPUPOPTDLG_RCLICK_ACTION, "PopupRClickAction", DBVT_BYTE, POPUP_DEF_RCLICKACTION, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_LCLICK, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_RCLICK, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Colourpicker(IDC_POPUPOPTDLG_BGCOLOUR, "PopupBGColour", POPUP_DEF_POPUP_BGCOLOUR, IDC_POPUPOPTDLG_DEFBGCOLOUR));
- g_PopupOptPage.Items.AddElem(new COptItem_Colourpicker(IDC_POPUPOPTDLG_TEXTCOLOUR, "PopupTextColour", POPUP_DEF_POPUP_TEXTCOLOUR, IDC_POPUPOPTDLG_DEFTEXTCOLOUR));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_DEFBGCOLOUR, "UseDefBGColour", DBVT_BYTE, POPUP_DEF_USEDEFBGCOLOUR, 0, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_DEFTEXTCOLOUR, "UseDefTextColour", DBVT_BYTE, POPUP_DEF_USEDEFTEXTCOLOUR, 0, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_BGCOLOUR, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_TEXTCOLOUR, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_ONLNOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_ONL, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_AWAYNOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_AWAY, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_NANOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_NA, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_OCCNOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_OCC, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_DNDNOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_DND, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_FFCNOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_FFC, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_OTHERNOTIFY, "PopupNotify", DBVT_DWORD, POPUP_DEF_POPUPNOTIFYFLAGS, SF_OTHER, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_IntEdit(IDC_POPUPOPTDLG_POPUPDELAY, "PopupDelay", DBVT_WORD, true, POPUP_DEF_POPUPDELAY, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_SEC, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_DEFAULT, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Generic(IDC_POPUPOPTDLG_STATIC_INFINITE, IDC_POPUPOPTDLG_USEPOPUPS));
- g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_LOGONLYWITHPOPUP, "LogOnlyWithPopup", DBVT_BYTE, 0));*/
-
g_MessagesOptPage.Items.AddElem(new COptItem_Generic(IDC_MESSAGEDLG_VARS, IDC_MESSAGEDLG_MSGTREE));
g_MessagesOptPage.Items.AddElem(new COptItem_Generic(IDC_MESSAGEDLG_DEL));
g_MessagesOptPage.Items.AddElem(new COptItem_Generic(IDC_MESSAGEDLG_MSGTITLE));
diff --git a/plugins/NewXstatusNotify/indsnd.cpp b/plugins/NewXstatusNotify/indsnd.cpp index 1d5e06788a..27a8b9a02a 100644 --- a/plugins/NewXstatusNotify/indsnd.cpp +++ b/plugins/NewXstatusNotify/indsnd.cpp @@ -339,7 +339,7 @@ int UserInfoInitialise(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS);
odp.pszTitle = LPGEN("Status Notify");
odp.pfnDlgProc = DlgProcSoundUIPage;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/NewXstatusNotify/options.cpp b/plugins/NewXstatusNotify/options.cpp index 0bcf192351..193fb56884 100644 --- a/plugins/NewXstatusNotify/options.cpp +++ b/plugins/NewXstatusNotify/options.cpp @@ -1059,17 +1059,17 @@ int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("General");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENERAL);
odp.pfnDlgProc = DlgProcGeneralOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Filtering");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILTERS);
odp.pfnDlgProc = DlgProcFiltering;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Message log");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_XLOG);
odp.pfnDlgProc = DlgProcXLogOpts;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUP))
{
@@ -1078,17 +1078,17 @@ int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("General");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP);
odp.pfnDlgProc = DlgProcPopUpOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Extra status");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_XPOPUP);
odp.pfnDlgProc = DlgProcXPopupOpts;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Status message");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMPOPUP);
odp.pfnDlgProc = DlgProcSMPopupOpts;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/plugins/Nudge/options.cpp b/plugins/Nudge/options.cpp index 15bd1e224b..7d5f052c6d 100644 --- a/plugins/Nudge/options.cpp +++ b/plugins/Nudge/options.cpp @@ -20,14 +20,14 @@ int NudgeOptInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
// odp.nIDBottomSimpleControl = IDC_STMSNGROUP;
odp.pfnDlgProc = DlgProcNudgeOpt;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.position = -790000001;
odp.ptszTab = LPGENT("Window Shaking");
odp.pfnDlgProc = DlgProcShakeOpt;
odp.flags |= ODPF_EXPERTONLY;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SHAKE);
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index 04045a3293..8c0d236aba 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -469,14 +469,14 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.ptszGroup = _T("Events");
odp.ptszTitle = _T("Pack Updater");
odp.pfnDlgProc = UpdateNotifyOptsProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUP))
{
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.ptszGroup = _T("PopUps");
odp.ptszTitle = _T("Pack Updater");
odp.pfnDlgProc = DlgPopUpOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
return 0;
}
\ No newline at end of file diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index de8ae07f58..f24b89f7e5 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -144,40 +144,40 @@ static int OptionsInitialize(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("General");
odp.pfnDlgProc = DlgProcPopUpGeneral;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP_GENERAL);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Classes");
odp.pfnDlgProc = DlgProcOptsClasses;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFICATIONS);
- CallService( MS_OPT_ADDPAGE, wParam,(LPARAM)&odp );
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Actions");
odp.pfnDlgProc = DlgProcPopupActions;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ACTIONS);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Contacts");
odp.pfnDlgProc = DlgProcContactOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Advanced");
odp.pfnDlgProc = DlgProcPopUpAdvOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP_ADVANCED);
odp.flags |= ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszGroup = LPGENT("Skins");
odp.ptszTab = LPGENT(MODULNAME_PLU);
odp.pfnDlgProc = DlgProcPopSkinsOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN2);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
//Test page
//odp.ptszTab = LPGEN("General (old)");
//odp.pfnDlgProc = DlgProcPopUpOpts;
//odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_POPUP);
- //CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ //Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/QuickMessages/options.c b/plugins/QuickMessages/options.c index 833c546262..4e269f1273 100644 --- a/plugins/QuickMessages/options.c +++ b/plugins/QuickMessages/options.c @@ -1164,6 +1164,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszGroup=LPGEN("Plugins");
odp.flags=ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
return 0;
}
diff --git a/plugins/QuickReplies/options.cpp b/plugins/QuickReplies/options.cpp index 1c26b9c385..84ce88dc1c 100644 --- a/plugins/QuickReplies/options.cpp +++ b/plugins/QuickReplies/options.cpp @@ -205,7 +205,7 @@ int OnOptInitialized(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PAGE);
odp.pfnDlgProc = DlgProcOptionsPage;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/Rate/options.cpp b/plugins/Rate/options.cpp index 47714d6828..013945258f 100644 --- a/plugins/Rate/options.cpp +++ b/plugins/Rate/options.cpp @@ -218,7 +218,7 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTitle = Translate("Rate");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/RecentContacts/options.cpp b/plugins/RecentContacts/options.cpp index c7922b2609..264b813d72 100644 --- a/plugins/RecentContacts/options.cpp +++ b/plugins/RecentContacts/options.cpp @@ -68,7 +68,7 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTitle = Translate(msLastUC_ShowListName);
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/SRMM/msgoptions.c b/plugins/SRMM/msgoptions.c index 3542902fb4..feb91e8266 100644 --- a/plugins/SRMM/msgoptions.c +++ b/plugins/SRMM/msgoptions.c @@ -593,19 +593,19 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Message Sessions");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG);
odp.pszTab = LPGEN("Messaging Log");
odp.pfnDlgProc = DlgProcLogOptions;
odp.nIDBottomSimpleControl = IDC_STMSGLOGGROUP;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
odp.pszTab = LPGEN("Typing Notify");
odp.pfnDlgProc = DlgProcTypeOptions;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Scriver/chat/options.c b/plugins/Scriver/chat/options.c index e58e1e824a..11ea14a12d 100644 --- a/plugins/Scriver/chat/options.c +++ b/plugins/Scriver/chat/options.c @@ -793,7 +793,7 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcOptionsPopup;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.ptszTab = NULL;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/plugins/Scriver/msgoptions.c b/plugins/Scriver/msgoptions.c index 80358590f4..9dd1624540 100644 --- a/plugins/Scriver/msgoptions.c +++ b/plugins/Scriver/msgoptions.c @@ -1100,7 +1100,7 @@ int OptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId);
odp.pfnDlgProc = tabPages[i].dlgProc;
odp.pszTab = (char*)tabPages[i].tabName;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
}
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
@@ -1108,7 +1108,7 @@ int OptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Typing Notify");
odp.pfnDlgProc = DlgProcTypeOptions;
odp.pszTab = NULL;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/SecureIM/options.cpp b/plugins/SecureIM/options.cpp index 3f84c98b10..93689874a9 100644 --- a/plugins/SecureIM/options.cpp +++ b/plugins/SecureIM/options.cpp @@ -1921,7 +1921,7 @@ int onRegisterOptions(WPARAM wParam, LPARAM) { odp.pszTitle = (char*)szModuleName;
odp.pszGroup = LPGEN("Services");
odp.pfnDlgProc = OptionsDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/SecureIM/popupOptions.cpp b/plugins/SecureIM/popupOptions.cpp index 03776ea777..a295c8dac8 100644 --- a/plugins/SecureIM/popupOptions.cpp +++ b/plugins/SecureIM/popupOptions.cpp @@ -231,7 +231,7 @@ int onRegisterPopOptions(WPARAM wParam, LPARAM) { odp.pszTitle = (char*)szModuleName;
odp.pszGroup = Translate("Popups");
odp.pfnDlgProc = PopOptionsDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/SeenPlugin/options.c b/plugins/SeenPlugin/options.c index af3c4f20f8..fc39a64a63 100644 --- a/plugins/SeenPlugin/options.c +++ b/plugins/SeenPlugin/options.c @@ -484,14 +484,14 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszGroup="Services";
odp.pszTitle="Last seen";
odp.pfnDlgProc= OptsSettingsDlgProc;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
if (ServiceExists(MS_POPUP_ADDPOPUP))
{
odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUPS);
odp.pszGroup = "PopUps";
odp.pszTitle = "Last seen";
odp.pfnDlgProc = OptsPopUpsDlgProc;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
}
return 0;
}
diff --git a/plugins/SeenPlugin/userinfo.c b/plugins/SeenPlugin/userinfo.c index bf23679ba9..442860bb86 100644 --- a/plugins/SeenPlugin/userinfo.c +++ b/plugins/SeenPlugin/userinfo.c @@ -89,7 +89,7 @@ int UserinfoInit(WPARAM wparam,LPARAM lparam) uip.pszTemplate=MAKEINTRESOURCE(IDD_USERINFO);
uip.pszTitle="Last seen";
uip.pfnDlgProc=UserinfoDlgProc;
- CallService(MS_USERINFO_ADDPAGE,wparam,(LPARAM)&uip);
+ UserInfo_AddPage(wparam, &uip);
}
return 0;
}
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index b52e2d92d7..ccdf23c1ff 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -567,6 +567,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.ptszGroup=LPGENT("Message Sessions");
odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/SimpleAR/Src/Options.cpp b/plugins/SimpleAR/Src/Options.cpp index 1f91c39220..78e4161a86 100644 --- a/plugins/SimpleAR/Src/Options.cpp +++ b/plugins/SimpleAR/Src/Options.cpp @@ -158,6 +158,6 @@ INT OptInit(WPARAM wParam,LPARAM lParam) odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.nIDBottomSimpleControl=0;
odp.pfnDlgProc=DlgProcOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/SimpleStatusMsg/options.cpp b/plugins/SimpleStatusMsg/options.cpp index b67583776b..dac11ff175 100644 --- a/plugins/SimpleStatusMsg/options.cpp +++ b/plugins/SimpleStatusMsg/options.cpp @@ -1722,7 +1722,7 @@ int InitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_STATUS);
odp.pfnDlgProc = DlgStatusOptionsProc;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
if (accounts->statusMsgCount == 0)
@@ -1735,18 +1735,18 @@ int InitOptions(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("General");
odp.pfnDlgProc = DlgOptionsProc;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Variables");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VARIABLES);
odp.pfnDlgProc = DlgVariablesOptionsProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADVANCED);
odp.pfnDlgProc = DlgAdvancedOptionsProc;
odp.flags |= ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/SmileyAdd/options.cpp b/plugins/SmileyAdd/options.cpp index e2b63f3be9..b540b15b35 100644 --- a/plugins/SmileyAdd/options.cpp +++ b/plugins/SmileyAdd/options.cpp @@ -73,7 +73,7 @@ int SmileysOptionsInitialize(WPARAM addInfo, LPARAM) odp.pszGroup = "Customize";
odp.pfnDlgProc = DlgProcSmileysOptions;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, addInfo, (LPARAM)&odp);
+ Options_AddPage( addInfo, &odp);
return 0;
}
diff --git a/plugins/SpellChecker/options.cpp b/plugins/SpellChecker/options.cpp index cf9f6c3058..015cfc893c 100644 --- a/plugins/SpellChecker/options.cpp +++ b/plugins/SpellChecker/options.cpp @@ -78,7 +78,7 @@ int InitOptionsCallback(WPARAM wParam,LPARAM lParam) odp.nIDBottomSimpleControl = IDC_SPELL_CHECKER;
odp.expertOnlyControls = optionsExpertControls;
odp.nExpertOnlyControls = MAX_REGS(optionsExpertControls);
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
ZeroMemory(&odp,sizeof(odp));
odp.cbSize=sizeof(odp);
@@ -89,7 +89,7 @@ int InitOptionsCallback(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = AutoreplaceDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_REPLACEMENTS);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index b400eca26d..1ed7c5e9e8 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -443,6 +443,6 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle = _T("Splash Screen");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index 7266bf5aaa..29b17ac44c 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -548,6 +548,6 @@ int AutoAwayOptInitialise(WPARAM wParam,LPARAM lParam) odp.pszGroup = LPGEN("Status");
odp.pfnDlgProc = DlgProcAutoAwayTabs;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, (LPARAM)&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index b434f592ca..ba6cf472d5 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -590,7 +590,7 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS);
odp.pfnDlgProc = DlgProcKsTabs;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
if ( ServiceExists( MS_POPUP_ADDPOPUP )) {
ZeroMemory(&odp,sizeof(odp));
@@ -603,7 +603,7 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszTitle = LPGEN("KeepStatus");
odp.pfnDlgProc = PopupOptDlgProc;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
}
return 0;
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 992fe13701..9227ae7f62 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -938,12 +938,12 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszTab = LPGEN("General");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_STARTUPSTATUS);
odp.pfnDlgProc = StartupStatusOptDlgProc;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
odp.pszTab = LPGEN("Status Profiles");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_STATUSPROFILES);
odp.pfnDlgProc = StatusProfilesOptDlgProc;
- CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ Options_AddPage(wparam,&odp);
return 0;
}
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index f857560c8c..8a3ab3e92e 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -202,18 +202,18 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) odp.ptszTab = _T("Main");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN);
odp.pfnDlgProc = MainDlgProc;
- CallService(MS_OPT_ADDPAGE, w, (LPARAM)&odp);
+ Options_AddPage( w, &odp);
odp.ptszTab = _T("Messages");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MESSAGES);
odp.pfnDlgProc = MessagesDlgProc;
- CallService(MS_OPT_ADDPAGE, w, (LPARAM)&odp);
+ Options_AddPage( w, &odp);
odp.ptszTab = _T("Protocols");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROTO);
odp.pfnDlgProc = ProtoDlgProc;
- CallService(MS_OPT_ADDPAGE, w, (LPARAM)&odp);
+ Options_AddPage( w, &odp);
return 0;
}
diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index fb71d68807..919171c7f0 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -207,7 +207,7 @@ int OptionsInit(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Services");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgProcOptions;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Svc_crshdmp/dumper.cpp b/plugins/Svc_crshdmp/dumper.cpp index bce015016b..bae091a023 100644 --- a/plugins/Svc_crshdmp/dumper.cpp +++ b/plugins/Svc_crshdmp/dumper.cpp @@ -231,13 +231,13 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags) continue;
}
- PLUGININFO* pi = GetMirInfo(hModule);
+ PLUGININFOEX* pi = GetMirInfo(hModule);
if (pi != NULL)
{
TCHAR timebuf[30] = TEXT("");
GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30);
- bool ep = (size_t)pi->cbSize > sizeof(PLUGININFO);
+ bool ep = (size_t)pi->cbSize > sizeof(PLUGININFOEX);
const TCHAR *unica = (ep && ((PLUGININFOEX*)pi)->flags & 1) ? TEXT("|Unicode aware|") : TEXT("");
ListItem* lst = new ListItem;
@@ -702,7 +702,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA if (crashpos != 0)
{
HMODULE hModule = (HMODULE)Module.BaseOfImage;
- PLUGININFO *pi = GetMirInfo(hModule);
+ PLUGININFOEX *pi = GetMirInfo(hModule);
if (pi != NULL)
{
diff --git a/plugins/Svc_crshdmp/utils.cpp b/plugins/Svc_crshdmp/utils.cpp index e60893ecf5..d4dced7d70 100644 --- a/plugins/Svc_crshdmp/utils.cpp +++ b/plugins/Svc_crshdmp/utils.cpp @@ -360,14 +360,13 @@ void GetLastWriteTime(LPCTSTR fileName, LPTSTR lpszString, DWORD dwSize) GetLastWriteTime(&FindFileData.ftLastWriteTime, lpszString, dwSize);
}
+typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_Info) (DWORD mirandaVersion);
-typedef PLUGININFO * (__cdecl * Miranda_Plugin_Info) (DWORD mirandaVersion);
-
-PLUGININFO* GetMirInfo(HMODULE hModule)
+PLUGININFOEX* GetMirInfo(HMODULE hModule)
{
Miranda_Plugin_Info bpi = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfoEx");
- if (bpi == NULL) bpi = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfo");
- if (bpi == NULL) return NULL;
+ if (bpi == NULL)
+ return NULL;
return bpi(mirandaVersion);
}
diff --git a/plugins/Svc_crshdmp/utils.h b/plugins/Svc_crshdmp/utils.h index 6c03552db7..9089f57571 100644 --- a/plugins/Svc_crshdmp/utils.h +++ b/plugins/Svc_crshdmp/utils.h @@ -147,7 +147,7 @@ void StoreStringToClip(bkstring& buffer); void ShowMessage(int type, const TCHAR* format, ...);
bool IsPluginEnabled(TCHAR* filename);
-PLUGININFO* GetMirInfo(HMODULE hModule);
+PLUGININFOEX* GetMirInfo(HMODULE hModule);
const PLUGININFOEX* GetPluginInfoEx(void);
void CreateMiniDump (HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr);
diff --git a/plugins/Svc_dbepp/options.cpp b/plugins/Svc_dbepp/options.cpp index 741796ca25..b149e7f41f 100644 --- a/plugins/Svc_dbepp/options.cpp +++ b/plugins/Svc_dbepp/options.cpp @@ -92,7 +92,7 @@ INT OptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcOpts;
odp.flags = ODPF_BOLDGROUPS;
odp.expertOnlyControls=NULL;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/Svc_vi/hooked_events.cpp b/plugins/Svc_vi/hooked_events.cpp index 3a9dfa3ce2..7645bf83bc 100644 --- a/plugins/Svc_vi/hooked_events.cpp +++ b/plugins/Svc_vi/hooked_events.cpp @@ -91,7 +91,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.expertOnlyControls = uiExpertOnlyControls;
odp.nExpertOnlyControls = 2;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
\ No newline at end of file diff --git a/plugins/Svc_vi/utils.cpp b/plugins/Svc_vi/utils.cpp index 9a29b45fdf..9be552c8cc 100644 --- a/plugins/Svc_vi/utils.cpp +++ b/plugins/Svc_vi/utils.cpp @@ -237,26 +237,23 @@ PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *piSrc) else
pi->uuid = UUID_NULL;
- if (piSrc->cbSize >= sizeof(PLUGININFO)) {
- if(pi->author) pi->author = _strdup(pi->author);
- if(pi->authorEmail) pi->authorEmail = _strdup(pi->authorEmail);
- if(pi->copyright) pi->copyright = _strdup(pi->copyright);
- if(pi->description) pi->description = _strdup(pi->description);
- if(pi->homepage) pi->homepage = _strdup(pi->homepage);
- if(pi->shortName) pi->shortName = _strdup(pi->shortName);
- }
-
+ if (pi->author) pi->author = _strdup(pi->author);
+ if (pi->authorEmail) pi->authorEmail = _strdup(pi->authorEmail);
+ if (pi->copyright) pi->copyright = _strdup(pi->copyright);
+ if (pi->description) pi->description = _strdup(pi->description);
+ if (pi->homepage) pi->homepage = _strdup(pi->homepage);
+ if (pi->shortName) pi->shortName = _strdup(pi->shortName);
return pi;
}
void FreePluginInfo(PLUGININFOEX *pi)
{
- if(pi->author) free(pi->author);
- if(pi->authorEmail) free(pi->authorEmail);
- if(pi->copyright) free(pi->copyright);
- if(pi->description) free(pi->description);
- if(pi->homepage) free(pi->homepage);
- if(pi->shortName) free(pi->shortName);
+ if (pi->author) free(pi->author);
+ if (pi->authorEmail) free(pi->authorEmail);
+ if (pi->copyright) free(pi->copyright);
+ if (pi->description) free(pi->description);
+ if (pi->homepage) free(pi->homepage);
+ if (pi->shortName) free(pi->shortName);
free(pi);
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 4e0cbd275a..61279c2eb9 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1289,46 +1289,46 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) odp.nIDBottomSimpleControl = 0;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.ptszTab = TranslateT("General");
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = TranslateT("Tabs and layout");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABBEDMSG);
odp.pfnDlgProc = DlgProcTabbedOptions;
- CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = TranslateT("Containers");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTAINERS);
odp.pfnDlgProc = DlgProcContainerSettings;
- CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = TranslateT("Message log");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG);
odp.pfnDlgProc = DlgProcLogOptions;
- CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = TranslateT("Tool bar");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TOOLBAR);
odp.pfnDlgProc = DlgProcToolBar;
- CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = TranslateT("Advanced tweaks");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PLUS);
odp.pfnDlgProc = PlusOptionsProc;
- CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszGroup = LPGENT("Message Sessions");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
odp.ptszTitle = LPGENT("Typing Notify");
odp.pfnDlgProc = DlgProcTypeOptions;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP_OPT);
odp.ptszTitle = LPGENT("Event notifications");
odp.ptszGroup = LPGENT("PopUps");
odp.pfnDlgProc = DlgProcPopupOpts;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
@@ -1338,13 +1338,13 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcSkinOpts;
odp.nIDBottomSimpleControl = 0;
odp.ptszGroup = LPGENT("Skins");
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_TABCONFIG);
odp.ptszTab = TranslateT("Window layout tweaks");
odp.pfnDlgProc = DlgProcTabConfig;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
/* group chats */
@@ -1353,25 +1353,25 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) odp.ptszTitle = LPGENT("Group Chats");
odp.ptszTab = TranslateT("Settings");
odp.pfnDlgProc = DlgProcOptions1;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
odp.ptszTab = TranslateT("Log formatting");
odp.pfnDlgProc = DlgProcOptions2;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS3);
odp.ptszTab = TranslateT("Events and filters");
odp.pfnDlgProc = DlgProcOptions3;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS4);
odp.ptszTab = TranslateT("Highlighting");
odp.pfnDlgProc = CMUCHighlight::dlgProc;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 4a892a9390..f68973c42d 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -508,7 +508,7 @@ int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.groupPosition = 910000000;
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgProcOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
return 0;
}
diff --git a/plugins/TipperYM/options.cpp b/plugins/TipperYM/options.cpp index cf763bd861..29624e2b3a 100644 --- a/plugins/TipperYM/options.cpp +++ b/plugins/TipperYM/options.cpp @@ -2430,14 +2430,14 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.ptszGroup = LPGENT("Customize");
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOptsAppearance;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
odp.ptszTab = LPGENT("Tooltips");
odp.ptszGroup = LPGENT("Skins");
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOptsSkin;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTENT);
odp.ptszTab = LPGENT("Content");
@@ -2445,7 +2445,7 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.ptszGroup = LPGENT("Customize");
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOptsContent;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRAYTIP);
odp.ptszTab = LPGENT("Tray tooltip");
@@ -2454,14 +2454,14 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOptsTraytip;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXTRA);
odp.ptszTab = LPGENT("Extra");
odp.ptszTitle = LPGENT("Tooltips");
odp.ptszGroup = LPGENT("Customize");
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOptsExtra;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index d4864c96d5..88ab42b740 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -309,7 +309,7 @@ int CTooltipNotify::InitializeOptions(WPARAM wParam, LPARAM lParam) odp.groupPosition = 910000000;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = CTooltipNotify::OptionsDlgProcWrapper;
- ::CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ ::Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index f7161fa6ca..4d6ab5916d 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -511,7 +511,7 @@ int TTBOptInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("TTBBackground");
odp.pfnDlgProc = DlgProcTTBBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
odp.position = -1000000000;
@@ -520,6 +520,6 @@ int TTBOptInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Buttons");
odp.pfnDlgProc = ButOrderOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Updater/options.cpp b/plugins/Updater/options.cpp index 1c4545d76e..03acb47c00 100644 --- a/plugins/Updater/options.cpp +++ b/plugins/Updater/options.cpp @@ -384,7 +384,7 @@ int OptInit(WPARAM wParam,LPARAM lParam) odp.ptszGroup = LPGENT("Services");
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOpts1;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Updater/scan.cpp b/plugins/Updater/scan.cpp index ddae89dc43..2144f80fbc 100644 --- a/plugins/Updater/scan.cpp +++ b/plugins/Updater/scan.cpp @@ -1,7 +1,6 @@ #include "common.h"
#include "scan.h"
-typedef PLUGININFO * (__cdecl * Miranda_Plugin_Info) ( DWORD mirandaVersion );
typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_Info_Ex) ( DWORD mirandaVersion );
struct AlternateShortName
@@ -56,10 +55,9 @@ void ScanPlugins(FilenameMap *fn_map, UpdateList *update_list) TCHAR plugins_folder[MAX_PATH], dll_path[MAX_PATH];
TCHAR *dll_name;
- Miranda_Plugin_Info dll_info_func;
Miranda_Plugin_Info_Ex dll_info_func_ex;
DWORD mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
- PLUGININFO *pluginInfo;
+ PLUGININFOEX *pluginInfo;
GetRootDir(plugins_folder);
_tcscat(plugins_folder, _T("\\Plugins"));
@@ -92,9 +90,8 @@ void ScanPlugins(FilenameMap *fn_map, UpdateList *update_list) }
if (hModule)
{
- dll_info_func = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfo");
dll_info_func_ex = (Miranda_Plugin_Info_Ex)GetProcAddress(hModule, "MirandaPluginInfoEx");
- if ((dll_info_func_ex && (pluginInfo = (PLUGININFO *)dll_info_func_ex(mirandaVersion))) || (dll_info_func && (pluginInfo = dll_info_func(mirandaVersion))))
+ if (dll_info_func_ex && (pluginInfo = (PLUGININFOEX*)dll_info_func_ex(mirandaVersion)) != NULL)
{
// *** This is a dodgy and unfair hack...
// In order to disable new plugins that may be unintentionally installed with an update,
@@ -254,10 +251,9 @@ bool RearrangeDllsWorker(char *shortName, StrList &filenames, TCHAR *basedir) TCHAR file_path[MAX_PATH];
- Miranda_Plugin_Info dll_info_func;
Miranda_Plugin_Info_Ex dll_info_func_ex;
DWORD mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
- PLUGININFO *pluginInfo;
+ PLUGININFOEX *pluginInfo;
HMODULE hModule;
// add filemask
@@ -272,9 +268,8 @@ bool RearrangeDllsWorker(char *shortName, StrList &filenames, TCHAR *basedir) mir_sntprintf(file_path, SIZEOF(file_path), _T("%s\\%s"), basedir, findData.cFileName);
if (valDllName(findData.cFileName) && (hModule = LoadLibrary(file_path)))
{
- dll_info_func = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfo");
dll_info_func_ex = (Miranda_Plugin_Info_Ex)GetProcAddress(hModule, "MirandaPluginInfoEx");
- if ((dll_info_func_ex && (pluginInfo = (PLUGININFO *)dll_info_func_ex(mirandaVersion))) || (dll_info_func && (pluginInfo = dll_info_func(mirandaVersion))))
+ if (dll_info_func_ex && (pluginInfo = (PLUGININFOEX *)dll_info_func_ex(mirandaVersion)) != NULL)
{
bool found = !_stricmp(pluginInfo->shortName, shortName);
if (!found)
diff --git a/plugins/Updater/services.cpp b/plugins/Updater/services.cpp index 3b11ddf850..21aaa4552e 100644 --- a/plugins/Updater/services.cpp +++ b/plugins/Updater/services.cpp @@ -514,7 +514,7 @@ INT_PTR GetUpdateOptions(WPARAM wParam, LPARAM lParam) { return found ? 0 : 1;
}
-bool RegisterForFileListing(int file_id, PLUGININFO *pluginInfo, bool auto_register)
+bool RegisterForFileListing(int file_id, PLUGININFOEX *pluginInfo, bool auto_register)
{
return RegisterForFileListing(file_id, pluginInfo->shortName, pluginInfo->version, auto_register, MC_PLUGINS);
}
@@ -739,7 +739,7 @@ INT_PTR Register(WPARAM wParam, LPARAM lParam) { INT_PTR RegisterFL(WPARAM wParam, LPARAM lParam) {
int file_id = (INT_PTR)wParam;
- PLUGININFO *pluginInfo = (PLUGININFO *)lParam;
+ PLUGININFOEX *pluginInfo = (PLUGININFOEX *)lParam;
// remove registered plugin if already there
EnterCriticalSection(&list_cs);
diff --git a/plugins/Updater/services.h b/plugins/Updater/services.h index 0bbac4d94a..ce4a2dc574 100644 --- a/plugins/Updater/services.h +++ b/plugins/Updater/services.h @@ -68,7 +68,7 @@ INT_PTR EnumerateUpdates(WPARAM wParam, LPARAM lParam); ////////////////////////////
bool IsRegistered(int file_id);
-bool RegisterForFileListing(int file_id, PLUGININFO *pluginInfo, bool auto_register);
+bool RegisterForFileListing(int file_id, PLUGININFOEX *pluginInfo, bool auto_register);
bool RegisterForFileListing(int file_id, const char *fl_name, DWORD version, bool auto_register, const Category cat);
void InitServices();
diff --git a/plugins/UserInfoEx/classPsTree.cpp b/plugins/UserInfoEx/classPsTree.cpp index 55e4fbcd77..ac88130d17 100644 --- a/plugins/UserInfoEx/classPsTree.cpp +++ b/plugins/UserInfoEx/classPsTree.cpp @@ -134,26 +134,21 @@ INT CPsTree::AddDummyItem(LPCSTR pszGroup) if (mir_stricmp(pszGroup, TREE_ROOTITEM))
{
CPsHdr psh;
- OPTIONSDIALOGPAGE odp;
- INT rc;
-
psh._hContact = _pPs->hContact;
psh._pszProto = _pPs->pszProto;
psh._hImages = _hImages;
psh._pPages = _pItems;
psh._numPages = _numItems;
- ZeroMemory(&odp, sizeof(odp));
+ OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.hInstance = ghInst;
odp.flags = ODPF_TCHAR;
odp.ptszTitle = mir_utf8decodeT(pszGroup);
- rc = CallService(MS_USERINFO_ADDPAGE, (WPARAM)&psh, (LPARAM)&odp);
+ INT_PTR rc = UserInfo_AddPage((WPARAM)&psh, &odp);
mir_free(odp.ptszTitle);
-
- if (!rc)
- {
+ if (!rc) {
_pItems = psh._pPages;
_numItems = psh._numPages;
return _numItems - 1;
diff --git a/plugins/UserInfoEx/dlg_propsheet.cpp b/plugins/UserInfoEx/dlg_propsheet.cpp index cefb8e777e..0b9db512cd 100644 --- a/plugins/UserInfoEx/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/dlg_propsheet.cpp @@ -43,6 +43,8 @@ Last change by : $Author: ing.u.horn $ #include <m_protocols.h>
#include <m_icq.h>
+#define OPTIONPAGE_OLD_SIZE (offsetof(OPTIONSDIALOGPAGE, hLangpack))
+
#define UPDATEANIMFRAMES 20
// internal dialog message handler
@@ -389,13 +391,9 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) // check size of the handled structures
if (pPsh == NULL || odp == NULL || pPsh->_dwSize != sizeof(CPsHdr))
- {
return 1;
- }
- if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE) &&
- odp->cbSize != OPTIONPAGE_OLD_SIZE2 &&
- odp->cbSize != OPTIONPAGE_OLD_SIZE3)
- {
+
+ if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE) && odp->cbSize != OPTIONPAGE_OLD_SIZE) {
MsgErr(NULL, LPGENT("The Page to add has invalid size %d bytes!"), odp->cbSize);
return 1;
}
@@ -403,34 +401,28 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) // try to check whether the flag member is initialized or not
odp->flags = odp->flags > (ODPF_UNICODE|ODPF_BOLDGROUPS|ODPF_ICON|PSPF_PROTOPREPENDED) ? 0 : odp->flags;
- if (pPsh->_dwFlags & (PSF_PROTOPAGESONLY|PSF_PROTOPAGESONLY_INIT))
- {
+ if (pPsh->_dwFlags & (PSF_PROTOPAGESONLY|PSF_PROTOPAGESONLY_INIT)) {
BOOLEAN bIsUnicode = (odp->flags & ODPF_UNICODE) == ODPF_UNICODE;
TCHAR* ptszTitle = bIsUnicode ? mir_tstrdup(odp->ptszTitle) : mir_a2t(odp->pszTitle);
// avoid adding pages for a meta subcontact, which have been added for a metacontact.
- if (pPsh->_dwFlags & PSF_PROTOPAGESONLY)
- {
- if (pPsh->_ignore.getIndex(ptszTitle) != -1)
- {
+ if (pPsh->_dwFlags & PSF_PROTOPAGESONLY) {
+ if (pPsh->_ignore.getIndex(ptszTitle) != -1) {
mir_free(ptszTitle);
return 0;
}
}
// init ignore list with pages added by metacontact
else if (pPsh->_dwFlags & PSF_PROTOPAGESONLY_INIT)
- {
pPsh->_ignore.insert(mir_tstrdup(ptszTitle));
- }
+
mir_free(ptszTitle);
}
// create the new tree item
CPsTreeItem *pNew = new CPsTreeItem();
- if (pNew)
- {
- if (pNew->Create(pPsh, odp))
- {
+ if (pNew) {
+ if (pNew->Create(pPsh, odp)) {
MIR_DELETE(pNew);
return 1;
}
@@ -715,7 +707,7 @@ VOID DlgContactInfoLoadModule() ghDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE);
myCreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDialog);
- myCreateServiceFunction(MS_USERINFO_ADDPAGE, AddPage);
+ myCreateServiceFunction("UserInfo/AddPage", AddPage);
HookEvent(ME_DB_CONTACT_DELETED, OnDeleteContact);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
diff --git a/plugins/UserInfoEx/psp_options.cpp b/plugins/UserInfoEx/psp_options.cpp index cb82943643..d399f82c57 100644 --- a/plugins/UserInfoEx/psp_options.cpp +++ b/plugins/UserInfoEx/psp_options.cpp @@ -1527,28 +1527,28 @@ static INT OnInitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_COMMON);
odp.pfnDlgProc = DlgProc_CommonOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
// Advanced page
odp.pszTab = LPGEN("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADVANCED);
odp.pfnDlgProc = DlgProc_AdvancedOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
// Details Dialog page
odp.pszTab = LPGEN("Details Dialog");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DETAILSDLG);
odp.pfnDlgProc = DlgProc_DetailsDlgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
// Reminder page
odp.pszTab = LPGEN("Reminder");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_REMINDER);
odp.pfnDlgProc = DlgProc_ReminderOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
// Popups page
if (ServiceExists(MS_POPUP_ADDPOPUPT))
@@ -1558,7 +1558,7 @@ static INT OnInitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP);
odp.pfnDlgProc = DlgProc_Popups;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return MIR_OK;
}
diff --git a/plugins/Variables/options.cpp b/plugins/Variables/options.cpp index 03956ddea9..9fceb111c6 100644 --- a/plugins/Variables/options.cpp +++ b/plugins/Variables/options.cpp @@ -141,7 +141,7 @@ int OptionsInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Variables");
odp.pfnDlgProc = SetOptsDlgProc;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/plugins/WhenWasIt/hooked_events.cpp b/plugins/WhenWasIt/hooked_events.cpp index 94c0e674dd..6d11805c28 100644 --- a/plugins/WhenWasIt/hooked_events.cpp +++ b/plugins/WhenWasIt/hooked_events.cpp @@ -200,7 +200,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.groupPosition = 910000000;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcOptions;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/YAPP/options.cpp b/plugins/YAPP/options.cpp index d161234afe..268135db8b 100644 --- a/plugins/YAPP/options.cpp +++ b/plugins/YAPP/options.cpp @@ -480,12 +480,12 @@ int OptInit(WPARAM wParam, LPARAM lParam) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1);
odp.pszTab = LPGEN("Settings");
odp.pfnDlgProc = DlgProcOpts1;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CLASSES);
odp.pszTab = LPGEN("Classes");
odp.pfnDlgProc = DlgProcOptsClasses;
- CallService( MS_OPT_ADDPAGE, wParam, (LPARAM)&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/ZeroNotification/main.c b/plugins/ZeroNotification/main.c index 946699b18a..92572cb326 100644 --- a/plugins/ZeroNotification/main.c +++ b/plugins/ZeroNotification/main.c @@ -234,7 +234,7 @@ static int OptionsInitialize(WPARAM wParam,LPARAM lParam) odp.pszGroup = Translate("Plugins");
odp.groupPosition = 100000000;
odp.pfnDlgProc = DlgProcNoSoundOpts;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index 817f1d9f48..084be88139 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -272,13 +272,10 @@ TCHAR *itot(int num) { void Utf8Decode( char* str, wchar_t** ucs2 )
{
- int len;
- wchar_t* tempBuf;
-
if ( str == NULL )
return;
- len = strlen( str );
+ size_t len = strlen( str );
if ( len < 2 ) {
if ( ucs2 != NULL ) {
*ucs2 = ( wchar_t* )malloc(( len+1 )*sizeof( wchar_t ));
@@ -288,7 +285,7 @@ void Utf8Decode( char* str, wchar_t** ucs2 ) return;
}
- tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
+ wchar_t* tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
{
wchar_t* d = tempBuf;
BYTE* s = ( BYTE* )str;
@@ -332,19 +329,15 @@ void Utf8Decode( char* str, wchar_t** ucs2 ) char* Utf8Encode( const char* src )
{
- int len;
- char* result;
- wchar_t* tempBuf;
-
if ( src == NULL )
return NULL;
- len = strlen( src );
- result = ( char* )malloc( len*3 + 1 );
+ size_t len = strlen( src );
+ char* result = ( char* )malloc( len*3 + 1 );
if ( result == NULL )
return NULL;
- tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
+ wchar_t* tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
MultiByteToWideChar( CP_ACP, 0, src, -1, tempBuf, len );
tempBuf[ len ] = 0;
{
diff --git a/protocols/AimOscar/ui.cpp b/protocols/AimOscar/ui.cpp index d365d910ae..4aa7502f73 100644 --- a/protocols/AimOscar/ui.cpp +++ b/protocols/AimOscar/ui.cpp @@ -761,12 +761,12 @@ int CAimProto::OnUserInfoInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("Profile");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO);
odp.pfnDlgProc = userinfo_dialog;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Admin");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADMIN);
odp.pfnDlgProc = admin_dialog;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
return 0;
}
@@ -1159,13 +1159,13 @@ int CAimProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_AIM);
odp.pfnDlgProc = options_dialog;
odp.nIDBottomSimpleControl = IDC_OPTIONS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Privacy");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PRIVACY);
odp.pfnDlgProc = privacy_dialog;
odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/protocols/FacebookRM/proto.cpp b/protocols/FacebookRM/proto.cpp index 50ff0f66bc..b0887d3f66 100644 --- a/protocols/FacebookRM/proto.cpp +++ b/protocols/FacebookRM/proto.cpp @@ -424,13 +424,13 @@ int FacebookProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = FBOptionsProc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.position = 271829;
odp.ptszTab = LPGENT("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_ADVANCED);
odp.pfnDlgProc = FBOptionsAdvancedProc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.position = 271830;
if (ServiceExists(MS_POPUP_ADDPOPUPT))
@@ -438,7 +438,7 @@ int FacebookProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("Events");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_EVENTS);
odp.pfnDlgProc = FBEventsProc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/protocols/GTalkExt/options.cpp b/protocols/GTalkExt/options.cpp index c7321de8a8..4232054a2c 100644 --- a/protocols/GTalkExt/options.cpp +++ b/protocols/GTalkExt/options.cpp @@ -252,7 +252,7 @@ void AddPopupsPage(WPARAM wParam) odp.ptszGroup = POPUPS_OPTIONS_GROUP;
odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
void AddAccPage(LPCTSTR acc, LPCSTR mod, WPARAM wParam)
@@ -268,7 +268,7 @@ void AddAccPage(LPCTSTR acc, LPCSTR mod, WPARAM wParam) odp.ptszTab =_T(MAIL_NOTIFICATIONS);
odp.dwInitParam = (LPARAM)mod;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
int OptionsInitialization(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/Gadu-Gadu/dialogs.c b/protocols/Gadu-Gadu/dialogs.c index b6bfc8f5c0..ed068a1d16 100644 --- a/protocols/Gadu-Gadu/dialogs.c +++ b/protocols/Gadu-Gadu/dialogs.c @@ -138,18 +138,18 @@ int gg_options_init(GGPROTO *gg, WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_GG_GENERAL);
odp.pfnDlgProc = gg_genoptsdlgproc;
odp.flags = ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTab = LPGEN("Conference");
odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_GG_CONFERENCE);
odp.pfnDlgProc = gg_confoptsdlgproc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
odp.pszTab = LPGEN("Advanced");
odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_GG_ADVANCED);
odp.pfnDlgProc = gg_advoptsdlgproc;
odp.flags |= ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -916,7 +916,7 @@ int gg_details_init(GGPROTO *gg, WPARAM wParam, LPARAM lParam) odp.pszTemplate = ((HANDLE)lParam != NULL) ? MAKEINTRESOURCE(IDD_INFO_GG) : MAKEINTRESOURCE(IDD_CHINFO_GG);
odp.ptszTitle = GG_PROTONAME;
odp.dwInitParam = (LPARAM)gg;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
// Start search for user data
diff --git a/protocols/IRCG/options.cpp b/protocols/IRCG/options.cpp index 25cf9d38b1..61684cbae1 100644 --- a/protocols/IRCG/options.cpp +++ b/protocols/IRCG/options.cpp @@ -1722,7 +1722,7 @@ int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM) odp.dwInitParam = (LPARAM)&OptCreateAccount;
OptCreateAccount.create = CConnectPrefsDlg::Create;
OptCreateAccount.param = this;
- CallService( MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.flags |= ODPF_EXPERTONLY;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_CTCP);
@@ -1730,21 +1730,21 @@ int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM) odp.dwInitParam = (LPARAM)&OptCreateConn;
OptCreateConn.create = CCtcpPrefsDlg::Create;
OptCreateConn.param = this;
- CallService( MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_OTHER);
odp.ptszTab = LPGENT("Advanced");
odp.dwInitParam = (LPARAM)&OptCreateOther;
OptCreateOther.create = COtherPrefsDlg::Create;
OptCreateOther.param = this;
- CallService( MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_IGNORE);
odp.ptszTab = LPGENT("Ignore");
odp.dwInitParam = (LPARAM)&OptCreateIgnore;
OptCreateIgnore.create = CIgnorePrefsDlg::Create;
OptCreateIgnore.param = this;
- CallService( MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/protocols/IRCG/userinfo.cpp b/protocols/IRCG/userinfo.cpp index d7e8f071b4..8f6378a3ce 100644 --- a/protocols/IRCG/userinfo.cpp +++ b/protocols/IRCG/userinfo.cpp @@ -219,6 +219,6 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = UserDetailsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
odp.pszTitle = m_szModuleName;
- CallService( MS_USERINFO_ADDPAGE, wParam, (LPARAM) & odp);
+ UserInfo_AddPage(wParam, &odp);
return 0;
}
diff --git a/protocols/IcqOscarJ/UI/userinfotab.cpp b/protocols/IcqOscarJ/UI/userinfotab.cpp index 788dd2ca31..f04d27f8b3 100644 --- a/protocols/IcqOscarJ/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/UI/userinfotab.cpp @@ -306,7 +306,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.position = -1900000000;
odp.ptszTitle = m_tszUserName;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_ICQ);
- CallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
if (!lParam)
{
@@ -317,7 +317,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.position = -1899999999;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO);
odp.pfnDlgProc = ChangeInfoDlgProc;
- CallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
}
return 0;
}
diff --git a/protocols/IcqOscarJ/icq_opts.cpp b/protocols/IcqOscarJ/icq_opts.cpp index d7433ea978..67c71d014e 100644 --- a/protocols/IcqOscarJ/icq_opts.cpp +++ b/protocols/IcqOscarJ/icq_opts.cpp @@ -597,22 +597,22 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQ);
odp.pfnDlgProc = DlgProcIcqOpts;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Contacts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQCONTACTS);
odp.pfnDlgProc = DlgProcIcqContactsOpts;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Features");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQFEATURES);
odp.pfnDlgProc = DlgProcIcqFeaturesOpts;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Privacy");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQPRIVACY);
odp.pfnDlgProc = DlgProcIcqPrivacyOpts;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
if (bPopUpService)
{
@@ -622,7 +622,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcIcqPopupOpts;
odp.ptszGroup = LPGENT("Popups");
odp.ptszTab = NULL;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
}
return 0;
}
diff --git a/protocols/JabberG/jabber_opt.cpp b/protocols/JabberG/jabber_opt.cpp index 230fdb8a5f..63c38d6d0c 100644 --- a/protocols/JabberG/jabber_opt.cpp +++ b/protocols/JabberG/jabber_opt.cpp @@ -1609,34 +1609,34 @@ int CJabberProto::OnOptionsInit( WPARAM wParam, LPARAM ) odp.cbSize = sizeof( odp );
odp.hInstance = hInst;
odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = m_tszUserName; // title!!!!!!!!!!!
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR|ODPF_DONTTRANSLATE;
+ odp.ptszTitle = m_tszUserName;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.ptszTab = LPGENT("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER);
odp.pfnDlgProc = CDlgBase::DynamicDlgProc;
- odp.dwInitParam = (LPARAM)&OptCreateAccount;
+ odp.dwInitParam = (LPARAM)&OptCreateAccount;
OptCreateAccount.create = CDlgOptAccount::Create;
OptCreateAccount.param = this;
- JCallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Conferences");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER4);
odp.pfnDlgProc = CDlgBase::DynamicDlgProc;
- odp.dwInitParam = (LPARAM)&OptCreateGc;
+ odp.dwInitParam = (LPARAM)&OptCreateGc;
OptCreateGc.create = CDlgOptGc::Create;
OptCreateGc.param = this;
- JCallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.flags |= ODPF_EXPERTONLY;
odp.ptszTab = LPGENT("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_JABBER2 );
odp.pfnDlgProc = CDlgBase::DynamicDlgProc;
- odp.dwInitParam = (LPARAM)&OptCreateAdvanced;
+ odp.dwInitParam = (LPARAM)&OptCreateAdvanced;
OptCreateAdvanced.create = CDlgOptAdvanced::Create;
OptCreateAdvanced.param = this;
- JCallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -2074,8 +2074,7 @@ void CJabberDlgAccMgrUI::CheckRegistration() void CJabberDlgAccMgrUI::setupConnection(int type)
{
- switch (type)
- {
+ switch (type) {
case ACC_PUBLIC: setupPublic(); break;
case ACC_TLS: setupSecure(); break;
case ACC_SSL: setupSecureSSL(); break;
@@ -2185,7 +2184,6 @@ void CJabberDlgAccMgrUI::setupFB() m_txtManualHost.Disable();
m_txtPort.Disable();
m_btnRegister.Disable();
-// m_cbResource.Disable();
}
void CJabberDlgAccMgrUI::setupVK()
@@ -2204,7 +2202,6 @@ void CJabberDlgAccMgrUI::setupVK() m_txtManualHost.Disable();
m_txtPort.Disable();
m_btnRegister.Disable();
-// m_cbResource.Disable();
}
void CJabberDlgAccMgrUI::setupSMS()
diff --git a/protocols/JabberG/jabber_userinfo.cpp b/protocols/JabberG/jabber_userinfo.cpp index d80276361a..713b838262 100644 --- a/protocols/JabberG/jabber_userinfo.cpp +++ b/protocols/JabberG/jabber_userinfo.cpp @@ -864,13 +864,13 @@ int CJabberProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) odp.position = -2000000000;
odp.pszTemplate = MAKEINTRESOURCEA( IDD_INFO_JABBER );
odp.pszTitle = LPGEN("Account");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = JabberUserPhotoDlgProc;
odp.position = 2000000000;
odp.pszTemplate = MAKEINTRESOURCEA( IDD_VCARD_PHOTO );
odp.pszTitle = LPGEN("Photo");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
}
}
else {
diff --git a/protocols/JabberG/jabber_vcard.cpp b/protocols/JabberG/jabber_vcard.cpp index 2ec8dcf3d7..470eac42c6 100644 --- a/protocols/JabberG/jabber_vcard.cpp +++ b/protocols/JabberG/jabber_vcard.cpp @@ -1223,32 +1223,32 @@ void CJabberProto::OnUserInfoInit_VCard( WPARAM wParam, LPARAM ) odp.pfnDlgProc = PersonalDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PERSONAL);
odp.ptszTab = LPGENT("General");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = ContactDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_CONTACT);
odp.ptszTab = LPGENT("Contacts");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = HomeDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_HOME);
odp.ptszTab = LPGENT("Home");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = WorkDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_WORK);
odp.ptszTab = LPGENT("Work");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = PhotoDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PHOTO);
odp.ptszTab = LPGENT("Photo");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = NoteDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_NOTE);
odp.ptszTab = LPGENT("Note");
- JCallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
SendGetVcard( m_szJabberJID );
}
diff --git a/protocols/MRA/MraPopUp.cpp b/protocols/MRA/MraPopUp.cpp index 00247bd3a7..67cf3ad263 100644 --- a/protocols/MRA/MraPopUp.cpp +++ b/protocols/MRA/MraPopUp.cpp @@ -38,7 +38,7 @@ int MraPopupOptInit(WPARAM wParam,LPARAM lParam) odp.flags = (ODPF_BOLDGROUPS | ODPF_UNICODE);
odp.nIDBottomSimpleControl = IDC_GROUPMAIN;
odp.pfnDlgProc = MraPopupDlgProcOpts;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
}
return(0);
}
diff --git a/protocols/MRA/Mra_options.cpp b/protocols/MRA/Mra_options.cpp index d478ac5308..664a9ce8a6 100644 --- a/protocols/MRA/Mra_options.cpp +++ b/protocols/MRA/Mra_options.cpp @@ -20,27 +20,27 @@ int OptInit(WPARAM wParam,LPARAM lParam) odp.pszTab="Account";
odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_ACCOUNT);
odp.pfnDlgProc=DlgProcOptsAccount;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.pszTab="Connections";
odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_CONNECTIONS);
odp.pfnDlgProc=DlgProcOptsConnections;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.pszTab="Anti spam";
odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_ANTISPAM);
odp.pfnDlgProc=MraAntiSpamDlgProcOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.pszTab="Files";
odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_FILES);
odp.pfnDlgProc=MraFilesQueueDlgProcOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.pszTab="Avatars";
odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_AVATRS);
odp.pfnDlgProc=MraAvatarsQueueDlgProcOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
MraPopupOptInit(wParam,lParam);
return(0);
diff --git a/protocols/MSN/msn_opts.cpp b/protocols/MSN/msn_opts.cpp index a15f956439..11d077c52c 100644 --- a/protocols/MSN/msn_opts.cpp +++ b/protocols/MSN/msn_opts.cpp @@ -720,7 +720,6 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int CMsnProto::OnOptionsInit(WPARAM wParam,LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = {0};
-
odp.cbSize = sizeof(odp);
odp.position = -790000000;
odp.hInstance = hInst;
@@ -731,22 +730,22 @@ int CMsnProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.pfnDlgProc = DlgProcMsnOpts;
odp.dwInitParam = (LPARAM)this;
- MSN_CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Connection");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN_CONN);
odp.pfnDlgProc = DlgProcMsnConnOpts;
- MSN_CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
- odp.ptszTab = LPGENT("Server list");
+ odp.ptszTab = LPGENT("Server list");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_LISTSMGR);
odp.pfnDlgProc = DlgProcMsnServLists;
- MSN_CallService(MS_OPT_ADDPAGE, wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
odp.ptszTab = LPGENT("Notifications");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY);
- odp.pfnDlgProc = DlgProcHotmailPopUpOpts;
- MSN_CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY);
+ odp.pfnDlgProc = DlgProcHotmailPopUpOpts;
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -761,7 +760,7 @@ INT_PTR CMsnProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Load resident option values into memory
-void CMsnProto::LoadOptions(void)
+void CMsnProto::LoadOptions(void)
{
memset(&MyOptions, 0, sizeof(MyOptions));
@@ -773,8 +772,7 @@ void CMsnProto::LoadOptions(void) MyOptions.szEmail[0] = 0;
_strlwr(MyOptions.szEmail);
- if (getStaticString(NULL, "MachineGuid", MyOptions.szMachineGuid, sizeof(MyOptions.szMachineGuid)))
- {
+ if (getStaticString(NULL, "MachineGuid", MyOptions.szMachineGuid, sizeof(MyOptions.szMachineGuid))) {
char* uuid = getNewUuid();
strcpy(MyOptions.szMachineGuid, uuid);
setString("MachineGuid", MyOptions.szMachineGuid);
diff --git a/protocols/MSN/msn_useropts.cpp b/protocols/MSN/msn_useropts.cpp index 1462224783..d8d247cf4b 100644 --- a/protocols/MSN/msn_useropts.cpp +++ b/protocols/MSN/msn_useropts.cpp @@ -70,7 +70,7 @@ int MsnOnDetailsInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle = m_tszUserName;
odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE;
- MSN_CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
*/
return 0;
diff --git a/protocols/NewsAggregator/Src/Options.cpp b/protocols/NewsAggregator/Src/Options.cpp index b9dc78b90c..c9264f3d27 100644 --- a/protocols/NewsAggregator/Src/Options.cpp +++ b/protocols/NewsAggregator/Src/Options.cpp @@ -644,6 +644,6 @@ INT OptInit(WPARAM wParam, LPARAM lParam) odp.ptszGroup = LPGENT("Network");
odp.ptszTitle = LPGENT("News Aggregator");
odp.pfnDlgProc = UpdateNotifyOptsProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
\ No newline at end of file diff --git a/protocols/Omegle/proto.cpp b/protocols/Omegle/proto.cpp index e954b9dd2c..ca930961b8 100644 --- a/protocols/Omegle/proto.cpp +++ b/protocols/Omegle/proto.cpp @@ -219,7 +219,7 @@ int OmegleProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = OmegleOptionsProc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
return 0;
}
diff --git a/protocols/Quotes/OptionDukasCopy.cpp b/protocols/Quotes/OptionDukasCopy.cpp index 1aef56b824..6fcc542b09 100644 --- a/protocols/Quotes/OptionDukasCopy.cpp +++ b/protocols/Quotes/OptionDukasCopy.cpp @@ -410,5 +410,5 @@ void ShowDukasCopyPropPage(CQuotesProviderDukasCopy* pProvider,WPARAM wp,OPTIONS // odp.ptszTitle = TranslateTS(const_cast<LPTSTR>(sTitle.c_str()));
// #endif
- CallService(MS_OPT_ADDPAGE,wp,reinterpret_cast<LPARAM>(&odp));
+ Options_AddPage(wp, &odp);
}
diff --git a/protocols/Quotes/QuoteInfoDlg.cpp b/protocols/Quotes/QuoteInfoDlg.cpp index 88253ec45d..0cb1c8a686 100644 --- a/protocols/Quotes/QuoteInfoDlg.cpp +++ b/protocols/Quotes/QuoteInfoDlg.cpp @@ -161,8 +161,7 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) odp.position = -2000000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_QUOTE_INFO);
odp.ptszTitle = TranslateT("Quote");
- CallService(MS_USERINFO_ADDPAGE,wp,reinterpret_cast<LPARAM>(&odp));
-
+ UserInfo_AddPage(wp, &odp);
return 0;
}
diff --git a/protocols/Quotes/QuotesProviderFinance.cpp b/protocols/Quotes/QuotesProviderFinance.cpp index 99d6127b32..e8b335035d 100644 --- a/protocols/Quotes/QuotesProviderFinance.cpp +++ b/protocols/Quotes/QuotesProviderFinance.cpp @@ -314,5 +314,5 @@ void CQuotesProviderFinance::ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) odp.pfnDlgProc = GoogleFinanceOptDlgProc;
odp.dwInitParam = reinterpret_cast<DWORD>(static_cast<CQuotesProviderFinance*>(this));
odp.ptszTab = const_cast<LPTSTR>(GetInfo().m_sName.c_str());
- CallService(MS_OPT_ADDPAGE,wp,reinterpret_cast<LPARAM>(&odp));
+ Options_AddPage(wp, &odp);
}
diff --git a/protocols/Quotes/QuotesProviderGoogle.cpp b/protocols/Quotes/QuotesProviderGoogle.cpp index 6458180324..c2b30a9a6a 100644 --- a/protocols/Quotes/QuotesProviderGoogle.cpp +++ b/protocols/Quotes/QuotesProviderGoogle.cpp @@ -470,7 +470,7 @@ void CQuotesProviderGoogle::ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) // tstring sTitle = o.str();
// odp.ptszTitle = TranslateTS(const_cast<LPTSTR>(sTitle.c_str()));
// #endif
- CallService(MS_OPT_ADDPAGE,wp,reinterpret_cast<LPARAM>(&odp));
+ Options_AddPage(wp, &odp);
}
void CQuotesProviderGoogle::Accept(CQuotesProviderVisitor& visitor)const
diff --git a/protocols/Twitter/main.cpp b/protocols/Twitter/main.cpp index 42ffac5220..1aeac73b83 100644 --- a/protocols/Twitter/main.cpp +++ b/protocols/Twitter/main.cpp @@ -102,21 +102,15 @@ int OnModulesLoaded(WPARAM,LPARAM) char curr_version[30];
upd.szComponentName = pluginInfo.shortName;
-
upd.szUpdateURL = UPDATER_AUTOREGISTER;
-
upd.szBetaVersionURL = "http://twosx.net/mim/twitter/updater/version.html";
upd.szBetaChangelogURL = "http://twosx.net/mim/twitter/updater/changelog.html";
upd.pbBetaVersionPrefix = reinterpret_cast<BYTE*>("Twitter ");
upd.cpbBetaVersionPrefix = (int)strlen(reinterpret_cast<char*>(upd.pbBetaVersionPrefix));
-
upd.szBetaUpdateURL = "http://twosx.net/mim/twitter/updater/twitter.zip";
-
- upd.pbVersion = reinterpret_cast<BYTE*>( CreateVersionStringPlugin(
- reinterpret_cast<PLUGININFO*>(&pluginInfo),curr_version) );
+ upd.pbVersion = reinterpret_cast<BYTE*>( CreateVersionStringPluginEx(&pluginInfo,curr_version) );
upd.cpbVersion = (int)strlen(reinterpret_cast<char*>(upd.pbVersion));
-
CallService(MS_UPDATE_REGISTER,0,(LPARAM)&upd);
}
diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp index c2108358ae..30b3b90a16 100644 --- a/protocols/Twitter/proto.cpp +++ b/protocols/Twitter/proto.cpp @@ -367,14 +367,14 @@ int TwitterProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("Basic");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = options_proc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
if(ServiceExists(MS_POPUP_ADDPOPUPT))
{
odp.ptszTab = LPGENT("Popups");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
odp.pfnDlgProc = popup_options_proc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
return 0;
@@ -525,23 +525,14 @@ void TwitterProto::LOG(TCHAR *fmt,...) CallService(MS_NETLIB_LOG, (WPARAM)hNetlib_, (LPARAM)( char* )_T2A(text));
}
-void TwitterProto::WLOG(TCHAR* first, const wstring last)
-{
- TCHAR *str1 = new TCHAR[1024*96];
- _stprintf(str1,_T("%s"), last.c_str());
- LOG(first, str1);
-}
-
// TODO: the more I think about it, the more I think all twit.* methods should
// be in MessageLoop
void TwitterProto::SendTweetWorker(void *p)
{
if(p == 0)
return;
- char *text = static_cast<char*>(p);
-
-
+ char *text = static_cast<char*>(p);
if (strlen(text) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here.
char * errorPopup = new char[280]; // i hate c strings ... i should use std::string here. why did i use char* ??? need to delete[] or use std::String
sprintf(errorPopup, "Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?", strlen(text));
diff --git a/protocols/Twitter/proto.h b/protocols/Twitter/proto.h index ca3fd8596c..6cea35b33d 100644 --- a/protocols/Twitter/proto.h +++ b/protocols/Twitter/proto.h @@ -147,7 +147,7 @@ private: void SetAllContactStatuses(int);
void LOG(TCHAR *fmt,...);
- void WLOG(TCHAR* first, const wstring last);
+ __inline void WLOG(TCHAR* first, const tstring& last) { LOG(first, last.c_str()); }
static void CALLBACK APC_callback(ULONG_PTR p);
void UpdateChat(const twitter_user &update);
diff --git a/protocols/Weather/weather_opt.cpp b/protocols/Weather/weather_opt.cpp index 2ec33bd371..6e27c45e5c 100644 --- a/protocols/Weather/weather_opt.cpp +++ b/protocols/Weather/weather_opt.cpp @@ -291,13 +291,13 @@ int OptInit(WPARAM wParam,LPARAM lParam) { odp.pszTitle = WEATHERPROTOTEXT;
odp.pszTab = LPGEN("General");
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
// text options
odp.pszTemplate = MAKEINTRESOURCEA(IDD_TEXTOPT);
odp.pfnDlgProc = DlgProcText;
odp.pszTab = LPGEN("Display");
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
// if popup service exists, load the weather popup options
if ((ServiceExists(MS_POPUP_ADDPOPUP))) {
@@ -307,7 +307,7 @@ int OptInit(WPARAM wParam,LPARAM lParam) { odp.groupPosition = 910000000;
odp.pszTab = NULL;
odp.pfnDlgProc = DlgPopUpOpts;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+ Options_AddPage(wParam,&odp);
}
return 0;
diff --git a/protocols/Weather/weather_userinfo.cpp b/protocols/Weather/weather_userinfo.cpp index c0b196bf4d..9041805fbd 100644 --- a/protocols/Weather/weather_userinfo.cpp +++ b/protocols/Weather/weather_userinfo.cpp @@ -44,7 +44,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO);
odp.pfnDlgProc = DlgProcINIPage;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
else
{
@@ -55,7 +55,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
odp.pfnDlgProc = DlgProcUIPage;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ UserInfo_AddPage(wParam, &odp);
}
}
diff --git a/protocols/YAMN/main.cpp b/protocols/YAMN/main.cpp index 20a4adc20b..33a5fc186c 100644 --- a/protocols/YAMN/main.cpp +++ b/protocols/YAMN/main.cpp @@ -264,7 +264,7 @@ int SystemModulesLoaded(WPARAM, LPARAM) wsprintfA(szUrl, "http://www.miranda-fr.net/tweety/yamn/%s.zip", YAMN_FILENAME);
update.szComponentName = pluginInfo.shortName;
- update.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO *)&pluginInfo, szVersion);
+ update.pbVersion = (BYTE *)CreateVersionStringPluginEx((PLUGININFOEX *)&pluginInfo, szVersion);
update.cpbVersion = (int)strlen((char *)update.pbVersion);
update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile = 3411";
update.szVersionURL = "http://addons.miranda-im.org/details.php?action = viewfile&id = 3411";
diff --git a/protocols/YAMN/proto/pop3/pop3opt.cpp b/protocols/YAMN/proto/pop3/pop3opt.cpp index bcbf78e380..ded7a63c80 100644 --- a/protocols/YAMN/proto/pop3/pop3opt.cpp +++ b/protocols/YAMN/proto/pop3/pop3opt.cpp @@ -175,24 +175,24 @@ int YAMNOptInitSvc(WPARAM wParam,LPARAM lParam) odp.pszTab = LPGEN("Accounts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTOPT);
odp.pfnDlgProc = DlgProcPOP3AccOpt;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.pszTab = LPGEN("General");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_YAMNOPT);
odp.pfnDlgProc = DlgProcYAMNOpt;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
odp.pszTab = LPGEN("Plugins");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PLUGINOPT);
odp.pfnDlgProc = DlgProcPluginOpt;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
if ( ServiceExists(MS_POPUP_ADDPOPUPEX)) {
odp.pszGroup = LPGEN("PopUps");
odp.pszTab = LPGEN("YAMN");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTPOPUP);
odp.pfnDlgProc = DlgProcPOP3AccPopup;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ Options_AddPage(wParam, &odp);
}
return 0;
}
diff --git a/protocols/Yahoo/options.cpp b/protocols/Yahoo/options.cpp index 01fa96330a..da51259fcc 100644 --- a/protocols/Yahoo/options.cpp +++ b/protocols/Yahoo/options.cpp @@ -381,17 +381,17 @@ INT_PTR __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.ptszTab = LPGENT("Account");
odp.pfnDlgProc = DlgProcYahooOpts;
odp.dwInitParam = LPARAM(this);
- YAHOO_CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Connection");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO_CONNECTION);
odp.pfnDlgProc = DlgProcYahooOptsConn;
- YAHOO_CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Ignore List");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO_IGNORE);
odp.pfnDlgProc = DlgProcYahooOptsIgnore;
- YAHOO_CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/protocols/Yahoo/user_info.cpp b/protocols/Yahoo/user_info.cpp index b82d26a495..77b06344f6 100644 --- a/protocols/Yahoo/user_info.cpp +++ b/protocols/Yahoo/user_info.cpp @@ -122,17 +122,14 @@ INT_PTR __cdecl CYahooProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) odp.dwInitParam = ( LPARAM )this;
HANDLE hContact = ( HANDLE )lParam;
- if ( hContact )
- {
+ if ( hContact ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
- if ( szProto != NULL && !strcmp( szProto, m_szModuleName ))
- {
+ if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) {
odp.pfnDlgProc = YahooUserInfoDlgProc;
odp.position = -1900000000;
odp.pszTemplate = MAKEINTRESOURCEA( IDD_USER_INFO );
odp.pszTitle = m_szModuleName;
- CallService( MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
-
+ UserInfo_AddPage(wParam, &odp);
}
}
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 8dbb7b2ecc..3cab040efe 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -26,34 +26,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define BLOCK_ALLOCED 0xABBABABA
#define BLOCK_FREED 0xDEADBEEF
-static int CheckBlock( void* blk )
+static int CheckBlock(void* blk)
{
int result = FALSE;
- char* p = ( char* )blk - sizeof(DWORD)*2;
+ char* p = (char*)blk - sizeof(DWORD)*2;
DWORD size, *b, *e;
__try
{
- size = *( DWORD* )p;
- b = ( DWORD* )&p[ sizeof( DWORD ) ];
- e = ( DWORD* )&p[ sizeof( DWORD )*2 + size ];
+ size = *(DWORD*)p;
+ b = (DWORD*)&p[ sizeof(DWORD) ];
+ e = (DWORD*)&p[ sizeof(DWORD)*2 + size ];
- if ( *b != BLOCK_ALLOCED || *e != BLOCK_ALLOCED )
+ if (*b != BLOCK_ALLOCED || *e != BLOCK_ALLOCED)
{
- if ( *b == BLOCK_FREED && *e == BLOCK_FREED )
- OutputDebugStringA( "memory block is already deleted\n" );
+ if (*b == BLOCK_FREED && *e == BLOCK_FREED)
+ OutputDebugStringA("memory block is already deleted\n");
else
- OutputDebugStringA( "memory block is corrupted\n" );
- #if defined( _DEBUG )
+ OutputDebugStringA("memory block is corrupted\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
}
else result = TRUE;
}
- __except( EXCEPTION_EXECUTE_HANDLER )
+ __except(EXCEPTION_EXECUTE_HANDLER)
{
- OutputDebugStringA( "access violation during checking memory block\n" );
- #if defined( _DEBUG )
+ OutputDebugStringA("access violation during checking memory block\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
}
@@ -63,91 +63,91 @@ static int CheckBlock( void* blk ) /******************************************************************************/
-void* mir_alloc( size_t size )
+void* mir_alloc(size_t size)
{
- if ( size == 0 )
+ if (size == 0)
return NULL;
{
- char* p = (char*)malloc( size + sizeof(DWORD)*3 );
- if ( p == NULL ) {
- OutputDebugStringA( "memory overflow\n" );
- #if defined( _DEBUG )
+ char* p = (char*)malloc(size + sizeof(DWORD)*3);
+ if (p == NULL) {
+ OutputDebugStringA("memory overflow\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
return NULL;
}
- *( DWORD* )p = ( DWORD )size;
- *( DWORD* )&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
- *( DWORD* )&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
- return p + sizeof( DWORD )*2;
+ *(DWORD*)p = (DWORD)size;
+ *(DWORD*)&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
+ *(DWORD*)&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
+ return p + sizeof(DWORD)*2;
} }
/******************************************************************************/
-void* mir_calloc( size_t size )
+void* mir_calloc(size_t size)
{
- void* p = mir_alloc( size );
- if ( p != NULL )
- memset( p, 0, size );
+ void* p = mir_alloc(size);
+ if (p != NULL)
+ memset(p, 0, size);
return p;
}
/******************************************************************************/
-void* mir_realloc( void* ptr, size_t size )
+void* mir_realloc(void* ptr, size_t size)
{
char* p;
- if ( ptr != NULL ) {
- if ( !CheckBlock( ptr ))
+ if (ptr != NULL) {
+ if ( !CheckBlock(ptr))
return NULL;
- p = ( char* )ptr - sizeof(DWORD)*2;
+ p = (char*)ptr - sizeof(DWORD)*2;
}
else p = NULL;
- p = ( char* )realloc( p, size + sizeof(DWORD)*3 );
- if ( p == NULL ) {
- OutputDebugStringA( "memory overflow\n" );
- #if defined( _DEBUG )
+ p = (char*)realloc(p, size + sizeof(DWORD)*3);
+ if (p == NULL) {
+ OutputDebugStringA("memory overflow\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
return NULL;
}
- *( DWORD* )p = ( DWORD )size;
- *( DWORD* )&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
- *( DWORD* )&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
- return p + sizeof( DWORD )*2;
+ *(DWORD*)p = (DWORD)size;
+ *(DWORD*)&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
+ *(DWORD*)&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
+ return p + sizeof(DWORD)*2;
}
/******************************************************************************/
-void mir_free( void* ptr )
+void mir_free(void* ptr)
{
char* p;
DWORD size;
- if ( ptr == NULL )
+ if (ptr == NULL)
return;
- if ( !CheckBlock( ptr ))
+ if ( !CheckBlock(ptr))
return;
- p = ( char* )ptr - sizeof(DWORD)*2;
- size = *( DWORD* )p;
- *( DWORD* )&p[ sizeof(DWORD) ] = BLOCK_FREED;
- *( DWORD* )&p[ size + sizeof(DWORD)*2 ] = BLOCK_FREED;
- free( p );
+ p = (char*)ptr - sizeof(DWORD)*2;
+ size = *(DWORD*)p;
+ *(DWORD*)&p[ sizeof(DWORD) ] = BLOCK_FREED;
+ *(DWORD*)&p[ size + sizeof(DWORD)*2 ] = BLOCK_FREED;
+ free(p);
}
/******************************************************************************/
-char* mir_strdup( const char* str )
+char* mir_strdup(const char* str)
{
- if ( str != NULL ) {
- char* p = ( char* )mir_alloc( strlen( str )+1 );
- if ( p )
- strcpy( p, str );
+ if (str != NULL) {
+ char* p = (char*)mir_alloc(strlen(str)+1);
+ if (p)
+ strcpy(p, str);
return p;
}
return NULL;
@@ -155,12 +155,12 @@ char* mir_strdup( const char* str ) /******************************************************************************/
-char* mir_strndup( const char* str, size_t len )
+char* mir_strndup(const char* str, size_t len)
{
- if ( str != NULL && len != 0 ) {
- char* p = ( char* )mir_alloc( len + 1 );
- if ( !p ) {
- memcpy( p, str, len );
+ if (str != NULL && len != 0) {
+ char* p = (char*)mir_alloc(len + 1);
+ if ( !p) {
+ memcpy(p, str, len);
p[ len ] = 0;
}
return p;
@@ -170,12 +170,12 @@ char* mir_strndup( const char* str, size_t len ) /******************************************************************************/
-WCHAR* mir_wstrdup( const WCHAR* str )
+WCHAR* mir_wstrdup(const WCHAR* str)
{
- if ( str != NULL ) {
- WCHAR* p = ( WCHAR* )mir_alloc( sizeof( WCHAR )*( wcslen( str )+1 ));
- if ( p )
- wcscpy( p, str );
+ if (str != NULL) {
+ WCHAR* p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(wcslen(str)+1));
+ if (p)
+ wcscpy(p, str);
return p;
}
return NULL;
@@ -233,48 +233,48 @@ int mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va) /******************************************************************************/
-wchar_t* mir_a2u_cp( const char* src, int codepage )
+wchar_t* mir_a2u_cp(const char* src, int codepage)
{
- if ( src == NULL )
+ if (src == NULL)
return NULL;
- int cbLen = MultiByteToWideChar( codepage, 0, src, -1, NULL, 0 );
- wchar_t* result = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1));
- if ( result == NULL )
+ int cbLen = MultiByteToWideChar(codepage, 0, src, -1, NULL, 0);
+ wchar_t* result = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen+1));
+ if (result == NULL)
return NULL;
- MultiByteToWideChar( codepage, 0, src, -1, result, cbLen );
+ MultiByteToWideChar(codepage, 0, src, -1, result, cbLen);
result[ cbLen ] = 0;
return result;
}
/******************************************************************************/
-wchar_t* mir_a2u( const char* src )
+wchar_t* mir_a2u(const char* src)
{
- return mir_a2u_cp( src, LangPackGetDefaultCodePage());
+ return mir_a2u_cp(src, LangPackGetDefaultCodePage());
}
/******************************************************************************/
-char* mir_u2a_cp( const wchar_t* src, int codepage )
+char* mir_u2a_cp(const wchar_t* src, int codepage)
{
- if ( src == NULL )
+ if (src == NULL)
return NULL;
- int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL );
- char* result = ( char* )mir_alloc( cbLen+1 );
- if ( result == NULL )
+ int cbLen = WideCharToMultiByte(codepage, 0, src, -1, NULL, 0, NULL, NULL);
+ char* result = (char*)mir_alloc(cbLen+1);
+ if (result == NULL)
return NULL;
- WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL );
+ WideCharToMultiByte(codepage, 0, src, -1, result, cbLen, NULL, NULL);
result[ cbLen ] = 0;
return result;
}
/******************************************************************************/
-char* mir_u2a( const wchar_t* src )
+char* mir_u2a(const wchar_t* src)
{
- return mir_u2a_cp( src, LangPackGetDefaultCodePage());
+ return mir_u2a_cp(src, LangPackGetDefaultCodePage());
}
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index 3798a54710..8678524411 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -35,7 +35,7 @@ void UnloadNewPluginsModule(void); void UnloadDefaultModules(void);
void RecalculateTime(void);
-HINSTANCE GetInstByAddress( void* codePtr );
+HINSTANCE GetInstByAddress(void* codePtr);
pfnMyMonitorFromPoint MyMonitorFromPoint;
pfnMyMonitorFromRect MyMonitorFromRect;
@@ -99,24 +99,24 @@ int hLangpack = 0; /////////////////////////////////////////////////////////////////////////////////////////
// exception handling
-static DWORD __cdecl sttDefaultFilter( DWORD, EXCEPTION_POINTERS* )
+static DWORD __cdecl sttDefaultFilter(DWORD, EXCEPTION_POINTERS*)
{
return EXCEPTION_EXECUTE_HANDLER;
}
pfnExceptionFilter pMirandaExceptFilter = sttDefaultFilter;
-static INT_PTR GetExceptionFilter( WPARAM, LPARAM )
+static INT_PTR GetExceptionFilter(WPARAM, LPARAM)
{
- return ( INT_PTR )pMirandaExceptFilter;
+ return (INT_PTR)pMirandaExceptFilter;
}
-static INT_PTR SetExceptionFilter( WPARAM, LPARAM lParam )
+static INT_PTR SetExceptionFilter(WPARAM, LPARAM lParam)
{
pfnExceptionFilter oldOne = pMirandaExceptFilter;
- if ( lParam != 0 )
- pMirandaExceptFilter = ( pfnExceptionFilter )lParam;
- return ( INT_PTR )oldOne;
+ if (lParam != 0)
+ pMirandaExceptFilter = (pfnExceptionFilter)lParam;
+ return (INT_PTR)oldOne;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -132,7 +132,7 @@ typedef struct }
THREAD_WAIT_ENTRY;
-static LIST<THREAD_WAIT_ENTRY> threads( 10, NumericKeySortT );
+static LIST<THREAD_WAIT_ENTRY> threads(10, NumericKeySortT);
struct FORK_ARG {
HANDLE hEvent;
@@ -155,9 +155,9 @@ void __cdecl forkthread_r(void * arg) {
callercode(cookie);
}
- __except( pMirandaExceptFilter( GetExceptionCode(), GetExceptionInformation()))
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
{
- Netlib_Logf( NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
+ Netlib_Logf(NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@@ -186,7 +186,7 @@ UINT_PTR forkthread ( static INT_PTR ForkThreadService(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)forkthread(( pThreadFunc )wParam, 0, ( void* )lParam );
+ return (INT_PTR)forkthread((pThreadFunc)wParam, 0, (void*)lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -196,7 +196,7 @@ unsigned __stdcall forkthreadex_r(void * arg) {
struct FORK_ARG *fa = (struct FORK_ARG *)arg;
pThreadFuncEx threadcode = fa->threadcodeex;
- pThreadFuncOwner threadcodeex = ( pThreadFuncOwner )fa->threadcodeex;
+ pThreadFuncOwner threadcodeex = (pThreadFuncOwner)fa->threadcodeex;
void *cookie = fa->arg;
void *owner = fa->owner;
unsigned long rc = 0;
@@ -205,14 +205,14 @@ unsigned __stdcall forkthreadex_r(void * arg) SetEvent(fa->hEvent);
__try
{
- if ( owner )
- rc = threadcodeex( owner, cookie );
+ if (owner)
+ rc = threadcodeex(owner, cookie);
else
- rc = threadcode( cookie );
+ rc = threadcode(cookie);
}
- __except( pMirandaExceptFilter( GetExceptionCode(), GetExceptionInformation()))
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
{
- Netlib_Logf( NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
+ Netlib_Logf(NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@@ -226,7 +226,7 @@ UINT_PTR forkthreadex( unsigned (__stdcall *threadcode)(void*),
void* owner,
void *arg,
- unsigned *thraddr )
+ unsigned *thraddr)
{
UINT_PTR rc;
struct FORK_ARG fa = { 0 };
@@ -245,11 +245,11 @@ UINT_PTR forkthreadex( static INT_PTR ForkThreadServiceEx(WPARAM wParam, LPARAM lParam)
{
FORK_THREADEX_PARAMS* params = (FORK_THREADEX_PARAMS*)lParam;
- if ( params == NULL )
+ if (params == NULL)
return 0;
UINT threadID;
- return forkthreadex( NULL, params->iStackSize, params->pFunc, ( void* )wParam, params->arg, params->threadID ? params->threadID : &threadID );
+ return forkthreadex(NULL, params->iStackSize, params->pFunc, (void*)wParam, params->arg, params->threadID ? params->threadID : &threadID);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -266,70 +266,70 @@ static int MirandaWaitForMutex(HANDLE hEvent) for (;;) {
// will get WAIT_IO_COMPLETE for QueueUserAPC() which isnt a result
DWORD rc = MsgWaitForMultipleObjectsExWorkaround(1, &hEvent, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
- if ( rc == WAIT_OBJECT_0 + 1 ) {
+ if (rc == WAIT_OBJECT_0 + 1) {
MSG msg;
- while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
- if ( IsDialogMessage(msg.hwnd, &msg) ) continue;
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (IsDialogMessage(msg.hwnd, &msg)) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- } else if ( rc == WAIT_OBJECT_0 ) {
+ } else if (rc == WAIT_OBJECT_0) {
// got object
return 1;
- } else if ( rc == WAIT_ABANDONED_0 || rc == WAIT_FAILED ) return 0;
+ } else if (rc == WAIT_ABANDONED_0 || rc == WAIT_FAILED) return 0;
}
}
VOID CALLBACK KillAllThreads(HWND, UINT, UINT_PTR, DWORD)
{
- if ( MirandaWaitForMutex( hStackMutex )) {
- for ( int j=0; j < threads.getCount(); j++ ) {
+ if ( MirandaWaitForMutex(hStackMutex)) {
+ for (int j=0; j < threads.getCount(); j++) {
THREAD_WAIT_ENTRY* p = threads[j];
char szModuleName[ MAX_PATH ];
- GetModuleFileNameA( p->hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf( NULL, "Thread %p was abnormally terminated because module '%s' didn't release it. Entry point: %p",
- p->hThread, szModuleName, p->addr );
- TerminateThread( p->hThread, 9999 );
+ GetModuleFileNameA(p->hOwner, szModuleName, sizeof(szModuleName));
+ Netlib_Logf(NULL, "Thread %p was abnormally terminated because module '%s' didn't release it. Entry point: %p",
+ p->hThread, szModuleName, p->addr);
+ TerminateThread(p->hThread, 9999);
CloseHandle(p->hThread);
- mir_free( p );
+ mir_free(p);
}
threads.destroy();
- ReleaseMutex( hStackMutex );
- SetEvent( hThreadQueueEmpty );
+ ReleaseMutex(hStackMutex);
+ SetEvent(hThreadQueueEmpty);
}
}
-void KillObjectThreads( void* owner )
+void KillObjectThreads(void* owner)
{
- if ( owner == NULL )
+ if (owner == NULL)
return;
- WaitForSingleObject( hStackMutex, INFINITE );
+ WaitForSingleObject(hStackMutex, INFINITE);
- HANDLE* threadPool = ( HANDLE* )alloca( threads.getCount()*sizeof( HANDLE ));
+ HANDLE* threadPool = (HANDLE*)alloca(threads.getCount()*sizeof(HANDLE));
int threadCount = 0;
- for ( int j = threads.getCount(); j--; ) {
+ for (int j = threads.getCount(); j--;) {
THREAD_WAIT_ENTRY* p = threads[j];
- if ( p->pObject == owner )
+ if (p->pObject == owner)
threadPool[ threadCount++ ] = p->hThread;
}
ReleaseMutex(hStackMutex);
// is there anything to kill?
- if ( threadCount > 0 ) {
- if ( WaitForMultipleObjects( threadCount, threadPool, TRUE, 5000 ) == WAIT_TIMEOUT ) {
+ if (threadCount > 0) {
+ if ( WaitForMultipleObjects(threadCount, threadPool, TRUE, 5000) == WAIT_TIMEOUT) {
// forcibly kill all remaining threads after 5 secs
- WaitForSingleObject( hStackMutex, INFINITE );
- for ( int j = threads.getCount()-1; j >= 0; j-- ) {
+ WaitForSingleObject(hStackMutex, INFINITE);
+ for (int j = threads.getCount()-1; j >= 0; j--) {
THREAD_WAIT_ENTRY* p = threads[j];
- if ( p->pObject == owner ) {
- TerminateThread( p->hThread, 9999 );
- CloseHandle( p->hThread );
- threads.remove( j );
- mir_free( p );
+ if (p->pObject == owner) {
+ TerminateThread(p->hThread, 9999);
+ CloseHandle(p->hThread);
+ threads.remove(j);
+ mir_free(p);
}
}
ReleaseMutex(hStackMutex);
@@ -340,15 +340,15 @@ void KillObjectThreads( void* owner ) static void UnwindThreadWait(void)
{
// acquire the list and wake up any alertable threads
- if ( MirandaWaitForMutex(hStackMutex) ) {
+ if ( MirandaWaitForMutex(hStackMutex)) {
int j;
- for ( j=0; j < threads.getCount(); j++ )
+ for (j=0; j < threads.getCount(); j++)
QueueUserAPC(DummyAPCFunc, threads[j]->hThread, 0);
ReleaseMutex(hStackMutex);
}
// give all unclosed threads 5 seconds to close
- SetTimer( NULL, 0, 5000, KillAllThreads );
+ SetTimer(NULL, 0, 5000, KillAllThreads);
// wait til the thread list is empty
MirandaWaitForMutex(hThreadQueueEmpty);
@@ -365,11 +365,11 @@ void* GetCurrentThreadEntryPoint() HANDLE hDupHandle, hCurrentProcess;
DWORD_PTR dwStartAddress;
- pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "NtQueryInformationThread" );
+ pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "NtQueryInformationThread");
if (NtQueryInformationThread == NULL) return 0;
hCurrentProcess = GetCurrentProcess();
- if (!DuplicateHandle(hCurrentProcess, GetCurrentThread(), hCurrentProcess, &hDupHandle, THREAD_QUERY_INFORMATION, FALSE, 0)) {
+ if ( !DuplicateHandle(hCurrentProcess, GetCurrentThread(), hCurrentProcess, &hDupHandle, THREAD_QUERY_INFORMATION, FALSE, 0)) {
SetLastError(ERROR_ACCESS_DENIED);
return NULL;
}
@@ -377,14 +377,13 @@ void* GetCurrentThreadEntryPoint() CloseHandle(hDupHandle);
if (ntStatus != ERROR_SUCCESS) return 0;
- return ( void* )dwStartAddress;
+ return (void*)dwStartAddress;
}
INT_PTR UnwindThreadPush(WPARAM wParam, LPARAM lParam)
{
ResetEvent(hThreadQueueEmpty); // thread list is not empty
- if (WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0)
- {
+ if ( WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0) {
THREAD_WAIT_ENTRY* p = (THREAD_WAIT_ENTRY*)mir_calloc(sizeof(THREAD_WAIT_ENTRY));
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &p->hThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
@@ -394,7 +393,7 @@ INT_PTR UnwindThreadPush(WPARAM wParam, LPARAM lParam) p->addr = (void*)lParam;
threads.insert(p);
- //Netlib_Logf( NULL, "*** pushing thread %x[%x] (%d)", hThread, GetCurrentThreadId(), threads.count );
+ //Netlib_Logf(NULL, "*** pushing thread %x[%x] (%d)", hThread, GetCurrentThreadId(), threads.count);
ReleaseMutex(hStackMutex);
} //if
return 0;
@@ -402,22 +401,21 @@ INT_PTR UnwindThreadPush(WPARAM wParam, LPARAM lParam) INT_PTR UnwindThreadPop(WPARAM, LPARAM)
{
- if (WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0)
- {
+ if ( WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0) {
DWORD dwThreadId=GetCurrentThreadId();
int j;
- //Netlib_Logf( NULL, "*** popping thread %x, %d threads left", dwThreadId, threads.count);
- for ( j=0; j < threads.getCount(); j++ ) {
+ //Netlib_Logf(NULL, "*** popping thread %x, %d threads left", dwThreadId, threads.count);
+ for (j=0; j < threads.getCount(); j++) {
THREAD_WAIT_ENTRY* p = threads[j];
- if ( p->dwThreadId == dwThreadId ) {
- SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
- CloseHandle( p->hThread );
- threads.remove( j );
- mir_free( p );
+ if (p->dwThreadId == dwThreadId) {
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
+ CloseHandle(p->hThread);
+ threads.remove(j);
+ mir_free(p);
if ( !threads.getCount()) {
threads.destroy();
- ReleaseMutex( hStackMutex );
+ ReleaseMutex(hStackMutex);
SetEvent(hThreadQueueEmpty); // thread list is empty now
return 0;
}
@@ -438,7 +436,7 @@ INT_PTR MirandaIsTerminated(WPARAM, LPARAM) static void __cdecl compactHeapsThread(void*)
{
- while (!Miranda_Terminated())
+ while ( !Miranda_Terminated())
{
HANDLE hHeaps[256];
DWORD hc;
@@ -483,7 +481,7 @@ void checkIdle(MSG * msg) static INT_PTR SystemGetIdle(WPARAM, LPARAM lParam)
{
- if ( lParam ) *(DWORD*)lParam = dwEventTime;
+ if (lParam) *(DWORD*)lParam = dwEventTime;
return 0;
}
@@ -491,10 +489,10 @@ static DWORD MsgWaitForMultipleObjectsExWorkaround(DWORD nCount, const HANDLE *p DWORD dwMsecs, DWORD dwWakeMask, DWORD dwFlags)
{
DWORD rc;
- if ( msgWaitForMultipleObjectsEx != NULL )
+ if (msgWaitForMultipleObjectsEx != NULL)
return msgWaitForMultipleObjectsEx(nCount, pHandles, dwMsecs, dwWakeMask, dwFlags);
rc=MsgWaitForMultipleObjects(nCount, pHandles, FALSE, 50, QS_ALLINPUT);
- if ( rc == WAIT_TIMEOUT ) rc=WaitForMultipleObjectsEx(nCount, pHandles, FALSE, 20, TRUE);
+ if (rc == WAIT_TIMEOUT) rc=WaitForMultipleObjectsEx(nCount, pHandles, FALSE, 20, TRUE);
return rc;
}
@@ -512,7 +510,7 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam switch (msg)
{
case WM_INITDIALOG:
- TranslateDialogDefault( hwnd );
+ TranslateDialogDefault(hwnd);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETRANGE, 0, MAKELPARAM(0, MIRANDA_PROCESS_WAIT_STEPS));
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETSTEP, 1, 0);
@@ -520,9 +518,9 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam break;
case WM_TIMER:
- if (SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_STEPIT, 0, 0) == MIRANDA_PROCESS_WAIT_STEPS)
+ if ( SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_STEPIT, 0, 0) == MIRANDA_PROCESS_WAIT_STEPS)
EndDialog(hwnd, 0);
- if (WaitForSingleObject((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1) != WAIT_TIMEOUT)
+ if ( WaitForSingleObject((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1) != WAIT_TIMEOUT)
{
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETPOS, MIRANDA_PROCESS_WAIT_STEPS, 0);
EndDialog(hwnd, 0);
@@ -530,7 +528,7 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam break;
case WM_COMMAND:
- if (HIWORD(wParam) == IDCANCEL)
+ if ( HIWORD(wParam) == IDCANCEL)
{
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETPOS, MIRANDA_PROCESS_WAIT_STEPS, 0);
EndDialog(hwnd, 0);
@@ -543,17 +541,17 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam void ParseCommandLine()
{
char* cmdline = GetCommandLineA();
- char* p = strstr( cmdline, "/restart:" );
- if ( p ) {
- HANDLE hProcess = OpenProcess( SYNCHRONIZE, FALSE, atol( p+9 ));
- if ( hProcess ) {
+ char* p = strstr(cmdline, "/restart:");
+ if (p) {
+ HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, atol(p+9));
+ if (hProcess) {
DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_WAITRESTART), NULL, WaitForProcessDlgProc, (LPARAM)hProcess);
- CloseHandle( hProcess );
+ CloseHandle(hProcess);
}
}
}
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int )
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
DWORD myPid=0;
int messageloop=1;
@@ -565,7 +563,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) setlocale(LC_ALL, "");
#ifdef _DEBUG
- _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
hUser32 = GetModuleHandleA("user32");
@@ -583,8 +581,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) hShFolder = GetModuleHandleA("shell32");
shGetSpecialFolderPathA = (pfnSHGetSpecialFolderPathA)GetProcAddress(hShFolder, "SHGetSpecialFolderPathA");
shGetSpecialFolderPathW = (pfnSHGetSpecialFolderPathW)GetProcAddress(hShFolder, "SHGetSpecialFolderPathW");
- if (shGetSpecialFolderPathA == NULL)
- {
+ if (shGetSpecialFolderPathA == NULL) {
hShFolder = LoadLibraryA("ShFolder.dll");
shGetSpecialFolderPathA = (pfnSHGetSpecialFolderPathA)GetProcAddress(hShFolder, "SHGetSpecialFolderPathA");
shGetSpecialFolderPathW = (pfnSHGetSpecialFolderPathW)GetProcAddress(hShFolder, "SHGetSpecialFolderPathW");
@@ -592,7 +589,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) shAutoComplete = (pfnSHAutoComplete)GetProcAddress(GetModuleHandleA("shlwapi"), "SHAutoComplete");
- if (IsWinVerXPPlus()) {
+ if ( IsWinVerXPPlus()) {
hThemeAPI = LoadLibraryA("uxtheme.dll");
if (hThemeAPI) {
openThemeData = (pfnOpenThemeData)GetProcAddress(hThemeAPI, "OpenThemeData");
@@ -616,7 +613,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) }
}
- if (IsWinVerVistaPlus()) {
+ if ( IsWinVerVistaPlus()) {
hDwmApi = LoadLibraryA("dwmapi.dll");
if (hDwmApi) {
dwmExtendFrameIntoClientArea = (pfnDwmExtendFrameIntoClientArea)GetProcAddress(hDwmApi, "DwmExtendFrameIntoClientArea");
@@ -630,17 +627,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) MyWSAStringToAddress = (LPFN_WSASTRINGTOADDRESSA)GetProcAddress(hWinSock, "WSAStringToAddressA");
MyWSAAddressToString = (LPFN_WSAADDRESSTOSTRINGA)GetProcAddress(hWinSock, "WSAAddressToStringA");
- if (bufferedPaintInit) bufferedPaintInit();
+ if (bufferedPaintInit)
+ bufferedPaintInit();
OleInitialize(NULL);
- if (IsWinVer7Plus())
+ if ( IsWinVer7Plus())
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
InitialiseModularEngine();
// ParseCommandLine();
- if (LoadDefaultModules()) {
+ if ( LoadDefaultModules()) {
NotifyEventHooks(hShutdownEvent, 0, 0);
UnloadDefaultModules();
@@ -662,27 +660,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) DWORD rc;
BOOL dying=FALSE;
rc=MsgWaitForMultipleObjectsExWorkaround(waitObjectCount, hWaitObjects, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
- if ( rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0 + waitObjectCount) {
+ if (rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0 + waitObjectCount) {
rc -= WAIT_OBJECT_0;
CallService(pszWaitServices[rc], (WPARAM) hWaitObjects[rc], 0);
}
//
- while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
- if ( msg.message != WM_QUIT ) {
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (msg.message != WM_QUIT) {
HWND h=GetForegroundWindow();
DWORD pid = 0;
checkIdle(&msg);
- if ( h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid &&
- GetClassLongPtr(h, GCW_ATOM) == 32770 )
- {
- if ( IsDialogMessage(h, &msg) )
+ if (h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid && GetClassLongPtr(h, GCW_ATOM) == 32770)
+ if (IsDialogMessage(h, &msg))
continue;
- }
+
TranslateMessage(&msg);
DispatchMessage(&msg);
- if ( SetIdleCallback != NULL )
+ if (SetIdleCallback != NULL)
SetIdleCallback();
- } else if ( !dying ) {
+ }
+ else if ( !dying) {
dying++;
SetEvent(hMirandaShutdown);
NotifyEventHooks(hPreShutdownEvent, 0, 0);
@@ -692,10 +689,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) NotifyEventHooks(hShutdownEvent, 0, 0);
// if the hooks generated any messages, it'll get processed before the second WM_QUIT
PostQuitMessage(0);
- } else if ( dying ) {
- messageloop=0;
}
- } // while
+ else if (dying)
+ messageloop=0;
+ }
}
exit:
@@ -761,10 +758,10 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) pVerInfo=mir_alloc(verInfoSize);
GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
VerQueryValue(pVerInfo, _T("\\StringFileInfo\\000004b0\\ProductVersion"), (LPVOID*)&productVersion, &blockSize);
- #if defined( _WIN64 )
- mir_snprintf(( char* )lParam, wParam, "%S x64 Unicode", productVersion );
+ #if defined(_WIN64)
+ mir_snprintf((char*)lParam, wParam, "%S x64 Unicode", productVersion);
#else
- mir_snprintf(( char* )lParam, wParam, "%S Unicode", productVersion );
+ mir_snprintf((char*)lParam, wParam, "%S Unicode", productVersion);
#endif
mir_free(pVerInfo);
return 0;
@@ -772,9 +769,11 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) INT_PTR WaitOnHandle(WPARAM wParam, LPARAM lParam)
{
- if (waitObjectCount>=MAXIMUM_WAIT_OBJECTS-1) return 1;
- hWaitObjects[waitObjectCount]=(HANDLE)wParam;
- pszWaitServices[waitObjectCount]=(char*)lParam;
+ if (waitObjectCount>=MAXIMUM_WAIT_OBJECTS-1)
+ return 1;
+
+ hWaitObjects[waitObjectCount] = (HANDLE)wParam;
+ pszWaitServices[waitObjectCount] = (char*)lParam;
waitObjectCount++;
return 0;
}
@@ -786,7 +785,10 @@ static INT_PTR RemoveWait(WPARAM wParam, LPARAM) for (i=0;i<waitObjectCount;i++)
if (hWaitObjects[i] == (HANDLE)wParam)
break;
- if (i == waitObjectCount) return 1;
+
+ if (i == waitObjectCount)
+ return 1;
+
waitObjectCount--;
MoveMemory(&hWaitObjects[i], &hWaitObjects[i+1], sizeof(HANDLE)*(waitObjectCount-i));
MoveMemory(&pszWaitServices[i], &pszWaitServices[i+1], sizeof(char*)*(waitObjectCount-i));
@@ -796,14 +798,14 @@ static INT_PTR RemoveWait(WPARAM wParam, LPARAM) INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam)
{
struct MM_INTERFACE *mmi = (struct MM_INTERFACE*) lParam;
- if ( mmi == NULL )
+ if (mmi == NULL)
return 1;
mmi->mmi_malloc = mir_alloc;
mmi->mmi_realloc = mir_realloc;
mmi->mmi_free = mir_free;
- switch( mmi->cbSize ) {
+ switch(mmi->cbSize) {
case sizeof(struct MM_INTERFACE):
mmi->mir_snprintf = mir_snprintf;
mmi->mir_sntprintf = mir_sntprintf;
@@ -825,7 +827,7 @@ INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam) break;
default:
-#if defined( _DEBUG )
+#if defined(_DEBUG)
DebugBreak();
#endif
return 1;
@@ -837,7 +839,7 @@ INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam) INT_PTR GetListInterface(WPARAM, LPARAM lParam)
{
struct LIST_INTERFACE *li = (struct LIST_INTERFACE*) lParam;
- if ( li == NULL )
+ if (li == NULL)
return 1;
switch(li->cbSize) {
@@ -865,13 +867,13 @@ INT_PTR GetListInterface(WPARAM, LPARAM lParam) INT_PTR GetUtfInterface(WPARAM, LPARAM lParam)
{
struct UTF8_INTERFACE *utfi = (struct UTF8_INTERFACE*) lParam;
- if ( utfi == NULL )
+ if (utfi == NULL)
return 1;
- switch( utfi->cbSize ) {
+ switch(utfi->cbSize) {
case UTF8_INTERFACE_SIZEOF_V1:
case UTF8_INTERFACE_SIZEOF_V2:
- case sizeof( struct UTF8_INTERFACE ):
+ case sizeof(struct UTF8_INTERFACE):
break;
default:
@@ -898,7 +900,7 @@ int LoadSystemModule(void) icce.dwICC = ICC_WIN95_CLASSES | ICC_USEREX_CLASSES;
InitCommonControlsEx(&icce);
- if (IsWinVerXPPlus()) {
+ if ( IsWinVerXPPlus()) {
hAPCWindow=CreateWindowEx(0, _T("ComboLBox"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
SetClassLongPtr(hAPCWindow, GCL_STYLE, GetClassLongPtr(hAPCWindow, GCL_STYLE) | CS_DROPSHADOW);
DestroyWindow(hAPCWindow);
diff --git a/src/core/miranda.h b/src/core/miranda.h index 3488c4ddd7..8f747ee86b 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -21,6 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define OPTIONPAGE_OLD_SIZE offsetof(OPTIONSDIALOGPAGE,hLangpack)
+
#define NEWSTR_ALLOCA(A) (A == NULL)?NULL:strcpy((char*)alloca(strlen(A)+1), A)
#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1)* sizeof(TCHAR)), A)
@@ -39,8 +41,8 @@ extern pfnMyGetMonitorInfo MyGetMonitorInfo; typedef HRESULT (STDAPICALLTYPE *pfnSHAutoComplete)(HWND, DWORD);
extern pfnSHAutoComplete shAutoComplete;
-typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL );
-typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL );
+typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
+typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
extern pfnSHGetSpecialFolderPathA shGetSpecialFolderPathA;
extern pfnSHGetSpecialFolderPathW shGetSpecialFolderPathW;
@@ -58,19 +60,19 @@ extern pfnAnimateWindow animateWindow; typedef BOOL (WINAPI * pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
extern pfnSetLayeredWindowAttributes setLayeredWindowAttributes;
-typedef HTHEME ( STDAPICALLTYPE *pfnOpenThemeData )( HWND, LPCWSTR );
-typedef HRESULT ( STDAPICALLTYPE *pfnIsThemeBackgroundPartiallyTransparent )( HTHEME, int, int );
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeParentBackground )( HWND, HDC, const RECT * );
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeBackground )( HTHEME, HDC, int, int, const RECT *, const RECT * );
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeText)( HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *);
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeTextEx)( HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const struct _DTTOPTS * );
-typedef HRESULT ( STDAPICALLTYPE *pfnGetThemeBackgroundContentRect)( HTHEME, HDC, int, int, LPCRECT, LPRECT );
-typedef HRESULT ( STDAPICALLTYPE *pfnGetThemeFont)( HTHEME, HDC, int, int, int, LOGFONT * );
-typedef HRESULT ( STDAPICALLTYPE *pfnCloseThemeData )( HTHEME );
-typedef HRESULT ( STDAPICALLTYPE *pfnEnableThemeDialogTexture )( HWND hwnd, DWORD dwFlags );
-typedef HRESULT ( STDAPICALLTYPE *pfnSetWindowTheme )( HWND, LPCWSTR, LPCWSTR );
-typedef HRESULT ( STDAPICALLTYPE *pfnSetWindowThemeAttribute )( HWND, enum WINDOWTHEMEATTRIBUTETYPE, PVOID, DWORD );
-typedef BOOL ( STDAPICALLTYPE *pfnIsThemeActive )();
+typedef HTHEME (STDAPICALLTYPE *pfnOpenThemeData)(HWND, LPCWSTR);
+typedef HRESULT (STDAPICALLTYPE *pfnIsThemeBackgroundPartiallyTransparent)(HTHEME, int, int);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeParentBackground)(HWND, HDC, const RECT *);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeBackground)(HTHEME, HDC, int, int, const RECT *, const RECT *);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeText)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeTextEx)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const struct _DTTOPTS *);
+typedef HRESULT (STDAPICALLTYPE *pfnGetThemeBackgroundContentRect)(HTHEME, HDC, int, int, LPCRECT, LPRECT);
+typedef HRESULT (STDAPICALLTYPE *pfnGetThemeFont)(HTHEME, HDC, int, int, int, LOGFONT *);
+typedef HRESULT (STDAPICALLTYPE *pfnCloseThemeData)(HTHEME);
+typedef HRESULT (STDAPICALLTYPE *pfnEnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags);
+typedef HRESULT (STDAPICALLTYPE *pfnSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
+typedef HRESULT (STDAPICALLTYPE *pfnSetWindowThemeAttribute)(HWND, enum WINDOWTHEMEATTRIBUTETYPE, PVOID, DWORD);
+typedef BOOL (STDAPICALLTYPE *pfnIsThemeActive)();
typedef HRESULT (STDAPICALLTYPE *pfnBufferedPaintInit)(void);
typedef HRESULT (STDAPICALLTYPE *pfnBufferedPaintUninit)(void);
typedef HANDLE (STDAPICALLTYPE *pfnBeginBufferedPaint)(HDC, RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *);
@@ -98,8 +100,8 @@ extern pfnGetBufferedPaintBits getBufferedPaintBits; extern ITaskbarList3 * pTaskbarInterface;
-typedef HRESULT ( STDAPICALLTYPE *pfnDwmExtendFrameIntoClientArea )( HWND hwnd, const MARGINS *margins );
-typedef HRESULT ( STDAPICALLTYPE *pfnDwmIsCompositionEnabled )( BOOL * );
+typedef HRESULT (STDAPICALLTYPE *pfnDwmExtendFrameIntoClientArea)(HWND hwnd, const MARGINS *margins);
+typedef HRESULT (STDAPICALLTYPE *pfnDwmIsCompositionEnabled)(BOOL *);
extern pfnDwmExtendFrameIntoClientArea dwmExtendFrameIntoClientArea;
extern pfnDwmIsCompositionEnabled dwmIsCompositionEnabled;
@@ -111,18 +113,18 @@ extern LPFN_WSAADDRESSTOSTRINGA MyWSAAddressToString; /**** file.c ***************************************************************************/
-void PushFileEvent( HANDLE hContact, HANDLE hdbe, LPARAM lParam );
+void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam);
/**** memory.c *************************************************************************/
#ifdef _STATIC
-void* mir_alloc( size_t );
-void* mir_calloc( size_t );
-void* mir_realloc( void* ptr, size_t );
-void mir_free( void* ptr );
-char* mir_strdup( const char* str );
-WCHAR* mir_wstrdup( const WCHAR* str );
-char* mir_strndup( const char* str, size_t len );
+void* mir_alloc(size_t);
+void* mir_calloc(size_t);
+void* mir_realloc(void* ptr, size_t);
+void mir_free(void* ptr);
+char* mir_strdup(const char* str);
+WCHAR* mir_wstrdup(const WCHAR* str);
+char* mir_strndup(const char* str, size_t len);
int mir_snprintf(char *buffer, size_t count, const char* fmt, ...);
int mir_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...);
@@ -132,7 +134,7 @@ int mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va) WCHAR* mir_a2u_cp(const char* src, int codepage);
WCHAR* mir_a2u(const char* src);
char* mir_u2a_cp(const wchar_t* src, int codepage);
-char* mir_u2a( const wchar_t* src);
+char* mir_u2a(const wchar_t* src);
#endif
/**** miranda.c ************************************************************************/
@@ -144,19 +146,19 @@ extern pfnExceptionFilter pMirandaExceptFilter; /**** modules.c ************************************************************************/
int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-void KillModuleEventHooks( HINSTANCE );
-void KillModuleServices( HINSTANCE );
+void KillModuleEventHooks(HINSTANCE);
+void KillModuleServices(HINSTANCE);
-void KillObjectEventHooks( void* pObject );
-void KillObjectServices( void* pObject );
-void KillObjectThreads( void* pObject );
+void KillObjectEventHooks(void* pObject);
+void KillObjectServices(void* pObject);
+void KillObjectThreads(void* pObject);
/**** utf.c ****************************************************************************/
-char* Utf8Decode( char* str, wchar_t** ucs2 );
-char* Utf8DecodeCP( char* str, int codepage, wchar_t** ucs2 );
+char* Utf8Decode(char* str, wchar_t** ucs2);
+char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2);
-wchar_t* Utf8DecodeUcs2( const char* str );
+wchar_t* Utf8DecodeUcs2(const char* str);
__forceinline char* Utf8DecodeA(const char* src)
{
@@ -166,10 +168,10 @@ __forceinline char* Utf8DecodeA(const char* src) }
-char* Utf8Encode( const char* str );
-char* Utf8EncodeCP( const char* src, int codepage );
+char* Utf8Encode(const char* str);
+char* Utf8EncodeCP(const char* src, int codepage);
-char* Utf8EncodeUcs2( const wchar_t* str );
+char* Utf8EncodeUcs2(const wchar_t* str);
int Ucs2toUtf8Len(const wchar_t *src);
@@ -180,13 +182,13 @@ int Ucs2toUtf8Len(const wchar_t *src); int LangPackGetDefaultCodePage();
int LangPackGetDefaultLocale();
-TCHAR* LangPackPcharToTchar( const char* pszStr );
+TCHAR* LangPackPcharToTchar(const char* pszStr);
char* LangPackTranslateString(struct LangPackMuuid* pUuid, const char *szEnglish, const int W);
TCHAR* LangPackTranslateStringT(int hLangpack, const TCHAR* tszEnglish);
unsigned int __fastcall hash(const void * key, unsigned int len);
-#pragma optimize( "gt", on )
+#pragma optimize("gt", on)
__inline unsigned int hashstr(const char * key)
{
if (key == NULL) return 0;
@@ -200,14 +202,14 @@ __inline unsigned int hashstr(const wchar_t * key) const unsigned int len = (unsigned int)wcslen((const wchar_t*)key);
return hash(key, len * sizeof(wchar_t));
}
-#pragma optimize( "", on )
+#pragma optimize("", on)
/**** path.c ***************************************************************************/
int pathToAbsolute(const char *pSrc, char *pOut, char* base);
-void CreatePathToFile( char* wszFilePath );
+void CreatePathToFile(char* wszFilePath);
int CreateDirectoryTree(const char *szDir);
-void CreatePathToFileW( WCHAR* wszFilePath );
+void CreatePathToFileW(WCHAR* wszFilePath);
int CreateDirectoryTreeW(const WCHAR *szDir);
int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base);
#define pathToAbsoluteT pathToAbsoluteW
@@ -216,17 +218,17 @@ int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base); /**** skin2icons.c *********************************************************************/
-HANDLE IcoLib_AddNewIcon( SKINICONDESC* sid );
-HICON IcoLib_GetIcon( const char* pszIconName, bool big );
-HICON IcoLib_GetIconByHandle( HANDLE hItem, bool big );
-HANDLE IcoLib_IsManaged( HICON hIcon );
-int IcoLib_ReleaseIcon( HICON hIcon, char* szIconName, bool big );
+HANDLE IcoLib_AddNewIcon(SKINICONDESC* sid);
+HICON IcoLib_GetIcon(const char* pszIconName, bool big);
+HICON IcoLib_GetIconByHandle(HANDLE hItem, bool big);
+HANDLE IcoLib_IsManaged(HICON hIcon);
+int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big);
/**** skinicons.c **********************************************************************/
-HICON LoadSkinProtoIcon( const char* szProto, int status, bool big = false );
-HICON LoadSkinIcon( int idx, bool big = false );
-HANDLE GetSkinIconHandle( int idx );
+HICON LoadSkinProtoIcon(const char* szProto, int status, bool big = false);
+HICON LoadSkinIcon(int idx, bool big = false);
+HANDLE GetSkinIconHandle(int idx);
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared);
int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource);
@@ -255,7 +257,7 @@ extern const int statusModeList[ MAX_STATUS_COUNT ]; extern const int skinIconStatusList[ MAX_STATUS_COUNT ];
extern const int skinIconStatusFlags[ MAX_STATUS_COUNT ];
-int TryProcessDoubleClick( HANDLE hContact );
+int TryProcessDoubleClick(HANDLE hContact);
/**** protocols.c ***********************************************************************/
@@ -266,31 +268,31 @@ int TryProcessDoubleClick( HANDLE hContact ); extern LIST<PROTOACCOUNT> accounts;
-PROTOACCOUNT* __fastcall Proto_GetAccount( const char* accName );
-PROTOACCOUNT* __fastcall Proto_GetAccount( HANDLE hContact );
-PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded( const char* szProtoName );
+PROTOACCOUNT* __fastcall Proto_GetAccount(const char* accName);
+PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact);
+PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char* szProtoName);
-bool __fastcall Proto_IsAccountEnabled( PROTOACCOUNT* pa );
-bool __fastcall Proto_IsAccountLocked( PROTOACCOUNT* pa );
+bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT* pa);
+bool __fastcall Proto_IsAccountLocked(PROTOACCOUNT* pa);
-PROTO_INTERFACE* AddDefaultAccount( const char* szProtoName );
-int FreeDefaultAccount( PROTO_INTERFACE* ppi );
+PROTO_INTERFACE* AddDefaultAccount(const char* szProtoName);
+int FreeDefaultAccount(PROTO_INTERFACE* ppi);
-BOOL ActivateAccount( PROTOACCOUNT* pa );
-void EraseAccount( const char* pszProtoName );
-void DeactivateAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase );
-void UnloadAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase );
-void OpenAccountOptions( PROTOACCOUNT* pa );
+BOOL ActivateAccount(PROTOACCOUNT* pa);
+void EraseAccount(const char* pszProtoName);
+void DeactivateAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase);
+void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase);
+void OpenAccountOptions(PROTOACCOUNT* pa);
-void LoadDbAccounts( void );
-void WriteDbAccounts( void );
+void LoadDbAccounts(void);
+void WriteDbAccounts(void);
-INT_PTR CallProtoServiceInt( HANDLE hContact, const char* szModule, const char* szService, WPARAM, LPARAM );
-INT_PTR CallContactService( HANDLE hContact, const char *szProtoService, WPARAM, LPARAM );
+INT_PTR CallProtoServiceInt(HANDLE hContact, const char* szModule, const char* szService, WPARAM, LPARAM);
+INT_PTR CallContactService(HANDLE hContact, const char *szProtoService, WPARAM, LPARAM);
-__inline static INT_PTR CallProtoService( const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam )
+__inline static INT_PTR CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam)
{
- return CallProtoServiceInt( NULL, szModule, szService, wParam, lParam );
+ return CallProtoServiceInt(NULL, szModule, szService, wParam, lParam);
}
/**** utils.c **************************************************************************/
@@ -305,7 +307,7 @@ __inline char* lrtrimp(char* str) { return ltrimp(rtrim(str)); }; bool __fastcall wildcmp(char * name, char * mask);
void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key);
-WORD GetHotkeyValue( INT_PTR idHotkey );
+WORD GetHotkeyValue(INT_PTR idHotkey);
HBITMAP ConvertIconToBitmap(HICON hIcon, HIMAGELIST hIml, int iconId);
@@ -315,10 +317,10 @@ private: wchar_t* m_body;
public:
- StrConvUT( const char* pSrc ) :
- m_body( mir_a2u( pSrc )) {}
+ StrConvUT(const char* pSrc) :
+ m_body(mir_a2u(pSrc)) {}
- ~StrConvUT() { mir_free( m_body ); }
+ ~StrConvUT() { mir_free(m_body); }
operator const wchar_t* () const { return m_body; }
};
@@ -328,18 +330,18 @@ private: char* m_body;
public:
- StrConvAT( const wchar_t* pSrc ) :
- m_body( mir_u2a( pSrc )) {}
+ StrConvAT(const wchar_t* pSrc) :
+ m_body(mir_u2a(pSrc)) {}
- ~StrConvAT() { mir_free( m_body ); }
+ ~StrConvAT() { mir_free(m_body); }
operator const char* () const { return m_body; }
- operator const wchar_t* () const { return ( wchar_t* )m_body; } // type cast to fake the interface definition
- operator const LPARAM () const { return ( LPARAM )m_body; }
+ operator const wchar_t* () const { return (wchar_t*)m_body; } // type cast to fake the interface definition
+ operator const LPARAM () const { return (LPARAM)m_body; }
};
-#define StrConvT( x ) StrConvUT( x )
-#define StrConvTu( x ) x
-#define StrConvA( x ) StrConvAT( x )
-#define StrConvU( x ) x
+#define StrConvT(x) StrConvUT(x)
+#define StrConvTu(x) x
+#define StrConvA(x) StrConvAT(x)
+#define StrConvU(x) x
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 43ac51ce78..ba846d0fd4 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -25,12 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // list of hooks
-static int compareHooks( const THook* p1, const THook* p2 )
+static int compareHooks(const THook* p1, const THook* p2)
{
- return strcmp( p1->name, p2->name );
+ return strcmp(p1->name, p2->name);
}
-static LIST<THook> hooks( 50, compareHooks );
+static LIST<THook> hooks(50, compareHooks);
struct THookToMainThreadItem
{
@@ -59,7 +59,7 @@ struct TService char name[1];
};
-LIST<TService> services( 100, NumericKeySortT );
+LIST<TService> services(100, NumericKeySortT);
typedef struct
{
@@ -80,9 +80,9 @@ static HANDLE hMainThread; static HANDLE hMissingService;
static THook *pLastHook = NULL;
-HINSTANCE GetInstByAddress( void* codePtr );
+HINSTANCE GetInstByAddress(void* codePtr);
-void LangPackDropUnusedItems( void );
+void LangPackDropUnusedItems(void);
void ParseCommandLine(); // core: IDD_WAITRESTART
int LoadSystemModule(void); // core: m_system.h services
@@ -152,23 +152,23 @@ int LoadDescButtonModule(); int LoadDefaultModules(void)
{
//load order is very important for these
- if (LoadSystemModule()) return 1;
- if (LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
+ if ( LoadSystemModule()) return 1;
+ if ( LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
ParseCommandLine(); // IDD_WAITRESTART need langpack so this is moved here
- if (LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
- if (LoadIcoTabsModule()) return 1;
- if (LoadHeaderbarModule()) return 1;
- if (LoadNewPluginsModuleInfos()) return 1;
+ if ( LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
+ if ( LoadIcoTabsModule()) return 1;
+ if ( LoadHeaderbarModule()) return 1;
+ if ( LoadNewPluginsModuleInfos()) return 1;
// database is available here
- if (LoadButtonModule()) return 1;
- if (LoadIcoLibModule()) return 1;
- if (LoadSkinIcons()) return 1;
+ if ( LoadButtonModule()) return 1;
+ if ( LoadIcoLibModule()) return 1;
+ if ( LoadSkinIcons()) return 1;
-// if (LoadErrorsModule()) return 1;
+// if ( LoadErrorsModule()) return 1;
bServiceMode = LoadServiceModePlugin();
- switch ( bServiceMode )
+ switch (bServiceMode)
{
case 1: return 0; // stop loading here
case 0: break;
@@ -178,43 +178,43 @@ int LoadDefaultModules(void) //this info will be available at LoadNewPluginsModule()
INT_PTR *disableDefaultModule=(INT_PTR*)CallService(MS_PLUGINS_GETDISABLEDEFAULTARRAY, 0, 0);
- if (LoadSkinSounds()) return 1;
- if (LoadSkinHotkeys()) return 1;
- if (LoadFontserviceModule()) return 1;
+ if ( LoadSkinSounds()) return 1;
+ if ( LoadSkinHotkeys()) return 1;
+ if ( LoadFontserviceModule()) return 1;
- if (LoadDescButtonModule()) return 1;
- if (LoadOptionsModule()) return 1;
- if (LoadNetlibModule()) return 1;
- if (LoadProtocolsModule()) return 1;
+ if ( LoadDescButtonModule()) return 1;
+ if ( LoadOptionsModule()) return 1;
+ if ( LoadNetlibModule()) return 1;
+ if ( LoadProtocolsModule()) return 1;
LoadDbAccounts(); // retrieves the account array from a database
- if (LoadContactsModule()) return 1;
- if (LoadContactListModule()) return 1;
- if (LoadAddContactModule()) return 1;
- if (LoadNewPluginsModule()) return 1; // will call Load() on everything, clist will load first
+ if ( LoadContactsModule()) return 1;
+ if ( LoadContactListModule()) return 1;
+ if ( LoadAddContactModule()) return 1;
+ if ( LoadNewPluginsModule()) return 1; // will call Load() on everything, clist will load first
LangPackDropUnusedItems();
- if (!disableDefaultModule[DEFMOD_SSL]) if (LoadSslModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SSL]) if (LoadSslModule()) return 1;
NetlibInitSsl();
if (LoadAccountsModule()) return 1;
//order becomes less important below here
- if (!disableDefaultModule[DEFMOD_UIFINDADD]) if (LoadFindAddModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIUSERINFO]) if (LoadUserInfoModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRURL]) if (LoadSendRecvUrlModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SREMAIL]) if (LoadSendRecvEMailModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRAUTH]) if (LoadSendRecvAuthModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRFILE]) if (LoadSendRecvFileModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIHELP]) if (LoadHelpModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIHISTORY]) if (LoadHistoryModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDIDLE]) if (LoadIdleModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDAUTOAWAY]) if (LoadAutoAwayModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDUSERONLINE]) if (LoadUserOnlineModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRAWAY]) if (LoadAwayMsgModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDIGNORE]) if (LoadIgnoreModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIVISIBILITY]) if (LoadVisibilityModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UPDATENOTIFY]) if (LoadUpdateNotifyModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIFINDADD]) if (LoadFindAddModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIUSERINFO]) if (LoadUserInfoModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRURL]) if (LoadSendRecvUrlModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SREMAIL]) if (LoadSendRecvEMailModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRAUTH]) if (LoadSendRecvAuthModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRFILE]) if (LoadSendRecvFileModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIHELP]) if (LoadHelpModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIHISTORY]) if (LoadHistoryModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDIDLE]) if (LoadIdleModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDAUTOAWAY]) if (LoadAutoAwayModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDUSERONLINE]) if (LoadUserOnlineModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRAWAY]) if (LoadAwayMsgModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDIGNORE]) if (LoadIgnoreModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIVISIBILITY]) if (LoadVisibilityModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UPDATENOTIFY]) if (LoadUpdateNotifyModule()) return 1;
return 0;
}
@@ -255,26 +255,26 @@ void DestroyModularEngine(void) {
int i;
THook* p;
- EnterCriticalSection( &csHooks );
- for ( i=0; i < hooks.getCount(); i++ ) {
+ EnterCriticalSection(&csHooks);
+ for (i=0; i < hooks.getCount(); i++) {
p = hooks[i];
- if ( p->subscriberCount )
- mir_free( p->subscriber );
- DeleteCriticalSection( &p->csHook );
- mir_free( p );
+ if (p->subscriberCount)
+ mir_free(p->subscriber);
+ DeleteCriticalSection(&p->csHook);
+ mir_free(p);
}
hooks.destroy();
- LeaveCriticalSection( &csHooks );
- DeleteCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
+ DeleteCriticalSection(&csHooks);
- EnterCriticalSection( &csServices );
- for ( i=0; i < services.getCount(); i++ )
- mir_free( services[i] );
+ EnterCriticalSection(&csServices);
+ for (i=0; i < services.getCount(); i++)
+ mir_free(services[i]);
services.destroy();
- LeaveCriticalSection( &csServices );
- DeleteCriticalSection( &csServices );
- CloseHandle( hMainThread );
+ LeaveCriticalSection(&csServices);
+ DeleteCriticalSection(&csServices);
+ CloseHandle(hMainThread);
}
///////////////////////////////HOOKS
@@ -284,61 +284,61 @@ HANDLE CreateHookableEvent(const char *name) THook* ret;
int idx;
- if ( name == NULL )
+ if (name == NULL)
return NULL;
- EnterCriticalSection( &csHooks );
- if (( idx = hooks.getIndex(( THook* )name )) != -1 ) {
- LeaveCriticalSection( &csHooks );
+ EnterCriticalSection(&csHooks);
+ if ((idx = hooks.getIndex((THook*)name)) != -1) {
+ LeaveCriticalSection(&csHooks);
return NULL;
}
- ret = ( THook* )mir_alloc( sizeof( THook ));
- strncpy( ret->name, name, sizeof( ret->name )); ret->name[ MAXMODULELABELLENGTH-1 ] = 0;
+ ret = (THook*)mir_alloc(sizeof(THook));
+ strncpy(ret->name, name, sizeof(ret->name)); ret->name[ MAXMODULELABELLENGTH-1 ] = 0;
ret->id = hookId++;
ret->subscriberCount = 0;
ret->subscriber = NULL;
ret->pfnHook = NULL;
- InitializeCriticalSection( &ret->csHook );
- hooks.insert( ret );
+ InitializeCriticalSection(&ret->csHook);
+ hooks.insert(ret);
- LeaveCriticalSection( &csHooks );
- return ( HANDLE )ret;
+ LeaveCriticalSection(&csHooks);
+ return (HANDLE)ret;
}
-int DestroyHookableEvent( HANDLE hEvent )
+int DestroyHookableEvent(HANDLE hEvent)
{
int idx;
THook* p;
- EnterCriticalSection( &csHooks );
- if ( pLastHook == ( THook* )hEvent )
+ EnterCriticalSection(&csHooks);
+ if (pLastHook == (THook*)hEvent)
pLastHook = NULL;
- if (( idx = hooks.getIndex(( THook* )hEvent )) == -1 ) {
+ if ((idx = hooks.getIndex((THook*)hEvent)) == -1) {
LeaveCriticalSection(&csHooks);
return 1;
}
p = hooks[idx];
- if ( p->subscriberCount ) {
- mir_free( p->subscriber );
+ if (p->subscriberCount) {
+ mir_free(p->subscriber);
p->subscriber = NULL;
p->subscriberCount = 0;
}
- hooks.remove( idx );
- DeleteCriticalSection( &p->csHook );
- mir_free( p );
+ hooks.remove(idx);
+ DeleteCriticalSection(&p->csHook);
+ mir_free(p);
- LeaveCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
return 0;
}
int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook)
{
- THook* p = ( THook* )hEvent;
+ THook* p = (THook*)hEvent;
EnterCriticalSection(&csHooks);
- if ( hooks.getIndex( p ) != -1 )
+ if (hooks.getIndex(p) != -1)
p->pfnHook = pfnHook;
LeaveCriticalSection(&csHooks);
return 0;
@@ -347,125 +347,125 @@ int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook) int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
int returnVal = 0;
- THook* p = ( THook* )hEvent;
- if ( p == NULL )
+ THook* p = (THook*)hEvent;
+ if (p == NULL)
return -1;
- EnterCriticalSection( &p->csHook );
- for ( int i = 0; i < p->subscriberCount; i++ ) {
+ EnterCriticalSection(&p->csHook);
+ for (int i = 0; i < p->subscriberCount; i++) {
THookSubscriber* s = &p->subscriber[i];
- if ( s->hOwner != hInst )
+ if (s->hOwner != hInst)
continue;
- switch ( s->type ) {
- case 1: returnVal = s->pfnHook( wParam, lParam ); break;
- case 2: returnVal = s->pfnHookParam( wParam, lParam, s->lParam ); break;
- case 3: returnVal = s->pfnHookObj( s->object, wParam, lParam ); break;
- case 4: returnVal = s->pfnHookObjParam( s->object, wParam, lParam, s->lParam ); break;
- case 5: returnVal = SendMessage( s->hwnd, s->message, wParam, lParam ); break;
+ switch (s->type) {
+ case 1: returnVal = s->pfnHook(wParam, lParam); break;
+ case 2: returnVal = s->pfnHookParam(wParam, lParam, s->lParam); break;
+ case 3: returnVal = s->pfnHookObj(s->object, wParam, lParam); break;
+ case 4: returnVal = s->pfnHookObjParam(s->object, wParam, lParam, s->lParam); break;
+ case 5: returnVal = SendMessage(s->hwnd, s->message, wParam, lParam); break;
default: continue;
}
- if ( returnVal )
+ if (returnVal)
break;
}
- if ( p->subscriberCount == 0 && p->pfnHook != 0 )
- returnVal = p->pfnHook( wParam, lParam );
+ if (p->subscriberCount == 0 && p->pfnHook != 0)
+ returnVal = p->pfnHook(wParam, lParam);
- LeaveCriticalSection( &p->csHook );
+ LeaveCriticalSection(&p->csHook);
return returnVal;
}
int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
int returnVal = 0;
- THook* p = ( THook* )hEvent;
- if ( p == NULL )
+ THook* p = (THook*)hEvent;
+ if (p == NULL)
return -1;
- EnterCriticalSection( &p->csHook );
+ EnterCriticalSection(&p->csHook);
// NOTE: We've got the critical section while all this lot are called. That's mostly safe, though.
- for ( int i = 0; i < p->subscriberCount; i++ ) {
+ for (int i = 0; i < p->subscriberCount; i++) {
THookSubscriber* s = &p->subscriber[i];
- switch ( s->type ) {
- case 1: returnVal = s->pfnHook( wParam, lParam ); break;
- case 2: returnVal = s->pfnHookParam( wParam, lParam, s->lParam ); break;
- case 3: returnVal = s->pfnHookObj( s->object, wParam, lParam ); break;
- case 4: returnVal = s->pfnHookObjParam( s->object, wParam, lParam, s->lParam ); break;
- case 5: returnVal = SendMessage( s->hwnd, s->message, wParam, lParam ); break;
+ switch (s->type) {
+ case 1: returnVal = s->pfnHook(wParam, lParam); break;
+ case 2: returnVal = s->pfnHookParam(wParam, lParam, s->lParam); break;
+ case 3: returnVal = s->pfnHookObj(s->object, wParam, lParam); break;
+ case 4: returnVal = s->pfnHookObjParam(s->object, wParam, lParam, s->lParam); break;
+ case 5: returnVal = SendMessage(s->hwnd, s->message, wParam, lParam); break;
default: continue;
}
- if ( returnVal )
+ if (returnVal)
break;
}
// check for no hooks and call the default hook if any
- if ( p->subscriberCount == 0 && p->pfnHook != 0 )
- returnVal = p->pfnHook( wParam, lParam );
+ if (p->subscriberCount == 0 && p->pfnHook != 0)
+ returnVal = p->pfnHook(wParam, lParam);
- LeaveCriticalSection( &p->csHook );
+ LeaveCriticalSection(&p->csHook);
return returnVal;
}
-static int checkHook( HANDLE hHook )
+static int checkHook(HANDLE hHook)
{
- if ( hHook == NULL )
+ if (hHook == NULL)
return -1;
- EnterCriticalSection( &csHooks );
- if ( pLastHook != hHook || !pLastHook ) {
- if ( hooks.getIndex(( THook* )hHook ) == -1 ) {
- LeaveCriticalSection( &csHooks );
+ EnterCriticalSection(&csHooks);
+ if (pLastHook != hHook || !pLastHook) {
+ if (hooks.getIndex((THook*)hHook) == -1) {
+ LeaveCriticalSection(&csHooks);
return -1;
}
- pLastHook = ( THook* )hHook;
+ pLastHook = (THook*)hHook;
}
- LeaveCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
return 0;
}
static void CALLBACK HookToMainAPCFunc(ULONG_PTR dwParam)
{
- THookToMainThreadItem* item = ( THookToMainThreadItem* )dwParam;
+ THookToMainThreadItem* item = (THookToMainThreadItem*)dwParam;
- if ( checkHook( item->hook ) == -1 )
+ if (checkHook(item->hook) == -1)
item->result = -1;
else
- item->result = CallHookSubscribers( item->hook, item->wParam, item->lParam );
- SetEvent( item->hDoneEvent );
+ item->result = CallHookSubscribers(item->hook, item->wParam, item->lParam);
+ SetEvent(item->hDoneEvent);
}
-int NotifyEventHooks( HANDLE hEvent, WPARAM wParam, LPARAM lParam )
+int NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
extern HWND hAPCWindow;
- if ( GetCurrentThreadId() != mainThreadId ) {
+ if ( GetCurrentThreadId() != mainThreadId) {
THookToMainThreadItem item;
item.hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- item.hook = ( THook* )hEvent;
+ item.hook = (THook*)hEvent;
item.wParam = wParam;
item.lParam = lParam;
- QueueUserAPC( HookToMainAPCFunc, hMainThread, ( ULONG_PTR )&item );
- PostMessage( hAPCWindow, WM_NULL, 0, 0 ); // let it process APC even if we're in a common dialog
- WaitForSingleObject( item.hDoneEvent, INFINITE );
- CloseHandle( item.hDoneEvent );
+ QueueUserAPC(HookToMainAPCFunc, hMainThread, (ULONG_PTR)&item);
+ PostMessage(hAPCWindow, WM_NULL, 0, 0); // let it process APC even if we're in a common dialog
+ WaitForSingleObject(item.hDoneEvent, INFINITE);
+ CloseHandle(item.hDoneEvent);
return item.result;
}
- return ( checkHook( hEvent ) == -1 ) ? -1 : CallHookSubscribers( hEvent, wParam, lParam );
+ return (checkHook(hEvent) == -1) ? -1 : CallHookSubscribers(hEvent, wParam, lParam);
}
-static HANDLE HookEventInt( int type, const char* name, MIRANDAHOOK hookProc, void* object, LPARAM lParam )
+static HANDLE HookEventInt(int type, const char* name, MIRANDAHOOK hookProc, void* object, LPARAM lParam)
{
int idx;
THook* p;
HANDLE ret;
- EnterCriticalSection( &csHooks );
- if (( idx = hooks.getIndex(( THook* )name )) == -1 ) {
+ EnterCriticalSection(&csHooks);
+ if ((idx = hooks.getIndex((THook*)name)) == -1) {
#ifdef _DEBUG
OutputDebugStringA("Attempt to hook: \t");
OutputDebugStringA(name);
@@ -476,47 +476,47 @@ static HANDLE HookEventInt( int type, const char* name, MIRANDAHOOK hookProc, vo }
p = hooks[ idx ];
- p->subscriber = ( THookSubscriber* )mir_realloc( p->subscriber, sizeof( THookSubscriber )*( p->subscriberCount+1 ));
+ p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount+1));
p->subscriber[ p->subscriberCount ].type = type;
p->subscriber[ p->subscriberCount ].pfnHook = hookProc;
p->subscriber[ p->subscriberCount ].object = object;
p->subscriber[ p->subscriberCount ].lParam = lParam;
- p->subscriber[ p->subscriberCount ].hOwner = GetInstByAddress( hookProc );
+ p->subscriber[ p->subscriberCount ].hOwner = GetInstByAddress(hookProc);
p->subscriberCount++;
- ret = ( HANDLE )(( p->id << 16 ) | p->subscriberCount );
- LeaveCriticalSection( &csHooks );
+ ret = (HANDLE)((p->id << 16) | p->subscriberCount);
+ LeaveCriticalSection(&csHooks);
return ret;
}
-HANDLE HookEvent( const char* name, MIRANDAHOOK hookProc )
+HANDLE HookEvent(const char* name, MIRANDAHOOK hookProc)
{
- return HookEventInt( 1, name, hookProc, 0, 0 );
+ return HookEventInt(1, name, hookProc, 0, 0);
}
-HANDLE HookEventParam( const char* name, MIRANDAHOOKPARAM hookProc, LPARAM lParam )
+HANDLE HookEventParam(const char* name, MIRANDAHOOKPARAM hookProc, LPARAM lParam)
{
- return HookEventInt( 2, name, (MIRANDAHOOK)hookProc, 0, lParam );
+ return HookEventInt(2, name, (MIRANDAHOOK)hookProc, 0, lParam);
}
-HANDLE HookEventObj( const char* name, MIRANDAHOOKOBJ hookProc, void* object)
+HANDLE HookEventObj(const char* name, MIRANDAHOOKOBJ hookProc, void* object)
{
- return HookEventInt( 3, name, (MIRANDAHOOK)hookProc, object, 0 );
+ return HookEventInt(3, name, (MIRANDAHOOK)hookProc, object, 0);
}
-HANDLE HookEventObjParam( const char* name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam )
+HANDLE HookEventObjParam(const char* name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam)
{
- return HookEventInt( 4, name, (MIRANDAHOOK)hookProc, object, lParam );
+ return HookEventInt(4, name, (MIRANDAHOOK)hookProc, object, lParam);
}
-HANDLE HookEventMessage( const char* name, HWND hwnd, UINT message )
+HANDLE HookEventMessage(const char* name, HWND hwnd, UINT message)
{
int idx;
THook* p;
HANDLE ret;
- EnterCriticalSection( &csHooks );
- if (( idx = hooks.getIndex(( THook* )name )) == -1 ) {
+ EnterCriticalSection(&csHooks);
+ if ((idx = hooks.getIndex((THook*)name)) == -1) {
#ifdef _DEBUG
MessageBoxA(NULL, "Attempt to hook non-existant event", name, MB_OK);
#endif
@@ -525,93 +525,93 @@ HANDLE HookEventMessage( const char* name, HWND hwnd, UINT message ) }
p = hooks[ idx ];
- p->subscriber = ( THookSubscriber* )mir_realloc( p->subscriber, sizeof( THookSubscriber )*( p->subscriberCount+1 ));
+ p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount+1));
p->subscriber[ p->subscriberCount ].type = 5;
p->subscriber[ p->subscriberCount ].hwnd = hwnd;
p->subscriber[ p->subscriberCount ].message = message;
p->subscriberCount++;
- ret = ( HANDLE )(( p->id << 16 ) | p->subscriberCount );
- LeaveCriticalSection( &csHooks );
+ ret = (HANDLE)((p->id << 16) | p->subscriberCount);
+ LeaveCriticalSection(&csHooks);
return ret;
}
-int UnhookEvent( HANDLE hHook )
+int UnhookEvent(HANDLE hHook)
{
int i;
THook* p = NULL;
- int hookId = ( int )hHook >> 16;
- int subscriberId = (( int )hHook & 0xFFFF ) - 1;
+ int hookId = (int)hHook >> 16;
+ int subscriberId = ((int)hHook & 0xFFFF) - 1;
- if (hHook == NULL) return 0;
+ if (hHook == NULL) return 0;
- EnterCriticalSection( &csHooks );
- for ( i = 0; i < hooks.getCount(); i++ ) {
- if ( hooks[i]->id == hookId ) {
+ EnterCriticalSection(&csHooks);
+ for (i = 0; i < hooks.getCount(); i++) {
+ if (hooks[i]->id == hookId) {
p = hooks[i];
break;
} }
- if ( p == NULL ) {
- LeaveCriticalSection( &csHooks );
+ if (p == NULL) {
+ LeaveCriticalSection(&csHooks);
return 1;
}
- if ( subscriberId >= p->subscriberCount || subscriberId < 0 ) {
- LeaveCriticalSection( &csHooks );
+ if (subscriberId >= p->subscriberCount || subscriberId < 0) {
+ LeaveCriticalSection(&csHooks);
return 1;
}
p->subscriber[subscriberId].type = 0;
p->subscriber[subscriberId].pfnHook = NULL;
p->subscriber[subscriberId].hOwner = NULL;
- while ( p->subscriberCount && p->subscriber[p->subscriberCount-1].type == 0 )
+ while (p->subscriberCount && p->subscriber[p->subscriberCount-1].type == 0)
p->subscriberCount--;
- if ( p->subscriberCount == 0 ) {
- if ( p->subscriber ) mir_free( p->subscriber );
+ if (p->subscriberCount == 0) {
+ if (p->subscriber) mir_free(p->subscriber);
p->subscriber = NULL;
}
- LeaveCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
return 0;
}
-void KillModuleEventHooks( HINSTANCE hInst )
+void KillModuleEventHooks(HINSTANCE hInst)
{
int i, j;
EnterCriticalSection(&csHooks);
- for ( i = hooks.getCount()-1; i >= 0; i-- ) {
- if ( hooks[i]->subscriberCount == 0 )
+ for (i = hooks.getCount()-1; i >= 0; i--) {
+ if (hooks[i]->subscriberCount == 0)
continue;
- for ( j = hooks[i]->subscriberCount-1; j >= 0; j-- ) {
- if ( hooks[i]->subscriber[j].hOwner == hInst ) {
+ for (j = hooks[i]->subscriberCount-1; j >= 0; j--) {
+ if (hooks[i]->subscriber[j].hOwner == hInst) {
char szModuleName[ MAX_PATH ];
- GetModuleFileNameA( hooks[i]->subscriber[j].hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf( NULL, "A hook %08x for event '%s' was abnormally deleted because module '%s' didn't released it",
- hooks[i]->subscriber[j].pfnHook, hooks[i]->name, szModuleName );
- UnhookEvent(( HANDLE )(( hooks[i]->id << 16 ) + j + 1 ));
- if ( hooks[i]->subscriberCount == 0 )
+ GetModuleFileNameA(hooks[i]->subscriber[j].hOwner, szModuleName, sizeof(szModuleName));
+ Netlib_Logf(NULL, "A hook %08x for event '%s' was abnormally deleted because module '%s' didn't released it",
+ hooks[i]->subscriber[j].pfnHook, hooks[i]->name, szModuleName);
+ UnhookEvent((HANDLE)((hooks[i]->id << 16) + j + 1));
+ if (hooks[i]->subscriberCount == 0)
break;
} } }
LeaveCriticalSection(&csHooks);
}
-void KillObjectEventHooks( void* pObject )
+void KillObjectEventHooks(void* pObject)
{
int i, j;
EnterCriticalSection(&csHooks);
- for ( i = hooks.getCount()-1; i >= 0; i-- ) {
- if ( hooks[i]->subscriberCount == 0 )
+ for (i = hooks.getCount()-1; i >= 0; i--) {
+ if (hooks[i]->subscriberCount == 0)
continue;
- for ( j = hooks[i]->subscriberCount-1; j >= 0; j-- ) {
- if ( hooks[i]->subscriber[j].object == pObject ) {
- UnhookEvent(( HANDLE )(( hooks[i]->id << 16 ) + j + 1 ));
- if ( hooks[i]->subscriberCount == 0 )
+ for (j = hooks[i]->subscriberCount-1; j >= 0; j--) {
+ if (hooks[i]->subscriber[j].object == pObject) {
+ UnhookEvent((HANDLE)((hooks[i]->id << 16) + j + 1));
+ if (hooks[i]->subscriberCount == 0)
break;
} } }
@@ -620,69 +620,69 @@ void KillObjectEventHooks( void* pObject ) /////////////////////SERVICES
-static __inline TService* FindServiceByName( const char *name )
+static __inline TService* FindServiceByName(const char *name)
{
- unsigned hash = hashstr( name );
- return services.find(( TService* )&hash );
+ unsigned hash = hashstr(name);
+ return services.find((TService*)&hash);
}
-static HANDLE CreateServiceInt( int type, const char *name, MIRANDASERVICE serviceProc, void* object, LPARAM lParam)
+static HANDLE CreateServiceInt(int type, const char *name, MIRANDASERVICE serviceProc, void* object, LPARAM lParam)
{
- if ( name == NULL )
+ if (name == NULL)
return NULL;
TService tmp;
- tmp.nameHash = hashstr( name );
+ tmp.nameHash = hashstr(name);
- EnterCriticalSection( &csServices );
+ EnterCriticalSection(&csServices);
- if ( services.getIndex( &tmp ) != -1 ) {
- LeaveCriticalSection( &csServices );
+ if (services.getIndex(&tmp) != -1) {
+ LeaveCriticalSection(&csServices);
return NULL;
}
- TService* p = ( TService* )mir_alloc( sizeof( *p ) + strlen( name ));
- strcpy( p->name, name );
+ TService* p = (TService*)mir_alloc(sizeof(*p) + strlen(name));
+ strcpy(p->name, name);
p->nameHash = tmp.nameHash;
p->pfnService = serviceProc;
- p->hOwner = GetInstByAddress( serviceProc );
+ p->hOwner = GetInstByAddress(serviceProc);
p->flags = type;
p->lParam = lParam;
p->object = object;
- services.insert( p );
+ services.insert(p);
- LeaveCriticalSection( &csServices );
- return ( HANDLE )tmp.nameHash;
+ LeaveCriticalSection(&csServices);
+ return (HANDLE)tmp.nameHash;
}
-HANDLE CreateServiceFunction( const char *name, MIRANDASERVICE serviceProc )
+HANDLE CreateServiceFunction(const char *name, MIRANDASERVICE serviceProc)
{
- return CreateServiceInt( 0, name, serviceProc, 0, 0 );
+ return CreateServiceInt(0, name, serviceProc, 0, 0);
}
HANDLE CreateServiceFunctionParam(const char *name, MIRANDASERVICEPARAM serviceProc, LPARAM lParam)
{
- return CreateServiceInt( 1, name, (MIRANDASERVICE)serviceProc, 0, lParam );
+ return CreateServiceInt(1, name, (MIRANDASERVICE)serviceProc, 0, lParam);
}
HANDLE CreateServiceFunctionObj(const char *name, MIRANDASERVICEOBJ serviceProc, void* object)
{
- return CreateServiceInt( 2, name, (MIRANDASERVICE)serviceProc, object, 0 );
+ return CreateServiceInt(2, name, (MIRANDASERVICE)serviceProc, object, 0);
}
HANDLE CreateServiceFunctionObjParam(const char *name, MIRANDASERVICEOBJPARAM serviceProc, void* object, LPARAM lParam)
{
- return CreateServiceInt( 3, name, (MIRANDASERVICE)serviceProc, object, lParam );
+ return CreateServiceInt(3, name, (MIRANDASERVICE)serviceProc, object, lParam);
}
int DestroyServiceFunction(HANDLE hService)
{
int idx;
- EnterCriticalSection( &csServices );
- if (( idx = services.getIndex(( TService* )&hService )) != -1 ) {
- mir_free( services[idx] );
- services.remove( idx );
+ EnterCriticalSection(&csServices);
+ if ((idx = services.getIndex((TService*)&hService)) != -1) {
+ mir_free(services[idx]);
+ services.remove(idx);
}
LeaveCriticalSection(&csServices);
@@ -691,12 +691,12 @@ int DestroyServiceFunction(HANDLE hService) int ServiceExists(const char *name)
{
- if ( name == NULL )
+ if (name == NULL)
return FALSE;
- EnterCriticalSection( &csServices );
- int ret = FindServiceByName( name ) != NULL;
- LeaveCriticalSection( &csServices );
+ EnterCriticalSection(&csServices);
+ int ret = FindServiceByName(name) != NULL;
+ LeaveCriticalSection(&csServices);
return ret;
}
@@ -735,7 +735,7 @@ INT_PTR CallService(const char *name, WPARAM wParam, LPARAM lParam) LPARAM fnParam = pService->lParam;
void* object = pService->object;
LeaveCriticalSection(&csServices);
- switch( flags ) {
+ switch(flags) {
case 1: return ((MIRANDASERVICEPARAM)pfnService)(wParam, lParam, fnParam);
case 2: return ((MIRANDASERVICEOBJ)pfnService)(object, wParam, lParam);
case 3: return ((MIRANDASERVICEOBJPARAM)pfnService)(object, wParam, lParam, fnParam);
@@ -773,39 +773,39 @@ INT_PTR CallServiceSync(const char *name, WPARAM wParam, LPARAM lParam) return CallService(name, wParam, lParam);
}
-int CallFunctionAsync( void (__stdcall *func)(void *), void *arg)
+int CallFunctionAsync(void (__stdcall *func)(void *), void *arg)
{
extern HWND hAPCWindow;
- int r = QueueUserAPC(( void (__stdcall *)( ULONG_PTR ))func, hMainThread, ( ULONG_PTR )arg );
+ int r = QueueUserAPC((void (__stdcall *)(ULONG_PTR))func, hMainThread, (ULONG_PTR)arg);
PostMessage(hAPCWindow, WM_NULL, 0, 0);
return r;
}
-void KillModuleServices( HINSTANCE hInst )
+void KillModuleServices(HINSTANCE hInst)
{
int i;
EnterCriticalSection(&csServices);
- for ( i = services.getCount()-1; i >= 0; i-- ) {
- if ( services[i]->hOwner == hInst ) {
+ for (i = services.getCount()-1; i >= 0; i--) {
+ if (services[i]->hOwner == hInst) {
char szModuleName[ MAX_PATH ];
- GetModuleFileNameA( services[i]->hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf( NULL, "A service function '%s' was abnormally deleted because module '%s' didn't released it",
- services[i]->name, szModuleName );
- DestroyServiceFunction(( HANDLE )services[i]->nameHash );
+ GetModuleFileNameA(services[i]->hOwner, szModuleName, sizeof(szModuleName));
+ Netlib_Logf(NULL, "A service function '%s' was abnormally deleted because module '%s' didn't released it",
+ services[i]->name, szModuleName);
+ DestroyServiceFunction((HANDLE)services[i]->nameHash);
} }
LeaveCriticalSection(&csServices);
}
-void KillObjectServices( void* pObject )
+void KillObjectServices(void* pObject)
{
int i;
EnterCriticalSection(&csServices);
- for ( i = services.getCount()-1; i >= 0; i-- )
- if ( services[i]->object == pObject )
- DestroyServiceFunction(( HANDLE )services[i]->nameHash );
+ for (i = services.getCount()-1; i >= 0; i--)
+ if (services[i]->object == pObject)
+ DestroyServiceFunction((HANDLE)services[i]->nameHash);
LeaveCriticalSection(&csServices);
}
diff --git a/src/core/modules.h b/src/core/modules.h index dc993a97b1..a2e5429d5f 100644 --- a/src/core/modules.h +++ b/src/core/modules.h @@ -123,7 +123,7 @@ Works precisely like NotifyEventHooks, but without switching to the first thread It guarantees that the execution time for these events is always tiny
*/
-int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam );
+int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
/*
hEvent : a HANDLE which has been returned by CreateHookableEvent()
@@ -263,6 +263,6 @@ Returns nonzero on success, zero on failure added during 0.3.4+ (2004/08/14)
*/
-int CallFunctionAsync( void (__stdcall *func)(void *), void *arg);
+int CallFunctionAsync(void (__stdcall *func)(void *), void *arg);
#endif // MODULES_H_
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index b9c3fbb683..f1a2e6330d 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -35,7 +35,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp TranslateDialogDefault(hdlg);
Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_ADDCONTACT);
- if ( acs->handleType == HANDLE_EVENT ) {
+ if (acs->handleType == HANDLE_EVENT) {
DWORD dwUin;
DBEVENTINFO dbei = { 0 };
dbei.cbSize=sizeof(dbei);
@@ -47,8 +47,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp }
{
TCHAR *szName = NULL, *tmpStr = NULL;
- if ( acs->handleType == HANDLE_CONTACT )
- szName = cli.pfnGetContactDisplayName( acs->handle, GCDNF_TCHAR );
+ if (acs->handleType == HANDLE_CONTACT)
+ szName = cli.pfnGetContactDisplayName(acs->handle, GCDNF_TCHAR);
else {
int isSet = 0;
@@ -64,31 +64,31 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp hcontact=*((PHANDLE)(dbei.pBlob+sizeof(DWORD)));
mir_free(dbei.pBlob);
if (hcontact != INVALID_HANDLE_VALUE) {
- szName = cli.pfnGetContactDisplayName( hcontact, 0 );
+ szName = cli.pfnGetContactDisplayName(hcontact, 0);
isSet = 1;
}
}
- if (!isSet) {
+ if ( !isSet) {
szName = (acs->handleType == HANDLE_EVENT) ? (tmpStr = mir_a2t(szUin)) :
(acs->psr->id ? acs->psr->id : acs->psr->nick);
} }
- if ( szName && szName[0] ) {
+ if (szName && szName[0]) {
TCHAR szTitle[128];
- mir_sntprintf( szTitle, SIZEOF(szTitle), TranslateT("Add %s"), szName );
- SetWindowText( hdlg, szTitle );
+ mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("Add %s"), szName);
+ SetWindowText(hdlg, szTitle);
}
- else SetWindowText( hdlg, TranslateT("Add Contact"));
+ else SetWindowText(hdlg, TranslateT("Add Contact"));
mir_free(tmpStr);
} }
- if ( acs->handleType == HANDLE_CONTACT && acs->handle )
- if ( acs->szProto == NULL || (acs->szProto != NULL && *acs->szProto == 0 ))
+ if (acs->handleType == HANDLE_CONTACT && acs->handle)
+ if (acs->szProto == NULL || (acs->szProto != NULL && *acs->szProto == 0))
acs->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)acs->handle, 0);
{
int groupId;
- for ( groupId = 0; groupId < 999; groupId++ ) {
+ for (groupId = 0; groupId < 999; groupId++) {
DBVARIANT dbv;
char idstr[4];
int id;
@@ -201,25 +201,25 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp }
// fall through
case IDCANCEL:
- if ( GetParent( hdlg ) == NULL)
- DestroyWindow( hdlg );
+ if (GetParent(hdlg) == NULL)
+ DestroyWindow(hdlg);
else
- EndDialog( hdlg, 0 );
+ EndDialog(hdlg, 0);
break;
}
break;
case WM_CLOSE:
/* if there is no parent for the dialog, its a modeless dialog and can't be killed using EndDialog() */
- if ( GetParent( hdlg ) == NULL )
+ if (GetParent(hdlg) == NULL)
DestroyWindow(hdlg);
else
- EndDialog( hdlg, 0 );
+ EndDialog(hdlg, 0);
break;
case WM_DESTROY:
Window_FreeIcon_IcoLib(hdlg);
- acs = ( ADDCONTACTSTRUCT* )GetWindowLongPtr(hdlg, GWLP_USERDATA);
+ acs = (ADDCONTACTSTRUCT*)GetWindowLongPtr(hdlg, GWLP_USERDATA);
if (acs) {
if (acs->psr) {
mir_free(acs->psr->nick);
@@ -239,9 +239,9 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp INT_PTR AddContactDialog(WPARAM wParam, LPARAM lParam)
{
if (lParam) {
- ADDCONTACTSTRUCT* acs = ( ADDCONTACTSTRUCT* )mir_alloc(sizeof(ADDCONTACTSTRUCT));
- memmove( acs, ( ADDCONTACTSTRUCT* )lParam, sizeof( ADDCONTACTSTRUCT ));
- if ( acs->psr ) {
+ ADDCONTACTSTRUCT* acs = (ADDCONTACTSTRUCT*)mir_alloc(sizeof(ADDCONTACTSTRUCT));
+ memmove(acs, (ADDCONTACTSTRUCT*)lParam, sizeof(ADDCONTACTSTRUCT));
+ if (acs->psr) {
PROTOSEARCHRESULT *psr;
/* bad! structures that are bigger than psr will cause crashes if they define pointers within unreachable structural space */
psr = (PROTOSEARCHRESULT *)mir_alloc(acs->psr->cbSize);
@@ -255,7 +255,7 @@ INT_PTR AddContactDialog(WPARAM wParam, LPARAM lParam) /* copied the passed acs structure, the psr structure with, the pointers within that */
}
- if ( wParam )
+ if (wParam)
DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs);
else
CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs);
diff --git a/src/modules/autoaway/autoaway.cpp b/src/modules/autoaway/autoaway.cpp index 055313736b..767800d014 100644 --- a/src/modules/autoaway/autoaway.cpp +++ b/src/modules/autoaway/autoaway.cpp @@ -31,37 +31,37 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) int i;
MIRANDA_IDLE_INFO mii;
- mii.cbSize = sizeof( mii );
- CallService( MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii );
- if ( mii.aaStatus == 0 )
+ mii.cbSize = sizeof(mii);
+ CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
+ if (mii.aaStatus == 0)
return 0;
- for ( i=0; i < accounts.getCount(); i++ ) {
+ for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if (!Proto_IsAccountEnabled( pa ) || Proto_IsAccountLocked( pa )) continue;
+ if ( !Proto_IsAccountEnabled(pa) || Proto_IsAccountLocked(pa)) continue;
- int statusbits = CallProtoService( pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 );
- int currentstatus = CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0 );
+ int statusbits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
+ int currentstatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
int status = mii.aaStatus;
- if ( !(statusbits & Proto_Status2Flag(status)) ) {
+ if ( !(statusbits & Proto_Status2Flag(status))) {
// the protocol doesnt support the given status
- if ( statusbits & Proto_Status2Flag( ID_STATUS_AWAY ))
+ if (statusbits & Proto_Status2Flag(ID_STATUS_AWAY))
status = ID_STATUS_AWAY;
// the proto doesnt support user mode or even away, bail.
else
continue;
}
- if ( currentstatus >= ID_STATUS_ONLINE && currentstatus != ID_STATUS_INVISIBLE ) {
- if ((lParam&IDF_ISIDLE) && ( currentstatus == ID_STATUS_ONLINE || currentstatus == ID_STATUS_FREECHAT )) {
- DBWriteContactSettingByte( NULL, AA_MODULE, pa->szModuleName, 1 );
- Proto_SetStatus( pa->szModuleName, status );
+ if (currentstatus >= ID_STATUS_ONLINE && currentstatus != ID_STATUS_INVISIBLE) {
+ if ((lParam&IDF_ISIDLE) && (currentstatus == ID_STATUS_ONLINE || currentstatus == ID_STATUS_FREECHAT)) {
+ DBWriteContactSettingByte(NULL, AA_MODULE, pa->szModuleName, 1);
+ Proto_SetStatus(pa->szModuleName, status);
}
- else if ( !(lParam & IDF_ISIDLE) && DBGetContactSettingByte( NULL, AA_MODULE, pa->szModuleName, 0 )) {
+ else if ( !(lParam & IDF_ISIDLE) && DBGetContactSettingByte(NULL, AA_MODULE, pa->szModuleName, 0)) {
// returning from idle and this proto was set away, set it back
- DBWriteContactSettingByte( NULL, AA_MODULE, pa->szModuleName, 0 );
- if ( !mii.aaLock )
- Proto_SetStatus( pa->szModuleName, ID_STATUS_ONLINE);
+ DBWriteContactSettingByte(NULL, AA_MODULE, pa->szModuleName, 0);
+ if ( !mii.aaLock)
+ Proto_SetStatus(pa->szModuleName, ID_STATUS_ONLINE);
} } }
return 0;
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 7395f2122a..ac1b301c4a 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -111,7 +111,7 @@ static int TBStateConvert2Flat(int state) static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
{
- if (!hdcPaint)
+ if ( !hdcPaint)
return;
HDC hdcMem;
@@ -122,7 +122,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) GetClientRect(ctl->hwnd, &rcClient);
hdcMem = CreateCompatibleDC(hdcPaint);
hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top);
- hOld = ( HDC )SelectObject(hdcMem, hbmMem);
+ hOld = (HDC)SelectObject(hdcMem, hbmMem);
// If its a push button, check to see if it should stay pressed
if (ctl->pushBtn && ctl->pbState) ctl->stateId = PBS_PRESSED;
@@ -139,12 +139,12 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) else {
HBRUSH hbr;
- if (ctl->stateId == PBS_PRESSED||ctl->stateId == PBS_HOT)
+ if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT)
hbr = GetSysColorBrush(COLOR_3DLIGHT);
else {
HWND hwndParent = GetParent(ctl->hwnd);
HDC dc = GetDC(hwndParent);
- HBRUSH oldBrush = (HBRUSH)GetCurrentObject( dc, OBJ_BRUSH );
+ HBRUSH oldBrush = (HBRUSH)GetCurrentObject(dc, OBJ_BRUSH);
hbr = (HBRUSH)SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM)dc, (LPARAM)hwndParent);
SelectObject(dc, oldBrush);
ReleaseDC(hwndParent, dc);
@@ -153,7 +153,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) FillRect(hdcMem, &rcClient, hbr);
DeleteObject(hbr);
}
- if (ctl->stateId == PBS_HOT||ctl->focus) {
+ if (ctl->stateId == PBS_HOT || ctl->focus) {
if (ctl->pbState)
DrawEdge(hdcMem, &rcClient, EDGE_ETCHED, BF_RECT|BF_SOFT);
else DrawEdge(hdcMem, &rcClient, BDR_RAISEDOUTER, BF_RECT|BF_SOFT|BF_FLAT);
@@ -231,7 +231,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) SetBkMode(hdcMem, TRANSPARENT);
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
// XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so.
- SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd)||!ctl->hThemeButton?GetSysColor(COLOR_BTNTEXT):GetSysColor(COLOR_GRAYTEXT));
+ SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton?GetSysColor(COLOR_BTNTEXT):GetSysColor(COLOR_GRAYTEXT));
GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
if (ctl->cHot) {
SIZE szHot;
@@ -240,10 +240,10 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) sz.cx -= szHot.cx;
}
if (ctl->arrow) {
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED);
+ DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+( !ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+( !ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED);
}
SelectObject(hdcMem, ctl->hFont);
- DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, (rcText.right-rcText.left-sz.cx)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId == PBS_PRESSED?0:1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd)||ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED);
+ DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, (rcText.right-rcText.left-sz.cx)/2+( !ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId == PBS_PRESSED?0:1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED);
SelectObject(hdcMem, hOldFont);
}
BitBlt(hdcPaint, 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, hdcMem, 0, 0, SRCCOPY);
@@ -261,11 +261,11 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L switch(msg) {
case WM_NCCREATE:
SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW);
- bct = ( MButtonCtrl* )mir_calloc(sizeof(MButtonCtrl));
+ bct = (MButtonCtrl*)mir_calloc(sizeof(MButtonCtrl));
if (bct == NULL) return FALSE;
bct->hwnd = hwndDlg;
bct->stateId = PBS_NORMAL;
- bct->hFont = ( HFONT )GetStockObject(DEFAULT_GUI_FONT);
+ bct->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
LoadTheme(bct);
if (SUCCEEDED(CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, IID_IAccPropServices, (void**)&bct->pAccPropServices))) {
// Annotating the Role of this object to be PushButton
@@ -292,14 +292,14 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (SendMessage(bct->hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) {
SendMessage(bct->hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
}
- if ( SendMessage(bct->hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0 ) {
+ if (SendMessage(bct->hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) {
int idx;
TTooltips tt;
tt.ThreadId = GetCurrentThreadId();
EnterCriticalSection(&csTips);
- if (( idx = lToolTips.getIndex(&tt)) != -1) {
- mir_free( lToolTips[idx] );
+ if ((idx = lToolTips.getIndex(&tt)) != -1) {
+ mir_free(lToolTips[idx]);
lToolTips.remove(idx);
DestroyWindow(bct->hwndToolTips);
}
@@ -319,8 +319,8 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_SETTEXT:
bct->cHot = 0;
- if ( lParam != 0 ) {
- TCHAR *tmp = ( TCHAR* )lParam;
+ if (lParam != 0) {
+ TCHAR *tmp = (TCHAR*)lParam;
while (*tmp) {
if (*tmp == '&' && *(tmp+1)) {
bct->cHot = _tolower(*(tmp+1));
@@ -413,7 +413,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L else return 0;
case BM_SETCHECK:
- if (!bct->pushBtn) break;
+ if ( !bct->pushBtn) break;
if (wParam == BST_CHECKED) {
bct->pbState = 1;
bct->stateId = PBS_PRESSED;
@@ -431,7 +431,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return 0;
case BUTTONSETARROW: // turn arrow on/off
if (wParam) {
- if (!bct->arrow) {
+ if ( !bct->arrow) {
bct->arrow = LoadSkinIcon(SKINICON_OTHER_DOWNARROW);
SetHwndPropInt(bct, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, ROLE_SYSTEM_BUTTONDROPDOWN);
}
@@ -462,18 +462,18 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case BUTTONADDTOOLTIP:
- if ( wParam ) {
+ if (wParam) {
TOOLINFO ti = {0};
- if ( !bct->hwndToolTips ) {
+ if ( !bct->hwndToolTips) {
int idx;
TTooltips tt;
tt.ThreadId = GetCurrentThreadId();
EnterCriticalSection(&csTips);
- if (( idx = lToolTips.getIndex(&tt)) != -1)
+ if ((idx = lToolTips.getIndex(&tt)) != -1)
bct->hwndToolTips = lToolTips[idx]->hwnd;
else {
- TTooltips *ptt = ( TTooltips* )mir_alloc( sizeof(TTooltips) );
+ TTooltips *ptt = (TTooltips*)mir_alloc(sizeof(TTooltips));
ptt->ThreadId = tt.ThreadId;
ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), TTS_ALWAYSTIP, 0, 0, 0, 0, NULL, NULL, hMirandaInst, NULL);
lToolTips.insert(ptt);
@@ -489,18 +489,18 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(bct->hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS;
ti.uId = (UINT_PTR)bct->hwnd;
- if ( lParam & BATF_UNICODE )
- ti.lpszText = mir_wstrdup( TranslateW(( WCHAR* )wParam ));
+ if (lParam & BATF_UNICODE)
+ ti.lpszText = mir_wstrdup(TranslateW((WCHAR*)wParam));
else
- ti.lpszText = LangPackPcharToTchar(( char* )wParam );
+ ti.lpszText = LangPackPcharToTchar((char*)wParam);
if (bct->pAccPropServices) {
wchar_t *tmpstr = mir_t2u(ti.lpszText);
bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT,
CHILDID_SELF, PROPID_ACC_DESCRIPTION, tmpstr);
mir_free(tmpstr);
}
- SendMessage( bct->hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
- mir_free( ti.lpszText );
+ SendMessage(bct->hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ mir_free(ti.lpszText);
}
break;
case WM_SETFOCUS: // set keybord focus and redraw
@@ -568,7 +568,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L POINT pt;
GetWindowRect(hwndDlg, &rc);
GetCursorPos(&pt);
- if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave
+ if ( !PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave
PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L);
KillTimer(hwndDlg, BUTTON_POLLID);
} }
@@ -587,7 +587,7 @@ int LoadButtonModule(void) {
WNDCLASSEX wc = {0};
- if ( bModuleInitialized ) return 0;
+ if (bModuleInitialized) return 0;
bModuleInitialized = TRUE;
wc.cbSize = sizeof(wc);
@@ -608,7 +608,7 @@ int LoadButtonModule(void) void UnloadButtonModule()
{
- if ( bModuleInitialized ) {
+ if (bModuleInitialized) {
EnterCriticalSection(&csTips);
lToolTips.destroy();
LeaveCriticalSection(&csTips);
diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index 95bffa718f..b02a039f3f 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -108,7 +108,7 @@ static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool else
rc->left = rc->right - cx;
- if (!query)
+ if ( !query)
{
Docking_PosCommand(hwnd, rc, false);
dockPos = *(LPPOINT)rc;
@@ -161,7 +161,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) }
}
- if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING)
+ if ( !docked && msg->message != WM_CREATE && msg->message != WM_MOVING)
return 0;
switch (msg->message)
@@ -190,7 +190,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (vis)
{
- if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
+ if ( !(wp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
{
bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0;
@@ -198,12 +198,12 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) GetWindowRect(msg->hwnd, &rc);
int cx = rc.right - rc.left;
- if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
+ if ( !(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
if (addbar)
Docking_RectToDock(&rc);
- if (!(wp->flags & SWP_NOSIZE))
+ if ( !(wp->flags & SWP_NOSIZE))
{
rc.right = rc.left + wp->cx;
rc.bottom = rc.top + wp->cy;
@@ -212,8 +212,8 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_SetSize(msg->hwnd, &rc, !addbar, false);
- if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
- if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
+ if ( !(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
+ if ( !(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
*((LRESULT *) lParam) = TRUE;
return TRUE;
@@ -248,7 +248,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (wp->flags & SWP_HIDEWINDOW)
vis = false;
- if (!vis)
+ if ( !vis)
Docking_Command(msg->hwnd, ABM_REMOVE);
else
Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED);
@@ -266,7 +266,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) break;
case WM_MOVING:
- if (!docked)
+ if ( !docked)
{
RECT rcMonitor;
POINT ptCursor;
@@ -340,7 +340,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) RECT rc;
POINT pt;
GetClientRect(msg->hwnd, &rc);
- if ((docked == DOCKED_LEFT && (short) LOWORD(msg->lParam) > rc.right) ||
+ if ((docked == DOCKED_LEFT && (short) LOWORD(msg->lParam) > rc.right) ||
(docked == DOCKED_RIGHT && (short) LOWORD(msg->lParam) < 0))
{
ReleaseCapture();
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 087cc34e30..168fae2746 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -23,13 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "clc.h"
-int InitGenMenu( void );
-int UnitGenMenu( void );
+int InitGenMenu(void);
+int UnitGenMenu(void);
-void InitCustomMenus( void );
-void UninitCustomMenus( void );
+void InitCustomMenus(void);
+void UninitCustomMenus(void);
-void MTG_OnmodulesLoad( void );
+void MTG_OnmodulesLoad(void);
static BOOL bModuleInitialized = FALSE;
static HANDLE hClcWindowList;
@@ -42,17 +42,17 @@ int g_IconWidth, g_IconHeight; void FreeDisplayNameCache(void);
-void fnClcBroadcast( int msg, WPARAM wParam, LPARAM lParam )
+void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam)
{
WindowList_Broadcast(hClcWindowList, msg, wParam, lParam);
}
void fnClcOptionsChanged(void)
{
- cli.pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0);
+ cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
}
-HMENU fnBuildGroupPopupMenu( struct ClcGroup* group )
+HMENU fnBuildGroupPopupMenu(struct ClcGroup* group)
{
HMENU hMenu = LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hGroupMenu = GetSubMenu(hMenu, 2);
@@ -72,49 +72,49 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) char *szProto;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
if ((HANDLE)wParam != NULL && !strcmp(cws->szModule, "CList")) {
- if (!strcmp(cws->szSetting, "MyHandle")) {
+ if ( !strcmp(cws->szSetting, "MyHandle")) {
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE) wParam);
- cli.pfnClcBroadcast( INTM_NAMECHANGED, wParam, lParam);
+ cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam);
}
- else if (!strcmp(cws->szSetting, "Group"))
- cli.pfnClcBroadcast( INTM_GROUPCHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "Hidden"))
- cli.pfnClcBroadcast( INTM_HIDDENCHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "NotOnList"))
- cli.pfnClcBroadcast( INTM_NOTONLISTCHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "Status"))
- cli.pfnClcBroadcast( INTM_INVALIDATE, 0, 0);
- else if (!strcmp(cws->szSetting, "NameOrder"))
- cli.pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0);
+ else if ( !strcmp(cws->szSetting, "Group"))
+ cli.pfnClcBroadcast(INTM_GROUPCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "Hidden"))
+ cli.pfnClcBroadcast(INTM_HIDDENCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "NotOnList"))
+ cli.pfnClcBroadcast(INTM_NOTONLISTCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "Status"))
+ cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0);
+ else if ( !strcmp(cws->szSetting, "NameOrder"))
+ cli.pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0);
}
- else if (!strcmp(cws->szModule, "CListGroups")) {
- cli.pfnClcBroadcast( INTM_GROUPSCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szModule, "CListGroups")) {
+ cli.pfnClcBroadcast(INTM_GROUPSCHANGED, wParam, lParam);
}
else {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto != NULL && (HANDLE) wParam != NULL) {
char *id = NULL;
- if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) {
- cli.pfnClcBroadcast( INTM_PROTOCHANGED, wParam, lParam);
+ if ( !strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) {
+ cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
}
// something is being written to a protocol module
- if (!strcmp(szProto, cws->szModule)) {
+ if ( !strcmp(szProto, cws->szModule)) {
// was a unique setting key written?
id = (char *) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR) id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting)) {
- cli.pfnClcBroadcast( INTM_PROTOCHANGED, wParam, lParam);
+ cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
}
}
}
if (szProto == NULL || strcmp(szProto, cws->szModule))
return 0;
- if (!strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail")
- || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN"))
- cli.pfnClcBroadcast( INTM_NAMECHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "ApparentMode"))
- cli.pfnClcBroadcast( INTM_APPARENTMODECHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "IdleTS"))
- cli.pfnClcBroadcast( INTM_IDLECHANGED, wParam, lParam);
+ if ( !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail")
+ || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN"))
+ cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "ApparentMode"))
+ cli.pfnClcBroadcast(INTM_APPARENTMODECHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "IdleTS"))
+ cli.pfnClcBroadcast(INTM_IDLECHANGED, wParam, lParam);
}
return 0;
}
@@ -154,7 +154,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0);
if (ack->result == ACKRESULT_SUCCESS) {
for (i = 0; i < cli.hClcProtoCount; i++) {
- if (!lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) {
+ if ( !lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) {
cli.clcProto[i].dwStatus = (WORD) ack->lParam;
break;
}
@@ -191,7 +191,7 @@ static int ClcIconsChanged(WPARAM, LPARAM) static INT_PTR SetInfoTipHoverTime(WPARAM wParam, LPARAM)
{
DBWriteContactSettingWord(NULL, "CLC", "InfoTipHoverTime", (WORD) wParam);
- cli.pfnClcBroadcast( INTM_SETINFOTIPHOVERTIME, wParam, 0);
+ cli.pfnClcBroadcast(INTM_SETINFOTIPHOVERTIME, wParam, 0);
return 0;
}
@@ -200,10 +200,10 @@ static INT_PTR GetInfoTipHoverTime(WPARAM, LPARAM) return DBGetContactSettingWord(NULL, "CLC", "InfoTipHoverTime", 750);
}
-static void SortClcByTimer( HWND hwnd )
+static void SortClcByTimer(HWND hwnd)
{
- KillTimer( hwnd, TIMERID_DELAYEDRESORTCLC );
- SetTimer( hwnd, TIMERID_DELAYEDRESORTCLC, 200, NULL );
+ KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC);
+ SetTimer(hwnd, TIMERID_DELAYEDRESORTCLC, 200, NULL);
}
int LoadCLCModule(void)
@@ -236,7 +236,7 @@ int LoadCLCModule(void) void UnloadClcModule()
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
UnhookEvent(hAckHook);
UnhookEvent(hClcSettingsChanged);
@@ -264,7 +264,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_CREATE:
WindowList_Add(hClcWindowList, hwnd, NULL);
cli.pfnRegisterFileDropping(hwnd);
- if ( dat == NULL ) {
+ if (dat == NULL) {
dat = (struct ClcData *) mir_calloc(sizeof(struct ClcData));
SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat);
}
@@ -286,7 +286,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->list.cl.increment = 30;
dat->needsResort = 1;
cli.pfnLoadClcOptions(hwnd, dat);
- if (!IsWindowVisible(hwnd))
+ if ( !IsWindowVisible(hwnd))
SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL);
else
{
@@ -342,8 +342,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, FillRect(hdcMem, &rc, hBrush);
DeleteObject(hBrush);
- hoMaskBmp = ( HBITMAP )SelectObject(hdcMem, hBmpMask);
- FillRect(hdcMem, &rc, ( HBRUSH )GetStockObject(BLACK_BRUSH));
+ hoMaskBmp = (HBITMAP)SelectObject(hdcMem, hBmpMask);
+ FillRect(hdcMem, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
SelectObject(hdcMem, hoMaskBmp);
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
@@ -416,24 +416,24 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, szFullName[0] = '\0';
break;
}
- memmove(szFullName + 1 + nameLen, szFullName, sizeof( TCHAR )*( lstrlen(szFullName) + 1));
- memcpy(szFullName, group->cl.items[i]->szText, sizeof( TCHAR )*nameLen);
+ memmove(szFullName + 1 + nameLen, szFullName, sizeof(TCHAR)*(lstrlen(szFullName) + 1));
+ memcpy(szFullName, group->cl.items[i]->szText, sizeof(TCHAR)*nameLen);
szFullName[nameLen] = '\\';
}
- if ( dbcws->value.type == DBVT_ASCIIZ ) {
+ if (dbcws->value.type == DBVT_ASCIIZ) {
WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal+1);
- eq = !lstrcmp( szFullName, wszGrpName );
- mir_free( wszGrpName );
+ eq = !lstrcmp(szFullName, wszGrpName);
+ mir_free(wszGrpName);
}
else {
char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal+1);
WCHAR* wszGrpName;
- Utf8Decode(szGrpName, &wszGrpName );
- eq = !lstrcmp( szFullName, wszGrpName );
- mir_free( wszGrpName );
+ Utf8Decode(szGrpName, &wszGrpName);
+ eq = !lstrcmp(szFullName, wszGrpName);
+ mir_free(wszGrpName);
}
- if ( eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
+ if (eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
break; //only expanded has changed: no action reqd
}
}
@@ -477,7 +477,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, struct ClcContact *contact;
BYTE iExtraImage[MAXEXTRACOLUMNS];
BYTE flags = 0;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
memset(iExtraImage, 0xFF, SIZEOF(iExtraImage));
else {
CopyMemory(iExtraImage, contact->iExtraImage, SIZEOF(iExtraImage));
@@ -521,9 +521,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
shouldShow = (style & CLS_SHOWHIDDEN || !DBGetContactSettingByte((HANDLE) wParam, "CList", "Hidden", 0))
- && (!cli.pfnIsHiddenMode(dat, status)
- || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); // this means an offline msg is flashing, so the contact should be shown
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) {
+ && ( !cli.pfnIsHiddenMode(dat, status)
+ || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); // this means an offline msg is flashing, so the contact should be shown
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = cli.pfnContactToHItem(selcontact);
@@ -539,7 +539,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, else { // item in list already
if (contact->iImage == (WORD) lParam)
break;
- if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = cli.pfnContactToHItem(selcontact);
cli.pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0);
@@ -547,7 +547,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, }
else {
contact->iImage = (WORD) lParam;
- if (!cli.pfnIsHiddenMode(dat, status))
+ if ( !cli.pfnIsHiddenMode(dat, status))
contact->flags |= CONTACTF_ONLINE;
else
contact->flags &= ~CONTACTF_ONLINE;
@@ -557,7 +557,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (hSelItem) {
struct ClcGroup *selgroup;
if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
- dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf(( SortedList* )&selgroup->cl, selcontact));
+ dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact));
else
dat->selection = -1;
}
@@ -567,7 +567,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case INTM_NAMECHANGED:
{
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
@@ -578,7 +578,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case INTM_PROTOCHANGED:
{
struct ClcContact *contact = NULL;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam);
@@ -590,7 +590,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, {
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_CONTACT)
break;
@@ -610,7 +610,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, WORD apparentMode;
char *szProto;
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
@@ -634,7 +634,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, {
char *szProto;
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
@@ -711,7 +711,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnHideInfoTip(hwnd, dat);
KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
- if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE))
+ if ( !SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE))
scrollLines = 3;
cli.pfnScrollTo(hwnd, dat, dat->yScroll - (short) HIWORD(wParam) * dat->rowHeight * (signed) scrollLines / WHEEL_DELTA, 0);
return 0;
@@ -859,7 +859,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
case WM_TIMER:
- switch( wParam ) {
+ switch(wParam) {
case TIMERID_RENAME:
cli.pfnBeginRenameSelection(hwnd, dat);
break;
@@ -971,7 +971,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
}
- if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) {
+ if ( !(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) {
NMCLISTCONTROL nm;
nm.hdr.code = NM_CLICK;
nm.hdr.hwndFrom = hwnd;
@@ -1030,7 +1030,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, }
if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_NOTMOVED && !(dat->exStyle & CLS_EX_DISABLEDRAGDROP)) {
if (abs((short) LOWORD(lParam) - dat->ptDragStart.x) >= GetSystemMetrics(SM_CXDRAG)
- || abs((short) HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG))
+ || abs((short) HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG))
dat->dragStage = (dat->dragStage & ~DRAGSTAGEM_STAGE) | DRAGSTAGE_ACTIVE;
}
if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) {
@@ -1078,8 +1078,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (pt.x >= 0 && pt.x < clRect.right
&& ((pt.y < 0 && pt.y > -dat->dragAutoScrollHeight)
- || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) {
- if (!dat->dragAutoScrolling) {
+ || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) {
+ if ( !dat->dragAutoScrolling) {
if (pt.y < 0)
dat->dragAutoScrolling = -1;
else
@@ -1150,7 +1150,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, TCHAR szNewName[120];
TCHAR* szGroup = cli.pfnGetGroupName(contactn->groupId, NULL);
mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szGroup, contacto->szText);
- cli.pfnRenameGroup( contacto->groupId, szNewName );
+ cli.pfnRenameGroup(contacto->groupId, szNewName);
}
break;
}
@@ -1195,7 +1195,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, else if (contact->type == CLCIT_GROUP) { //dropee is a group
TCHAR szNewName[120];
lstrcpyn(szNewName, contact->szText, SIZEOF(szNewName));
- cli.pfnRenameGroup( contact->groupId, szNewName );
+ cli.pfnRenameGroup(contact->groupId, szNewName);
} } } } }
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -1217,7 +1217,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnInvalidateRect(hwnd, NULL, FALSE);
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
- if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL)))
+ if ( !(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL)))
break;
UpdateWindow(hwnd);
cli.pfnDoSelectionDefaultAction(hwnd, dat);
@@ -1323,14 +1323,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, {
int i;
for (i = 0; i <= FONTID_MAX; i++)
- if (!dat->fontInfo[i].changed)
+ if ( !dat->fontInfo[i].changed)
DeleteObject(dat->fontInfo[i].hFont);
}
if (dat->himlHighlight)
ImageList_Destroy(dat->himlHighlight);
if (dat->hwndRenameEdit)
DestroyWindow(dat->hwndRenameEdit);
- if (!dat->bkChanged && dat->hBmpBackground)
+ if ( !dat->bkChanged && dat->hBmpBackground)
DeleteObject(dat->hBmpBackground);
cli.pfnFreeGroup(&dat->list);
mir_free(dat);
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index ba12d8b70a..3662cea1c6 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -83,64 +83,64 @@ struct ClcData { /* clc.c */
extern int g_IconWidth, g_IconHeight;
-void fnClcOptionsChanged( void );
-void fnClcBroadcast( int msg, WPARAM wParam, LPARAM lParam );
-HMENU fnBuildGroupPopupMenu( struct ClcGroup* group );
+void fnClcOptionsChanged(void);
+void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam);
+HMENU fnBuildGroupPopupMenu(struct ClcGroup* group);
LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcidents.c */
-int fnGetRowsPriorTo( struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex );
-int fnFindItem( HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible );
-int fnGetRowByIndex( struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup );
-HANDLE fnContactToHItem( struct ClcContact* contact );
-HANDLE fnContactToItemHandle( struct ClcContact * contact, DWORD * nmFlags );
+int fnGetRowsPriorTo(struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex);
+int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible);
+int fnGetRowByIndex(struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup);
+HANDLE fnContactToHItem(struct ClcContact* contact);
+HANDLE fnContactToItemHandle(struct ClcContact * contact, DWORD * nmFlags);
/* clcitems.c */
-struct ClcGroup* fnAddGroup( HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers );
+struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
-void fnFreeContact( struct ClcContact *p );
-void fnFreeGroup( struct ClcGroup *group );
+void fnFreeContact(struct ClcContact *p);
+void fnFreeGroup(struct ClcGroup *group);
int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText);
-int fnAddItemToGroup( struct ClcGroup *group, int iAboveItem );
-void fnAddContactToTree( HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
-int fnAddContactToGroup( struct ClcData *dat, struct ClcGroup *group, HANDLE hContact);
-void fnDeleteItemFromTree( HWND hwnd, HANDLE hItem );
-void fnRebuildEntireList( HWND hwnd, struct ClcData *dat );
-int fnGetGroupContentsCount( struct ClcGroup *group, int visibleOnly );
-void fnSortCLC( HWND hwnd, struct ClcData *dat, int useInsertionSort );
+int fnAddItemToGroup(struct ClcGroup *group, int iAboveItem);
+void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
+int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hContact);
+void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem);
+void fnRebuildEntireList(HWND hwnd, struct ClcData *dat);
+int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly);
+void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort);
void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
/* clcmsgs.c */
-LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam );
+LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcutils.c */
-char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact );
-int fnHitTest( HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags );
-void fnScrollTo( HWND hwnd, struct ClcData *dat, int desty, int noSmooth );
-void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk );
-void fnRecalcScrollBar( HWND hwnd, struct ClcData *dat );
-void fnSetGroupExpand( HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState );
-void fnDoSelectionDefaultAction( HWND hwnd, struct ClcData *dat );
-int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk );
-void fnEndRename(HWND hwnd, struct ClcData *dat, int save );
-void fnDeleteFromContactList( HWND hwnd, struct ClcData *dat );
-void fnBeginRenameSelection( HWND hwnd, struct ClcData *dat );
-void fnCalcEipPosition( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
-int fnGetDropTargetInformation( HWND hwnd, struct ClcData *dat, POINT pt );
-int fnClcStatusToPf2( int status );
-int fnIsHiddenMode( struct ClcData *dat, int status );
-void fnHideInfoTip( HWND hwnd, struct ClcData *dat );
-void fnNotifyNewContact( HWND hwnd, HANDLE hContact );
-DWORD fnGetDefaultExStyle( void );
-void fnGetSetting( int i, LOGFONT* lf, COLORREF* colour );
+char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact);
+int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags);
+void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth);
+void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk);
+void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat);
+void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState);
+void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat);
+int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
+void fnEndRename(HWND hwnd, struct ClcData *dat, int save);
+void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat);
+void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat);
+void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
+int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt);
+int fnClcStatusToPf2(int status);
+int fnIsHiddenMode(struct ClcData *dat, int status);
+void fnHideInfoTip(HWND hwnd, struct ClcData *dat);
+void fnNotifyNewContact(HWND hwnd, HANDLE hContact);
+DWORD fnGetDefaultExStyle(void);
+void fnGetSetting(int i, LOGFONT* lf, COLORREF* colour);
void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour);
-void fnGetFontSetting( int i, LOGFONT* lf, COLORREF* colour );
-void fnLoadClcOptions( HWND hwnd, struct ClcData *dat );
-void fnRecalculateGroupCheckboxes( HWND hwnd, struct ClcData *dat );
-void fnSetGroupChildCheckboxes( struct ClcGroup *group, int checked );
-void fnInvalidateItem( HWND hwnd, struct ClcData *dat, int iItem );
+void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour);
+void fnLoadClcOptions(HWND hwnd, struct ClcData *dat);
+void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
+void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked);
+void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem);
int fnGetRowBottomY(struct ClcData *dat, int item);
int fnGetRowHeight(struct ClcData *dat, int item);
@@ -154,96 +154,96 @@ DWORD GetDefaultExStyle(void); void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour);
/* clistmenus.c */
-HGENMENU fnGetProtocolMenu( const char* );
-int fnGetProtocolVisibility( const char* accName );
-int fnConvertMenu( CLISTMENUITEM*, TMO_MenuItem* );
+HGENMENU fnGetProtocolMenu(const char*);
+int fnGetProtocolVisibility(const char* accName);
+int fnConvertMenu(CLISTMENUITEM*, TMO_MenuItem*);
int fnGetAccountIndexByPos(int Pos);
int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos);
-void RebuildMenuOrder( void );
+void RebuildMenuOrder(void);
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam);
/* clistsettings.c */
-TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode );
-void fnGetDefaultFontSetting( int i, LOGFONT* lf, COLORREF * colour);
-void fnInvalidateDisplayNameCacheEntry( HANDLE hContact );
+TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode);
+void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF * colour);
+void fnInvalidateDisplayNameCacheEntry(HANDLE hContact);
-ClcCacheEntryBase* fnGetCacheEntry( HANDLE hContact );
-ClcCacheEntryBase* fnCreateCacheItem ( HANDLE hContact );
-void fnCheckCacheItem( ClcCacheEntryBase* p );
-void fnFreeCacheItem( ClcCacheEntryBase* p );
+ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact);
+ClcCacheEntryBase* fnCreateCacheItem (HANDLE hContact);
+void fnCheckCacheItem(ClcCacheEntryBase* p);
+void fnFreeCacheItem(ClcCacheEntryBase* p);
/* clcfiledrop.c */
void InitFileDropping(void);
-void fnRegisterFileDropping ( HWND hwnd );
-void fnUnregisterFileDropping ( HWND hwnd );
+void fnRegisterFileDropping (HWND hwnd);
+void fnUnregisterFileDropping (HWND hwnd);
/* clistevents.c */
-struct CListEvent* fnAddEvent( CLISTEVENT *cle );
-CLISTEVENT* fnGetEvent( HANDLE hContact, int idx );
+struct CListEvent* fnAddEvent(CLISTEVENT *cle);
+CLISTEVENT* fnGetEvent(HANDLE hContact, int idx);
-struct CListEvent* fnCreateEvent( void );
-void fnFreeEvent( struct CListEvent* p );
+struct CListEvent* fnCreateEvent(void);
+void fnFreeEvent(struct CListEvent* p);
-int fnEventsProcessContactDoubleClick( HANDLE hContact );
-int fnEventsProcessTrayDoubleClick( int );
+int fnEventsProcessContactDoubleClick(HANDLE hContact);
+int fnEventsProcessTrayDoubleClick(int);
int fnGetImlIconIndex(HICON hIcon);
-int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent );
+int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent);
/* clistmod.c */
int fnIconFromStatusMode(const char *szProto, int status, HANDLE hContact);
-int fnShowHide( WPARAM wParam, LPARAM lParam );
-HICON fnGetIconFromStatusMode( HANDLE hContact, const char *szProto, int status );
-TCHAR* fnGetStatusModeDescription( int wParam, int lParam);
+int fnShowHide(WPARAM wParam, LPARAM lParam);
+HICON fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status);
+TCHAR* fnGetStatusModeDescription(int wParam, int lParam);
int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY);
/* clisttray.c */
-void fnInitTray( void );
-void fnUninitTray( void );
-void fnLockTray( void );
-void fnUnlockTray( void );
+void fnInitTray(void);
+void fnUninitTray(void);
+void fnLockTray(void);
+void fnUnlockTray(void);
int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY *msn);
int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status);
-int fnTrayIconDestroy( HWND hwnd );
-void fnTrayIconIconsChanged ( void );
-int fnTrayIconInit( HWND hwnd );
-TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto );
-int fnTrayIconPauseAutoHide ( WPARAM wParam, LPARAM lParam );
-INT_PTR fnTrayIconProcessMessage ( WPARAM wParam, LPARAM lParam );
+int fnTrayIconDestroy(HWND hwnd);
+void fnTrayIconIconsChanged (void);
+int fnTrayIconInit(HWND hwnd);
+TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto);
+int fnTrayIconPauseAutoHide (WPARAM wParam, LPARAM lParam);
+INT_PTR fnTrayIconProcessMessage (WPARAM wParam, LPARAM lParam);
void fnTrayIconRemove(HWND hwnd, const char *szProto);
int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto);
-void fnTrayIconSetToBase ( char *szPreferredProto );
-void fnTrayIconTaskbarCreated( HWND hwnd );
-int fnTrayIconUpdate( HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase );
-void fnTrayIconUpdateBase ( const char *szChangedProto );
-void fnTrayIconUpdateWithImageList ( int iImage, const TCHAR *szNewTip, char *szPreferredProto );
+void fnTrayIconSetToBase (char *szPreferredProto);
+void fnTrayIconTaskbarCreated(HWND hwnd);
+int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase);
+void fnTrayIconUpdateBase (const char *szChangedProto);
+void fnTrayIconUpdateWithImageList (int iImage, const TCHAR *szNewTip, char *szPreferredProto);
VOID CALLBACK fnTrayCycleTimerProc(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
/* clui.c */
-LRESULT CALLBACK fnContactListWndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
-void fnLoadCluiGlobalOpts( void );
+LRESULT CALLBACK fnContactListWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+void fnLoadCluiGlobalOpts(void);
void fnCluiProtocolStatusChanged(int, const char*);
void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon);
/* contact.c */
-void fnChangeContactIcon ( HANDLE hContact, int iIcon, int add );
-void fnLoadContactTree ( void );
-int fnCompareContacts ( const struct ClcContact *contact1, const struct ClcContact *contact2);
-void fnSortContacts ( void );
-int fnSetHideOffline ( WPARAM wParam, LPARAM lParam );
+void fnChangeContactIcon (HANDLE hContact, int iIcon, int add);
+void fnLoadContactTree (void);
+int fnCompareContacts (const struct ClcContact *contact1, const struct ClcContact *contact2);
+void fnSortContacts (void);
+int fnSetHideOffline (WPARAM wParam, LPARAM lParam);
/* docking.c */
-int fnDocking_ProcessWindowMessage ( WPARAM wParam, LPARAM lParam );
+int fnDocking_ProcessWindowMessage (WPARAM wParam, LPARAM lParam);
/* group.c */
-TCHAR* fnGetGroupName ( int idx, DWORD* pdwFlags );
-int fnRenameGroup ( int groupID, TCHAR* newName );
+TCHAR* fnGetGroupName (int idx, DWORD* pdwFlags);
+int fnRenameGroup (int groupID, TCHAR* newName);
/* keyboard.c */
-int fnHotKeysRegister ( HWND hwnd );
-void fnHotKeysUnregister ( HWND hwnd );
-int fnHotKeysProcess ( HWND hwnd, WPARAM wParam, LPARAM lParam );
-int fnHotkeysProcessMessage ( WPARAM wParam, LPARAM lParam );
+int fnHotKeysRegister (HWND hwnd);
+void fnHotKeysUnregister (HWND hwnd);
+int fnHotKeysProcess (HWND hwnd, WPARAM wParam, LPARAM lParam);
+int fnHotkeysProcessMessage (WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 54660267c9..8af901284b 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -83,7 +83,7 @@ static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, in if (szProto == NULL)
return NULL;
protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (!(protoCaps & PF1_FILESEND))
+ if ( !(protoCaps & PF1_FILESEND))
return NULL;
if (ID_STATUS_OFFLINE == DBGetContactSettingWord(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE))
return NULL;
@@ -148,7 +148,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL shortPt.y = pt.y;
hwnd = WindowFromPoint(shortPt);
GetClassName(hwnd, szWindowClass, SIZEOF(szWindowClass));
- if (!lstrcmp(szWindowClass, CLISTCONTROL_CLASS)) {
+ if ( !lstrcmp(szWindowClass, CLISTCONTROL_CLASS)) {
struct ClcData *dat;
hwndCurrentDrag = hwnd;
dat = (struct ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
@@ -188,7 +188,7 @@ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR *szFil lstrcat(szPath, _T("\\*"));
if (hFind = FindFirstFile(szPath, &fd)) {
do {
- if (!lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T("..")))
+ if ( !lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T("..")))
continue;
lstrcpy(szPath, szFilename);
lstrcat(szPath, _T("\\"));
@@ -234,7 +234,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt AddToFileList(&ppFiles, &totalCount, szFilename);
}
- if (!CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles))
+ if ( !CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles))
*pdwEffect = DROPEFFECT_COPY;
for (i = 0; ppFiles[i]; i++)
diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index 1256ad4c8b..60e8fb6c3b 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -85,7 +85,7 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact * break;
nowVisible = 1;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
- if (!group->expanded) {
+ if ( !group->expanded) {
nowVisible = 0;
break;
}
@@ -102,7 +102,7 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact * && group->cl.items[group->scanIndex]->hContact == (HANDLE) ((UINT_PTR)hItem & ~HCONTACT_ISINFO)))
{
if (isVisible) {
- if (!nowVisible)
+ if ( !nowVisible)
*isVisible = 0;
else {
int posY = cli.pfnGetRowTopY(dat, index+1);
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 261710c078..74e951c276 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -31,9 +31,9 @@ int fnAddItemToGroup(struct ClcGroup *group, int iAboveItem) newItem->type = CLCIT_DIVIDER;
newItem->flags = 0;
newItem->szText[0] = '\0';
- memset( newItem->iExtraImage, 0xFF, SIZEOF(newItem->iExtraImage));
+ memset(newItem->iExtraImage, 0xFF, SIZEOF(newItem->iExtraImage));
- List_Insert(( SortedList* )&group->cl, newItem, iAboveItem );
+ List_Insert((SortedList*)&group->cl, newItem, iAboveItem);
return iAboveItem;
}
@@ -44,10 +44,10 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, int i, compareResult;
dat->needsResort = 1;
- if (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS))
+ if ( !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS))
return &dat->list;
- pNextField = ( TCHAR* )szName;
+ pNextField = (TCHAR*)szName;
do {
pBackslash = _tcschr(pNextField, '\\');
if (pBackslash == NULL) {
@@ -55,7 +55,7 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, pNextField = NULL;
}
else {
- lstrcpyn(szThisField, pNextField, min( SIZEOF(szThisField), pBackslash - pNextField + 1 ));
+ lstrcpyn(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
compareResult = 1;
@@ -79,7 +79,7 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, }
if (pNextField == NULL && group->cl.items[i]->groupId == 0)
break;
- if (!(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && group->cl.items[i]->groupId > groupId)
+ if ( !(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && group->cl.items[i]->groupId > groupId)
break;
}
if (compareResult) {
@@ -87,12 +87,12 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, return NULL;
i = cli.pfnAddItemToGroup(group, i);
group->cl.items[i]->type = CLCIT_GROUP;
- lstrcpyn(group->cl.items[i]->szText, szThisField, SIZEOF( group->cl.items[i]->szText ));
+ lstrcpyn(group->cl.items[i]->szText, szThisField, SIZEOF(group->cl.items[i]->szText));
group->cl.items[i]->groupId = (WORD) (pNextField ? 0 : groupId);
group->cl.items[i]->group = (struct ClcGroup *) mir_alloc(sizeof(struct ClcGroup));
group->cl.items[i]->group->parent = group;
group = group->cl.items[i]->group;
- memset( &group->cl, 0, sizeof( group->cl ));
+ memset(&group->cl, 0, sizeof(group->cl));
group->cl.increment = 10;
if (flags == (DWORD) - 1 || pNextField != NULL) {
group->expanded = 0;
@@ -108,8 +108,8 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact) {
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry( hContact );
- if ( !lstrcmp( cache->group, szName) && (style & CLS_SHOWHIDDEN || !cache->isHidden ))
+ ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
+ if ( !lstrcmp(cache->group, szName) && (style & CLS_SHOWHIDDEN || !cache->isHidden))
group->totalMembers++;
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
@@ -163,7 +163,7 @@ int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText group->cl.items[i]->type = CLCIT_INFO;
group->cl.items[i]->flags = (BYTE) flags;
group->cl.items[i]->hContact = (HANDLE)++ iInfoItemUniqueHandle;
- lstrcpyn(group->cl.items[i]->szText, pszText, SIZEOF( group->cl.items[i]->szText ));
+ lstrcpyn(group->cl.items[i]->szText, pszText, SIZEOF(group->cl.items[i]->szText));
return i;
}
@@ -177,10 +177,10 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon dat->needsResort = 1;
for (i = group->cl.count - 1; i >= 0; i--) {
- if (group->cl.items[i]->hContact == hContact )
+ if (group->cl.items[i]->hContact == hContact)
return i;
- if ( index == -1 )
+ if (index == -1)
if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags & CLCIIF_BELOWCONTACTS))
index = i;
}
@@ -208,8 +208,8 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText));
{ ClcCacheEntryBase* p = cli.pfnGetCacheEntry(hContact);
- if ( p != NULL ) {
- if ( p->group ) mir_free( p->group );
+ if (p != NULL) {
+ if (p->group) mir_free(p->group);
p->group = NULL;
} }
@@ -231,7 +231,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd if (szProto != NULL)
status = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- if ( DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
+ if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
group = &dat->list;
else {
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0);
@@ -239,7 +239,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd int i, len;
DWORD groupFlags;
TCHAR *szGroupName;
- if (!(style & CLS_HIDEEMPTYGROUPS)) {
+ if ( !(style & CLS_HIDEEMPTYGROUPS)) {
mir_free(dbv.ptszVal);
return;
}
@@ -250,7 +250,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd mir_free(dbv.ptszVal);
return;
} //never happens
- if (!lstrcmp(szGroupName, dbv.ptszVal))
+ if ( !lstrcmp(szGroupName, dbv.ptszVal))
break;
}
if (groupFlags & GROUPF_HIDEOFFLINE) {
@@ -264,10 +264,10 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd mir_free(dbv.ptszVal);
return;
} //never happens
- if (!lstrcmp(szGroupName, dbv.ptszVal))
+ if ( !lstrcmp(szGroupName, dbv.ptszVal))
break;
len = lstrlen(szGroupName);
- if (!_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\')
+ if ( !_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\')
cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, groupFlags, i, 1);
@@ -289,21 +289,21 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount)
{
int iContact;
- if (( iContact = List_IndexOf(( SortedList* )&group->cl, contact )) == -1 )
+ if ((iContact = List_IndexOf((SortedList*)&group->cl, contact)) == -1)
return group;
if (updateTotalCount && contact->type == CLCIT_CONTACT)
group->totalMembers--;
{ ClcCacheEntryBase* p = cli.pfnGetCacheEntry(contact->hContact);
- if ( p != NULL ) {
- if ( p->group ) mir_free( p->group );
+ if (p != NULL) {
+ if (p->group) mir_free(p->group);
p->group = NULL;
} }
- cli.pfnFreeContact( group->cl.items[iContact] );
- mir_free( group->cl.items[iContact] );
- List_Remove(( SortedList* )&group->cl, iContact );
+ cli.pfnFreeContact(group->cl.items[iContact]);
+ mir_free(group->cl.items[iContact]);
+ List_Remove((SortedList*)&group->cl, iContact);
if ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) && group->cl.count == 0) {
int i;
@@ -326,10 +326,10 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0);
dat->needsResort = 1;
- if (!cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) {
+ if ( !cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) {
DBVARIANT dbv;
int i, nameOffset;
- if (!IsHContactContact(hItem))
+ if ( !IsHContactContact(hItem))
return;
if (DBGetContactSettingTString(hItem, "CList", "Group", &dbv))
return;
@@ -342,7 +342,7 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) break;
if (group->cl.items[i]->type == CLCIT_GROUP) {
int len = lstrlen(group->cl.items[i]->szText);
- if (!_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) &&
+ if ( !_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) &&
(dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) {
group->totalMembers--;
if (dbv.ptszVal[nameOffset + len] == '\0')
@@ -394,13 +394,13 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) if (group != NULL) {
group->totalMembers++;
- if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL) {
- if (!cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
+ if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
cli.pfnAddContactToGroup(dat, group, hContact);
}
- else if (!cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
+ else if ( !cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
cli.pfnAddContactToGroup(dat, group, hContact);
}
else cli.pfnAddContactToGroup(dat, group, hContact);
@@ -447,7 +447,7 @@ int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly) break;
group = group->parent;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) {
+ else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ( !visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
count += group->cl.count;
@@ -460,16 +460,16 @@ int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly) static int __cdecl GroupSortProc(const void* p1, const void* p2)
{
- ClcContact **contact1 = ( ClcContact** )p1, **contact2 = ( ClcContact** )p2;
+ ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2;
return lstrcmpi(contact1[0]->szText, contact2[0]->szText);
}
static int __cdecl ContactSortProc(const void* p1, const void* p2)
{
- ClcContact **contact1 = ( ClcContact** )p1, **contact2 = ( ClcContact** )p2;
+ ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2;
- int result = cli.pfnCompareContacts( contact1[0], contact2[0] );
+ int result = cli.pfnCompareContacts(contact1[0], contact2[0]);
if (result)
return result;
//nothing to distinguish them, so make sure they stay in the same order
@@ -498,8 +498,8 @@ static void SortGroup(struct ClcData *dat, struct ClcGroup *group, int useInsert for (i = group->cl.count - 1; i >= 0; i--) {
if (group->cl.items[i]->type == CLCIT_DIVIDER) {
- mir_free( group->cl.items[i] );
- List_Remove(( SortedList* )&group->cl, i );
+ mir_free(group->cl.items[i]);
+ List_Remove((SortedList*)&group->cl, i);
} }
for (i = 0; i < group->cl.count; i++)
@@ -550,7 +550,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) struct ClcGroup *group = &dat->list, *selgroup;
HANDLE hSelItem;
- if ( dat->needsResort ) {
+ if (dat->needsResort) {
if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1)
hSelItem = NULL;
else
@@ -611,9 +611,9 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) KillTimer(hwnd, TIMERID_RENAME);
cli.pfnEndRename(hwnd, dat, 1);
- OBJLIST<SavedContactState_t> saveContact( 10, HandleKeySortT );
- OBJLIST<SavedGroupState_t> saveGroup( 100, NumericKeySortT );
- OBJLIST<SavedInfoState_t> saveInfo( 10, NumericKeySortT );
+ OBJLIST<SavedContactState_t> saveContact(10, HandleKeySortT);
+ OBJLIST<SavedGroupState_t> saveGroup(100, NumericKeySortT);
+ OBJLIST<SavedInfoState_t> saveInfo(10, NumericKeySortT);
dat->needsResort = 1;
group = &dat->list;
@@ -631,22 +631,22 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) SavedGroupState_t* p = new SavedGroupState_t;
p->groupId = group->groupId;
p->expanded = group->expanded;
- saveGroup.insert( p );
+ saveGroup.insert(p);
continue;
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
SavedContactState_t* p = new SavedContactState_t;
p->hContact = group->cl.items[group->scanIndex]->hContact;
- CopyMemory( p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage,
+ CopyMemory(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage,
sizeof(group->cl.items[group->scanIndex]->iExtraImage));
p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
- saveContact.insert( p );
+ saveContact.insert(p);
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) {
SavedInfoState_t* p = new SavedInfoState_t;
p->parentId = (group->parent == NULL) ? -1 : group->groupId;
p->contact = *group->cl.items[group->scanIndex];
- saveInfo.insert( p );
+ saveInfo.insert(p);
}
group->scanIndex++;
}
@@ -668,14 +668,14 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) SavedGroupState_t tmp, *p;
tmp.groupId = group->groupId;
- if (( p = saveGroup.find( &tmp )) != NULL )
+ if ((p = saveGroup.find(&tmp)) != NULL)
group->expanded = p->expanded;
continue;
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
SavedContactState_t tmp, *p;
tmp.hContact = group->cl.items[group->scanIndex]->hContact;
- if (( p = saveContact.find( &tmp )) != NULL ) {
+ if ((p = saveContact.find(&tmp)) != NULL) {
CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage,
SIZEOF(group->cl.items[group->scanIndex]->iExtraImage));
if (p->checked)
@@ -689,7 +689,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) if (saveInfo[i].parentId == -1)
group = &dat->list;
else {
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL))
continue;
group = contact->group;
}
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index 6757f7ae41..8c4de5232d 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -57,14 +57,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (cii->hParentGroup == NULL)
group = &dat->list;
else {
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL))
return (LRESULT) (HANDLE) NULL;
group = groupContact->group;
}
- if ( msg == CLM_ADDINFOITEMA )
- { WCHAR* wszText = mir_a2u(( char* )cii->pszText );
+ if (msg == CLM_ADDINFOITEMA)
+ { WCHAR* wszText = mir_a2u((char*)cii->pszText);
i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
- mir_free( wszText );
+ mir_free(wszText);
}
else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
cli.pfnRecalcScrollBar(hwnd, dat);
@@ -95,7 +95,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR {
ClcContact *contact;
ClcGroup *group, *tgroup;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -106,7 +106,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_EXPAND:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_GROUP)
break;
@@ -115,12 +115,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR }
case CLM_FINDCONTACT:
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
return (LRESULT) (HANDLE) NULL;
return wParam;
case CLM_FINDGROUP:
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL))
return (LRESULT) (HANDLE) NULL;
return wParam | HCONTACT_ISGROUP;
@@ -130,7 +130,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETCHECKMARK:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
return (contact->flags & CONTACTF_CHECKED) != 0;
}
@@ -144,7 +144,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETEXPAND:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return CLE_INVALID;
if (contact->type != CLCIT_GROUP)
return CLE_INVALID;
@@ -159,7 +159,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
if (LOWORD(lParam) >= dat->extraColumnsCount)
return 0xFF;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0xFF;
return contact->iExtraImage[LOWORD(lParam)];
}
@@ -179,22 +179,22 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return dat->groupIndent;
case CLM_GETISEARCHSTRING:
- lstrcpy(( TCHAR* ) lParam, dat->szQuickSearch);
+ lstrcpy((TCHAR*) lParam, dat->szQuickSearch);
return lstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
- lstrcpy(( TCHAR* ) lParam, contact->szText);
+ lstrcpy((TCHAR*) lParam, contact->szText);
return lstrlen(contact->szText);
}
case CLM_GETITEMTYPE:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return CLCIT_INVALID;
return contact->type;
}
@@ -212,7 +212,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
ClcGroup *group;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL))
return NULL;
int i = List_IndexOf((SortedList*)&group->cl, contact);
@@ -316,7 +316,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR {
ClcContact *contact;
ClcGroup *group, *tgroup;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -326,7 +326,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR }
case CLM_SETBKBITMAP:
- if (!dat->bkChanged && dat->hBmpBackground) {
+ if ( !dat->bkChanged && dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
dat->hBmpBackground = NULL;
}
@@ -337,7 +337,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETBKCOLOR:
- if (!dat->bkChanged && dat->hBmpBackground) {
+ if ( !dat->bkChanged && dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
dat->hBmpBackground = NULL;
}
@@ -349,7 +349,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETCHECKMARK:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
if (lParam)
contact->flags |= CONTACTF_CHECKED;
@@ -372,7 +372,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
if (LOWORD(lParam) >= dat->extraColumnsCount)
return 0;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
contact->iExtraImage[LOWORD(lParam)] = (BYTE) HIWORD(lParam);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -428,9 +428,9 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETITEMTEXT:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
- lstrcpyn(contact->szText, ( TCHAR* )lParam, SIZEOF( contact->szText ));
+ lstrcpyn(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 054657878f..e49e9621b3 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -76,7 +76,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
POINT pt;
- if ( flags )
+ if (flags)
*flags = 0;
pt.x = testx;
@@ -95,15 +95,15 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT);
if (h != hwndTemp)
{
- if (!hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX))
+ if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX))
return -1;
}
}
while (hwndParent);
GetClientRect(hwnd, &clRect);
- if ( testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right ) {
- if ( flags ) {
+ if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
+ if (flags) {
if (testx < 0)
*flags |= CLCHT_TOLEFT;
else if (testx >= clRect.right)
@@ -121,7 +121,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo return -1;
}
hit = cli.pfnRowHitTest(dat, dat->yScroll + testy);
- if ( hit != -1 )
+ if (hit != -1)
hit = cli.pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
if (hit == -1) {
if (flags)
@@ -160,7 +160,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo if (hitcontact->iExtraImage[i] == 0xFF)
continue;
if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) &&
- testx < clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + g_IconWidth ) {
+ testx < clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + g_IconWidth) {
if (flags)
*flags |= CLCHT_ONITEMEXTRA | (i << 24);
return hit;
@@ -168,9 +168,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo }
hdc = GetDC(hwnd);
if (hitcontact->type == CLCIT_GROUP)
- hFont = ( HFONT )SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont);
+ hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont);
else
- hFont = ( HFONT )SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont);
+ hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont);
GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
@@ -217,10 +217,10 @@ void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) desty = 0;
if (abs(desty - dat->yScroll) < 4)
noSmooth = 1;
- if (!noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING)
+ if ( !noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING)
noSmooth = 1;
previousy = dat->yScroll;
- if (!noSmooth) {
+ if ( !noSmooth) {
startTick = GetTickCount();
for (;;) {
nowTick = GetTickCount();
@@ -372,8 +372,8 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi continue;
}
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
- if ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) ||
- (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) {
+ if ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) ||
+ ( !prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) {
struct ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
@@ -381,7 +381,7 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
}
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) {
+ if ( !(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
continue;
@@ -420,7 +420,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) else if (contact->type == CLCIT_CONTACT) {
cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
TCHAR* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
- if (!text[0] || !lstrcmp(otherName, text))
+ if ( !text[0] || !lstrcmp(otherName, text))
DBDeleteContactSetting(contact->hContact, "CList", "MyHandle");
else
DBWriteContactSettingTString(contact->hContact, "CList", "MyHandle", text);
@@ -445,7 +445,7 @@ void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat) CallService(MS_CLIST_GROUPDELETE, (WPARAM)contact->groupId, 0);
break;
case CLCIT_CONTACT:
- CallService("CList/DeleteContactCommand", (WPARAM)contact->hContact, (LPARAM)hwnd );
+ CallService("CList/DeleteContactCommand", (WPARAM)contact->hContact, (LPARAM)hwnd);
break;
} }
@@ -496,9 +496,9 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
return;
GetClientRect(hwnd, &clRect);
- cli.pfnCalcEipPosition( dat, contact, group, &pt );
+ cli.pfnCalcEipPosition(dat, contact, group, &pt);
h = cli.pfnGetRowHeight(dat, dat->selection);
- dat->hwndRenameEdit = CreateWindow( _T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
+ dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
@@ -507,7 +507,7 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) SetFocus(dat->hwndRenameEdit);
}
-void fnCalcEipPosition( struct ClcData *dat, struct ClcContact *, struct ClcGroup *group, POINT *result)
+void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *, struct ClcGroup *group, POINT *result)
{
int indent;
for (indent = 0; group->parent; indent++, group = group->parent);
@@ -526,7 +526,7 @@ int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt) GetClientRect(hwnd, &clRect);
dat->selection = dat->iDragItem;
dat->iInsertionMark = -1;
- if (!PtInRect(&clRect, pt))
+ if ( !PtInRect(&clRect, pt))
return DROPTARGET_OUTSIDE;
hit = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, &group, &hitFlags);
@@ -691,7 +691,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) cli.pfnGetDefaultFontSetting(i, lf, colour);
mir_snprintf(idstr, SIZEOF(idstr), "Font%dName", i);
- if ( !DBGetContactSettingTString(NULL, "CLC", idstr, &dbv )) {
+ if ( !DBGetContactSettingTString(NULL, "CLC", idstr, &dbv)) {
lstrcpy(lf->lfFaceName, dbv.ptszVal);
mir_free(dbv.pszVal);
}
@@ -725,7 +725,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) HDC hdc = GetDC(hwnd);
for (i = 0; i <= FONTID_MAX; i++)
{
- if (!dat->fontInfo[i].changed)
+ if ( !dat->fontInfo[i].changed)
DeleteObject(dat->fontInfo[i].hFont);
cli.pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour);
@@ -750,7 +750,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->showIdle = DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE);
dat->noVScrollbar = DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0);
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
- if (!dat->bkChanged) {
+ if ( !dat->bkChanged) {
DBVARIANT dbv;
dat->bkColour = DBGetContactSettingDword(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
if (dat->hBmpBackground) {
@@ -758,7 +758,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->hBmpBackground = NULL;
}
if (DBGetContactSettingByte(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- if (!DBGetContactSettingString(NULL, "CLC", "BkBitmap", &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "CLC", "BkBitmap", &dbv)) {
dat->hBmpBackground = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM) dbv.pszVal);
mir_free(dbv.pszVal);
}
@@ -813,7 +813,7 @@ void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat) }
else if (group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->type == CLCIT_CONTACT) {
group->scanIndex |= GSIF_HASMEMBERS;
- if (!(group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED))
+ if ( !(group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED))
group->scanIndex &= ~GSIF_ALLCHECKED;
}
group->scanIndex++;
@@ -844,7 +844,7 @@ void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked) void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem)
{
RECT rc;
- if ( iItem == -1 )
+ if (iItem == -1)
return;
GetClientRect(hwnd, &rc);
@@ -873,7 +873,7 @@ int fnGetRowHeight(struct ClcData *dat, int) }
int fnRowHitTest(struct ClcData *dat, int y)
-{ if (!dat->rowHeight)
+{ if ( !dat->rowHeight)
return y;
return y / dat->rowHeight;
}
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index ae662be16f..924634ad06 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -29,31 +29,31 @@ CLIST_INTERFACE cli = { 0 }; static TCHAR szTip[MAX_TIP_SIZE+1];
-int LoadContactListModule2( void );
-int LoadCLCModule( void );
-void BuildProtoMenus( void );
+int LoadContactListModule2(void);
+int LoadCLCModule(void);
+void BuildProtoMenus(void);
static int interfaceInited = 0;
-static void fnPaintClc( HWND, ClcData*, HDC, RECT* )
+static void fnPaintClc(HWND, ClcData*, HDC, RECT*)
{
}
-static struct ClcContact* fnCreateClcContact( void )
+static struct ClcContact* fnCreateClcContact(void)
{
- return ( struct ClcContact* )mir_calloc( sizeof( struct ClcContact ));
+ return (struct ClcContact*)mir_calloc(sizeof(struct ClcContact));
}
-static BOOL fnInvalidateRect( HWND hwnd, CONST RECT* lpRect, BOOL bErase )
+static BOOL fnInvalidateRect(HWND hwnd, CONST RECT* lpRect, BOOL bErase)
{
- return InvalidateRect( hwnd, lpRect, bErase );
+ return InvalidateRect(hwnd, lpRect, bErase);
}
-static void fnOnCreateClc( void )
+static void fnOnCreateClc(void)
{
}
-static void fnReloadProtoMenus( void )
+static void fnReloadProtoMenus(void)
{
RebuildMenuOrder();
if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
@@ -61,11 +61,11 @@ static void fnReloadProtoMenus( void ) cli.pfnCluiProtocolStatusChanged(0, 0);
}
-static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam )
+static INT_PTR srvRetrieveInterface(WPARAM, LPARAM lParam)
{
int rc;
- if ( interfaceInited == 0 ) {
+ if (interfaceInited == 0) {
cli.version = 6;
cli.bDisplayLocked = TRUE;
@@ -207,7 +207,7 @@ static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) cli.pfnGetProtocolMenu = fnGetProtocolMenu;
cli.pfnConvertMenu = fnConvertMenu;
- cli.hInst = ( HMODULE )lParam;
+ cli.hInst = (HMODULE)lParam;
rc = LoadContactListModule2();
if (rc == 0)
@@ -215,11 +215,11 @@ static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) interfaceInited = 1;
}
- return ( LPARAM )&cli;
+ return (LPARAM)&cli;
}
int LoadContactListModule()
{
- CreateServiceFunction( MS_CLIST_RETRIEVE_INTERFACE, srvRetrieveInterface );
+ CreateServiceFunction(MS_CLIST_RETRIEVE_INTERFACE, srvRetrieveInterface);
return 0;
}
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 46045daa04..8177e233d4 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -90,7 +90,7 @@ static void ShowEventsInTray() char ** pTrayProtos;
char nTrayProtoCnt;
int nTrayCnt=cli.trayIconCount;
- if (!cli.events.count || !nTrayCnt) return;
+ if ( !cli.events.count || !nTrayCnt) return;
if (cli.events.count == 1 || nTrayCnt == 1)
{
ShowOneEventInTray(0); //for only one icon in tray show topmost event
@@ -113,10 +113,10 @@ static void ShowEventsInTray() {
int j;
for (j=0; j<nTrayProtoCnt; j++)
- if ( iEventProto && pTrayProtos[j] && !lstrcmpA(pTrayProtos[j], iEventProto))
+ if (iEventProto && pTrayProtos[j] && !lstrcmpA(pTrayProtos[j], iEventProto))
break;
- if ( j>=nTrayProtoCnt ) j=0; //event was not found so assume first icon
- if ( pTrayProtos[j] ) //if not already set
+ if (j>=nTrayProtoCnt) j=0; //event was not found so assume first icon
+ if (pTrayProtos[j]) //if not already set
ShowOneEventInTray(i); //show it
pTrayProtos[j]=NULL; //and clear slot
}
@@ -137,18 +137,18 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD) //decrease eflashes in any case - no need to collect all events
if (cli.events.items[i]->cle.flags & CLEF_ONLYAFEW) {
if (0 >= --cli.events.items[i]->flashesDone)
- cli.pfnRemoveEvent( cli.events.items[i]->cle.hContact, cli.events.items[i]->cle.hDbEvent);
+ cli.pfnRemoveEvent(cli.events.items[i]->cle.hContact, cli.events.items[i]->cle.hDbEvent);
} }
if (cli.events.count == 0) {
KillTimer(NULL, idEvent);
- cli.pfnTrayIconSetToBase( NULL );
+ cli.pfnTrayIconSetToBase(NULL);
}
iconsOn = !iconsOn;
}
-struct CListEvent* fnAddEvent( CLISTEVENT *cle )
+struct CListEvent* fnAddEvent(CLISTEVENT *cle)
{
int i;
struct CListEvent* p;
@@ -158,15 +158,15 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) if (cle->flags & CLEF_URGENT) {
for (i = 0; i < cli.events.count; i++)
- if (!(cli.events.items[i]->cle.flags & CLEF_URGENT))
+ if ( !(cli.events.items[i]->cle.flags & CLEF_URGENT))
break;
}
else i = cli.events.count;
- if (( p = ( struct CListEvent* )cli.pfnCreateEvent()) == NULL )
+ if ((p = (struct CListEvent*)cli.pfnCreateEvent()) == NULL)
return NULL;
- List_Insert(( SortedList* )&cli.events, p, i );
+ List_Insert((SortedList*)&cli.events, p, i);
p->cle = *cle;
p->imlIconIndex = fnGetImlIconIndex(cli.events.items[i]->cle.hIcon);
p->flashesDone = 12;
@@ -188,7 +188,7 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cle->hContact, 0);
iconsOn = 1;
flashTimerId = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), IconFlashTimer);
- cli.pfnTrayIconUpdateWithImageList( p->imlIconIndex, p->cle.ptszTooltip, szProto);
+ cli.pfnTrayIconUpdateWithImageList(p->imlIconIndex, p->cle.ptszTooltip, szProto);
}
cli.pfnChangeContactIcon(cle->hContact, p->imlIconIndex, 1);
cli.pfnSortContacts();
@@ -197,7 +197,7 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) // Removes an event from the contact list's queue
// Returns 0 if the event was successfully removed, or nonzero if the event was not found
-int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent )
+int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent)
{
int i;
char *szProto;
@@ -219,8 +219,8 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) 0);
// Free any memory allocated to the event
- cli.pfnFreeEvent( cli.events.items[i] );
- List_Remove(( SortedList* )&cli.events, i );
+ cli.pfnFreeEvent(cli.events.items[i]);
+ List_Remove((SortedList*)&cli.events, i);
{
//count same protocoled events
char * szEventProto;
@@ -241,7 +241,7 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) if (cli.events.count == 0 || nSameProto == 0) {
if (cli.events.count == 0)
KillTimer(NULL, flashTimerId);
- cli.pfnTrayIconSetToBase( hContact == NULL ? NULL : szProto);
+ cli.pfnTrayIconSetToBase(hContact == NULL ? NULL : szProto);
}
else {
if (cli.events.items[0]->cle.hContact == NULL)
@@ -254,9 +254,9 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) return 0;
}
-CLISTEVENT* fnGetEvent( HANDLE hContact, int idx )
+CLISTEVENT* fnGetEvent(HANDLE hContact, int idx)
{
- if ( hContact == INVALID_HANDLE_VALUE) {
+ if (hContact == INVALID_HANDLE_VALUE) {
if (idx >= cli.events.count)
return NULL;
return &cli.events.items[idx]->cle;
@@ -303,10 +303,10 @@ int fnEventsProcessTrayDoubleClick(int index) char * eventProto=NULL;
if (cli.events.items[i]->cle.hContact)
eventProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cli.events.items[i]->cle.hContact, 0);
- if (!eventProto)
+ if ( !eventProto)
eventProto=cli.events.items[i]->cle.lpszProtocol;
- if (!eventProto || !_strcmpi(eventProto, szProto)) {
+ if ( !eventProto || !_strcmpi(eventProto, szProto)) {
eventIndex=i;
break;
} }
@@ -319,7 +319,7 @@ int fnEventsProcessTrayDoubleClick(int index) char * eventProto=NULL;
if (cli.events.items[i]->cle.hContact)
eventProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cli.events.items[i]->cle.hContact, 0);
- if (!eventProto)
+ if ( !eventProto)
eventProto=cli.events.items[i]->cle.lpszProtocol;
if (eventProto) {
for (j=0; j<cli.trayIconCount; j++)
@@ -338,7 +338,7 @@ int fnEventsProcessTrayDoubleClick(int index) cli.pfnUnlockTray();
hContact = cli.events.items[eventIndex]->cle.hContact;
hDbEvent = cli.events.items[eventIndex]->cle.hDbEvent;
- //if (!ServiceExists(cli.events.items[eventIndex]->cle.pszService))
+ //if ( !ServiceExists(cli.events.items[eventIndex]->cle.pszService))
// ; may be better to show send msg?
CallService(cli.events.items[eventIndex]->cle.pszService, (WPARAM) NULL, (LPARAM) & cli.events.items[eventIndex]->cle);
cli.pfnRemoveEvent(hContact, hDbEvent);
@@ -388,13 +388,13 @@ static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam) /***************************************************************************************/
INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC", wParam, lParam); }
-INT_PTR AddEventStub(WPARAM, LPARAM lParam) { return cli.pfnAddEvent((CLISTEVENT*)lParam ) == NULL; }
-INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam, (HANDLE)lParam ); }
+INT_PTR AddEventStub(WPARAM, LPARAM lParam) { return cli.pfnAddEvent((CLISTEVENT*)lParam) == NULL; }
+INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam, (HANDLE)lParam); }
INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HANDLE)wParam, (int)lParam); }
int InitCListEvents(void)
{
- memset( &cli.events, 0, sizeof(cli.events));
+ memset(&cli.events, 0, sizeof(cli.events));
cli.events.increment = 10;
disableTrayFlash = DBGetContactSettingByte(NULL, "CList", "DisableTrayFlash", 0);
@@ -408,18 +408,18 @@ int InitCListEvents(void) return 0;
}
-struct CListEvent* fnCreateEvent( void )
+struct CListEvent* fnCreateEvent(void)
{
- return (struct CListEvent*)mir_calloc( sizeof(struct CListEvent));
+ return (struct CListEvent*)mir_calloc(sizeof(struct CListEvent));
}
-void fnFreeEvent( struct CListEvent* p )
+void fnFreeEvent(struct CListEvent* p)
{
- if ( p->cle.pszService )
- mir_free( p->cle.pszService );
- if ( p->cle.pszTooltip )
- mir_free( p->cle.pszTooltip );
- mir_free( p );
+ if (p->cle.pszService)
+ mir_free(p->cle.pszService);
+ if (p->cle.pszTooltip)
+ mir_free(p->cle.pszTooltip);
+ mir_free(p);
}
void UninitCListEvents(void)
@@ -429,9 +429,9 @@ void UninitCListEvents(void) if (cli.events.count) KillTimer(NULL, flashTimerId);
for (i = 0; i < cli.events.count; i++)
- cli.pfnFreeEvent(( struct CListEvent* )cli.events.items[i] );
- List_Destroy(( SortedList* )&cli.events );
+ cli.pfnFreeEvent((struct CListEvent*)cli.events.items[i]);
+ List_Destroy((SortedList*)&cli.events);
- if ( imlIcon != NULL )
- mir_free( imlIcon );
+ if (imlIcon != NULL)
+ mir_free(imlIcon);
}
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index e26ca5f13f..c9cc9212a9 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -141,16 +141,16 @@ typedef struct _MenuItemHandles /////////////////////////////////////////////////////////////////////////////////////////
// service functions
-void FreeMenuProtos( void )
+void FreeMenuProtos(void)
{
int i;
- if ( cli.menuProtos ) {
- for ( i=0; i < cli.menuProtoCount; i++ )
- if ( cli.menuProtos[i].szProto )
+ if (cli.menuProtos) {
+ for (i=0; i < cli.menuProtoCount; i++)
+ if (cli.menuProtos[i].szProto)
mir_free(cli.menuProtos[i].szProto);
- mir_free( cli.menuProtos );
+ mir_free(cli.menuProtos);
cli.menuProtos = NULL;
}
cli.menuProtoCount = 0;
@@ -163,16 +163,16 @@ int GetAverageMode(int* pNetProtoCount = NULL) int netProtoCount = 0;
int averageMode = 0;
- for ( int i=0; i < accounts.getCount(); i++ ) {
+ for (int i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( cli.pfnGetProtocolVisibility( pa->szModuleName ) == 0 )
+ if (cli.pfnGetProtocolVisibility(pa->szModuleName) == 0)
continue;
netProtoCount++;
- if ( averageMode == 0 )
- averageMode = CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0 );
- else if ( averageMode > 0 && averageMode != CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0 )) {
+ if (averageMode == 0)
+ averageMode = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ else if (averageMode > 0 && averageMode != CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0)) {
averageMode = -1;
if (pNetProtoCount == NULL) break;
}
@@ -215,8 +215,8 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- lpMainMenuExecParam mmep = ( lpMainMenuExecParam )mir_alloc( sizeof( MainMenuExecParam ));
- if ( mmep == NULL )
+ lpMainMenuExecParam mmep = (lpMainMenuExecParam)mir_alloc(sizeof(MainMenuExecParam));
+ if (mmep == NULL)
return 0;
//we need just one parametr.
@@ -225,7 +225,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) mmep->szMenuName = tmi.ptszName;
tmi.ownerdata = mmep;
- PMO_IntMenuItem pimi = MO_AddNewMenuItem( hMainMenuObject, &tmi );
+ PMO_IntMenuItem pimi = MO_AddNewMenuItem(hMainMenuObject, &tmi);
char* name;
bool needFree = false;
@@ -233,15 +233,15 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) if (mi->pszService)
name = mi->pszService;
else if (mi->flags & CMIF_UNICODE) {
- name = mir_t2a( mi->ptszName );
+ name = mir_t2a(mi->ptszName);
needFree = true;
}
else name = mi->pszName;
- MO_SetOptionsMenuItem( pimi, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )name );
+ MO_SetOptionsMenuItem(pimi, OPT_MENUITEMSETUNIQNAME, (INT_PTR)name);
if (needFree) mir_free(name);
- return ( INT_PTR )pimi;
+ return (INT_PTR)pimi;
}
int MainMenuCheckService(WPARAM, LPARAM)
@@ -254,8 +254,8 @@ int MainMenuCheckService(WPARAM, LPARAM) //lparam - lparam from winproc
INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam)
{
- lpMainMenuExecParam mmep = ( lpMainMenuExecParam )wParam;
- if ( mmep != NULL ) {
+ lpMainMenuExecParam mmep = (lpMainMenuExecParam)wParam;
+ if (mmep != NULL) {
// bug in help.c, it used wparam as parent window handle without reason.
if ( !lstrcmpA(mmep->szServiceName, "Help/AboutCommand"))
mmep->Param1 = 0;
@@ -267,10 +267,10 @@ INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR FreeOwnerDataMainMenu(WPARAM, LPARAM lParam)
{
- lpMainMenuExecParam mmep = ( lpMainMenuExecParam )lParam;
- if ( mmep != NULL ) {
- FreeAndNil(( void** )&mmep->szServiceName);
- FreeAndNil(( void** )&mmep);
+ lpMainMenuExecParam mmep = (lpMainMenuExecParam)lParam;
+ if (mmep != NULL) {
+ FreeAndNil((void**)&mmep->szServiceName);
+ FreeAndNil((void**)&mmep);
}
return 0;
}
@@ -291,52 +291,52 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- if ( !( mi->flags & CMIF_ROOTHANDLE )) {
+ if ( !(mi->flags & CMIF_ROOTHANDLE)) {
//old system
tmi.flags |= CMIF_ROOTHANDLE;
tmi.root = NULL;
}
//owner data
- lpContactMenuExecParam cmep = ( lpContactMenuExecParam )mir_calloc(sizeof(ContactMenuExecParam));
- cmep->szServiceName = mir_strdup( mi->pszService );
- if ( mi->pszContactOwner != NULL )
- cmep->pszContactOwner = mir_strdup( mi->pszContactOwner );
+ lpContactMenuExecParam cmep = (lpContactMenuExecParam)mir_calloc(sizeof(ContactMenuExecParam));
+ cmep->szServiceName = mir_strdup(mi->pszService);
+ if (mi->pszContactOwner != NULL)
+ cmep->pszContactOwner = mir_strdup(mi->pszContactOwner);
cmep->param = mi->popupPosition;
tmi.ownerdata = cmep;
//may be need to change how UniqueName is formed?
- PMO_IntMenuItem menuHandle = MO_AddNewMenuItem( hContactMenuObject, &tmi );
+ PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hContactMenuObject, &tmi);
char buf[ 256 ];
if (mi->pszService)
- mir_snprintf( buf, SIZEOF(buf), "%s/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", (mi->pszService) ? mi->pszService : "" );
+ mir_snprintf(buf, SIZEOF(buf), "%s/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", (mi->pszService) ? mi->pszService : "");
else if (mi->ptszName)
{
if (tmi.flags&CMIF_UNICODE)
{
char * temp = mir_t2a(mi->ptszName);
- mir_snprintf( buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", temp );
+ mir_snprintf(buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", temp);
mir_free(temp);
}
else
- mir_snprintf( buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", mi->ptszName );
+ mir_snprintf(buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", mi->ptszName);
}
else buf[0]='\0';
- if (buf[0]) MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
- return ( INT_PTR )menuHandle;
+ if (buf[0]) MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
+ return (INT_PTR)menuHandle;
}
static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM)
{
- HANDLE hContact = ( HANDLE )wParam;
+ HANDLE hContact = (HANDLE)wParam;
NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0);
char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
BuildContactParam bcp;
bcp.szProto = szProto;
- bcp.isOnList = ( DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 0 );
- bcp.isOnline = ( szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE));
+ bcp.isOnList = (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 0);
+ bcp.isOnline = (szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE));
ListParam param = { 0 };
param.MenuObjectHandle = hContactMenuObject;
@@ -364,41 +364,41 @@ INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam) //true - ok, false ignore
INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = ( PCheckProcParam )wParam;
- if ( pcpp == NULL )
+ PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ if (pcpp == NULL)
return FALSE;
- BuildContactParam *bcp = ( BuildContactParam* )pcpp->wParam;
- if ( bcp == NULL )
+ BuildContactParam *bcp = (BuildContactParam*)pcpp->wParam;
+ if (bcp == NULL)
return FALSE;
- lpContactMenuExecParam cmep = ( lpContactMenuExecParam )pcpp->MenuItemOwnerData;
- if ( cmep == NULL ) //this is root...build it
+ lpContactMenuExecParam cmep = (lpContactMenuExecParam)pcpp->MenuItemOwnerData;
+ if (cmep == NULL) //this is root...build it
return TRUE;
- if ( cmep->pszContactOwner != NULL ) {
- if ( bcp->szProto == NULL ) return FALSE;
- if ( strcmp( cmep->pszContactOwner, bcp->szProto )) return FALSE;
+ if (cmep->pszContactOwner != NULL) {
+ if (bcp->szProto == NULL) return FALSE;
+ if (strcmp(cmep->pszContactOwner, bcp->szProto)) return FALSE;
}
TMO_MenuItem mi;
- if ( MO_GetMenuItem(( WPARAM )pcpp->MenuItemHandle, ( LPARAM )&mi ) == 0 ) {
- if ( mi.flags & CMIF_HIDDEN ) return FALSE;
- if ( mi.flags & CMIF_NOTONLIST && bcp->isOnList ) return FALSE;
- if ( mi.flags & CMIF_NOTOFFLIST && !bcp->isOnList ) return FALSE;
- if ( mi.flags & CMIF_NOTONLINE && bcp->isOnline ) return FALSE;
- if ( mi.flags & CMIF_NOTOFFLINE && !bcp->isOnline ) return FALSE;
+ if (MO_GetMenuItem((WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
+ if (mi.flags & CMIF_HIDDEN) return FALSE;
+ if (mi.flags & CMIF_NOTONLIST && bcp->isOnList) return FALSE;
+ if (mi.flags & CMIF_NOTOFFLIST && !bcp->isOnList) return FALSE;
+ if (mi.flags & CMIF_NOTONLINE && bcp->isOnline) return FALSE;
+ if (mi.flags & CMIF_NOTOFFLINE && !bcp->isOnline) return FALSE;
}
return TRUE;
}
INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam)
{
- lpContactMenuExecParam cmep = ( lpContactMenuExecParam )lParam;
- if ( cmep != NULL ) {
- FreeAndNil(( void** )&cmep->szServiceName);
- FreeAndNil(( void** )&cmep->pszContactOwner);
- FreeAndNil(( void** )&cmep);
+ lpContactMenuExecParam cmep = (lpContactMenuExecParam)lParam;
+ if (cmep != NULL) {
+ FreeAndNil((void**)&cmep->szServiceName);
+ FreeAndNil((void**)&cmep->pszContactOwner);
+ FreeAndNil((void**)&cmep);
}
return 0;
}
@@ -408,26 +408,26 @@ INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam) BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat)
{
- if (!itdat)
+ if ( !itdat)
return FALSE;
MENUITEMINFO mii = {0};
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( int i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
+ for (int i = GetMenuItemCount(hMenu)-1; i >= 0; i--) {
GetMenuItemInfo(hMenu, i, TRUE, &mii);
- if ( mii.fType == MFT_SEPARATOR )
+ if (mii.fType == MFT_SEPARATOR)
continue;
BOOL inSub = FALSE;
- if ( mii.hSubMenu )
+ if (mii.hSubMenu)
inSub = FindMenuHandleByGlobalID(mii.hSubMenu, id, itdat);
- if ( inSub )
+ if (inSub)
return inSub;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
- if ( pimi != NULL ) {
- if ( pimi == id ) {
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
+ if (pimi != NULL) {
+ if (pimi == id) {
itdat->OwnerMenu = hMenu;
itdat->position = i;
return TRUE;
@@ -438,20 +438,20 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itd INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = ( PCheckProcParam )wParam;
- if ( !pcpp )
+ PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ if ( !pcpp)
return TRUE;
- PMO_IntMenuItem timi = MO_GetIntMenuItem( pcpp->MenuItemHandle );
- if ( !timi )
+ PMO_IntMenuItem timi = MO_GetIntMenuItem(pcpp->MenuItemHandle);
+ if ( !timi)
return TRUE;
- StatusMenuExecParam *smep = ( StatusMenuExecParam* )pcpp->MenuItemOwnerData;
- if (smep && !smep->status && smep->custom ) {
- if ( wildcmp(smep->svc, "*XStatus*")) {
+ StatusMenuExecParam *smep = (StatusMenuExecParam*)pcpp->MenuItemOwnerData;
+ if (smep && !smep->status && smep->custom) {
+ if (wildcmp(smep->svc, "*XStatus*")) {
int XStatus = CallProtoService(smep->proto, "/GetXStatus", 0, 0);
char buf[255];
- mir_snprintf( buf, sizeof(buf), "*XStatus%d", XStatus );
+ mir_snprintf(buf, sizeof(buf), "*XStatus%d", XStatus);
bool check = wildcmp(smep->svc, buf);
bool reset = wildcmp(smep->svc, "*XStatus0");
@@ -461,15 +461,15 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) else
timi->mi.flags &= ~CMIF_CHECKED;
- if ( reset || check ) {
- PMO_IntMenuItem timiParent = MO_GetIntMenuItem( timi->mi.root );
+ if (reset || check) {
+ PMO_IntMenuItem timiParent = MO_GetIntMenuItem(timi->mi.root);
if (timiParent) {
CLISTMENUITEM mi2 = {0};
mi2.cbSize = sizeof(mi2);
mi2.flags = CMIM_NAME | CMIF_TCHAR;
mi2.ptszName = LangPackTranslateStringT(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.ptszName : LPGENT("Custom status"));
- timiParent = MO_GetIntMenuItem( timi->mi.root );
+ timiParent = MO_GetIntMenuItem(timi->mi.root);
MenuItemData it = {0};
@@ -478,15 +478,15 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) TCHAR d[100];
GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);
- if (!IsWinVer98Plus()) {
+ if ( !IsWinVer98Plus()) {
mi.cbSize = MENUITEMINFO_V4_SIZE;
mi.fMask = MIIM_TYPE | MIIM_STATE;
mi.fType = MFT_STRING;
}
else {
- mi.cbSize = sizeof( mi );
+ mi.cbSize = sizeof(mi);
mi.fMask = MIIM_STRING | MIIM_STATE;
- if ( timi->iconId != -1 ) {
+ if (timi->iconId != -1) {
mi.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && isThemeActive()) {
if (timi->hBmp == NULL)
@@ -498,7 +498,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) }
}
- mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED );
+ mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED);
mi.dwTypeData = mi2.ptszName;
SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi);
}
@@ -509,14 +509,14 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) timiParent->hBmp = NULL;
} } }
}
- else if ( smep && smep->status && !smep->custom ) {
- int curProtoStatus = ( smep->proto ) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode();
- if ( smep->status == curProtoStatus )
+ else if (smep && smep->status && !smep->custom) {
+ int curProtoStatus = (smep->proto) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode();
+ if (smep->status == curProtoStatus)
timi->mi.flags |= CMIF_CHECKED;
else
timi->mi.flags &= ~CMIF_CHECKED;
}
- else if (( !smep || smep->proto ) && timi->mi.pszName ) {
+ else if (( !smep || smep->proto) && timi->mi.pszName) {
int curProtoStatus=0;
BOOL IconNeedDestroy=FALSE;
char* prot;
@@ -525,20 +525,20 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) else
{
char *prn=mir_u2a(timi->mi.ptszName);
- prot = NEWSTR_ALLOCA( prn );
+ prot = NEWSTR_ALLOCA(prn);
if (prn) mir_free(prn);
}
- if ( Proto_GetAccount( prot ) == NULL )
+ if (Proto_GetAccount(prot) == NULL)
return TRUE;
- if (( curProtoStatus = CallProtoService(prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND )
+ if ((curProtoStatus = CallProtoService(prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
curProtoStatus = 0;
- if ( curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE )
+ if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus);
else {
timi->mi.hIcon=(HICON)CallProtoService(prot, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
- if ( timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND )
+ if (timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND)
timi->mi.hIcon = NULL;
else
IconNeedDestroy = TRUE;
@@ -546,9 +546,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (timi->mi.hIcon) {
timi->mi.flags |= CMIM_ICON;
- MO_ModifyMenuItem( timi, &timi->mi );
- if ( IconNeedDestroy ) {
- DestroyIcon( timi->mi.hIcon );
+ MO_ModifyMenuItem(timi, &timi->mi);
+ if (IconNeedDestroy) {
+ DestroyIcon(timi->mi.hIcon);
timi->mi.hIcon = NULL;
}
else IconLib_ReleaseIcon(timi->mi.hIcon, 0);
@@ -559,71 +559,71 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
{
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )wParam;
- if ( smep != NULL ) {
- if ( smep->custom ) {
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)wParam;
+ if (smep != NULL) {
+ if (smep->custom) {
if (smep->svc && *smep->svc)
CallService(smep->svc, 0, (LPARAM)smep->hMenuItem);
}
else {
- if ( smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL ) {
+ if (smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL) {
PMO_IntMenuItem pimi;
char *prot = smep->proto;
char szHumanName[64]={0};
- PROTOACCOUNT * acc = Proto_GetAccount( smep->proto );
+ PROTOACCOUNT * acc = Proto_GetAccount(smep->proto);
int i=(DBGetContactSettingByte(NULL, prot, "LockMainStatus", 0)?0:1);
DBWriteContactSettingByte(NULL, prot, "LockMainStatus", (BYTE)i);
- CallProtoService( smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName );
- pimi = MO_GetIntMenuItem(( HGENMENU )smep->protoindex );
+ CallProtoService(smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName);
+ pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
PMO_IntMenuItem root = (PMO_IntMenuItem)pimi->mi.root;
- mir_free( pimi->mi.pszName );
- mir_free( root->mi.pszName );
- if ( i ) {
+ mir_free(pimi->mi.pszName);
+ mir_free(root->mi.pszName);
+ if (i) {
TCHAR buf[256];
pimi->mi.flags|=CMIF_CHECKED;
- if ( cli.bDisplayLocked ) {
+ if (cli.bDisplayLocked) {
mir_sntprintf(buf, SIZEOF(buf), LPGENT("%s (locked)"), acc->tszAccountName);
- pimi->mi.ptszName = mir_tstrdup( buf );
- root->mi.ptszName = mir_tstrdup( buf );
+ pimi->mi.ptszName = mir_tstrdup(buf);
+ root->mi.ptszName = mir_tstrdup(buf);
}
else {
- pimi->mi.ptszName = mir_tstrdup( acc->tszAccountName );
- root->mi.ptszName = mir_tstrdup( acc->tszAccountName );
+ pimi->mi.ptszName = mir_tstrdup(acc->tszAccountName);
+ root->mi.ptszName = mir_tstrdup(acc->tszAccountName);
}
}
else {
- pimi->mi.ptszName = mir_tstrdup( acc->tszAccountName );
- root->mi.ptszName = mir_tstrdup( acc->tszAccountName );
+ pimi->mi.ptszName = mir_tstrdup(acc->tszAccountName);
+ root->mi.ptszName = mir_tstrdup(acc->tszAccountName);
pimi->mi.flags &= ~CMIF_CHECKED;
}
- if ( cli.hwndStatus )
- InvalidateRect( cli.hwndStatus, NULL, TRUE );
+ if (cli.hwndStatus)
+ InvalidateRect(cli.hwndStatus, NULL, TRUE);
}
- else if ( smep->proto != NULL ) {
+ else if (smep->proto != NULL) {
Proto_SetStatus(smep->proto, smep->status);
NotifyEventHooks(hStatusModeChangeEvent, smep->status, (LPARAM)smep->proto);
}
else {
int MenusProtoCount = 0;
- for ( int i=0; i < accounts.getCount(); i++ )
- if ( cli.pfnGetProtocolVisibility( accounts[i]->szModuleName ))
+ for (int i=0; i < accounts.getCount(); i++)
+ if (cli.pfnGetProtocolVisibility(accounts[i]->szModuleName))
MenusProtoCount++;
cli.currentDesiredStatusMode = smep->status;
- for ( int j=0; j < accounts.getCount(); j++ ) {
+ for (int j=0; j < accounts.getCount(); j++) {
PROTOACCOUNT* pa = accounts[j];
- if ( !Proto_IsAccountEnabled( pa ))
+ if ( !Proto_IsAccountEnabled(pa))
continue;
- if ( MenusProtoCount > 1 && Proto_IsAccountLocked( pa ))
+ if (MenusProtoCount > 1 && Proto_IsAccountLocked(pa))
continue;
Proto_SetStatus(pa->szModuleName, cli.currentDesiredStatusMode);
}
- NotifyEventHooks( hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0 );
- DBWriteContactSettingWord( NULL, "CList", "Status", ( WORD )cli.currentDesiredStatusMode );
+ NotifyEventHooks(hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0);
+ DBWriteContactSettingWord(NULL, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
return 1;
} } }
@@ -633,10 +633,10 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
{
lpStatusMenuExecParam smep = (lpStatusMenuExecParam)lParam;
- if ( smep != NULL ) {
- FreeAndNil(( void** )&smep->proto);
- FreeAndNil(( void** )&smep->svc);
- FreeAndNil(( void** )&smep);
+ if (smep != NULL) {
+ FreeAndNil((void**)&smep->proto);
+ FreeAndNil((void**)&smep->svc);
+ FreeAndNil((void**)&smep);
}
return (0);
@@ -653,30 +653,30 @@ static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam) if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- return MO_ModifyMenuItem(( PMO_IntMenuItem )wParam, &tmi );
+ return MO_ModifyMenuItem((PMO_IntMenuItem)wParam, &tmi);
}
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
{
WORD cmd = LOWORD(wParam);
- if ( HIWORD(wParam) & MPCF_MAINMENU ) {
- int hst = LOWORD( wParam );
- if ( hst >= ID_STATUS_OFFLINE && hst <= ID_STATUS_OUTTOLUNCH ) {
- int pos = statustopos( hst );
- if ( pos != -1 && hStatusMainMenuHandles != NULL )
- return MO_ProcessCommand( hStatusMainMenuHandles[ pos ], lParam );
+ if (HIWORD(wParam) & MPCF_MAINMENU) {
+ int hst = LOWORD(wParam);
+ if (hst >= ID_STATUS_OFFLINE && hst <= ID_STATUS_OUTTOLUNCH) {
+ int pos = statustopos(hst);
+ if (pos != -1 && hStatusMainMenuHandles != NULL)
+ return MO_ProcessCommand(hStatusMainMenuHandles[ pos ], lParam);
} }
- if ( !( cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX ))
+ if ( !(cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX))
return 0; // DO NOT process ids outside from clist menu id range v0.7.0.27+
//process old menu sys
- if ( HIWORD(wParam) & MPCF_CONTACTMENU )
- return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam );
+ if (HIWORD(wParam) & MPCF_CONTACTMENU)
+ return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam);
//unknown old menu
- return MO_ProcessCommandByMenuIdent( LOWORD(wParam), lParam );
+ return MO_ProcessCommandByMenuIdent(LOWORD(wParam), lParam);
}
BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat)
@@ -686,24 +686,24 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itda MENUITEMINFO mii = {0};
BOOL inSub=FALSE;
- if ( !itdat )
+ if ( !itdat)
return FALSE;
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
- GetMenuItemInfo( hMenu, i, TRUE, &mii );
- if ( mii.fType == MFT_SEPARATOR )
+ for (i = GetMenuItemCount(hMenu)-1; i >= 0; i--) {
+ GetMenuItemInfo(hMenu, i, TRUE, &mii);
+ if (mii.fType == MFT_SEPARATOR)
continue;
- if ( mii.hSubMenu )
- inSub = FindMenuHanleByGlobalID( mii.hSubMenu, id, itdat );
+ if (mii.hSubMenu)
+ inSub = FindMenuHanleByGlobalID(mii.hSubMenu, id, itdat);
if (inSub)
return inSub;
- pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData);
- if ( pimi != NULL ) {
- if ( pimi == id ) {
+ pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
+ if (pimi != NULL) {
+ if (pimi == id) {
itdat->OwnerMenu = hMenu;
itdat->position = i;
return TRUE;
@@ -717,8 +717,8 @@ static INT_PTR MenuProcessHotkey(WPARAM vKey, LPARAM) prochotkey = true;
bool res =
- MO_ProcessHotKeys( hStatusMenuObject, vKey ) ||
- MO_ProcessHotKeys( hMainMenuObject, vKey );
+ MO_ProcessHotKeys(hStatusMenuObject, vKey) ||
+ MO_ProcessHotKeys(hMainMenuObject, vKey);
prochotkey = false;
@@ -735,18 +735,18 @@ static int MenuIconsChanged(WPARAM, LPARAM) static INT_PTR MeasureMenuItem(WPARAM, LPARAM lParam)
{
- return MO_MeasureMenuItem(( LPMEASUREITEMSTRUCT )lParam );
+ return MO_MeasureMenuItem((LPMEASUREITEMSTRUCT)lParam);
}
static INT_PTR DrawMenuItem(WPARAM, LPARAM lParam)
{
- return MO_DrawMenuItem(( LPDRAWITEMSTRUCT )lParam );
+ return MO_DrawMenuItem((LPDRAWITEMSTRUCT)lParam);
}
int RecursiveDeleteMenu(HMENU hMenu)
{
int cnt = GetMenuItemCount(hMenu);
- for ( int i=0; i < cnt; i++ ) {
+ for (int i=0; i < cnt; i++) {
HMENU submenu = GetSubMenu(hMenu, 0);
if (submenu) DestroyMenu(submenu);
DeleteMenu(hMenu, 0, MF_BYPOSITION);
@@ -781,10 +781,10 @@ static INT_PTR SetStatusMode(WPARAM wParam, LPARAM) int fnGetProtocolVisibility(const char* accName)
{
- if ( accName ) {
- PROTOACCOUNT* pa = Proto_GetAccount( accName );
- return pa && pa->bIsVisible && Proto_IsAccountEnabled( pa ) &&
- pa->ppro && (pa->ppro->GetCaps( PFLAGNUM_2, 0 ) & ~pa->ppro->GetCaps( PFLAGNUM_5, 0 ));
+ if (accName) {
+ PROTOACCOUNT* pa = Proto_GetAccount(accName);
+ return pa && pa->bIsVisible && Proto_IsAccountEnabled(pa) &&
+ pa->ppro && (pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0));
}
return FALSE;
@@ -796,15 +796,15 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos) char buf[10];
DBVARIANT dbv;
- _itoa( Pos, buf, 10 );
- if ( !DBGetContactSetting( NULL, "Protocols", buf, &dbv )) {
- for ( p=0; p < protoCnt; p++ ) {
- if ( lstrcmpA( proto[p]->szName, dbv.pszVal ) == 0 ) {
- DBFreeVariant( &dbv );
+ _itoa(Pos, buf, 10);
+ if ( !DBGetContactSetting(NULL, "Protocols", buf, &dbv)) {
+ for (p=0; p < protoCnt; p++) {
+ if (lstrcmpA(proto[p]->szName, dbv.pszVal) == 0) {
+ DBFreeVariant(&dbv);
return p;
} }
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
return -1;
@@ -813,28 +813,28 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos) int fnGetAccountIndexByPos(int Pos)
{
int i;
- for ( i=0; i < accounts.getCount(); i++ )
- if ( accounts[i]->iOrder == Pos )
+ for (i=0; i < accounts.getCount(); i++)
+ if (accounts[i]->iOrder == Pos)
return i;
return -1;
}
-void RebuildMenuOrder( void )
+void RebuildMenuOrder(void)
{
int i, j, s;
DWORD flags;
- BYTE bHideStatusMenu = DBGetContactSettingByte( NULL, "CLUI", "DontHideStatusMenu", 0 ); // cool perversion, though
+ BYTE bHideStatusMenu = DBGetContactSettingByte(NULL, "CLUI", "DontHideStatusMenu", 0); // cool perversion, though
//clear statusmenu
RecursiveDeleteMenu(hStatusMenu);
//status menu
- if ( hStatusMenuObject != 0 ) {
+ if (hStatusMenuObject != 0) {
CallService(MO_REMOVEMENUOBJECT, (WPARAM)hStatusMenuObject, 0);
- mir_free( hStatusMainMenuHandles );
- mir_free( hStatusMenuHandles );
+ mir_free(hStatusMainMenuHandles);
+ mir_free(hStatusMenuHandles);
}
TMenuParam tmp = { 0 };
@@ -844,27 +844,27 @@ void RebuildMenuOrder( void ) tmp.name = "StatusMenu";
hStatusMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp);
- MO_SetOptionsMenuObject( hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu" );
+ MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
- hStatusMainMenuHandles = ( PMO_IntMenuItem* )mir_calloc( SIZEOF(statusModeList) * sizeof( PMO_IntMenuItem* ));
+ hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem*));
hStatusMainMenuHandlesCnt = SIZEOF(statusModeList);
- hStatusMenuHandles = ( tStatusMenuHandles* )mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
+ hStatusMenuHandles = (tStatusMenuHandles*)mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
hStatusMenuHandlesCnt = accounts.getCount();
FreeMenuProtos();
- for ( s=0; s < accounts.getCount(); s++ ) {
- i = cli.pfnGetAccountIndexByPos( s );
- if ( i == -1 )
+ for (s=0; s < accounts.getCount(); s++) {
+ i = cli.pfnGetAccountIndexByPos(s);
+ if (i == -1)
continue;
PROTOACCOUNT* pa = accounts[i];
int pos = 0;
- if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility( pa->szModuleName ))
+ if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- flags = pa->ppro->GetCaps( PFLAGNUM_2, 0 ) & ~pa->ppro->GetCaps( PFLAGNUM_5, 0 );
+ flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
int j;
HICON ic;
TCHAR tbuf[256];
@@ -874,21 +874,21 @@ void RebuildMenuOrder( void ) tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED;
tmi.position = pos++;
- tmi.hIcon = ic = (HICON)CallProtoService( pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0 );
+ tmi.hIcon = ic = (HICON)CallProtoService(pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- if ( Proto_IsAccountLocked( pa ) && cli.bDisplayLocked ) {
- mir_sntprintf( tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName );
+ if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
+ mir_sntprintf(tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName);
tmi.ptszName = tbuf;
}
else tmi.ptszName = pa->tszAccountName;
{
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_calloc( sizeof( StatusMenuExecParam ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_calloc(sizeof(StatusMenuExecParam));
smep->proto = mir_strdup(pa->szModuleName);
tmi.ownerdata = smep;
}
- PMO_IntMenuItem rootmenu = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ PMO_IntMenuItem rootmenu = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
memset(&tmi, 0, sizeof(tmi));
tmi.cbSize = sizeof(tmi);
@@ -898,24 +898,24 @@ void RebuildMenuOrder( void ) tmi.hIcon = ic;
{
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
- memset( smep, 0, sizeof( *smep ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_alloc(sizeof(StatusMenuExecParam));
+ memset(smep, 0, sizeof(*smep));
smep->proto = mir_strdup(pa->szModuleName);
tmi.ownerdata = smep;
}
- if ( Proto_IsAccountLocked( pa ))
+ if (Proto_IsAccountLocked(pa))
tmi.flags |= CMIF_CHECKED;
- if (( tmi.flags & CMIF_CHECKED ) && cli.bDisplayLocked ) {
- mir_sntprintf( tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName );
+ if ((tmi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
+ mir_sntprintf(tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName);
tmi.ptszName = tbuf;
}
else tmi.ptszName = pa->tszAccountName;
- PMO_IntMenuItem menuHandle = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
- ((lpStatusMenuExecParam)tmi.ownerdata)->protoindex = ( int )menuHandle;
- MO_ModifyMenuItem( menuHandle, &tmi );
+ PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ ((lpStatusMenuExecParam)tmi.ownerdata)->protoindex = (int)menuHandle;
+ MO_ModifyMenuItem(menuHandle, &tmi);
cli.menuProtos=(MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount+1));
memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
@@ -925,29 +925,29 @@ void RebuildMenuOrder( void ) cli.menuProtoCount++;
{
char buf[256];
- mir_snprintf( buf, SIZEOF(buf), "RootProtocolIcon_%s", pa->szModuleName );
- MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ mir_snprintf(buf, SIZEOF(buf), "RootProtocolIcon_%s", pa->szModuleName);
+ MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
}
DestroyIcon(ic);
pos += 500000;
- for ( j=0; j < SIZEOF(statusModeList); j++ ) {
- if ( !( flags & statusModePf2List[j] ))
+ for (j=0; j < SIZEOF(statusModeList); j++) {
+ if ( !(flags & statusModePf2List[j]))
continue;
//adding
- memset( &tmi, 0, sizeof( tmi ));
+ memset(&tmi, 0, sizeof(tmi));
tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
- if ( statusModeList[j] == ID_STATUS_OFFLINE )
+ if (statusModeList[j] == ID_STATUS_OFFLINE)
tmi.flags |= CMIF_CHECKED;
tmi.root = rootmenu;
tmi.position = pos++;
- tmi.ptszName = cli.pfnGetStatusModeDescription( statusModeList[j], GSMDF_UNTRANSLATED );
- tmi.hIcon = LoadSkinProtoIcon( pa->szModuleName, statusModeList[j] );
+ tmi.ptszName = cli.pfnGetStatusModeDescription(statusModeList[j], GSMDF_UNTRANSLATED);
+ tmi.hIcon = LoadSkinProtoIcon(pa->szModuleName, statusModeList[j]);
{
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_calloc( sizeof( StatusMenuExecParam ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = FALSE;
smep->status = statusModeList[j];
smep->protoindex = i;
@@ -957,11 +957,11 @@ void RebuildMenuOrder( void ) hStatusMenuHandles[i].protoindex = i;
hStatusMenuHandles[i].protostatus[j] = statusModeList[j];
- hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
{
char buf[ 256 ];
mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
- MO_SetOptionsMenuItem( hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ MO_SetOptionsMenuItem(hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
}
IconLib_ReleaseIcon(tmi.hIcon, 0);
} }
@@ -970,28 +970,28 @@ void RebuildMenuOrder( void ) int pos = 200000;
//add to root menu
- for ( j=0; j < SIZEOF(statusModeList); j++ ) {
- for ( i=0; i < accounts.getCount(); i++ ) {
+ for (j=0; j < SIZEOF(statusModeList); j++) {
+ for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility( pa->szModuleName ))
+ if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
- if ( !( flags & statusModePf2List[j] ))
+ if ( !(flags & statusModePf2List[j]))
continue;
TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof( tmi );
+ tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
- if ( statusModeList[j] == ID_STATUS_OFFLINE )
+ if (statusModeList[j] == ID_STATUS_OFFLINE)
tmi.flags |= CMIF_CHECKED;
- tmi.hIcon = LoadSkinIcon( skinIconStatusList[j] );
+ tmi.hIcon = LoadSkinIcon(skinIconStatusList[j]);
tmi.position = pos++;
tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0'+j);
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_alloc(sizeof(StatusMenuExecParam));
smep->custom = FALSE;
smep->status = statusModeList[j];
smep->proto = NULL;
@@ -999,20 +999,20 @@ void RebuildMenuOrder( void ) tmi.ownerdata = smep;
{
TCHAR buf[ 256 ], hotkeyName[ 100 ];
- WORD hotKey = GetHotkeyValue( statusHotkeys[j] );
- HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf( buf, SIZEOF( buf ), LPGENT("%s\t%s"),
- cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName );
+ WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
+ HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
+ mir_sntprintf(buf, SIZEOF(buf), LPGENT("%s\t%s"),
+ cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
tmi.ptszName = buf;
tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
- hStatusMainMenuHandles[j] = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ hStatusMainMenuHandles[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
}
{
char buf[ 256 ];
- mir_snprintf( buf, sizeof( buf ), "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName );
- MO_SetOptionsMenuItem( hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ mir_snprintf(buf, sizeof(buf), "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
+ MO_SetOptionsMenuItem(hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
}
- IconLib_ReleaseIcon( tmi.hIcon, 0 );
+ IconLib_ReleaseIcon(tmi.hIcon, 0);
break;
} }
@@ -1021,21 +1021,21 @@ void RebuildMenuOrder( void ) /////////////////////////////////////////////////////////////////////////////////////////
-static int sttRebuildHotkeys( WPARAM, LPARAM )
+static int sttRebuildHotkeys(WPARAM, LPARAM)
{
TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof( tmi );
+ tmi.cbSize = sizeof(tmi);
tmi.flags = CMIM_HOTKEY | CMIM_NAME | CMIF_TCHAR;
- for ( int j=0; j < SIZEOF(statusModeList); j++ ) {
+ for (int j=0; j < SIZEOF(statusModeList); j++) {
TCHAR buf[ 256 ], hotkeyName[ 100 ];
- WORD hotKey = GetHotkeyValue( statusHotkeys[j] );
- HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf( buf, SIZEOF( buf ), LPGENT("%s\t%s"),
- cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName );
+ WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
+ HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
+ mir_sntprintf(buf, SIZEOF(buf), LPGENT("%s\t%s"),
+ cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
tmi.ptszName = buf;
tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
- MO_ModifyMenuItem( hStatusMainMenuHandles[j], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[j], &tmi);
}
return 0;
@@ -1046,8 +1046,8 @@ static int sttRebuildHotkeys( WPARAM, LPARAM ) int statustopos(int status)
{
int j;
- for ( j = 0; j < SIZEOF(statusModeList); j++ )
- if ( status == statusModeList[j] )
+ for (j = 0; j < SIZEOF(statusModeList); j++)
+ if (status == statusModeList[j])
return j;
return -1;
@@ -1056,10 +1056,10 @@ int statustopos(int status) static int MenuProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA* ack=(ACKDATA*)lParam;
- if ( ack->type != ACKTYPE_STATUS ) return 0;
- if ( ack->result != ACKRESULT_SUCCESS ) return 0;
- if ( hStatusMainMenuHandles == NULL ) return 0;
- if ( cli.pfnGetProtocolVisibility( ack->szModule ) == 0 ) return 0;
+ if (ack->type != ACKTYPE_STATUS) return 0;
+ if (ack->result != ACKRESULT_SUCCESS) return 0;
+ if (hStatusMainMenuHandles == NULL) return 0;
+ if (cli.pfnGetProtocolVisibility(ack->szModule) == 0) return 0;
int overallStatus = GetAverageMode();
@@ -1074,44 +1074,44 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) for (int pos2 = 0; pos2<hStatusMainMenuHandlesCnt; pos2++) {
if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMainMenuHandles[pos2], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[pos2], &tmi);
} }
cli.currentStatusMenuItem=overallStatus;
pos = statustopos(cli.currentStatusMenuItem);
if (pos>=0 && pos < hStatusMainMenuHandlesCnt) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
}
// cli.currentDesiredStatusMode = cli.currentStatusMenuItem;
}
else {
- int pos = statustopos( cli.currentStatusMenuItem );
- if ( pos == -1 ) pos=0;
- if ( pos >= 0 && pos < hStatusMainMenuHandlesCnt ) {
+ int pos = statustopos(cli.currentStatusMenuItem);
+ if (pos == -1) pos=0;
+ if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
}
cli.currentStatusMenuItem=0;
}
- for ( int i=0; i < accounts.getCount(); i++ ) {
- if ( !lstrcmpA( accounts[i]->szModuleName, ack->szModule )) {
- if ((( int )ack->hProcess >= ID_STATUS_OFFLINE || ( int )ack->hProcess == 0 ) && ( int )ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->hProcess);
- if ( pos == -1 )
+ for (int i=0; i < accounts.getCount(); i++) {
+ if ( !lstrcmpA(accounts[i]->szModuleName, ack->szModule)) {
+ if (((int)ack->hProcess >= ID_STATUS_OFFLINE || (int)ack->hProcess == 0) && (int)ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos((int)ack->hProcess);
+ if (pos == -1)
pos = 0;
- for ( pos = 0; pos < SIZEOF(statusModeList); pos++ ) {
+ for (pos = 0; pos < SIZEOF(statusModeList); pos++) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
} }
- if ( ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->lParam );
- if ( pos >= 0 && pos < SIZEOF(statusModeList)) {
+ if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos((int)ack->lParam);
+ if (pos >= 0 && pos < SIZEOF(statusModeList)) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
}
}
break;
@@ -1123,7 +1123,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-int fnConvertMenu( CLISTMENUITEM* mi, TMO_MenuItem* pmi )
+int fnConvertMenu(CLISTMENUITEM* mi, TMO_MenuItem* pmi)
{
if (mi == NULL || pmi == NULL)
return FALSE;
@@ -1147,23 +1147,23 @@ int fnConvertMenu( CLISTMENUITEM* mi, TMO_MenuItem* pmi ) /////////////////////////////////////////////////////////////////////////////////////////
-static MenuProto* FindProtocolMenu( const char* proto )
+static MenuProto* FindProtocolMenu(const char* proto)
{
for (int i=0; i < cli.menuProtoCount; i++)
- if ( cli.menuProtos[i].pMenu && !lstrcmpiA( cli.menuProtos[i].szProto, proto ))
+ if (cli.menuProtos[i].pMenu && !lstrcmpiA(cli.menuProtos[i].szProto, proto))
return &cli.menuProtos[i];
- if ( cli.menuProtoCount == 1 )
- if ( !lstrcmpiA( cli.menuProtos[0].szProto, proto ))
+ if (cli.menuProtoCount == 1)
+ if ( !lstrcmpiA(cli.menuProtos[0].szProto, proto))
return &cli.menuProtos[0];
return NULL;
}
-HGENMENU fnGetProtocolMenu( const char* proto )
+HGENMENU fnGetProtocolMenu(const char* proto)
{
- MenuProto* mp = FindProtocolMenu( proto );
- if ( mp )
+ MenuProto* mp = FindProtocolMenu(proto);
+ if (mp)
return mp->pMenu;
return NULL;
@@ -1180,19 +1180,19 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) // for new style menus the pszPopupName contains the root menu handle
PMO_IntMenuItem pRoot = NULL;
- if ( mi->flags & CMIF_ROOTHANDLE )
- pRoot = MO_GetIntMenuItem( mi->hParentMenu );
+ if (mi->flags & CMIF_ROOTHANDLE)
+ pRoot = MO_GetIntMenuItem(mi->hParentMenu);
// for old style menus the pszPopupName really means the popup name
else {
- MenuProto* mp = FindProtocolMenu( mi->pszContactOwner );
- if ( mp && mi->pszPopupName ) {
- if ( mp->pMenu ) {
- TCHAR* ptszName = ( mi->flags & CMIF_UNICODE ) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
- pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, ptszName );
- mir_free( ptszName );
+ MenuProto* mp = FindProtocolMenu(mi->pszContactOwner);
+ if (mp && mi->pszPopupName) {
+ if (mp->pMenu) {
+ TCHAR* ptszName = (mi->flags & CMIF_UNICODE) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
+ pRoot = MO_RecursiveWalkMenu(mp->pMenu->submenu.first, FindRoot, ptszName);
+ mir_free(ptszName);
}
- if ( pRoot == NULL ) {
+ if (pRoot == NULL) {
TMO_MenuItem tmi = { 0 };
tmi.cbSize = sizeof(tmi);
tmi.flags = (mi->flags & CMIF_UNICODE) | CMIF_ROOTHANDLE;
@@ -1200,7 +1200,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) tmi.root = mp->pMenu;
tmi.hIcon = NULL;
tmi.pszName = mi->pszPopupName;
- pRoot = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ pRoot = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
}
tmi.flags |= CMIF_ROOTHANDLE;
@@ -1209,13 +1209,13 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) if (wParam) {
int * res=(int*)wParam;
- *res = ( int )pRoot;
+ *res = (int)pRoot;
}
//owner data
lpStatusMenuExecParam smep = NULL;
- if ( mi->pszService ) {
- smep = ( lpStatusMenuExecParam )mir_calloc(sizeof(StatusMenuExecParam));
+ if (mi->pszService) {
+ smep = (lpStatusMenuExecParam)mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = TRUE;
smep->svc=mir_strdup(mi->pszService);
{
@@ -1228,28 +1228,28 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) }
tmi.ownerdata = smep;
}
- PMO_IntMenuItem menuHandle = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
- if ( smep )
+ PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ if (smep)
smep->hMenuItem = menuHandle;
char buf[MAX_PATH+64];
{
- char* p = ( pRoot ) ? mir_t2a( pRoot->mi.ptszName ) : NULL;
- mir_snprintf( buf, SIZEOF(buf), "%s/%s", ( p ) ? p : "", mi->pszService ? mi->pszService : "" );
- mir_free( p );
+ char* p = (pRoot) ? mir_t2a(pRoot->mi.ptszName) : NULL;
+ mir_snprintf(buf, SIZEOF(buf), "%s/%s", (p) ? p : "", mi->pszService ? mi->pszService : "");
+ mir_free(p);
}
- MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
- return ( INT_PTR )menuHandle;
+ return (INT_PTR)menuHandle;
}
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam)
{
- return SetStatusMode( lParam, 0 );
+ return SetStatusMode(lParam, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1257,10 +1257,10 @@ static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam) static INT_PTR AddProtoMenuItem(WPARAM wParam, LPARAM lParam)
{
- if ( DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE ))
- return AddStatusMenuItem( wParam, lParam );
+ if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
+ return AddStatusMenuItem(wParam, lParam);
- return AddMainMenuItem( wParam, lParam );
+ return AddMainMenuItem(wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1305,7 +1305,7 @@ void InitCustomMenus(void) hPreBuildContactMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDCONTACTMENU);
hPreBuildMainMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDMAINMENU);
cli.hPreBuildStatusMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSTATUSMENU);
- hStatusModeChangeEvent = CreateHookableEvent( ME_CLIST_STATUSMODECHANGE );
+ hStatusModeChangeEvent = CreateHookableEvent(ME_CLIST_STATUSMODECHANGE);
hAckHook=(HANDLE)HookEvent(ME_PROTO_ACK, MenuProtoAck);
@@ -1331,8 +1331,8 @@ void InitCustomMenus(void) hMainMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp);
}
- MO_SetOptionsMenuObject( hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE );
- MO_SetOptionsMenuObject( hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu" );
+ MO_SetOptionsMenuObject(hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetOptionsMenuObject(hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");
//contact menu
{
@@ -1344,46 +1344,46 @@ void InitCustomMenus(void) hContactMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp);
}
- MO_SetOptionsMenuObject( hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE );
- MO_SetOptionsMenuObject( hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu" );
+ MO_SetOptionsMenuObject(hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetOptionsMenuObject(hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");
// initialize hotkeys
CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus);
HOTKEYDESC hkd = { 0 };
- hkd.cbSize = sizeof( hkd );
+ hkd.cbSize = sizeof(hkd);
hkd.ptszSection = _T("Status");
hkd.dwFlags = HKD_TCHAR;
- for ( int i = 0; i < SIZEOF(statusHotkeys); i++ ) {
+ for (int i = 0; i < SIZEOF(statusHotkeys); i++) {
char szName[30];
- mir_snprintf( szName, SIZEOF(szName), "StatusHotKey_%d", i );
+ mir_snprintf(szName, SIZEOF(szName), "StatusHotKey_%d", i);
hkd.pszName = szName;
hkd.lParam = statusModeList[i];
- hkd.ptszDescription = fnGetStatusModeDescription( hkd.lParam, 0 );
- hkd.DefHotKey = HOTKEYCODE( HOTKEYF_CONTROL, '0'+i ) | HKF_MIRANDA_LOCAL;
+ hkd.ptszDescription = fnGetStatusModeDescription(hkd.lParam, 0);
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, '0'+i) | HKF_MIRANDA_LOCAL;
hkd.pszService = MS_CLIST_HKSTATUS;
- statusHotkeys[i] = CallService( MS_HOTKEY_REGISTER, 0, LPARAM( &hkd ));
+ statusHotkeys[i] = CallService(MS_HOTKEY_REGISTER, 0, LPARAM(&hkd));
}
- HookEvent( ME_HOTKEYS_CHANGED, sttRebuildHotkeys );
+ HookEvent(ME_HOTKEYS_CHANGED, sttRebuildHotkeys);
// add exit command to menu
{
CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof( mi );
+ mi.cbSize = sizeof(mi);
mi.position = 0x7fffffff;
mi.flags = CMIF_ICONFROMICOLIB;
mi.pszService = "CloseAction";
mi.pszName = LPGEN("E&xit");
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_EXIT );
- AddMainMenuItem( 0, ( LPARAM )&mi );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_EXIT);
+ AddMainMenuItem(0, (LPARAM)&mi);
}
cli.currentStatusMenuItem=ID_STATUS_OFFLINE;
cli.currentDesiredStatusMode=ID_STATUS_OFFLINE;
- if ( IsWinVer98Plus() )
- HookEvent(ME_SKIN_ICONSCHANGED, MenuIconsChanged );
+ if (IsWinVer98Plus())
+ HookEvent(ME_SKIN_ICONSCHANGED, MenuIconsChanged);
}
void UninitCustomMenus(void)
@@ -1391,11 +1391,11 @@ void UninitCustomMenus(void) mir_free(hStatusMainMenuHandles);
hStatusMainMenuHandles = NULL;
- mir_free( hStatusMenuHandles );
+ mir_free(hStatusMenuHandles);
hStatusMenuHandles = NULL;
- if ( hMainMenuObject ) CallService( MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0 );
- if ( hStatusMenuObject ) CallService( MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0 );
+ if (hMainMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0);
+ if (hStatusMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0);
UnloadMoveToGroup();
FreeMenuProtos();
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 4c8df451d0..26ad72ae7c 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -57,7 +57,7 @@ OBJLIST<ProtoIconIndex> protoIconIndex(5); static HANDLE hProtoAckHook;
static HANDLE hContactSettingChanged;
-TCHAR* fnGetStatusModeDescription( int mode, int flags )
+TCHAR* fnGetStatusModeDescription(int mode, int flags)
{
static TCHAR szMode[64];
TCHAR* descr;
@@ -111,19 +111,19 @@ TCHAR* fnGetStatusModeDescription( int mode, int flags ) return NULL;
}
if (noPrefixReqd || !(flags & GSMDF_PREFIXONLINE))
- return ( flags & GSMDF_UNTRANSLATED ) ? descr : TranslateTS( descr );
+ return (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr);
- lstrcpy( szMode, TranslateT( "Online" ));
- lstrcat( szMode, _T(": "));
- lstrcat( szMode, ( flags & GSMDF_UNTRANSLATED ) ? descr : TranslateTS( descr ));
+ lstrcpy(szMode, TranslateT("Online"));
+ lstrcat(szMode, _T(": "));
+ lstrcat(szMode, (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr));
return szMode;
}
static INT_PTR GetStatusModeDescription(WPARAM wParam, LPARAM lParam)
{
- TCHAR* buf1 = cli.pfnGetStatusModeDescription( wParam, lParam );
+ TCHAR* buf1 = cli.pfnGetStatusModeDescription(wParam, lParam);
- if ( !( lParam & GSMDF_TCHAR ))
+ if ( !(lParam & GSMDF_TCHAR))
{
static char szMode[64];
char *buf2 = mir_u2a(buf1);
@@ -164,24 +164,24 @@ static int ProtocolAck(WPARAM, LPARAM lParam) return 0;
}
-HICON fnGetIconFromStatusMode( HANDLE hContact, const char *szProto, int status )
+HICON fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status)
{
- return ImageList_GetIcon( hCListImages, cli.pfnIconFromStatusMode( szProto, status, hContact ), ILD_NORMAL);
+ return ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL);
}
-int fnIconFromStatusMode(const char *szProto, int status, HANDLE )
+int fnIconFromStatusMode(const char *szProto, int status, HANDLE)
{
int index, i;
- for ( index = 0; index < SIZEOF(statusModeList); index++ )
- if ( status == statusModeList[index] )
+ for (index = 0; index < SIZEOF(statusModeList); index++)
+ if (status == statusModeList[index])
break;
- if ( index == SIZEOF(statusModeList))
+ if (index == SIZEOF(statusModeList))
index = 0;
if (szProto == NULL)
return index + 1;
- for ( i = 0; i < protoIconIndex.getCount(); i++ ) {
+ for (i = 0; i < protoIconIndex.getCount(); i++) {
if (strcmp(szProto, protoIconIndex[i].szProto) == 0)
return protoIconIndex[i].iIconBase + index;
}
@@ -197,19 +197,19 @@ static INT_PTR GetContactIcon(WPARAM wParam, LPARAM) szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
}
-static void AddProtoIconIndex( PROTOACCOUNT* pa )
+static void AddProtoIconIndex(PROTOACCOUNT* pa)
{
ProtoIconIndex *pii = new ProtoIconIndex;
pii->szProto = pa->szModuleName;
for (int i = 0; i < SIZEOF(statusModeList); i++) {
- int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i] );
+ int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i]);
if (i == 0)
pii->iIconBase = iImg;
}
protoIconIndex.insert(pii);
}
-static void RemoveProtoIconIndex( PROTOACCOUNT* pa )
+static void RemoveProtoIconIndex(PROTOACCOUNT* pa)
{
for (int i = 0; i < protoIconIndex.getCount(); i++)
if (strcmp(protoIconIndex[i].szProto, pa->szModuleName) == 0) {
@@ -220,14 +220,14 @@ static void RemoveProtoIconIndex( PROTOACCOUNT* pa ) static int ContactListModulesLoaded(WPARAM, LPARAM)
{
- if ( !ServiceExists( MS_DB_CONTACT_GETSETTING_STR )) {
- MessageBox( NULL, TranslateT( "This plugin requires db3x plugin version 0.5.1.0 or later" ), _T("CList"), MB_OK );
+ if ( !ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) {
+ MessageBox(NULL, TranslateT("This plugin requires db3x plugin version 0.5.1.0 or later"), _T("CList"), MB_OK);
return 1;
}
RebuildMenuOrder();
for (int i = 0; i < accounts.getCount(); i++)
- AddProtoIconIndex( accounts[i] );
+ AddProtoIconIndex(accounts[i]);
cli.pfnLoadContactTree();
@@ -238,37 +238,37 @@ static int ContactListModulesLoaded(WPARAM, LPARAM) return 0;
}
-static int ContactListAccountsChanged( WPARAM eventCode, LPARAM lParam )
+static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam)
{
switch (eventCode)
{
case PRAC_ADDED:
- AddProtoIconIndex(( PROTOACCOUNT* )lParam );
+ AddProtoIconIndex((PROTOACCOUNT*)lParam);
break;
case PRAC_REMOVED:
- RemoveProtoIconIndex(( PROTOACCOUNT* )lParam );
+ RemoveProtoIconIndex((PROTOACCOUNT*)lParam);
break;
}
cli.pfnReloadProtoMenus();
cli.pfnTrayIconIconsChanged();
- cli.pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 );
- cli.pfnClcBroadcast( INTM_INVALIDATE, 0, 0 );
+ cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
+ cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0);
return 0;
}
static INT_PTR ContactDoubleClicked(WPARAM wParam, LPARAM)
{
// Try to process event myself
- if ( cli.pfnEventsProcessContactDoubleClick(( HANDLE )wParam ) == 0 )
+ if (cli.pfnEventsProcessContactDoubleClick((HANDLE)wParam) == 0)
return 0;
// Allow third-party plugins to process a dblclick
- if ( NotifyEventHooks( hContactDoubleClicked, wParam, 0 ))
+ if (NotifyEventHooks(hContactDoubleClicked, wParam, 0))
return 0;
// Otherwise try to execute the default action
- TryProcessDoubleClick(( HANDLE )wParam );
+ TryProcessDoubleClick((HANDLE)wParam);
return 0;
}
@@ -288,14 +288,14 @@ static int CListIconsChanged(WPARAM, LPARAM) int i, j;
for (i = 0; i < SIZEOF(statusModeList); i++)
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, i + 1, LoadSkinIcon( skinIconStatusList[i] ));
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, LoadSkinIcon( SKINICON_OTHER_GROUPOPEN ));
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, LoadSkinIcon( SKINICON_OTHER_GROUPSHUT ));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, i + 1, LoadSkinIcon(skinIconStatusList[i]));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, LoadSkinIcon(SKINICON_OTHER_GROUPOPEN));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, LoadSkinIcon(SKINICON_OTHER_GROUPSHUT));
for (i = 0; i < protoIconIndex.getCount(); i++)
for (j = 0; j < SIZEOF(statusModeList); j++)
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, LoadSkinProtoIcon(protoIconIndex[i].szProto, statusModeList[j] ));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, LoadSkinProtoIcon(protoIconIndex[i].szProto, statusModeList[j]));
cli.pfnTrayIconIconsChanged();
- cli.pfnInvalidateRect( cli.hwndContactList, NULL, TRUE);
+ cli.pfnInvalidateRect(cli.hwndContactList, NULL, TRUE);
return 0;
}
@@ -382,7 +382,7 @@ int fnShowHide(WPARAM, LPARAM) switch (iVisibleState) {
case GWVS_PARTIALLY_COVERED:
//If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it.
- if (!DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
break;
case GWVS_COVERED: //Fall through (and we're already falling)
case GWVS_HIDDEN:
@@ -398,7 +398,7 @@ int fnShowHide(WPARAM, LPARAM) RECT rcWindow;
ShowWindow(cli.hwndContactList, SW_RESTORE);
- if (!DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
SetWindowPos(cli.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
else
SetWindowPos(cli.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -441,7 +441,7 @@ int fnShowHide(WPARAM, LPARAM) int GetStatusModeOrdering(int statusMode);
extern int sortByStatus, sortByProto;
-static INT_PTR CompareContacts( WPARAM wParam, LPARAM lParam )
+static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
{
HANDLE a = (HANDLE) wParam, b = (HANDLE) lParam;
TCHAR namea[128], *nameb;
@@ -480,10 +480,10 @@ static INT_PTR CompareContacts( WPARAM wParam, LPARAM lParam ) }
}
- nameb = cli.pfnGetContactDisplayName( a, 0);
+ nameb = cli.pfnGetContactDisplayName(a, 0);
_tcsncpy(namea, nameb, SIZEOF(namea));
namea[ SIZEOF(namea)-1 ] = 0;
- nameb = cli.pfnGetContactDisplayName( b, 0);
+ nameb = cli.pfnGetContactDisplayName(b, 0);
//otherwise just compare names
return _tcsicmp(namea, nameb);
@@ -491,12 +491,12 @@ static INT_PTR CompareContacts( WPARAM wParam, LPARAM lParam ) /***************************************************************************************/
-static INT_PTR TrayIconProcessMessageStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnTrayIconProcessMessage( wParam, lParam ); }
-static INT_PTR TrayIconPauseAutoHideStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnTrayIconPauseAutoHide( wParam, lParam ); }
-static INT_PTR ShowHideStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnShowHide( wParam, lParam ); }
-static INT_PTR SetHideOfflineStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnSetHideOffline( wParam, lParam ); }
-static INT_PTR Docking_ProcessWindowMessageStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnDocking_ProcessWindowMessage( wParam, lParam ); }
-static INT_PTR HotkeysProcessMessageStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnHotkeysProcessMessage( wParam, lParam ); }
+static INT_PTR TrayIconProcessMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnTrayIconProcessMessage(wParam, lParam); }
+static INT_PTR TrayIconPauseAutoHideStub(WPARAM wParam, LPARAM lParam) { return cli.pfnTrayIconPauseAutoHide(wParam, lParam); }
+static INT_PTR ShowHideStub(WPARAM wParam, LPARAM lParam) { return cli.pfnShowHide(wParam, lParam); }
+static INT_PTR SetHideOfflineStub(WPARAM wParam, LPARAM lParam) { return cli.pfnSetHideOffline(wParam, lParam); }
+static INT_PTR Docking_ProcessWindowMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnDocking_ProcessWindowMessage(wParam, lParam); }
+static INT_PTR HotkeysProcessMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnHotkeysProcessMessage(wParam, lParam); }
int LoadContactListModule2(void)
{
@@ -513,7 +513,7 @@ int LoadContactListModule2(void) CreateServiceFunction(MS_CLIST_GETSTATUSMODEDESCRIPTION, GetStatusModeDescription);
CreateServiceFunction(MS_CLIST_GETCONTACTDISPLAYNAME, GetContactDisplayName);
CreateServiceFunction(MS_CLIST_INVALIDATEDISPLAYNAME, InvalidateDisplayName);
- CreateServiceFunction(MS_CLIST_TRAYICONPROCESSMESSAGE, TrayIconProcessMessageStub );
+ CreateServiceFunction(MS_CLIST_TRAYICONPROCESSMESSAGE, TrayIconProcessMessageStub);
CreateServiceFunction(MS_CLIST_PAUSEAUTOHIDE, TrayIconPauseAutoHideStub);
CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts);
CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP, ContactChangeGroup);
@@ -539,18 +539,18 @@ int LoadContactListModule2(void) int i;
//now all core skin icons are loaded via icon lib. so lets release them
for (i = 0; i < SIZEOF(statusModeList); i++)
- ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i] );
+ ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i]);
}
//see IMAGE_GROUP... in clist.h if you add more images above here
- ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN );
- ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT );
+ ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN);
+ ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT);
return 0;
}
void UnloadContactListModule()
{
- if ( hCListImages ) {
+ if (hCListImages) {
//remove transitory contacts
HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact != NULL) {
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 07684d5c0a..710bd6aaf0 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -25,63 +25,63 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SortedList* clistCache = NULL;
-static int compareContacts( ClcCacheEntryBase* p1, ClcCacheEntryBase* p2 )
+static int compareContacts(ClcCacheEntryBase* p1, ClcCacheEntryBase* p2)
{
- return ( char* )p1->hContact - ( char* )p2->hContact;
+ return (char*)p1->hContact - (char*)p2->hContact;
}
void InitDisplayNameCache(void)
{
- clistCache = List_Create( 0, 50 );
- clistCache->sortFunc = ( FSortFunc )compareContacts;
+ clistCache = List_Create(0, 50);
+ clistCache->sortFunc = (FSortFunc)compareContacts;
}
void FreeDisplayNameCache(void)
{
- if ( clistCache != NULL ) {
+ if (clistCache != NULL) {
int i;
- for ( i = 0; i < clistCache->realCount; i++) {
- cli.pfnFreeCacheItem(( ClcCacheEntryBase* )clistCache->items[i] );
- mir_free( clistCache->items[i] );
+ for (i = 0; i < clistCache->realCount; i++) {
+ cli.pfnFreeCacheItem((ClcCacheEntryBase*)clistCache->items[i]);
+ mir_free(clistCache->items[i]);
}
- List_Destroy( clistCache );
+ List_Destroy(clistCache);
mir_free(clistCache);
clistCache = NULL;
} }
// default handlers for the cache item creation and destruction
-ClcCacheEntryBase* fnCreateCacheItem( HANDLE hContact )
+ClcCacheEntryBase* fnCreateCacheItem(HANDLE hContact)
{
- ClcCacheEntryBase* p = ( ClcCacheEntryBase* )mir_calloc( sizeof( ClcCacheEntryBase ));
- if ( p == NULL )
+ ClcCacheEntryBase* p = (ClcCacheEntryBase*)mir_calloc(sizeof(ClcCacheEntryBase));
+ if (p == NULL)
return NULL;
p->hContact = hContact;
return p;
}
-void fnCheckCacheItem( ClcCacheEntryBase* p )
+void fnCheckCacheItem(ClcCacheEntryBase* p)
{
DBVARIANT dbv;
- if ( p->group == NULL ) {
- if ( !DBGetContactSettingTString( p->hContact, "CList", "Group", &dbv )) {
- p->group = mir_tstrdup( dbv.ptszVal );
- mir_free( dbv.ptszVal );
+ if (p->group == NULL) {
+ if ( !DBGetContactSettingTString(p->hContact, "CList", "Group", &dbv)) {
+ p->group = mir_tstrdup(dbv.ptszVal);
+ mir_free(dbv.ptszVal);
}
- else p->group = mir_tstrdup( _T("") );
+ else p->group = mir_tstrdup(_T(""));
}
- if ( p->isHidden == -1 )
- p->isHidden = DBGetContactSettingByte( p->hContact, "CList", "Hidden", 0 );
+ if (p->isHidden == -1)
+ p->isHidden = DBGetContactSettingByte(p->hContact, "CList", "Hidden", 0);
}
-void fnFreeCacheItem( ClcCacheEntryBase* p )
+void fnFreeCacheItem(ClcCacheEntryBase* p)
{
- if ( p->name ) { mir_free( p->name ); p->name = NULL; }
- if ( p->szName ) { mir_free( p->szName); p->szName = NULL; }
- if ( p->group ) { mir_free( p->group ); p->group = NULL; }
+ if (p->name) { mir_free(p->name); p->name = NULL; }
+ if (p->szName) { mir_free(p->szName); p->szName = NULL; }
+ if (p->group) { mir_free(p->group); p->group = NULL; }
p->isHidden = -1;
}
@@ -89,15 +89,15 @@ ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact) {
ClcCacheEntryBase* p;
int idx;
- if ( !List_GetIndex( clistCache, &hContact, &idx )) {
- if (( p = cli.pfnCreateCacheItem( hContact )) != NULL ) {
- List_Insert( clistCache, p, idx );
- cli.pfnInvalidateDisplayNameCacheEntry( p );
+ if ( !List_GetIndex(clistCache, &hContact, &idx)) {
+ if ((p = cli.pfnCreateCacheItem(hContact)) != NULL) {
+ List_Insert(clistCache, p, idx);
+ cli.pfnInvalidateDisplayNameCacheEntry(p);
}
}
- else p = ( ClcCacheEntryBase* )clistCache->items[idx];
+ else p = (ClcCacheEntryBase*)clistCache->items[idx];
- cli.pfnCheckCacheItem( p );
+ cli.pfnCheckCacheItem(p);
return p;
}
@@ -110,21 +110,21 @@ void fnInvalidateDisplayNameCacheEntry(HANDLE hContact) }
else {
int idx;
- if ( List_GetIndex( clistCache, &hContact, &idx ))
- cli.pfnFreeCacheItem(( ClcCacheEntryBase* )clistCache->items[idx] );
+ if (List_GetIndex(clistCache, &hContact, &idx))
+ cli.pfnFreeCacheItem((ClcCacheEntryBase*)clistCache->items[idx]);
} }
-TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode )
+TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode)
{
CONTACTINFO ci;
TCHAR *buffer;
ClcCacheEntryBase* cacheEntry = NULL;
- if ( mode & GCDNF_NOCACHE )
+ if (mode & GCDNF_NOCACHE)
mode &= ~GCDNF_NOCACHE;
- else if ( mode != GCDNF_NOMYHANDLE) {
- cacheEntry = cli.pfnGetCacheEntry( hContact );
- if ( cacheEntry->name )
+ else if (mode != GCDNF_NOMYHANDLE) {
+ cacheEntry = cli.pfnGetCacheEntry(hContact);
+ if (cacheEntry->name)
return cacheEntry->name;
}
ZeroMemory(&ci, sizeof(ci));
@@ -133,33 +133,33 @@ TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode ) if (ci.hContact == NULL)
ci.szProto = "ICQ";
ci.dwFlag = ((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (cacheEntry == NULL)
return ci.pszVal;
cacheEntry->name = ci.pszVal;
- cacheEntry->szName = mir_u2a( ci.pszVal );
+ cacheEntry->szName = mir_u2a(ci.pszVal);
return ci.pszVal;
}
if (ci.type == CNFT_DWORD) {
if (cacheEntry == NULL) {
- buffer = (TCHAR*) mir_alloc(15 * sizeof( TCHAR ));
- _ltot(ci.dVal, buffer, 10 );
+ buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
+ _ltot(ci.dVal, buffer, 10);
return buffer;
}
else {
- buffer = (TCHAR*) mir_alloc(15 * sizeof( TCHAR ));
- _ltot(ci.dVal, buffer, 10 );
+ buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
+ _ltot(ci.dVal, buffer, 10);
cacheEntry->name = buffer;
- cacheEntry->szName = mir_u2a( buffer );
+ cacheEntry->szName = mir_u2a(buffer);
return buffer;
} } }
CallContactService(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
buffer = TranslateT("(Unknown Contact)");
- return ( cacheEntry == NULL ) ? mir_tstrdup( buffer ) : buffer;
+ return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
}
INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
@@ -169,12 +169,12 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) char *buffer;
HANDLE hContact = (HANDLE)wParam;
- if ( lParam & GCDNF_UNICODE )
- return ( INT_PTR )cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE );
+ if (lParam & GCDNF_UNICODE)
+ return (INT_PTR)cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE);
if ((int) lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
- if ( cacheEntry->szName )
+ if (cacheEntry->szName)
return (INT_PTR)cacheEntry->szName;
}
ZeroMemory(&ci, sizeof(ci));
@@ -183,30 +183,30 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) if (ci.hContact == NULL)
ci.szProto = "ICQ";
ci.dwFlag = ((lParam == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (cacheEntry == NULL) {
- buffer = mir_u2a( ci.pszVal );
+ buffer = mir_u2a(ci.pszVal);
mir_free(ci.pszVal);
return (INT_PTR) buffer;
}
else {
cacheEntry->name = ci.pszVal;
- cacheEntry->szName = mir_u2a( ci.pszVal );
+ cacheEntry->szName = mir_u2a(ci.pszVal);
return (INT_PTR)cacheEntry->szName;
}
}
if (ci.type == CNFT_DWORD) {
if (cacheEntry == NULL) {
- buffer = ( char* )mir_alloc(15);
- _ltoa(ci.dVal, buffer, 10 );
+ buffer = (char*)mir_alloc(15);
+ _ltoa(ci.dVal, buffer, 10);
return (INT_PTR) buffer;
}
else {
- buffer = ( char* )mir_alloc(15);
- _ltoa(ci.dVal, buffer, 10 );
+ buffer = (char*)mir_alloc(15);
+ _ltoa(ci.dVal, buffer, 10);
cacheEntry->szName = buffer;
- cacheEntry->name = mir_a2u( buffer );
+ cacheEntry->name = mir_a2u(buffer);
return (INT_PTR) buffer;
} } }
@@ -241,19 +241,19 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE)wParam;
// Early exit
- if ( hContact == NULL)
+ if (hContact == NULL)
return 0;
dbv.pszVal = NULL;
- if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
- if (!strcmp(cws->szModule, dbv.pszVal)) {
+ if ( !DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
+ if ( !strcmp(cws->szModule, dbv.pszVal)) {
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
- if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
- || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
+ if ( !strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
+ || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
CallService(MS_CLUI_CONTACTRENAMED, wParam, 0);
}
- else if (!strcmp(cws->szSetting, "Status")) {
- if (!DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) {
+ else if ( !strcmp(cws->szSetting, "Status")) {
+ if ( !DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) {
if (DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
// User's state is changing, and we are hideOffline-ing
if (cws->value.wVal == ID_STATUS_OFFLINE) {
@@ -274,8 +274,8 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) cli.pfnSortContacts();
} }
- if (!strcmp(cws->szModule, "CList")) {
- if (!strcmp(cws->szSetting, "Hidden")) {
+ if ( !strcmp(cws->szModule, "CList")) {
+ if ( !strcmp(cws->szSetting, "Hidden")) {
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) {
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1);
@@ -283,12 +283,12 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) else
CallService(MS_CLUI_CONTACTDELETED, wParam, 0);
}
- if (!strcmp(cws->szSetting, "MyHandle"))
+ if ( !strcmp(cws->szSetting, "MyHandle"))
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
}
- if (!strcmp(cws->szModule, "Protocol")) {
- if (!strcmp(cws->szSetting, "p")) {
+ if ( !strcmp(cws->szModule, "Protocol")) {
+ if ( !strcmp(cws->szSetting, "p")) {
char *szProto;
if (cws->value.type == DBVT_DELETED)
szProto = NULL;
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 8480c6026b..608f692028 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -45,25 +45,25 @@ static CRITICAL_SECTION trayLockCS; #define lock cli.pfnLockTray()
#define ulock cli.pfnUnlockTray()
-#define initcheck if (!fTrayInited) return
+#define initcheck if ( !fTrayInited) return
static BOOL fTrayInited=FALSE;
-static TCHAR* sttGetXStatus( const char* szProto )
+static TCHAR* sttGetXStatus(const char* szProto)
{
TCHAR* result = NULL;
- if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) > ID_STATUS_OFFLINE ) {
+ if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
char str[MAXMODULELABELLENGTH];
- mir_snprintf( str, sizeof(str), "%s/GetXStatus", szProto );
- if ( ServiceExists( str )) {
+ mir_snprintf(str, sizeof(str), "%s/GetXStatus", szProto);
+ if (ServiceExists(str)) {
char* dbTitle = "XStatusName";
char* dbTitle2 = NULL;
- int xstatus = CallProtoService( szProto, "/GetXStatus", ( WPARAM )&dbTitle, ( LPARAM )&dbTitle2 );
- if ( dbTitle && xstatus ) {
+ int xstatus = CallProtoService(szProto, "/GetXStatus", (WPARAM)&dbTitle, (LPARAM)&dbTitle2);
+ if (dbTitle && xstatus) {
DBVARIANT dbv={0};
- if ( !DBGetContactSettingTString(NULL, szProto, dbTitle, &dbv )) {
- if ( dbv.ptszVal[0] != 0 )
+ if ( !DBGetContactSettingTString(NULL, szProto, dbTitle, &dbv)) {
+ if (dbv.ptszVal[0] != 0)
result = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
} } } }
@@ -83,7 +83,7 @@ static void SetTaskBarIcon(const HICON hIcon, const TCHAR *szNewTip) }
}
-TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto )
+TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto)
{
TCHAR *szStatus, *szSeparator;
TCHAR *ProtoXStatus=NULL;
@@ -91,7 +91,7 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) PROTOACCOUNT* pa;
initcheck NULL;
lock;
- if ( !mToolTipTrayTips )
+ if ( !mToolTipTrayTips)
szSeparator = (IsWinVerMEPlus()) ? szSeparator = _T("\n") : _T(" | ");
else
szSeparator = _T("\n");
@@ -108,36 +108,36 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) if (szPrefix && szPrefix[0]) {
lstrcpyn(cli.szTip, szPrefix, MAX_TIP_SIZE);
- if (!DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT))
{ ulock; return cli.szTip; }
}
else cli.szTip[0] = '\0';
cli.szTip[ MAX_TIP_SIZE-1 ] = '\0';
- for ( t = 0; t < accounts.getCount(); t++ ) {
- int i = cli.pfnGetAccountIndexByPos( t );
- if ( i == -1 )
+ for (t = 0; t < accounts.getCount(); t++) {
+ int i = cli.pfnGetAccountIndexByPos(t);
+ if (i == -1)
continue;
pa = accounts[i];
- if ( !cli.pfnGetProtocolVisibility( pa->szModuleName ))
+ if ( !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- szStatus = cli.pfnGetStatusModeDescription( CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
- if ( !szStatus )
+ szStatus = cli.pfnGetStatusModeDescription(CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ if ( !szStatus)
continue;
- ProtoXStatus = sttGetXStatus( pa->szModuleName );
+ ProtoXStatus = sttGetXStatus(pa->szModuleName);
- if ( mToolTipTrayTips ) {
+ if (mToolTipTrayTips) {
TCHAR tipline[256];
mir_sntprintf(tipline, SIZEOF(tipline), _T("<b>%-12.12s</b>\t%s"), pa->tszAccountName, szStatus);
- if ( cli.szTip[0] )
+ if (cli.szTip[0])
_tcsncat(cli.szTip, szSeparator, MAX_TIP_SIZE - _tcslen(cli.szTip));
_tcsncat(cli.szTip, tipline, MAX_TIP_SIZE - _tcslen(cli.szTip));
if (ProtoXStatus) {
mir_sntprintf(tipline, SIZEOF(tipline), _T("%-24.24s\n"), ProtoXStatus);
- if ( cli.szTip[0] )
+ if (cli.szTip[0])
_tcsncat(cli.szTip, szSeparator, MAX_TIP_SIZE - _tcslen(cli.szTip));
_tcsncat(cli.szTip, tipline, MAX_TIP_SIZE - _tcslen(cli.szTip));
}
@@ -150,17 +150,17 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) _tcsncat(cli.szTip, _T(" "), MAX_TIP_SIZE - _tcslen(cli.szTip));
_tcsncat(cli.szTip, szStatus, MAX_TIP_SIZE - _tcslen(cli.szTip));
}
- mir_free( ProtoXStatus );
+ mir_free(ProtoXStatus);
}
}
else {
- if (( pa = Proto_GetAccount( szProto )) != NULL ) {
- ProtoXStatus = sttGetXStatus( szProto );
+ if ((pa = Proto_GetAccount(szProto)) != NULL) {
+ ProtoXStatus = sttGetXStatus(szProto);
szStatus = cli.pfnGetStatusModeDescription(CallProtoService(szProto, PS_GETSTATUS, 0, 0), 0);
- if ( szPrefix && szPrefix[0] ) {
- if ( DBGetContactSettingByte( NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT )) {
- if ( mToolTipTrayTips ) {
- if ( ProtoXStatus )
+ if (szPrefix && szPrefix[0]) {
+ if (DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
+ if (mToolTipTrayTips) {
+ if (ProtoXStatus)
mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s<b>%-12.12s</b>\t%s%s%-24.24s"), szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
else
mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s<b>%-12.12s</b>\t%s"), szPrefix, szSeparator, pa->tszAccountName, szStatus);
@@ -170,11 +170,11 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) else lstrcpyn(cli.szTip, szPrefix, MAX_TIP_SIZE);
}
else {
- if ( mToolTipTrayTips ) {
- if ( ProtoXStatus )
- mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s\n%-24.24s"), pa->tszAccountName, szStatus, ProtoXStatus);
+ if (mToolTipTrayTips) {
+ if (ProtoXStatus)
+ mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s\n%-24.24s"), pa->tszAccountName, szStatus, ProtoXStatus);
else
- mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s"), pa->tszAccountName, szStatus);
+ mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s"), pa->tszAccountName, szStatus);
}
else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s %s"), pa->tszAccountName, szStatus);
}
@@ -197,9 +197,9 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s cli.trayIcon[i].id = TRAYICON_ID_BASE + i;
cli.trayIcon[i].szProto = (char *) szProto;
- cli.trayIcon[i].hBaseIcon = cli.pfnGetIconFromStatusMode( NULL, szIconProto ? szIconProto : cli.trayIcon[i].szProto, status );
+ cli.trayIcon[i].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, szIconProto ? szIconProto : cli.trayIcon[i].szProto, status);
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = hwnd;
nid.uID = cli.trayIcon[i].id;
nid.uFlags = mToolTipTrayTips ? NIF_ICON | NIF_MESSAGE : NIF_ICON | NIF_MESSAGE | NIF_TIP;
@@ -209,10 +209,10 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s if (cli.shellVersion >= 5)
nid.uFlags |= NIF_INFO;
- cli.pfnTrayIconMakeTooltip( NULL, cli.trayIcon[i].szProto );
- if ( !mToolTipTrayTips )
- lstrcpyn( nid.szTip, cli.szTip, SIZEOF( nid.szTip ));
- cli.trayIcon[i].ptszToolTip = mir_tstrdup( cli.szTip );
+ cli.pfnTrayIconMakeTooltip(NULL, cli.trayIcon[i].szProto);
+ if ( !mToolTipTrayTips)
+ lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
+ cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
cli.trayIcon[i].isBase = 1;
@@ -228,11 +228,11 @@ void fnTrayIconRemove(HWND hwnd, const char *szProto) int i;
initcheck;
lock;
- for ( i = 0; i < cli.trayIconCount; i++ ) {
+ for (i = 0; i < cli.trayIconCount; i++) {
struct trayIconInfo_t* pii = &cli.trayIcon[i];
- if ( pii->id != 0 && !lstrcmpA( szProto, pii->szProto )) {
+ if (pii->id != 0 && !lstrcmpA(szProto, pii->szProto)) {
NOTIFYICONDATA nid = { 0 };
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = hwnd;
nid.uID = pii->id;
Shell_NotifyIcon(NIM_DELETE, &nid);
@@ -258,7 +258,7 @@ int fnTrayIconInit(HWND hwnd) int averageMode = GetAverageMode(&netProtoCount);
mToolTipTrayTips = ServiceExists("mToolTip/ShowTip") != 0;
- if ( cli.cycleTimerId ) {
+ if (cli.cycleTimerId) {
KillTimer(NULL, cli.cycleTimerId);
cli.cycleTimerId = 0;
}
@@ -275,8 +275,8 @@ int fnTrayIconInit(HWND hwnd) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
- if (!DBGetContactSettingString(NULL, "CList", "PrimaryStatus", &dbv)
- && (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysPrimary", 0) ))
+ if ( !DBGetContactSettingString(NULL, "CList", "PrimaryStatus", &dbv)
+ && (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysPrimary", 0)))
szProto = dbv.pszVal;
else
szProto = NULL;
@@ -285,7 +285,7 @@ int fnTrayIconInit(HWND hwnd) DBFreeVariant(&dbv);
}
else if (trayIconSetting == SETTING_TRAYICON_MULTI &&
- (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT )))
+ (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
{
cli.trayIconCount = netProtoCount;
for (int i = 0; i < accounts.getCount(); ++i)
@@ -327,15 +327,15 @@ int fnTrayIconDestroy(HWND hwnd) if (cli.trayIconCount == 1)
SetTaskBarIcon(NULL, NULL);
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = hwnd;
- for ( i = 0; i < cli.trayIconCount; i++ ) {
- if ( cli.trayIcon[i].id == 0 )
+ for (i = 0; i < cli.trayIconCount; i++) {
+ if (cli.trayIcon[i].id == 0)
continue;
nid.uID = cli.trayIcon[i].id;
- Shell_NotifyIcon( NIM_DELETE, &nid );
- DestroyIcon( cli.trayIcon[i].hBaseIcon );
- mir_free( cli.trayIcon[i].ptszToolTip );
+ Shell_NotifyIcon(NIM_DELETE, &nid);
+ DestroyIcon(cli.trayIcon[i].hBaseIcon);
+ mir_free(cli.trayIcon[i].ptszToolTip);
}
mir_free(cli.trayIcon);
cli.trayIcon = NULL;
@@ -356,12 +356,12 @@ void fnTrayIconTaskbarCreated(HWND hwnd) static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
int i;
- if ( RefreshTimerId ) {
+ if (RefreshTimerId) {
KillTimer(NULL, RefreshTimerId);
RefreshTimerId=0;
}
for (i=0; i < accounts.getCount(); i++) {
- cli.pfnTrayIconUpdateBase( accounts[i]->szModuleName );
+ cli.pfnTrayIconUpdateBase(accounts[i]->szModuleName);
}
}
@@ -372,11 +372,11 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer initcheck -1;
lock;
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = cli.hwndContactList;
nid.uFlags = mToolTipTrayTips ? NIF_ICON : NIF_ICON | NIF_TIP;
nid.hIcon = hNewIcon;
- if (!hNewIcon)
+ if ( !hNewIcon)
{ ulock; return -1; }
for (i = 0; i < cli.trayIconCount; i++) {
@@ -387,9 +387,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer nid.uID = cli.trayIcon[i].id;
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
- mir_free( cli.trayIcon[i].ptszToolTip );
- cli.trayIcon[i].ptszToolTip = mir_tstrdup( cli.szTip );
- if (!mToolTipTrayTips)
+ mir_free(cli.trayIcon[i].ptszToolTip);
+ cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ if ( !mToolTipTrayTips)
lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
@@ -410,9 +410,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer nid.uID = cli.trayIcon[i].id;
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
- mir_free( cli.trayIcon[i].ptszToolTip );
- cli.trayIcon[i].ptszToolTip = mir_tstrdup( cli.szTip );
- if (!mToolTipTrayTips)
+ mir_free(cli.trayIcon[i].ptszToolTip);
+ cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ if ( !mToolTipTrayTips)
lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
@@ -490,7 +490,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) int i;
for (i = accounts.getCount() + 1; --i;) {
cycleStep = (cycleStep + 1) % accounts.getCount();
- if ( cli.pfnGetProtocolVisibility( accounts[cycleStep]->szModuleName ))
+ if (cli.pfnGetProtocolVisibility(accounts[cycleStep]->szModuleName))
break;
}
@@ -498,7 +498,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) {
DestroyIcon(cli.trayIcon[0].hBaseIcon);
cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, accounts[cycleStep]->szModuleName,
- CallProtoService( accounts[cycleStep]->szModuleName, PS_GETSTATUS, 0, 0 ));
+ CallProtoService(accounts[cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
if (cli.trayIcon[0].isBase)
cli.pfnTrayIconUpdate(cli.trayIcon[0].hBaseIcon, NULL, NULL, 1);
}
@@ -508,7 +508,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) void fnTrayIconUpdateBase(const char *szChangedProto)
{
- if ( !cli.pfnGetProtocolVisibility( szChangedProto )) return;
+ if ( !cli.pfnGetProtocolVisibility(szChangedProto)) return;
int i, netProtoCount, changed = -1;
HWND hwnd = cli.hwndContactList;
@@ -522,7 +522,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) }
for (i = 0; i < accounts.getCount(); i++) {
- if (!lstrcmpA(szChangedProto, accounts[i]->szModuleName ))
+ if ( !lstrcmpA(szChangedProto, accounts[i]->szModuleName))
cycleStep = i - 1;
}
@@ -533,17 +533,17 @@ void fnTrayIconUpdateBase(const char *szChangedProto) if (averageMode > 0) {
if (trayIconSetting == SETTING_TRAYICON_MULTI) {
if (DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- //changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode((char*)szChangedProto, NULL, averageMode), (char*)szChangedProto);
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto );
+ //changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode((char*)szChangedProto, NULL, averageMode), (char*)szChangedProto);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else if (cli.trayIcon && cli.trayIcon[0].szProto != NULL) {
cli.pfnTrayIconDestroy(hwnd);
cli.pfnTrayIconInit(hwnd);
}
else
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL );
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
}
else
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
}
else {
switch (trayIconSetting) {
@@ -555,7 +555,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) szProto = NULL;
else
szProto = dbv.pszVal;
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto );
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
DBFreeVariant(&dbv);
break;
}
@@ -568,11 +568,11 @@ void fnTrayIconUpdateBase(const char *szChangedProto) ILD_NORMAL), NULL);
break;
case SETTING_TRAYICON_MULTI:
- if (!cli.trayIcon) {
+ if ( !cli.trayIcon) {
cli.pfnTrayIconRemove(NULL, NULL);
}
- else if ((cli.trayIconCount > 1 || netProtoCount == 1) || DBGetContactSettingByte( NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT ))
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto );
+ else if ((cli.trayIconCount > 1 || netProtoCount == 1) || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else {
cli.pfnTrayIconDestroy(hwnd);
cli.pfnTrayIconInit(hwnd);
@@ -596,19 +596,19 @@ void fnTrayIconSetToBase(char *szPreferredProto) lock;
for (i = 0; i < cli.trayIconCount; i++) {
- if ( cli.trayIcon[i].id == 0 )
+ if (cli.trayIcon[i].id == 0)
continue;
- if ( lstrcmpA( cli.trayIcon[i].szProto, szPreferredProto ))
+ if (lstrcmpA(cli.trayIcon[i].szProto, szPreferredProto))
continue;
- cli.pfnTrayIconUpdate( cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
ulock; return;
}
//if there wasn't a specific icon, there will only be one suitable
- for ( i = 0; i < cli.trayIconCount; i++) {
- if ( cli.trayIcon[i].id == 0 )
+ for (i = 0; i < cli.trayIconCount; i++) {
+ if (cli.trayIcon[i].id == 0)
continue;
- cli.pfnTrayIconUpdate( cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
ulock; return;
}
ulock; return;
@@ -644,7 +644,7 @@ int fnTrayIconPauseAutoHide(WPARAM, LPARAM) initcheck 0;
lock;
if (DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
- if ( GetActiveWindow() != cli.hwndContactList ) {
+ if (GetActiveWindow() != cli.hwndContactList) {
KillTimer(NULL, autoHideTimerId);
autoHideTimerId = SetTimer(NULL, 0, 1000 * DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
}
@@ -661,45 +661,45 @@ static POINT tray_hover_pos = {0}; static void CALLBACK TrayHideToolTipTimerProc(HWND hwnd, UINT, UINT_PTR, DWORD)
{
- if ( g_trayTooltipActive ) {
+ if (g_trayTooltipActive) {
POINT pt;
GetCursorPos(&pt);
- if ( abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE ) {
+ if (abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE) {
CallService("mToolTip/HideTip", 0, 0);
g_trayTooltipActive = FALSE;
- KillTimer( hwnd, TIMERID_TRAYHOVER_2 );
+ KillTimer(hwnd, TIMERID_TRAYHOVER_2);
}
}
- else KillTimer( hwnd, TIMERID_TRAYHOVER_2 );
+ else KillTimer(hwnd, TIMERID_TRAYHOVER_2);
}
static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
{
- if ( !g_trayTooltipActive && !cli.bTrayMenuOnScreen ) {
+ if ( !g_trayTooltipActive && !cli.bTrayMenuOnScreen) {
CLCINFOTIP ti = {0};
POINT pt;
- GetCursorPos( &pt );
- if ( abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE ) {
+ GetCursorPos(&pt);
+ if (abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE) {
TCHAR* szTipCur = cli.szTip;
{
int n = s_LastHoverIconID-100;
- if ( n >= 0 && n < cli.trayIconCount )
+ if (n >= 0 && n < cli.trayIconCount)
szTipCur = cli.trayIcon[n].ptszToolTip;
}
ti.rcItem.left = pt.x - 10;
ti.rcItem.right = pt.x + 10;
ti.rcItem.top = pt.y - 10;
ti.rcItem.bottom = pt.y + 10;
- ti.cbSize = sizeof( ti );
+ ti.cbSize = sizeof(ti);
ti.isTreeFocused = GetFocus() == cli.hwndContactList ? 1 : 0;
- if (CallService( "mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti ) == CALLSERVICE_NOTFOUND)
+ if (CallService("mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti) == CALLSERVICE_NOTFOUND)
{
- char* p = mir_u2a( szTipCur );
- CallService( "mToolTip/ShowTip", (WPARAM)p, (LPARAM)&ti );
- mir_free( p );
+ char* p = mir_u2a(szTipCur);
+ CallService("mToolTip/ShowTip", (WPARAM)p, (LPARAM)&ti);
+ mir_free(p);
}
- GetCursorPos( &tray_hover_pos );
- SetTimer( cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc );
+ GetCursorPos(&tray_hover_pos);
+ SetTimer(cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc);
g_trayTooltipActive = TRUE;
} }
@@ -711,8 +711,8 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) MSG *msg = (MSG *) wParam;
switch (msg->message) {
case WM_CREATE: {
- WM_TASKBARCREATED = RegisterWindowMessage( _T("TaskbarCreated"));
- WM_TASKBARBUTTONCREATED = RegisterWindowMessage( _T("TaskbarButtonCreated"));
+ WM_TASKBARCREATED = RegisterWindowMessage(_T("TaskbarCreated"));
+ WM_TASKBARBUTTONCREATED = RegisterWindowMessage(_T("TaskbarButtonCreated"));
PostMessage(msg->hwnd, TIM_CREATE, 0, 0);
break;
}
@@ -735,12 +735,12 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) break;
case TIM_CALLBACK:
- if ( msg->lParam == WM_RBUTTONDOWN || msg->lParam == WM_LBUTTONDOWN || msg->lParam == WM_RBUTTONDOWN && g_trayTooltipActive ) {
+ if (msg->lParam == WM_RBUTTONDOWN || msg->lParam == WM_LBUTTONDOWN || msg->lParam == WM_RBUTTONDOWN && g_trayTooltipActive) {
CallService("mToolTip/HideTip", 0, 0);
g_trayTooltipActive = FALSE;
}
- if ( msg->lParam == WM_MBUTTONUP )
+ if (msg->lParam == WM_MBUTTONUP)
cli.pfnShowHide(0, 0);
else if (msg->lParam == (DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000))
@@ -752,7 +752,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) {
if ((unsigned)cli.trayIcon[i].id == msg->wParam)
{
- if (!cli.trayIcon[i].szProto) break;
+ if ( !cli.trayIcon[i].szProto) break;
int ind = 0;
for (int j = 0; j < accounts.getCount(); ++j)
@@ -760,7 +760,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) int k = cli.pfnGetAccountIndexByPos(j);
if (k >= 0)
{
- if (!strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName))
+ if ( !strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName))
{
HMENU hm = GetSubMenu(hMenu, ind);
if (hm) hMenu = hm;
@@ -811,12 +811,12 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) RemoveMenu(hMenu, 1, MF_BYPOSITION);
DestroyMenu(hMainMenu);
}
- else if ( msg->lParam == WM_MOUSEMOVE ) {
+ else if (msg->lParam == WM_MOUSEMOVE) {
s_LastHoverIconID = msg->wParam;
- if ( g_trayTooltipActive ) {
+ if (g_trayTooltipActive) {
POINT pt;
- GetCursorPos( &pt );
- if ( abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE ) {
+ GetCursorPos(&pt);
+ if (abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE) {
CallService("mToolTip/HideTip", 0, 0);
g_trayTooltipActive = FALSE;
ReleaseCapture();
@@ -851,62 +851,62 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// processes tray icon's notifications
-int fnCListTrayNotify( MIRANDASYSTRAYNOTIFY* msn )
+int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn)
{
UINT iconId = 0;
- if ( msn == NULL )
+ if (msn == NULL)
return 1;
- if ( msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL )
+ if (msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL)
return 1;
- if ( cli.trayIcon == NULL )
+ if (cli.trayIcon == NULL)
return 2;
- if ( msn->szProto ) {
+ if (msn->szProto) {
int j;
- for ( j = 0; j < cli.trayIconCount; j++ ) {
- if ( cli.trayIcon[j].szProto != NULL ) {
- if ( !strcmp( msn->szProto, cli.trayIcon[j].szProto )) {
+ for (j = 0; j < cli.trayIconCount; j++) {
+ if (cli.trayIcon[j].szProto != NULL) {
+ if ( !strcmp(msn->szProto, cli.trayIcon[j].szProto)) {
iconId = cli.trayIcon[j].id;
break;
}
}
- else if ( cli.trayIcon[j].isBase ) {
+ else if (cli.trayIcon[j].isBase) {
iconId = cli.trayIcon[j].id;
break;
} }
}
else iconId = cli.trayIcon[0].id;
- if ( msn->dwInfoFlags & NIIF_INTERN_UNICODE ) {
+ if (msn->dwInfoFlags & NIIF_INTERN_UNICODE) {
NOTIFYICONDATAW nid = {0};
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAW_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATAW_V1_SIZE;
nid.hWnd = cli.hwndContactList;
nid.uID = iconId;
nid.uFlags = NIF_INFO;
- lstrcpynW( nid.szInfo, msn->tszInfo, SIZEOF( nid.szInfo ));
- lstrcpynW( nid.szInfoTitle, msn->tszInfoTitle, SIZEOF( nid.szInfoTitle ));
+ lstrcpynW(nid.szInfo, msn->tszInfo, SIZEOF(nid.szInfo));
+ lstrcpynW(nid.szInfoTitle, msn->tszInfoTitle, SIZEOF(nid.szInfoTitle));
nid.szInfo[ SIZEOF(nid.szInfo)-1 ] = 0;
nid.szInfoTitle[ SIZEOF(nid.szInfoTitle)-1 ] = 0;
nid.uTimeout = msn->uTimeout;
nid.dwInfoFlags = (msn->dwInfoFlags & ~NIIF_INTERN_UNICODE);
- return Shell_NotifyIconW( NIM_MODIFY, &nid ) == 0;
+ return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0;
}
else
{
NOTIFYICONDATAA nid = { 0 };
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATAA_V1_SIZE;
nid.hWnd = cli.hwndContactList;
nid.uID = iconId;
nid.uFlags = NIF_INFO;
- lstrcpynA( nid.szInfo, msn->szInfo, sizeof( nid.szInfo ));
- lstrcpynA( nid.szInfoTitle, msn->szInfoTitle, sizeof( nid.szInfoTitle ));
+ lstrcpynA(nid.szInfo, msn->szInfo, sizeof(nid.szInfo));
+ lstrcpynA(nid.szInfoTitle, msn->szInfoTitle, sizeof(nid.szInfoTitle));
nid.uTimeout = msn->uTimeout;
nid.dwInfoFlags = msn->dwInfoFlags;
- return Shell_NotifyIconA( NIM_MODIFY, &nid ) == 0;
+ return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0;
} }
/////////////////////////////////////////////////////////////////////////////////////////
@@ -925,49 +925,49 @@ typedef HRESULT(CALLBACK * DLLGETVERSIONPROC) (DLLVERSIONINFO *); static DLLVERSIONINFO dviShell;
-static INT_PTR pfnCListTrayNotifyStub(WPARAM, LPARAM lParam )
-{ return cli.pfnCListTrayNotify(( MIRANDASYSTRAYNOTIFY* )lParam );
+static INT_PTR pfnCListTrayNotifyStub(WPARAM, LPARAM lParam)
+{ return cli.pfnCListTrayNotify((MIRANDASYSTRAYNOTIFY*)lParam);
}
-void fnInitTray( void )
+void fnInitTray(void)
{
HMODULE hLib = GetModuleHandleA("shell32");
- if ( hLib ) {
+ if (hLib) {
DLLGETVERSIONPROC proc;
dviShell.cbSize = sizeof(dviShell);
- proc = ( DLLGETVERSIONPROC )GetProcAddress( hLib, "DllGetVersion" );
+ proc = (DLLGETVERSIONPROC)GetProcAddress(hLib, "DllGetVersion");
if (proc) {
- proc( &dviShell );
+ proc(&dviShell);
cli.shellVersion = dviShell.dwMajorVersion;
}
FreeLibrary(hLib);
}
InitializeCriticalSection(&trayLockCS);
- if ( cli.shellVersion >= 5 )
- CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub );
+ if (cli.shellVersion >= 5)
+ CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub);
fTrayInited=TRUE;
}
-void fnUninitTray( void )
+void fnUninitTray(void)
{
fTrayInited=FALSE;
- DeleteCriticalSection( &trayLockCS );
+ DeleteCriticalSection(&trayLockCS);
}
-void fnLockTray( void )
+void fnLockTray(void)
{
// return; //stub to be removed
initcheck;
- EnterCriticalSection( &trayLockCS );
+ EnterCriticalSection(&trayLockCS);
}
-void fnUnlockTray( void )
+void fnUnlockTray(void)
{
// return; //stub to be removed
initcheck;
#ifdef _DEBUG
if (trayLockCS.RecursionCount == 0) DebugBreak(); //try to unlock already
#endif
- LeaveCriticalSection( &trayLockCS );
+ LeaveCriticalSection(&trayLockCS);
}
#undef lock
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 8f128e7c25..78ed09174d 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -76,7 +76,7 @@ static void DisconnectAll() {
int nProto;
for (nProto = 0; nProto < accounts.getCount(); nProto++)
- CallProtoService( accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
+ CallProtoService(accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
static int CluiIconsChanged(WPARAM, LPARAM)
@@ -98,9 +98,9 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS;
GetClassName(hwndClist, cls, SIZEOF(cls));
- hwndClist = (!lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = ( !lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
- if (!hItem) {
+ if ( !hItem) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
}
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hRenameMenuItem, (LPARAM) & mi);
@@ -114,7 +114,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM) HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, SIZEOF(cls));
// worst case scenario, the rename is sent to the main contact list
- hwndClist = (!lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = ( !lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
if (hItem) {
SetFocus(hwndClist);
@@ -181,7 +181,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) UINT_PTR action;
if (DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) &&
- !(GetKeyState(VK_SHIFT)&0x8000) )
+ !(GetKeyState(VK_SHIFT)&0x8000))
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
action = DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND) lParam, AskForConfirmationDlgProc, wParam);
else
@@ -205,7 +205,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
// Set a flag so we remember to delete the contact when the protocol goes online the next time
DBWriteContactSettingByte((HANDLE) wParam, "CList", "Delete", 1);
- MessageBox( NULL,
+ MessageBox(NULL,
TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."),
TranslateT("Delete Contact"), MB_OK);
return 0;
@@ -251,14 +251,14 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l m.message=msg;
m.wParam=wParam;
m.lParam=lParam;
- if ( cli.pfnDocking_ProcessWindowMessage(( WPARAM )&m, ( LPARAM )&result ))
+ if (cli.pfnDocking_ProcessWindowMessage((WPARAM)&m, (LPARAM)&result))
return result;
- if ( cli.pfnTrayIconProcessMessage(( WPARAM )&m, ( LPARAM )&result ))
+ if (cli.pfnTrayIconProcessMessage((WPARAM)&m, (LPARAM)&result))
return result;
- if ( cli.pfnHotkeysProcessMessage(( WPARAM )&m, ( LPARAM )&result ))
+ if (cli.pfnHotkeysProcessMessage((WPARAM)&m, (LPARAM)&result))
return result;
- return cli.pfnContactListWndProc( hwnd, msg, wParam, lParam );
+ return cli.pfnContactListWndProc(hwnd, msg, wParam, lParam);
}
int LoadCLUIModule(void)
@@ -266,7 +266,7 @@ int LoadCLUIModule(void) DBVARIANT dbv;
TCHAR titleText[256];
- uMsgProcessProfile = RegisterWindowMessage( _T("Miranda::ProcessProfile"));
+ uMsgProcessProfile = RegisterWindowMessage(_T("Miranda::ProcessProfile"));
cli.pfnLoadCluiGlobalOpts();
HookEvent(ME_SYSTEM_MODULESLOADED, CluiModulesLoaded);
@@ -307,7 +307,7 @@ int LoadCLUIModule(void) RegisterClassEx(&wndclass);
if (DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv))
- lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF( titleText ));
+ lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF(titleText));
else {
lstrcpyn(titleText, dbv.ptszVal, SIZEOF(titleText));
DBFreeVariant(&dbv);
@@ -344,7 +344,7 @@ int LoadCLUIModule(void) {
int state = DBGetContactSettingByte(NULL, "CList", "State", SETTING_STATE_NORMAL);
cli.hMenuMain = GetMenu(cli.hwndContactList);
- if (!DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
SetMenu(cli.hwndContactList, NULL);
if (state == SETTING_STATE_NORMAL)
ShowWindow(cli.hwndContactList, SW_SHOW);
@@ -361,7 +361,7 @@ int LoadCLUIModule(void) CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact);
mi.position = 2000070000;
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_DELETE );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_DELETE);
mi.pszContactOwner = NULL; //on every contact
mi.pszName = LPGEN("De&lete");
mi.pszService = "CList/DeleteContactCommand";
@@ -369,7 +369,7 @@ int LoadCLUIModule(void) CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact);
mi.position = 2000050000;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_RENAME );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_RENAME);
mi.pszContactOwner = NULL; //on every contact
mi.pszName = LPGEN("&Rename");
mi.pszService = "CList/RenameContactCommand";
@@ -378,7 +378,7 @@ int LoadCLUIModule(void) CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList);
mi.position = -2050000000;
mi.flags |= CMIF_NOTONLIST;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_ADDCONTACT );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ADDCONTACT);
mi.pszName = LPGEN("&Add permanently to list");
mi.pszService = "CList/AddToListContactCommand";
Menu_AddContactMenuItem(&mi);
@@ -393,7 +393,7 @@ int LoadCLUIModule(void) void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon)
{
- if (!IsWinVerXPPlus()) {
+ if ( !IsWinVerXPPlus()) {
FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_MENU));
if (dis->itemState & ODS_HOTLIGHT)
DrawEdge(dis->hDC, &dis->rcItem, BDR_RAISEDINNER, BF_RECT);
@@ -527,7 +527,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE;
case M_CREATECLC:
- cli.hwndContactTree = CreateWindow( CLISTCONTROL_CLASS, _T(""),
+ cli.hwndContactTree = CreateWindow(CLISTCONTROL_CLASS, _T(""),
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
| CLS_CONTACTLIST
| (DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
@@ -586,7 +586,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if (wParam == SIZE_MINIMIZED)
{
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT))
{
ShowWindow(hwnd, SW_HIDE);
@@ -600,11 +600,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
// drop thru
case WM_MOVE:
- if (!IsIconic(hwnd)) {
+ if ( !IsIconic(hwnd)) {
RECT rc;
GetWindowRect(hwnd, &rc);
- if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
DBWriteContactSettingDword(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
DBWriteContactSettingDword(NULL, "CList", "x", (DWORD) rc.left);
DBWriteContactSettingDword(NULL, "CList", "y", (DWORD) rc.top);
@@ -636,7 +636,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_SETCURSOR:
if (cluiopt.transparent) {
- if (!transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) {
+ if ( !transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) {
setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA);
transparentFocus=1;
SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
@@ -648,7 +648,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
LRESULT result;
result = DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam);
- if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT ||
+ if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT ||
result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT)
if (DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0))
return HTCLIENT;
@@ -678,7 +678,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else
setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
}
- if (!transparentFocus)
+ if ( !transparentFocus)
KillTimer(hwnd, TM_AUTOALPHA);
}
return TRUE;
@@ -690,7 +690,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
if (noRecurse)
break;
- if (!DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) || !IsWinVer2000Plus())
+ if ( !DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) || !IsWinVer2000Plus())
break;
if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) {
DWORD thisTick, startTick;
@@ -741,7 +741,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case SC_MINIMIZE:
case SC_CLOSE:
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT))
{
ShowWindow(hwnd, SW_HIDE);
@@ -839,7 +839,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *) lParam;
ClientToScreen(hwnd, &nmc->pt);
- if (!(nmc->flags & CLNF_ISGROUP))
+ if ( !(nmc->flags & CLNF_ISGROUP))
if (NotifyEventHooks(hContactDraggingEvent, (WPARAM) nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) {
SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
return TRUE;
@@ -849,7 +849,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case CLN_DRAGSTOP:
{
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *) lParam;
- if (!(nmc->flags & CLNF_ISGROUP))
+ if ( !(nmc->flags & CLNF_ISGROUP))
NotifyEventHooks(hContactDragStopEvent, (WPARAM) nmc->hItem, 0);
break;
}
@@ -857,7 +857,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *) lParam;
ClientToScreen(hwnd, &nmc->pt);
- if (!(nmc->flags & CLNF_ISGROUP))
+ if ( !(nmc->flags & CLNF_ISGROUP))
if (NotifyEventHooks(hContactDroppedEvent, (WPARAM) nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) {
SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
return TRUE;
@@ -875,7 +875,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcWindow, rcTree, rcWorkArea;
int maxHeight, newHeight;
- if (!DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0))
+ if ( !DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0))
break;
if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0))
break;
@@ -973,7 +973,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM POINT pt;
GetCursorPos(&pt);
if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) &&
- (!(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
+ ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU;
@@ -995,7 +995,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // all this is done in screen-coords!
GetCursorPos(&pt);
// the mouse isnt near the window, so put it in the middle of the window
- if (!PtInRect(&rc, pt)) {
+ if ( !PtInRect(&rc, pt)) {
pt.x = rc.left + (rc.right - rc.left) / 2;
pt.y = rc.top + (rc.bottom - rc.top) / 2;
}
@@ -1050,7 +1050,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon,
g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL);
IconLib_ReleaseIcon(hIcon, 0);
- if ( Proto_IsAccountLocked( Proto_GetAccount( szProto ))) {
+ if (Proto_IsAccountLocked(Proto_GetAccount(szProto))) {
hIcon = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED);
if (hIcon != NULL) {
DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon,
@@ -1066,8 +1066,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (showOpts & 2) {
PROTOACCOUNT* pa;
TCHAR tszName[64];
- if (( pa = Proto_GetAccount( szProto )) != NULL )
- mir_sntprintf( tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName );
+ if ((pa = Proto_GetAccount(szProto)) != NULL)
+ mir_sntprintf(tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName);
else
tszName[0] = 0;
@@ -1076,11 +1076,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM x += textSize.cx;
}
if (showOpts & 4) {
- TCHAR* szStatus = cli.pfnGetStatusModeDescription( status, 0 );
- if ( !szStatus )
+ TCHAR* szStatus = cli.pfnGetStatusModeDescription(status, 0);
+ if ( !szStatus)
szStatus = _T("");
- GetTextExtentPoint32( dis->hDC, szStatus, lstrlen(szStatus), &textSize );
- TextOut( dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy ) >> 1, szStatus, lstrlen( szStatus ));
+ GetTextExtentPoint32(dis->hDC, szStatus, lstrlen(szStatus), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, lstrlen(szStatus));
}
}
else if (dis->CtlType == ODT_MENU) {
@@ -1100,11 +1100,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE;
case WM_DESTROY:
- if (!IsIconic(hwnd)) {
+ if ( !IsIconic(hwnd)) {
RECT rc;
GetWindowRect(hwnd, &rc);
- if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
DBWriteContactSettingDword(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
DBWriteContactSettingDword(NULL, "CList", "x", (DWORD) rc.left);
DBWriteContactSettingDword(NULL, "CList", "y", (DWORD) rc.top);
@@ -1115,8 +1115,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
- if ( cli.hwndStatus ) {
- DestroyWindow( cli.hwndStatus );
+ if (cli.hwndStatus) {
+ DestroyWindow(cli.hwndStatus);
cli.hwndStatus = NULL;
}
diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index d96f688997..e1123ecd05 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -35,7 +35,7 @@ static INT_PTR GetHwndTree(WPARAM, LPARAM) static INT_PTR CluiProtocolStatusChanged(WPARAM wParam, LPARAM lParam)
{
- cli.pfnCluiProtocolStatusChanged( wParam, (const char*)lParam );
+ cli.pfnCluiProtocolStatusChanged(wParam, (const char*)lParam);
return 0;
}
@@ -54,7 +54,7 @@ static INT_PTR GroupAdded(WPARAM wParam, LPARAM lParam) HWND hwndFocus = GetFocus();
GetClassName(hwndFocus, szFocusClass, SIZEOF(szFocusClass));
- if (!lstrcmp(szFocusClass, CLISTCONTROL_CLASS)) {
+ if ( !lstrcmp(szFocusClass, CLISTCONTROL_CLASS)) {
hItem = (HANDLE) SendMessage(hwndFocus, CLM_FINDGROUP, wParam, 0);
if (hItem)
SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM) hItem, 0);
@@ -151,27 +151,27 @@ void LoadCluiServices(void) /////////////////////////////////////////////////////////////////////////////////////////
// default protocol status notification handler
-void fnCluiProtocolStatusChanged(int, const char* )
+void fnCluiProtocolStatusChanged(int, const char*)
{
int i, *partWidths;
int borders[3];
int flags = 0;
- if ( cli.menuProtoCount == 0 ) {
+ if (cli.menuProtoCount == 0) {
SendMessage(cli.hwndStatus, SB_SETPARTS, 0, 0);
- SendMessage( cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0 );
+ SendMessage(cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0);
return;
}
- SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, ( LPARAM )&borders);
+ SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders);
- partWidths = ( int* )alloca( cli.menuProtoCount * sizeof( int ));
- if ( DBGetContactSettingByte( NULL, "CLUI", "EqualSections", 0 )) {
+ partWidths = (int*)alloca(cli.menuProtoCount * sizeof(int));
+ if (DBGetContactSettingByte(NULL, "CLUI", "EqualSections", 0)) {
RECT rc;
- GetClientRect( cli.hwndStatus, &rc );
- rc.right -= borders[0] * 2 + ( DBGetContactSettingByte( NULL, "CLUI", "ShowGrip", 1 ) ? GetSystemMetrics( SM_CXVSCROLL ) : 0 );
- for ( i = 0; i < cli.menuProtoCount; i++ )
- partWidths[ i ] = ( i+1 ) * rc.right / cli.menuProtoCount - (borders[2] >> 1);
+ GetClientRect(cli.hwndStatus, &rc);
+ rc.right -= borders[0] * 2 + (DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? GetSystemMetrics(SM_CXVSCROLL) : 0);
+ for (i = 0; i < cli.menuProtoCount; i++)
+ partWidths[ i ] = (i+1) * rc.right / cli.menuProtoCount - (borders[2] >> 1);
}
else {
HDC hdc;
@@ -180,42 +180,42 @@ void fnCluiProtocolStatusChanged(int, const char* ) hdc = GetDC(NULL);
SelectObject(hdc, (HFONT) SendMessage(cli.hwndStatus, WM_GETFONT, 0, 0));
- for ( i = 0; i < cli.menuProtoCount; i++ ) { //count down since built in ones tend to go at the end
+ for (i = 0; i < cli.menuProtoCount; i++) { //count down since built in ones tend to go at the end
int x = 2;
- if ( showOpts & 1 )
+ if (showOpts & 1)
x += g_IconWidth;
- if ( showOpts & 2 ) {
+ if (showOpts & 2) {
TCHAR tszName[64];
- PROTOACCOUNT* pa = Proto_GetAccount( cli.menuProtos[i].szProto );
- if ( pa )
- mir_sntprintf( tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName );
+ PROTOACCOUNT* pa = Proto_GetAccount(cli.menuProtos[i].szProto);
+ if (pa)
+ mir_sntprintf(tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName);
else
tszName[0] = 0;
- if ( showOpts & 4 && lstrlen(tszName) < SIZEOF(tszName)-1 )
- lstrcat( tszName, _T(" "));
+ if (showOpts & 4 && lstrlen(tszName) < SIZEOF(tszName)-1)
+ lstrcat(tszName, _T(" "));
GetTextExtentPoint32(hdc, tszName, lstrlen(tszName), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
- if ( showOpts & 4 ) {
- TCHAR* modeDescr = cli.pfnGetStatusModeDescription( CallProtoService( cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0 );
+ if (showOpts & 4) {
+ TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoService(cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
GetTextExtentPoint32(hdc, modeDescr, lstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
- partWidths[ i ] = ( i ? partWidths[ i-1] : 0 ) + x + 2;
+ partWidths[ i ] = (i ? partWidths[ i-1] : 0) + x + 2;
}
ReleaseDC(NULL, hdc);
}
partWidths[ cli.menuProtoCount-1 ] = -1;
SendMessage(cli.hwndStatus, SB_SETMINHEIGHT, g_IconHeight, 0);
- SendMessage(cli.hwndStatus, SB_SETPARTS, cli.menuProtoCount, ( LPARAM )partWidths);
+ SendMessage(cli.hwndStatus, SB_SETPARTS, cli.menuProtoCount, (LPARAM)partWidths);
flags = SBT_OWNERDRAW;
- if ( DBGetContactSettingByte( NULL, "CLUI", "SBarBevel", 1 ) == 0 )
+ if (DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1) == 0)
flags |= SBT_NOBORDERS;
- for ( i = 0; i < cli.menuProtoCount; i++ ) {
- SendMessage( cli.hwndStatus, SB_SETTEXT, i | flags, ( LPARAM )cli.menuProtos[i].szProto );
+ for (i = 0; i < cli.menuProtoCount; i++) {
+ SendMessage(cli.hwndStatus, SB_SETTEXT, i | flags, (LPARAM)cli.menuProtos[i].szProto);
}
}
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index c0b1c9e8d1..5fce5cb1f4 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -45,7 +45,7 @@ static const struct { static int GetContactStatus(HANDLE hContact)
{
- char* szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL)
return ID_STATUS_OFFLINE;
return DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -73,7 +73,7 @@ void fnLoadContactTree(void) CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0);
for (i = 1;; i++) {
- if ( cli.pfnGetGroupName(i, NULL) == NULL)
+ if (cli.pfnGetGroupName(i, NULL) == NULL)
break;
CallService(MS_CLUI_GROUPADDED, i, 0);
}
@@ -82,7 +82,7 @@ void fnLoadContactTree(void) hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact != NULL) {
status = GetContactStatus(hContact);
- if ((!hideOffline || status != ID_STATUS_OFFLINE) && !DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if (( !hideOffline || status != ID_STATUS_OFFLINE) && !DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0), status, hContact), 1);
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
@@ -108,7 +108,7 @@ int fnCompareContacts(const struct ClcContact* c1, const struct ClcContact* c2) return 2 * (statusa == ID_STATUS_OFFLINE) - 1;
}
/* both are online, now check protocols */
- rc = lstrcmpA( c1->proto, c2->proto);
+ rc = lstrcmpA(c1->proto, c2->proto);
if (rc != 0 && (c1->proto != NULL && c2->proto != NULL))
return rc;
/* protocols are the same, order by display name */
@@ -128,10 +128,10 @@ int fnCompareContacts(const struct ClcContact* c1, const struct ClcContact* c2) }
}
- nameb = cli.pfnGetContactDisplayName( a, 0);
+ nameb = cli.pfnGetContactDisplayName(a, 0);
_tcsncpy(namea, nameb, SIZEOF(namea));
namea[ SIZEOF(namea)-1 ] = 0;
- nameb = cli.pfnGetContactDisplayName( b, 0);
+ nameb = cli.pfnGetContactDisplayName(b, 0);
//otherwise just compare names
return _tcsicmp(namea, nameb);
@@ -176,7 +176,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) int fnSetHideOffline(WPARAM wParam, LPARAM)
{
- switch(( int )wParam ) {
+ switch((int)wParam) {
case 0:
DBWriteContactSettingByte(NULL, "CList", "HideOffline", 0);
break;
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 4c6edd416d..7fcb9b32c7 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -29,44 +29,44 @@ static CRITICAL_SECTION csMenuHook; static int NextObjectId = 0x100, NextObjectMenuItemId = CLISTMENUIDMIN;
-#if defined( _DEBUG )
-static void DumpMenuItem( TMO_IntMenuItem* pParent, int level = 0 )
+#if defined(_DEBUG)
+static void DumpMenuItem(TMO_IntMenuItem* pParent, int level = 0)
{
char temp[ 30 ];
- memset( temp, '\t', level );
+ memset(temp, '\t', level);
temp[ level ] = 0;
- for ( PMO_IntMenuItem pimi = pParent; pimi != NULL; pimi = pimi->next ) {
- Netlib_Logf( NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.ptszName );
+ for (PMO_IntMenuItem pimi = pParent; pimi != NULL; pimi = pimi->next) {
+ Netlib_Logf(NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.ptszName);
PMO_IntMenuItem submenu = pimi->submenu.first;
- if ( submenu )
- DumpMenuItem( submenu, level+1 );
+ if (submenu)
+ DumpMenuItem(submenu, level+1);
} }
#endif
-static int CompareMenus( const TIntMenuObject* p1, const TIntMenuObject* p2 )
+static int CompareMenus(const TIntMenuObject* p1, const TIntMenuObject* p2)
{
- return lstrcmpA( p1->Name, p2->Name );
+ return lstrcmpA(p1->Name, p2->Name);
}
-LIST<TIntMenuObject> g_menus( 10, CompareMenus );
+LIST<TIntMenuObject> g_menus(10, CompareMenus);
-void FreeAndNil( void **p )
+void FreeAndNil(void **p)
{
- if ( p == NULL )
+ if (p == NULL)
return;
- if ( *p != NULL ) {
- mir_free( *p );
+ if (*p != NULL) {
+ mir_free(*p);
*p = NULL;
} }
-int GetMenuObjbyId( const int id )
+int GetMenuObjbyId(const int id)
{
- for ( int i=0; i < g_menus.getCount(); i++ )
- if ( g_menus[i]->id == id )
+ for (int i=0; i < g_menus.getCount(); i++)
+ if (g_menus[i]->id == id)
return i;
return -1;
@@ -80,21 +80,21 @@ LPTSTR GetMenuItemText(PMO_IntMenuItem pimi) return LangPackTranslateStringT(pimi->mi.hLangpack, pimi->mi.ptszName);
}
-PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem parent, pfnWalkFunc func, void* param )
+PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, void* param)
{
- if ( parent == NULL )
+ if (parent == NULL)
return FALSE;
PMO_IntMenuItem pnext;
- for ( PMO_IntMenuItem pimi = parent; pimi != NULL; pimi = pnext ) {
+ for (PMO_IntMenuItem pimi = parent; pimi != NULL; pimi = pnext) {
PMO_IntMenuItem submenu = pimi->submenu.first;
pnext = pimi->next;
- if ( func( pimi, param )) // it can destroy the menu item
+ if (func(pimi, param)) // it can destroy the menu item
return pimi;
- if ( submenu ) {
- PMO_IntMenuItem res = MO_RecursiveWalkMenu( submenu, func, param );
- if ( res )
+ if (submenu) {
+ PMO_IntMenuItem res = MO_RecursiveWalkMenu(submenu, func, param);
+ if (res)
return res;
}
}
@@ -104,23 +104,23 @@ PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem parent, pfnWalkFunc func, //wparam=0
//lparam=LPMEASUREITEMSTRUCT
-int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis )
+int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis)
{
// prevent win9x from ugly menus displaying when there is no icon
mis->itemWidth = 0;
mis->itemHeight = 0;
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- if ( mis == NULL )
+ if (mis == NULL)
return FALSE;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mis->itemData );
- if ( pimi == NULL )
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mis->itemData);
+ if (pimi == NULL)
return FALSE;
- if ( pimi->iconId == -1 )
+ if (pimi->iconId == -1)
return FALSE;
mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON)-GetSystemMetrics(SM_CXMENUCHECK)+4);
@@ -130,35 +130,35 @@ int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis ) //wparam=0
//lparam=LPDRAWITEMSTRUCT
-int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis )
+int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- if ( dis == NULL )
+ if (dis == NULL)
return FALSE;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )dis->itemData );
- if ( pimi == NULL || pimi->iconId == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)dis->itemData);
+ if (pimi == NULL || pimi->iconId == -1) {
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
int y = (dis->rcItem.bottom - dis->rcItem.top - GetSystemMetrics(SM_CYSMICON))/2+1;
- if ( dis->itemState & ODS_SELECTED ) {
- if ( dis->itemState & ODS_CHECKED ) {
+ if (dis->itemState & ODS_SELECTED) {
+ if (dis->itemState & ODS_CHECKED) {
RECT rc;
rc.left = 2; rc.right = GetSystemMetrics(SM_CXSMICON)+2;
rc.top = y; rc.bottom = rc.top+GetSystemMetrics(SM_CYSMICON)+2;
- FillRect(dis->hDC, &rc, GetSysColorBrush( COLOR_HIGHLIGHT ));
- ImageList_DrawEx( pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_SELECTED );
+ FillRect(dis->hDC, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_SELECTED);
}
- else ImageList_DrawEx( pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_FOCUS );
+ else ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_FOCUS);
}
else {
- if ( dis->itemState & ODS_CHECKED) {
+ if (dis->itemState & ODS_CHECKED) {
RECT rc;
rc.left = 0; rc.right = GetSystemMetrics(SM_CXSMICON)+4;
rc.top = y-2; rc.bottom = rc.top + GetSystemMetrics(SM_CYSMICON)+4;
@@ -173,14 +173,14 @@ int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis ) }
else ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return TRUE;
}
int MO_RemoveAllObjects()
{
int i;
- for ( i=0; i < g_menus.getCount(); i++ )
+ for (i=0; i < g_menus.getCount(); i++)
delete g_menus[i];
g_menus.destroy();
@@ -193,74 +193,74 @@ INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM) int objidx;
if ( !bIsGenMenuInited) return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- objidx = GetMenuObjbyId(( int )wParam );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ objidx = GetMenuObjbyId((int)wParam);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
delete g_menus[ objidx ];
- g_menus.remove( objidx );
- LeaveCriticalSection( &csMenuHook );
+ g_menus.remove(objidx);
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
//wparam=MenuObjectHandle
//lparam=vKey
-INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey )
+INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
{
if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- int objidx = GetMenuObjbyId((int)menuHandle );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ int objidx = GetMenuObjbyId((int)menuHandle);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
- for ( PMO_IntMenuItem pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next ) {
- if ( pimi->mi.hotKey == 0 ) continue;
- if ( HIWORD(pimi->mi.hotKey) != vKey) continue;
- if ( !(LOWORD(pimi->mi.hotKey) & MOD_ALT ) != !( GetKeyState( VK_MENU ) & 0x8000)) continue;
- if ( !(LOWORD(pimi->mi.hotKey) & MOD_CONTROL ) != !( GetKeyState( VK_CONTROL ) & 0x8000)) continue;
- if ( !(LOWORD(pimi->mi.hotKey) & MOD_SHIFT ) != !( GetKeyState( VK_SHIFT ) & 0x8000)) continue;
+ for (PMO_IntMenuItem pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next) {
+ if (pimi->mi.hotKey == 0) continue;
+ if (HIWORD(pimi->mi.hotKey) != vKey) continue;
+ if ( !(LOWORD(pimi->mi.hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue;
+ if ( !(LOWORD(pimi->mi.hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue;
+ if ( !(LOWORD(pimi->mi.hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue;
- MO_ProcessCommand( pimi, 0 );
- LeaveCriticalSection( &csMenuHook );
+ MO_ProcessCommand(pimi, 0);
+ LeaveCriticalSection(&csMenuHook);
return TRUE;
}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam)
{
- char* szProto = ( char* )wParam;
- if ( szProto == NULL )
+ char* szProto = (char*)wParam;
+ if (szProto == NULL)
return 0;
- if ( DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE ))
- return ( INT_PTR )cli.pfnGetProtocolMenu( szProto );
+ if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
+ return (INT_PTR)cli.pfnGetProtocolMenu(szProto);
- int objidx = GetMenuObjbyId(( int )hMainMenuObject );
- if ( objidx == -1 )
+ int objidx = GetMenuObjbyId((int)hMainMenuObject);
+ if (objidx == -1)
return NULL;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
TIntMenuObject* pmo = g_menus[objidx];
PMO_IntMenuItem p;
- for ( p = pmo->m_items.first; p != NULL; p = p->next )
- if ( !lstrcmpA( p->UniqName, szProto ))
+ for (p = pmo->m_items.first; p != NULL; p = p->next)
+ if ( !lstrcmpA(p->UniqName, szProto))
break;
- LeaveCriticalSection( &csMenuHook );
- return ( INT_PTR )p;
+ LeaveCriticalSection(&csMenuHook);
+ return (INT_PTR)p;
}
//wparam=MenuItemHandle
@@ -268,88 +268,88 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam)
{
PMO_MenuItem mi = (PMO_MenuItem)lParam;
- if ( !bIsGenMenuInited || mi == NULL )
+ if ( !bIsGenMenuInited || mi == NULL)
return -1;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam);
- EnterCriticalSection( &csMenuHook );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ EnterCriticalSection(&csMenuHook);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
*mi = pimi->mi;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
-static int FindDefaultItem( PMO_IntMenuItem pimi, void* )
+static int FindDefaultItem(PMO_IntMenuItem pimi, void*)
{
- if ( pimi->mi.flags & ( CMIF_GRAYED | CMIF_HIDDEN ))
+ if (pimi->mi.flags & (CMIF_GRAYED | CMIF_HIDDEN))
return FALSE;
- return ( pimi->mi.flags & CMIF_DEFAULT ) ? TRUE : FALSE;
+ return (pimi->mi.flags & CMIF_DEFAULT) ? TRUE : FALSE;
}
INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam);
- EnterCriticalSection( &csMenuHook );
- if ( pimi )
- pimi = MO_RecursiveWalkMenu( pimi, FindDefaultItem, NULL );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ EnterCriticalSection(&csMenuHook);
+ if (pimi)
+ pimi = MO_RecursiveWalkMenu(pimi, FindDefaultItem, NULL);
- LeaveCriticalSection( &csMenuHook );
- return ( INT_PTR )pimi;
+ LeaveCriticalSection(&csMenuHook);
+ return (INT_PTR)pimi;
}
//wparam MenuItemHandle
//lparam PMO_MenuItem
-int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi )
+int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi)
{
int oldflags;
- if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof( TMO_MenuItem ))
+ if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem))
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )menuHandle );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)menuHandle);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- if ( pmi->flags & CMIM_NAME ) {
- FreeAndNil(( void** )&pimi->mi.pszName );
+ if (pmi->flags & CMIM_NAME) {
+ FreeAndNil((void**)&pimi->mi.pszName);
- if ( pmi->flags & CMIF_UNICODE )
+ if (pmi->flags & CMIF_UNICODE)
pimi->mi.ptszName = mir_tstrdup(pmi->ptszName);
else
pimi->mi.ptszName = mir_a2t(pmi->pszName);
}
- if ( pmi->flags & CMIM_FLAGS ) {
- oldflags = pimi->mi.flags & ( CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB );
+ if (pmi->flags & CMIM_FLAGS) {
+ oldflags = pimi->mi.flags & (CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB);
pimi->mi.flags = (pmi->flags & ~CMIM_ALL) | oldflags;
}
- if ((pmi->flags & CMIM_ICON) && !bIconsDisabled ) {
- if ( pimi->mi.flags & CMIF_ICONFROMICOLIB ) {
- HICON hIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
- if ( hIcon != NULL ) {
+ if ((pmi->flags & CMIM_ICON) && !bIconsDisabled) {
+ if (pimi->mi.flags & CMIF_ICONFROMICOLIB) {
+ HICON hIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
+ if (hIcon != NULL) {
pimi->hIcolibItem = pmi->hIcolibItem;
- pimi->iconId = ImageList_ReplaceIcon( pimi->parent->m_hMenuIcons, pimi->iconId, hIcon );
- IconLib_ReleaseIcon( hIcon, 0 );
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, hIcon);
+ IconLib_ReleaseIcon(hIcon, 0);
}
else pimi->iconId = -1, pimi->hIcolibItem = NULL;
}
else {
pimi->mi.hIcon = pmi->hIcon;
- if ( pmi->hIcon != NULL )
- pimi->iconId = ImageList_ReplaceIcon( pimi->parent->m_hMenuIcons, pimi->iconId, pmi->hIcon );
+ if (pmi->hIcon != NULL)
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, pmi->hIcon);
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
@@ -359,10 +359,10 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) }
}
- if ( pmi->flags & CMIM_HOTKEY )
+ if (pmi->flags & CMIM_HOTKEY)
pimi->mi.hotKey = pmi->hotKey;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
@@ -371,33 +371,33 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) //NULL on error.
INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- INT_PTR res = ( INT_PTR )pimi->mi.ownerdata;
- LeaveCriticalSection( &csMenuHook );
+ INT_PTR res = (INT_PTR)pimi->mi.ownerdata;
+ LeaveCriticalSection(&csMenuHook);
return res;
}
PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam)
{
- PMO_IntMenuItem result = ( PMO_IntMenuItem )wParam;
- if ( result == NULL || wParam == (HGENMENU)0xffff1234 || wParam == HGENMENU_ROOT)
+ PMO_IntMenuItem result = (PMO_IntMenuItem)wParam;
+ if (result == NULL || wParam == (HGENMENU)0xffff1234 || wParam == HGENMENU_ROOT)
return NULL;
__try
{
- if ( result->signature != MENUITEM_SIGNATURE )
+ if (result->signature != MENUITEM_SIGNATURE)
result = NULL;
}
- __except( EXCEPTION_EXECUTE_HANDLER )
+ __except(EXCEPTION_EXECUTE_HANDLER)
{
result = NULL;
}
@@ -407,80 +407,80 @@ PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam) //LOWORD(wparam) menuident
-static int FindMenuByCommand( PMO_IntMenuItem pimi, void* pCommand )
+static int FindMenuByCommand(PMO_IntMenuItem pimi, void* pCommand)
{
- return ( pimi->iCommand == (int)pCommand );
+ return (pimi->iCommand == (int)pCommand);
}
int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- int objidx = GetMenuObjbyId( menuID );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ int objidx = GetMenuObjbyId(menuID);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- PMO_IntMenuItem pimi = MO_RecursiveWalkMenu( g_menus[objidx]->m_items.first, FindMenuByCommand, ( void* )command );
- if ( pimi ) {
- LeaveCriticalSection( &csMenuHook );
- return MO_ProcessCommand( pimi, lParam );
+ PMO_IntMenuItem pimi = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindMenuByCommand, (void*)command);
+ if (pimi) {
+ LeaveCriticalSection(&csMenuHook);
+ return MO_ProcessCommand(pimi, lParam);
}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- for ( int i=0; i < g_menus.getCount(); i++ ) {
- PMO_IntMenuItem pimi = MO_RecursiveWalkMenu( g_menus[i]->m_items.first, FindMenuByCommand, ( void* )wParam );
- if ( pimi ) {
- LeaveCriticalSection( &csMenuHook );
- return MO_ProcessCommand( pimi, lParam );
+ for (int i=0; i < g_menus.getCount(); i++) {
+ PMO_IntMenuItem pimi = MO_RecursiveWalkMenu(g_menus[i]->m_items.first, FindMenuByCommand, (void*)wParam);
+ if (pimi) {
+ LeaveCriticalSection(&csMenuHook);
+ return MO_ProcessCommand(pimi, lParam);
} }
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
-int MO_ProcessCommand( PMO_IntMenuItem aHandle, LPARAM lParam )
+int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem( aHandle );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem(aHandle);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
char *srvname = pimi->parent->ExecService;
void *ownerdata = pimi->mi.ownerdata;
- LeaveCriticalSection( &csMenuHook );
- CallService( srvname, ( WPARAM )ownerdata, lParam );
+ LeaveCriticalSection(&csMenuHook);
+ CallService(srvname, (WPARAM)ownerdata, lParam);
return 1;
}
-int MO_SetOptionsMenuItem( PMO_IntMenuItem aHandle, int setting, INT_PTR value )
+int MO_SetOptionsMenuItem(PMO_IntMenuItem aHandle, int setting, INT_PTR value)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem( aHandle );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem(aHandle);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
@@ -488,58 +488,58 @@ int MO_SetOptionsMenuItem( PMO_IntMenuItem aHandle, int setting, INT_PTR value ) __try
{
res = 1;
- if ( setting == OPT_MENUITEMSETUNIQNAME ) {
- mir_free( pimi->UniqName );
- pimi->UniqName = mir_strdup(( char* )value );
+ if (setting == OPT_MENUITEMSETUNIQNAME) {
+ mir_free(pimi->UniqName);
+ pimi->UniqName = mir_strdup((char*)value);
}
}
- __except( EXCEPTION_EXECUTE_HANDLER ) {}
+ __except(EXCEPTION_EXECUTE_HANDLER) {}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return res;
}
-int MO_SetOptionsMenuObject( HANDLE handle, int setting, INT_PTR value )
+int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value)
{
int pimoidx;
int res = 0;
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
__try
{
- pimoidx = GetMenuObjbyId((int)handle );
+ pimoidx = GetMenuObjbyId((int)handle);
res = pimoidx != -1;
- if ( res ) {
+ if (res) {
TIntMenuObject* pmo = g_menus[pimoidx];
- switch ( setting ) {
+ switch (setting) {
case OPT_MENUOBJECT_SET_ONADD_SERVICE:
- FreeAndNil(( void** )&pmo->onAddService );
- pmo->onAddService = mir_strdup(( char* )value );
+ FreeAndNil((void**)&pmo->onAddService);
+ pmo->onAddService = mir_strdup((char*)value);
break;
case OPT_MENUOBJECT_SET_FREE_SERVICE:
- FreeAndNil(( void** )&pmo->FreeService );
- pmo->FreeService = mir_strdup(( char* )value );
+ FreeAndNil((void**)&pmo->FreeService);
+ pmo->FreeService = mir_strdup((char*)value);
break;
case OPT_MENUOBJECT_SET_CHECK_SERVICE:
- FreeAndNil(( void** )&pmo->CheckService );
- pmo->CheckService = mir_strdup(( char* )value);
+ FreeAndNil((void**)&pmo->CheckService);
+ pmo->CheckService = mir_strdup((char*)value);
break;
case OPT_USERDEFINEDITEMS:
- pmo->m_bUseUserDefinedItems = ( BOOL )value;
+ pmo->m_bUseUserDefinedItems = (BOOL)value;
break;
}
}
}
- __except( EXCEPTION_EXECUTE_HANDLER ) {}
+ __except(EXCEPTION_EXECUTE_HANDLER) {}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return res;
}
@@ -548,71 +548,71 @@ int MO_SetOptionsMenuObject( HANDLE handle, int setting, INT_PTR value ) //result=MenuObjectHandle
INT_PTR MO_CreateNewMenuObject(WPARAM, LPARAM lParam)
{
- PMenuParam pmp = ( PMenuParam )lParam;
- if ( !bIsGenMenuInited || pmp == NULL )
+ PMenuParam pmp = (PMenuParam)lParam;
+ if ( !bIsGenMenuInited || pmp == NULL)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
TIntMenuObject* p = new TIntMenuObject();
p->id = NextObjectId++;
- p->Name = mir_strdup( pmp->name );
- p->CheckService = mir_strdup( pmp->CheckService );
- p->ExecService = mir_strdup( pmp->ExecService );
- p->m_hMenuIcons = ImageList_Create( GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
- (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 15, 100 );
+ p->Name = mir_strdup(pmp->name);
+ p->CheckService = mir_strdup(pmp->CheckService);
+ p->ExecService = mir_strdup(pmp->ExecService);
+ p->m_hMenuIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
+ (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 15, 100);
g_menus.insert(p);
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return p->id;
}
//wparam=MenuItemHandle
//lparam=0
-static int FreeMenuItem( TMO_IntMenuItem* pimi, void* )
+static int FreeMenuItem(TMO_IntMenuItem* pimi, void*)
{
- pimi->parent->freeItem( pimi );
+ pimi->parent->freeItem(pimi);
return FALSE;
}
-static int FindParent( TMO_IntMenuItem* pimi, void* p )
+static int FindParent(TMO_IntMenuItem* pimi, void* p)
{
return pimi->next == p;
}
INT_PTR MO_RemoveMenuItem(WPARAM wParam, LPARAM)
{
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- if ( pimi->submenu.first ) {
- MO_RecursiveWalkMenu( pimi->submenu.first, FreeMenuItem, NULL );
+ if (pimi->submenu.first) {
+ MO_RecursiveWalkMenu(pimi->submenu.first, FreeMenuItem, NULL);
pimi->submenu.first = NULL;
}
- PMO_IntMenuItem prev = MO_RecursiveWalkMenu( pimi->owner->first, FindParent, pimi );
- if ( prev )
+ PMO_IntMenuItem prev = MO_RecursiveWalkMenu(pimi->owner->first, FindParent, pimi);
+ if (prev)
prev->next = pimi->next;
- if ( pimi->owner->first == pimi )
+ if (pimi->owner->first == pimi)
pimi->owner->first = pimi->next;
- if ( pimi->owner->last == pimi )
+ if (pimi->owner->last == pimi)
pimi->owner->last = prev;
pimi->signature = 0; // invalidate all future calls to that object
- pimi->parent->freeItem( pimi );
+ pimi->parent->freeItem(pimi);
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// we presume that this function is being called inside csMenuHook only
-static int PackMenuItems( PMO_IntMenuItem pimi, void* )
+static int PackMenuItems(PMO_IntMenuItem pimi, void*)
{
pimi->iCommand = NextObjectMenuItemId++;
return FALSE;
@@ -621,10 +621,10 @@ static int PackMenuItems( PMO_IntMenuItem pimi, void* ) static int GetNextObjectMenuItemId()
{
// if menu commands are exausted, pack the menu array
- if ( NextObjectMenuItemId >= CLISTMENUIDMAX ) {
+ if (NextObjectMenuItemId >= CLISTMENUIDMAX) {
NextObjectMenuItemId = CLISTMENUIDMIN;
- for ( int i=0; i < g_menus.getCount(); i++ )
- MO_RecursiveWalkMenu( g_menus[i]->m_items.first, PackMenuItems, NULL );
+ for (int i=0; i < g_menus.getCount(); i++)
+ MO_RecursiveWalkMenu(g_menus[i]->m_items.first, PackMenuItems, NULL);
}
return NextObjectMenuItemId++;
@@ -633,25 +633,25 @@ static int GetNextObjectMenuItemId() //wparam=MenuObjectHandle
//lparam=PMO_MenuItem
//return MenuItemHandle
-PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi )
+PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
{
- if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof( TMO_MenuItem ))
+ if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem))
return NULL;
//old mode
- if ( !( pmi->flags & CMIF_ROOTHANDLE ))
- return MO_AddOldNewMenuItem( menuobjecthandle, pmi );
+ if ( !(pmi->flags & CMIF_ROOTHANDLE))
+ return MO_AddOldNewMenuItem(menuobjecthandle, pmi);
- EnterCriticalSection( &csMenuHook );
- int objidx = GetMenuObjbyId((int)menuobjecthandle );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ int objidx = GetMenuObjbyId((int)menuobjecthandle);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return NULL;
}
TIntMenuObject* pmo = g_menus[objidx];
- TMO_IntMenuItem* p = ( TMO_IntMenuItem* )mir_calloc( sizeof( TMO_IntMenuItem ));
+ TMO_IntMenuItem* p = (TMO_IntMenuItem*)mir_calloc(sizeof(TMO_IntMenuItem));
p->parent = pmo;
p->signature = MENUITEM_SIGNATURE;
p->iCommand = GetNextObjectMenuItemId();
@@ -660,89 +660,89 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi ) p->OverrideShow = TRUE;
p->originalPosition = pmi->position;
- if ( pmi->flags & CMIF_UNICODE )
+ if (pmi->flags & CMIF_UNICODE)
p->mi.ptszName = mir_tstrdup(pmi->ptszName);
else
p->mi.ptszName = mir_a2u(pmi->pszName);
- if ( pmi->hIcon != NULL && !bIconsDisabled ) {
- if ( pmi->flags & CMIF_ICONFROMICOLIB ) {
- HICON hIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
- p->iconId = ImageList_AddIcon( pmo->m_hMenuIcons, hIcon );
+ if (pmi->hIcon != NULL && !bIconsDisabled) {
+ if (pmi->flags & CMIF_ICONFROMICOLIB) {
+ HICON hIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
+ p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, hIcon);
p->hIcolibItem = pmi->hIcolibItem;
- IconLib_ReleaseIcon( hIcon, 0 );
+ IconLib_ReleaseIcon(hIcon, 0);
}
else {
- HANDLE hIcolibItem = IcoLib_IsManaged( pmi->hIcon );
- if ( hIcolibItem ) {
- p->iconId = ImageList_AddIcon( pmo->m_hMenuIcons, pmi->hIcon );
+ HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
+ if (hIcolibItem) {
+ p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
p->hIcolibItem = hIcolibItem;
}
- else p->iconId = ImageList_AddIcon( pmo->m_hMenuIcons, pmi->hIcon );
+ else p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
} }
- if ( p->mi.root == HGENMENU_ROOT )
+ if (p->mi.root == HGENMENU_ROOT)
p->mi.root = NULL;
- PMO_IntMenuItem pRoot = ( p->mi.root != NULL ) ? MO_GetIntMenuItem( p->mi.root ) : NULL;
- if ( pRoot )
+ PMO_IntMenuItem pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL;
+ if (pRoot)
p->owner = &pRoot->submenu;
else
p->owner = &pmo->m_items;
- if ( !p->owner->first )
+ if ( !p->owner->first)
p->owner->first = p;
- if ( p->owner->last )
+ if (p->owner->last)
p->owner->last->next = p;
p->owner->last = p;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return p;
}
//wparam=MenuObjectHandle
//lparam=PMO_MenuItem
-int FindRoot( PMO_IntMenuItem pimi, void* param )
+int FindRoot(PMO_IntMenuItem pimi, void* param)
{
- if ( pimi->mi.pszName != NULL )
- if ( pimi->submenu.first && !_tcscmp( pimi->mi.ptszName, ( TCHAR* )param ))
+ if (pimi->mi.pszName != NULL)
+ if (pimi->submenu.first && !_tcscmp(pimi->mi.ptszName, (TCHAR*)param))
return TRUE;
return FALSE;
}
-PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi )
+PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
{
- if ( !bIsGenMenuInited || pmi == NULL )
+ if ( !bIsGenMenuInited || pmi == NULL)
return NULL;
- int objidx = GetMenuObjbyId((int)menuobjecthandle );
- if ( objidx == -1 )
+ int objidx = GetMenuObjbyId((int)menuobjecthandle);
+ if (objidx == -1)
return NULL;
- if ( pmi->cbSize != sizeof( TMO_MenuItem ))
+ if (pmi->cbSize != sizeof(TMO_MenuItem))
return NULL;
- if ( pmi->flags & CMIF_ROOTHANDLE )
+ if (pmi->flags & CMIF_ROOTHANDLE)
return NULL;
//is item with popup or not
- if ( pmi->root == 0 ) {
+ if (pmi->root == 0) {
//yes, this without popup
pmi->root = NULL; //first level
}
else { // no, search for needed root and create it if need
TCHAR* tszRoot;
- if ( pmi->flags & CMIF_UNICODE )
- tszRoot = mir_tstrdup(( TCHAR* )pmi->root );
+ if (pmi->flags & CMIF_UNICODE)
+ tszRoot = mir_tstrdup((TCHAR*)pmi->root);
else
- tszRoot = mir_a2t(( char* )pmi->root );
+ tszRoot = mir_a2t((char*)pmi->root);
- PMO_IntMenuItem oldroot = MO_RecursiveWalkMenu( g_menus[objidx]->m_items.first, FindRoot, tszRoot );
- mir_free( tszRoot );
+ PMO_IntMenuItem oldroot = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindRoot, tszRoot);
+ mir_free(tszRoot);
- if ( oldroot == NULL ) {
+ if (oldroot == NULL) {
//not found, creating root
TMO_MenuItem tmi = { 0 };
tmi = *pmi;
@@ -750,9 +750,9 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi tmi.ownerdata = 0;
tmi.root = NULL;
//copy pszPopupName
- tmi.ptszName = ( TCHAR* )pmi->root;
- if (( oldroot = MO_AddNewMenuItem( menuobjecthandle, &tmi )) != NULL )
- MO_SetOptionsMenuItem( oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root );
+ tmi.ptszName = (TCHAR*)pmi->root;
+ if ((oldroot = MO_AddNewMenuItem(menuobjecthandle, &tmi)) != NULL)
+ MO_SetOptionsMenuItem(oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root);
}
pmi->root = oldroot;
@@ -760,20 +760,20 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi }
pmi->flags |= CMIF_ROOTHANDLE;
//add popup(root allready exists)
- return MO_AddNewMenuItem( menuobjecthandle, pmi );
+ return MO_AddNewMenuItem(menuobjecthandle, pmi);
}
-static int WhereToPlace( HMENU hMenu, PMO_MenuItem mi )
+static int WhereToPlace(HMENU hMenu, PMO_MenuItem mi)
{
MENUITEMINFO mii = { 0 };
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( int i=GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
- GetMenuItemInfo( hMenu, i, TRUE, &mii );
- if ( mii.fType != MFT_SEPARATOR ) {
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData);
- if ( pimi != NULL )
- if ( pimi->mi.position <= mi->position )
+ for (int i=GetMenuItemCount(hMenu)-1; i >= 0; i--) {
+ GetMenuItemInfo(hMenu, i, TRUE, &mii);
+ if (mii.fType != MFT_SEPARATOR) {
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
+ if (pimi != NULL)
+ if (pimi->mi.position <= mi->position)
return i+1;
} }
@@ -797,7 +797,7 @@ static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, PMO_IntMenuItem& p) mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_DATA | MIIM_TYPE;
GetMenuItemInfo(hMenu, uItem, TRUE, &mii);
- p = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
+ p = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
return mii.fType;
}
@@ -807,30 +807,30 @@ static void InsertSeparator(HMENU hMenu, int uItem) mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_TYPE;
mii.fType = MFT_SEPARATOR;
- InsertMenuItem( hMenu, uItem, TRUE, &mii );
+ InsertMenuItem(hMenu, uItem, TRUE, &mii);
}
static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii)
{
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )lpmii->dwItemData ), p;
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), p;
if (pimi == NULL)
return;
//check for separator before
if (uItem) {
- UINT fType = GetMenuItemTypeData( hMenu, uItem-1, p);
+ UINT fType = GetMenuItemTypeData(hMenu, uItem-1, p);
if (p != NULL && fType != MFT_SEPARATOR) {
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) {
//but might be supposed to be after the next one instead
- if ( uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) != MFT_SEPARATOR)
+ if (uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) != MFT_SEPARATOR)
InsertSeparator(hMenu, uItem);
uItem++;
} } }
//check for separator after
- if ( uItem < GetMenuItemCount( hMenu )) {
- UINT fType = GetMenuItemTypeData( hMenu, uItem, p);
+ if (uItem < GetMenuItemCount(hMenu)) {
+ UINT fType = GetMenuItemTypeData(hMenu, uItem, p);
if (p != NULL && fType != MFT_SEPARATOR)
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL))
InsertSeparator(hMenu, uItem);
@@ -840,8 +840,8 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l MENUITEMINFO mii = *lpmii;
int count = GetMenuItemCount(hMenu);
- if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL ) {
- if ( !( mii.fMask & MIIM_FTYPE ))
+ if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) {
+ if ( !(mii.fMask & MIIM_FTYPE))
mii.fType = 0;
mii.fMask |= MIIM_FTYPE;
mii.fType |= MFT_MENUBARBREAK;
@@ -849,7 +849,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l mii.dwTypeData = GetMenuItemText(pimi);
- InsertMenuItem( hMenu, uItem, TRUE, &mii);
+ InsertMenuItem(hMenu, uItem, TRUE, &mii);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -859,24 +859,24 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- ListParam *lp = ( ListParam* )lParam;
- int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle );
- if ( pimoidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ ListParam *lp = (ListParam*)lParam;
+ int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle);
+ if (pimoidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
- #if defined( _DEBUG )
- // DumpMenuItem( g_menus[pimoidx]->m_items.first );
+ #if defined(_DEBUG)
+ // DumpMenuItem(g_menus[pimoidx]->m_items.first);
#endif
- INT_PTR res = (INT_PTR)BuildRecursiveMenu(( HMENU )wParam, g_menus[pimoidx]->m_items.first, ( ListParam* )lParam );
- LeaveCriticalSection( &csMenuHook );
+ INT_PTR res = (INT_PTR)BuildRecursiveMenu((HMENU)wParam, g_menus[pimoidx]->m_items.first, (ListParam*)lParam);
+ LeaveCriticalSection(&csMenuHook);
return res;
}
@@ -884,53 +884,53 @@ INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) #define PUTPOSITIONSONMENU
#endif
-void GetMenuItemName( PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize )
+void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize)
{
- if ( pMenuItem->UniqName )
- mir_snprintf( pszDest, cbDestSize, "{%s}", pMenuItem->UniqName );
+ if (pMenuItem->UniqName)
+ mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->UniqName);
else if (pMenuItem->mi.flags & CMIF_UNICODE) {
- char* name = mir_t2a( pMenuItem->mi.ptszName );
- mir_snprintf( pszDest, cbDestSize, "{%s}", name );
+ char* name = mir_t2a(pMenuItem->mi.ptszName);
+ mir_snprintf(pszDest, cbDestSize, "{%s}", name);
mir_free(name);
}
else
- mir_snprintf( pszDest, cbDestSize, "{%s}", pMenuItem->mi.pszName );
+ mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->mi.pszName);
}
HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *param)
{
- if ( param == NULL || pRootMenu == NULL )
+ if (param == NULL || pRootMenu == NULL)
return NULL;
TIntMenuObject* pmo = pRootMenu->parent;
- int rootlevel = ( param->rootlevel == -1 ) ? 0 : param->rootlevel;
+ int rootlevel = (param->rootlevel == -1) ? 0 : param->rootlevel;
ListParam localparam = *param;
- while ( rootlevel == 0 && GetMenuItemCount( hMenu ) > 0 )
- DeleteMenu( hMenu, 0, MF_BYPOSITION );
+ while (rootlevel == 0 && GetMenuItemCount(hMenu) > 0)
+ DeleteMenu(hMenu, 0, MF_BYPOSITION);
- for ( PMO_IntMenuItem pmi = pRootMenu; pmi != NULL; pmi = pmi->next ) {
+ for (PMO_IntMenuItem pmi = pRootMenu; pmi != NULL; pmi = pmi->next) {
PMO_MenuItem mi = &pmi->mi;
- if ( mi->cbSize != sizeof( TMO_MenuItem ))
+ if (mi->cbSize != sizeof(TMO_MenuItem))
continue;
- if ( mi->flags & CMIF_HIDDEN )
+ if (mi->flags & CMIF_HIDDEN)
continue;
- if ( pmo->CheckService != NULL ) {
+ if (pmo->CheckService != NULL) {
TCheckProcParam CheckParam;
CheckParam.lParam = param->lParam;
CheckParam.wParam = param->wParam;
CheckParam.MenuItemOwnerData = mi->ownerdata;
CheckParam.MenuItemHandle = pmi;
- if ( CallService( pmo->CheckService, ( WPARAM )&CheckParam, 0 ) == FALSE )
+ if (CallService(pmo->CheckService, (WPARAM)&CheckParam, 0) == FALSE)
continue;
}
/**************************************/
- if ( rootlevel == 0 && mi->root == NULL && pmo->m_bUseUserDefinedItems ) {
+ if (rootlevel == 0 && mi->root == NULL && pmo->m_bUseUserDefinedItems) {
char DBString[256];
DBVARIANT dbv = { 0 };
int pos;
@@ -938,33 +938,33 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pmo->Name);
char menuItemName[256];
- GetMenuItemName( pmi, menuItemName, sizeof( menuItemName ));
+ GetMenuItemName(pmi, menuItemName, sizeof(menuItemName));
// check if it visible
- mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
- if ( DBGetContactSettingByte( NULL, MenuNameItems, DBString, -1 ) == -1 )
- DBWriteContactSettingByte( NULL, MenuNameItems, DBString, 1 );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ if (DBGetContactSettingByte(NULL, MenuNameItems, DBString, -1) == -1)
+ DBWriteContactSettingByte(NULL, MenuNameItems, DBString, 1);
pmi->OverrideShow = TRUE;
- if ( !DBGetContactSettingByte( NULL, MenuNameItems, DBString, 1 )) {
+ if ( !DBGetContactSettingByte(NULL, MenuNameItems, DBString, 1)) {
pmi->OverrideShow = FALSE;
continue; // find out what value to return if not getting added
}
// mi.pszName
- mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
- if ( !DBGetContactSettingTString( NULL, MenuNameItems, DBString, &dbv )) {
- if ( _tcslen( dbv.ptszVal ) > 0 ) {
- if ( pmi->CustomName ) mir_free( pmi->CustomName );
- pmi->CustomName = mir_tstrdup( dbv.ptszVal );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ if ( !DBGetContactSettingTString(NULL, MenuNameItems, DBString, &dbv)) {
+ if (_tcslen(dbv.ptszVal) > 0) {
+ if (pmi->CustomName) mir_free(pmi->CustomName);
+ pmi->CustomName = mir_tstrdup(dbv.ptszVal);
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
- mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
- if (( pos = DBGetContactSettingDword( NULL, MenuNameItems, DBString, -1 )) == -1 ) {
- DBWriteContactSettingDword( NULL, MenuNameItems, DBString, mi->position );
- if ( pmi->submenu.first )
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ if ((pos = DBGetContactSettingDword(NULL, MenuNameItems, DBString, -1)) == -1) {
+ DBWriteContactSettingDword(NULL, MenuNameItems, DBString, mi->position);
+ if (pmi->submenu.first)
mi->position = 0;
}
else mi->position = pos;
@@ -972,13 +972,13 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para /**************************************/
- if ( rootlevel != (int)pmi->mi.root )
+ if (rootlevel != (int)pmi->mi.root)
continue;
MENUITEMINFO mii = { 0 };
- mii.dwItemData = ( LPARAM )pmi;
+ mii.dwItemData = (LPARAM)pmi;
- int i = WhereToPlace( hMenu, mi );
+ int i = WhereToPlace(hMenu, mi);
if ( !IsWinVer98Plus()) {
mii.cbSize = MENUITEMINFO_V4_SIZE;
@@ -986,9 +986,9 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para mii.fType = MFT_STRING;
}
else {
- mii.cbSize = sizeof( mii );
+ mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_ID | MIIM_STRING;
- if ( pmi->iconId != -1 ) {
+ if (pmi->iconId != -1) {
mii.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && isThemeActive()) {
if (pmi->hBmp == NULL)
@@ -1000,46 +1000,46 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para }
mii.fMask |= MIIM_STATE;
- mii.fState = (( pmi->mi.flags & CMIF_GRAYED ) ? MFS_GRAYED : MFS_ENABLED );
- mii.fState |= (( pmi->mi.flags & CMIF_CHECKED) ? MFS_CHECKED : MFS_UNCHECKED );
- if ( pmi->mi.flags & CMIF_DEFAULT )
+ mii.fState = ((pmi->mi.flags & CMIF_GRAYED) ? MFS_GRAYED : MFS_ENABLED);
+ mii.fState |= ((pmi->mi.flags & CMIF_CHECKED) ? MFS_CHECKED : MFS_UNCHECKED);
+ if (pmi->mi.flags & CMIF_DEFAULT)
mii.fState |= MFS_DEFAULT;
- mii.dwTypeData = ( pmi->CustomName ) ? pmi->CustomName : mi->ptszName;
+ mii.dwTypeData = (pmi->CustomName) ? pmi->CustomName : mi->ptszName;
// it's a submenu
- if ( pmi->submenu.first ) {
+ if (pmi->submenu.first) {
mii.fMask |= MIIM_SUBMENU;
mii.hSubMenu = CreatePopupMenu();
#ifdef PUTPOSITIONSONMENU
- if ( GetKeyState(VK_CONTROL) & 0x8000) {
+ if (GetKeyState(VK_CONTROL) & 0x8000) {
TCHAR str[256];
- mir_sntprintf( str, SIZEOF(str), _T( "%s (%d, id %x)" ), mi->pszName, mi->position, mii.dwItemData );
+ mir_sntprintf(str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
InsertMenuItemWithSeparators(hMenu, i, &mii);
- localparam.rootlevel = LPARAM( pmi );
+ localparam.rootlevel = LPARAM(pmi);
BuildRecursiveMenu(mii.hSubMenu, pmi->submenu.first, &localparam);
}
else {
mii.wID = pmi->iCommand;
#ifdef PUTPOSITIONSONMENU
- if ( GetKeyState(VK_CONTROL) & 0x8000) {
+ if (GetKeyState(VK_CONTROL) & 0x8000) {
TCHAR str[256];
- mir_sntprintf( str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData );
+ mir_sntprintf(str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
- if ( pmo->onAddService != NULL )
- if ( CallService( pmo->onAddService, ( WPARAM )&mii, ( LPARAM )pmi ) == FALSE )
+ if (pmo->onAddService != NULL)
+ if (CallService(pmo->onAddService, (WPARAM)&mii, (LPARAM)pmi) == FALSE)
continue;
- InsertMenuItemWithSeparators( hMenu, i, &mii );
+ InsertMenuItemWithSeparators(hMenu, i, &mii);
} }
return hMenu;
@@ -1048,12 +1048,12 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para /////////////////////////////////////////////////////////////////////////////////////////
// iconlib in menu
-static int MO_ReloadIcon( PMO_IntMenuItem pmi, void* )
+static int MO_ReloadIcon(PMO_IntMenuItem pmi, void*)
{
- if ( pmi->hIcolibItem ) {
- HICON newIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
- if ( newIcon )
- ImageList_ReplaceIcon( pmi->parent->m_hMenuIcons, pmi->iconId, newIcon );
+ if (pmi->hIcolibItem) {
+ HICON newIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
+ if (newIcon)
+ ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, newIcon);
IconLib_ReleaseIcon(newIcon, 0);
}
@@ -1063,12 +1063,12 @@ static int MO_ReloadIcon( PMO_IntMenuItem pmi, void* ) int OnIconLibChanges(WPARAM, LPARAM)
{
- EnterCriticalSection( &csMenuHook );
- for ( int mo=0; mo < g_menus.getCount(); mo++ )
- if ((int)hStatusMenuObject != g_menus[mo]->id ) //skip status menu
- MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_ReloadIcon, 0 );
+ EnterCriticalSection(&csMenuHook);
+ for (int mo=0; mo < g_menus.getCount(); mo++)
+ if ((int)hStatusMenuObject != g_menus[mo]->id) //skip status menu
+ MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_ReloadIcon, 0);
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
cli.pfnReloadProtoMenus();
return 0;
@@ -1077,28 +1077,28 @@ int OnIconLibChanges(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
//
-static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* )
+static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
{
char *uname, *descr;
uname = pmi->UniqName;
- if ( uname == NULL )
+ if (uname == NULL)
uname = mir_u2a(pmi->CustomName);
descr = mir_u2a(pmi->mi.ptszName);
- if ( !uname && !descr )
+ if ( !uname && !descr)
return FALSE;
- if ( !pmi->hIcolibItem ) {
- HICON hIcon = ImageList_GetIcon( pmi->parent->m_hMenuIcons, pmi->iconId, 0 );
- char* buf = NEWSTR_ALLOCA( descr );
+ if ( !pmi->hIcolibItem) {
+ HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
+ char* buf = NEWSTR_ALLOCA(descr);
char sectionName[256], iconame[256];
- mir_snprintf( sectionName, sizeof(sectionName), "Menu Icons/%s", pmi->parent->Name );
+ mir_snprintf(sectionName, sizeof(sectionName), "Menu Icons/%s", pmi->parent->Name);
// remove '&'
char* start = buf;
- while ( start ) {
- if (( start = strchr( start, '&' )) == NULL )
+ while (start) {
+ if ((start = strchr(start, '&')) == NULL)
break;
memmove(start, start+1, strlen(start+1)+1);
@@ -1117,18 +1117,18 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) sid.pszDefaultFile = NULL;
sid.pszDescription = buf;
sid.hDefaultIcon = hIcon;
- pmi->hIcolibItem = ( HANDLE )CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ pmi->hIcolibItem = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
- Safe_DestroyIcon( hIcon );
- if ( hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)iconame )) {
- ImageList_ReplaceIcon( pmi->parent->m_hMenuIcons, pmi->iconId, hIcon );
- IconLib_ReleaseIcon( hIcon, 0 );
+ Safe_DestroyIcon(hIcon);
+ if (hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconame)) {
+ ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, hIcon);
+ IconLib_ReleaseIcon(hIcon, 0);
} }
- if ( !pmi->UniqName )
- mir_free( uname );
- mir_free( descr );
+ if ( !pmi->UniqName)
+ mir_free(uname);
+ mir_free(descr);
return FALSE;
@@ -1137,25 +1137,25 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) int RegisterAllIconsInIconLib()
{
//register all icons
- for ( int mo=0; mo < g_menus.getCount(); mo++ ) {
- if ((int)hStatusMenuObject == g_menus[mo]->id ) //skip status menu
+ for (int mo=0; mo < g_menus.getCount(); mo++) {
+ if ((int)hStatusMenuObject == g_menus[mo]->id) //skip status menu
continue;
- MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_RegisterIcon, 0 );
+ MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_RegisterIcon, 0);
}
return 0;
}
-int TryProcessDoubleClick( HANDLE hContact )
+int TryProcessDoubleClick(HANDLE hContact)
{
- int iMenuID = GetMenuObjbyId((int)hContactMenuObject );
- if ( iMenuID != -1 ) {
+ int iMenuID = GetMenuObjbyId((int)hContactMenuObject);
+ if (iMenuID != -1) {
NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0);
- PMO_IntMenuItem pimi = ( PMO_IntMenuItem )MO_GetDefaultMenuItem(( WPARAM )g_menus[ iMenuID ]->m_items.first, 0 );
- if ( pimi != NULL ) {
- MO_ProcessCommand( pimi, ( LPARAM )hContact );
+ PMO_IntMenuItem pimi = (PMO_IntMenuItem)MO_GetDefaultMenuItem((WPARAM)g_menus[ iMenuID ]->m_items.first, 0);
+ if (pimi != NULL) {
+ MO_ProcessCommand(pimi, (LPARAM)hContact);
return 0;
} }
@@ -1167,77 +1167,77 @@ int TryProcessDoubleClick( HANDLE hContact ) int posttimerid;
-static VOID CALLBACK PostRegisterIcons( HWND, UINT, UINT_PTR, DWORD )
+static VOID CALLBACK PostRegisterIcons(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer( 0, posttimerid );
+ KillTimer(0, posttimerid);
RegisterAllIconsInIconLib();
}
static int OnModulesLoaded(WPARAM, LPARAM)
{
- posttimerid = SetTimer(( HWND )NULL, 0, 5, ( TIMERPROC )PostRegisterIcons );
+ posttimerid = SetTimer((HWND)NULL, 0, 5, (TIMERPROC)PostRegisterIcons);
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibChanges);
return 0;
}
-static INT_PTR SRVMO_SetOptionsMenuObject( WPARAM, LPARAM lParam)
+static INT_PTR SRVMO_SetOptionsMenuObject(WPARAM, LPARAM lParam)
{
- lpOptParam lpop = ( lpOptParam )lParam;
- if ( lpop == NULL )
+ lpOptParam lpop = (lpOptParam)lParam;
+ if (lpop == NULL)
return 0;
- return MO_SetOptionsMenuObject( lpop->Handle, lpop->Setting, lpop->Value );
+ return MO_SetOptionsMenuObject(lpop->Handle, lpop->Setting, lpop->Value);
}
-static INT_PTR SRVMO_SetOptionsMenuItem( WPARAM, LPARAM lParam)
+static INT_PTR SRVMO_SetOptionsMenuItem(WPARAM, LPARAM lParam)
{
- lpOptParam lpop = ( lpOptParam )lParam;
- if ( lpop == NULL )
+ lpOptParam lpop = (lpOptParam)lParam;
+ if (lpop == NULL)
return 0;
- return MO_SetOptionsMenuItem(( PMO_IntMenuItem )lpop->Handle, lpop->Setting, lpop->Value );
+ return MO_SetOptionsMenuItem((PMO_IntMenuItem)lpop->Handle, lpop->Setting, lpop->Value);
}
int InitGenMenu()
{
- InitializeCriticalSection( &csMenuHook );
- CreateServiceFunction( MO_BUILDMENU, MO_BuildMenu );
-
- CreateServiceFunction( MO_PROCESSCOMMAND, ( MIRANDASERVICE )MO_ProcessCommand );
- CreateServiceFunction( MO_CREATENEWMENUOBJECT, MO_CreateNewMenuObject );
- CreateServiceFunction( MO_REMOVEMENUITEM, MO_RemoveMenuItem );
- CreateServiceFunction( MO_ADDNEWMENUITEM, ( MIRANDASERVICE )MO_AddNewMenuItem );
- CreateServiceFunction( MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData );
- CreateServiceFunction( MO_MODIFYMENUITEM, ( MIRANDASERVICE )MO_ModifyMenuItem );
- CreateServiceFunction( MO_GETMENUITEM, MO_GetMenuItem );
- CreateServiceFunction( MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem );
- CreateServiceFunction( MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent );
- CreateServiceFunction( MO_PROCESSHOTKEYS, ( MIRANDASERVICE )MO_ProcessHotKeys );
- CreateServiceFunction( MO_REMOVEMENUOBJECT, MO_RemoveMenuObject );
- CreateServiceFunction( MO_GETPROTOROOTMENU, MO_GetProtoRootMenu );
-
- CreateServiceFunction( MO_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject );
- CreateServiceFunction( MO_SETOPTIONSMENUITEM, SRVMO_SetOptionsMenuItem );
+ InitializeCriticalSection(&csMenuHook);
+ CreateServiceFunction(MO_BUILDMENU, MO_BuildMenu);
+
+ CreateServiceFunction(MO_PROCESSCOMMAND, (MIRANDASERVICE)MO_ProcessCommand);
+ CreateServiceFunction(MO_CREATENEWMENUOBJECT, MO_CreateNewMenuObject);
+ CreateServiceFunction(MO_REMOVEMENUITEM, MO_RemoveMenuItem);
+ CreateServiceFunction(MO_ADDNEWMENUITEM, (MIRANDASERVICE)MO_AddNewMenuItem);
+ CreateServiceFunction(MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData);
+ CreateServiceFunction(MO_MODIFYMENUITEM, (MIRANDASERVICE)MO_ModifyMenuItem);
+ CreateServiceFunction(MO_GETMENUITEM, MO_GetMenuItem);
+ CreateServiceFunction(MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem);
+ CreateServiceFunction(MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent);
+ CreateServiceFunction(MO_PROCESSHOTKEYS, (MIRANDASERVICE)MO_ProcessHotKeys);
+ CreateServiceFunction(MO_REMOVEMENUOBJECT, MO_RemoveMenuObject);
+ CreateServiceFunction(MO_GETPROTOROOTMENU, MO_GetProtoRootMenu);
+
+ CreateServiceFunction(MO_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject);
+ CreateServiceFunction(MO_SETOPTIONSMENUITEM, SRVMO_SetOptionsMenuItem);
bIconsDisabled = DBGetContactSettingByte(NULL, "CList", "DisableMenuIcons", 0) != 0;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
bIsGenMenuInited = true;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
- HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoaded );
- HookEvent( ME_OPT_INITIALISE, GenMenuOptInit );
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, GenMenuOptInit);
return 0;
}
int UnitGenMenu()
{
- if ( bIsGenMenuInited ) {
- EnterCriticalSection( &csMenuHook );
+ if (bIsGenMenuInited) {
+ EnterCriticalSection(&csMenuHook);
MO_RemoveAllObjects();
bIsGenMenuInited=false;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
DeleteCriticalSection(&csMenuHook);
}
return 0;
@@ -1251,25 +1251,25 @@ TIntMenuObject::TIntMenuObject() TIntMenuObject::~TIntMenuObject()
{
- MO_RecursiveWalkMenu( m_items.first, FreeMenuItem, NULL );
+ MO_RecursiveWalkMenu(m_items.first, FreeMenuItem, NULL);
- FreeAndNil(( void** )&FreeService );
- FreeAndNil(( void** )&onAddService );
- FreeAndNil(( void** )&CheckService );
- FreeAndNil(( void** )&ExecService );
- FreeAndNil(( void** )&Name );
+ FreeAndNil((void**)&FreeService);
+ FreeAndNil((void**)&onAddService);
+ FreeAndNil((void**)&CheckService);
+ FreeAndNil((void**)&ExecService);
+ FreeAndNil((void**)&Name);
ImageList_Destroy(m_hMenuIcons);
}
-void TIntMenuObject::freeItem( TMO_IntMenuItem* p )
+void TIntMenuObject::freeItem(TMO_IntMenuItem* p)
{
- if ( FreeService )
- CallService( FreeService, ( WPARAM )p, ( LPARAM )p->mi.ownerdata );
-
- FreeAndNil(( void** )&p->mi.pszName );
- FreeAndNil(( void** )&p->UniqName );
- FreeAndNil(( void** )&p->CustomName );
- if ( p->hBmp ) DeleteObject( p->hBmp );
- mir_free( p );
+ if (FreeService)
+ CallService(FreeService, (WPARAM)p, (LPARAM)p->mi.ownerdata);
+
+ FreeAndNil((void**)&p->mi.pszName);
+ FreeAndNil((void**)&p->UniqName);
+ FreeAndNil((void**)&p->CustomName);
+ if (p->hBmp) DeleteObject(p->hBmp);
+ mir_free(p);
}
diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index b67ca92e39..aa924656e0 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -62,11 +62,11 @@ struct TIntMenuObject TIntMenuObject();
~TIntMenuObject();
- __inline void* operator new( size_t size )
- { return mir_calloc( size );
+ __inline void* operator new(size_t size)
+ { return mir_calloc(size);
}
- __inline void operator delete( void* p )
- { mir_free( p );
+ __inline void operator delete(void* p)
+ { mir_free(p);
}
char* Name;
@@ -95,7 +95,7 @@ struct TIntMenuObject HIMAGELIST m_hMenuIcons;
BOOL m_bUseUserDefinedItems;
- void freeItem( TMO_IntMenuItem* );
+ void freeItem(TMO_IntMenuItem*);
};
extern LIST<TIntMenuObject> g_menus;
@@ -104,35 +104,35 @@ extern LIST<TIntMenuObject> g_menus; //internal usage
HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem, ListParam *param);
-void GetMenuItemName( PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize );
+void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize);
-PMO_IntMenuItem MO_GetIntMenuItem( HGENMENU );
+PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU);
-PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi );
-PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi );
+PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi);
+PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi);
-int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis );
-int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis );
-int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmiparam );
-int MO_ProcessCommand( PMO_IntMenuItem pimi, LPARAM lParam );
-INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey );
-int MO_SetOptionsMenuItem( PMO_IntMenuItem menuobjecthandle, int setting, INT_PTR value );
-int MO_SetOptionsMenuObject( HANDLE menuobjecthandle, int setting, INT_PTR value );
+int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis);
+int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis);
+int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmiparam);
+int MO_ProcessCommand(PMO_IntMenuItem pimi, LPARAM lParam);
+INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey);
+int MO_SetOptionsMenuItem(PMO_IntMenuItem menuobjecthandle, int setting, INT_PTR value);
+int MO_SetOptionsMenuObject(HANDLE menuobjecthandle, int setting, INT_PTR value);
INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam);
int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam);
// function returns TRUE if the walk should be immediately stopped
-typedef int ( *pfnWalkFunc )( PMO_IntMenuItem, void* );
+typedef int (*pfnWalkFunc)(PMO_IntMenuItem, void*);
// returns the item, on which pfnWalkFunc returned TRUE
-PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem, pfnWalkFunc, void* );
+PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem, pfnWalkFunc, void*);
//general stuff
int InitGenMenu();
int UnitGenMenu();
-int FindRoot( PMO_IntMenuItem pimi, void* param );
+int FindRoot(PMO_IntMenuItem pimi, void* param);
TMO_IntMenuItem * GetMenuItemByGlobalID(int globalMenuID);
BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index ed58a53145..e16fd49d18 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern bool bIconsDisabled;
extern int DefaultImageListColorDepth;
long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD);
-void RebuildProtoMenus( int );
+void RebuildProtoMenus(int);
struct OrderData
{
@@ -57,7 +57,7 @@ static BOOL GetCurrentMenuObjectID(HWND hwndDlg, int* result) TVITEM tvi;
HWND hTree = GetDlgItem(hwndDlg, IDC_MENUOBJECTS);
HTREEITEM hti = TreeView_GetSelection(hTree);
- if ( hti == NULL )
+ if (hti == NULL)
return FALSE;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -77,51 +77,51 @@ static int SaveTree(HWND hwndDlg) int MenuObjectId, runtimepos;
TIntMenuObject* pimo;
MenuItemOptData* iod;
- HWND hTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
+ HWND hTree = GetDlgItem(hwndDlg, IDC_MENUITEMS);
- if ( !GetCurrentMenuObjectID( hwndDlg, &MenuObjectId ))
+ if ( !GetCurrentMenuObjectID(hwndDlg, &MenuObjectId))
return 0;
- tvi.hItem = TreeView_GetRoot( hTree );
+ tvi.hItem = TreeView_GetRoot(hTree);
tvi.cchTextMax = 99;
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE;
tvi.pszText = idstr;
count = 0;
- menupos = GetMenuObjbyId( MenuObjectId );
- if ( menupos == -1 )
+ menupos = GetMenuObjbyId(MenuObjectId);
+ if (menupos == -1)
return -1;
pimo = g_menus[menupos];
- mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
runtimepos = 100;
- while ( tvi.hItem != NULL ) {
- TreeView_GetItem( hTree, &tvi );
- iod = ( MenuItemOptData* )tvi.lParam;
- if ( iod->pimi ) {
- GetMenuItemName( iod->pimi, menuItemName, sizeof( menuItemName ));
+ while (tvi.hItem != NULL) {
+ TreeView_GetItem(hTree, &tvi);
+ iod = (MenuItemOptData*)tvi.lParam;
+ if (iod->pimi) {
+ GetMenuItemName(iod->pimi, menuItemName, sizeof(menuItemName));
- mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
- DBWriteContactSettingByte( NULL, MenuNameItems, DBString, iod->show );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ DBWriteContactSettingByte(NULL, MenuNameItems, DBString, iod->show);
- mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
- DBWriteContactSettingDword( NULL, MenuNameItems, DBString, runtimepos );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ DBWriteContactSettingDword(NULL, MenuNameItems, DBString, runtimepos);
- mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
- if ( lstrcmp( iod->name, iod->defname ) != 0 )
- DBWriteContactSettingTString( NULL, MenuNameItems, DBString, iod->name );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ if (lstrcmp(iod->name, iod->defname) != 0)
+ DBWriteContactSettingTString(NULL, MenuNameItems, DBString, iod->name);
else
- DBDeleteContactSetting( NULL, MenuNameItems, DBString );
+ DBDeleteContactSetting(NULL, MenuNameItems, DBString);
runtimepos += 100;
}
- if ( iod->name && !_tcscmp( iod->name, STR_SEPARATOR) && iod->show )
+ if (iod->name && !_tcscmp(iod->name, STR_SEPARATOR) && iod->show)
runtimepos += SEPARATORPOSITIONINTERVAL;
- tvi.hItem = TreeView_GetNextSibling( hTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
count++;
}
return 1;
@@ -136,19 +136,19 @@ static int BuildMenuObjectsTree(HWND hwndDlg) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_DeleteAllItems( hTree );
- if ( g_menus.getCount() == 0 )
+ TreeView_DeleteAllItems(hTree);
+ if (g_menus.getCount() == 0)
return FALSE;
- for ( i=0; i < g_menus.getCount(); i++ ) {
- if ( g_menus[i]->id == (int)hStatusMenuObject || !g_menus[i]->m_bUseUserDefinedItems )
+ for (i=0; i < g_menus.getCount(); i++) {
+ if (g_menus[i]->id == (int)hStatusMenuObject || !g_menus[i]->m_bUseUserDefinedItems)
continue;
- tvis.item.lParam = ( LPARAM )g_menus[i]->id;
- tvis.item.pszText = LangPackPcharToTchar( g_menus[i]->Name );
+ tvis.item.lParam = (LPARAM)g_menus[i]->id;
+ tvis.item.pszText = LangPackPcharToTchar(g_menus[i]->Name);
tvis.item.iImage = tvis.item.iSelectedImage = TRUE;
- TreeView_InsertItem( hTree, &tvis );
- mir_free( tvis.item.pszText );
+ TreeView_InsertItem(hTree, &tvis);
+ mir_free(tvis.item.pszText);
}
return 1;
}
@@ -173,21 +173,21 @@ static int InsertSeparator(HWND hwndDlg) TVINSERTSTRUCT tvis = {0};
TVITEM tvi = {0};
HTREEITEM hti = {0};
- HWND hMenuTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
+ HWND hMenuTree = GetDlgItem(hwndDlg, IDC_MENUITEMS);
- hti = TreeView_GetSelection( hMenuTree );
- if ( hti == NULL )
+ hti = TreeView_GetSelection(hMenuTree);
+ if (hti == NULL)
return 1;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti;
- if ( TreeView_GetItem( hMenuTree, &tvi) == FALSE )
+ if (TreeView_GetItem(hMenuTree, &tvi) == FALSE)
return 1;
- PD = ( MenuItemOptData* )mir_alloc( sizeof( MenuItemOptData ));
- ZeroMemory( PD, sizeof( MenuItemOptData ));
+ PD = (MenuItemOptData*)mir_alloc(sizeof(MenuItemOptData));
+ ZeroMemory(PD, sizeof(MenuItemOptData));
PD->id = -1;
- PD->name = mir_tstrdup( STR_SEPARATOR );
+ PD->name = mir_tstrdup(STR_SEPARATOR);
PD->show = TRUE;
PD->pos = ((MenuItemOptData *)tvi.lParam)->pos-1;
@@ -197,23 +197,23 @@ static int InsertSeparator(HWND hwndDlg) tvis.hParent = NULL;
tvis.hInsertAfter = hti;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_InsertItem( hMenuTree, &tvis );
+ TreeView_InsertItem(hMenuTree, &tvis);
return 1;
}
-static void FreeTreeData( HWND hwndDlg )
+static void FreeTreeData(HWND hwndDlg)
{
HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_MENUITEMS));
- while ( hItem != NULL ) {
+ while (hItem != NULL) {
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- TreeView_GetItem( GetDlgItem( hwndDlg, IDC_MENUITEMS ), &tvi );
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
{ MenuItemOptData* O = (MenuItemOptData *)tvi.lParam;
- if ( O->name ) mir_free( O->name );
- if ( O->defname ) mir_free( O->defname );
- if ( O->uniqname ) mir_free( O->uniqname );
- mir_free( O );
+ if (O->name) mir_free(O->name);
+ if (O->defname) mir_free(O->defname);
+ if (O->uniqname) mir_free(O->uniqname);
+ mir_free(O);
}
tvi.lParam = 0;
@@ -227,69 +227,69 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) char menuItemName[256], MenuNameItems[256];
char buf[256];
- FreeTreeData( hwndDlg );
+ FreeTreeData(hwndDlg);
TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_MENUITEMS));
- int menupos = GetMenuObjbyId( MenuObjectId );
- if ( menupos == -1 )
+ int menupos = GetMenuObjbyId(MenuObjectId);
+ if (menupos == -1)
return FALSE;
TIntMenuObject* pimo = g_menus[menupos];
- if ( pimo->m_items.first == NULL )
+ if (pimo->m_items.first == NULL)
return FALSE;
- mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name );
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
int count = 0;
{
- for ( PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next )
- if ( p->mi.root == ( HGENMENU )-1 || p->mi.root == NULL )
+ for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next)
+ if (p->mi.root == (HGENMENU)-1 || p->mi.root == NULL)
count++;
}
- lpMenuItemOptData *PDar = ( lpMenuItemOptData* )mir_alloc( sizeof( lpMenuItemOptData )*count );
+ lpMenuItemOptData *PDar = (lpMenuItemOptData*)mir_alloc(sizeof(lpMenuItemOptData)*count);
count = 0;
{
- for ( PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next ) {
- if ( p->mi.root != ( HGENMENU )-1 && p->mi.root != NULL )
+ for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next) {
+ if (p->mi.root != (HGENMENU)-1 && p->mi.root != NULL)
continue;
- MenuItemOptData *PD = ( MenuItemOptData* )mir_calloc( sizeof( MenuItemOptData ));
- GetMenuItemName( p, menuItemName, sizeof( menuItemName ));
+ MenuItemOptData *PD = (MenuItemOptData*)mir_calloc(sizeof(MenuItemOptData));
+ GetMenuItemName(p, menuItemName, sizeof(menuItemName));
{
DBVARIANT dbv;
mir_snprintf(buf, SIZEOF(buf), "%s_name", menuItemName);
- if ( !DBGetContactSettingTString( NULL, MenuNameItems, buf, &dbv )) {
- PD->name = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if ( !DBGetContactSettingTString(NULL, MenuNameItems, buf, &dbv)) {
+ PD->name = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- else PD->name = mir_tstrdup( GetMenuItemText(p));
+ else PD->name = mir_tstrdup(GetMenuItemText(p));
}
PD->pimi = p;
- PD->defname = mir_tstrdup( GetMenuItemText(p));
+ PD->defname = mir_tstrdup(GetMenuItemText(p));
- mir_snprintf( buf, SIZEOF(buf), "%s_visible", menuItemName );
- PD->show = DBGetContactSettingByte( NULL, MenuNameItems, buf, 1 );
+ mir_snprintf(buf, SIZEOF(buf), "%s_visible", menuItemName);
+ PD->show = DBGetContactSettingByte(NULL, MenuNameItems, buf, 1);
- if ( bReread ) {
- mir_snprintf( buf, SIZEOF(buf), "%s_pos", menuItemName );
- PD->pos = DBGetContactSettingDword( NULL, MenuNameItems, buf, 1 );
+ if (bReread) {
+ mir_snprintf(buf, SIZEOF(buf), "%s_pos", menuItemName);
+ PD->pos = DBGetContactSettingDword(NULL, MenuNameItems, buf, 1);
}
- else PD->pos = ( PD->pimi ) ? PD->pimi->originalPosition : 0;
+ else PD->pos = (PD->pimi) ? PD->pimi->originalPosition : 0;
PD->id = p->iCommand;
- if ( p->UniqName )
- PD->uniqname = mir_strdup( p->UniqName );
+ if (p->UniqName)
+ PD->uniqname = mir_strdup(p->UniqName);
PDar[ count ] = PD;
count++;
} }
- qsort( PDar, count, sizeof( lpMenuItemOptData ), sortfunc );
+ qsort(PDar, count, sizeof(lpMenuItemOptData), sortfunc);
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, FALSE, 0);
int lastpos = 0;
@@ -299,26 +299,26 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- for ( int i=0; i < count; i++ ) {
- if ( PDar[i]->pos - lastpos >= SEPARATORPOSITIONINTERVAL ) {
- MenuItemOptData *PD = ( MenuItemOptData* )mir_calloc( sizeof( MenuItemOptData ));
+ for (int i=0; i < count; i++) {
+ if (PDar[i]->pos - lastpos >= SEPARATORPOSITIONINTERVAL) {
+ MenuItemOptData *PD = (MenuItemOptData*)mir_calloc(sizeof(MenuItemOptData));
PD->id = -1;
- PD->name = mir_tstrdup( STR_SEPARATOR );
+ PD->name = mir_tstrdup(STR_SEPARATOR);
PD->pos = PDar[i]->pos - 1;
PD->show = TRUE;
- tvis.item.lParam = ( LPARAM )PD;
+ tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = PD->name;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis);
}
- tvis.item.lParam = ( LPARAM )PDar[i];
+ tvis.item.lParam = (LPARAM)PDar[i];
tvis.item.pszText = PDar[i]->name;
tvis.item.iImage = tvis.item.iSelectedImage = PDar[i]->show;
HTREEITEM hti = (HTREEITEM)SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis);
- if ( first ) {
+ if (first) {
TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti);
first=FALSE;
}
@@ -326,26 +326,26 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) lastpos = PDar[i]->pos;
}
- SendDlgItemMessage( hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0 );
- mir_free( PDar );
- ShowWindow( GetDlgItem( hwndDlg, IDC_NOTSUPPORTWARNING ), ( pimo->m_bUseUserDefinedItems ) ? SW_HIDE : SW_SHOW );
- EnableWindow( GetDlgItem( hwndDlg, IDC_MENUITEMS ), pimo->m_bUseUserDefinedItems );
- EnableWindow( GetDlgItem( hwndDlg, IDC_INSERTSEPARATOR ), pimo->m_bUseUserDefinedItems );
+ SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0);
+ mir_free(PDar);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_NOTSUPPORTWARNING), (pimo->m_bUseUserDefinedItems) ? SW_HIDE : SW_SHOW);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MENUITEMS), pimo->m_bUseUserDefinedItems);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_INSERTSEPARATOR), pimo->m_bUseUserDefinedItems);
return 1;
}
-static void RebuildCurrent( HWND hwndDlg )
+static void RebuildCurrent(HWND hwndDlg)
{
int MenuObjectID;
- if ( GetCurrentMenuObjectID( hwndDlg, &MenuObjectID ))
- BuildTree( hwndDlg, MenuObjectID, TRUE );
+ if (GetCurrentMenuObjectID(hwndDlg, &MenuObjectID))
+ BuildTree(hwndDlg, MenuObjectID, TRUE);
}
-static void ResetMenuItems( HWND hwndDlg )
+static void ResetMenuItems(HWND hwndDlg)
{
int MenuObjectID;
- if ( GetCurrentMenuObjectID( hwndDlg, &MenuObjectID ))
- BuildTree( hwndDlg, MenuObjectID, FALSE );
+ if (GetCurrentMenuObjectID(hwndDlg, &MenuObjectID))
+ BuildTree(hwndDlg, MenuObjectID, FALSE);
}
static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsertAfter)
@@ -353,23 +353,23 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, ( LPARAM )&tvi ))
+ if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi))
return NULL;
- if ( hItem && hInsertAfter ) {
+ if (hItem && hInsertAfter) {
TVINSERTSTRUCT tvis;
TCHAR name[128];
- if ( hItem == hInsertAfter )
+ if (hItem == hInsertAfter)
return hItem;
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.item.stateMask = 0xFFFFFFFF;
tvis.item.pszText = name;
- tvis.item.cchTextMax = sizeof( name );
+ tvis.item.cchTextMax = sizeof(name);
tvis.item.hItem = hItem;
- tvis.item.iImage = tvis.item.iSelectedImage = (( MenuItemOptData* )tvi.lParam)->show;
- if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
+ tvis.item.iImage = tvis.item.iSelectedImage = ((MenuItemOptData*)tvi.lParam)->show;
+ if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
return NULL;
- if (!TreeView_DeleteItem(hTreeWnd, hItem))
+ if ( !TreeView_DeleteItem(hTreeWnd, hItem))
return NULL;
tvis.hParent=NULL;
tvis.hInsertAfter=hInsertAfter;
@@ -396,9 +396,9 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam HWND tvw=hwnd;
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=hti.hItem;
- TreeView_GetItem( tvw, &tvi );
+ TreeView_GetItem(tvw, &tvi);
- if (!((MenuItemOptData *)tvi.lParam)->isSelected) { /* is not Selected*/
+ if ( !((MenuItemOptData *)tvi.lParam)->isSelected) { /* is not Selected*/
// reset all selection except current
HTREEITEM hit;
hit=TreeView_GetRoot(tvw);
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA dat=(struct OrderData*)mir_alloc(sizeof(struct OrderData));
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
- dat->iInitMenuValue = DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE );
+ dat->iInitMenuValue = DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE);
MyOldWindowProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC, (LONG_PTR)&LBTNDOWNProc);
{
@@ -446,28 +446,28 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), himlCheckBoxes, TVSIL_NORMAL);
TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUITEMS), himlCheckBoxes, TVSIL_NORMAL);
}
- CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE );
- CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled );
+ CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE);
+ CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled);
BuildMenuObjectsTree(hwndDlg);
return TRUE;
case WM_COMMAND:
- if ( HIWORD(wParam) == BN_CLICKED || HIWORD( wParam ) == BN_DBLCLK ) {
- switch ( LOWORD( wParam )) {
+ if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DBLCLK) {
+ switch (LOWORD(wParam)) {
case IDC_INSERTSEPARATOR:
InsertSeparator(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_RESETMENU:
- ResetMenuItems( hwndDlg );
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ ResetMenuItems(hwndDlg);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_DISABLEMENUICONS:
case IDC_RADIO1:
case IDC_RADIO2:
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_GENMENU_DEFAULT:
@@ -483,18 +483,18 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem=hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr( iod->name, STR_SEPARATOR ))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
if (iod->name)
mir_free(iod->name);
- iod->name = mir_tstrdup( iod->defname );
+ iod->name = mir_tstrdup(iod->defname);
SaveTree(hwndDlg);
RebuildCurrent(hwndDlg);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -504,20 +504,20 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR buf[256];
MenuItemOptData *iod;
- HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg, IDC_MENUITEMS ));
- if ( hti == NULL )
+ HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS));
+ if (hti == NULL)
break;
tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem = hti;
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_GETITEM, 0, (LPARAM)&tvi);
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR ))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
- ZeroMemory(buf, sizeof( buf ));
- GetDlgItemText( hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF( buf ));
+ ZeroMemory(buf, sizeof(buf));
+ GetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF(buf));
if (iod->name)
mir_free(iod->name);
@@ -525,7 +525,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SaveTree(hwndDlg);
RebuildCurrent(hwndDlg);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
} }
@@ -533,15 +533,15 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY:
hdr = (LPNMHDR)lParam;
- switch( hdr->idFrom ) {
+ switch(hdr->idFrom) {
case 0:
- if (hdr->code == PSN_APPLY ) {
+ if (hdr->code == PSN_APPLY) {
bIconsDisabled = IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENUICONS) != 0;
DBWriteContactSettingByte(NULL, "CList", "DisableMenuIcons", bIconsDisabled);
SaveTree(hwndDlg);
int iNewMenuValue = IsDlgButtonChecked(hwndDlg, IDC_RADIO1) ? 0 : 1;
- if ( iNewMenuValue != dat->iInitMenuValue ) {
- RebuildProtoMenus( iNewMenuValue );
+ if (iNewMenuValue != dat->iInitMenuValue) {
+ RebuildProtoMenus(iNewMenuValue);
dat->iInitMenuValue = iNewMenuValue;
}
RebuildCurrent(hwndDlg);
@@ -549,8 +549,8 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case IDC_MENUOBJECTS:
- if (hdr->code == TVN_SELCHANGEDA )
- RebuildCurrent( hwndDlg );
+ if (hdr->code == TVN_SELCHANGEDA)
+ RebuildCurrent(hwndDlg);
break;
case IDC_MENUITEMS:
@@ -661,12 +661,12 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.hItem=hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
- if ( tvi.lParam == 0 )
+ if (tvi.lParam == 0)
break;
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
SetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, iod->name);
@@ -684,7 +684,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_MOUSEMOVE:
- if (!dat||!dat->dragging) break;
+ if ( !dat || !dat->dragging) break;
{
TVHITTESTINFO hti;
@@ -697,7 +697,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM it = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2;
TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti);
- if (!(hti.flags&TVHT_ABOVE))
+ if ( !(hti.flags&TVHT_ABOVE))
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti.hItem, 1);
else
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), it, 0);
@@ -710,7 +710,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_LBUTTONUP:
- if (!dat->dragging)
+ if ( !dat->dragging)
break;
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0);
@@ -727,7 +727,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST;
if (dat->hDragItem == hti.hItem) break;
dat->hDragItem=NULL;
- if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem == TVI_FIRST)) {
+ if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
HWND tvw;
HTREEITEM * pSIT;
HTREEITEM FirstItem=NULL;
@@ -760,7 +760,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (i=0; i<uSic; i++) {
if (insertAfter) insertAfter=MoveItemAbove(tvw, pSIT[i], insertAfter);
else break;
- if (!i) FirstItem=insertAfter;
+ if ( !i) FirstItem=insertAfter;
} }
// free pointers...
mir_free(pSIT);
@@ -773,11 +773,11 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_DESTROY:
- if ( dat )
- mir_free( dat );
+ if (dat)
+ mir_free(dat);
ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), NULL, TVSIL_NORMAL));
- FreeTreeData( hwndDlg );
+ FreeTreeData(hwndDlg);
break;
}
@@ -786,10 +786,10 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD)
{
- if ( pNMTVCD == NULL )
+ if (pNMTVCD == NULL)
return -1;
- switch ( pNMTVCD->nmcd.dwDrawStage ) {
+ switch (pNMTVCD->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
@@ -818,7 +818,7 @@ long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD) and any subitems and return CDRF_NEWFONT. If the list-view control
is in report mode, you can simply return CDRF_NOTIFYSUBITEMREDRAW
to customize the item's subitems individually */
- if ( tvi.iImage == -1 ) {
+ if (tvi.iImage == -1) {
HBRUSH br;
SIZE sz;
RECT rc;
@@ -853,18 +853,18 @@ int GenMenuOptInit(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Customize");
odp.position = -1000000000;
- odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_GENMENU );
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENMENU);
odp.pszTitle = LPGEN("Menus");
odp.pfnDlgProc = GenMenuOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.position = -10000000;
odp.groupPosition = 1000000;
- odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_PROTOCOLORDER );
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTOCOLORDER);
odp.pszTitle = LPGEN("Accounts");
odp.pfnDlgProc = ProtocolOrderOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index c741c02008..714ed0e223 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -55,7 +55,7 @@ static int GroupNameExists(const TCHAR *name, int skipGroup) _itoa(i, idstr, 10);
if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
- if (!_tcscmp(dbv.ptszVal + 1, name)) {
+ if ( !_tcscmp(dbv.ptszVal + 1, name)) {
DBFreeVariant(&dbv);
return i+1;
}
@@ -78,13 +78,13 @@ static INT_PTR CreateGroup(WPARAM wParam, LPARAM lParam) if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
return 0;
- mir_sntprintf( newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName );
+ mir_sntprintf(newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName);
mir_free(dbv.pszVal);
}
- else lstrcpyn( newBaseName, grpName, SIZEOF( newBaseName ));
+ else lstrcpyn(newBaseName, grpName, SIZEOF(newBaseName));
_itoa(newId, str, 10);
- lstrcpyn( newName + 1, newBaseName, SIZEOF(newName) - 1);
+ lstrcpyn(newName + 1, newBaseName, SIZEOF(newName) - 1);
if (lParam) {
i = GroupNameExists(newBaseName, -1);
if (i) newId = i - 1;
@@ -93,7 +93,7 @@ static INT_PTR CreateGroup(WPARAM wParam, LPARAM lParam) else {
i = 1;
while (GroupNameExists(newName + 1, -1))
- mir_sntprintf( newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, ++i );
+ mir_sntprintf(newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, ++i);
}
if (i) {
const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, newName };
@@ -124,20 +124,20 @@ static INT_PTR GetGroupName2(WPARAM wParam, LPARAM lParam) return (INT_PTR) name;
}
-TCHAR* fnGetGroupName( int idx, DWORD* pdwFlags )
+TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags)
{
char idstr[33];
DBVARIANT dbv;
static TCHAR name[128];
- _itoa( idx-1, idstr, 10);
- if (DBGetContactSettingTString( NULL, "CListGroups", idstr, &dbv ))
+ _itoa(idx-1, idstr, 10);
+ if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
return NULL;
- lstrcpyn( name, dbv.ptszVal + 1, SIZEOF( name ));
- if ( pdwFlags != NULL )
+ lstrcpyn(name, dbv.ptszVal + 1, SIZEOF(name));
+ if (pdwFlags != NULL)
*pdwFlags = dbv.ptszVal[0];
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
return name;
}
@@ -167,7 +167,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) if (DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT))
{
TCHAR szQuestion[256+100];
- mir_sntprintf( szQuestion, SIZEOF(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation can not be undone."), name );
+ mir_sntprintf(szQuestion, SIZEOF(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation can not be undone."), name);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete Group"), MB_YESNO|MB_ICONQUESTION) == IDNO)
return 1;
}
@@ -230,7 +230,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) _itoa(i, str, 10);
if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
break;
- if (!_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
+ if ( !_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
if (szNewParent[0])
mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2);
else
@@ -275,7 +275,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) //must rename setting in all child contacts too
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
do {
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry( hContact );
+ ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->group, oldName)) {
DBWriteContactSettingTString(hContact, "CList", "Group", szName);
mir_free(cache->group);
@@ -298,7 +298,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
- mir_sntprintf( szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2 );
+ mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2);
RenameGroupWithMove(i, szNewName, 0); //luckily, child groups will never need reordering
}
DBFreeVariant(&dbv);
@@ -318,7 +318,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) _itoa(i, idstr, 10);
if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
- if (!lstrcmp(dbv.ptszVal + 1, str)) {
+ if ( !lstrcmp(dbv.ptszVal + 1, str)) {
if (i < groupId)
break; //is OK
MoveGroupBefore(groupId + 1, i + 2);
@@ -335,16 +335,16 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) return 0;
}
-int fnRenameGroup( int groupID, TCHAR* newName )
+int fnRenameGroup(int groupID, TCHAR* newName)
{
- return -1 != RenameGroupWithMove( groupID-1, newName, 1);
+ return -1 != RenameGroupWithMove(groupID-1, newName, 1);
}
static INT_PTR RenameGroup(WPARAM wParam, LPARAM lParam)
{
- WCHAR* temp = mir_a2u(( char* )lParam );
- int result = ( -1 != RenameGroupWithMove(wParam - 1, temp, 1));
- mir_free( temp );
+ WCHAR* temp = mir_a2u((char*)lParam);
+ int result = (-1 != RenameGroupWithMove(wParam - 1, temp, 1));
+ mir_free(temp);
return result;
}
@@ -475,7 +475,7 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) pNextField = NULL;
}
else {
- lstrcpyn(szThisField, pNextField, min( SIZEOF(szThisField), pBackslash - pNextField + 1));
+ lstrcpyn(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
compareResult = 1;
@@ -567,7 +567,7 @@ int InitGroupServices(void) CreateServiceFunction(MS_CLIST_GROUPMOVEBEFORE, MoveGroupBefore);
CreateServiceFunction(MS_CLIST_GROUPBUILDMENU, BuildGroupMenu);
- hGroupChangeEvent = CreateHookableEvent( ME_CLIST_GROUPCHANGE );
+ hGroupChangeEvent = CreateHookableEvent(ME_CLIST_GROUPCHANGE);
return 0;
}
diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 2f7345ff5b..28fc6d7be4 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -33,7 +33,7 @@ static INT_PTR hkHideShow(WPARAM, LPARAM) INT_PTR hkSearch(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv={0};
- if (!DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) {
CallService(MS_UTILS_OPENURL, DBGetContactSettingByte(NULL, "CList", "HKSearchNewWnd", 0), (LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
}
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 5fd05e87a0..2075fa3648 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -47,15 +47,15 @@ struct GroupItemSort { return _tcscoll(d1->name, d2->name); }
};
-static TCHAR* PrepareGroupName( TCHAR* str )
+static TCHAR* PrepareGroupName(TCHAR* str)
{
- TCHAR* p = _tcschr( str, '&' ), *d;
- if ( p == NULL )
- return mir_tstrdup( str );
+ TCHAR* p = _tcschr(str, '&'), *d;
+ if (p == NULL)
+ return mir_tstrdup(str);
- d = p = ( TCHAR* )mir_alloc( sizeof( TCHAR )*( 2*_tcslen( str )+1 ));
- while ( *str ) {
- if ( *str == '&' )
+ d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2*_tcslen(str)+1));
+ while (*str) {
+ if (*str == '&')
*d++ = '&';
*d++ = *str++;
}
@@ -71,13 +71,13 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo mi.hParentMenu = hRoot;
mi.popupPosition = param; // param to pszService - only with CMIF_CHILDPOPUP !!!!!!
mi.position = pos;
- mi.ptszName = PrepareGroupName( name );
+ mi.ptszName = PrepareGroupName(name);
mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- if ( checked )
+ if (checked)
mi.flags |= CMIF_CHECKED;
mi.pszService = MTG_MOVE;
HANDLE result = Menu_AddContactMenuItem(&mi);
- mir_free( mi.ptszName );
+ mir_free(mi.ptszName);
lphGroupsItems.insert((HANDLE*)result);
}
@@ -87,7 +87,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) int i;
OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);
- if (!hMoveToGroupItem)
+ if ( !hMoveToGroupItem)
{
CLISTMENUITEM mi = {0};
diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index 41a5b5beba..2eeb402f42 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -48,12 +48,12 @@ typedef struct { }
tempProtoItem;
-int isProtoSuitable( PROTO_INTERFACE* ppi )
+int isProtoSuitable(PROTO_INTERFACE* ppi)
{
- if ( ppi == NULL )
+ if (ppi == NULL)
return TRUE;
- return ppi->GetCaps( PFLAGNUM_2, 0 ) & ~ppi->GetCaps( PFLAGNUM_5, 0 );
+ return ppi->GetCaps(PFLAGNUM_2, 0) & ~ppi->GetCaps(PFLAGNUM_5, 0);
}
bool CheckProtocolOrder(void)
@@ -132,26 +132,26 @@ int FillTree(HWND hwnd) tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
TreeView_DeleteAllItems(hwnd);
- if ( accounts.getCount() == 0 )
+ if (accounts.getCount() == 0)
return FALSE;
- for ( i = 0; i < accounts.getCount(); i++ ) {
- int idx = cli.pfnGetAccountIndexByPos( i );
- if ( idx == -1 )
+ for (i = 0; i < accounts.getCount(); i++) {
+ int idx = cli.pfnGetAccountIndexByPos(i);
+ if (idx == -1)
continue;
pa = accounts[idx];
- PD = ( ProtocolData* )mir_alloc( sizeof( ProtocolData ));
+ PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
PD->RealName = pa->szModuleName;
PD->protopos = pa->iOrder;
- PD->enabled = Proto_IsAccountEnabled( pa ) && isProtoSuitable( pa->ppro );
+ PD->enabled = Proto_IsAccountEnabled(pa) && isProtoSuitable(pa->ppro);
PD->show = PD->enabled ? pa->bIsVisible : 100;
- tvis.item.lParam = ( LPARAM )PD;
+ tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = pa->tszAccountName;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
- TreeView_InsertItem( hwnd, &tvis );
+ TreeView_InsertItem(hwnd, &tvis);
}
return 0;
@@ -166,7 +166,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
case WM_DESTROY:
ImageList_Destroy(TreeView_GetImageList(hwndProtoOrder, TVSIL_NORMAL));
- mir_free( dat );
+ mir_free(dat);
break;
case WM_INITDIALOG:
@@ -177,7 +177,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndProtoOrder, GWL_STYLE, GetWindowLongPtr(hwndProtoOrder, GWL_STYLE) | TVS_NOHSCROLL);
{
- HIMAGELIST himlCheckBoxes = ImageList_Create( GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), ILC_COLOR32|ILC_MASK, 2, 2 );
+ HIMAGELIST himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 2, 2);
ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK);
ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK);
TreeView_SetImageList(hwndProtoOrder, himlCheckBoxes, TVSIL_NORMAL);
@@ -189,7 +189,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
if (LOWORD(wParam) == IDC_RESETPROTOCOLDATA && HIWORD(wParam) == BN_CLICKED)
{
- for ( int i = 0; i < accounts.getCount(); i++ )
+ for (int i = 0; i < accounts.getCount(); i++)
accounts[i]->iOrder = i;
FillTree(hwndProtoOrder);
@@ -200,7 +200,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_NOTIFY:
switch(((LPNMHDR)lParam)->idFrom) {
case 0:
- if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int count = 0;
TVITEM tvi;
@@ -208,27 +208,27 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvi.cchTextMax = 32;
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
TreeView_GetItem(hwndProtoOrder, &tvi);
if (tvi.lParam != 0) {
- ProtocolData* ppd = ( ProtocolData* )tvi.lParam;
- PROTOACCOUNT* pa = Proto_GetAccount( ppd->RealName );
- if ( pa != NULL ) {
+ ProtocolData* ppd = (ProtocolData*)tvi.lParam;
+ PROTOACCOUNT* pa = Proto_GetAccount(ppd->RealName);
+ if (pa != NULL) {
pa->iOrder = count++;
- if ( ppd->enabled )
+ if (ppd->enabled)
pa->bIsVisible = ppd->show;
}
}
- tvi.hItem = TreeView_GetNextSibling(hwndProtoOrder, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndProtoOrder, tvi.hItem);
}
WriteDbAccounts();
cli.pfnReloadProtoMenus();
cli.pfnTrayIconIconsChanged();
- cli.pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 );
- cli.pfnClcBroadcast( INTM_INVALIDATE, 0, 0 );
+ cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
+ cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0);
}
break;
@@ -255,15 +255,15 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hti.pt.x=(short)LOWORD(GetMessagePos());
hti.pt.y=(short)HIWORD(GetMessagePos());
ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if ( TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti )) {
- if ( hti.flags & TVHT_ONITEMICON ) {
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
+ if (hti.flags & TVHT_ONITEMICON) {
TVITEMA tvi;
tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tvi.hItem = hti.hItem;
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- ProtocolData *pData = ( ProtocolData* )tvi.lParam;
- if ( pData->enabled ) {
+ ProtocolData *pData = (ProtocolData*)tvi.lParam;
+ if (pData->enabled) {
tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
pData->show = tvi.iImage;
TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
@@ -274,19 +274,19 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_MOUSEMOVE:
- if ( dat->dragging ) {
+ if (dat->dragging) {
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lParam);
hti.pt.y=(short)HIWORD(lParam);
ClientToScreen(hwndDlg, &hti.pt);
ScreenToClient(hwndProtoOrder, &hti.pt);
TreeView_HitTest(hwndProtoOrder, &hti);
- if ( hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT ))
+ if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT))
{
HTREEITEM it = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(hwndProtoOrder) / 2;
TreeView_HitTest(hwndProtoOrder, &hti);
- if ( !( hti.flags & TVHT_ABOVE ))
+ if ( !(hti.flags & TVHT_ABOVE))
TreeView_SetInsertMark(hwndProtoOrder, hti.hItem, 1);
else
TreeView_SetInsertMark(hwndProtoOrder, it, 0);
@@ -299,7 +299,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_LBUTTONUP:
- if ( dat->dragging ) {
+ if (dat->dragging) {
TVHITTESTINFO hti;
TVITEM tvi;
@@ -318,7 +318,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvi.mask = TVIF_HANDLE|TVIF_PARAM;
tvi.hItem = dat->hDragItem;
TreeView_GetItem(hwndProtoOrder, &tvi);
- if ( hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST))
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST))
{
TVINSERTSTRUCT tvis;
TCHAR name[128];
diff --git a/src/modules/contacts/contacts.cpp b/src/modules/contacts/contacts.cpp index 1b8041a066..11180fb52c 100644 --- a/src/modules/contacts/contacts.cpp +++ b/src/modules/contacts/contacts.cpp @@ -20,19 +20,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NAMEORDERCOUNT 8
static TCHAR* nameOrderDescr[ NAMEORDERCOUNT ] =
{
- _T( "My custom name (not moveable)" ),
- _T( "Nick" ),
- _T( "FirstName" ),
- _T( "E-mail" ),
- _T( "LastName" ),
- _T( "Username" ),
- _T( "FirstName LastName" ),
- _T( "'(Unknown Contact)' (not moveable)" )
+ _T("My custom name (not moveable)"),
+ _T("Nick"),
+ _T("FirstName"),
+ _T("E-mail"),
+ _T("LastName"),
+ _T("Username"),
+ _T("FirstName LastName"),
+ _T("'(Unknown Contact)' (not moveable)")
};
BYTE nameOrder[NAMEORDERCOUNT];
-static int GetDatabaseString( CONTACTINFO *ci, const char* setting, DBVARIANT* dbv )
+static int GetDatabaseString(CONTACTINFO *ci, const char* setting, DBVARIANT* dbv)
{
if (strcmp(ci->szProto, "CList") && CallProtoService(ci->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC)
{
@@ -43,7 +43,7 @@ static int GetDatabaseString( CONTACTINFO *ci, const char* setting, DBVARIANT* d if (res != CALLSERVICE_NOTFOUND) return res;
}
- if ( ci->dwFlag & CNF_UNICODE )
+ if (ci->dwFlag & CNF_UNICODE)
return DBGetContactSettingWString(ci->hContact, ci->szProto, setting, dbv);
return DBGetContactSettingString(ci->hContact, ci->szProto, setting, dbv);
@@ -52,20 +52,20 @@ static int GetDatabaseString( CONTACTINFO *ci, const char* setting, DBVARIANT* d static int ProcessDatabaseValueDefault(CONTACTINFO *ci, const char* setting)
{
DBVARIANT dbv;
- if ( !GetDatabaseString( ci, setting, &dbv )) {
+ if ( !GetDatabaseString(ci, setting, &dbv)) {
switch (dbv.type) {
case DBVT_ASCIIZ:
- if (!dbv.pszVal[0]) break;
+ if ( !dbv.pszVal[0]) break;
case DBVT_WCHAR:
- if (!dbv.pwszVal[0]) break;
+ if ( !dbv.pwszVal[0]) break;
ci->type = CNFT_ASCIIZ;
ci->pszVal = dbv.ptszVal;
return 0;
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
- if ( DBGetContactSetting( ci->hContact, ci->szProto, setting, &dbv ))
+ if (DBGetContactSetting(ci->hContact, ci->szProto, setting, &dbv))
return 1;
switch (dbv.type) {
@@ -83,7 +83,7 @@ static int ProcessDatabaseValueDefault(CONTACTINFO *ci, const char* setting) return 0;
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
return 1;
}
@@ -96,40 +96,40 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { if (ci->szProto == NULL) return 1;
ci->type = 0;
switch(ci->dwFlag & 0x7F) {
- case CNF_FIRSTNAME: return ProcessDatabaseValueDefault( ci, "FirstName" );
- case CNF_LASTNAME: return ProcessDatabaseValueDefault( ci, "LastName" );
- case CNF_NICK: return ProcessDatabaseValueDefault( ci, "Nick" );
- case CNF_EMAIL: return ProcessDatabaseValueDefault( ci, "e-mail" );
- case CNF_CITY: return ProcessDatabaseValueDefault( ci, "City" );
- case CNF_STATE: return ProcessDatabaseValueDefault( ci, "State" );
- case CNF_PHONE: return ProcessDatabaseValueDefault( ci, "Phone" );
- case CNF_HOMEPAGE: return ProcessDatabaseValueDefault( ci, "Homepage" );
- case CNF_ABOUT: return ProcessDatabaseValueDefault( ci, "About" );
- case CNF_AGE: return ProcessDatabaseValueDefault( ci, "Age" );
- case CNF_GENDER: return ProcessDatabaseValueDefault( ci, "Gender" );
- case CNF_FAX: return ProcessDatabaseValueDefault( ci, "Fax" );
- case CNF_CELLULAR: return ProcessDatabaseValueDefault( ci, "Cellular" );
- case CNF_BIRTHDAY: return ProcessDatabaseValueDefault( ci, "BirthDay" );
- case CNF_BIRTHMONTH: return ProcessDatabaseValueDefault( ci, "BirthMonth" );
- case CNF_BIRTHYEAR: return ProcessDatabaseValueDefault( ci, "BirthYear" );
- case CNF_STREET: return ProcessDatabaseValueDefault( ci, "Street" );
- case CNF_ZIP: return ProcessDatabaseValueDefault( ci, "ZIP" );
- case CNF_LANGUAGE1: return ProcessDatabaseValueDefault( ci, "Language1" );
- case CNF_LANGUAGE2: return ProcessDatabaseValueDefault( ci, "Language2" );
- case CNF_LANGUAGE3: return ProcessDatabaseValueDefault( ci, "Language3" );
- case CNF_CONAME: return ProcessDatabaseValueDefault( ci, "Company" );
- case CNF_CODEPT: return ProcessDatabaseValueDefault( ci, "CompanyDepartment" );
- case CNF_COPOSITION: return ProcessDatabaseValueDefault( ci, "CompanyPosition" );
- case CNF_COSTREET: return ProcessDatabaseValueDefault( ci, "CompanyStreet" );
- case CNF_COCITY: return ProcessDatabaseValueDefault( ci, "CompanyCity" );
- case CNF_COSTATE: return ProcessDatabaseValueDefault( ci, "CompanyState" );
- case CNF_COZIP: return ProcessDatabaseValueDefault( ci, "CompanyZIP" );
- case CNF_COHOMEPAGE: return ProcessDatabaseValueDefault( ci, "CompanyHomepage" );
+ case CNF_FIRSTNAME: return ProcessDatabaseValueDefault(ci, "FirstName");
+ case CNF_LASTNAME: return ProcessDatabaseValueDefault(ci, "LastName");
+ case CNF_NICK: return ProcessDatabaseValueDefault(ci, "Nick");
+ case CNF_EMAIL: return ProcessDatabaseValueDefault(ci, "e-mail");
+ case CNF_CITY: return ProcessDatabaseValueDefault(ci, "City");
+ case CNF_STATE: return ProcessDatabaseValueDefault(ci, "State");
+ case CNF_PHONE: return ProcessDatabaseValueDefault(ci, "Phone");
+ case CNF_HOMEPAGE: return ProcessDatabaseValueDefault(ci, "Homepage");
+ case CNF_ABOUT: return ProcessDatabaseValueDefault(ci, "About");
+ case CNF_AGE: return ProcessDatabaseValueDefault(ci, "Age");
+ case CNF_GENDER: return ProcessDatabaseValueDefault(ci, "Gender");
+ case CNF_FAX: return ProcessDatabaseValueDefault(ci, "Fax");
+ case CNF_CELLULAR: return ProcessDatabaseValueDefault(ci, "Cellular");
+ case CNF_BIRTHDAY: return ProcessDatabaseValueDefault(ci, "BirthDay");
+ case CNF_BIRTHMONTH: return ProcessDatabaseValueDefault(ci, "BirthMonth");
+ case CNF_BIRTHYEAR: return ProcessDatabaseValueDefault(ci, "BirthYear");
+ case CNF_STREET: return ProcessDatabaseValueDefault(ci, "Street");
+ case CNF_ZIP: return ProcessDatabaseValueDefault(ci, "ZIP");
+ case CNF_LANGUAGE1: return ProcessDatabaseValueDefault(ci, "Language1");
+ case CNF_LANGUAGE2: return ProcessDatabaseValueDefault(ci, "Language2");
+ case CNF_LANGUAGE3: return ProcessDatabaseValueDefault(ci, "Language3");
+ case CNF_CONAME: return ProcessDatabaseValueDefault(ci, "Company");
+ case CNF_CODEPT: return ProcessDatabaseValueDefault(ci, "CompanyDepartment");
+ case CNF_COPOSITION: return ProcessDatabaseValueDefault(ci, "CompanyPosition");
+ case CNF_COSTREET: return ProcessDatabaseValueDefault(ci, "CompanyStreet");
+ case CNF_COCITY: return ProcessDatabaseValueDefault(ci, "CompanyCity");
+ case CNF_COSTATE: return ProcessDatabaseValueDefault(ci, "CompanyState");
+ case CNF_COZIP: return ProcessDatabaseValueDefault(ci, "CompanyZIP");
+ case CNF_COHOMEPAGE: return ProcessDatabaseValueDefault(ci, "CompanyHomepage");
case CNF_CUSTOMNICK:
{
char* saveProto = ci->szProto; ci->szProto = "CList";
- if ( ci->hContact != NULL && !ProcessDatabaseValueDefault( ci, "MyHandle" )) {
+ if (ci->hContact != NULL && !ProcessDatabaseValueDefault(ci, "MyHandle")) {
ci->szProto = saveProto;
return 0;
}
@@ -138,60 +138,60 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { }
case CNF_COUNTRY:
case CNF_COCOUNTRY:
- if ( !GetDatabaseString( ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv ))
+ if ( !GetDatabaseString(ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv))
return 0;
- if ( !DBGetContactSetting( ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv )) {
- if ( dbv.type == DBVT_WORD ) {
+ if ( !DBGetContactSetting(ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) {
+ if (dbv.type == DBVT_WORD) {
int i, countryCount;
struct CountryListEntry *countries;
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
for (i=0;i<countryCount;i++) {
if (countries[i].id != dbv.wVal) continue;
- if ( ci->dwFlag & CNF_UNICODE ) {
- int cbLen = MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )countries[i].szName, -1, NULL, 0 );
- WCHAR* buf = ( WCHAR* )mir_alloc( sizeof( WCHAR )*(cbLen+1) );
- if ( buf != NULL )
- MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )countries[i].szName, -1, buf, cbLen );
- ci->pszVal = ( TCHAR* )buf;
+ if (ci->dwFlag & CNF_UNICODE) {
+ int cbLen = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)countries[i].szName, -1, NULL, 0);
+ WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*(cbLen+1));
+ if (buf != NULL)
+ MultiByteToWideChar(CP_ACP, 0, (LPCSTR)countries[i].szName, -1, buf, cbLen);
+ ci->pszVal = (TCHAR*)buf;
}
- else ci->pszVal = ( TCHAR* )mir_strdup(countries[i].szName);
+ else ci->pszVal = (TCHAR*)mir_strdup(countries[i].szName);
ci->type = CNFT_ASCIIZ;
DBFreeVariant(&dbv);
return 0;
}
}
- else return ProcessDatabaseValueDefault( ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry" );
+ else return ProcessDatabaseValueDefault(ci, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry");
DBFreeVariant(&dbv);
}
break;
case CNF_FIRSTLAST:
- if ( !GetDatabaseString( ci, "FirstName", &dbv )) {
+ if ( !GetDatabaseString(ci, "FirstName", &dbv)) {
DBVARIANT dbv2;
- if (!GetDatabaseString(ci, "LastName", &dbv2)) {
+ if ( !GetDatabaseString(ci, "LastName", &dbv2)) {
ci->type = CNFT_ASCIIZ;
- if ( ci->dwFlag & CNF_UNICODE ) {
+ if (ci->dwFlag & CNF_UNICODE) {
size_t len = wcslen(dbv.pwszVal) + wcslen(dbv2.pwszVal) + 2;
- WCHAR* buf = ( WCHAR* )mir_alloc( sizeof( WCHAR )*len );
- if ( buf != NULL )
- wcscat( wcscat( wcscpy( buf, dbv.pwszVal ), L" " ), dbv2.pwszVal );
- ci->pszVal = ( TCHAR* )buf;
+ WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
+ if (buf != NULL)
+ wcscat(wcscat(wcscpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
+ ci->pszVal = (TCHAR*)buf;
}
else {
size_t len = strlen(dbv.pszVal) + strlen(dbv2.pszVal) + 2;
- char* buf = ( char* )mir_alloc( len );
- if ( buf != NULL )
- strcat( strcat( strcpy( buf, dbv.pszVal ), " " ), dbv2.pszVal );
- ci->pszVal = ( TCHAR* )buf;
+ char* buf = (char*)mir_alloc(len);
+ if (buf != NULL)
+ strcat(strcat(strcpy(buf, dbv.pszVal), " "), dbv2.pszVal);
+ ci->pszVal = (TCHAR*)buf;
}
- DBFreeVariant( &dbv );
- DBFreeVariant( &dbv2 );
+ DBFreeVariant(&dbv);
+ DBFreeVariant(&dbv2);
return 0;
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
break;
@@ -199,18 +199,18 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { {
char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid)
- if (!ProcessDatabaseValueDefault(ci, uid))
+ if ( !ProcessDatabaseValueDefault(ci, uid))
return 0;
break;
}
case CNF_DISPLAYUID:
{
- if (!ProcessDatabaseValueDefault(ci, "display_uid"))
+ if ( !ProcessDatabaseValueDefault(ci, "display_uid"))
return 0;
char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid)
- if (!ProcessDatabaseValueDefault(ci, uid))
+ if ( !ProcessDatabaseValueDefault(ci, uid))
return 0;
break;
@@ -219,7 +219,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { case CNF_DISPLAY:
{
int i;
- for ( i=0; i < NAMEORDERCOUNT; i++ ) {
+ for (i=0; i < NAMEORDERCOUNT; i++) {
switch(nameOrder[i]) {
case 0: // custom name
{
@@ -234,19 +234,19 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { break;
}
case 1:
- if ( !ProcessDatabaseValueDefault( ci, "Nick" )) // nick
+ if ( !ProcessDatabaseValueDefault(ci, "Nick")) // nick
return 0;
break;
case 2:
- if ( !ProcessDatabaseValueDefault( ci, "FirstName" )) // First Name
+ if ( !ProcessDatabaseValueDefault(ci, "FirstName")) // First Name
return 0;
break;
case 3:
- if ( !ProcessDatabaseValueDefault( ci, "e-mail" )) // E-mail
+ if ( !ProcessDatabaseValueDefault(ci, "e-mail")) // E-mail
return 0;
break;
case 4:
- if ( !ProcessDatabaseValueDefault( ci, "LastName" )) // Last Name
+ if ( !ProcessDatabaseValueDefault(ci, "LastName")) // Last Name
return 0;
break;
case 5: // Unique id
@@ -254,18 +254,18 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { // protocol must define a PFLAG_UNIQUEIDSETTING
char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid) {
- if (!GetDatabaseString(ci, uid, &dbv)) {
- if ( dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD ) {
+ if ( !GetDatabaseString(ci, uid, &dbv)) {
+ if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) {
long value = (dbv.type == DBVT_BYTE) ? dbv.bVal:(dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal);
- if ( ci->dwFlag & CNF_UNICODE ) {
+ if (ci->dwFlag & CNF_UNICODE) {
WCHAR buf[ 40 ];
- _ltow( value, buf, 10 );
- ci->pszVal = ( TCHAR* )mir_wstrdup( buf );
+ _ltow(value, buf, 10);
+ ci->pszVal = (TCHAR*)mir_wstrdup(buf);
}
else {
char buf[ 40 ];
- _ltoa( value, buf, 10 );
- ci->pszVal = ( TCHAR* )mir_strdup(buf);
+ _ltoa(value, buf, 10);
+ ci->pszVal = (TCHAR*)mir_strdup(buf);
}
ci->type = CNFT_ASCIIZ;
return 0;
@@ -283,39 +283,39 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { break;
}
case 6: // first + last name
- if (!GetDatabaseString(ci, "FirstName", &dbv)) {
+ if ( !GetDatabaseString(ci, "FirstName", &dbv)) {
DBVARIANT dbv2;
- if (!GetDatabaseString(ci, "LastName", &dbv2)) {
+ if ( !GetDatabaseString(ci, "LastName", &dbv2)) {
ci->type = CNFT_ASCIIZ;
- if ( ci->dwFlag & CNF_UNICODE ) {
+ if (ci->dwFlag & CNF_UNICODE) {
size_t len = wcslen(dbv.pwszVal) + wcslen(dbv2.pwszVal) + 2;
- WCHAR* buf = ( WCHAR* )mir_alloc( sizeof( WCHAR )*len );
- if ( buf != NULL )
- wcscat( wcscat( wcscpy( buf, dbv.pwszVal ), L" " ), dbv2.pwszVal );
- ci->pszVal = ( TCHAR* )buf;
+ WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
+ if (buf != NULL)
+ wcscat(wcscat(wcscpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
+ ci->pszVal = (TCHAR*)buf;
}
else {
size_t len = strlen(dbv.pszVal) + strlen(dbv2.pszVal) + 2;
- char* buf = ( char* )mir_alloc( len );
- if ( buf != NULL )
- strcat( strcat( strcpy( buf, dbv.pszVal ), " " ), dbv2.pszVal );
- ci->pszVal = ( TCHAR* )buf;
+ char* buf = (char*)mir_alloc(len);
+ if (buf != NULL)
+ strcat(strcat(strcpy(buf, dbv.pszVal), " "), dbv2.pszVal);
+ ci->pszVal = (TCHAR*)buf;
}
- DBFreeVariant( &dbv );
- DBFreeVariant( &dbv2 );
+ DBFreeVariant(&dbv);
+ DBFreeVariant(&dbv2);
return 0;
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
break;
case 7:
- if ( ci->dwFlag & CNF_UNICODE )
- ci->pszVal = ( TCHAR* )mir_wstrdup( TranslateW( L"'(Unknown Contact)'" ));
+ if (ci->dwFlag & CNF_UNICODE)
+ ci->pszVal = (TCHAR*)mir_wstrdup(TranslateW(L"'(Unknown Contact)'"));
else
- ci->pszVal = ( TCHAR* )mir_strdup( Translate("'(Unknown Contact)'"));
+ ci->pszVal = (TCHAR*)mir_strdup(Translate("'(Unknown Contact)'"));
ci->type = CNFT_ASCIIZ;
return 0;
} } }
@@ -338,7 +338,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { }
case CNF_MYNOTES: {
char* saveProto = ci->szProto; ci->szProto = "UserInfo";
- if (!ProcessDatabaseValueDefault(ci, "MyNotes")) {
+ if ( !ProcessDatabaseValueDefault(ci, "MyNotes")) {
ci->szProto = saveProto;
return 0;
}
@@ -371,10 +371,10 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT|TVIF_PARAM;
- for (i=0; i < SIZEOF(nameOrderDescr); i++ ) {
+ for (i=0; i < SIZEOF(nameOrderDescr); i++) {
tvis.item.lParam = nameOrder[i];
- tvis.item.pszText = TranslateTS( nameOrderDescr[ nameOrder[i]] );
- TreeView_InsertItem( GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvis );
+ tvis.item.pszText = TranslateTS(nameOrderDescr[ nameOrder[i]]);
+ TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvis);
} }
return TRUE;
}
@@ -392,9 +392,9 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara cws.value.pbVal = nameOrder;
tvi.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_NAMEORDER));
i=0;
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- TreeView_GetItem( GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvi );
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvi);
nameOrder[i++] = (BYTE)tvi.lParam;
tvi.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_NAMEORDER), tvi.hItem);
}
@@ -405,7 +405,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara case IDC_NAMEORDER:
if (((LPNMHDR)lParam)->code == TVN_BEGINDRAGA) {
LPNMTREEVIEWA notify = (LPNMTREEVIEWA)lParam;
- if ( notify->itemNew.lParam == 0 || notify->itemNew.lParam == SIZEOF(nameOrderDescr)-1 )
+ if (notify->itemNew.lParam == 0 || notify->itemNew.lParam == SIZEOF(nameOrderDescr)-1)
break;
SetCapture(hwndDlg);
dat->dragging=1;
@@ -416,7 +416,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara }
break;
case WM_MOUSEMOVE:
- if (!dat->dragging) break;
+ if ( !dat->dragging) break;
{ TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lParam);
hti.pt.y=(short)HIWORD(lParam);
@@ -436,7 +436,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara }
break;
case WM_LBUTTONUP:
- if (!dat->dragging) break;
+ if ( !dat->dragging) break;
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_NAMEORDER), NULL, 0);
dat->dragging=0;
ReleaseCapture();
@@ -488,7 +488,7 @@ static int ContactOptInit(WPARAM wParam, LPARAM) odp.pszTitle = LPGEN("Contacts");
odp.pfnDlgProc = ContactOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -501,7 +501,7 @@ int LoadContactsModule(void) { for (i=0; i<NAMEORDERCOUNT; i++)
nameOrder[i]=i;
- if (!DBGetContactSetting(NULL, "Contact", "NameOrder", &dbv))
+ if ( !DBGetContactSetting(NULL, "Contact", "NameOrder", &dbv))
{
CopyMemory(nameOrder, dbv.pbVal, dbv.cpbVal);
DBFreeVariant(&dbv);
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index e4b2663b60..407cc4b4b2 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -41,15 +41,15 @@ bool fileExist(TCHAR* fname) return res;
}
-static void fillProfileName( const TCHAR* ptszFileName )
+static void fillProfileName(const TCHAR* ptszFileName)
{
- const TCHAR* p = _tcsrchr( ptszFileName, '\\' );
- if ( p == NULL )
+ const TCHAR* p = _tcsrchr(ptszFileName, '\\');
+ if (p == NULL)
p = ptszFileName;
else
p++;
- _tcsncpy( g_profileName, p, SIZEOF(g_profileName));
+ _tcsncpy(g_profileName, p, SIZEOF(g_profileName));
}
bool IsInsideRootDir(TCHAR* profiledir, bool exact)
@@ -103,7 +103,7 @@ static bool showProfileManager(void) // wanna show it?
GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T("never"), Mgr, SIZEOF(Mgr), mirandabootini);
- return ( _tcsicmp(Mgr, _T("yes")) == 0 );
+ return (_tcsicmp(Mgr, _T("yes")) == 0);
}
bool shouldAutoCreate(TCHAR *szProfile)
@@ -177,7 +177,7 @@ void getProfileCmdLine(TCHAR * szProfile, size_t cch, TCHAR * profiledir) p = _tcsrchr(buf, '\\'); if (p) ++p; else p = buf;
- if (!isValidProfileName(buf) && *p)
+ if ( !isValidProfileName(buf) && *p)
_tcscat(buf, _T(".dat"));
_tcscpy(profileName, p);
@@ -299,10 +299,10 @@ static int getProfile1(TCHAR * szProfile, size_t cch, TCHAR * profiledir, BOOL * reqfd = !shpm && found == 1 && nodprof;
}
- if ( noProfiles )
+ if (noProfiles)
*noProfiles = found == 0;
- if ( nodprof && !reqfd )
+ if (nodprof && !reqfd)
szProfile[0] = 0;
return reqfd;
@@ -352,18 +352,18 @@ static int getProfile(TCHAR * szProfile, size_t cch) }
// carefully converts a file name from TCHAR* to char*
-char* makeFileName( const TCHAR* tszOriginalName )
+char* makeFileName(const TCHAR* tszOriginalName)
{
char* szResult = NULL;
- char* szFileName = mir_t2a( tszOriginalName );
- TCHAR* tszFileName = mir_a2t( szFileName );
- if ( _tcscmp( tszOriginalName, tszFileName )) {
+ char* szFileName = mir_t2a(tszOriginalName);
+ TCHAR* tszFileName = mir_a2t(szFileName);
+ if (_tcscmp(tszOriginalName, tszFileName)) {
TCHAR tszProfile[MAX_PATH];
- if ( GetShortPathName( tszOriginalName, tszProfile, MAX_PATH) != 0)
- szResult = mir_t2a( tszProfile );
+ if (GetShortPathName(tszOriginalName, tszProfile, MAX_PATH) != 0)
+ szResult = mir_t2a(tszProfile);
}
- if ( !szResult )
+ if ( !szResult)
szResult = szFileName;
else
mir_free(szFileName);
@@ -382,10 +382,10 @@ int makeDatabase(TCHAR * profile, DATABASELINK * link, HWND hwndDlg) if (file) file++;
if (_taccess(profile, 0) == 0) {
// file already exists!
- mir_sntprintf(buf, SIZEOF(buf), TranslateTS( _T("The profile '%s' already exists. Do you want to move it to the ")
+ mir_sntprintf(buf, SIZEOF(buf), TranslateTS(_T("The profile '%s' already exists. Do you want to move it to the ")
_T("Recycle Bin? \n\nWARNING: The profile will be deleted if Recycle Bin is disabled.\n")
- _T("WARNING: A profile may contain confidential information and should be properly deleted.")), file );
- if ( MessageBox(hwndDlg, buf, TranslateT("The profile already exists"), MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2) != IDYES )
+ _T("WARNING: A profile may contain confidential information and should be properly deleted.")), file);
+ if (MessageBox(hwndDlg, buf, TranslateT("The profile already exists"), MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2) != IDYES)
return 0;
// move the file
@@ -394,7 +394,7 @@ int makeDatabase(TCHAR * profile, DATABASELINK * link, HWND hwndDlg) sf.pFrom = buf;
sf.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
mir_sntprintf(buf, SIZEOF(buf), _T("%s\0"), profile);
- if ( SHFileOperation(&sf) != 0 ) {
+ if (SHFileOperation(&sf) != 0) {
mir_sntprintf(buf, SIZEOF(buf), TranslateT("Couldn't move '%s' to the Recycle Bin, Please select another profile name."), file);
MessageBox(0, buf, TranslateT("Problem moving profile"), MB_ICONINFORMATION|MB_OK);
return 0;
@@ -419,24 +419,24 @@ int makeDatabase(TCHAR * profile, DATABASELINK * link, HWND hwndDlg) // enumerate all plugins that had valid DatabasePluginInfo()
static int FindDbPluginForProfile(const char*, DATABASELINK * dblink, LPARAM lParam)
{
- TCHAR* tszProfile = ( TCHAR* )lParam;
+ TCHAR* tszProfile = (TCHAR*)lParam;
int res = DBPE_CONT;
- if ( dblink && dblink->cbSize == sizeof(DATABASELINK)) {
+ if (dblink && dblink->cbSize == sizeof(DATABASELINK)) {
char* szProfile = makeFileName(tszProfile);
// liked the profile?
int err = 0;
if (dblink->grokHeader(szProfile, &err) == 0) {
// added APIs?
if ( !dblink->Load(szProfile, &pluginCoreLink)) {
- fillProfileName( tszProfile );
+ fillProfileName(tszProfile);
res = DBPE_DONE;
}
else res = DBPE_HALT;
}
else {
res = DBPE_HALT;
- switch ( err ) {
+ switch (err) {
case EGROKPRF_CANTREAD:
case EGROKPRF_UNKHEADER:
// just not supported.
@@ -455,18 +455,18 @@ static int FindDbPluginForProfile(const char*, DATABASELINK * dblink, LPARAM lPa // enumerate all plugins that had valid DatabasePluginInfo()
static int FindDbPluginAutoCreate(const char*, DATABASELINK * dblink, LPARAM lParam)
{
- TCHAR* tszProfile = ( TCHAR* )lParam;
+ TCHAR* tszProfile = (TCHAR*)lParam;
int res = DBPE_CONT;
if (dblink && dblink->cbSize == sizeof(DATABASELINK)) {
- CreatePathToFileT( tszProfile );
+ CreatePathToFileT(tszProfile);
int err;
- char *szProfile = makeFileName( tszProfile );
+ char *szProfile = makeFileName(tszProfile);
if (dblink->makeDatabase(szProfile, &err) == 0) {
dbCreated = true;
if ( !dblink->Load(szProfile, &pluginCoreLink)) {
- fillProfileName( tszProfile );
+ fillProfileName(tszProfile);
res = DBPE_DONE;
}
else res = DBPE_HALT;
@@ -488,8 +488,8 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) TCHAR classname[256];
ENUMMIRANDAWINDOW * x = (ENUMMIRANDAWINDOW *)lParam;
DWORD_PTR res=0;
- if ( GetClassName(hwnd, classname, SIZEOF(classname)) && lstrcmp( _T("Miranda"), classname) == 0 ) {
- if ( SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res ) {
+ if (GetClassName(hwnd, classname, SIZEOF(classname)) && lstrcmp(_T("Miranda"), classname) == 0) {
+ if (SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res) {
x->found++;
return FALSE;
}
@@ -501,7 +501,7 @@ static int FindMirandaForProfile(TCHAR * szProfile) {
ENUMMIRANDAWINDOW x={0};
x.profile=szProfile;
- x.msg=RegisterWindowMessage( _T( "Miranda::ProcessProfile" ));
+ x.msg=RegisterWindowMessage(_T("Miranda::ProcessProfile"));
x.aPath=GlobalAddAtom(szProfile);
EnumWindows(EnumMirandaWindows, (LPARAM)&x);
GlobalDeleteAtom(x.aPath);
@@ -519,17 +519,17 @@ int LoadDatabaseModule(void) InitUtils();
// find out which profile to load
- if ( !getProfile( szProfile, SIZEOF( szProfile )))
+ if ( !getProfile(szProfile, SIZEOF(szProfile)))
return 1;
PLUGIN_DB_ENUM dbe;
dbe.cbSize = sizeof(PLUGIN_DB_ENUM);
dbe.lParam = (LPARAM)szProfile;
- if ( _taccess(szProfile, 0) && shouldAutoCreate( szProfile ))
- dbe.pfnEnumCallback=( int(*) (const char*, void*, LPARAM) )FindDbPluginAutoCreate;
+ if (_taccess(szProfile, 0) && shouldAutoCreate(szProfile))
+ dbe.pfnEnumCallback=(int(*) (const char*, void*, LPARAM))FindDbPluginAutoCreate;
else
- dbe.pfnEnumCallback=( int(*) (const char*, void*, LPARAM) )FindDbPluginForProfile;
+ dbe.pfnEnumCallback=(int(*) (const char*, void*, LPARAM))FindDbPluginForProfile;
// find a driver to support the given profile
bool retry;
@@ -537,12 +537,12 @@ int LoadDatabaseModule(void) do {
retry = false;
rc = CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe);
- switch ( rc ) {
+ switch (rc) {
case -1: {
// no plugins at all
TCHAR buf[256];
TCHAR* p = _tcsrchr(szProfile, '\\');
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile );
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile);
MessageBox(0, buf, TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR);
break;
}
@@ -555,7 +555,7 @@ int LoadDatabaseModule(void) mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile);
MessageBox(0, buf, TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR);
}
- else if (!FindMirandaForProfile(szProfile)) {
+ else if ( !FindMirandaForProfile(szProfile)) {
TCHAR buf[256];
TCHAR* p = _tcsrchr(szProfile, '\\');
mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile);
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index ce01d20dc8..e8836114c1 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -41,11 +41,11 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa const TCHAR *pszSecurityInfo;
GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, SIZEOF(szSecurity), mirandabootini);
- if (!lstrcmpi(szSecurity, _T("all")))
+ if ( !lstrcmpi(szSecurity, _T("all")))
pszSecurityInfo = LPGENT("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
- else if (!lstrcmpi(szSecurity, _T("onlyunsafe")))
+ else if ( !lstrcmpi(szSecurity, _T("onlyunsafe")))
pszSecurityInfo = LPGENT("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
- else if (!lstrcmpi(szSecurity, _T("none")))
+ else if ( !lstrcmpi(szSecurity, _T("none")))
pszSecurityInfo = LPGENT("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
else pszSecurityInfo = NULL;
if (pszSecurityInfo) SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo));
@@ -78,9 +78,9 @@ static bool IsInSpaceSeparatedList(const char *szWord, const char *szList) for (szItem = szList;;) {
szEnd = strchr(szItem, ' ');
if (szEnd == NULL)
- return !lstrcmpA( szItem, szWord );
- if ( szEnd - szItem == wordLen ) {
- if ( !strncmp( szItem, szWord, wordLen ))
+ return !lstrcmpA(szItem, szWord);
+ if (szEnd - szItem == wordLen) {
+ if ( !strncmp(szItem, szWord, wordLen))
return true;
}
szItem = szEnd+1;
@@ -197,13 +197,13 @@ void ConvertBackslashes(char *, UINT); static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN)
{
FILE *fp = _tfopen(szIniPath, _T("rt"));
- if ( fp == NULL )
+ if (fp == NULL)
return;
bool warnThisSection = false;
char szSection[128]; szSection[0] = 0;
- while (!feof(fp)) {
+ while ( !feof(fp)) {
char szLine[2048];
if (fgets(szLine, sizeof(szLine), fp) == NULL)
break;
@@ -270,7 +270,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf continue;
char *szValue=strchr(szLine, '=');
- if ( szValue == NULL )
+ if (szValue == NULL)
continue;
char szName[128];
@@ -376,15 +376,15 @@ static void DoAutoExec(void) int secur;
GetPrivateProfileString(_T("AutoExec"), _T("Use"), _T("prompt"), szUse, SIZEOF(szUse), mirandabootini);
- if (!lstrcmpi(szUse, _T("no"))) return;
+ if ( !lstrcmpi(szUse, _T("no"))) return;
GetPrivateProfileString(_T("AutoExec"), _T("Safe"), _T("CLC Icons CLUI CList SkinSounds"), buf, SIZEOF(buf), mirandabootini);
szSafeSections = mir_t2a(buf);
GetPrivateProfileString(_T("AutoExec"), _T("Unsafe"), _T("ICQ MSN"), buf, SIZEOF(buf), mirandabootini);
szUnsafeSections = mir_t2a(buf);
GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, SIZEOF(szSecurity), mirandabootini);
- if (!lstrcmpi(szSecurity, _T("none"))) secur = 0;
- else if (!lstrcmpi(szSecurity, _T("notsafe"))) secur = 1;
- else if (!lstrcmpi(szSecurity, _T("onlyunsafe"))) secur = 2;
+ if ( !lstrcmpi(szSecurity, _T("none"))) secur = 0;
+ else if ( !lstrcmpi(szSecurity, _T("notsafe"))) secur = 1;
+ else if ( !lstrcmpi(szSecurity, _T("onlyunsafe"))) secur = 2;
GetPrivateProfileString(_T("AutoExec"), _T("OverrideSecurityFilename"), _T(""), szOverrideSecurityFilename, SIZEOF(szOverrideSecurityFilename), mirandabootini);
GetPrivateProfileString(_T("AutoExec"), _T("OnCreateFilename"), _T(""), szOnCreateFilename, SIZEOF(szOnCreateFilename), mirandabootini);
@@ -418,7 +418,7 @@ static void DoAutoExec(void) bool secFN = lstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
- if (!lstrcmpi(szUse, _T("prompt")) && !secFN) {
+ if ( !lstrcmpi(szUse, _T("prompt")) && !secFN) {
int result=DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
if (result == IDC_NOTOALL) break;
if (result == IDCANCEL) continue;
@@ -431,9 +431,9 @@ static void DoAutoExec(void) else {
TCHAR szOnCompletion[8];
GetPrivateProfileString(_T("AutoExec"), _T("OnCompletion"), _T("recycle"), szOnCompletion, SIZEOF(szOnCompletion), mirandabootini);
- if (!lstrcmpi(szOnCompletion, _T("delete")))
+ if ( !lstrcmpi(szOnCompletion, _T("delete")))
DeleteFile(szIniPath);
- else if (!lstrcmpi(szOnCompletion, _T("recycle"))) {
+ else if ( !lstrcmpi(szOnCompletion, _T("recycle"))) {
SHFILEOPSTRUCT shfo={0};
shfo.wFunc=FO_DELETE;
shfo.pFrom=szIniPath;
@@ -441,7 +441,7 @@ static void DoAutoExec(void) shfo.fFlags=FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
- else if (!lstrcmpi(szOnCompletion, _T("rename"))) {
+ else if ( !lstrcmpi(szOnCompletion, _T("rename"))) {
TCHAR szRenamePrefix[MAX_PATH];
TCHAR szNewPath[MAX_PATH];
GetPrivateProfileString(_T("AutoExec"), _T("RenamePrefix"), _T("done_"), szRenamePrefix, SIZEOF(szRenamePrefix), mirandabootini);
@@ -450,7 +450,7 @@ static void DoAutoExec(void) lstrcat(szNewPath, fd.cFileName);
MoveFile(szIniPath, szNewPath);
}
- else if (!lstrcmpi(szOnCompletion, _T("ask")))
+ else if ( !lstrcmpi(szOnCompletion, _T("ask")))
DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath);
}
} while (FindNextFile(hFind, &fd));
@@ -484,7 +484,7 @@ int InitIni(void) void UninitIni(void)
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
CallService(MS_SYSTEM_REMOVEWAIT, (WPARAM)hIniChangeNotification, 0);
FindCloseChangeNotification(hIniChangeNotification);
}
diff --git a/src/modules/database/dblists.cpp b/src/modules/database/dblists.cpp index c4dabf8fae..1dd802c196 100644 --- a/src/modules/database/dblists.cpp +++ b/src/modules/database/dblists.cpp @@ -25,10 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* a simple sorted list implementation */
-SortedList* List_Create( int p_limit, int p_increment )
+SortedList* List_Create(int p_limit, int p_increment)
{
- SortedList* result = ( SortedList* )mir_calloc( sizeof( SortedList ));
- if ( result == NULL )
+ SortedList* result = (SortedList*)mir_calloc(sizeof(SortedList));
+ if (result == NULL)
return(NULL);
result->increment = p_increment;
@@ -36,34 +36,34 @@ SortedList* List_Create( int p_limit, int p_increment ) return(result);
}
-void List_Destroy( SortedList* p_list )
+void List_Destroy(SortedList* p_list)
{
- if ( p_list == NULL )
+ if (p_list == NULL)
return;
- if ( p_list->items != NULL ) {
- mir_free( p_list->items );
+ if (p_list->items != NULL) {
+ mir_free(p_list->items);
p_list->items = NULL;
}
p_list->realCount = p_list->limit = 0;
}
-void* List_Find( SortedList* p_list, void* p_value )
+void* List_Find(SortedList* p_list, void* p_value)
{
int index;
- if ( !List_GetIndex( p_list, p_value, &index ))
+ if ( !List_GetIndex(p_list, p_value, &index))
return(NULL);
return(p_list->items[ index ]);
}
#ifdef _DEBUG
-#pragma optimize( "gt", on )
+#pragma optimize("gt", on)
#endif
-int List_GetIndex( SortedList* p_list, void* p_value, int* p_index )
+int List_GetIndex(SortedList* p_list, void* p_value, int* p_index)
{
if (p_value == NULL)
{
@@ -184,36 +184,36 @@ int List_GetIndex( SortedList* p_list, void* p_value, int* p_index ) return 0;
}
-int List_IndexOf( SortedList* p_list, void* p_value )
+int List_IndexOf(SortedList* p_list, void* p_value)
{
- if ( p_value == NULL )
+ if (p_value == NULL)
return -1;
int i;
- for ( i=0; i < p_list->realCount; i++ )
- if ( p_list->items[i] == p_value )
+ for (i=0; i < p_list->realCount; i++)
+ if (p_list->items[i] == p_value)
return i;
return -1;
}
#ifdef _DEBUG
-#pragma optimize( "", on )
+#pragma optimize("", on)
#endif
-int List_Insert( SortedList* p_list, void* p_value, int p_index)
+int List_Insert(SortedList* p_list, void* p_value, int p_index)
{
- if ( p_value == NULL || p_index > p_list->realCount )
+ if (p_value == NULL || p_index > p_list->realCount)
return 0;
- if ( p_list->realCount == p_list->limit )
+ if (p_list->realCount == p_list->limit)
{
- p_list->items = ( void** )mir_realloc( p_list->items, sizeof( void* )*(p_list->realCount + p_list->increment));
+ p_list->items = (void**)mir_realloc(p_list->items, sizeof(void*)*(p_list->realCount + p_list->increment));
p_list->limit += p_list->increment;
}
- if ( p_index < p_list->realCount )
- memmove( p_list->items+p_index+1, p_list->items+p_index, sizeof( void* )*( p_list->realCount-p_index ));
+ if (p_index < p_list->realCount)
+ memmove(p_list->items+p_index+1, p_list->items+p_index, sizeof(void*)*(p_list->realCount-p_index));
p_list->realCount++;
@@ -221,62 +221,62 @@ int List_Insert( SortedList* p_list, void* p_value, int p_index) return 1;
}
-int List_InsertPtr( SortedList* list, void* p )
+int List_InsertPtr(SortedList* list, void* p)
{
- if ( p == NULL )
+ if (p == NULL)
return -1;
int idx = list->realCount;
- List_GetIndex( list, p, &idx );
- return List_Insert( list, p, idx );
+ List_GetIndex(list, p, &idx);
+ return List_Insert(list, p, idx);
}
-int List_Remove( SortedList* p_list, int index )
+int List_Remove(SortedList* p_list, int index)
{
- if ( index < 0 || index > p_list->realCount )
+ if (index < 0 || index > p_list->realCount)
return(0);
p_list->realCount--;
- if ( p_list->realCount > index )
+ if (p_list->realCount > index)
{
- memmove( p_list->items+index, p_list->items+index+1, sizeof( void* )*( p_list->realCount-index ));
+ memmove(p_list->items+index, p_list->items+index+1, sizeof(void*)*(p_list->realCount-index));
p_list->items[ p_list->realCount ] = NULL;
}
return 1;
}
-int List_RemovePtr( SortedList* list, void* p )
+int List_RemovePtr(SortedList* list, void* p)
{
int idx = -1;
- if ( List_GetIndex( list, p, &idx ))
- List_Remove( list, idx );
+ if (List_GetIndex(list, p, &idx))
+ List_Remove(list, idx);
return idx;
}
-void List_Copy( SortedList* s, SortedList* d, size_t itemSize )
+void List_Copy(SortedList* s, SortedList* d, size_t itemSize)
{
int i;
d->increment = s->increment;
d->sortFunc = s->sortFunc;
- for ( i = 0; i < s->realCount; i++ ) {
- void* item = mir_alloc( itemSize );
- memcpy( item, s->items[i], itemSize );
- List_Insert( d, item, i );
+ for (i = 0; i < s->realCount; i++) {
+ void* item = mir_alloc(itemSize);
+ memcpy(item, s->items[i], itemSize);
+ List_Insert(d, item, i);
} }
-void List_ObjCopy( SortedList* s, SortedList* d, size_t itemSize )
+void List_ObjCopy(SortedList* s, SortedList* d, size_t itemSize)
{
int i;
d->increment = s->increment;
d->sortFunc = s->sortFunc;
- for ( i = 0; i < s->realCount; i++ ) {
+ for (i = 0; i < s->realCount; i++) {
void* item = new char[ itemSize ];
- memcpy( item, s->items[i], itemSize );
- List_Insert( d, item, i );
+ memcpy(item, s->items[i], itemSize);
+ List_Insert(d, item, i);
} }
diff --git a/src/modules/database/dblists.h b/src/modules/database/dblists.h index 160e45eca3..8975f37275 100644 --- a/src/modules/database/dblists.h +++ b/src/modules/database/dblists.h @@ -23,17 +23,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* a simple sorted list implementation */
-SortedList* List_Create( int, int );
-void List_Destroy( SortedList* );
+SortedList* List_Create(int, int);
+void List_Destroy(SortedList*);
-void* List_Find( SortedList*, void* );
-int List_GetIndex( SortedList*, void*, int* );
-int List_Insert( SortedList*, void*, int );
-int List_Remove( SortedList*, int );
-int List_IndexOf( SortedList*, void* );
+void* List_Find(SortedList*, void*);
+int List_GetIndex(SortedList*, void*, int*);
+int List_Insert(SortedList*, void*, int);
+int List_Remove(SortedList*, int);
+int List_IndexOf(SortedList*, void*);
-int List_InsertPtr( SortedList* list, void* p );
-int List_RemovePtr( SortedList* list, void* p );
+int List_InsertPtr(SortedList* list, void* p);
+int List_RemovePtr(SortedList* list, void* p);
-void List_Copy( SortedList*, SortedList*, size_t );
-void List_ObjCopy( SortedList*, SortedList*, size_t );
+void List_Copy(SortedList*, SortedList*, size_t);
+void List_ObjCopy(SortedList*, SortedList*, size_t);
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 6cad16035b..dede30691b 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -24,51 +24,51 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "profilemanager.h"
-static int CompareEventTypes( const DBEVENTTYPEDESCR* p1, const DBEVENTTYPEDESCR* p2 )
+static int CompareEventTypes(const DBEVENTTYPEDESCR* p1, const DBEVENTTYPEDESCR* p2)
{
- int result = strcmp( p1->module, p2->module );
- if ( result )
+ int result = strcmp(p1->module, p2->module);
+ if (result)
return result;
return p1->eventType - p2->eventType;
}
-static LIST<DBEVENTTYPEDESCR> eventTypes( 10, CompareEventTypes );
+static LIST<DBEVENTTYPEDESCR> eventTypes(10, CompareEventTypes);
static BOOL bModuleInitialized = FALSE;
static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam)
{
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )lParam;
- if ( eventTypes.getIndex( et ) == -1 ) {
- DBEVENTTYPEDESCR* p = ( DBEVENTTYPEDESCR* )mir_alloc( sizeof( DBEVENTTYPEDESCR ));
+ DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)lParam;
+ if (eventTypes.getIndex(et) == -1) {
+ DBEVENTTYPEDESCR* p = (DBEVENTTYPEDESCR*)mir_alloc(sizeof(DBEVENTTYPEDESCR));
p->cbSize = DBEVENTTYPEDESCR_SIZE;
- p->module = mir_strdup( et->module );
+ p->module = mir_strdup(et->module);
p->eventType = et->eventType;
- p->descr = mir_strdup( et->descr );
+ p->descr = mir_strdup(et->descr);
p->textService = NULL;
p->iconService = NULL;
p->eventIcon = NULL;
p->flags = 0;
- if ( et->cbSize == DBEVENTTYPEDESCR_SIZE ) {
- if ( et->textService )
- p->textService = mir_strdup( et->textService );
- if ( et->iconService )
- p->iconService = mir_strdup( et->iconService );
+ if (et->cbSize == DBEVENTTYPEDESCR_SIZE) {
+ if (et->textService)
+ p->textService = mir_strdup(et->textService);
+ if (et->iconService)
+ p->iconService = mir_strdup(et->iconService);
p->eventIcon = et->eventIcon;
p->flags = et->flags;
}
- if ( !p->textService ) {
+ if ( !p->textService) {
char szServiceName[100];
- mir_snprintf( szServiceName, sizeof(szServiceName), "%s/GetEventText%d", p->module, p->eventType );
- p->textService = mir_strdup( szServiceName );
+ mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventText%d", p->module, p->eventType);
+ p->textService = mir_strdup(szServiceName);
}
- if ( !p->iconService ) {
+ if ( !p->iconService) {
char szServiceName[100];
- mir_snprintf( szServiceName, sizeof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType );
- p->iconService = mir_strdup( szServiceName );
+ mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType);
+ p->iconService = mir_strdup(szServiceName);
}
- eventTypes.insert( p );
+ eventTypes.insert(p);
}
return 0;
@@ -79,12 +79,12 @@ static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam) DBEVENTTYPEDESCR tmp;
int idx;
- tmp.module = ( char* )wParam;
+ tmp.module = (char*)wParam;
tmp.eventType = lParam;
- if ( !List_GetIndex(( SortedList* )&eventTypes, &tmp, &idx ))
+ if ( !List_GetIndex((SortedList*)&eventTypes, &tmp, &idx))
return 0;
- return ( INT_PTR )eventTypes[idx];
+ return (INT_PTR)eventTypes[idx];
}
static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
@@ -93,147 +93,147 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) BOOL bIsDenyUnicode = (egt->datatype & DBVTF_DENYUNICODE);
DBEVENTINFO* dbei = egt->dbei;
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet(( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)DbEventTypeGet((WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- if ( et && ServiceExists( et->textService ))
- return CallService( et->textService, wParam, lParam );
+ if (et && ServiceExists(et->textService))
+ return CallService(et->textService, wParam, lParam);
- if ( !dbei->pBlob ) return 0;
+ if ( !dbei->pBlob) return 0;
- if ( dbei->eventType == EVENTTYPE_FILE ) {
+ if (dbei->eventType == EVENTTYPE_FILE) {
char* filename = ((char *)dbei->pBlob) + sizeof(DWORD);
- char* descr = filename + lstrlenA( filename ) + 1;
+ char* descr = filename + lstrlenA(filename) + 1;
char* str = (*descr == 0) ? filename : descr;
- switch ( egt->datatype ) {
+ switch (egt->datatype) {
case DBVT_WCHAR:
- return ( INT_PTR )(( dbei->flags & DBEF_UTF ) ?
- Utf8DecodeT( str ) : mir_a2t( str ));
+ return (INT_PTR)((dbei->flags & DBEF_UTF) ?
+ Utf8DecodeT(str) : mir_a2t(str));
case DBVT_ASCIIZ:
- return ( INT_PTR )(( dbei->flags & DBEF_UTF ) ? Utf8Decode( mir_strdup( str ), NULL ) : mir_strdup( str ));
+ return (INT_PTR)((dbei->flags & DBEF_UTF) ? Utf8Decode(mir_strdup(str), NULL) : mir_strdup(str));
}
return 0;
}
// temporary fix for bug with event types conflict between jabber chat states notifications
// and srmm's status changes, must be commented out in future releases
- if ( dbei->eventType == 25368 && dbei->cbBlob == 1 && dbei->pBlob[0] == 1 )
+ if (dbei->eventType == 25368 && dbei->cbBlob == 1 && dbei->pBlob[0] == 1)
return 0;
egt->datatype &= ~DBVTF_DENYUNICODE;
- if ( egt->datatype == DBVT_WCHAR )
+ if (egt->datatype == DBVT_WCHAR)
{
WCHAR* msg = NULL;
- if ( dbei->flags & DBEF_UTF ) {
+ if (dbei->flags & DBEF_UTF) {
char* str = (char*)alloca(dbei->cbBlob + 1);
if (str == NULL) return NULL;
memcpy(str, dbei->pBlob, dbei->cbBlob);
str[dbei->cbBlob] = 0;
- Utf8DecodeCP( str, egt->codepage, &msg );
+ Utf8DecodeCP(str, egt->codepage, &msg);
}
else {
- size_t msglen = strlen(( char* )dbei->pBlob) + 1, msglenW = 0;
- if ( msglen != dbei->cbBlob ) {
- size_t i, count = (( dbei->cbBlob - msglen ) / sizeof( WCHAR ));
- WCHAR* p = ( WCHAR* )&dbei->pBlob[ msglen ];
- for ( i=0; i < count; i++ ) {
- if ( p[i] == 0 ) {
+ size_t msglen = strlen((char*)dbei->pBlob) + 1, msglenW = 0;
+ if (msglen != dbei->cbBlob) {
+ size_t i, count = ((dbei->cbBlob - msglen) / sizeof(WCHAR));
+ WCHAR* p = (WCHAR*)&dbei->pBlob[ msglen ];
+ for (i=0; i < count; i++) {
+ if (p[i] == 0) {
msglenW = i;
break;
} } }
- if ( msglenW > 0 && msglenW < msglen && !bIsDenyUnicode )
- msg = mir_wstrdup(( WCHAR* )&dbei->pBlob[ msglen ] );
+ if (msglenW > 0 && msglenW < msglen && !bIsDenyUnicode)
+ msg = mir_wstrdup((WCHAR*)&dbei->pBlob[ msglen ]);
else {
- msg = ( WCHAR* )mir_alloc( sizeof(WCHAR) * msglen );
- MultiByteToWideChar( egt->codepage, 0, (char *) dbei->pBlob, -1, msg, (int)msglen );
+ msg = (WCHAR*)mir_alloc(sizeof(WCHAR) * msglen);
+ MultiByteToWideChar(egt->codepage, 0, (char *) dbei->pBlob, -1, msg, (int)msglen);
} }
- return ( INT_PTR )msg;
+ return (INT_PTR)msg;
}
- else if ( egt->datatype == DBVT_ASCIIZ ) {
- char* msg = mir_strdup(( char* )dbei->pBlob );
+ else if (egt->datatype == DBVT_ASCIIZ) {
+ char* msg = mir_strdup((char*)dbei->pBlob);
if (dbei->flags & DBEF_UTF)
- Utf8DecodeCP( msg, egt->codepage, NULL );
+ Utf8DecodeCP(msg, egt->codepage, NULL);
- return ( INT_PTR )msg;
+ return (INT_PTR)msg;
}
return 0;
}
-static INT_PTR DbEventGetIcon( WPARAM wParam, LPARAM lParam )
+static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO* dbei = ( DBEVENTINFO* )lParam;
+ DBEVENTINFO* dbei = (DBEVENTINFO*)lParam;
HICON icon = NULL;
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet(( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)DbEventTypeGet((WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- if ( et && ServiceExists( et->iconService )) {
- icon = ( HICON )CallService( et->iconService, wParam, lParam );
- if ( icon )
- return ( INT_PTR )icon;
+ if (et && ServiceExists(et->iconService)) {
+ icon = (HICON)CallService(et->iconService, wParam, lParam);
+ if (icon)
+ return (INT_PTR)icon;
}
- if ( et && et->eventIcon )
- icon = ( HICON )CallService( MS_SKIN2_GETICONBYHANDLE, 0, ( LPARAM )et->eventIcon );
- if ( !icon ) {
+ if (et && et->eventIcon)
+ icon = (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)et->eventIcon);
+ if ( !icon) {
char szName[100];
- mir_snprintf( szName, sizeof( szName ), "eventicon_%s%d", dbei->szModule, dbei->eventType );
- icon = ( HICON )CallService( MS_SKIN2_GETICON, 0, ( LPARAM )szName );
+ mir_snprintf(szName, sizeof(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType);
+ icon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szName);
}
- if ( !icon )
+ if ( !icon)
{
- switch( dbei->eventType ) {
+ switch(dbei->eventType) {
case EVENTTYPE_URL:
- icon = LoadSkinIcon( SKINICON_EVENT_URL );
+ icon = LoadSkinIcon(SKINICON_EVENT_URL);
break;
case EVENTTYPE_FILE:
- icon = LoadSkinIcon( SKINICON_EVENT_FILE );
+ icon = LoadSkinIcon(SKINICON_EVENT_FILE);
break;
default: // EVENTTYPE_MESSAGE and unknown types
- icon = LoadSkinIcon( SKINICON_EVENT_MESSAGE );
+ icon = LoadSkinIcon(SKINICON_EVENT_MESSAGE);
break;
}
}
- if ( wParam & LR_SHARED )
- return ( INT_PTR )icon;
+ if (wParam & LR_SHARED)
+ return (INT_PTR)icon;
else
- return ( INT_PTR )CopyIcon( icon );
+ return (INT_PTR)CopyIcon(icon);
}
-static INT_PTR DbEventGetStringT( WPARAM wParam, LPARAM lParam )
+static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO* dbei = ( DBEVENTINFO* )wParam;
- char* string = ( char* )lParam;
+ DBEVENTINFO* dbei = (DBEVENTINFO*)wParam;
+ char* string = (char*)lParam;
- if ( dbei->flags & DBEF_UTF )
- return ( INT_PTR )Utf8DecodeUcs2( string );
+ if (dbei->flags & DBEF_UTF)
+ return (INT_PTR)Utf8DecodeUcs2(string);
- return ( INT_PTR )mir_a2t( string );
+ return (INT_PTR)mir_a2t(string);
}
/////////////////////////////////////////////////////////////////////////////////////////
-static int sttEnumVars( const char* szVarName, LPARAM lParam )
+static int sttEnumVars(const char* szVarName, LPARAM lParam)
{
- LIST<char>* vars = ( LIST<char>* )lParam;
- vars->insert( mir_strdup( szVarName ));
+ LIST<char>* vars = (LIST<char>*)lParam;
+ vars->insert(mir_strdup(szVarName));
return 0;
}
-static INT_PTR DbDeleteModule( WPARAM, LPARAM lParam )
+static INT_PTR DbDeleteModule(WPARAM, LPARAM lParam)
{
- LIST<char> vars( 20 );
+ LIST<char> vars(20);
DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = sttEnumVars;
- dbces.lParam = ( LPARAM )&vars;
- dbces.szModule = ( char* )lParam;
- CallService( MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces );
+ dbces.lParam = (LPARAM)&vars;
+ dbces.szModule = (char*)lParam;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
- for ( int i=vars.getCount()-1; i >= 0; i-- ) {
- DBDeleteContactSetting( NULL, ( char* )lParam, vars[i] );
- mir_free( vars[i] );
+ for (int i=vars.getCount()-1; i >= 0; i--) {
+ DBDeleteContactSetting(NULL, (char*)lParam, vars[i]);
+ mir_free(vars[i]);
}
vars.destroy();
return 0;
@@ -241,14 +241,14 @@ static INT_PTR DbDeleteModule( WPARAM, LPARAM lParam ) static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam)
{
- if (!wParam || !lParam)
+ if ( !wParam || !lParam)
return 1;
char* dst = (char*)lParam;
- char* tmp = mir_t2a( g_profileDir );
- strncpy( dst, tmp, wParam );
- mir_free( tmp );
+ char* tmp = mir_t2a(g_profileDir);
+ strncpy(dst, tmp, wParam);
+ mir_free(tmp);
if (wParam <= _tcslen(g_profileName))
{
@@ -260,14 +260,14 @@ static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam) static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
{
- if (!wParam || !lParam)
+ if ( !wParam || !lParam)
return 1;
char* dst = (char*)lParam;
- char* tmp = makeFileName( g_profileName );
- strncpy( dst, tmp, wParam );
- mir_free( tmp );
+ char* tmp = makeFileName(g_profileName);
+ strncpy(dst, tmp, wParam);
+ mir_free(tmp);
if (wParam <= _tcslen(g_profileName))
{
@@ -279,7 +279,7 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) static INT_PTR GetProfilePathW(WPARAM wParam, LPARAM lParam)
{
- if (!wParam || !lParam)
+ if ( !wParam || !lParam)
return 1;
wchar_t* dst = (wchar_t*)lParam;
@@ -295,7 +295,7 @@ static INT_PTR GetProfilePathW(WPARAM wParam, LPARAM lParam) static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam)
{
wchar_t* dst = (wchar_t*)lParam;
- wcsncpy(dst, g_profileName, wParam );
+ wcsncpy(dst, g_profileName, wParam);
if (wParam <= wcslen(g_profileName))
{
dst[wParam - 1] = 0;
@@ -329,15 +329,15 @@ void UnloadEventsModule() {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
- for ( i=0; i < eventTypes.getCount(); i++ ) {
+ for (i=0; i < eventTypes.getCount(); i++) {
DBEVENTTYPEDESCR* p = eventTypes[i];
- mir_free( p->module );
- mir_free( p->descr );
- mir_free( p->textService );
- mir_free( p->iconService );
- mir_free( p );
+ mir_free(p->module);
+ mir_free(p->descr);
+ mir_free(p->textService);
+ mir_free(p->iconService);
+ mir_free(p);
}
eventTypes.destroy();
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 7d362fd554..e568aa778e 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -68,7 +68,7 @@ struct ProfileEnumData { extern TCHAR mirandabootini[MAX_PATH];
char **GetServiceModePluginsList(void);
-void SetServiceModePlugin( int idx );
+void SetServiceModePlugin(int idx);
static void ThemeDialogBackground(HWND hwnd)
{
@@ -84,22 +84,22 @@ static int findProfiles(TCHAR * szProfileDir, ENUMPROFILECALLBACK callback, LPAR TCHAR searchspec[MAX_PATH];
mir_sntprintf(searchspec, SIZEOF(searchspec), _T("%s\\*.*"), szProfileDir);
hFind = FindFirstFile(searchspec, &ffd);
- if ( hFind == INVALID_HANDLE_VALUE )
+ if (hFind == INVALID_HANDLE_VALUE)
return 0;
do {
// find all subfolders except "." and ".."
- if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T("..")) ) {
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T(".."))) {
TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\%s\\%s.dat"), szProfileDir, ffd.cFileName, ffd.cFileName);
if (_taccess(buf, 0) == 0) {
mir_sntprintf(profile, SIZEOF(profile), _T("%s.dat"), ffd.cFileName);
- if ( !callback(buf, profile, lParam ))
+ if ( !callback(buf, profile, lParam))
break;
}
}
}
- while ( FindNextFile(hFind, &ffd) );
+ while (FindNextFile(hFind, &ffd));
FindClose(hFind);
return 1;
@@ -107,8 +107,8 @@ static int findProfiles(TCHAR * szProfileDir, ENUMPROFILECALLBACK callback, LPAR static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if ( msg == WM_CHAR ) {
- if ( _tcschr( _T(".?/\\#' "), (TCHAR)wParam) != 0 )
+ if (msg == WM_CHAR) {
+ if (_tcschr(_T(".?/\\#' "), (TCHAR)wParam) != 0)
return 0;
PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0);
}
@@ -121,11 +121,11 @@ static int FindDbProviders(const char*, DATABASELINK * dblink, LPARAM lParam) HWND hwndCombo = GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS);
char szName[64];
- if ( dblink->getFriendlyName(szName, SIZEOF(szName), 1) == 0 ) {
+ if (dblink->getFriendlyName(szName, SIZEOF(szName), 1) == 0) {
// add to combo box
- TCHAR* p = LangPackPcharToTchar( szName );
- LRESULT index = SendMessage( hwndCombo, CB_ADDSTRING, 0, (LPARAM)p );
- mir_free( p );
+ TCHAR* p = LangPackPcharToTchar(szName);
+ LRESULT index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)p);
+ mir_free(p);
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)dblink);
}
return DBPE_CONT;
@@ -136,7 +136,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA struct DlgProfData * dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
dat = (struct DlgProfData *)lParam;
{
@@ -145,11 +145,11 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA dbe.cbSize = sizeof(dbe);
dbe.pfnEnumCallback = (int(*)(const char*, void*, LPARAM))FindDbProviders;
dbe.lParam = (LPARAM)hwndDlg;
- if ( CallService( MS_PLUGINS_ENUMDBPLUGINS, 0, ( LPARAM )&dbe ) == -1 ) {
+ if (CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe) == -1) {
// no plugins?!
- EnableWindow( GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS ), FALSE );
- EnableWindow( GetDlgItem(hwndDlg, IDC_PROFILENAME ), FALSE );
- ShowWindow( GetDlgItem(hwndDlg, IDC_NODBDRIVERS ), TRUE );
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILENAME), FALSE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_NODBDRIVERS), TRUE);
}
// default item
SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_SETCURSEL, 0, 0);
@@ -178,43 +178,43 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA }
// focus on the textbox
- PostMessage( hwndDlg, WM_FOCUSTEXTBOX, 0, 0 );
+ PostMessage(hwndDlg, WM_FOCUSTEXTBOX, 0, 0);
return TRUE;
case WM_FOCUSTEXTBOX:
- SetFocus( GetDlgItem( hwndDlg, IDC_PROFILENAME ));
+ SetFocus(GetDlgItem(hwndDlg, IDC_PROFILENAME));
break;
case WM_INPUTCHANGED: // when input in the edit box changes
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- EnableWindow( dat->hwndOK, GetWindowTextLength( GetDlgItem( hwndDlg, IDC_PROFILENAME )) > 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ EnableWindow(dat->hwndOK, GetWindowTextLength(GetDlgItem(hwndDlg, IDC_PROFILENAME)) > 0);
break;
case WM_SHOWWINDOW:
- if ( wParam ) {
- SetWindowText( dat->hwndOK, TranslateT("&Create"));
- SendMessage( hwndDlg, WM_INPUTCHANGED, 0, 0 );
+ if (wParam) {
+ SetWindowText(dat->hwndOK, TranslateT("&Create"));
+ SendMessage(hwndDlg, WM_INPUTCHANGED, 0, 0);
}
break;
case WM_NOTIFY:
{
- NMHDR* hdr = ( NMHDR* )lParam;
- if ( hdr && hdr->code == PSN_APPLY && dat && IsWindowVisible( hwndDlg )) {
+ NMHDR* hdr = (NMHDR*)lParam;
+ if (hdr && hdr->code == PSN_APPLY && dat && IsWindowVisible(hwndDlg)) {
TCHAR szName[MAX_PATH];
LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_GETCURSEL, 0, 0);
- if ( curSel == CB_ERR ) break; // should never happen
- GetDlgItemText(hwndDlg, IDC_PROFILENAME, szName, SIZEOF( szName ));
- if ( szName[0] == 0 )
+ if (curSel == CB_ERR) break; // should never happen
+ GetDlgItemText(hwndDlg, IDC_PROFILENAME, szName, SIZEOF(szName));
+ if (szName[0] == 0)
break;
// profile placed in "profile_name" subfolder
- mir_sntprintf( dat->pd->szProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), dat->pd->szProfileDir, szName, szName );
+ mir_sntprintf(dat->pd->szProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), dat->pd->szProfileDir, szName, szName);
dat->pd->newProfile = 1;
- dat->pd->dblink = (DATABASELINK *)SendDlgItemMessage( hwndDlg, IDC_PROFILEDRIVERS, CB_GETITEMDATA, ( WPARAM )curSel, 0 );
+ dat->pd->dblink = (DATABASELINK *)SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_GETITEMDATA, (WPARAM)curSel, 0);
- if ( makeDatabase( dat->pd->szProfile, dat->pd->dblink, hwndDlg ) == 0 ) {
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
+ if (makeDatabase(dat->pd->szProfile, dat->pd->dblink, hwndDlg) == 0) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
} } }
break;
}
@@ -226,11 +226,11 @@ static int DetectDbProvider(const char*, DATABASELINK * dblink, LPARAM lParam) {
int error;
-char* fullpath = makeFileName(( TCHAR* )lParam );
+char* fullpath = makeFileName((TCHAR*)lParam);
int ret = dblink->grokHeader(fullpath, &error);
- mir_free( fullpath );
- if ( ret == 0) {
+ mir_free(fullpath);
+ if (ret == 0) {
char tmp[ MAX_PATH ];
dblink->getFriendlyName(tmp, SIZEOF(tmp), 1);
@@ -254,20 +254,20 @@ BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam) TCHAR* p = _tcsrchr(profile, '.');
_tcscpy(sizeBuf, _T("0 KB"));
- if ( p != NULL ) *p=0;
+ if (p != NULL) *p=0;
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_IMAGE;
item.pszText = profile;
item.iItem = 0;
- if ( _tstat(fullpath, &statbuf) == 0) {
- if ( statbuf.st_size > 1000000 ) {
- mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0 );
+ if (_tstat(fullpath, &statbuf) == 0) {
+ if (statbuf.st_size > 1000000) {
+ mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0);
_tcscpy(sizeBuf+5, _T(" MB"));
}
else {
- mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0 );
+ mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0);
_tcscpy(sizeBuf+5, _T(" KB"));
}
bFileExists = TRUE;
@@ -277,16 +277,16 @@ BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam) item.iImage = bFileLocked;
- iItem = SendMessage( hwndList, LVM_INSERTITEM, 0, (LPARAM)&item );
- if ( lstrcmpi(ped->szProfile, fullpath) == 0 )
+ iItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
+ if (lstrcmpi(ped->szProfile, fullpath) == 0)
ListView_SetItemState(hwndList, iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
item.iItem = iItem;
item.iSubItem = 2;
item.pszText = sizeBuf;
- SendMessage( hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item );
+ SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item);
- if ( bFileExists ) {
+ if (bFileExists) {
PLUGIN_DB_ENUM dbe;
TCHAR szPath[MAX_PATH];
@@ -298,26 +298,26 @@ BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam) dbe.pfnEnumCallback = (int(*)(const char*, void*, LPARAM))DetectDbProvider;
dbe.lParam = (LPARAM)szPath;
_tcscpy(szPath, fullpath);
- if ( CallService( MS_PLUGINS_ENUMDBPLUGINS, 0, ( LPARAM )&dbe ) == 1 ) {
+ if (CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe) == 1) {
if (bFileLocked) {
// file locked
- item2.pszText = TranslateT( "<In Use>" );
+ item2.pszText = TranslateT("<In Use>");
item2.iSubItem = 1;
- SendMessage( hwndList, LVM_SETITEMTEXT, iItem, ( LPARAM )&item2 );
+ SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2);
}
else {
item.pszText = szPath;
item.iSubItem = 1;
- SendMessage( hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item );
+ SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item);
} }
item2.iSubItem = 3;
- item2.pszText = rtrim( _tctime( &statbuf.st_ctime ));
- SendMessage( hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2 );
+ item2.pszText = rtrim(_tctime(&statbuf.st_ctime));
+ SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2);
item2.iSubItem = 4;
- item2.pszText = rtrim( _tctime( &statbuf.st_mtime ));
- SendMessage( hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2 );
+ item2.pszText = rtrim(_tctime(&statbuf.st_mtime));
+ SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2);
}
return TRUE;
}
@@ -334,7 +334,7 @@ void DeleteProfile(HWND hwndList, int iItem, DlgProfData* dat) item.iItem = iItem;
item.pszText = profile;
item.cchTextMax = SIZEOF(profile);
- if (!ListView_GetItem(hwndList, &item))
+ if ( !ListView_GetItem(hwndList, &item))
return;
mir_sntprintf(profilef, SIZEOF(profilef), TranslateT("Are you sure you want to remove profile \"%s\"?"), profile);
@@ -363,7 +363,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, HIMAGELIST hImgList;
LVCOLUMN col;
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
dat = (DlgProfData*) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
@@ -372,23 +372,23 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, col.mask = LVCF_TEXT | LVCF_WIDTH;
col.pszText = TranslateT("Profile");
col.cx=122;
- ListView_InsertColumn( hwndList, 0, &col );
+ ListView_InsertColumn(hwndList, 0, &col);
col.pszText = TranslateT("Driver");
col.cx=100;
- ListView_InsertColumn( hwndList, 1, &col );
+ ListView_InsertColumn(hwndList, 1, &col);
col.pszText = TranslateT("Size");
col.cx=60;
- ListView_InsertColumn( hwndList, 2, &col );
+ ListView_InsertColumn(hwndList, 2, &col);
col.pszText = TranslateT("Created");
col.cx=145;
- ListView_InsertColumn( hwndList, 3, &col );
+ ListView_InsertColumn(hwndList, 3, &col);
col.pszText = TranslateT("Modified");
col.cx=145;
- ListView_InsertColumn( hwndList, 4, &col );
+ ListView_InsertColumn(hwndList, 4, &col);
// icons
hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 2, 1);
@@ -435,7 +435,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_SHOWWINDOW:
- if ( wParam )
+ if (wParam)
{
SetWindowText(dat->hwndOK, TranslateT("&Run"));
EnableWindow(dat->hwndOK, ListView_GetSelectedCount(hwndList) == 1);
@@ -529,7 +529,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct DetailsData* dat = ( struct DetailsData* )GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ struct DetailsData* dat = (struct DetailsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
@@ -541,9 +541,9 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0));
dat = (struct DetailsData*)mir_alloc(sizeof(struct DetailsData));
dat->prof = prof;
- prof->hwndOK = GetDlgItem( hwndDlg, IDOK );
- EnableWindow( prof->hwndOK, FALSE );
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, (LONG_PTR)dat );
+ prof->hwndOK = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(prof->hwndOK, FALSE);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
{
TCHAR buf[512];
@@ -558,72 +558,72 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, dat->currentPage = 0;
dat->pageCount = psh->nPages;
- dat->opd = ( struct DetailsPageData* )mir_calloc( sizeof( struct DetailsPageData )*dat->pageCount );
- odp = ( OPTIONSDIALOGPAGE* )psh->ppsp;
+ dat->opd = (struct DetailsPageData*)mir_calloc(sizeof(struct DetailsPageData)*dat->pageCount);
+ odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
tci.mask = TCIF_TEXT;
- for ( i=0; i < dat->pageCount; i++ ) {
+ for (i=0; i < dat->pageCount; i++) {
dat->opd[i].pTemplate = (DLGTEMPLATE *)LockResource(LoadResource(odp[i].hInstance, FindResourceA(odp[i].hInstance, odp[i].pszTemplate, MAKEINTRESOURCEA(5))));
dat->opd[i].dlgProc = odp[i].pfnDlgProc;
dat->opd[i].hInst = odp[i].hInstance;
dat->opd[i].hwnd = NULL;
dat->opd[i].changed = 0;
- tci.pszText = ( TCHAR* )odp[i].ptszTitle;
+ tci.pszText = (TCHAR*)odp[i].ptszTitle;
if (dat->prof->pd->noProfiles || shouldAutoCreate(dat->prof->pd->szProfile))
dat->currentPage = 1;
- TabCtrl_InsertItem( GetDlgItem(hwndDlg, IDC_TABS), i, &tci );
+ TabCtrl_InsertItem(GetDlgItem(hwndDlg, IDC_TABS), i, &tci);
} }
GetWindowRect(GetDlgItem(hwndDlg, IDC_TABS), &dat->rcDisplay);
TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_TABS), FALSE, &dat->rcDisplay);
{
POINT pt = {0, 0};
- ClientToScreen( hwndDlg, &pt );
- OffsetRect( &dat->rcDisplay, -pt.x, -pt.y );
+ ClientToScreen(hwndDlg, &pt);
+ OffsetRect(&dat->rcDisplay, -pt.x, -pt.y);
}
- TabCtrl_SetCurSel( GetDlgItem( hwndDlg, IDC_TABS ), dat->currentPage );
+ TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TABS), dat->currentPage);
dat->opd[dat->currentPage].hwnd = CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst, dat->opd[dat->currentPage].pTemplate, hwndDlg, dat->opd[dat->currentPage].dlgProc, (LPARAM)dat->prof);
- ThemeDialogBackground( dat->opd[dat->currentPage].hwnd );
- SetWindowPos( dat->opd[dat->currentPage].hwnd, HWND_TOP, dat->rcDisplay.left, dat->rcDisplay.top, 0, 0, SWP_NOSIZE );
+ ThemeDialogBackground(dat->opd[dat->currentPage].hwnd);
+ SetWindowPos(dat->opd[dat->currentPage].hwnd, HWND_TOP, dat->rcDisplay.left, dat->rcDisplay.top, 0, 0, SWP_NOSIZE);
{ PSHNOTIFY pshn;
pshn.hdr.code = PSN_INFOCHANGED;
pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
pshn.hdr.idFrom = 0;
- pshn.lParam = ( LPARAM )0;
- SendMessage( dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, ( LPARAM )&pshn );
+ pshn.lParam = (LPARAM)0;
+ SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
// service mode combobox
{
char **list = GetServiceModePluginsList();
- if ( !list ) {
- ShowWindow( GetDlgItem(hwndDlg, IDC_SM_LABEL ), FALSE );
- ShowWindow( GetDlgItem(hwndDlg, IDC_SM_COMBO ), FALSE );
+ if ( !list) {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SM_LABEL), FALSE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SM_COMBO), FALSE);
} else {
int i = 0;
LRESULT index;
- HWND hwndCombo = GetDlgItem(hwndDlg, IDC_SM_COMBO );
- index = SendMessage( hwndCombo, CB_ADDSTRING, 0, (LPARAM)_T("") );
- SendMessage( hwndCombo, CB_SETITEMDATA, index, (LPARAM)-1 );
- SendMessage( hwndCombo, CB_SETCURSEL, 0, 0);
- while ( list[i] ) {
- TCHAR *str = LangPackPcharToTchar( list[i] );
- index = SendMessage( hwndCombo, CB_ADDSTRING, 0, (LPARAM)str );
+ HWND hwndCombo = GetDlgItem(hwndDlg, IDC_SM_COMBO);
+ index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)_T(""));
+ SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)-1);
+ SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
+ while (list[i]) {
+ TCHAR *str = LangPackPcharToTchar(list[i]);
+ index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)str);
mir_free(str);
- SendMessage( hwndCombo, CB_SETITEMDATA, index, (LPARAM)i );
+ SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)i);
i++;
}
mir_free(list);
}
}
- ShowWindow( dat->opd[dat->currentPage].hwnd, SW_SHOW );
+ ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW);
return TRUE;
}
case WM_CTLCOLORSTATIC:
- switch ( GetDlgCtrlID(( HWND )lParam )) {
+ switch (GetDlgCtrlID((HWND)lParam)) {
case IDC_WHITERECT:
- SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW ));
- return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW );
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
}
break;
@@ -638,9 +638,9 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, pshn.hdr.code = PSN_INFOCHANGED;
pshn.hdr.idFrom = 0;
pshn.lParam = (LPARAM)0;
- for ( i=0; i < dat->pageCount; i++ ) {
+ for (i=0; i < dat->pageCount; i++) {
pshn.hdr.hwndFrom = dat->opd[i].hwnd;
- if ( dat->opd[i].hwnd != NULL )
+ if (dat->opd[i].hwnd != NULL)
SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
break;
@@ -651,25 +651,25 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, switch(((LPNMHDR)lParam)->code) {
case TCN_SELCHANGING:
{ PSHNOTIFY pshn;
- if ( dat->currentPage == -1 || dat->opd[dat->currentPage].hwnd == NULL )
+ if (dat->currentPage == -1 || dat->opd[dat->currentPage].hwnd == NULL)
break;
pshn.hdr.code = PSN_KILLACTIVE;
pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
pshn.hdr.idFrom = 0;
pshn.lParam = 0;
- if ( SendMessage( dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, ( LPARAM )&pshn )) {
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, TRUE );
+ if (SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn)) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
break;
}
case TCN_SELCHANGE:
- if ( dat->currentPage != -1 && dat->opd[dat->currentPage].hwnd != NULL )
- ShowWindow( dat->opd[ dat->currentPage ].hwnd, SW_HIDE );
+ if (dat->currentPage != -1 && dat->opd[dat->currentPage].hwnd != NULL)
+ ShowWindow(dat->opd[ dat->currentPage ].hwnd, SW_HIDE);
dat->currentPage = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS));
- if ( dat->currentPage != -1 ) {
- if ( dat->opd[dat->currentPage].hwnd == NULL ) {
+ if (dat->currentPage != -1) {
+ if (dat->opd[dat->currentPage].hwnd == NULL) {
PSHNOTIFY pshn;
dat->opd[dat->currentPage].hwnd=CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst, dat->opd[dat->currentPage].pTemplate, hwndDlg, dat->opd[dat->currentPage].dlgProc, (LPARAM)dat->prof);
ThemeDialogBackground(dat->opd[dat->currentPage].hwnd);
@@ -706,7 +706,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case IDC_REMOVE:
- if (!dat->prof->pd->noProfiles) {
+ if ( !dat->prof->pd->noProfiles) {
HWND hwndList = GetDlgItem(dat->opd[0].hwnd, IDC_PROFILELIST);
DeleteProfile(hwndList, ListView_GetNextItem(hwndList, -1, LVNI_SELECTED | LVNI_ALL), dat->prof);
}
@@ -718,26 +718,26 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, PSHNOTIFY pshn;
pshn.hdr.idFrom=0;
pshn.lParam=(LPARAM)0;
- if ( dat->currentPage != -1 ) {
+ if (dat->currentPage != -1) {
pshn.hdr.code = PSN_KILLACTIVE;
pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
- if ( SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, ( LPARAM )&pshn ))
+ if (SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn))
break;
}
pshn.hdr.code=PSN_APPLY;
- for ( i=0; i < dat->pageCount; i++ ) {
- if ( dat->opd[i].hwnd == NULL || !dat->opd[i].changed )
+ for (i=0; i < dat->pageCount; i++) {
+ if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed)
continue;
pshn.hdr.hwndFrom = dat->opd[i].hwnd;
- SendMessage( dat->opd[i].hwnd, WM_NOTIFY, 0, ( LPARAM )&pshn );
- if ( GetWindowLongPtr( dat->opd[i].hwnd, DWLP_MSGRESULT ) == PSNRET_INVALID_NOCHANGEPAGE) {
- TabCtrl_SetCurSel( GetDlgItem( hwndDlg, IDC_TABS ), i );
- if ( dat->currentPage != -1 )
- ShowWindow( dat->opd[ dat->currentPage ].hwnd, SW_HIDE );
+ SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
+ if (GetWindowLongPtr(dat->opd[i].hwnd, DWLP_MSGRESULT) == PSNRET_INVALID_NOCHANGEPAGE) {
+ TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TABS), i);
+ if (dat->currentPage != -1)
+ ShowWindow(dat->opd[ dat->currentPage ].hwnd, SW_HIDE);
dat->currentPage = i;
- ShowWindow( dat->opd[dat->currentPage].hwnd, SW_SHOW );
+ ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW);
return 0;
} }
EndDialog(hwndDlg, 1);
@@ -748,21 +748,21 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_DESTROY:
{
LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_SM_COMBO, CB_GETCURSEL, 0, 0);
- if ( curSel != CB_ERR ) {
- int idx = SendDlgItemMessage( hwndDlg, IDC_SM_COMBO, CB_GETITEMDATA, ( WPARAM )curSel, 0 );
+ if (curSel != CB_ERR) {
+ int idx = SendDlgItemMessage(hwndDlg, IDC_SM_COMBO, CB_GETITEMDATA, (WPARAM)curSel, 0);
SetServiceModePlugin(idx);
}
}
- DestroyIcon(( HICON )SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- DestroyIcon(( HICON )SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
- DeleteObject( dat->hBoldFont );
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ DeleteObject(dat->hBoldFont);
{ int i;
- for ( i=0; i < dat->pageCount; i++ )
- if ( dat->opd[i].hwnd != NULL )
- DestroyWindow( dat->opd[i].hwnd );
+ for (i=0; i < dat->pageCount; i++)
+ if (dat->opd[i].hwnd != NULL)
+ DestroyWindow(dat->opd[i].hwnd);
}
- mir_free( dat->opd );
- mir_free( dat );
+ mir_free(dat->opd);
+ mir_free(dat);
break;
}
return FALSE;
@@ -770,10 +770,10 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, static int AddProfileManagerPage(struct DetailsPageInit * opi, OPTIONSDIALOGPAGE * odp)
{
- if ( odp->cbSize != sizeof( OPTIONSDIALOGPAGE ))
+ if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE))
return 1;
- opi->odp = ( OPTIONSDIALOGPAGE* )mir_realloc( opi->odp, sizeof( OPTIONSDIALOGPAGE )*( opi->pageCount+1 ));
+ opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1));
{
OPTIONSDIALOGPAGE* p = opi->odp + opi->pageCount++;
p->cbSize = sizeof(OPTIONSDIALOGPAGE);
@@ -785,8 +785,8 @@ static int AddProfileManagerPage(struct DetailsPageInit * opi, OPTIONSDIALOGPAGE p->groupPosition = odp->groupPosition;
p->hGroupIcon = odp->hGroupIcon;
p->hIcon = odp->hIcon;
- if (( DWORD_PTR )odp->pszTemplate & 0xFFFF0000 )
- p->pszTemplate = mir_strdup( odp->pszTemplate );
+ if ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000)
+ p->pszTemplate = mir_strdup(odp->pszTemplate);
else
p->pszTemplate = odp->pszTemplate;
}
@@ -827,15 +827,15 @@ int getProfileManager(PROFILEMANAGERDATA * pd) prof.psh = &psh;
int rc = DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_PROFILEMANAGER), NULL, DlgProfileManager, (LPARAM)&prof);
- if ( rc != -1 )
- for ( int i=0; i < opi.pageCount; i++ ) {
- mir_free(( char* )opi.odp[i].pszTitle );
- mir_free( opi.odp[i].pszGroup );
- if (( DWORD_PTR )opi.odp[i].pszTemplate & 0xFFFF0000 )
- mir_free(( char* )opi.odp[i].pszTemplate );
+ if (rc != -1)
+ for (int i=0; i < opi.pageCount; i++) {
+ mir_free((char*)opi.odp[i].pszTitle);
+ mir_free(opi.odp[i].pszGroup);
+ if ((DWORD_PTR)opi.odp[i].pszTemplate & 0xFFFF0000)
+ mir_free((char*)opi.odp[i].pszTemplate);
}
- if ( opi.odp != NULL )
+ if (opi.odp != NULL)
mir_free(opi.odp);
return rc;
diff --git a/src/modules/database/profilemanager.h b/src/modules/database/profilemanager.h index f132dfad84..9d4e7821e1 100644 --- a/src/modules/database/profilemanager.h +++ b/src/modules/database/profilemanager.h @@ -31,7 +31,7 @@ typedef struct { int InitUtils(void);
-char* makeFileName( const TCHAR* tszOriginalName );
+char* makeFileName(const TCHAR* tszOriginalName);
int makeDatabase(TCHAR * profile, DATABASELINK * link, HWND hwndDlg);
int getProfileManager(PROFILEMANAGERDATA * pd);
int getProfilePath(TCHAR * buf, size_t cch);
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 27ae355ae2..4763836180 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -119,7 +119,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) if (*throbbing) {
/* create memdc */
hMemDC=CreateCompatibleDC(0);
- hBitmap=( HBITMAP )SelectObject(hMemDC, CreateCompatibleBitmap(hdc, width, height));
+ hBitmap=(HBITMAP)SelectObject(hMemDC, CreateCompatibleBitmap(hdc, width, height));
/* flush it */
rc.left=rc.top=0;
rc.right=width;
@@ -162,7 +162,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) /* paint to screen */
BitBlt(hdc, rcItem->left, rcItem->top, width, height, hMemDC, 0, 0, SRCCOPY);
/* select back in the old bitmap and delete the created one, as well as freeing the mem dc. */
- hBitmap=( HBITMAP )SelectObject(hMemDC, hBitmap);
+ hBitmap=(HBITMAP)SelectObject(hMemDC, hBitmap);
DeleteObject(hBitmap);
DeleteDC(hMemDC);
}
@@ -207,7 +207,7 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg, struct FindAddDlgData *dat) static void ReposTinySearchDlg(HWND hwndDlg, struct FindAddDlgData *dat)
{
- if ( dat->hwndTinySearch != NULL ) {
+ if (dat->hwndTinySearch != NULL) {
RECT rc;
RECT clientRect;
POINT pt={0, 0};
@@ -253,28 +253,28 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl) {
int i;
static const int controls[]={IDC_BYPROTOID, IDC_BYEMAIL, IDC_BYNAME, IDC_BYADVANCED, IDC_BYCUSTOM};
- for ( i=0; i < SIZEOF(controls); i++ )
+ for (i=0; i < SIZEOF(controls); i++)
CheckDlgButton(hwndDlg, controls[i], idControl == controls[i]?BST_CHECKED:BST_UNCHECKED);
}
#define sttErrMsg TranslateT("You haven't filled in the search field. Please enter a search term and try again.")
#define sttErrTitle TranslateT("Search")
-static void SetListItemText( HWND hwndList, int idx, int col, TCHAR* szText )
+static void SetListItemText(HWND hwndList, int idx, int col, TCHAR* szText)
{
- if ( szText && szText[0] )
+ if (szText && szText[0])
{
- ListView_SetItemText( hwndList, idx, col, szText );
+ ListView_SetItemText(hwndList, idx, col, szText);
}
else
{
- ListView_SetItemText( hwndList, idx, col, TranslateT("<not specified>"));
+ ListView_SetItemText(hwndList, idx, col, TranslateT("<not specified>"));
}
}
static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct FindAddDlgData* dat = ( struct FindAddDlgData* )GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ struct FindAddDlgData* dat = (struct FindAddDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
HWND hwndList = GetDlgItem(hwndDlg, IDC_RESULTS);
switch (msg) {
@@ -321,7 +321,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
GetTextExtentPoint32(hdc, TranslateT("Searching"), lstrlen(TranslateT("Searching")), &textSize);
partWidth[0]=textSize.cx;
- GetTextExtentPoint32(hdc, _T("01234567890123456789"), 20, &textSize );
+ GetTextExtentPoint32(hdc, _T("01234567890123456789"), 20, &textSize);
partWidth[0]+=textSize.cx;
ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
partWidth[1]=partWidth[0]+150;
@@ -339,12 +339,12 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP RECT rect;
int cbwidth = 0;
- if ( !DBGetContactSettingTString( NULL, "FindAdd", "LastSearched", &dbv ))
+ if ( !DBGetContactSettingTString(NULL, "FindAdd", "LastSearched", &dbv))
szProto = dbv.ptszVal;
- for ( i=0, netProtoCount=0; i < accounts.getCount(); i++ ) {
- if (!Proto_IsAccountEnabled( accounts[i] )) continue;
- DWORD caps = (DWORD)CallProtoService( accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0 );
+ for (i=0, netProtoCount=0; i < accounts.getCount(); i++) {
+ if ( !Proto_IsAccountEnabled(accounts[i])) continue;
+ DWORD caps = (DWORD)CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_BASICSEARCH || caps & PF1_EXTSEARCH || caps & PF1_SEARCHBYEMAIL || caps & PF1_SEARCHBYNAME)
netProtoCount++;
}
@@ -363,22 +363,22 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
cbei.iItem++;
}
- for ( i=0; i < accounts.getCount(); i++ ) {
+ for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if (!Proto_IsAccountEnabled(pa)) continue;
- DWORD caps=(DWORD)CallProtoService( pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0 );
+ if ( !Proto_IsAccountEnabled(pa)) continue;
+ DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if ( !(caps&PF1_BASICSEARCH) && !(caps&PF1_EXTSEARCH) && !(caps&PF1_SEARCHBYEMAIL) && !(caps&PF1_SEARCHBYNAME))
continue;
cbei.pszText = pa->tszAccountName;
GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
if (textSize.cx>cbwidth) cbwidth = textSize.cx;
- hIcon=(HICON)CallProtoService( pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ hIcon=(HICON)CallProtoService(pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon(dat->himlComboIcons, hIcon);
DestroyIcon(hIcon);
cbei.lParam=(LPARAM)pa->szModuleName;
SendDlgItemMessageA(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
- if (szProto && cbei.pszText && !lstrcmp( szProto, pa->tszAccountName ))
+ if (szProto && cbei.pszText && !lstrcmp(szProto, pa->tszAccountName))
index = cbei.iItem;
cbei.iItem++;
}
@@ -446,12 +446,12 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->showAdvanced = dat->showEmail = dat->showName = dat->showProtoId = dat->showTiny = 0;
szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
- if ( szProto == (char *)CB_ERR )
+ if (szProto == (char *)CB_ERR)
break;
- if ( szProto == NULL ) {
- for ( i=0; i < accounts.getCount(); i++ ) {
+ if (szProto == NULL) {
+ for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if (!Proto_IsAccountEnabled(pa)) continue;
+ if ( !Proto_IsAccountEnabled(pa)) continue;
protoCaps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1;
if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1;
@@ -469,7 +469,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP char *szUniqueId;
szUniqueId=(char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
if (szUniqueId) {
- #if defined( _UNICODE )
+ #if defined(_UNICODE)
TCHAR* p = mir_a2u(szUniqueId);
SetDlgItemText(hwndDlg, IDC_BYPROTOID, p);
mir_free(p);
@@ -502,12 +502,12 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP en(BYCUSTOM, Tiny); en(TINYEXTENDEDGROUP, Tiny);
#undef en
- checkmarkVisible=(dat->showAdvanced && IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) ||
- (dat->showEmail && IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) ||
- (dat->showTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) ||
- (dat->showName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) ||
+ checkmarkVisible=(dat->showAdvanced && IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) ||
+ (dat->showEmail && IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) ||
+ (dat->showTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) ||
+ (dat->showName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) ||
(dat->showProtoId && IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID));
- if (!checkmarkVisible) {
+ if ( !checkmarkVisible) {
if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID);
else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL);
else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME);
@@ -801,7 +801,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->bFlexSearchResult=TRUE;
psr=&(csr->psr);
// check if this is column names data (psr->cbSize == 0)
- if ( psr->cbSize == 0 ) { // blob contain info about columns
+ if (psr->cbSize == 0) { // blob contain info about columns
int iColumn;
LVCOLUMN lvc={0};
@@ -836,7 +836,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (psr->id)
{
BOOL validPtr = isUnicode ? IsBadStringPtrW((wchar_t*)psr->id, 25) : IsBadStringPtrA((char*)psr->id, 25);
- if (!validPtr)
+ if ( !validPtr)
{
isUnicode = false;
lsr->psr.id = NULL;
@@ -853,11 +853,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.mask = LVIF_PARAM | LVIF_IMAGE;
lvi.lParam = (LPARAM)lsr;
- for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--; )
+ for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;)
{
szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
if (szComboProto == NULL) continue;
- if (!lstrcmpA(szComboProto, ack->szModule))
+ if ( !lstrcmpA(szComboProto, ack->szModule))
{
cbei.mask = CBEIF_IMAGE;
cbei.iItem = i;
@@ -867,7 +867,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
i = ListView_InsertItem(hwndList, &lvi);
for (col=0; col<csr->nFieldCount; col++) {
- SetListItemText(hwndList, i, col+1 , csr->pszFields[col] );
+ SetListItemText(hwndList, i, col+1 , csr->pszFields[col]);
}
ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg);
i=0;
@@ -897,11 +897,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.mask = LVIF_PARAM|LVIF_IMAGE;
lvi.lParam=(LPARAM)lsr;
- for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--; )
+ for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;)
{
szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
if (szComboProto == NULL) continue;
- if (!lstrcmpA(szComboProto, ack->szModule)) {
+ if ( !lstrcmpA(szComboProto, ack->szModule)) {
cbei.mask=CBEIF_IMAGE;
cbei.iItem=i;
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei);
@@ -911,11 +911,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
i=ListView_InsertItem(hwndList, &lvi);
col=1;
- SetListItemText(hwndList, i, col++, lsr->psr.id );
- SetListItemText(hwndList, i, col++, lsr->psr.nick );
- SetListItemText(hwndList, i, col++, lsr->psr.firstName );
- SetListItemText(hwndList, i, col++, lsr->psr.lastName );
- SetListItemText(hwndList, i, col++, lsr->psr.email );
+ SetListItemText(hwndList, i, col++, lsr->psr.id);
+ SetListItemText(hwndList, i, col++, lsr->psr.nick);
+ SetListItemText(hwndList, i, col++, lsr->psr.firstName);
+ SetListItemText(hwndList, i, col++, lsr->psr.lastName);
+ SetListItemText(hwndList, i, col++, lsr->psr.email);
SetStatusBarResultInfo(hwndDlg);
}
break;
@@ -927,7 +927,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
TCHAR *szProto;
int len = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
- szProto = ( TCHAR* )alloca( sizeof(TCHAR)*( len+1 ));
+ szProto = (TCHAR*)alloca(sizeof(TCHAR)*(len+1));
*szProto='\0';
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), (LPARAM)szProto);
DBWriteContactSettingTString(NULL, "FindAdd", "LastSearched", szProto?szProto:_T(""));
@@ -972,12 +972,12 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) // One alternative would be to only create the service if we have network
// protocols loaded but that would delay the creation until MODULE_LOADED and
// that is not good either...
- for ( i=0, netProtoCount=0; i < accounts.getCount(); i++ ) {
+ for (i=0, netProtoCount=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if (!Proto_IsAccountEnabled(pa)) continue;
- int protoCaps=CallProtoService( pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0 );
- if ( protoCaps&PF1_BASICSEARCH || protoCaps&PF1_SEARCHBYEMAIL || protoCaps&PF1_SEARCHBYNAME
- || protoCaps&PF1_EXTSEARCHUI ) netProtoCount++;
+ if ( !Proto_IsAccountEnabled(pa)) continue;
+ int protoCaps=CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (protoCaps&PF1_BASICSEARCH || protoCaps&PF1_SEARCHBYEMAIL || protoCaps&PF1_SEARCHBYNAME
+ || protoCaps&PF1_EXTSEARCHUI) netProtoCount++;
}
if (netProtoCount > 0)
hwndFindAdd=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_FINDADD), NULL, DlgProcFindAdd);
@@ -987,7 +987,7 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) int FindAddPreShutdown(WPARAM, LPARAM)
{
- if ( IsWindow( hwndFindAdd ))
+ if (IsWindow(hwndFindAdd))
DestroyWindow(hwndFindAdd);
hwndFindAdd = NULL;
return 0;
@@ -1004,7 +1004,7 @@ int LoadFindAddModule(void) mi.cbSize = sizeof(mi);
mi.position = 500020000;
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_FINDUSER );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_FINDUSER);
mi.pszName = LPGEN("&Find/Add Contacts...");
mi.pszService = MS_FINDADD_FINDADD;
hMainMenuItem = Menu_AddMainMenuItem(&mi);
@@ -1016,18 +1016,18 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) int netProtoCount, i;
// Make sure we have some networks to search on.
- for ( i=0, netProtoCount=0; i < accounts.getCount(); i++ ) {
+ for (i=0, netProtoCount=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- int protoCaps = CallProtoService( pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0 );
- if ( protoCaps & ( PF1_BASICSEARCH | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_EXTSEARCHUI ))
+ int protoCaps = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (protoCaps & (PF1_BASICSEARCH | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_EXTSEARCHUI))
netProtoCount++;
}
CLISTMENUITEM cmi = { 0 };
cmi.cbSize = sizeof(cmi);
cmi.flags = CMIM_FLAGS;
- if ( netProtoCount == 0 )
+ if (netProtoCount == 0)
cmi.flags |= CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItem, (LPARAM)&cmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItem, (LPARAM)&cmi);
return 0;
}
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 81ca1d661a..2422f262d1 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -76,13 +76,13 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) for (i=0; i < NUM_COLUMNID; i++)
{
LVCOLUMN lvc;
- if ( i < columnCount )
+ if (i < columnCount)
{
int bNeedsFree = FALSE;
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
- if ( szColumnNames[i] != NULL )
- lvc.pszText = TranslateTS( szColumnNames[i] );
- else if ( i == COLUMNID_HANDLE )
+ if (szColumnNames[i] != NULL)
+ lvc.pszText = TranslateTS(szColumnNames[i]);
+ else if (i == COLUMNID_HANDLE)
{
if (szProto)
{
@@ -137,12 +137,12 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa sortMultiplier=dat->bSortAscending?1:-1;
sortCol=dat->iLastColumnSortIndex;
- if (!dat->bFlexSearchResult)
+ if ( !dat->bFlexSearchResult)
{
lsr1=(struct ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam1);
lsr2=(struct ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam2);
- if ( lsr1 == NULL || lsr2 == NULL ) return 0;
+ if (lsr1 == NULL || lsr2 == NULL) return 0;
switch(sortCol)
{
case COLUMNID_PROTO:
@@ -194,7 +194,7 @@ void FreeSearchResults(HWND hwndResults) static void BeginSearchFailed(void * arg)
{
TCHAR buf[128];
- if ( arg != NULL ) {
+ if (arg != NULL) {
const TCHAR* protoName = (TCHAR*)arg;
mir_sntprintf(buf, SIZEOF(buf),
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
@@ -208,18 +208,18 @@ static void BeginSearchFailed(void * arg) int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams)
{
int i;
- if ( szProto == NULL ) {
+ if (szProto == NULL) {
int failures = 0;
dat->searchCount = 0;
dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * accounts.getCount());
- for ( i=0; i < accounts.getCount();i++) {
+ for (i=0; i < accounts.getCount();i++) {
PROTOACCOUNT* pa = accounts[i];
- if (!Proto_IsAccountEnabled(pa)) continue;
+ if ( !Proto_IsAccountEnabled(pa)) continue;
DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
- if (!(caps&requiredCapability)) continue;
+ if ( !(caps&requiredCapability)) continue;
dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[dat->searchCount].szProto = pa->szModuleName;
- if ( dat->search[dat->searchCount].hProcess == NULL ) failures++;
+ if (dat->search[dat->searchCount].hProcess == NULL) failures++;
else dat->searchCount++;
}
if (failures) {
@@ -254,21 +254,21 @@ void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat) {
TCHAR str[256];
- if (dat->searchCount != 0 ) {
+ if (dat->searchCount != 0) {
int i;
- lstrcpy( str, TranslateT("Searching"));
- for ( i=0; i < dat->searchCount; i++ ) {
- PROTOACCOUNT* pa = Proto_GetAccount( dat->search[i].szProto );
- if ( !pa )
+ lstrcpy(str, TranslateT("Searching"));
+ for (i=0; i < dat->searchCount; i++) {
+ PROTOACCOUNT* pa = Proto_GetAccount(dat->search[i].szProto);
+ if ( !pa)
continue;
- lstrcat(str, i ? _T(", ") : _T( " " ));
- lstrcat(str, pa->tszAccountName );
+ lstrcat(str, i ? _T(", ") : _T(" "));
+ lstrcat(str, pa->tszAccountName);
} }
else lstrcpy(str, TranslateT("Idle"));
- SendMessage( hwndStatus, SB_SETTEXT, 0, (LPARAM)str );
+ SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)str);
}
struct ProtoResultsSummary {
@@ -304,33 +304,33 @@ void SetStatusBarResultInfo(HWND hwndDlg) subtotal[subtotalCount++].count=1;
}
}
- if ( total != 0 ) {
+ if (total != 0) {
TCHAR substr[64];
- PROTOACCOUNT* pa = Proto_GetAccount( subtotal[0].szProto );
- if ( pa == NULL )
+ PROTOACCOUNT* pa = Proto_GetAccount(subtotal[0].szProto);
+ if (pa == NULL)
return;
- if ( subtotalCount == 1 ) {
- if (total == 1) mir_sntprintf( str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName );
- else mir_sntprintf( str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName );
+ if (subtotalCount == 1) {
+ if (total == 1) mir_sntprintf(str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName);
+ else mir_sntprintf(str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName);
}
else {
- mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("), total);
- for ( i=0; i < subtotalCount; i++ ) {
- if ( i ) {
- if (( pa = Proto_GetAccount( subtotal[i].szProto )) == NULL )
+ mir_sntprintf(str, SIZEOF(str), TranslateT("%d users found ("), total);
+ for (i=0; i < subtotalCount; i++) {
+ if (i) {
+ if ((pa = Proto_GetAccount(subtotal[i].szProto)) == NULL)
return;
- lstrcat( str, _T(", "));
+ lstrcat(str, _T(", "));
}
- mir_sntprintf( substr, SIZEOF(substr), _T("%d %s"), subtotal[i].count, pa->tszAccountName );
- lstrcat( str, substr );
+ mir_sntprintf(substr, SIZEOF(substr), _T("%d %s"), subtotal[i].count, pa->tszAccountName);
+ lstrcat(str, substr);
}
- lstrcat( str, _T(")"));
+ lstrcat(str, _T(")"));
}
mir_free(subtotal);
}
else lstrcpy(str, TranslateT("No users found"));
- SendMessage(hwndStatus, SB_SETTEXT, 2, (LPARAM)str );
+ SendMessage(hwndStatus, SB_SETTEXT, 2, (LPARAM)str);
}
void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto)
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 2e8ac7823e..8f343c5041 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -27,47 +27,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // *_w2 is working copy of list
// *_w3 is stores initial configuration
-static int sttCompareFont( const TFontID* p1, const TFontID* p2 )
+static int sttCompareFont(const TFontID* p1, const TFontID* p2)
{
- int result = _tcscmp( p1->group, p2->group );
- if ( result != 0 )
+ int result = _tcscmp(p1->group, p2->group);
+ if (result != 0)
return result;
result = p1->order - p2->order;
- if ( result != 0 )
+ if (result != 0)
return result;
- return _tcscmp( TranslateTS(p1->name), TranslateTS(p2->name) );
+ return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name));
}
-OBJLIST<TFontID> font_id_list( 20, sttCompareFont ), font_id_list_w2( 20, sttCompareFont ), font_id_list_w3( 20, sttCompareFont );
+OBJLIST<TFontID> font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont);
-static int sttCompareColour( const TColourID* p1, const TColourID* p2 )
+static int sttCompareColour(const TColourID* p1, const TColourID* p2)
{
- int result = _tcscmp( p1->group, p2->group );
- if ( result != 0 )
+ int result = _tcscmp(p1->group, p2->group);
+ if (result != 0)
return result;
result = p1->order - p2->order;
- if ( result != 0 )
+ if (result != 0)
return result;
- return _tcscmp( TranslateTS(p1->name), TranslateTS(p2->name) );
+ return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name));
}
-OBJLIST<TColourID> colour_id_list( 10, sttCompareColour ), colour_id_list_w2( 10, sttCompareColour ), colour_id_list_w3( 10, sttCompareColour );
+OBJLIST<TColourID> colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour);
-static int sttCompareEffect( const TEffectID* p1, const TEffectID* p2 )
+static int sttCompareEffect(const TEffectID* p1, const TEffectID* p2)
{
- int result = _tcscmp( p1->group, p2->group );
- if ( result != 0 )
+ int result = _tcscmp(p1->group, p2->group);
+ if (result != 0)
return result;
result = p1->order - p2->order;
- if ( result != 0 )
+ if (result != 0)
return result;
- return _tcscmp( TranslateTS(p1->name), TranslateTS(p2->name) );
+ return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name));
}
-OBJLIST<TEffectID> effect_id_list( 10, sttCompareEffect ), effect_id_list_w2( 10, sttCompareEffect ), effect_id_list_w3( 10, sttCompareEffect );
+OBJLIST<TEffectID> effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect);
typedef struct DrawTextWithEffectParam_tag
{
@@ -87,26 +87,26 @@ typedef struct DrawTextWithEffectParam_tag #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW
// Helper
-int __inline DrawTextWithEffect( HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, FONTEFFECT * pEffect )
+int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, FONTEFFECT * pEffect)
{
DrawTextWithEffectParam params;
- static BYTE bIfServiceExists = ServiceExists( MS_DRAW_TEXT_WITH_EFFECT ) ? 1 : 0;
+ static BYTE bIfServiceExists = ServiceExists(MS_DRAW_TEXT_WITH_EFFECT) ? 1 : 0;
- if ( pEffect == NULL || pEffect->effectIndex == 0 )
- return DrawText ( hdc, lpchText, cchText, lprc, dwDTFormat ); // If no effect specified draw by GDI it just more careful with ClearType
+ if (pEffect == NULL || pEffect->effectIndex == 0)
+ return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat); // If no effect specified draw by GDI it just more careful with ClearType
- if ( bIfServiceExists == 0)
- return DrawText ( hdc, lpchText, cchText, lprc, dwDTFormat );
+ if (bIfServiceExists == 0)
+ return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat);
// else
- params.cbSize = sizeof( DrawTextWithEffectParam );
+ params.cbSize = sizeof(DrawTextWithEffectParam);
params.hdc = hdc;
params.lpchText = lpchText;
params.cchText = cchText;
params.lprc = lprc;
params.dwDTFormat = dwDTFormat;
params.pEffect = pEffect;
- return CallService( MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0 );
+ return CallService(MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0);
}
@@ -146,32 +146,32 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST<TFontID>& flist, OBJL strcpy(buff, "SETTINGS:\r\n");
WriteLine(fhand, buff);
- for ( i = 0; i < flist.getCount(); i++ ) {
+ for (i = 0; i < flist.getCount(); i++) {
TFontID& F = flist[i];
mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", F.dbSettingsGroup);
- if ( strcmp( buff, header ) != 0) {
+ if (strcmp(buff, header) != 0) {
strcpy(header, buff);
WriteLine(fhand, buff);
}
- if ( F.flags & FIDF_APPENDNAME )
- mir_snprintf( buff, SIZEOF(buff), "%sName=s", F.prefix );
+ if (F.flags & FIDF_APPENDNAME)
+ mir_snprintf(buff, SIZEOF(buff), "%sName=s", F.prefix);
else
- mir_snprintf( buff, SIZEOF(buff), "%s=s", F.prefix );
+ mir_snprintf(buff, SIZEOF(buff), "%s=s", F.prefix);
WideCharToMultiByte(code_page, 0, F.value.szFace, -1, abuff, 1024, 0, 0);
abuff[1023]=0;
- strcat( buff, abuff );
+ strcat(buff, abuff);
WriteLine(fhand, buff);
mir_snprintf(buff, SIZEOF(buff), "%sSize=b", F.prefix);
- if ( F.flags & FIDF_SAVEACTUALHEIGHT ) {
+ if (F.flags & FIDF_SAVEACTUALHEIGHT) {
HDC hdc;
SIZE size;
HFONT hFont, hOldFont;
LOGFONT lf;
- CreateFromFontSettings( &F.value, &lf );
+ CreateFromFontSettings(&F.value, &lf);
hFont = CreateFontIndirect(&lf);
hdc = GetDC(hwndDlg);
@@ -207,32 +207,32 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST<TFontID>& flist, OBJL }
header[0] = 0;
- for ( i=0; i < clist.getCount(); i++ ) {
+ for (i=0; i < clist.getCount(); i++) {
TColourID& C = clist[i];
- mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", C.dbSettingsGroup );
+ mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", C.dbSettingsGroup);
if (strcmp(buff, header) != 0) {
strcpy(header, buff);
WriteLine(fhand, buff);
}
- mir_snprintf(buff, SIZEOF(buff), "%s=d%d", C.setting, (DWORD)C.value );
+ mir_snprintf(buff, SIZEOF(buff), "%s=d%d", C.setting, (DWORD)C.value);
WriteLine(fhand, buff);
}
header[0] = 0;
- for ( i=0; i < elist.getCount(); i++ ) {
+ for (i=0; i < elist.getCount(); i++) {
TEffectID& E = elist[i];
- mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", E.dbSettingsGroup );
+ mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", E.dbSettingsGroup);
if (strcmp(buff, header) != 0) {
strcpy(header, buff);
WriteLine(fhand, buff);
}
- mir_snprintf(buff, SIZEOF(buff), "%sEffect=b%d", E.setting, E.value.effectIndex );
+ mir_snprintf(buff, SIZEOF(buff), "%sEffect=b%d", E.setting, E.value.effectIndex);
WriteLine(fhand, buff);
- mir_snprintf(buff, SIZEOF(buff), "%sEffectCol1=d%d", E.setting, E.value.baseColour );
+ mir_snprintf(buff, SIZEOF(buff), "%sEffectCol1=d%d", E.setting, E.value.baseColour);
WriteLine(fhand, buff);
- mir_snprintf(buff, SIZEOF(buff), "%sEffectCol2=d%d", E.setting, E.value.secondaryColour );
+ mir_snprintf(buff, SIZEOF(buff), "%sEffectCol2=d%d", E.setting, E.value.secondaryColour);
WriteLine(fhand, buff);
}
@@ -281,18 +281,18 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const TCHAR *name, const T {
int i;
BOOL res = FALSE;
- for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--; )
+ for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;)
{
FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0);
- if ( itemData && itemData->font_id >= 0) {
+ if (itemData && itemData->font_id >= 0) {
TFontID& F = font_id_list_w2[itemData->font_id];
- if ( name && !_tcscmp( F.name, name )) {
+ if (name && !_tcscmp(F.name, name)) {
itemData->colour_id = colourId;
res = TRUE;
}
- if ( backgroundGroup && backgroundName && !_tcscmp( F.backgroundGroup, backgroundGroup) && !_tcscmp( F.backgroundName, backgroundName)) {
+ if (backgroundGroup && backgroundName && !_tcscmp(F.backgroundGroup, backgroundGroup) && !_tcscmp(F.backgroundName, backgroundName)) {
itemData->colour_id = colourId;
res = TRUE;
} } }
@@ -304,13 +304,13 @@ static BOOL sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int eff {
int i;
BOOL res = FALSE;
- for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--; )
+ for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;)
{
FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0);
- if ( itemData && itemData->font_id >= 0) {
+ if (itemData && itemData->font_id >= 0) {
TFontID& F = font_id_list_w2[itemData->font_id];
- if ( name && !_tcscmp( F.name, name )) {
+ if (name && !_tcscmp(F.name, name)) {
itemData->effect_id = effectId;
res = TRUE;
}
@@ -330,7 +330,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC else
tvi.hItem = TreeView_GetRoot(hwndTree);
- if (!name)
+ if ( !name)
return tvi.hItem;
tvi.mask = TVIF_TEXT;
@@ -341,7 +341,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC {
TreeView_GetItem(hwndTree, &tvi);
- if (!lstrcmp(tvi.pszText, name))
+ if ( !lstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -369,11 +369,11 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName) *sectionName = 0;
}
- pItemName = TranslateTS( pItemName );
+ pItemName = TranslateTS(pItemName);
hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName);
- if (!sectionName || !hItem) {
- if (!hItem) {
+ if ( !sectionName || !hItem) {
+ if ( !hItem) {
TVINSERTSTRUCT tvis = {0};
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
treeItem->groupName = sectionName ? NULL : mir_tstrdup(groupName);
@@ -390,7 +390,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName) ZeroMemory(&tvis.item, sizeof(tvis.item));
tvis.item.hItem = hItem;
tvis.item.mask = TVIF_HANDLE|TVIF_STATE;
- tvis.item.state = tvis.item.stateMask = DBGetContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED );
+ tvis.item.state = tvis.item.stateMask = DBGetContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
TreeView_SetItem(hwndTree, &tvis.item);
} }
@@ -405,36 +405,36 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName) }
}
-static void sttSaveCollapseState( HWND hwndTree )
+static void sttSaveCollapseState(HWND hwndTree)
{
HTREEITEM hti;
TVITEM tvi;
- hti = TreeView_GetRoot( hwndTree );
- while ( hti != NULL ) {
+ hti = TreeView_GetRoot(hwndTree);
+ while (hti != NULL) {
HTREEITEM ht;
TreeItem *treeItem;
tvi.mask = TVIF_STATE | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM;
tvi.hItem = hti;
tvi.stateMask = (DWORD)-1;
- TreeView_GetItem( hwndTree, &tvi );
+ TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.cChildren > 0 ) {
+ if (tvi.cChildren > 0) {
treeItem = (TreeItem *)tvi.lParam;
- if ( tvi.state & TVIS_EXPANDED )
- DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED );
+ if (tvi.state & TVIS_EXPANDED)
+ DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
else
- DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, 0 );
+ DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, 0);
}
- ht = TreeView_GetChild( hwndTree, hti );
- if ( ht == NULL ) {
- ht = TreeView_GetNextSibling( hwndTree, hti );
- while ( ht == NULL ) {
- hti = TreeView_GetParent( hwndTree, hti );
- if ( hti == NULL ) break;
- ht = TreeView_GetNextSibling( hwndTree, hti );
+ ht = TreeView_GetChild(hwndTree, hti);
+ if (ht == NULL) {
+ ht = TreeView_GetNextSibling(hwndTree, hti);
+ while (ht == NULL) {
+ hti = TreeView_GetParent(hwndTree, hti);
+ if (hti == NULL) break;
+ ht = TreeView_GetNextSibling(hwndTree, hti);
} }
hti = ht;
@@ -445,18 +445,18 @@ static void sttFreeListItems(HWND hList) int idx = 0;
LRESULT res;
FSUIListItemData *itemData;
- int count = SendMessage( hList, LB_GETCOUNT, 0, 0 );
- if ( count > 0 ) {
- while ( idx < count) {
- res = SendMessage( hList, LB_GETITEMDATA, idx++, 0 );
+ int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
+ if (count > 0) {
+ while (idx < count) {
+ res = SendMessage(hList, LB_GETITEMDATA, idx++, 0);
itemData = (FSUIListItemData *)res;
- if ( itemData && res != LB_ERR )
- mir_free( itemData );
+ if (itemData && res != LB_ERR)
+ mir_free(itemData);
}
}
}
-static BOOL ShowEffectButton( HWND hwndDlg, BOOL bShow )
+static BOOL ShowEffectButton(HWND hwndDlg, BOOL bShow)
{
ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bShow ? SW_HIDE : SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR_STATIC), bShow ? SW_HIDE : SW_SHOW);
@@ -466,14 +466,14 @@ static BOOL ShowEffectButton( HWND hwndDlg, BOOL bShow ) return TRUE;
}
-static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static TEffectSettings * pEffect = NULL;
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- pEffect = ( TEffectSettings*) lParam;
+ pEffect = (TEffectSettings*) lParam;
{
int i;
TCHAR * ModernEffectNames[]=
@@ -488,17 +488,17 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa _T("Contour heavy"),
};
- for ( i=0; i < SIZEOF(ModernEffectNames); i++ )
+ for (i=0; i < SIZEOF(ModernEffectNames); i++)
{
int itemid = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_ADDSTRING, 0, (LPARAM)TranslateTS(ModernEffectNames[i]));
- SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i );
- SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0 );
+ SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i);
+ SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0);
}
- int cnt=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0 );
- for ( i = 0; i < cnt; i++ ) {
- if (SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0) == pEffect->effectIndex ) {
- SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, i, 0 );
+ int cnt=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0);
+ for (i = 0; i < cnt; i++) {
+ if (SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0) == pEffect->effectIndex) {
+ SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, i, 0);
break;
} } }
@@ -515,16 +515,16 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa switch (LOWORD(wParam)) {
case IDOK:
{
- int i = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCURSEL, 0, 0 );
+ int i = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCURSEL, 0, 0);
pEffect->effectIndex=(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0);
pEffect->baseColour=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_GETPOS, 0, 0))<<24);
pEffect->secondaryColour=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_GETPOS, 0, 0))<<24);;
}
- EndDialog( hwndDlg, IDOK );
+ EndDialog(hwndDlg, IDOK);
return TRUE;
case IDCANCEL:
- EndDialog( hwndDlg, IDCANCEL );
+ EndDialog(hwndDlg, IDCANCEL);
return TRUE;
}
break;
@@ -535,9 +535,9 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa return FALSE;
}
-static BOOL ChooseEffectDialog( HWND hwndParent, TEffectSettings * es)
+static BOOL ChooseEffectDialog(HWND hwndParent, TEffectSettings * es)
{
- return ( DialogBoxParam( hMirandaInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es ) == IDOK );
+ return (DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es) == IDOK);
}
static void sttSaveFontData(HWND hwndDlg, TFontID &F)
@@ -545,34 +545,34 @@ static void sttSaveFontData(HWND hwndDlg, TFontID &F) LOGFONT lf;
char str[128];
- if ( F.flags & FIDF_APPENDNAME )
+ if (F.flags & FIDF_APPENDNAME)
mir_snprintf(str, SIZEOF(str), "%sName", F.prefix);
else
mir_snprintf(str, SIZEOF(str), "%s", F.prefix);
- if ( DBWriteContactSettingTString( NULL, F.dbSettingsGroup, str, F.value.szFace )) {
+ if (DBWriteContactSettingTString(NULL, F.dbSettingsGroup, str, F.value.szFace)) {
char buff[1024];
WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, 0, 0);
DBWriteContactSettingString(NULL, F.dbSettingsGroup, str, buff);
}
mir_snprintf(str, SIZEOF(str), "%sSize", F.prefix);
- if ( F.flags & FIDF_SAVEACTUALHEIGHT ) {
+ if (F.flags & FIDF_SAVEACTUALHEIGHT) {
HDC hdc;
SIZE size;
HFONT hFont, hOldFont;
- CreateFromFontSettings( &F.value, &lf );
- hFont = CreateFontIndirect( &lf );
+ CreateFromFontSettings(&F.value, &lf);
+ hFont = CreateFontIndirect(&lf);
hdc = GetDC(hwndDlg);
- hOldFont = (HFONT)SelectObject( hdc, hFont );
- GetTextExtentPoint32( hdc, _T("_W"), 2, &size);
+ hOldFont = (HFONT)SelectObject(hdc, hFont);
+ GetTextExtentPoint32(hdc, _T("_W"), 2, &size);
ReleaseDC(hwndDlg, hdc);
SelectObject(hdc, hOldFont);
DeleteObject(hFont);
DBWriteContactSettingByte(NULL, F.dbSettingsGroup, str, (char)size.cy);
}
- else if ( F.flags & FIDF_SAVEPOINTSIZE ) {
+ else if (F.flags & FIDF_SAVEPOINTSIZE) {
HDC hdc = GetDC(hwndDlg);
DBWriteContactSettingByte(NULL, F.dbSettingsGroup, str, (BYTE)-MulDiv(F.value.size, 72, GetDeviceCaps(hdc, LOGPIXELSY)));
ReleaseDC(hwndDlg, hdc);
@@ -585,7 +585,7 @@ static void sttSaveFontData(HWND hwndDlg, TFontID &F) DBWriteContactSettingByte(NULL, F.dbSettingsGroup, str, F.value.charset);
mir_snprintf(str, SIZEOF(str), "%sCol", F.prefix);
DBWriteContactSettingDword(NULL, F.dbSettingsGroup, str, F.value.colour);
- if ( F.flags & FIDF_NOAS ) {
+ if (F.flags & FIDF_NOAS) {
mir_snprintf(str, SIZEOF(str), "%sAs", F.prefix);
DBWriteContactSettingWord(NULL, F.dbSettingsGroup, str, (WORD)0x00FF);
}
@@ -613,26 +613,26 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, effect_id_list_w2 = effect_id_list;
effect_id_list_w3 = effect_id_list;
- for ( i = 0; i < font_id_list_w2.getCount(); i++ ) {
+ for (i = 0; i < font_id_list_w2.getCount(); i++) {
TFontID& F = font_id_list_w2[i];
// sync settings with database
- UpdateFontSettings( &F, &F.value );
+ UpdateFontSettings(&F, &F.value);
sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group);
}
- for ( i = 0; i < colour_id_list_w2.getCount(); i++ ) {
+ for (i = 0; i < colour_id_list_w2.getCount(); i++) {
TColourID& C = colour_id_list_w2[i];
// sync settings with database
- UpdateColourSettings( &C, &C.value );
+ UpdateColourSettings(&C, &C.value);
sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group);
}
- for ( i = 0; i < effect_id_list_w2.getCount(); i++ ) {
+ for (i = 0; i < effect_id_list_w2.getCount(); i++) {
TEffectID& E = effect_id_list_w2[i];
// sync settings with database
- UpdateEffectSettings( &E, &E.value );
+ UpdateEffectSettings(&E, &E.value);
sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E.group);
}
}
@@ -665,37 +665,37 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, WM_SETREDRAW, FALSE, 0);
- for ( fontId = 0; fontId < font_id_list_w2.getCount(); fontId++ ) {
+ for (fontId = 0; fontId < font_id_list_w2.getCount(); fontId++) {
TFontID& F = font_id_list_w2[fontId];
- if ( _tcsncmp( F.group, group_buff, 64 ) == 0 ) {
- FSUIListItemData *itemData = ( FSUIListItemData* )mir_alloc(sizeof(FSUIListItemData));
+ if (_tcsncmp(F.group, group_buff, 64) == 0) {
+ FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->colour_id = -1;
itemData->effect_id = -1;
itemData->font_id = fontId;
- if ( first_font_index == -1 )
+ if (first_font_index == -1)
first_font_index = fontId;
itemId = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData);
need_restart |= (F.flags & FIDF_NEEDRESTART);
} }
-// ShowWindow( GetDlgItem(hwndDlg, IDC_STAT_RESTART), (need_restart ? SW_SHOW : SW_HIDE));
+// ShowWindow(GetDlgItem(hwndDlg, IDC_STAT_RESTART), (need_restart ? SW_SHOW : SW_HIDE));
- if ( hBkgColourBrush ) {
- DeleteObject( hBkgColourBrush );
+ if (hBkgColourBrush) {
+ DeleteObject(hBkgColourBrush);
hBkgColourBrush = 0;
}
- for ( colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++ ) {
+ for (colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++) {
TColourID& C = colour_id_list_w2[colourId];
- if ( _tcsncmp( C.group, group_buff, 64 ) == 0 ) {
+ if (_tcsncmp(C.group, group_buff, 64) == 0) {
FSUIListItemData *itemData = NULL;
- if ( first_colour_index == -1 )
+ if (first_colour_index == -1)
first_colour_index = colourId;
- if (!sttFsuiBindColourIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) {
- itemData = ( FSUIListItemData* )mir_alloc(sizeof(FSUIListItemData));
+ if ( !sttFsuiBindColourIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) {
+ itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->colour_id = colourId;
itemData->font_id = -1;
itemData->effect_id = -1;
@@ -703,22 +703,22 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, itemId = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData);
}
- if ( _tcscmp( C.name, _T("Background") ) == 0 )
- hBkgColourBrush = CreateSolidBrush( C.value );
+ if (_tcscmp(C.name, _T("Background")) == 0)
+ hBkgColourBrush = CreateSolidBrush(C.value);
} }
- if ( !hBkgColourBrush )
+ if ( !hBkgColourBrush)
hBkgColourBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
- for ( effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++ ) {
+ for (effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++) {
TEffectID& E = effect_id_list_w2[effectId];
- if ( _tcsncmp( E.group, group_buff, 64 ) == 0 ) {
+ if (_tcsncmp(E.group, group_buff, 64) == 0) {
FSUIListItemData *itemData = NULL;
- if ( first_effect_index == -1 )
+ if (first_effect_index == -1)
first_effect_index = effectId;
- if (!sttFsuiBindEffectIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) {
- itemData = ( FSUIListItemData* )mir_alloc(sizeof(FSUIListItemData));
+ if ( !sttFsuiBindEffectIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) {
+ itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->effect_id = effectId;
itemData->font_id = -1;
itemData->colour_id = -1;
@@ -755,24 +755,24 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if ((mis->CtlID != IDC_FONTLIST) || (mis->itemID == -1))
break;
- if (!itemData) return FALSE;
+ if ( !itemData) return FALSE;
if (itemData->font_id >= 0) {
int iItem = itemData->font_id;
bIsFont = TRUE;
- CreateFromFontSettings( &font_id_list_w2[iItem].value, &lf );
+ CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf);
hFont = CreateFontIndirect(&lf);
itemName = TranslateTS(font_id_list_w2[iItem].name);
}
if (itemData->colour_id >= 0) {
int iItem = itemData->colour_id;
- if ( !itemName )
- itemName = TranslateTS( colour_id_list_w2[iItem].name );
+ if ( !itemName)
+ itemName = TranslateTS(colour_id_list_w2[iItem].name);
}
hdc = GetDC(GetDlgItem(hwndDlg, mis->CtlID));
- if ( hFont )
+ if (hFont)
hoFont = (HFONT) SelectObject(hdc, hFont);
else
hoFont = (HFONT) SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, mis->CtlID, WM_GETFONT, 0, 0));
@@ -803,18 +803,18 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (dis->CtlID != IDC_FONTLIST)
break;
- if (!itemData) return FALSE;
+ if ( !itemData) return FALSE;
- if ( itemData->font_id >= 0 ) {
+ if (itemData->font_id >= 0) {
int iItem = itemData->font_id;
bIsFont = TRUE;
- CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf );
+ CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf);
hFont = CreateFontIndirect(&lf);
itemName = TranslateTS(font_id_list_w2[iItem].name);
clText = font_id_list_w2[iItem].value.colour;
}
- if ( itemData->colour_id >= 0 ) {
+ if (itemData->colour_id >= 0) {
int iItem = itemData->colour_id;
if (bIsFont)
clBack = colour_id_list_w2[iItem].value;
@@ -824,7 +824,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } }
- if ( itemData->effect_id >= 0 ) {
+ if (itemData->effect_id >= 0) {
int iItem = itemData->effect_id;
Effect.effectIndex = effect_id_list_w2[iItem].value.effectIndex;
@@ -832,7 +832,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, Effect.secondaryColour = effect_id_list_w2[iItem].value.secondaryColour;
pEffect = &Effect;
- if (!bIsFont)
+ if ( !bIsFont)
itemName = TranslateTS(effect_id_list_w2[iItem].name);
}
@@ -857,7 +857,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, else FillRect(dis->hDC, &dis->rcItem, bIsFont ? hBkgColourBrush : GetSysColorBrush(COLOR_WINDOW));
}
- if ( bIsFont ) {
+ if (bIsFont) {
HBRUSH hbrBack;
RECT rc;
@@ -887,7 +887,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SetTextColor(dis->hDC, clText);
- DrawTextWithEffect(dis->hDC, _T("abc"), 3, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect );
+ DrawTextWithEffect(dis->hDC, _T("abc"), 3, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect);
if (dis->itemState & ODS_SELECTED) {
SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
@@ -895,7 +895,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect );
+ DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect);
} else
{
RECT rc;
@@ -920,7 +920,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect );
+ DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect);
}
if (hoFont) SelectObject(dis->hDC, hoFont);
if (hFont) DeleteObject(hFont);
@@ -955,7 +955,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, bEnableEffect = 0;
if (bEnableFont && (itemData->font_id < 0))
bEnableFont = 0;
- if (!bEnableFont || bEnableClText && (itemData->font_id < 0))
+ if ( !bEnableFont || bEnableClText && (itemData->font_id < 0))
bEnableClText = 0;
if (bEnableReset && (itemData->font_id >= 0) && !(font_id_list_w2[itemData->font_id].flags&FIDF_DEFAULTVALID))
bEnableReset = 0;
@@ -976,7 +976,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bEnableClBack);
- ShowEffectButton( hwndDlg, bEnableEffect && !bEnableClBack );
+ ShowEffectButton(hwndDlg, bEnableEffect && !bEnableClBack);
EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCOLOUR), bEnableClText);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSEFONT), bEnableFont);
@@ -1012,14 +1012,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, TFontID& F = font_id_list_w2[itemData->font_id];
- CreateFromFontSettings(&F.value, &lf );
+ CreateFromFontSettings(&F.value, &lf);
cf.lStructSize = sizeof(cf);
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
cf.lCustData = 0;
- if ( F.flags & FIDF_ALLOWEFFECTS )
+ if (F.flags & FIDF_ALLOWEFFECTS)
{
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
// use custom font dialog to disable colour selection
@@ -1027,7 +1027,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
cf.lpfnHook = CFHookProc;
}
- else if ( F.flags & FIDF_DISABLESTYLES ) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS
+ else if (F.flags & FIDF_DISABLESTYLES) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK | CF_TTONLY | CF_NOOEMFONTS;
cf.lCustData = F.flags;
cf.hInstance = hMirandaInst;
@@ -1078,7 +1078,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0);
TEffectID& E = effect_id_list_w2[itemData->effect_id];
es = E.value;
- if ( ChooseEffectDialog(hwndDlg, &es) ) {
+ if (ChooseEffectDialog(hwndDlg, &es)) {
for (i = 0; i < selCount; ++i) {
FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (itemData->effect_id < 0)
@@ -1124,10 +1124,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (itemData->colour_id < 0) continue;
colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- if ( _tcscmp( colour_id_list_w2[itemData->colour_id].name, _T("Background") ) == 0 )
+ if (_tcscmp(colour_id_list_w2[itemData->colour_id].name, _T("Background")) == 0)
{
- if ( hBkgColourBrush ) DeleteObject( hBkgColourBrush );
- hBkgColourBrush = CreateSolidBrush( colour_id_list_w2[itemData->colour_id].value );
+ if (hBkgColourBrush) DeleteObject(hBkgColourBrush);
+ hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value);
}
}
mir_free(selItems);
@@ -1188,8 +1188,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.lpstrDefExt = _T("ini");
- if ( GetSaveFileName( &ofn ) == TRUE )
- if ( !ExportSettings( hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list ))
+ if (GetSaveFileName(&ofn) == TRUE)
+ if ( !ExportSettings(hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list))
MessageBox(hwndDlg, TranslateT("Error writing file"), TranslateT("Error"), MB_ICONWARNING | MB_OK);
return TRUE;
}
@@ -1207,32 +1207,32 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY ) {
+ if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) {
char str[32];
font_id_list_w3 = font_id_list;
colour_id_list_w3 = colour_id_list;
effect_id_list_w3 = effect_id_list;
- EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE );
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
font_id_list = font_id_list_w2;
colour_id_list = colour_id_list_w2;
effect_id_list = effect_id_list_w2;
- for ( i=0; i < font_id_list_w2.getCount(); i++ ) {
+ for (i=0; i < font_id_list_w2.getCount(); i++) {
TFontID& F = font_id_list_w2[i];
sttSaveFontData(hwndDlg, F);
}
- for ( i=0; i < colour_id_list_w2.getCount(); i++ ) {
+ for (i=0; i < colour_id_list_w2.getCount(); i++) {
TColourID& C = colour_id_list_w2[i];
mir_snprintf(str, SIZEOF(str), "%s", C.setting);
DBWriteContactSettingDword(NULL, C.dbSettingsGroup, str, C.value);
}
- for ( i=0; i < effect_id_list_w2.getCount(); i++ ) {
+ for (i=0; i < effect_id_list_w2.getCount(); i++) {
TEffectID& E = effect_id_list_w2[i];
mir_snprintf(str, SIZEOF(str), "%sEffect", E.setting);
@@ -1290,18 +1290,15 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {0};
-
- odp.cbSize = sizeof(odp);
- odp.cbSize = OPTIONPAGE_OLD_SIZE2;
- odp.position = -790000000;
- odp.hInstance = hMirandaInst;;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
- odp.pszTitle = LPGEN("Fonts & Colors");
- odp.pszGroup = LPGEN("Customize");
- odp.flags = ODPF_BOLDGROUPS;
- odp.nIDBottomSimpleControl = 0;
- odp.pfnDlgProc = DlgProcLogOptions;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ odp.cbSize = sizeof(odp);
+ odp.position = -790000000;
+ odp.hInstance = hMirandaInst;;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
+ odp.pszTitle = LPGEN("Fonts & Colors");
+ odp.pszGroup = LPGEN("Customize");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcLogOptions;
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -1309,10 +1306,10 @@ int OptInit(WPARAM wParam, LPARAM) static TFontID *sttFindFont(OBJLIST<TFontID> &fonts, char *module, char *prefix)
{
- for ( int i = 0; i < fonts.getCount(); i++ )
+ for (int i = 0; i < fonts.getCount(); i++)
{
TFontID& F = fonts[i];
- if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix) )
+ if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix))
return &F;
}
@@ -1358,7 +1355,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar break;
}
- if (!pf) break;
+ if ( !pf) break;
HFONT hFont = NULL, hoFont = NULL;
COLORREF clText = GetSysColor(COLOR_WINDOWTEXT);
@@ -1400,7 +1397,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
- if ( pf->flags & FIDF_ALLOWEFFECTS )
+ if (pf->flags & FIDF_ALLOWEFFECTS)
{
cf.Flags |= CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
// use custom font dialog to disable colour selection
@@ -1427,18 +1424,18 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY ) {
- for ( i=0; i < font_id_list.getCount(); i++ )
+ if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) {
+ for (i=0; i < font_id_list.getCount(); i++)
{
TFontID &F = font_id_list[i];
if (F.deffontsettings.charset == SYMBOL_CHARSET) continue;
COLORREF cl = F.value.colour;
- if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSHEADER ||
+ if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSHEADER ||
(F.flags&FIDF_CLASSMASK) == 0 &&
- (_tcsstr(F.name, _T("Incoming nick")) ||
- _tcsstr(F.name, _T("Outgoing nick")) ||
- _tcsstr(F.name, _T("Incoming timestamp")) ||
+ (_tcsstr(F.name, _T("Incoming nick")) ||
+ _tcsstr(F.name, _T("Outgoing nick")) ||
+ _tcsstr(F.name, _T("Incoming timestamp")) ||
_tcsstr(F.name, _T("Outgoing timestamp")))
)
{
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp index 050661aefb..832d8ae610 100644 --- a/src/modules/fonts/FontService.cpp +++ b/src/modules/fonts/FontService.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int code_page = CP_ACP;
HANDLE hFontReloadEvent, hColourReloadEvent;
-int OptInit( WPARAM, LPARAM );
+int OptInit(WPARAM, LPARAM);
int FontsModernOptInit(WPARAM wParam, LPARAM lParam);
INT_PTR RegisterFont(WPARAM wParam, LPARAM lParam);
@@ -67,7 +67,7 @@ static int OnPreShutdown(WPARAM, LPARAM) return 0;
}
-int LoadFontserviceModule( void )
+int LoadFontserviceModule(void)
{
code_page = LangPackGetDefaultCodePage();
@@ -103,19 +103,19 @@ int LoadFontserviceModule( void ) fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
fontid.order = 0;
- FontRegisterT( &fontid );
+ FontRegisterT(&fontid);
_tcsncpy(fontid.name, _T("Generic text"), SIZEOF(fontid.name));
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
fontid.order = 0;
- FontRegisterT( &fontid );
+ FontRegisterT(&fontid);
_tcsncpy(fontid.name, _T("Small text"), SIZEOF(fontid.name));
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
fontid.order = 0;
- FontRegisterT( &fontid );
+ FontRegisterT(&fontid);
// do last for silly dyna plugin
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
diff --git a/src/modules/fonts/FontService.h b/src/modules/fonts/FontService.h index 5d9a3f10a2..92e62ba9df 100644 --- a/src/modules/fonts/FontService.h +++ b/src/modules/fonts/FontService.h @@ -109,4 +109,4 @@ extern OBJLIST<TEffectID> effect_id_list; extern int code_page;
extern HANDLE hFontReloadEvent, hColourReloadEvent;
-int CreateFromFontSettings(TFontSettings *fs, LOGFONT *lf );
+int CreateFromFontSettings(TFontSettings *fs, LOGFONT *lf);
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index b19fd59144..3e69a5fe9f 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -27,17 +27,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. COLORREF GetColorFromDefault(COLORREF cl);
-void ConvertFontSettings( FontSettings* fs, TFontSettings* fsw)
+void ConvertFontSettings(FontSettings* fs, TFontSettings* fsw)
{
fsw->colour = fs->colour;
fsw->size = fs->size;
fsw->style = fs->style;
fsw->charset = fs->charset;
- MultiByteToWideChar( code_page, 0, fs->szFace, -1, fsw->szFace, LF_FACESIZE);
+ MultiByteToWideChar(code_page, 0, fs->szFace, -1, fsw->szFace, LF_FACESIZE);
}
-void ConvertFontID( FontID *fid, TFontID* fidw )
+void ConvertFontID(FontID *fid, TFontID* fidw)
{
memset(fidw, 0, sizeof(TFontID));
fidw->cbSize = sizeof(TFontID);
@@ -47,11 +47,11 @@ void ConvertFontID( FontID *fid, TFontID* fidw ) fidw->order = fid->order;
ConvertFontSettings(&fid->deffontsettings, &fidw->deffontsettings);
- MultiByteToWideChar( code_page, 0, fid->group, -1, fidw->group, 64);
- MultiByteToWideChar( code_page, 0, fid->name, -1, fidw->name, 64);
+ MultiByteToWideChar(code_page, 0, fid->group, -1, fidw->group, 64);
+ MultiByteToWideChar(code_page, 0, fid->name, -1, fidw->name, 64);
if (fid->cbSize >= FontID_SIZEOF_V2A) {
- MultiByteToWideChar( code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64);
- MultiByteToWideChar( code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64);
+ MultiByteToWideChar(code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64);
+ MultiByteToWideChar(code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64);
}
}
@@ -65,8 +65,8 @@ void ConvertColourID(ColourID *cid, TColourID* cidw) cidw->defcolour = cid->defcolour;
cidw->order = cid->order;
- MultiByteToWideChar( code_page, 0, cid->group, -1, cidw->group, 64);
- MultiByteToWideChar( code_page, 0, cid->name, -1, cidw->name, 64);
+ MultiByteToWideChar(code_page, 0, cid->group, -1, cidw->group, 64);
+ MultiByteToWideChar(code_page, 0, cid->name, -1, cidw->name, 64);
}
void ConvertEffectID(EffectID *eid, TEffectID* eidw)
@@ -81,8 +81,8 @@ void ConvertEffectID(EffectID *eid, TEffectID* eidw) eidw->defeffect.secondaryColour = eid->defeffect.secondaryColour;
eidw->order = eid->order;
- MultiByteToWideChar( code_page, 0, eid->group, -1, eidw->group, 64);
- MultiByteToWideChar( code_page, 0, eid->name, -1, eidw->name, 64);
+ MultiByteToWideChar(code_page, 0, eid->group, -1, eidw->group, 64);
+ MultiByteToWideChar(code_page, 0, eid->name, -1, eidw->name, 64);
}
@@ -102,13 +102,13 @@ void ConvertLOGFONT(LOGFONTW *lfw, LOGFONTA *lfa) lfa->lfQuality = lfw->lfQuality;
lfa->lfPitchAndFamily = lfw->lfPitchAndFamily;
- WideCharToMultiByte( code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, 0, 0);
+ WideCharToMultiByte(code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, 0, 0);
}
static void GetDefaultFontSetting(LOGFONT* lf, COLORREF* colour)
{
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), lf, FALSE);
- if ( colour )
+ if (colour)
*colour = GetSysColor(COLOR_WINDOWTEXT);
lf->lfHeight = 10;
@@ -130,7 +130,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR if (flags & FIDF_APPENDNAME) mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix);
else mir_snprintf(idstr, SIZEOF(idstr), "%s", prefix);
- if ( !DBGetContactSettingTString(NULL, settings_group, idstr, &dbv )) {
+ if ( !DBGetContactSettingTString(NULL, settings_group, idstr, &dbv)) {
_tcscpy(lf->lfFaceName, dbv.ptszVal);
DBFreeVariant(&dbv);
}
@@ -193,7 +193,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR return retval;
}
-int CreateFromFontSettings(TFontSettings* fs, LOGFONT* lf )
+int CreateFromFontSettings(TFontSettings* fs, LOGFONT* lf)
{
GetDefaultFontSetting(lf, 0);
@@ -218,8 +218,8 @@ void UpdateFontSettings(TFontID* font_id, TFontSettings* fontsettings) {
LOGFONT lf;
COLORREF colour;
- if ( GetFontSettingFromDB(font_id->dbSettingsGroup, font_id->prefix, &lf, &colour, font_id->flags) && (font_id->flags & FIDF_DEFAULTVALID)) {
- CreateFromFontSettings(&font_id->deffontsettings, &lf );
+ if (GetFontSettingFromDB(font_id->dbSettingsGroup, font_id->prefix, &lf, &colour, font_id->flags) && (font_id->flags & FIDF_DEFAULTVALID)) {
+ CreateFromFontSettings(&font_id->deffontsettings, &lf);
colour = GetColorFromDefault(font_id->deffontsettings.colour);
}
@@ -269,11 +269,11 @@ COLORREF GetColorFromDefault(COLORREF cl) /////////////////////////////////////////////////////////////////////////////////////////
// RegisterFont service
-static int sttRegisterFontWorker( TFontID* font_id )
+static int sttRegisterFontWorker(TFontID* font_id)
{
- for ( int i = 0; i < font_id_list.getCount(); i++ ) {
+ for (int i = 0; i < font_id_list.getCount(); i++) {
TFontID& F = font_id_list[i];
- if ( !lstrcmp( F.group, font_id->group ) && !lstrcmp( F.name, font_id->name ) && !( F.flags & FIDF_ALLOWREREGISTER ))
+ if ( !lstrcmp(F.group, font_id->group) && !lstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER))
return 1;
}
@@ -282,61 +282,61 @@ static int sttRegisterFontWorker( TFontID* font_id ) DBWriteContactSettingDword(0, font_id->dbSettingsGroup, idstr, font_id->flags);
{
TFontID* newItem = new TFontID;
- memset( newItem, 0, sizeof( TFontID ));
- memcpy( newItem, font_id, font_id->cbSize);
+ memset(newItem, 0, sizeof(TFontID));
+ memcpy(newItem, font_id, font_id->cbSize);
- if (!lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg")))
+ if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg")))
{
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace));
- if (!newItem->deffontsettings.size)
+ if ( !newItem->deffontsettings.size)
newItem->deffontsettings.size = lf.lfHeight;
}
- UpdateFontSettings( font_id, &newItem->value );
- font_id_list.insert( newItem );
+ UpdateFontSettings(font_id, &newItem->value);
+ font_id_list.insert(newItem);
}
return 0;
}
-INT_PTR RegisterFontW(WPARAM wParam, LPARAM )
+INT_PTR RegisterFontW(WPARAM wParam, LPARAM)
{
- return sttRegisterFontWorker(( TFontID* )wParam );
+ return sttRegisterFontWorker((TFontID*)wParam);
}
INT_PTR RegisterFont(WPARAM wParam, LPARAM)
{
TFontID temp;
- ConvertFontID(( FontID* )wParam, &temp );
- return sttRegisterFontWorker( &temp );
+ ConvertFontID((FontID*)wParam, &temp);
+ return sttRegisterFontWorker(&temp);
}
/////////////////////////////////////////////////////////////////////////////////////////
// GetFont service
-static int sttGetFontWorker( TFontID* font_id, LOGFONT* lf )
+static int sttGetFontWorker(TFontID* font_id, LOGFONT* lf)
{
COLORREF colour;
- for ( int i = 0; i < font_id_list.getCount(); i++ ) {
+ for (int i = 0; i < font_id_list.getCount(); i++) {
TFontID& F = font_id_list[i];
- if ( !_tcsncmp( F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp( F.group, font_id->group, SIZEOF(F.group))) {
- if ( GetFontSettingFromDB( F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && ( F.flags & FIDF_DEFAULTVALID )) {
- CreateFromFontSettings( &F.deffontsettings, lf );
+ if ( !_tcsncmp(F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp(F.group, font_id->group, SIZEOF(F.group))) {
+ if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) {
+ CreateFromFontSettings(&F.deffontsettings, lf);
colour = GetColorFromDefault(F.deffontsettings.colour);
}
return (int)colour;
} }
- GetDefaultFontSetting( lf, &colour );
+ GetDefaultFontSetting(lf, &colour);
return (int)colour;
}
INT_PTR GetFontW(WPARAM wParam, LPARAM lParam)
{
- return sttGetFontWorker(( TFontID* )wParam, ( LOGFONT* )lParam );
+ return sttGetFontWorker((TFontID*)wParam, (LOGFONT*)lParam);
}
INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
@@ -344,8 +344,8 @@ INT_PTR GetFont(WPARAM wParam, LPARAM lParam) TFontID temp;
LOGFONT lftemp;
ConvertFontID((FontID *)wParam, &temp);
- { int ret = sttGetFontWorker( &temp, &lftemp );
- ConvertLOGFONT( &lftemp, ( LOGFONTA* )lParam );
+ { int ret = sttGetFontWorker(&temp, &lftemp);
+ ConvertLOGFONT(&lftemp, (LOGFONTA*)lParam);
return ret;
}
}
@@ -353,48 +353,48 @@ INT_PTR GetFont(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// RegisterColour service
-void UpdateColourSettings( TColourID* colour_id, COLORREF *colour)
+void UpdateColourSettings(TColourID* colour_id, COLORREF *colour)
{
- *colour = ( COLORREF )DBGetContactSettingDword(NULL, colour_id->dbSettingsGroup, colour_id->setting, GetColorFromDefault(colour_id->defcolour) );
+ *colour = (COLORREF)DBGetContactSettingDword(NULL, colour_id->dbSettingsGroup, colour_id->setting, GetColorFromDefault(colour_id->defcolour));
}
-static int sttRegisterColourWorker( TColourID* colour_id )
+static int sttRegisterColourWorker(TColourID* colour_id)
{
- for ( int i = 0; i < colour_id_list.getCount(); i++ ) {
+ for (int i = 0; i < colour_id_list.getCount(); i++) {
TColourID& C = colour_id_list[i];
- if ( !_tcscmp( C.group, colour_id->group ) && !_tcscmp( C.name, colour_id->name ))
+ if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name))
return 1;
}
TColourID* newItem = new TColourID;
- memcpy( newItem, colour_id, sizeof( TColourID ));
- UpdateColourSettings( colour_id, &newItem->value );
- colour_id_list.insert( newItem );
+ memcpy(newItem, colour_id, sizeof(TColourID));
+ UpdateColourSettings(colour_id, &newItem->value);
+ colour_id_list.insert(newItem);
return 0;
}
INT_PTR RegisterColourW(WPARAM wParam, LPARAM)
{
- return sttRegisterColourWorker(( TColourID* )wParam );
+ return sttRegisterColourWorker((TColourID*)wParam);
}
INT_PTR RegisterColour(WPARAM wParam, LPARAM)
{
TColourID temp;
- ConvertColourID(( ColourID* )wParam, &temp );
- return sttRegisterColourWorker( &temp );
+ ConvertColourID((ColourID*)wParam, &temp);
+ return sttRegisterColourWorker(&temp);
}
/////////////////////////////////////////////////////////////////////////////////////////
// GetColour service
-static int sttGetColourWorker( TColourID* colour_id )
+static int sttGetColourWorker(TColourID* colour_id)
{
int i;
- for ( i = 0; i < colour_id_list.getCount(); i++ ) {
+ for (i = 0; i < colour_id_list.getCount(); i++) {
TColourID& C = colour_id_list[i];
- if ( !_tcscmp( C.group, colour_id->group ) && !_tcscmp( C.name, colour_id->name ))
+ if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name))
return (int)DBGetContactSettingDword(NULL, C.dbSettingsGroup, C.setting, GetColorFromDefault(C.defcolour));
}
@@ -403,14 +403,14 @@ static int sttGetColourWorker( TColourID* colour_id ) INT_PTR GetColourW(WPARAM wParam, LPARAM)
{
- return sttGetColourWorker(( TColourID* )wParam );
+ return sttGetColourWorker((TColourID*)wParam);
}
INT_PTR GetColour(WPARAM wParam, LPARAM)
{
TColourID temp;
- ConvertColourID(( ColourID* )wParam, &temp );
- return sttGetColourWorker( &temp );
+ ConvertColourID((ColourID*)wParam, &temp);
+ return sttGetColourWorker(&temp);
}
@@ -435,44 +435,44 @@ void UpdateEffectSettings(TEffectID* effect_id, TEffectSettings* effectsettings) /////////////////////////////////////////////////////////////////////////////////////////
// RegisterFont service
-static int sttRegisterEffectWorker( TEffectID* effect_id )
+static int sttRegisterEffectWorker(TEffectID* effect_id)
{
- for ( int i = 0; i < effect_id_list.getCount(); i++ ) {
+ for (int i = 0; i < effect_id_list.getCount(); i++) {
TEffectID& E = effect_id_list[i];
- if ( !_tcscmp( E.group, effect_id->group ) && !_tcscmp( E.name, effect_id->name ))
+ if ( !_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name))
return 1;
}
TEffectID* newItem = new TEffectID;
- memcpy( newItem, effect_id, sizeof( TEffectID ));
- UpdateEffectSettings( effect_id, &newItem->value );
- effect_id_list.insert( newItem );
+ memcpy(newItem, effect_id, sizeof(TEffectID));
+ UpdateEffectSettings(effect_id, &newItem->value);
+ effect_id_list.insert(newItem);
return 0;
}
INT_PTR RegisterEffectW(WPARAM wParam, LPARAM lParam)
{
- return sttRegisterEffectWorker(( TEffectID* )wParam );
+ return sttRegisterEffectWorker((TEffectID*)wParam);
}
INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam)
{
TEffectID temp;
- ConvertEffectID(( EffectID* )wParam, &temp );
- return sttRegisterEffectWorker( &temp );
+ ConvertEffectID((EffectID*)wParam, &temp);
+ return sttRegisterEffectWorker(&temp);
}
/////////////////////////////////////////////////////////////////////////////////////////
// GetEffect service
-static int sttGetEffectWorker( TEffectID* effect_id, FONTEFFECT* effect )
+static int sttGetEffectWorker(TEffectID* effect_id, FONTEFFECT* effect)
{
- for ( int i = 0; i < effect_id_list.getCount(); i++ ) {
+ for (int i = 0; i < effect_id_list.getCount(); i++) {
TEffectID& E = effect_id_list[i];
- if ( !_tcsncmp( E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp( E.group, effect_id->group, SIZEOF(E.group)))
+ if ( !_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group)))
{
TEffectSettings temp;
- UpdateEffectSettings( effect_id, &temp );
+ UpdateEffectSettings(effect_id, &temp);
effect->effectIndex = temp.effectIndex;
effect->baseColour = temp.baseColour;
@@ -486,12 +486,12 @@ static int sttGetEffectWorker( TEffectID* effect_id, FONTEFFECT* effect ) INT_PTR GetEffectW(WPARAM wParam, LPARAM lParam)
{
- return sttGetEffectWorker(( TEffectID* )wParam, ( FONTEFFECT* )lParam );
+ return sttGetEffectWorker((TEffectID*)wParam, (FONTEFFECT*)lParam);
}
INT_PTR GetEffect(WPARAM wParam, LPARAM lParam)
{
TEffectID temp;
ConvertEffectID((EffectID *)wParam, &temp);
- return sttGetEffectWorker( &temp, ( FONTEFFECT* )lParam );
+ return sttGetEffectWorker(&temp, (FONTEFFECT*)lParam);
}
diff --git a/src/modules/help/about.cpp b/src/modules/help/about.cpp index de962109fb..2d7616c0ed 100644 --- a/src/modules/help/about.cpp +++ b/src/modules/help/about.cpp @@ -57,9 +57,9 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar mir_sntprintf(str, SIZEOF(str), _T(STR_VERSION_FORMAT), TranslateT("v"), productVersion, isAnsi?" ANSI":"");
{
TCHAR oldTitle[256], newTitle[256];
- GetDlgItemText( hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF( oldTitle ));
- mir_sntprintf( newTitle, SIZEOF(newTitle), oldTitle, str );
- SetDlgItemText( hwndDlg, IDC_HEADERBAR, newTitle );
+ GetDlgItemText(hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF(oldTitle));
+ mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, str);
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, newTitle);
}
mir_sntprintf(str, SIZEOF(str), TranslateT("Built %s %s"), _T(__DATE__), _T(__TIME__));
@@ -92,7 +92,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return TRUE;
case WM_COMMAND:
- switch( LOWORD( wParam )) {
+ switch(LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
DestroyWindow(hwndDlg);
@@ -118,7 +118,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
- switch ( GetWindowLongPtr(( HWND )lParam, GWL_ID )) {
+ switch (GetWindowLongPtr((HWND)lParam, GWL_ID)) {
case IDC_WHITERECT:
case IDC_BUILDTIME:
case IDC_CREDITSFILE:
@@ -132,7 +132,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
case WM_DESTROY:
- Window_FreeIcon_IcoLib( hwndDlg );
+ Window_FreeIcon_IcoLib(hwndDlg);
{
HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg, IDC_VERSION, WM_GETFONT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_VERSION, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0), 0);
diff --git a/src/modules/history/history.cpp b/src/modules/history/history.cpp index ccaf14fab0..8e759f471c 100644 --- a/src/modules/history/history.cpp +++ b/src/modules/history/history.cpp @@ -33,8 +33,8 @@ static HANDLE hWindowList=0; static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM)
{
- HWND hwnd = WindowList_Find( hWindowList, ( HANDLE )wParam );
- if ( hwnd ) {
+ HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam);
+ if (hwnd) {
SetForegroundWindow(hwnd);
SetFocus(hwnd);
return 0;
@@ -46,7 +46,7 @@ static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM) static int HistoryContactDelete(WPARAM wParam, LPARAM)
{
HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam);
- if ( hwnd != NULL )
+ if (hwnd != NULL)
DestroyWindow(hwnd);
return 0;
}
@@ -64,7 +64,7 @@ int LoadHistoryModule(void) mi.cbSize = sizeof(mi);
mi.position = 1000090000;
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_HISTORY );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_HISTORY);
mi.pszName = LPGEN("View &History");
mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
Menu_AddContactMenuItem(&mi);
@@ -79,91 +79,91 @@ int LoadHistoryModule(void) /////////////////////////////////////////////////////////////////////////////////////////
// Fills the events list
-static void GetMessageDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
+static void GetMessageDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf)
{
- TCHAR* msg = DbGetEventTextT( dbei, CP_ACP );
- _tcsncpy( buf, msg ? msg : TranslateT("Invalid Message"), cbBuf );
+ TCHAR* msg = DbGetEventTextT(dbei, CP_ACP);
+ _tcsncpy(buf, msg ? msg : TranslateT("Invalid Message"), cbBuf);
buf[ cbBuf-1 ] = 0;
- mir_free( msg );
+ mir_free(msg);
}
-static void GetUrlDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
+static void GetUrlDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf)
{
int len = dbei->cbBlob;
- if ( len >= cbBuf )
+ if (len >= cbBuf)
len = cbBuf-1;
- MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )dbei->pBlob, len, buf, cbBuf );
+ MultiByteToWideChar(CP_ACP, 0, (LPCSTR)dbei->pBlob, len, buf, cbBuf);
buf[ len ] = 0;
- if ( len < cbBuf-3 )
- _tcscat( buf, _T( "\r\n" ));
+ if (len < cbBuf-3)
+ _tcscat(buf, _T("\r\n"));
}
-static void GetFileDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
+static void GetFileDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf)
{
- int len = dbei->cbBlob - sizeof( DWORD );
- if ( len >= cbBuf )
+ int len = dbei->cbBlob - sizeof(DWORD);
+ if (len >= cbBuf)
len = cbBuf-1;
- MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )dbei->pBlob + sizeof( DWORD ), len, buf, cbBuf );
+ MultiByteToWideChar(CP_ACP, 0, (LPCSTR)dbei->pBlob + sizeof(DWORD), len, buf, cbBuf);
buf[ len ] = 0;
- if ( len < cbBuf-3 )
- _tcscat( buf, _T( "\r\n" ));
+ if (len < cbBuf-3)
+ _tcscat(buf, _T("\r\n"));
}
-static void GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr )
+static void GetObjectDescription(DBEVENTINFO *dbei, TCHAR* str, int cbStr)
{
- switch( dbei->eventType ) {
+ switch(dbei->eventType) {
case EVENTTYPE_MESSAGE:
- GetMessageDescription( dbei, str, cbStr );
+ GetMessageDescription(dbei, str, cbStr);
break;
case EVENTTYPE_URL:
- GetUrlDescription( dbei, str, cbStr );
+ GetUrlDescription(dbei, str, cbStr);
break;
case EVENTTYPE_FILE:
- GetFileDescription( dbei, str, cbStr );
+ GetFileDescription(dbei, str, cbStr);
break;
default:
{
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService( MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
- if ( et && ( et->flags & DETF_HISTORY )) {
- GetMessageDescription( dbei, str, cbStr );
+ DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ if (et && (et->flags & DETF_HISTORY)) {
+ GetMessageDescription(dbei, str, cbStr);
}
else
str[ 0 ] = 0;
} } }
-static void GetObjectSummary( DBEVENTINFO *dbei, TCHAR* str, int cbStr )
+static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr)
{
TCHAR* pszSrc, *pszTmp = NULL;
- switch( dbei->eventType ) {
+ switch(dbei->eventType) {
case EVENTTYPE_MESSAGE:
- if ( dbei->flags & DBEF_SENT ) pszSrc = TranslateT( "Outgoing Message" );
- else pszSrc = TranslateT( "Incoming Message" );
+ if (dbei->flags & DBEF_SENT) pszSrc = TranslateT("Outgoing Message");
+ else pszSrc = TranslateT("Incoming Message");
break;
case EVENTTYPE_URL:
- if ( dbei->flags & DBEF_SENT ) pszSrc = TranslateT( "Outgoing URL" );
- else pszSrc = TranslateT( "Incoming URL" );
+ if (dbei->flags & DBEF_SENT) pszSrc = TranslateT("Outgoing URL");
+ else pszSrc = TranslateT("Incoming URL");
break;
case EVENTTYPE_FILE:
- if ( dbei->flags & DBEF_SENT ) pszSrc = TranslateT( "Outgoing File" );
- else pszSrc = TranslateT( "Incoming File" );
+ if (dbei->flags & DBEF_SENT) pszSrc = TranslateT("Outgoing File");
+ else pszSrc = TranslateT("Incoming File");
break;
default:
{
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService( MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
- if ( et && ( et->flags & DETF_HISTORY )) {
- pszTmp = mir_a2t( et->descr );
- pszSrc = TranslateTS( pszTmp );
+ DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ if (et && (et->flags & DETF_HISTORY)) {
+ pszTmp = mir_a2t(et->descr);
+ pszSrc = TranslateTS(pszTmp);
break;
}
else {
@@ -171,10 +171,10 @@ static void GetObjectSummary( DBEVENTINFO *dbei, TCHAR* str, int cbStr ) return;
} } }
- _tcsncpy( str, ( const TCHAR* )pszSrc, cbStr );
+ _tcsncpy(str, (const TCHAR*)pszSrc, cbStr);
str[ cbStr-1 ] = 0;
- mir_free( pszTmp );
+ mir_free(pszTmp);
}
typedef struct {
@@ -189,7 +189,7 @@ static void FillHistoryThread(void* param) DBEVENTINFO dbei;
int newBlobSize, oldBlobSize, i;
HWND hwndList;
- THistoryThread *hInfo = ( THistoryThread* )param;
+ THistoryThread *hInfo = (THistoryThread*)param;
SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_RESETCONTENT, 0, 0);
i=CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)hInfo->hContact, 0);
@@ -200,8 +200,8 @@ static void FillHistoryThread(void* param) oldBlobSize=0;
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hInfo->hContact, 0);
hwndList = GetDlgItem(hInfo->hwnd, IDC_LIST);
- while ( hDbEvent != NULL ) {
- if ( !IsWindow( hInfo->hwnd ))
+ while (hDbEvent != NULL) {
+ if ( !IsWindow(hInfo->hwnd))
break;
newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
if (newBlobSize>oldBlobSize) {
@@ -209,12 +209,12 @@ static void FillHistoryThread(void* param) oldBlobSize=newBlobSize;
}
dbei.cbBlob = oldBlobSize;
- CallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei );
+ CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
GetObjectSummary(&dbei, str, SIZEOF(str));
if (str[0]) {
tmi.printTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, SIZEOF(strdatetime), 0);
- mir_sntprintf( eventText, SIZEOF(eventText), _T("%s: %s"), strdatetime, str );
- i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText );
+ mir_sntprintf(eventText, SIZEOF(eventText), _T("%s: %s"), strdatetime, str);
+ i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText);
SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent);
}
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
@@ -257,7 +257,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP Utils_RestoreWindowPosition(hwndDlg, hContact, "History", "");
{
TCHAR* contactName, str[200];
- contactName = cli.pfnGetContactDisplayName( hContact, 0 );
+ contactName = cli.pfnGetContactDisplayName(hContact, 0);
mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"), contactName);
SetWindowText(hwndDlg, str);
}
@@ -298,7 +298,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
}
case WM_COMMAND:
- switch ( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
DestroyWindow(hwndDlg);
@@ -312,10 +312,10 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
HANDLE hDbevent;
int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
- if ( index == LB_ERR )
+ if (index == LB_ERR)
break;
- if ( MessageBox(hwndDlg, TranslateT("Are you sure you want to delete this history item?"), TranslateT("Delete History"), MB_YESNO|MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(hwndDlg, TranslateT("Are you sure you want to delete this history item?"), TranslateT("Delete History"), MB_YESNO|MB_ICONQUESTION) == IDYES) {
hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hDbevent);
SendMessage(hwndDlg, DM_HREBUILD, 0, 0);
@@ -323,7 +323,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
}
case IDC_LIST:
- if ( HIWORD(wParam) == LBN_SELCHANGE ) {
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
TCHAR str[8192], *contactName;
HANDLE hDbEvent;
DBEVENTINFO dbei;
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP sel=SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), FALSE); break; }
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), TRUE);
- contactName = cli.pfnGetContactDisplayName( hContact, 0 );
+ contactName = cli.pfnGetContactDisplayName(hContact, 0);
hDbEvent=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, sel, 0);
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize=sizeof(dbei);
@@ -342,7 +342,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0)
{
GetObjectDescription(&dbei, str, SIZEOF(str));
- if ( str[0] )
+ if (str[0])
SetDlgItemText(hwndDlg, IDC_EDIT, str);
}
mir_free(dbei.pBlob);
@@ -359,7 +359,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP int newBlobSize, oldBlobSize;
int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
- if ( index == LB_ERR )
+ if (index == LB_ERR)
break;
hDbEventStart=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
@@ -369,7 +369,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP oldBlobSize=0;
for (;;) {
hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, ++index, 0);
- if (hDbEvent == ( HANDLE )LB_ERR) {
+ if (hDbEvent == (HANDLE)LB_ERR) {
index = -1;
continue;
}
@@ -384,7 +384,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetObjectDescription(&dbei, str, SIZEOF(str));
if (str[0]) {
CharUpperBuff(str, lstrlen(str));
- if ( _tcsstr(str, (const TCHAR*)lParam) != NULL) {
+ if (_tcsstr(str, (const TCHAR*)lParam) != NULL) {
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);
break;
@@ -406,11 +406,11 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE;
case WM_COMMAND:
- switch ( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDOK://find Next
{
TCHAR str[128];
- HWND hwndParent = ( HWND )GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HWND hwndParent = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, SIZEOF(str));
CharUpperBuff(str, lstrlen(str));
SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
diff --git a/src/modules/icolib/extracticon.cpp b/src/modules/icolib/extracticon.cpp index 06025ad843..6a9b3a2ccc 100644 --- a/src/modules/icolib/extracticon.cpp +++ b/src/modules/icolib/extracticon.cpp @@ -50,7 +50,7 @@ typedef struct void* _RelativeVirtualAddresstoPtr(IMAGE_DOS_HEADER* pDosHeader, DWORD rva)
{
IMAGE_NT_HEADERS* pPE = (IMAGE_NT_HEADERS*)((BYTE*)pDosHeader + pDosHeader->e_lfanew);
- IMAGE_SECTION_HEADER* pSection = IMAGE_FIRST_SECTION( pPE );
+ IMAGE_SECTION_HEADER* pSection = IMAGE_FIRST_SECTION(pPE);
int i;
for (i = 0; i < pPE->FileHeader.NumberOfSections; i++) {
@@ -145,12 +145,12 @@ void* _FindResource(IMAGE_DOS_HEADER* pDosHeader, void* prt, int resIndex, int r if (pRes[index].OffsetToData & IMAGE_RESOURCE_DATA_IS_DIRECTORY) {
IMAGE_RESOURCE_DIRECTORY* pDir;
- pDir = (IMAGE_RESOURCE_DIRECTORY*)((LPBYTE)prt + (pRes[index].OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY) );
+ pDir = (IMAGE_RESOURCE_DIRECTORY*)((LPBYTE)prt + (pRes[index].OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY));
pRes = (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(pDir+1);
index = 0;
}
- if ( pRes[index].OffsetToData & IMAGE_RESOURCE_DATA_IS_DIRECTORY )
+ if (pRes[index].OffsetToData & IMAGE_RESOURCE_DATA_IS_DIRECTORY)
return NULL;
pEntry = (IMAGE_RESOURCE_DATA_ENTRY*)((LPBYTE)prt + pRes[index].OffsetToData);
@@ -183,21 +183,21 @@ UINT _ExtractFromExe(HANDLE hFile, int iconIndex, int cxIconSize, int cyIconSize if ((DWORD)(pDosHeader->e_lfanew) >= fileLen) goto cleanup;
pRes = _GetResourceTable(pDosHeader);
- if (!pRes) goto cleanup;
- if (!phicon) {
+ if ( !pRes) goto cleanup;
+ if ( !phicon) {
retval = _FindResourceCount(pRes, (int)RT_GROUP_ICON);
goto cleanup;
}
pIconDir = (NEWHEADER*)_FindResource(pDosHeader, pRes, iconIndex, (int)RT_GROUP_ICON, &cbSize);
- if (!pIconDir) goto cleanup;
+ if ( !pIconDir) goto cleanup;
if (pIconDir->Reserved || pIconDir->ResType != RES_ICON) goto cleanup;
idIcon = LookupIconIdFromDirectoryEx((LPBYTE)pIconDir, TRUE, cxIconSize, cyIconSize, flags);
pIcon = (LPBITMAPINFOHEADER)_FindResource(pDosHeader, pRes, -idIcon, (int)RT_ICON, &cbSize);
- if (!pIcon) goto cleanup;
+ if ( !pIcon) goto cleanup;
- if ( pIcon->biSize != sizeof(BITMAPINFOHEADER) && pIcon->biSize != sizeof(BITMAPCOREHEADER)) {
+ if (pIcon->biSize != sizeof(BITMAPINFOHEADER) && pIcon->biSize != sizeof(BITMAPCOREHEADER)) {
_ASSERT(0);
goto cleanup;
}
@@ -212,20 +212,20 @@ cleanup: return retval;
}
-UINT _ExtractFromICO( LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, HICON* phicon, UINT flags )
+UINT _ExtractFromICO(LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, HICON* phicon, UINT flags)
{
HICON hicon;
- if ( iconIndex >= 1 )
+ if (iconIndex >= 1)
return 0;
// do we just want a count?
- if (!phicon)
+ if ( !phicon)
return 1;
flags |= LR_LOADFROMFILE;
- hicon = (HICON)LoadImage( NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags );
- if (!hicon)
+ hicon = (HICON)LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);
+ if ( !hicon)
return 0;
*phicon = hicon;
@@ -253,12 +253,12 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC return 0;
// failed to read file signature
- if ( !ReadFile(hFile, &magic, sizeof(magic), &read, NULL ) || (read != sizeof(magic))) {
+ if ( !ReadFile(hFile, &magic, sizeof(magic), &read, NULL) || (read != sizeof(magic))) {
CloseHandle(hFile);
return 0;
}
- switch ( magic[0] ) {
+ switch (magic[0]) {
case IMAGE_DOS_SIGNATURE:
res = _ExtractFromExe(hFile, iconIndex, cxIcon, cyIcon, phicon, flags);
break;
@@ -269,7 +269,7 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC break;
case MAGIC_ICON:
- if ((magic[1] == MAGIC_ICO1 || magic[1] == MAGIC_CUR ) && magic[2] >= 1 )
+ if ((magic[1] == MAGIC_ICO1 || magic[1] == MAGIC_CUR) && magic[2] >= 1)
res = _ExtractFromICO(lpszFile, iconIndex, cxIcon, cyIcon, phicon, flags);
break;
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 2c2776d523..e02fcf579a 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -42,25 +42,25 @@ struct IcoLibOptsData { CRITICAL_SECTION csIconList;
-#define SECTIONPARAM_MAKE(index, level, flags) MAKELONG((index)&0xFFFF, MAKEWORD( level, flags ) )
-#define SECTIONPARAM_INDEX(lparam) LOWORD( lparam )
-#define SECTIONPARAM_LEVEL(lparam) LOBYTE( HIWORD(lparam) )
-#define SECTIONPARAM_FLAGS(lparam) HIBYTE( HIWORD(lparam) )
+#define SECTIONPARAM_MAKE(index, level, flags) MAKELONG((index)&0xFFFF, MAKEWORD(level, flags))
+#define SECTIONPARAM_INDEX(lparam) LOWORD(lparam)
+#define SECTIONPARAM_LEVEL(lparam) LOBYTE(HIWORD(lparam))
+#define SECTIONPARAM_FLAGS(lparam) HIBYTE(HIWORD(lparam))
#define SECTIONPARAM_HAVEPAGE 0x0001
-static int sttCompareSections( const SectionItem* p1, const SectionItem* p2 )
-{ return _tcscmp( p1->name, p2->name );
+static int sttCompareSections(const SectionItem* p1, const SectionItem* p2)
+{ return _tcscmp(p1->name, p2->name);
}
-static LIST<SectionItem> sectionList( 20, sttCompareSections );
+static LIST<SectionItem> sectionList(20, sttCompareSections);
-static int sttCompareIconSourceFiles( const IconSourceFile* p1, const IconSourceFile* p2 )
-{ return _tcsicmp( p1->file, p2->file );
+static int sttCompareIconSourceFiles(const IconSourceFile* p1, const IconSourceFile* p2)
+{ return _tcsicmp(p1->file, p2->file);
}
-static LIST<IconSourceFile> iconSourceFileList( 10, sttCompareIconSourceFiles );
+static LIST<IconSourceFile> iconSourceFileList(10, sttCompareIconSourceFiles);
-static int sttCompareIconSourceItems( const IconSourceItem* p1, const IconSourceItem* p2 )
+static int sttCompareIconSourceItems(const IconSourceItem* p1, const IconSourceItem* p2)
{ if (p1->indx < p2->indx)
return -1;
@@ -79,82 +79,82 @@ static int sttCompareIconSourceItems( const IconSourceItem* p1, const IconSource if (p1->cy > p2->cy)
return 1;
- if ( p1->file == p2->file )
+ if (p1->file == p2->file)
return 0;
- return ( p1->file > p2->file ) ? 1 : -1;
+ return (p1->file > p2->file) ? 1 : -1;
}
-static LIST<IconSourceItem> iconSourceList( 20, sttCompareIconSourceItems );
+static LIST<IconSourceItem> iconSourceList(20, sttCompareIconSourceItems);
-static int sttCompareIcons( const IconItem* p1, const IconItem* p2 )
-{ return strcmp( p1->name, p2->name );
+static int sttCompareIcons(const IconItem* p1, const IconItem* p2)
+{ return strcmp(p1->name, p2->name);
}
-static LIST<IconItem> iconList( 20, sttCompareIcons );
+static LIST<IconItem> iconList(20, sttCompareIcons);
/////////////////////////////////////////////////////////////////////////////////////////
// Utility functions
static void __fastcall MySetCursor(TCHAR* nCursor)
-{ SetCursor( LoadCursor( NULL, nCursor ));
+{ SetCursor(LoadCursor(NULL, nCursor));
}
static void __fastcall SAFE_FREE(void** p)
{
- if ( *p ) {
- mir_free( *p );
+ if (*p) {
+ mir_free(*p);
*p = NULL;
} }
-static void __fastcall SafeDestroyIcon( HICON* icon )
+static void __fastcall SafeDestroyIcon(HICON* icon)
{
- if ( *icon ) {
- DestroyIcon( *icon );
+ if (*icon) {
+ DestroyIcon(*icon);
*icon = NULL;
} }
// Helper functions to manage Icon resources
-IconSourceFile* IconSourceFile_Get( const TCHAR* file, bool isPath )
+IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath)
{
TCHAR fileFull[ MAX_PATH ];
- if ( !file )
+ if ( !file)
return NULL;
if (isPath)
- pathToAbsoluteT( file, fileFull, NULL );
+ pathToAbsoluteT(file, fileFull, NULL);
/// TODO: convert path to long - eliminate duplicate items
else
- _tcscpy( fileFull, file );
+ _tcscpy(fileFull, file);
IconSourceFile key = { fileFull };
int ix;
- if (( ix = iconSourceFileList.getIndex( &key )) != -1 ) {
+ if ((ix = iconSourceFileList.getIndex(&key)) != -1) {
iconSourceFileList[ ix ]->ref_count++;
return iconSourceFileList[ ix ];
}
- IconSourceFile* newItem = (IconSourceFile*)mir_calloc( sizeof( IconSourceFile ));
- newItem->file = mir_tstrdup( fileFull );
+ IconSourceFile* newItem = (IconSourceFile*)mir_calloc(sizeof(IconSourceFile));
+ newItem->file = mir_tstrdup(fileFull);
newItem->ref_count = 1;
- iconSourceFileList.insert( newItem );
+ iconSourceFileList.insert(newItem);
return newItem;
}
-int IconSourceFile_Release( IconSourceFile** pitem )
+int IconSourceFile_Release(IconSourceFile** pitem)
{
- if ( pitem && *pitem && (*pitem)->ref_count ) {
+ if (pitem && *pitem && (*pitem)->ref_count) {
IconSourceFile* item = *pitem;
- if ( --item->ref_count <= 0 ) {
+ if (--item->ref_count <= 0) {
int indx;
- if (( indx = iconSourceFileList.getIndex( item )) != -1 ) {
- SAFE_FREE(( void** )&item->file );
- iconSourceFileList.remove( indx );
- SAFE_FREE(( void** )&item );
+ if ((indx = iconSourceFileList.getIndex(item)) != -1) {
+ SAFE_FREE((void**)&item->file);
+ iconSourceFileList.remove(indx);
+ SAFE_FREE((void**)&item);
}
}
*pitem = NULL;
@@ -169,15 +169,15 @@ static int BytesPerScanLine(int PixelsPerScanline, int BitsPerPixel, int Alignme return bytes / 8;
}
-static int InitializeBitmapInfoHeader( HBITMAP bitmap, BITMAPINFOHEADER* bi )
+static int InitializeBitmapInfoHeader(HBITMAP bitmap, BITMAPINFOHEADER* bi)
{
DIBSECTION DS;
int bytes;
DS.dsBmih.biSize = 0;
- bytes = GetObject( bitmap, sizeof(DS), &DS );
- if ( bytes == 0 ) return 1; // Failure
- else if (( bytes >= (sizeof(DS.dsBm) + sizeof(DS.dsBmih))) &&
+ bytes = GetObject(bitmap, sizeof(DS), &DS);
+ if (bytes == 0) return 1; // Failure
+ else if ((bytes >= (sizeof(DS.dsBm) + sizeof(DS.dsBmih))) &&
(DS.dsBmih.biSize >= DWORD(sizeof(DS.dsBmih))))
*bi = DS.dsBmih;
else {
@@ -188,25 +188,25 @@ static int InitializeBitmapInfoHeader( HBITMAP bitmap, BITMAPINFOHEADER* bi ) }
bi->biBitCount = DS.dsBm.bmBitsPixel * DS.dsBm.bmPlanes;
bi->biPlanes = 1;
- if ( bi->biClrImportant > bi->biClrUsed )
+ if (bi->biClrImportant > bi->biClrUsed)
bi->biClrImportant = bi->biClrUsed;
- if ( !bi->biSizeImage )
- bi->biSizeImage = BytesPerScanLine( bi->biWidth, bi->biBitCount, 32 ) * abs( bi->biHeight );
+ if ( !bi->biSizeImage)
+ bi->biSizeImage = BytesPerScanLine(bi->biWidth, bi->biBitCount, 32) * abs(bi->biHeight);
return 0; // Success
}
-static int InternalGetDIBSizes( HBITMAP bitmap, int* InfoHeaderSize, int* ImageSize )
+static int InternalGetDIBSizes(HBITMAP bitmap, int* InfoHeaderSize, int* ImageSize)
{
BITMAPINFOHEADER bi;
- if ( InitializeBitmapInfoHeader( bitmap, &bi )) return 1; // Failure
- if ( bi.biBitCount > 8 ) {
+ if (InitializeBitmapInfoHeader(bitmap, &bi)) return 1; // Failure
+ if (bi.biBitCount > 8) {
*InfoHeaderSize = sizeof(BITMAPINFOHEADER);
- if ((bi.biCompression & BI_BITFIELDS) != 0 )
+ if ((bi.biCompression & BI_BITFIELDS) != 0)
*InfoHeaderSize += 12;
}
else {
- if ( bi.biClrUsed == 0 )
+ if (bi.biClrUsed == 0)
*InfoHeaderSize = sizeof(BITMAPINFOHEADER) +
sizeof(RGBQUAD) * (int)(1 << bi.biBitCount);
else
@@ -217,53 +217,53 @@ static int InternalGetDIBSizes( HBITMAP bitmap, int* InfoHeaderSize, int* ImageS return 0; // Success
}
-static int InternalGetDIB( HBITMAP bitmap, HPALETTE palette, void* bitmapInfo, void* Bits )
+static int InternalGetDIB(HBITMAP bitmap, HPALETTE palette, void* bitmapInfo, void* Bits)
{
HPALETTE oldPal = 0;
- if ( InitializeBitmapInfoHeader( bitmap, (BITMAPINFOHEADER*)bitmapInfo )) return 1; // Failure
+ if (InitializeBitmapInfoHeader(bitmap, (BITMAPINFOHEADER*)bitmapInfo)) return 1; // Failure
HDC DC = CreateCompatibleDC(0);
- if ( palette ) {
- oldPal = SelectPalette( DC, palette, FALSE );
- RealizePalette( DC );
+ if (palette) {
+ oldPal = SelectPalette(DC, palette, FALSE);
+ RealizePalette(DC);
}
- int result = GetDIBits( DC, bitmap, 0, ((BITMAPINFOHEADER*)bitmapInfo)->biHeight, Bits, (BITMAPINFO*)bitmapInfo, DIB_RGB_COLORS) == 0;
+ int result = GetDIBits(DC, bitmap, 0, ((BITMAPINFOHEADER*)bitmapInfo)->biHeight, Bits, (BITMAPINFO*)bitmapInfo, DIB_RGB_COLORS) == 0;
- if ( oldPal ) SelectPalette( DC, oldPal, FALSE );
- DeleteDC( DC );
+ if (oldPal) SelectPalette(DC, oldPal, FALSE);
+ DeleteDC(DC);
return result;
}
-static int GetIconData( HICON icon, BYTE** data, int* size )
+static int GetIconData(HICON icon, BYTE** data, int* size)
{
ICONINFO iconInfo;
int MonoInfoSize, ColorInfoSize;
int MonoBitsSize, ColorBitsSize;
- if ( !data || !size ) return 1; // Failure
+ if ( !data || !size) return 1; // Failure
- if ( !GetIconInfo( icon, &iconInfo )) return 1; // Failure
+ if ( !GetIconInfo(icon, &iconInfo)) return 1; // Failure
- if ( InternalGetDIBSizes( iconInfo.hbmMask, &MonoInfoSize, &MonoBitsSize ) ||
- InternalGetDIBSizes( iconInfo.hbmColor, &ColorInfoSize, &ColorBitsSize )) {
- DeleteObject( iconInfo.hbmColor );
- DeleteObject( iconInfo.hbmMask );
+ if (InternalGetDIBSizes(iconInfo.hbmMask, &MonoInfoSize, &MonoBitsSize) ||
+ InternalGetDIBSizes(iconInfo.hbmColor, &ColorInfoSize, &ColorBitsSize)) {
+ DeleteObject(iconInfo.hbmColor);
+ DeleteObject(iconInfo.hbmMask);
return 1; // Failure
}
- void* MonoInfo = mir_alloc( MonoInfoSize );
- void* MonoBits = mir_alloc( MonoBitsSize );
- void* ColorInfo = mir_alloc( ColorInfoSize );
- void* ColorBits = mir_alloc( ColorBitsSize );
-
- if ( InternalGetDIB( iconInfo.hbmMask, 0, MonoInfo, MonoBits ) ||
- InternalGetDIB( iconInfo.hbmColor, 0, ColorInfo, ColorBits )) {
- SAFE_FREE( &MonoInfo );
- SAFE_FREE( &MonoBits );
- SAFE_FREE( &ColorInfo );
- SAFE_FREE( &ColorBits );
- DeleteObject( iconInfo.hbmColor );
- DeleteObject( iconInfo.hbmMask );
+ void* MonoInfo = mir_alloc(MonoInfoSize);
+ void* MonoBits = mir_alloc(MonoBitsSize);
+ void* ColorInfo = mir_alloc(ColorInfoSize);
+ void* ColorBits = mir_alloc(ColorBitsSize);
+
+ if (InternalGetDIB(iconInfo.hbmMask, 0, MonoInfo, MonoBits) ||
+ InternalGetDIB(iconInfo.hbmColor, 0, ColorInfo, ColorBits)) {
+ SAFE_FREE(&MonoInfo);
+ SAFE_FREE(&MonoBits);
+ SAFE_FREE(&ColorInfo);
+ SAFE_FREE(&ColorBits);
+ DeleteObject(iconInfo.hbmColor);
+ DeleteObject(iconInfo.hbmMask);
return 1; // Failure
}
@@ -272,141 +272,141 @@ static int GetIconData( HICON icon, BYTE** data, int* size ) BYTE* buf = *data;
((BITMAPINFOHEADER*)ColorInfo)->biHeight *= 2; // color height includes mono bits
- memcpy( buf, ColorInfo, ColorInfoSize );
+ memcpy(buf, ColorInfo, ColorInfoSize);
buf += ColorInfoSize;
- memcpy( buf, ColorBits, ColorBitsSize );
+ memcpy(buf, ColorBits, ColorBitsSize);
buf += ColorBitsSize;
- memcpy( buf, MonoBits, MonoBitsSize );
-
- SAFE_FREE( &MonoInfo );
- SAFE_FREE( &MonoBits );
- SAFE_FREE( &ColorInfo );
- SAFE_FREE( &ColorBits );
- DeleteObject( iconInfo.hbmColor );
- DeleteObject( iconInfo.hbmMask );
+ memcpy(buf, MonoBits, MonoBitsSize);
+
+ SAFE_FREE(&MonoInfo);
+ SAFE_FREE(&MonoBits);
+ SAFE_FREE(&ColorInfo);
+ SAFE_FREE(&ColorBits);
+ DeleteObject(iconInfo.hbmColor);
+ DeleteObject(iconInfo.hbmMask);
return 0; // Success
}
#define VER30 0x00030000
-static HICON IconSourceItem_GetIcon( IconSourceItem* item )
+static HICON IconSourceItem_GetIcon(IconSourceItem* item)
{
- if ( item->icon ) {
+ if (item->icon) {
item->icon_ref_count++;
return item->icon;
}
- if ( item->icon_size ) {
- item->icon = CreateIconFromResourceEx( item->icon_data, item->icon_size, TRUE, VER30, item->cx, item->cy, LR_COLOR );
- if ( item->icon ) {
+ if (item->icon_size) {
+ item->icon = CreateIconFromResourceEx(item->icon_data, item->icon_size, TRUE, VER30, item->cx, item->cy, LR_COLOR);
+ if (item->icon) {
item->icon_ref_count++;
return item->icon;
}
}
//SHOULD BE REPLACED WITH GOOD ENOUGH FUNCTION
- _ExtractIconEx( item->file->file, item->indx, item->cx, item->cy, &item->icon, LR_COLOR );
+ _ExtractIconEx(item->file->file, item->indx, item->cx, item->cy, &item->icon, LR_COLOR);
- if ( item->icon )
+ if (item->icon)
item->icon_ref_count++;
return item->icon;
}
-static int IconSourceItem_ReleaseIcon( IconSourceItem* item )
+static int IconSourceItem_ReleaseIcon(IconSourceItem* item)
{
- if ( item && item->icon_ref_count )
+ if (item && item->icon_ref_count)
{
item->icon_ref_count--;
- if ( !item->icon_ref_count ) {
- if ( !item->icon_size )
- if ( GetIconData( item->icon, &item->icon_data, &item->icon_size ))
+ if ( !item->icon_ref_count) {
+ if ( !item->icon_size)
+ if (GetIconData(item->icon, &item->icon_data, &item->icon_size))
item->icon_size = 0; // Failure
- SafeDestroyIcon( &item->icon );
+ SafeDestroyIcon(&item->icon);
}
return 0; // Success
}
return 1; // Failure
}
-IconSourceItem* GetIconSourceItem( const TCHAR* file, int indx, int cxIcon, int cyIcon )
+IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon)
{
- if ( !file )
+ if ( !file)
return NULL;
- IconSourceFile* r_file = IconSourceFile_Get( file, true );
+ IconSourceFile* r_file = IconSourceFile_Get(file, true);
IconSourceItem key = { r_file, indx, cxIcon, cyIcon };
int ix;
- if (( ix = iconSourceList.getIndex( &key )) != -1 ) {
- IconSourceFile_Release( &r_file );
+ if ((ix = iconSourceList.getIndex(&key)) != -1) {
+ IconSourceFile_Release(&r_file);
iconSourceList[ ix ]->ref_count++;
return iconSourceList[ ix ];
}
- IconSourceItem* newItem = (IconSourceItem*)mir_calloc( sizeof( IconSourceItem ));
+ IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem));
newItem->file = r_file;
newItem->indx = indx;
newItem->ref_count = 1;
newItem->cx = cxIcon;
newItem->cy = cyIcon;
- iconSourceList.insert( newItem );
+ iconSourceList.insert(newItem);
return newItem;
}
-IconSourceItem* GetIconSourceItemFromPath( const TCHAR* path, int cxIcon, int cyIcon )
+IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyIcon)
{
TCHAR *comma;
TCHAR file[ MAX_PATH ];
int n;
- if ( !path )
+ if ( !path)
return NULL;
- lstrcpyn( file, path, SIZEOF( file ));
- comma = _tcsrchr( file, ',' );
- if ( !comma )
+ lstrcpyn(file, path, SIZEOF(file));
+ comma = _tcsrchr(file, ',');
+ if ( !comma)
n = 0;
else {
- n = _ttoi( comma+1 );
+ n = _ttoi(comma+1);
*comma = 0;
}
- return GetIconSourceItem( file, n, cxIcon, cyIcon );
+ return GetIconSourceItem(file, n, cxIcon, cyIcon);
}
-IconSourceItem* CreateStaticIconSourceItem( int cxIcon, int cyIcon )
+IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
{
TCHAR sourceName[ MAX_PATH ];
IconSourceFile key = { sourceName };
int i = 0;
do { // find new unique name
- mir_sntprintf( sourceName, SIZEOF( sourceName ), _T("*StaticIcon_%d"), ++i);
- } while ( iconSourceFileList.getIndex( &key ) != -1 );
+ mir_sntprintf(sourceName, SIZEOF(sourceName), _T("*StaticIcon_%d"), ++i);
+ } while (iconSourceFileList.getIndex(&key) != -1);
- IconSourceItem* newItem = (IconSourceItem*)mir_calloc( sizeof( IconSourceItem ));
- newItem->file = IconSourceFile_Get( sourceName, false );
+ IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem));
+ newItem->file = IconSourceFile_Get(sourceName, false);
newItem->indx = 0;
newItem->ref_count = 1;
newItem->cx = cxIcon;
newItem->cy = cyIcon;
- iconSourceList.insert( newItem );
+ iconSourceList.insert(newItem);
return newItem;
}
-static int IconSourceItem_Release( IconSourceItem** pitem )
+static int IconSourceItem_Release(IconSourceItem** pitem)
{
- if ( pitem && *pitem && (*pitem)->ref_count ) {
+ if (pitem && *pitem && (*pitem)->ref_count) {
IconSourceItem* item = *pitem;
item->ref_count--;
- if ( !item->ref_count ) {
+ if ( !item->ref_count) {
int indx;
- if (( indx = iconSourceList.getIndex( item )) != -1 ) {
- IconSourceFile_Release( &item->file );
- SafeDestroyIcon( &item->icon );
- SAFE_FREE(( void** )&item->icon_data );
- iconSourceList.remove( indx );
- SAFE_FREE(( void** )&item );
+ if ((indx = iconSourceList.getIndex(item)) != -1) {
+ IconSourceFile_Release(&item->file);
+ SafeDestroyIcon(&item->icon);
+ SAFE_FREE((void**)&item->icon_data);
+ iconSourceList.remove(indx);
+ SAFE_FREE((void**)&item);
}
}
*pitem = NULL;
@@ -418,47 +418,47 @@ static int IconSourceItem_Release( IconSourceItem** pitem ) /////////////////////////////////////////////////////////////////////////////////////////
// Service functions
-static HICON ExtractIconFromPath( const TCHAR *path, int cxIcon, int cyIcon )
+static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon)
{
TCHAR *comma;
TCHAR file[ MAX_PATH ], fileFull[ MAX_PATH ];
int n;
HICON hIcon;
- if ( !path )
+ if ( !path)
return (HICON)NULL;
- lstrcpyn( file, path, SIZEOF( file ));
- comma = _tcsrchr( file, ',' );
- if ( !comma )
+ lstrcpyn(file, path, SIZEOF(file));
+ comma = _tcsrchr(file, ',');
+ if ( !comma)
n = 0;
else {
- n = _ttoi( comma+1 );
+ n = _ttoi(comma+1);
*comma = 0;
}
- pathToAbsoluteT( file, fileFull, NULL );
+ pathToAbsoluteT(file, fileFull, NULL);
hIcon = NULL;
//SHOULD BE REPLACED WITH GOOD ENOUGH FUNCTION
- _ExtractIconEx( fileFull, n, cxIcon, cyIcon, &hIcon, LR_COLOR );
+ _ExtractIconEx(fileFull, n, cxIcon, cyIcon, &hIcon, LR_COLOR);
return hIcon;
}
static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new)
{
- if ( !sectionName )
+ if ( !sectionName)
return NULL;
int indx;
SectionItem key = { sectionName, 0 };
- if (( indx = sectionList.getIndex( &key )) != -1 )
+ if ((indx = sectionList.getIndex(&key)) != -1)
return sectionList[ indx ];
- if ( create_new ) {
- SectionItem* newItem = ( SectionItem* )mir_calloc( sizeof( SectionItem ));
- newItem->name = mir_tstrdup( sectionName );
+ if (create_new) {
+ SectionItem* newItem = (SectionItem*)mir_calloc(sizeof(SectionItem));
+ newItem->name = mir_tstrdup(sectionName);
newItem->flags = 0;
- sectionList.insert( newItem );
+ sectionList.insert(newItem);
bNeedRebuild = TRUE;
return newItem;
}
@@ -468,15 +468,15 @@ static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new) static void IcoLib_RemoveSection(SectionItem* section)
{
- if ( !section )
+ if ( !section)
return;
int indx;
- if (( indx = sectionList.getIndex( section )) != -1 ) {
- sectionList.remove( indx );
- SAFE_FREE(( void** )§ion->name);
- SAFE_FREE(( void** )§ion );
+ if ((indx = sectionList.getIndex(section)) != -1) {
+ sectionList.remove(indx);
+ SAFE_FREE((void**)§ion->name);
+ SAFE_FREE((void**)§ion);
bNeedRebuild = TRUE;
}
}
@@ -485,7 +485,7 @@ static IconItem* IcoLib_FindIcon(const char* pszIconName) {
int indx;
IconItem key = { (char*)pszIconName };
- if (( indx = iconList.getIndex( &key )) != -1 )
+ if ((indx = iconList.getIndex(&key)) != -1)
return iconList[ indx ];
return NULL;
@@ -496,13 +496,13 @@ static IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big) IconItem* item = NULL;
int indx;
- for ( indx = 0; indx < iconList.getCount(); indx++ ) {
- if ( iconList[ indx ]->source_small && iconList[ indx ]->source_small->icon == hIcon) {
+ for (indx = 0; indx < iconList.getCount(); indx++) {
+ if (iconList[ indx ]->source_small && iconList[ indx ]->source_small->icon == hIcon) {
item = iconList[ indx ];
big = false;
break;
}
- else if ( iconList[ indx ]->source_big && iconList[ indx ]->source_big->icon == hIcon) {
+ else if (iconList[ indx ]->source_big && iconList[ indx ]->source_big->icon == hIcon) {
item = iconList[ indx ];
big = true;
break;
@@ -516,177 +516,177 @@ static void IcoLib_FreeIcon(IconItem* icon) {
if ( !icon) return;
- SAFE_FREE(( void** )&icon->name );
- SAFE_FREE(( void** )&icon->description );
- SAFE_FREE(( void** )&icon->default_file );
- SAFE_FREE(( void** )&icon->temp_file );
- if ( icon->section) {
+ SAFE_FREE((void**)&icon->name);
+ SAFE_FREE((void**)&icon->description);
+ SAFE_FREE((void**)&icon->default_file);
+ SAFE_FREE((void**)&icon->temp_file);
+ if (icon->section) {
if ( !--icon->section->ref_count)
- IcoLib_RemoveSection( icon->section );
+ IcoLib_RemoveSection(icon->section);
icon->section = NULL;
}
- IconSourceItem_Release( &icon->source_small );
- IconSourceItem_Release( &icon->source_big );
- IconSourceItem_Release( &icon->default_icon );
- SafeDestroyIcon( &icon->temp_icon );
+ IconSourceItem_Release(&icon->source_small);
+ IconSourceItem_Release(&icon->source_big);
+ IconSourceItem_Release(&icon->default_icon);
+ SafeDestroyIcon(&icon->temp_icon);
}
/////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_AddNewIcon
-HANDLE IcoLib_AddNewIcon( SKINICONDESC* sid )
+HANDLE IcoLib_AddNewIcon(SKINICONDESC* sid)
{
int utf = 0, utf_path = 0;
IconItem* item;
- if ( !sid->cbSize )
+ if ( !sid->cbSize)
return NULL;
- if ( sid->cbSize < SKINICONDESC_SIZE_V1 )
+ if (sid->cbSize < SKINICONDESC_SIZE_V1)
return NULL;
- if ( sid->cbSize >= SKINICONDESC_SIZE ) {
+ if (sid->cbSize >= SKINICONDESC_SIZE) {
utf = sid->flags & SIDF_UNICODE ? 1 : 0;
utf_path = sid->flags & SIDF_PATH_UNICODE ? 1 : 0;
}
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
- item = IcoLib_FindIcon( sid->pszName );
- if ( !item ) {
- item = ( IconItem* )mir_alloc( sizeof( IconItem ));
+ item = IcoLib_FindIcon(sid->pszName);
+ if ( !item) {
+ item = (IconItem*)mir_alloc(sizeof(IconItem));
item->name = sid->pszName;
- iconList.insert( item );
+ iconList.insert(item);
}
- else IcoLib_FreeIcon( item );
+ else IcoLib_FreeIcon(item);
- ZeroMemory( item, sizeof( *item ));
- item->name = mir_strdup( sid->pszName );
- if ( utf ) {
- item->description = mir_u2t( sid->pwszDescription );
- item->section = IcoLib_AddSection( sid->pwszSection, TRUE );
+ ZeroMemory(item, sizeof(*item));
+ item->name = mir_strdup(sid->pszName);
+ if (utf) {
+ item->description = mir_u2t(sid->pwszDescription);
+ item->section = IcoLib_AddSection(sid->pwszSection, TRUE);
}
else {
- item->description = mir_a2t( sid->pszDescription );
- WCHAR* pwszSection = sid->pszSection ? mir_a2u( sid->pszSection ) : NULL;
- item->section = IcoLib_AddSection( pwszSection, TRUE );
- SAFE_FREE(( void** )&pwszSection );
+ item->description = mir_a2t(sid->pszDescription);
+ WCHAR* pwszSection = sid->pszSection ? mir_a2u(sid->pszSection) : NULL;
+ item->section = IcoLib_AddSection(pwszSection, TRUE);
+ SAFE_FREE((void**)&pwszSection);
}
- if ( item->section ) {
+ if (item->section) {
item->section->ref_count++;
item->orderID = ++item->section->maxOrder;
}
else
item->orderID = 0;
- if ( sid->pszDefaultFile ) {
- if ( utf_path ) {
+ if (sid->pszDefaultFile) {
+ if (utf_path) {
WCHAR fileFull[ MAX_PATH ];
- pathToAbsoluteW( sid->pwszDefaultFile, fileFull, NULL );
- item->default_file = mir_wstrdup( fileFull );
+ pathToAbsoluteW(sid->pwszDefaultFile, fileFull, NULL);
+ item->default_file = mir_wstrdup(fileFull);
}
else {
- WCHAR *file = mir_a2u( sid->pszDefaultFile );
+ WCHAR *file = mir_a2u(sid->pszDefaultFile);
WCHAR fileFull[ MAX_PATH ];
- pathToAbsoluteW( file, fileFull, NULL );
- SAFE_FREE(( void** )&file );
- item->default_file = mir_wstrdup( fileFull );
+ pathToAbsoluteW(file, fileFull, NULL);
+ SAFE_FREE((void**)&file);
+ item->default_file = mir_wstrdup(fileFull);
} }
item->default_indx = sid->iDefaultIndex;
- if ( sid->cbSize >= SKINICONDESC_SIZE_V3 ) {
+ if (sid->cbSize >= SKINICONDESC_SIZE_V3) {
item->cx = sid->cx;
item->cy = sid->cy;
}
- if ( sid->cbSize >= SKINICONDESC_SIZE_V2 && sid->hDefaultIcon ) {
+ if (sid->cbSize >= SKINICONDESC_SIZE_V2 && sid->hDefaultIcon) {
bool big;
- IconItem* def_item = IcoLib_FindHIcon( sid->hDefaultIcon, big );
- if ( def_item ) {
+ IconItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
+ if (def_item) {
item->default_icon = big ? def_item->source_big : def_item->source_small;
item->default_icon->ref_count++;
}
else {
int cx = item->cx ? item->cx : GetSystemMetrics(SM_CXSMICON);
int cy = item->cy ? item->cy : GetSystemMetrics(SM_CYSMICON);
- item->default_icon = CreateStaticIconSourceItem( cx, cy );
- if ( GetIconData( sid->hDefaultIcon, &item->default_icon->icon_data, &item->default_icon->icon_size )) {
- IconSourceItem_Release( &item->default_icon );
+ item->default_icon = CreateStaticIconSourceItem(cx, cy);
+ if (GetIconData(sid->hDefaultIcon, &item->default_icon->icon_data, &item->default_icon->icon_size)) {
+ IconSourceItem_Release(&item->default_icon);
}
}
}
- if ( sid->cbSize >= SKINICONDESC_SIZE && item->section )
+ if (sid->cbSize >= SKINICONDESC_SIZE && item->section)
item->section->flags = sid->flags & SIDF_SORTED;
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
return item;
}
/////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_RemoveIcon
-static INT_PTR IcoLib_RemoveIcon( WPARAM, LPARAM lParam )
+static INT_PTR IcoLib_RemoveIcon(WPARAM, LPARAM lParam)
{
- if ( lParam ) {
+ if (lParam) {
int indx;
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
- if (( indx = iconList.getIndex(( IconItem* )&lParam )) != -1 ) {
+ if ((indx = iconList.getIndex((IconItem*)&lParam)) != -1) {
IconItem *item = iconList[ indx ];
- IcoLib_FreeIcon( item );
- iconList.remove( indx );
- SAFE_FREE(( void** )&item );
+ IcoLib_FreeIcon(item);
+ iconList.remove(indx);
+ SAFE_FREE((void**)&item);
}
- LeaveCriticalSection( &csIconList );
- return ( indx == -1 ) ? 1 : 0;
+ LeaveCriticalSection(&csIconList);
+ return (indx == -1) ? 1 : 0;
}
return 1; // Failed
}
-HICON IconItem_GetDefaultIcon( IconItem* item, bool big )
+HICON IconItem_GetDefaultIcon(IconItem* item, bool big)
{
HICON hIcon = NULL;
- if ( item->default_icon && !big ) {
- IconSourceItem_Release( &item->source_small );
+ if (item->default_icon && !big) {
+ IconSourceItem_Release(&item->source_small);
item->source_small = item->default_icon;
item->source_small->ref_count++;
- hIcon = IconSourceItem_GetIcon( item->source_small );
+ hIcon = IconSourceItem_GetIcon(item->source_small);
}
- if ( !hIcon && item->default_file ) {
+ if ( !hIcon && item->default_file) {
int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON);
int cy = item->cy ? item->cy : GetSystemMetrics(big ? SM_CYICON : SM_CYSMICON);
- IconSourceItem* def_icon = GetIconSourceItem( item->default_file, item->default_indx, cx, cy );
- if ( big ) {
- if ( def_icon != item->source_big ) {
- IconSourceItem_Release( &item->source_big );
+ IconSourceItem* def_icon = GetIconSourceItem(item->default_file, item->default_indx, cx, cy);
+ if (big) {
+ if (def_icon != item->source_big) {
+ IconSourceItem_Release(&item->source_big);
item->source_big = def_icon;
- if ( def_icon ) {
+ if (def_icon) {
def_icon->ref_count++;
- hIcon = IconSourceItem_GetIcon( def_icon );
+ hIcon = IconSourceItem_GetIcon(def_icon);
}
}
else
- IconSourceItem_Release( &def_icon );
+ IconSourceItem_Release(&def_icon);
}
else {
- if ( def_icon != item->default_icon ) {
- IconSourceItem_Release( &item->default_icon );
+ if (def_icon != item->default_icon) {
+ IconSourceItem_Release(&item->default_icon);
item->default_icon = def_icon;
- if ( def_icon ) {
- IconSourceItem_Release( &item->source_small );
+ if (def_icon) {
+ IconSourceItem_Release(&item->source_small);
item->source_small = def_icon;
def_icon->ref_count++;
- hIcon = IconSourceItem_GetIcon( def_icon );
+ hIcon = IconSourceItem_GetIcon(def_icon);
}
}
else
- IconSourceItem_Release( &def_icon );
+ IconSourceItem_Release(&def_icon);
}
}
return hIcon;
@@ -696,7 +696,7 @@ HICON IconItem_GetDefaultIcon( IconItem* item, bool big ) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon
-HICON IconItem_GetIcon( IconItem* item, bool big )
+HICON IconItem_GetIcon(IconItem* item, bool big)
{
DBVARIANT dbv = {0};
HICON hIcon = NULL;
@@ -704,20 +704,20 @@ HICON IconItem_GetIcon( IconItem* item, bool big ) big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
- if ( !source && !DBGetContactSettingTString( NULL, "SkinIcons", item->name, &dbv )) {
+ if ( !source && !DBGetContactSettingTString(NULL, "SkinIcons", item->name, &dbv)) {
int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON);
int cy = item->cy ? item->cy : GetSystemMetrics(big ? SM_CYICON : SM_CYSMICON);
- source = GetIconSourceItemFromPath( dbv.ptszVal, cx, cy );
- DBFreeVariant( &dbv );
+ source = GetIconSourceItemFromPath(dbv.ptszVal, cx, cy);
+ DBFreeVariant(&dbv);
}
- if ( source )
- hIcon = IconSourceItem_GetIcon( source );
+ if (source)
+ hIcon = IconSourceItem_GetIcon(source);
- if ( !hIcon )
- hIcon = IconItem_GetDefaultIcon( item, big );
+ if ( !hIcon)
+ hIcon = IconItem_GetDefaultIcon(item, big);
- if ( !hIcon )
+ if ( !hIcon)
return hIconBlank;
return hIcon;
@@ -726,37 +726,37 @@ HICON IconItem_GetIcon( IconItem* item, bool big ) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon_Preview
-HICON IconItem_GetIcon_Preview( IconItem* item )
+HICON IconItem_GetIcon_Preview(IconItem* item)
{
HICON hIcon = NULL;
- if ( !item->temp_reset ) {
- HICON hRefIcon = IconItem_GetIcon( item, false );
- hIcon = CopyIcon( hRefIcon );
- if ( item->source_small && item->source_small->icon == hRefIcon )
- IconSourceItem_ReleaseIcon( item->source_small );
+ if ( !item->temp_reset) {
+ HICON hRefIcon = IconItem_GetIcon(item, false);
+ hIcon = CopyIcon(hRefIcon);
+ if (item->source_small && item->source_small->icon == hRefIcon)
+ IconSourceItem_ReleaseIcon(item->source_small);
}
else {
- if ( item->default_icon ) {
- HICON hRefIcon = IconSourceItem_GetIcon( item->default_icon );
- if ( hRefIcon ) {
- hIcon = CopyIcon( hRefIcon );
- if ( item->default_icon->icon == hRefIcon )
- IconSourceItem_ReleaseIcon( item->default_icon );
+ if (item->default_icon) {
+ HICON hRefIcon = IconSourceItem_GetIcon(item->default_icon);
+ if (hRefIcon) {
+ hIcon = CopyIcon(hRefIcon);
+ if (item->default_icon->icon == hRefIcon)
+ IconSourceItem_ReleaseIcon(item->default_icon);
} }
- if ( !hIcon && item->default_file ) {
- IconSourceItem_Release( &item->default_icon );
- item->default_icon = GetIconSourceItem( item->default_file, item->default_indx, item->cx, item->cy );
- if ( item->default_icon ) {
- HICON hRefIcon = IconSourceItem_GetIcon( item->default_icon );
- if ( hRefIcon ) {
- hIcon = CopyIcon( hRefIcon );
- if ( item->default_icon->icon == hRefIcon )
- IconSourceItem_ReleaseIcon( item->default_icon );
+ if ( !hIcon && item->default_file) {
+ IconSourceItem_Release(&item->default_icon);
+ item->default_icon = GetIconSourceItem(item->default_file, item->default_indx, item->cx, item->cy);
+ if (item->default_icon) {
+ HICON hRefIcon = IconSourceItem_GetIcon(item->default_icon);
+ if (hRefIcon) {
+ hIcon = CopyIcon(hRefIcon);
+ if (item->default_icon->icon == hRefIcon)
+ IconSourceItem_ReleaseIcon(item->default_icon);
} } }
- if ( !hIcon )
+ if ( !hIcon)
return CopyIcon(hIconBlank);
}
return hIcon;
@@ -772,21 +772,21 @@ HICON IconItem_GetIcon_Preview( IconItem* item ) // cx/cyDesired = GetSystemMetrics(SM_CX/CYSMICON)
// fuLoad = 0
-HICON IcoLib_GetIcon( const char* pszIconName, bool big )
+HICON IcoLib_GetIcon(const char* pszIconName, bool big)
{
IconItem* item;
HICON result = NULL;
- if ( !pszIconName )
+ if ( !pszIconName)
return hIconBlank;
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
- item = IcoLib_FindIcon( pszIconName );
- if ( item ) {
- result = IconItem_GetIcon( item, big );
+ item = IcoLib_FindIcon(pszIconName);
+ if (item) {
+ result = IconItem_GetIcon(item, big);
}
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
return result;
}
@@ -794,16 +794,16 @@ HICON IcoLib_GetIcon( const char* pszIconName, bool big ) // IcoLib_GetIconHandle
// lParam: pszIconName
-HANDLE IcoLib_GetIconHandle( const char* pszIconName )
+HANDLE IcoLib_GetIconHandle(const char* pszIconName)
{
IconItem* item;
- if ( !pszIconName )
+ if ( !pszIconName)
return NULL;
- EnterCriticalSection( &csIconList );
- item = IcoLib_FindIcon( pszIconName );
- LeaveCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
+ item = IcoLib_FindIcon(pszIconName);
+ LeaveCriticalSection(&csIconList);
return (HANDLE)item;
}
@@ -813,27 +813,27 @@ HANDLE IcoLib_GetIconHandle( const char* pszIconName ) // lParam: icolib item handle
// wParam: 0
-HICON IcoLib_GetIconByHandle( HANDLE hItem, bool big )
+HICON IcoLib_GetIconByHandle(HANDLE hItem, bool big)
{
- if ( hItem == NULL )
+ if (hItem == NULL)
return NULL;
HICON result = hIconBlank;
- IconItem* pi = ( IconItem* )hItem;
+ IconItem* pi = (IconItem*)hItem;
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
// we can get any junk here... but getIndex() is MUCH faster than indexOf().
__try
{
- if ( iconList.getIndex( pi ) != -1 )
- result = IconItem_GetIcon( pi, big );
+ if (iconList.getIndex(pi) != -1)
+ result = IconItem_GetIcon(pi, big);
}
- __except( EXCEPTION_EXECUTE_HANDLER )
+ __except(EXCEPTION_EXECUTE_HANDLER)
{
}
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
return result;
}
@@ -842,21 +842,21 @@ HICON IcoLib_GetIconByHandle( HANDLE hItem, bool big ) // lParam: NULL
// wParam: HICON
-HANDLE IcoLib_IsManaged( HICON hIcon )
+HANDLE IcoLib_IsManaged(HICON hIcon)
{
IconItem* item;
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
bool big;
- item = IcoLib_FindHIcon( hIcon, big );
- if ( item ) {
+ item = IcoLib_FindHIcon(hIcon, big);
+ if (item) {
IconSourceItem* source = big && !item->cx ? item->source_big : item->source_small;
- if ( source->icon_ref_count == 0 )
+ if (source->icon_ref_count == 0)
item = NULL;
}
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
return NULL;
}
@@ -865,23 +865,23 @@ HANDLE IcoLib_IsManaged( HICON hIcon ) // lParam: NULL
// wParam: HICON
-static INT_PTR IcoLib_AddRef( WPARAM wParam, LPARAM )
+static INT_PTR IcoLib_AddRef(WPARAM wParam, LPARAM)
{
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
bool big;
- IconItem *item = IcoLib_FindHIcon(( HICON )wParam, big);
+ IconItem *item = IcoLib_FindHIcon((HICON)wParam, big);
INT_PTR res = 1;
- if ( item ) {
+ if (item) {
IconSourceItem* source = big && !item->cx ? item->source_big : item->source_small;
- if ( source->icon_ref_count ) {
+ if (source->icon_ref_count) {
source->icon_ref_count++;
res = 0;
}
}
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
return res;
}
@@ -890,31 +890,31 @@ static INT_PTR IcoLib_AddRef( WPARAM wParam, LPARAM ) // lParam: pszIconName or NULL
// wParam: HICON or NULL
-int IcoLib_ReleaseIcon( HICON hIcon, char* szIconName, bool big )
+int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big)
{
IconItem *item = NULL;
EnterCriticalSection(&csIconList);
- if ( szIconName )
- item = IcoLib_FindIcon( szIconName );
+ if (szIconName)
+ item = IcoLib_FindIcon(szIconName);
- if ( !item && hIcon ) // find by HICON
- item = IcoLib_FindHIcon( hIcon, big );
+ if ( !item && hIcon) // find by HICON
+ item = IcoLib_FindHIcon(hIcon, big);
int res = 1;
- if ( item ) {
+ if (item) {
IconSourceItem* source = big && !item->cx ? item->source_big : item->source_small;
- if ( source && source->icon_ref_count ) {
- if ( iconEventActive )
+ if (source && source->icon_ref_count) {
+ if (iconEventActive)
source->icon_ref_count--;
else
- IconSourceItem_ReleaseIcon( source );
+ IconSourceItem_ReleaseIcon(source);
res = 0;
}
}
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
return res;
}
@@ -928,27 +928,27 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) HICON hIcon;
int indx;
- mir_sntprintf( path, SIZEOF(path), _T("%s,"), filename );
- suffIndx = lstrlen( path );
+ mir_sntprintf(path, SIZEOF(path), _T("%s,"), filename);
+ suffIndx = lstrlen(path);
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
- for ( indx = 0; indx < iconList.getCount(); indx++ ) {
+ for (indx = 0; indx < iconList.getCount(); indx++) {
IconItem *item = iconList[ indx ];
- if ( item->default_file && item->section == sectionActive ) {
- _itot( item->default_indx, path + suffIndx, 10 );
- hIcon = ExtractIconFromPath( path, item->cx, item->cy );
- if ( hIcon ) {
- SAFE_FREE(( void** )&item->temp_file );
- SafeDestroyIcon( &item->temp_icon );
+ if (item->default_file && item->section == sectionActive) {
+ _itot(item->default_indx, path + suffIndx, 10);
+ hIcon = ExtractIconFromPath(path, item->cx, item->cy);
+ if (hIcon) {
+ SAFE_FREE((void**)&item->temp_file);
+ SafeDestroyIcon(&item->temp_icon);
- item->temp_file = mir_tstrdup( path );
+ item->temp_file = mir_tstrdup(path);
item->temp_icon = hIcon;
item->temp_reset = FALSE;
} } }
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
}
void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem)
@@ -960,37 +960,37 @@ void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem) tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- TreeView_GetItem( htv, &tvi );
+ TreeView_GetItem(htv, &tvi);
treeItem = (TreeItem *)tvi.lParam;
sectionActive = sectionList[ SECTIONPARAM_INDEX(treeItem->value) ];
- tvi.hItem = TreeView_GetChild( htv, tvi.hItem );
- while ( tvi.hItem ) {
- LoadSubIcons( htv, filename, tvi.hItem );
- tvi.hItem = TreeView_GetNextSibling( htv, tvi.hItem );
+ tvi.hItem = TreeView_GetChild(htv, tvi.hItem);
+ while (tvi.hItem) {
+ LoadSubIcons(htv, filename, tvi.hItem);
+ tvi.hItem = TreeView_GetNextSibling(htv, tvi.hItem);
}
- if ( SECTIONPARAM_FLAGS(treeItem->value) & SECTIONPARAM_HAVEPAGE )
- LoadSectionIcons( filename, sectionActive );
+ if (SECTIONPARAM_FLAGS(treeItem->value) & SECTIONPARAM_HAVEPAGE)
+ LoadSectionIcons(filename, sectionActive);
}
-static void UndoChanges( int iconIndx, int cmd )
+static void UndoChanges(int iconIndx, int cmd)
{
IconItem *item = iconList[ iconIndx ];
- if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE )
+ if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
else
{
- SAFE_FREE(( void** )&item->temp_file );
- SafeDestroyIcon( &item->temp_icon );
+ SAFE_FREE((void**)&item->temp_file);
+ SafeDestroyIcon(&item->temp_icon);
}
- if ( cmd == ID_RESET )
+ if (cmd == ID_RESET)
item->temp_reset = TRUE;
}
-void UndoSubItemChanges( HWND htv, HTREEITEM hItem, int cmd )
+void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd)
{
TVITEM tvi = {0};
TreeItem *treeItem;
@@ -998,28 +998,28 @@ void UndoSubItemChanges( HWND htv, HTREEITEM hItem, int cmd ) tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- TreeView_GetItem( htv, &tvi );
+ TreeView_GetItem(htv, &tvi);
treeItem = (TreeItem *)tvi.lParam;
- if ( SECTIONPARAM_FLAGS( treeItem->value ) & SECTIONPARAM_HAVEPAGE ) {
- EnterCriticalSection( &csIconList );
+ if (SECTIONPARAM_FLAGS(treeItem->value) & SECTIONPARAM_HAVEPAGE) {
+ EnterCriticalSection(&csIconList);
- for ( indx = 0; indx < iconList.getCount(); indx++ )
- if ( iconList[ indx ]->section == sectionList[ SECTIONPARAM_INDEX(treeItem->value) ])
- UndoChanges( indx, cmd );
+ for (indx = 0; indx < iconList.getCount(); indx++)
+ if (iconList[ indx ]->section == sectionList[ SECTIONPARAM_INDEX(treeItem->value) ])
+ UndoChanges(indx, cmd);
- LeaveCriticalSection( &csIconList );
+ LeaveCriticalSection(&csIconList);
}
- tvi.hItem = TreeView_GetChild( htv, tvi.hItem );
- while ( tvi.hItem ) {
- UndoSubItemChanges( htv, tvi.hItem, cmd );
- tvi.hItem = TreeView_GetNextSibling( htv, tvi.hItem );
+ tvi.hItem = TreeView_GetChild(htv, tvi.hItem);
+ while (tvi.hItem) {
+ UndoSubItemChanges(htv, tvi.hItem, cmd);
+ tvi.hItem = TreeView_GetNextSibling(htv, tvi.hItem);
} }
static void OpenIconsPage()
{
- CallService( MS_UTILS_OPENURL, 1, (LPARAM)"http://addons.miranda-im.org/index.php?action=display&id=35" );
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://addons.miranda-im.org/index.php?action=display&id=35");
}
static int OpenPopupMenu(HWND hwndDlg)
@@ -1029,15 +1029,15 @@ static int OpenPopupMenu(HWND hwndDlg) int cmd;
GetCursorPos(&pt);
- hMenu = LoadMenu( hMirandaInst, MAKEINTRESOURCE( IDR_ICOLIB_CONTEXT ));
- hPopup = GetSubMenu( hMenu, 0 );
+ hMenu = LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT));
+ hPopup = GetSubMenu(hMenu, 0);
TranslateMenu(hPopup);
- cmd = TrackPopupMenu( hPopup, TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL );
- DestroyMenu( hMenu );
+ cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ DestroyMenu(hMenu);
return cmd;
}
-static TCHAR* OpenFileDlg( HWND hParent, const TCHAR* szFile, BOOL bAll )
+static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll)
{
OPENFILENAME ofn = {0};
TCHAR filter[512], *pfilter, file[MAX_PATH*2];
@@ -1072,7 +1072,7 @@ static TCHAR* OpenFileDlg( HWND hParent, const TCHAR* szFile, BOOL bAll ) ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.nMaxFile = MAX_PATH*2;
- if (!GetOpenFileName(&ofn))
+ if ( !GetOpenFileName(&ofn))
return NULL;
return mir_tstrdup(file);
@@ -1108,13 +1108,13 @@ void DoIconsChanged(HWND hwndDlg) EnterCriticalSection(&csIconList); // Destroy unused icons
for (int indx = 0; indx < iconList.getCount(); indx++) {
IconItem *item = iconList[indx];
- if ( item->source_small && !item->source_small->icon_ref_count) {
+ if (item->source_small && !item->source_small->icon_ref_count) {
item->source_small->icon_ref_count++;
- IconSourceItem_ReleaseIcon( item->source_small );
+ IconSourceItem_ReleaseIcon(item->source_small);
}
- if ( item->source_big && !item->source_big->icon_ref_count) {
+ if (item->source_big && !item->source_big->icon_ref_count) {
item->source_big->icon_ref_count++;
- IconSourceItem_ReleaseIcon( item->source_big );
+ IconSourceItem_ReleaseIcon(item->source_big);
}
}
LeaveCriticalSection(&csIconList);
@@ -1130,7 +1130,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR else
tvi.hItem = TreeView_GetRoot(hwndTree);
- if (!name)
+ if ( !name)
return tvi.hItem;
tvi.mask = TVIF_TEXT;
@@ -1141,7 +1141,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR {
TreeView_GetItem(hwndTree, &tvi);
- if (!lstrcmp(tvi.pszText, name))
+ if ( !lstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -1237,12 +1237,12 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
- count = (int)_ExtractIconEx( filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR );
+ count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR);
for (i = 0; i < count; lvi.iItem++, i++) {
mir_sntprintf(caption, SIZEOF(caption), _T("%d"), i+1);
lvi.pszText = caption;
//hIcon = ExtractIcon(hMirandaInst, filename, i);
- _ExtractIconEx( filename, i, 16, 16, &hIcon, LR_DEFAULTCOLOR );
+ _ExtractIconEx(filename, i, 16, 16, &hIcon, LR_DEFAULTCOLOR);
lvi.iImage = ImageList_AddIcon(hIml, hIcon);
DestroyIcon(hIcon);
lvi.lParam = i;
@@ -1253,16 +1253,16 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_COMMAND:
- switch( LOWORD( wParam )) {
+ switch(LOWORD(wParam)) {
case IDC_BROWSE:
{
TCHAR str[MAX_PATH];
TCHAR *file;
GetDlgItemText(hwndDlg, IDC_ICONSET, str, SIZEOF(str));
- if (!(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE))) break;
+ if ( !(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE))) break;
SetDlgItemText(hwndDlg, IDC_ICONSET, file);
- SAFE_FREE(( void** )&file );
+ SAFE_FREE((void**)&file);
}
break;
@@ -1314,7 +1314,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM onItem = 1;
} }
- if (!onItem && dropHiLite != -1) {
+ if ( !onItem && dropHiLite != -1) {
ImageList_DragLeave(hwndDragOver);
ListView_SetItemState(hPPreview, dropHiLite, 0, LVIS_DROPHILITED);
UpdateWindow(hPPreview);
@@ -1396,44 +1396,44 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM /////////////////////////////////////////////////////////////////////////////////////////
// IcoLib options window procedure
-static int CALLBACK DoSortIconsFunc(LPARAM lParam1, LPARAM lParam2, LPARAM )
+static int CALLBACK DoSortIconsFunc(LPARAM lParam1, LPARAM lParam2, LPARAM)
{ return lstrcmpi(TranslateTS(iconList[lParam1]->description), TranslateTS(iconList[lParam2]->description));
}
-static int CALLBACK DoSortIconsFuncByOrder(LPARAM lParam1, LPARAM lParam2, LPARAM )
+static int CALLBACK DoSortIconsFuncByOrder(LPARAM lParam1, LPARAM lParam2, LPARAM)
{ return iconList[lParam1]->orderID - iconList[lParam2]->orderID;
}
-static void SaveCollapseState( HWND hwndTree )
+static void SaveCollapseState(HWND hwndTree)
{
HTREEITEM hti;
TVITEM tvi;
- hti = TreeView_GetRoot( hwndTree );
- while ( hti != NULL ) {
+ hti = TreeView_GetRoot(hwndTree);
+ while (hti != NULL) {
HTREEITEM ht;
TreeItem *treeItem;
tvi.mask = TVIF_STATE | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM;
tvi.hItem = hti;
tvi.stateMask = (DWORD)-1;
- TreeView_GetItem( hwndTree, &tvi );
+ TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.cChildren > 0 ) {
+ if (tvi.cChildren > 0) {
treeItem = (TreeItem *)tvi.lParam;
- if ( tvi.state & TVIS_EXPANDED )
- DBWriteContactSettingByte(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED );
+ if (tvi.state & TVIS_EXPANDED)
+ DBWriteContactSettingByte(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED);
else
- DBWriteContactSettingByte(NULL, "SkinIconsUI", treeItem->paramName, 0 );
+ DBWriteContactSettingByte(NULL, "SkinIconsUI", treeItem->paramName, 0);
}
- ht = TreeView_GetChild( hwndTree, hti );
- if ( ht == NULL ) {
- ht = TreeView_GetNextSibling( hwndTree, hti );
- while ( ht == NULL ) {
- hti = TreeView_GetParent( hwndTree, hti );
- if ( hti == NULL ) break;
- ht = TreeView_GetNextSibling( hwndTree, hti );
+ ht = TreeView_GetChild(hwndTree, hti);
+ if (ht == NULL) {
+ ht = TreeView_GetNextSibling(hwndTree, hti);
+ while (ht == NULL) {
+ hti = TreeView_GetParent(hwndTree, hti);
+ if (hti == NULL) break;
+ ht = TreeView_GetNextSibling(hwndTree, hti);
} }
hti = ht;
@@ -1485,7 +1485,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR itemName[1024];
HTREEITEM hSection;
- if (!hwndTree) break;
+ if ( !hwndTree) break;
TreeView_SelectItem(hwndTree, NULL);
TreeView_DeleteAllItems(hwndTree);
@@ -1508,14 +1508,14 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM *sectionName = 0;
}
- pItemName = TranslateTS( pItemName );
+ pItemName = TranslateTS(pItemName);
hItem = FindNamedTreeItemAt(hwndTree, hSection, pItemName);
- if (!sectionName || !hItem) {
- if (!hItem) {
+ if ( !sectionName || !hItem) {
+ if ( !hItem) {
TVINSERTSTRUCT tvis = {0};
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
- treeItem->value = SECTIONPARAM_MAKE( indx, sectionLevel, sectionName?0:SECTIONPARAM_HAVEPAGE );
+ treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName?0:SECTIONPARAM_HAVEPAGE);
treeItem->paramName = mir_t2a(itemName);
tvis.hParent = hSection;
@@ -1524,7 +1524,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.item.pszText = pItemName;
tvis.item.lParam = (LPARAM) treeItem;
- tvis.item.state = tvis.item.stateMask = DBGetContactSettingByte(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED );
+ tvis.item.state = tvis.item.stateMask = DBGetContactSettingByte(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED);
hItem = TreeView_InsertItem(hwndTree, &tvis);
}
else {
@@ -1532,9 +1532,9 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TreeItem *treeItem;
tvi.hItem = hItem;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- TreeView_GetItem( hwndTree, &tvi );
+ TreeView_GetItem(hwndTree, &tvi);
treeItem = (TreeItem *)tvi.lParam;
- treeItem->value = SECTIONPARAM_MAKE( indx, sectionLevel, SECTIONPARAM_HAVEPAGE );
+ treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, SECTIONPARAM_HAVEPAGE);
} }
if (sectionName) {
@@ -1558,10 +1558,10 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM LVITEM lvi = {0};
HIMAGELIST hIml;
HICON hIcon;
- SectionItem* sectionActive = ( SectionItem* )lParam;
+ SectionItem* sectionActive = (SectionItem*)lParam;
int indx;
- EnableWindow(hPreview, sectionActive != NULL );
+ EnableWindow(hPreview, sectionActive != NULL);
ListView_DeleteAllItems(hPreview);
hIml = ListView_GetImageList(hPreview, LVSIL_NORMAL);
@@ -1580,17 +1580,17 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (item->section == sectionActive) {
lvi.pszText = TranslateTS(item->description);
hIcon = item->temp_icon;
- if ( !hIcon )
- hIcon = IconItem_GetIcon_Preview( item );
+ if ( !hIcon)
+ hIcon = IconItem_GetIcon_Preview(item);
lvi.iImage = ImageList_AddIcon(hIml, hIcon);
lvi.lParam = indx;
ListView_InsertItem(hPreview, &lvi);
- if (hIcon != item->temp_icon) SafeDestroyIcon( &hIcon );
+ if (hIcon != item->temp_icon) SafeDestroyIcon(&hIcon);
} }
LeaveCriticalSection(&csIconList);
- if ( sectionActive->flags & SIDF_SORTED )
+ if (sectionActive->flags & SIDF_SORTED)
ListView_SortItems(hPreview, DoSortIconsFunc, 0);
else
ListView_SortItems(hPreview, DoSortIconsFuncByOrder, 0);
@@ -1613,13 +1613,13 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_GetItem(hPreview, &lvi);
EnterCriticalSection(&csIconList);
hIcon = iconList[lvi.lParam]->temp_icon;
- if (!hIcon)
- hIcon = IconItem_GetIcon_Preview( iconList[lvi.lParam] );
+ if ( !hIcon)
+ hIcon = IconItem_GetIcon_Preview(iconList[lvi.lParam]);
LeaveCriticalSection(&csIconList);
if (hIcon)
ImageList_ReplaceIcon(hIml, lvi.iImage, hIcon);
- if (hIcon != iconList[lvi.lParam]->temp_icon) SafeDestroyIcon( &hIcon );
+ if (hIcon != iconList[lvi.lParam]->temp_icon) SafeDestroyIcon(&hIcon);
}
ListView_RedrawItems(hPreview, 0, count);
}
@@ -1634,85 +1634,85 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.mask = LVIF_PARAM;
lvi.iItem = wParam;
- ListView_GetItem( hPreview, &lvi );
+ ListView_GetItem(hPreview, &lvi);
- EnterCriticalSection( &csIconList );
+ EnterCriticalSection(&csIconList);
item = iconList[ lvi.lParam ];
- SAFE_FREE(( void** )&item->temp_file );
- SafeDestroyIcon( &item->temp_icon );
- item->temp_file = mir_tstrdup( path );
- item->temp_icon = ( HICON )ExtractIconFromPath( path, item->cx, item->cy );
+ SAFE_FREE((void**)&item->temp_file);
+ SafeDestroyIcon(&item->temp_icon);
+ item->temp_file = mir_tstrdup(path);
+ item->temp_icon = (HICON)ExtractIconFromPath(path, item->cx, item->cy);
item->temp_reset = FALSE;
- LeaveCriticalSection( &csIconList );
- DoOptionsChanged( hwndDlg );
+ LeaveCriticalSection(&csIconList);
+ DoOptionsChanged(hwndDlg);
}
break;
case WM_COMMAND:
- if ( LOWORD(wParam) == IDC_IMPORT ) {
+ if (LOWORD(wParam) == IDC_IMPORT) {
dat->hwndIndex = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ICOLIB_IMPORT), GetParent(hwndDlg), DlgProcIconImport, (LPARAM)hwndDlg);
EnableWindow((HWND)lParam, FALSE);
}
- else if ( LOWORD(wParam) == IDC_GETMORE ) {
+ else if (LOWORD(wParam) == IDC_GETMORE) {
OpenIconsPage();
break;
}
- else if (LOWORD(wParam) == IDC_LOADICONS ) {
+ else if (LOWORD(wParam) == IDC_LOADICONS) {
TCHAR filetmp[1] = {0};
TCHAR *file;
- if ( file = OpenFileDlg( hwndDlg, filetmp, FALSE )) {
- HWND htv = GetDlgItem( hwndDlg, IDC_CATEGORYLIST );
+ if (file = OpenFileDlg(hwndDlg, filetmp, FALSE)) {
+ HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST);
TCHAR filename[ MAX_PATH ];
- CallService( MS_UTILS_PATHTORELATIVET, ( WPARAM )file, ( LPARAM )filename );
- SAFE_FREE(( void** )&file );
+ CallService(MS_UTILS_PATHTORELATIVET, (WPARAM)file, (LPARAM)filename);
+ SAFE_FREE((void**)&file);
- MySetCursor( IDC_WAIT );
- LoadSubIcons( htv, filename, TreeView_GetSelection( htv ));
- MySetCursor( IDC_ARROW );
+ MySetCursor(IDC_WAIT);
+ LoadSubIcons(htv, filename, TreeView_GetSelection(htv));
+ MySetCursor(IDC_ARROW);
- DoOptionsChanged( hwndDlg );
+ DoOptionsChanged(hwndDlg);
} }
break;
case WM_CONTEXTMENU:
- if (( HWND )wParam == hPreview ) {
- UINT count = ListView_GetSelectedCount( hPreview );
+ if ((HWND)wParam == hPreview) {
+ UINT count = ListView_GetSelectedCount(hPreview);
- if ( count > 0 ) {
- int cmd = OpenPopupMenu( hwndDlg );
- switch( cmd ) {
+ if (count > 0) {
+ int cmd = OpenPopupMenu(hwndDlg);
+ switch(cmd) {
case ID_CANCELCHANGE:
case ID_RESET:
{
LVITEM lvi = {0};
int itemIndx = -1;
- while (( itemIndx = ListView_GetNextItem( hPreview, itemIndx, LVNI_SELECTED )) != -1 ) {
+ while ((itemIndx = ListView_GetNextItem(hPreview, itemIndx, LVNI_SELECTED)) != -1) {
lvi.mask = LVIF_PARAM;
lvi.iItem = itemIndx; //lvhti.iItem;
- ListView_GetItem( hPreview, &lvi );
+ ListView_GetItem(hPreview, &lvi);
- UndoChanges( lvi.lParam, cmd );
+ UndoChanges(lvi.lParam, cmd);
}
- DoOptionsChanged( hwndDlg );
+ DoOptionsChanged(hwndDlg);
break;
} } }
}
else {
- HWND htv = GetDlgItem( hwndDlg, IDC_CATEGORYLIST );
- if (( HWND )wParam == htv ) {
- int cmd = OpenPopupMenu( hwndDlg );
+ HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST);
+ if ((HWND)wParam == htv) {
+ int cmd = OpenPopupMenu(hwndDlg);
- switch( cmd ) {
+ switch(cmd) {
case ID_CANCELCHANGE:
case ID_RESET:
- UndoSubItemChanges( htv, TreeView_GetSelection( htv ), cmd );
- DoOptionsChanged( hwndDlg );
+ UndoSubItemChanges(htv, TreeView_GetSelection(htv), cmd);
+ DoOptionsChanged(hwndDlg);
break;
} } }
break;
@@ -1732,13 +1732,13 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (item->temp_reset) {
DBDeleteContactSetting(NULL, "SkinIcons", item->name);
if (item->source_small != item->default_icon) {
- IconSourceItem_Release( &item->source_small );
+ IconSourceItem_Release(&item->source_small);
}
}
else if (item->temp_file) {
DBWriteContactSettingTString(NULL, "SkinIcons", item->name, item->temp_file);
- IconSourceItem_Release( &item->source_small );
- SafeDestroyIcon( &item->temp_icon );
+ IconSourceItem_Release(&item->source_small);
+ SafeDestroyIcon(&item->temp_icon);
}
}
LeaveCriticalSection(&csIconList);
@@ -1758,15 +1758,15 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.iItem = pInfoTip->iItem;
ListView_GetItem(pInfoTip->hdr.hwndFrom, &lvi);
- if ( lvi.lParam < iconList.getCount() ) {
+ if (lvi.lParam < iconList.getCount()) {
item = iconList[lvi.lParam];
- if ( item->temp_file )
- _tcsncpy( pInfoTip->pszText, item->temp_file, pInfoTip->cchTextMax );
- else if ( item->default_file )
- mir_sntprintf( pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s, %d"), item->default_file, item->default_indx );
+ if (item->temp_file)
+ _tcsncpy(pInfoTip->pszText, item->temp_file, pInfoTip->cchTextMax);
+ else if (item->default_file)
+ mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s, %d"), item->default_file, item->default_indx);
}
}
- if ( bNeedRebuild ) {
+ if (bNeedRebuild) {
EnterCriticalSection(&csIconList);
bNeedRebuild = FALSE;
LeaveCriticalSection(&csIconList);
@@ -1782,10 +1782,10 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NMTREEVIEW *pnmtv = (NMTREEVIEW*)lParam;
TVITEM tvi = pnmtv->itemNew;
TreeItem *treeItem = (TreeItem *)tvi.lParam;
- if ( treeItem )
- SendMessage(hwndDlg, DM_REBUILDICONSPREVIEW, 0, ( LPARAM )(
+ if (treeItem)
+ SendMessage(hwndDlg, DM_REBUILDICONSPREVIEW, 0, (LPARAM)(
(SECTIONPARAM_FLAGS(treeItem->value)&SECTIONPARAM_HAVEPAGE)?
- sectionList[ SECTIONPARAM_INDEX(treeItem->value) ] : NULL ) );
+ sectionList[ SECTIONPARAM_INDEX(treeItem->value) ] : NULL));
break;
}
case TVN_DELETEITEMA: // no idea why both TVN_SELCHANGEDA/W should be there but let's keep this both too...
@@ -1798,7 +1798,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
break;
} }
- if ( bNeedRebuild ) {
+ if (bNeedRebuild) {
EnterCriticalSection(&csIconList);
bNeedRebuild = FALSE;
LeaveCriticalSection(&csIconList);
@@ -1809,19 +1809,19 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
int indx;
- SaveCollapseState( GetDlgItem(hwndDlg, IDC_CATEGORYLIST) );
+ SaveCollapseState(GetDlgItem(hwndDlg, IDC_CATEGORYLIST));
DestroyWindow(dat->hwndIndex);
EnterCriticalSection(&csIconList);
for (indx = 0; indx < iconList.getCount(); indx++) {
IconItem *item = iconList[indx];
- SAFE_FREE(( void** )&item->temp_file);
+ SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
}
LeaveCriticalSection(&csIconList);
- SAFE_FREE(( void** )&dat);
+ SAFE_FREE((void**)&dat);
break;
} }
@@ -1830,7 +1830,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static UINT iconsExpertOnlyControls[]={IDC_IMPORT};
-static int SkinOptionsInit( WPARAM wParam, LPARAM )
+static int SkinOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {0};
@@ -1844,11 +1844,11 @@ static int SkinOptionsInit( WPARAM wParam, LPARAM ) odp.pfnDlgProc = DlgProcIcoLibOpts;
odp.expertOnlyControls = iconsExpertOnlyControls;
odp.nExpertOnlyControls = SIZEOF(iconsExpertOnlyControls);
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
-static int SkinSystemModulesLoaded( WPARAM, LPARAM )
+static int SkinSystemModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_OPT_INITIALISE, SkinOptionsInit);
return 0;
@@ -1857,32 +1857,32 @@ static int SkinSystemModulesLoaded( WPARAM, LPARAM ) /////////////////////////////////////////////////////////////////////////////////////////
// Module initialization and finalization procedure
-static INT_PTR sttIcoLib_AddNewIcon( WPARAM, LPARAM lParam )
-{ return (INT_PTR)IcoLib_AddNewIcon(( SKINICONDESC* )lParam );
+static INT_PTR sttIcoLib_AddNewIcon(WPARAM, LPARAM lParam)
+{ return (INT_PTR)IcoLib_AddNewIcon((SKINICONDESC*)lParam);
}
-static INT_PTR sttIcoLib_GetIcon( WPARAM wParam, LPARAM lParam )
-{ return (INT_PTR)IcoLib_GetIcon(( const char* )lParam, wParam != 0 );
+static INT_PTR sttIcoLib_GetIcon(WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)IcoLib_GetIcon((const char*)lParam, wParam != 0);
}
-static INT_PTR sttIcoLib_GetIconHandle( WPARAM, LPARAM lParam )
-{ return (INT_PTR)IcoLib_GetIconHandle(( const char* )lParam );
+static INT_PTR sttIcoLib_GetIconHandle(WPARAM, LPARAM lParam)
+{ return (INT_PTR)IcoLib_GetIconHandle((const char*)lParam);
}
-static INT_PTR sttIcoLib_GetIconByHandle( WPARAM wParam, LPARAM lParam )
-{ return (INT_PTR)IcoLib_GetIconByHandle(( HANDLE )lParam, wParam != 0 );
+static INT_PTR sttIcoLib_GetIconByHandle(WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)IcoLib_GetIconByHandle((HANDLE)lParam, wParam != 0);
}
-static INT_PTR sttIcoLib_ReleaseIcon( WPARAM wParam, LPARAM lParam )
-{ return (INT_PTR)IcoLib_ReleaseIcon(( HICON )wParam, ( char* )lParam, false );
+static INT_PTR sttIcoLib_ReleaseIcon(WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, false);
}
-static INT_PTR sttIcoLib_ReleaseIconBig( WPARAM wParam, LPARAM lParam )
-{ return (INT_PTR)IcoLib_ReleaseIcon(( HICON )wParam, ( char* )lParam, true );
+static INT_PTR sttIcoLib_ReleaseIconBig(WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, true);
}
-static INT_PTR sttIcoLib_IsManaged( WPARAM wParam, LPARAM )
-{ return (INT_PTR)IcoLib_IsManaged(( HICON )wParam );
+static INT_PTR sttIcoLib_IsManaged(WPARAM wParam, LPARAM)
+{ return (INT_PTR)IcoLib_IsManaged((HICON)wParam);
}
int LoadIcoLibModule(void)
@@ -1914,7 +1914,7 @@ void UnloadIcoLibModule(void) {
int indx;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
DestroyHookableEvent(hIconsChangedEvent);
DestroyHookableEvent(hIcons2ChangedEvent);
@@ -1929,35 +1929,35 @@ void UnloadIcoLibModule(void) DestroyServiceFunction(hIcoLib_ReleaseIcon);
DeleteCriticalSection(&csIconList);
- for (indx = iconList.getCount()-1; indx >= 0; indx-- ) {
+ for (indx = iconList.getCount()-1; indx >= 0; indx--) {
IconItem* I = iconList[indx];
- iconList.remove( indx );
- IcoLib_FreeIcon( I );
- mir_free( I );
+ iconList.remove(indx);
+ IcoLib_FreeIcon(I);
+ mir_free(I);
}
iconList.destroy();
- for (indx = iconSourceList.getCount()-1; indx >= 0; indx-- ) {
+ for (indx = iconSourceList.getCount()-1; indx >= 0; indx--) {
IconSourceItem* I = iconSourceList[indx];
- iconSourceList.remove( indx );
- IconSourceFile_Release( &I->file );
- SafeDestroyIcon( &I->icon );
- SAFE_FREE(( void** )&I->icon_data );
- SAFE_FREE(( void** )&I );
+ iconSourceList.remove(indx);
+ IconSourceFile_Release(&I->file);
+ SafeDestroyIcon(&I->icon);
+ SAFE_FREE((void**)&I->icon_data);
+ SAFE_FREE((void**)&I);
}
iconSourceList.destroy();
- for (indx = iconSourceFileList.getCount()-1; indx >= 0; indx-- ) {
+ for (indx = iconSourceFileList.getCount()-1; indx >= 0; indx--) {
IconSourceFile* I = iconSourceFileList[indx];
- iconSourceFileList.remove( indx );
- SAFE_FREE(( void** )&I->file );
- SAFE_FREE(( void** )&I );
+ iconSourceFileList.remove(indx);
+ SAFE_FREE((void**)&I->file);
+ SAFE_FREE((void**)&I);
}
iconSourceFileList.destroy();
for (indx = 0; indx < sectionList.getCount(); indx++) {
- SAFE_FREE(( void** )§ionList[indx]->name );
- mir_free( sectionList[indx] );
+ SAFE_FREE((void**)§ionList[indx]->name);
+ mir_free(sectionList[indx]);
}
sectionList.destroy();
diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp index 2fd41083d1..4939a8af61 100644 --- a/src/modules/idle/idle.cpp +++ b/src/modules/idle/idle.cpp @@ -130,17 +130,17 @@ BOOL IsTerminalDisconnected() DWORD pBytesReturned = 0;
BOOL result = FALSE;
- if ( !bIsWTSApiPresent )
+ if ( !bIsWTSApiPresent)
return FALSE;
- if ( _WTSQuerySessionInformation( WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSConnectState, &pBuffer, &pBytesReturned)) {
- if ( *( PDWORD )pBuffer == WTSDisconnected)
+ if (_WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSConnectState, &pBuffer, &pBytesReturned)) {
+ if (*(PDWORD)pBuffer == WTSDisconnected)
result = TRUE;
}
else bIsWTSApiPresent = FALSE;
- if ( pBuffer )
- _WTSFreeMemory( pBuffer );
+ if (pBuffer)
+ _WTSFreeMemory(pBuffer);
return result;
}
@@ -169,14 +169,14 @@ static void IdleObject_ReadSettings(IdleObject * obj) obj->useridlecheck = DBGetContactSettingByte(NULL, IDLEMOD, IDL_USERIDLECHECK, 0);
obj->minutes = DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLETIME1ST, 10);
obj->aastatus = !DBGetContactSettingByte(NULL, IDLEMOD, IDL_AAENABLE, 0) ? 0 : DBGetContactSettingWord(NULL, IDLEMOD, IDL_AASTATUS, 0);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEMETHOD, 0) ) IdleObject_UseMethod1(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEMETHOD, 0)) IdleObject_UseMethod1(obj);
else IdleObject_UseMethod0(obj);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONSAVER, 0) ) IdleObject_SetSaverCheck(obj);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONFULLSCR, 0) ) IdleObject_SetFullScrCheck(obj);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONLOCK, 0 ) ) IdleObject_SetWorkstationCheck(obj);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEPRIVATE, 0) ) IdleObject_SetPrivacy(obj);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, 0) ) IdleObject_SetStatusLock(obj);
- if ( DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONTSDC, 0) ) IdleObject_SetTerminalCheck(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONSAVER, 0)) IdleObject_SetSaverCheck(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONFULLSCR, 0)) IdleObject_SetFullScrCheck(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONLOCK, 0)) IdleObject_SetWorkstationCheck(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEPRIVATE, 0)) IdleObject_SetPrivacy(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, 0)) IdleObject_SetStatusLock(obj);
+ if (DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONTSDC, 0)) IdleObject_SetTerminalCheck(obj);
}
static void IdleObject_Create(IdleObject * obj)
@@ -197,28 +197,28 @@ static void IdleObject_Destroy(IdleObject * obj) static int IdleObject_IsUserIdle(IdleObject * obj)
{
DWORD dwTick;
- if ( IdleObject_GetMethod(obj) ) {
+ if (IdleObject_GetMethod(obj)) {
CallService(MS_SYSTEM_GETIDLE, 0, (LPARAM)&dwTick);
return GetTickCount() - dwTick > (obj->minutes * 60 * 1000);
}
- if ( MyGetLastInputInfo != NULL ) {
+ if (MyGetLastInputInfo != NULL) {
LASTINPUTINFO ii;
ZeroMemory(&ii, sizeof(ii));
ii.cbSize=sizeof(ii);
- if ( MyGetLastInputInfo(&ii) )
+ if (MyGetLastInputInfo(&ii))
return GetTickCount() - ii.dwTime > (obj->minutes * 60 * 1000);
}
else {
POINT pt;
GetCursorPos(&pt);
- if ( pt.x != obj->mousepos.x || pt.y != obj->mousepos.y ) {
+ if (pt.x != obj->mousepos.x || pt.y != obj->mousepos.y) {
obj->mousepos=pt;
obj->mouseidle=0;
}
else obj->mouseidle += 2;
- if ( obj->mouseidle )
+ if (obj->mouseidle)
return obj->mouseidle * 1000 >= (obj->minutes * 60 * 1000);
}
return FALSE;
@@ -293,31 +293,31 @@ static void IdleObject_Tick(IdleObject * obj) bool idle = false;
int idleType = 0, flags = 0;
- if ( obj->useridlecheck && IdleObject_IsUserIdle(obj)) {
+ if (obj->useridlecheck && IdleObject_IsUserIdle(obj)) {
idleType = 1; idle = true;
}
- else if ( IdleObject_IdleCheckSaver(obj) && IsScreenSaverRunning()) {
+ else if (IdleObject_IdleCheckSaver(obj) && IsScreenSaverRunning()) {
idleType = 2; idle = true;
}
- else if ( IdleObject_IdleCheckFullScr(obj) && IsFullScreen()) {
+ else if (IdleObject_IdleCheckFullScr(obj) && IsFullScreen()) {
idleType = 5; idle = true;
}
- else if ( IdleObject_IdleCheckWorkstation(obj) && IsWorkstationLocked()) {
+ else if (IdleObject_IdleCheckWorkstation(obj) && IsWorkstationLocked()) {
idleType = 3; idle = true;
}
- else if ( IdleObject_IdleCheckTerminal(obj) && IsTerminalDisconnected()) {
+ else if (IdleObject_IdleCheckTerminal(obj) && IsTerminalDisconnected()) {
idleType = 4; idle = true;
}
- if ( IdleObject_IsPrivacy(obj))
+ if (IdleObject_IsPrivacy(obj))
flags |= IDF_PRIVACY;
- if ( !IdleObject_IsIdle(obj) && idle ) {
+ if ( !IdleObject_IsIdle(obj) && idle) {
IdleObject_SetIdle(obj);
obj->idleType = idleType;
NotifyEventHooks(hIdleEvent, 0, IDF_ISIDLE | flags);
}
- if ( IdleObject_IsIdle(obj) && !idle ) {
+ if (IdleObject_IsIdle(obj) && !idle) {
IdleObject_ClearIdle(obj);
obj->idleType = 0;
NotifyEventHooks(hIdleEvent, 0, flags);
@@ -325,15 +325,15 @@ static void IdleObject_Tick(IdleObject * obj) void CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
{
- if ( gIdleObject.hTimer == idEvent )
- IdleObject_Tick( &gIdleObject );
+ if (gIdleObject.hTimer == idEvent)
+ IdleObject_Tick(&gIdleObject);
}
int IdleGetStatusIndex(WORD status)
{
int j;
- for (j = 0; j < SIZEOF(aa_Status); j++ )
- if ( aa_Status[j] == status )
+ for (j = 0; j < SIZEOF(aa_Status); j++)
+ if (aa_Status[j] == status)
return j;
return 0;
@@ -341,7 +341,7 @@ int IdleGetStatusIndex(WORD status) static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
{
int j;
@@ -355,8 +355,8 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_LOCKED, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONLOCK, 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_IDLEPRIVATE, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEPRIVATE, 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_IDLESTATUSLOCK, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, 0) ? BST_CHECKED : BST_UNCHECKED);
- if ( !bIsWTSApiPresent )
- EnableWindow( GetDlgItem( hwndDlg, IDC_IDLETERMINAL ), FALSE );
+ if ( !bIsWTSApiPresent)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IDLETERMINAL), FALSE);
else
CheckDlgButton(hwndDlg, IDC_IDLETERMINAL, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONTSDC, 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_IDLE1STTIME), 0);
@@ -365,8 +365,8 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_IDLE1STTIME, EM_LIMITTEXT, (WPARAM)2, 0);
CheckDlgButton(hwndDlg, IDC_AASHORTIDLE, DBGetContactSettingByte(NULL, IDLEMOD, IDL_AAENABLE, 0) ? BST_CHECKED:BST_UNCHECKED);
- for ( j = 0; j < SIZEOF(aa_Status); j++ )
- SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_ADDSTRING, 0, ( LPARAM )cli.pfnGetStatusModeDescription( aa_Status[j], 0 ));
+ for (j = 0; j < SIZEOF(aa_Status); j++)
+ SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_ADDSTRING, 0, (LPARAM)cli.pfnGetStatusModeDescription(aa_Status[j], 0));
j = IdleGetStatusIndex((WORD)(DBGetContactSettingWord(NULL, IDLEMOD, IDL_AASTATUS, 0)));
SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_SETCURSEL, j, 0);
@@ -386,7 +386,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY:
{
NMHDR * hdr = (NMHDR *)lParam;
- if ( hdr && hdr->code == PSN_APPLY ) {
+ if (hdr && hdr->code == PSN_APPLY) {
int method = IsDlgButtonChecked(hwndDlg, IDC_IDLEONWINDOWS) == BST_CHECKED;
int mins = SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_GETPOS, 0, 0);
DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLETIME1ST, (BYTE)(HIWORD(mins) == 0 ? LOWORD(mins) : 10));
@@ -401,7 +401,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DBWriteContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLESTATUSLOCK) == BST_CHECKED?1:0));
{
int curSel = SendDlgItemMessage(hwndDlg, IDC_AASTATUS, CB_GETCURSEL, 0, 0);
- if ( curSel != CB_ERR ) {
+ if (curSel != CB_ERR) {
DBWriteContactSettingWord(NULL, IDLEMOD, IDL_AASTATUS, (WORD)(aa_Status[curSel]));
}
}
@@ -412,13 +412,13 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
}
case WM_COMMAND:
- switch ( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDC_IDLE1STTIME:
{
int min;
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE ) return FALSE;
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return FALSE;
min=GetDlgItemInt(hwndDlg, IDC_IDLE1STTIME, NULL, FALSE);
- if ( min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_IDLE1STTIME)) )
+ if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_IDLE1STTIME)))
SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
break;
}
@@ -428,7 +428,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case IDC_AASTATUS:
- if ( HIWORD(wParam) != CBN_SELCHANGE )
+ if (HIWORD(wParam) != CBN_SELCHANGE)
return TRUE;
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -448,14 +448,14 @@ static int IdleOptInit(WPARAM wParam, LPARAM) odp.pszTitle = LPGEN("Idle");
odp.pfnDlgProc = IdleOptsDlgProc;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam)
{
- MIRANDA_IDLE_INFO *mii = ( MIRANDA_IDLE_INFO* )lParam;
- if ( !mii || ( mii->cbSize != sizeof(MIRANDA_IDLE_INFO) && mii->cbSize != MIRANDA_IDLE_INFO_SIZE_1 ))
+ MIRANDA_IDLE_INFO *mii = (MIRANDA_IDLE_INFO*)lParam;
+ if ( !mii || (mii->cbSize != sizeof(MIRANDA_IDLE_INFO) && mii->cbSize != MIRANDA_IDLE_INFO_SIZE_1))
return 1;
mii->idleTime = gIdleObject.minutes;
@@ -463,7 +463,7 @@ static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam) mii->aaStatus = gIdleObject.aastatus;
mii->aaLock = gIdleObject.state&0x20;
- if ( mii->cbSize == sizeof(MIRANDA_IDLE_INFO))
+ if (mii->cbSize == sizeof(MIRANDA_IDLE_INFO))
mii->idleType = gIdleObject.idleType;
return 0;
}
@@ -508,7 +508,7 @@ int LoadIdleModule(void) void UnloadIdleModule()
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
IdleObject_Destroy(&gIdleObject);
DestroyHookableEvent(hIdleEvent);
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 2c3ca8ba78..4158925082 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -65,7 +65,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for ( i=0; i < SIZEOF(iconOn); i++ ) {
+ for (i=0; i < SIZEOF(iconOn); i++) {
iImage=SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if (iconOn[i] && iImage == 0) iconOn[i]=0;
if (iImage != 0xFF) childCount[i]++;
@@ -73,7 +73,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for ( i=0; i < SIZEOF(iconOn); i++ ) {
+ for (i=0; i < SIZEOF(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+3:0):0xFF));
if (groupChildCount) groupChildCount[i]+=childCount[i];
}
@@ -146,7 +146,7 @@ static void InitialiseItem(HWND hwndList, HANDLE hContact, HANDLE hItem, DWORD p mask=GetMask(hContact);
for (i=0;i<IGNOREEVENT_MAX;i++)
- if ((ignoreIdToPf1[i] == 0xFFFFFFFF&&ignoreIdToPf4[i] == 0xFFFFFFFF) || (proto1Caps&ignoreIdToPf1[i]||proto4Caps&ignoreIdToPf4[i]))
+ if ((ignoreIdToPf1[i] == 0xFFFFFFFF&&ignoreIdToPf4[i] == 0xFFFFFFFF) || (proto1Caps&ignoreIdToPf1[i] || proto4Caps&ignoreIdToPf4[i]))
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, mask&(1<<i)?i+3:0));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 1));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX+1, 2));
@@ -182,7 +182,7 @@ static void SetAllContactIcons(HWND hwndList) proto4Caps=CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
}
InitialiseItem(hwndList, hContact, hItem, proto1Caps, proto4Caps);
- if (!DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if ( !DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
}
} while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_TYPING);
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- for ( i=0; i < SIZEOF(hIcons); i++ )
+ for (i=0; i < SIZEOF(hIcons); i++)
hIcons[i]=ImageList_GetIcon(hIml, 1+i, ILD_NORMAL);
}
@@ -226,7 +226,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM SendDlgItemMessage(hwndDlg, IDC_ADDED, STM_SETICON, (WPARAM)hIcons[7], 0);
SendDlgItemMessage(hwndDlg, IDC_TYPINGICON, STM_SETICON, (WPARAM)hIcons[8], 0);
- if (!SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) {
+ if ( !SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) {
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE)&~(CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN));
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_AUTOREBUILD, 0, 0);
}
@@ -278,7 +278,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM if (nm->iColumn == -1) break;
hItem=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
if (hItem == NULL) break;
- if (!(hitFlags&CLCHT_ONITEMEXTRA)) break;
+ if ( !(hitFlags&CLCHT_ONITEMEXTRA)) break;
if (nm->iColumn == IGNOREEVENT_MAX) { //ignore all
for (iImage=0;iImage<IGNOREEVENT_MAX;iImage++)
SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, iImage, iImage+3);
@@ -329,7 +329,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM case WM_DESTROY:
{ int i;
HIMAGELIST hIml;
- for ( i=0; i < SIZEOF(hIcons); i++ )
+ for (i=0; i < SIZEOF(hIcons); i++)
DestroyIcon(hIcons[i]);
hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0);
ImageList_Destroy(hIml);
@@ -352,8 +352,8 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgProcIgnoreOpts;
odp.flags = ODPF_BOLDGROUPS;
odp.expertOnlyControls = expertOnlyControls;
- odp.nExpertOnlyControls = SIZEOF( expertOnlyControls );
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp);
+ odp.nExpertOnlyControls = SIZEOF(expertOnlyControls);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -459,8 +459,8 @@ int LoadIgnoreModule(void) CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while ( hContact != NULL ) {
- if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"Ignore"))
+ while (hContact != NULL) {
+ if ( !CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"Ignore"))
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)"Ignore");
hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
}
diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp index 54e78b6dae..3d20a4b85b 100644 --- a/src/modules/langpack/langpack.cpp +++ b/src/modules/langpack/langpack.cpp @@ -34,12 +34,12 @@ struct LangPackMuuid PLUGININFOEX* pInfo;
};
-static int CompareMuuids( const LangPackMuuid* p1, const LangPackMuuid* p2 )
+static int CompareMuuids(const LangPackMuuid* p1, const LangPackMuuid* p2)
{
- return memcmp( &p1->muuid, &p2->muuid, sizeof( MUUID ));
+ return memcmp(&p1->muuid, &p2->muuid, sizeof(MUUID));
}
-static LIST<LangPackMuuid> lMuuids( 10, CompareMuuids );
+static LIST<LangPackMuuid> lMuuids(10, CompareMuuids);
static LangPackMuuid* pCurrentMuuid = NULL;
static BOOL bModuleInitialized = FALSE;
@@ -81,9 +81,9 @@ static int IsEmpty(char *str) void ConvertBackslashes(char *str, UINT fileCp)
{
char *pstr;
- for ( pstr = str; *pstr; pstr = CharNextExA( fileCp, pstr, 0 )) {
- if ( *pstr == '\\' ) {
- switch( pstr[1] ) {
+ for (pstr = str; *pstr; pstr = CharNextExA(fileCp, pstr, 0)) {
+ if (*pstr == '\\') {
+ switch(pstr[1]) {
case 'n': *pstr = '\n'; break;
case 't': *pstr = '\t'; break;
case 'r': *pstr = '\r'; break;
@@ -93,7 +93,7 @@ void ConvertBackslashes(char *str, UINT fileCp) } } }
#ifdef _DEBUG
-//#pragma optimize( "gt", on )
+//#pragma optimize("gt", on)
#endif
// MurmurHash2
@@ -161,7 +161,7 @@ static int SortLangPackHashesProc(LangPackEntry *arg1, LangPackEntry *arg2) return (arg1->pMuuid < arg2->pMuuid) ? -1 : 1;
}
-static void swapBytes( void* p, size_t iSize )
+static void swapBytes(void* p, size_t iSize)
{
char *head = (char *)p; // here
char *tail = head + iSize - 1;
@@ -173,68 +173,68 @@ static void swapBytes( void* p, size_t iSize ) }
}
-static bool EnterMuuid( const char* p, MUUID& result )
+static bool EnterMuuid(const char* p, MUUID& result)
{
- if ( *p++ != '{' )
+ if (*p++ != '{')
return false;
BYTE* d = (BYTE*)&result;
- for ( int nBytes = 0; *p && nBytes < 24; p++ ) {
- if ( *p == '-' )
+ for (int nBytes = 0; *p && nBytes < 24; p++) {
+ if (*p == '-')
continue;
- if ( *p == '}' )
+ if (*p == '}')
break;
- if ( !isxdigit( *p ))
+ if ( !isxdigit(*p))
return false;
- if ( !isxdigit( p[1] ))
+ if ( !isxdigit(p[1]))
return false;
int c = 0;
- if ( sscanf( p, "%2x", &c ) != 1 )
+ if (sscanf(p, "%2x", &c) != 1)
return false;
- *d++ = ( BYTE )c;
+ *d++ = (BYTE)c;
nBytes++;
p++;
}
- if ( *p != '}' )
+ if (*p != '}')
return false;
- swapBytes( &result.a, sizeof( result.a ));
- swapBytes( &result.b, sizeof( result.b ));
- swapBytes( &result.c, sizeof( result.c ));
+ swapBytes(&result.a, sizeof(result.a));
+ swapBytes(&result.b, sizeof(result.b));
+ swapBytes(&result.c, sizeof(result.c));
return true;
}
-static void LoadLangPackFile( FILE* fp, char* line, UINT fileCp )
+static void LoadLangPackFile(FILE* fp, char* line, UINT fileCp)
{
- while ( !feof( fp )) {
- if ( fgets( line, LANGPACK_BUF_SIZE, fp ) == NULL )
+ while ( !feof(fp)) {
+ if (fgets(line, LANGPACK_BUF_SIZE, fp) == NULL)
break;
- if ( IsEmpty(line) || line[0] == ';' || line[0] == 0 )
+ if (IsEmpty(line) || line[0] == ';' || line[0] == 0)
continue;
- rtrim( line );
+ rtrim(line);
- if ( line[0] == '#' ) {
- strlwr( line );
+ if (line[0] == '#') {
+ strlwr(line);
- if ( !memcmp( line+1, "include", 7 )) {
+ if ( !memcmp(line+1, "include", 7)) {
TCHAR tszFileName[ MAX_PATH ];
- TCHAR* fileName = mir_a2t( ltrim( line+9 ));
- mir_sntprintf( tszFileName, SIZEOF(tszFileName), _T("%s%s"), langPack.filePath, fileName );
- mir_free( fileName );
+ TCHAR* fileName = mir_a2t(ltrim(line+9));
+ mir_sntprintf(tszFileName, SIZEOF(tszFileName), _T("%s%s"), langPack.filePath, fileName);
+ mir_free(fileName);
- FILE* p = _tfopen( tszFileName, _T("r"));
- if ( p ) {
+ FILE* p = _tfopen(tszFileName, _T("r"));
+ if (p) {
line[0] = 0;
- fgets( line, SIZEOF(line), p );
+ fgets(line, SIZEOF(line), p);
UINT fileCp = CP_ACP;
if (strlen(line) >= 3 && line[0] == '\xef' && line[1] == '\xbb' && line[2] == '\xbf')
@@ -248,38 +248,38 @@ static void LoadLangPackFile( FILE* fp, char* line, UINT fileCp ) fseek(p, 0, SEEK_SET);
}
- LoadLangPackFile( p, line, fileCp );
- fclose( p );
+ LoadLangPackFile(p, line, fileCp);
+ fclose(p);
}
}
- else if ( !memcmp( line+1, "muuid", 5 )) {
+ else if ( !memcmp(line+1, "muuid", 5)) {
MUUID t;
- if ( !EnterMuuid( line+7, t )) {
- NetlibLogf( NULL, "Invalid MUUID: %s\n", line+7 );
+ if ( !EnterMuuid(line+7, t)) {
+ NetlibLogf(NULL, "Invalid MUUID: %s\n", line+7);
continue;
}
- LangPackMuuid* pNew = ( LangPackMuuid* )mir_alloc( sizeof( LangPackMuuid ));
- memcpy( &pNew->muuid, &t, sizeof( t ));
+ LangPackMuuid* pNew = (LangPackMuuid*)mir_alloc(sizeof(LangPackMuuid));
+ memcpy(&pNew->muuid, &t, sizeof(t));
pNew->pInfo = NULL;
- lMuuids.insert( pNew );
+ lMuuids.insert(pNew);
pCurrentMuuid = pNew;
}
continue;
}
- ConvertBackslashes( line, fileCp );
+ ConvertBackslashes(line, fileCp);
- if ( line[0] == '[' && line[ lstrlenA(line)-1 ] == ']' ) {
- if ( langPack.entryCount && langPack.entry[ langPack.entryCount-1].local == NULL )
+ if (line[0] == '[' && line[ lstrlenA(line)-1 ] == ']') {
+ if (langPack.entryCount && langPack.entry[ langPack.entryCount-1].local == NULL)
langPack.entryCount--;
char* pszLine = line+1;
line[ lstrlenA(line)-1 ] = '\0';
- if ( ++langPack.entryCount > langPack.entriesAlloced ) {
+ if (++langPack.entryCount > langPack.entriesAlloced) {
langPack.entriesAlloced += 128;
- langPack.entry = ( LangPackEntry* )mir_realloc( langPack.entry, sizeof(LangPackEntry)*langPack.entriesAlloced );
+ langPack.entry = (LangPackEntry*)mir_realloc(langPack.entry, sizeof(LangPackEntry)*langPack.entriesAlloced);
}
LangPackEntry* E = &langPack.entry[ langPack.entryCount-1 ];
@@ -291,33 +291,33 @@ static void LoadLangPackFile( FILE* fp, char* line, UINT fileCp ) continue;
}
- if ( !langPack.entryCount )
+ if ( !langPack.entryCount)
continue;
LangPackEntry* E = &langPack.entry[ langPack.entryCount-1 ];
- if ( E->local == NULL ) {
- E->local = mir_strdup( line );
- if ( fileCp == CP_UTF8 )
- Utf8DecodeCP( E->local, langPack.defaultANSICp, NULL );
+ if (E->local == NULL) {
+ E->local = mir_strdup(line);
+ if (fileCp == CP_UTF8)
+ Utf8DecodeCP(E->local, langPack.defaultANSICp, NULL);
int iNeeded = MultiByteToWideChar(fileCp, 0, line, -1, 0, 0);
E->wlocal = (wchar_t *)mir_alloc((iNeeded+1) * sizeof(wchar_t));
- MultiByteToWideChar( fileCp, 0, line, -1, E->wlocal, iNeeded );
+ MultiByteToWideChar(fileCp, 0, line, -1, E->wlocal, iNeeded);
}
else {
- size_t iOldLenA = strlen( E->local );
- E->local = ( char* )mir_realloc( E->local, iOldLenA + strlen(line) + 2 );
- strcat( E->local, "\n" );
- strcat( E->local, line );
-
- if ( fileCp == CP_UTF8 )
- Utf8DecodeCP( E->local + iOldLenA + 1, langPack.defaultANSICp, NULL );
-
- int iNeeded = MultiByteToWideChar( fileCp, 0, line, -1, 0, 0 );
- size_t iOldLen = wcslen( E->wlocal );
- E->wlocal = ( wchar_t* )mir_realloc( E->wlocal, ( sizeof(wchar_t) * ( iOldLen + iNeeded + 2)));
- wcscat( E->wlocal, L"\n" );
- MultiByteToWideChar( fileCp, 0, line, -1, E->wlocal + iOldLen + 1, iNeeded );
+ size_t iOldLenA = strlen(E->local);
+ E->local = (char*)mir_realloc(E->local, iOldLenA + strlen(line) + 2);
+ strcat(E->local, "\n");
+ strcat(E->local, line);
+
+ if (fileCp == CP_UTF8)
+ Utf8DecodeCP(E->local + iOldLenA + 1, langPack.defaultANSICp, NULL);
+
+ int iNeeded = MultiByteToWideChar(fileCp, 0, line, -1, 0, 0);
+ size_t iOldLen = wcslen(E->wlocal);
+ E->wlocal = (wchar_t*)mir_realloc(E->wlocal, (sizeof(wchar_t) * (iOldLen + iNeeded + 2)));
+ wcscat(E->wlocal, L"\n");
+ MultiByteToWideChar(fileCp, 0, line, -1, E->wlocal + iOldLen + 1, iNeeded);
}
}
}
@@ -327,18 +327,18 @@ static int LoadLangPack(const TCHAR *szLangPack) int startOfLine=0;
USHORT langID;
- lstrcpy( langPack.filename, szLangPack );
- lstrcpy( langPack.filePath, szLangPack );
- TCHAR* p = _tcsrchr( langPack.filePath, '\\' );
- if ( p )
+ lstrcpy(langPack.filename, szLangPack);
+ lstrcpy(langPack.filePath, szLangPack);
+ TCHAR* p = _tcsrchr(langPack.filePath, '\\');
+ if (p)
p[1] = 0;
FILE *fp = _tfopen(szLangPack, _T("rt"));
- if ( fp == NULL )
+ if (fp == NULL)
return 1;
char line[ LANGPACK_BUF_SIZE ] = "";
- fgets( line, SIZEOF(line), fp );
+ fgets(line, SIZEOF(line), fp);
UINT fileCp = CP_ACP;
size_t lineLen = strlen(line);
@@ -348,37 +348,37 @@ static int LoadLangPack(const TCHAR *szLangPack) memmove(line, line + 3, lineLen - 2);
}
- lrtrim( line );
- if ( lstrcmpA( line, "Miranda Language Pack Version 1" )) {
+ lrtrim(line);
+ if (lstrcmpA(line, "Miranda Language Pack Version 1")) {
fclose(fp);
return 2;
}
//headers
- while ( !feof( fp )) {
- startOfLine = ftell( fp );
- if ( fgets( line, SIZEOF(line), fp ) == NULL )
+ while ( !feof(fp)) {
+ startOfLine = ftell(fp);
+ if (fgets(line, SIZEOF(line), fp) == NULL)
break;
- lrtrim( line );
- if ( IsEmpty( line ) || line[0] == ';' || line[0] == 0)
+ lrtrim(line);
+ if (IsEmpty(line) || line[0] == ';' || line[0] == 0)
continue;
- if ( line[0] == '[' || line[0] == '#' )
+ if (line[0] == '[' || line[0] == '#')
break;
- char* pszColon = strchr( line, ':' );
- if ( pszColon == NULL ) {
- fclose( fp );
+ char* pszColon = strchr(line, ':');
+ if (pszColon == NULL) {
+ fclose(fp);
return 3;
}
*pszColon++ = 0;
- if (!lstrcmpA(line, "Language")) {mir_snprintf(langPack.language, sizeof(langPack.language), "%s", pszColon); lrtrim(langPack.language);}
- else if (!lstrcmpA(line, "Last-Modified-Using")) {mir_snprintf(langPack.lastModifiedUsing, sizeof(langPack.lastModifiedUsing), "%s", pszColon); lrtrim(langPack.lastModifiedUsing);}
- else if (!lstrcmpA(line, "Authors")) {mir_snprintf(langPack.authors, sizeof(langPack.authors), "%s", pszColon); lrtrim(langPack.authors);}
- else if (!lstrcmpA(line, "Author-email")) {mir_snprintf(langPack.authorEmail, sizeof(langPack.authorEmail), "%s", pszColon); lrtrim(langPack.authorEmail);}
- else if (!lstrcmpA(line, "Locale")) {
+ if ( !lstrcmpA(line, "Language")) {mir_snprintf(langPack.language, sizeof(langPack.language), "%s", pszColon); lrtrim(langPack.language);}
+ else if ( !lstrcmpA(line, "Last-Modified-Using")) {mir_snprintf(langPack.lastModifiedUsing, sizeof(langPack.lastModifiedUsing), "%s", pszColon); lrtrim(langPack.lastModifiedUsing);}
+ else if ( !lstrcmpA(line, "Authors")) {mir_snprintf(langPack.authors, sizeof(langPack.authors), "%s", pszColon); lrtrim(langPack.authors);}
+ else if ( !lstrcmpA(line, "Author-email")) {mir_snprintf(langPack.authorEmail, sizeof(langPack.authorEmail), "%s", pszColon); lrtrim(langPack.authorEmail);}
+ else if ( !lstrcmpA(line, "Locale")) {
char szBuf[20], *stopped;
lrtrim(pszColon + 1);
@@ -393,10 +393,10 @@ static int LoadLangPack(const TCHAR *szLangPack) }
//body
- fseek( fp, startOfLine, SEEK_SET );
+ fseek(fp, startOfLine, SEEK_SET);
langPack.entriesAlloced = 0;
- LoadLangPackFile( fp, line, fileCp );
+ LoadLangPackFile(fp, line, fileCp);
fclose(fp);
qsort(langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc);
@@ -414,18 +414,18 @@ static int SortLangPackHashesProc2(LangPackEntry *arg1, LangPackEntry *arg2) char *LangPackTranslateString(LangPackMuuid* pUuid, const char *szEnglish, const int W)
{
- if ( langPack.entryCount == 0 || szEnglish == NULL )
+ if (langPack.entryCount == 0 || szEnglish == NULL)
return (char*)szEnglish;
LangPackEntry key, *entry;
key.englishHash = W ? hashstrW(szEnglish) : hashstr(szEnglish);
- entry = (LangPackEntry*)bsearch(&key, langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc2 );
- if ( entry == NULL )
+ entry = (LangPackEntry*)bsearch(&key, langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc2);
+ if (entry == NULL)
return (char*)szEnglish;
// try to find the exact match, otherwise the first entry will be returned
- if ( pUuid ) {
- for ( LangPackEntry* p = entry->pNext; p != NULL; p = p->pNext ) {
+ if (pUuid) {
+ for (LangPackEntry* p = entry->pNext; p != NULL; p = p->pNext) {
if (p->pMuuid == pUuid) {
entry = p;
break;
@@ -444,54 +444,54 @@ int LangPackGetDefaultLocale() return (langPack.localeID == 0) ? LOCALE_USER_DEFAULT : langPack.localeID;
}
-TCHAR* LangPackPcharToTchar( const char* pszStr )
+TCHAR* LangPackPcharToTchar(const char* pszStr)
{
- if ( pszStr == NULL )
+ if (pszStr == NULL)
return NULL;
- { int len = (int)strlen( pszStr );
- TCHAR* result = ( TCHAR* )alloca(( len+1 )*sizeof( TCHAR ));
- MultiByteToWideChar( LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len );
+ { int len = (int)strlen(pszStr);
+ TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
+ MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
result[len] = 0;
- return mir_wstrdup( TranslateW( result ));
+ return mir_wstrdup(TranslateW(result));
}
}
/////////////////////////////////////////////////////////////////////////////////////////
-LangPackMuuid* __fastcall LangPackLookupUuid( WPARAM wParam )
+LangPackMuuid* __fastcall LangPackLookupUuid(WPARAM wParam)
{
int idx = (wParam >> 16) & 0xFFFF;
- return ( idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[ idx-1 ] : NULL;
+ return (idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[ idx-1 ] : NULL;
}
-int LangPackMarkPluginLoaded( PLUGININFOEX* pInfo )
+int LangPackMarkPluginLoaded(PLUGININFOEX* pInfo)
{
LangPackMuuid tmp; tmp.muuid = pInfo->uuid;
- int idx = lMuuids.getIndex( &tmp );
- if ( idx == -1 )
+ int idx = lMuuids.getIndex(&tmp);
+ if (idx == -1)
return 0;
lMuuids[ idx ]->pInfo = pInfo;
return (idx+1) << 16;
}
-void LangPackDropUnusedItems( void )
+void LangPackDropUnusedItems(void)
{
- if ( langPack.entryCount == 0 )
+ if (langPack.entryCount == 0)
return;
LangPackEntry *s = langPack.entry+1, *d = s, *pLast = langPack.entry;
DWORD dwSavedHash = langPack.entry->englishHash;
bool bSortNeeded = false;
- for ( int i=1; i < langPack.entryCount; i++, s++ ) {
- if ( s->pMuuid != NULL && s->pMuuid->pInfo == NULL )
+ for (int i=1; i < langPack.entryCount; i++, s++) {
+ if (s->pMuuid != NULL && s->pMuuid->pInfo == NULL)
s->pMuuid = NULL;
- if ( s->englishHash != dwSavedHash ) {
+ if (s->englishHash != dwSavedHash) {
pLast = d;
- if ( s != d )
+ if (s != d)
*d++ = *s;
else
d++;
@@ -499,14 +499,14 @@ void LangPackDropUnusedItems( void ) }
else {
bSortNeeded = true;
- LangPackEntry* p = ( LangPackEntry* )mir_alloc( sizeof( LangPackEntry ));
+ LangPackEntry* p = (LangPackEntry*)mir_alloc(sizeof(LangPackEntry));
*p = *s;
pLast->pNext = p; pLast = p;
}
}
- if ( bSortNeeded ) {
- langPack.entryCount = ( int )( d - langPack.entry );
+ if (bSortNeeded) {
+ langPack.entryCount = (int)(d - langPack.entry);
qsort(langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc);
}
}
@@ -524,8 +524,8 @@ int LoadLangPackModule(void) ZeroMemory(&langPack, sizeof(langPack));
LoadLangPackServices();
pathToAbsoluteT(_T("langpack_*.txt"), szSearch, NULL);
- hFind = FindFirstFile( szSearch, &fd );
- if ( hFind != INVALID_HANDLE_VALUE ) {
+ hFind = FindFirstFile(szSearch, &fd);
+ if (hFind != INVALID_HANDLE_VALUE) {
pathToAbsoluteT(fd.cFileName, szSearch, NULL);
FindClose(hFind);
LoadLangPack(szSearch);
@@ -535,28 +535,28 @@ int LoadLangPackModule(void) void UnloadLangPackModule()
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
int i;
- for ( i=0; i < lMuuids.getCount(); i++ )
- mir_free( lMuuids[i] );
+ for (i=0; i < lMuuids.getCount(); i++)
+ mir_free(lMuuids[i]);
lMuuids.destroy();
LangPackEntry* p = langPack.entry;
- for ( i=0; i < langPack.entryCount; i++, p++ ) {
- if ( p->pNext != NULL ) {
- for ( LangPackEntry* p1 = p->pNext; p1 != NULL; ) {
+ for (i=0; i < langPack.entryCount; i++, p++) {
+ if (p->pNext != NULL) {
+ for (LangPackEntry* p1 = p->pNext; p1 != NULL;) {
LangPackEntry* p2 = p1; p1 = p1->pNext;
- mir_free( p2->local);
- mir_free( p2->wlocal);
- mir_free( p2 );
+ mir_free(p2->local);
+ mir_free(p2->wlocal);
+ mir_free(p2);
} }
- mir_free( p->local );
- mir_free( p->wlocal );
+ mir_free(p->local);
+ mir_free(p->wlocal);
}
- if ( langPack.entryCount ) {
+ if (langPack.entryCount) {
mir_free(langPack.entry);
langPack.entry=0;
langPack.entryCount=0;
@@ -566,8 +566,8 @@ void UnloadLangPackModule() INT_PTR ReloadLangpack(WPARAM wParam, LPARAM lParam)
{
- TCHAR* pszStr = ( TCHAR* )lParam;
- if ( pszStr == NULL )
+ TCHAR* pszStr = (TCHAR*)lParam;
+ if (pszStr == NULL)
pszStr = langPack.filename;
UnloadLangPackModule();
diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index 88e94b8cfc..983d069fda 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -24,14 +24,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define FLAGS LANG_UNICODE
-LangPackMuuid* __fastcall LangPackLookupUuid( WPARAM );
-int LangPackMarkPluginLoaded( PLUGININFOEX* pInfo );
+LangPackMuuid* __fastcall LangPackLookupUuid(WPARAM);
+int LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR TranslateString(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)LangPackTranslateString( LangPackLookupUuid(wParam), (const char *)lParam, (wParam & LANG_UNICODE) ? 1 : 0);
+ return (INT_PTR)LangPackTranslateString(LangPackLookupUuid(wParam), (const char *)lParam, (wParam & LANG_UNICODE) ? 1 : 0);
}
TCHAR* LangPackTranslateStringT(int hLangpack, const TCHAR* tszEnglish)
@@ -44,62 +44,62 @@ TCHAR* LangPackTranslateStringT(int hLangpack, const TCHAR* tszEnglish) static INT_PTR TranslateMenu(WPARAM wParam, LPARAM lParam)
{
- HMENU hMenu = ( HMENU )wParam;
- LangPackMuuid* uuid = LangPackLookupUuid( lParam );
+ HMENU hMenu = (HMENU)wParam;
+ LangPackMuuid* uuid = LangPackLookupUuid(lParam);
MENUITEMINFO mii;
mii.cbSize = MENUITEMINFO_V4_SIZE;
- for (int i = GetMenuItemCount( hMenu )-1; i >= 0; i--) {
+ for (int i = GetMenuItemCount(hMenu)-1; i >= 0; i--) {
TCHAR str[256];
mii.fMask = MIIM_TYPE|MIIM_SUBMENU;
- mii.dwTypeData = ( TCHAR* )str;
+ mii.dwTypeData = (TCHAR*)str;
mii.cch = SIZEOF(str);
GetMenuItemInfo(hMenu, i, TRUE, &mii);
- if ( mii.cch && mii.dwTypeData ) {
- TCHAR* result = ( TCHAR* )LangPackTranslateString( uuid, ( const char* )mii.dwTypeData, FLAGS );
- if ( result != mii.dwTypeData ) {
+ if (mii.cch && mii.dwTypeData) {
+ TCHAR* result = (TCHAR*)LangPackTranslateString(uuid, (const char*)mii.dwTypeData, FLAGS);
+ if (result != mii.dwTypeData) {
mii.dwTypeData = result;
mii.fMask = MIIM_TYPE;
- SetMenuItemInfo( hMenu, i, TRUE, &mii );
+ SetMenuItemInfo(hMenu, i, TRUE, &mii);
} }
- if ( mii.hSubMenu != NULL ) TranslateMenu(( WPARAM )mii.hSubMenu, lParam );
+ if (mii.hSubMenu != NULL) TranslateMenu((WPARAM)mii.hSubMenu, lParam);
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-static void TranslateWindow( LangPackMuuid* pUuid, HWND hwnd )
+static void TranslateWindow(LangPackMuuid* pUuid, HWND hwnd)
{
TCHAR title[2048];
- GetWindowText(hwnd, title, SIZEOF( title ));
+ GetWindowText(hwnd, title, SIZEOF(title));
{
- TCHAR* result = ( TCHAR* )LangPackTranslateString( pUuid, ( const char* )title, FLAGS );
- if ( result != title )
- SetWindowText(hwnd, result );
+ TCHAR* result = (TCHAR*)LangPackTranslateString(pUuid, (const char*)title, FLAGS);
+ if (result != title)
+ SetWindowText(hwnd, result);
} }
static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
{
LANGPACKTRANSLATEDIALOG *lptd = (LANGPACKTRANSLATEDIALOG*)lParam;
TCHAR szClass[32];
- int i, id = GetDlgCtrlID( hwnd );
+ int i, id = GetDlgCtrlID(hwnd);
- if ( lptd->ignoreControls != NULL )
- for ( i=0; lptd->ignoreControls[i]; i++ )
- if ( lptd->ignoreControls[i] == id )
+ if (lptd->ignoreControls != NULL)
+ for (i=0; lptd->ignoreControls[i]; i++)
+ if (lptd->ignoreControls[i] == id)
return TRUE;
- LangPackMuuid* uuid = LangPackLookupUuid( lptd->flags );
+ LangPackMuuid* uuid = LangPackLookupUuid(lptd->flags);
- GetClassName( hwnd, szClass, SIZEOF(szClass));
- if (!lstrcmpi(szClass, _T("static")) || !lstrcmpi(szClass, _T("hyperlink")) || !lstrcmpi(szClass, _T("button")) || !lstrcmpi(szClass, _T("MButtonClass")) || !lstrcmpi(szClass, _T("MHeaderbarCtrl")))
- TranslateWindow( uuid, hwnd );
- else if ( !lstrcmpi( szClass, _T("edit"))) {
- if ( lptd->flags & LPTDF_NOIGNOREEDIT || GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY )
- TranslateWindow( uuid, hwnd );
+ GetClassName(hwnd, szClass, SIZEOF(szClass));
+ if ( !lstrcmpi(szClass, _T("static")) || !lstrcmpi(szClass, _T("hyperlink")) || !lstrcmpi(szClass, _T("button")) || !lstrcmpi(szClass, _T("MButtonClass")) || !lstrcmpi(szClass, _T("MHeaderbarCtrl")))
+ TranslateWindow(uuid, hwnd);
+ else if ( !lstrcmpi(szClass, _T("edit"))) {
+ if (lptd->flags & LPTDF_NOIGNOREEDIT || GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY)
+ TranslateWindow(uuid, hwnd);
}
return TRUE;
}
@@ -107,13 +107,13 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam) static INT_PTR TranslateDialog(WPARAM wParam, LPARAM lParam)
{
LANGPACKTRANSLATEDIALOG *lptd = (LANGPACKTRANSLATEDIALOG*)lParam;
- if ( lptd == NULL || lptd->cbSize != sizeof(LANGPACKTRANSLATEDIALOG))
+ if (lptd == NULL || lptd->cbSize != sizeof(LANGPACKTRANSLATEDIALOG))
return 1;
- if ( !( lptd->flags & LPTDF_NOTITLE ))
- TranslateWindow( LangPackLookupUuid( lptd->flags ), lptd->hwndDlg );
+ if ( !(lptd->flags & LPTDF_NOTITLE))
+ TranslateWindow(LangPackLookupUuid(lptd->flags), lptd->hwndDlg);
- EnumChildWindows( lptd->hwndDlg, TranslateDialogEnumProc, lParam );
+ EnumChildWindows(lptd->hwndDlg, TranslateDialogEnumProc, lParam);
return 0;
}
@@ -121,7 +121,7 @@ static INT_PTR TranslateDialog(WPARAM wParam, LPARAM lParam) static INT_PTR LPRegister(WPARAM wParam, LPARAM lParam)
{
- *( int* )wParam = LangPackMarkPluginLoaded(( PLUGININFOEX* )lParam );
+ *(int*)wParam = LangPackMarkPluginLoaded((PLUGININFOEX*)lParam);
return 0;
}
@@ -143,17 +143,17 @@ static INT_PTR GetDefaultLocale(WPARAM, LPARAM) static INT_PTR PcharToTchar(WPARAM wParam, LPARAM lParam)
{
- char* pszStr = ( char* )lParam;
- if ( pszStr == NULL )
+ char* pszStr = (char*)lParam;
+ if (pszStr == NULL)
return NULL;
- LangPackMuuid* uuid = LangPackLookupUuid( wParam );
+ LangPackMuuid* uuid = LangPackLookupUuid(wParam);
- { int len = (int)strlen( pszStr );
- TCHAR* result = ( TCHAR* )alloca(( len+1 )*sizeof( TCHAR ));
- MultiByteToWideChar( LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len );
+ { int len = (int)strlen(pszStr);
+ TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
+ MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
result[len] = 0;
- return ( INT_PTR )mir_wstrdup(( wchar_t* )LangPackTranslateString( uuid, ( char* )result, 1 ));
+ return (INT_PTR)mir_wstrdup((wchar_t*)LangPackTranslateString(uuid, (char*)result, 1));
}
}
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index 7e637b4b47..9c6f55aa11 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -133,7 +133,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) struct NetlibUser *thisUser;
if (nlu == NULL || nlu->cbSize != sizeof(NETLIBUSER) || nlu->szSettingsModule == NULL
- || (!(nlu->flags&NUF_NOOPTIONS) && nlu->szDescriptiveName == NULL)
+ || ( !(nlu->flags&NUF_NOOPTIONS) && nlu->szDescriptiveName == NULL)
|| (nlu->flags&NUF_HTTPGATEWAY && (nlu->pfnHttpGatewayInit == NULL))) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
@@ -174,7 +174,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyType", PROXYTYPE_SOCKS5);
if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType == PROXYTYPE_HTTPS)
thisUser->settings.proxyType=PROXYTYPE_HTTP;
- if (!(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) {
+ if ( !(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) {
thisUser->settings.useProxy=0;
thisUser->settings.proxyType=PROXYTYPE_SOCKS5;
}
@@ -232,7 +232,7 @@ void NetlibDoClose(NetlibConnection *nlc, bool noShutdown) NetlibLogf(nlc->nlu, "(%p:%u) Connection closed internal", nlc, nlc->s);
if (nlc->hSsl)
{
- if (!noShutdown) si.shutdown(nlc->hSsl);
+ if ( !noShutdown) si.shutdown(nlc->hSsl);
si.sfree(nlc->hSsl);
nlc->hSsl = NULL;
}
@@ -286,7 +286,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM) waitHandles[1]=nlc->hOkToCloseEvent;
waitHandles[2]=nlc->ncsRecv.hMutex;
waitHandles[3]=nlc->ncsSend.hMutex;
- waitResult=WaitForMultipleObjects( SIZEOF(waitHandles), waitHandles, TRUE, INFINITE);
+ waitResult=WaitForMultipleObjects(SIZEOF(waitHandles), waitHandles, TRUE, INFINITE);
if (waitResult<WAIT_OBJECT_0 || waitResult >= WAIT_OBJECT_0 + SIZEOF(waitHandles)) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER); //already been closed
@@ -420,9 +420,9 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) return (INT_PTR)(char*)NULL;
}
for (outputLen=0, pszIn=szInput;*pszIn;pszIn++) {
- if ((48 <= *pszIn && *pszIn <= 57) ||//0-9
- (65 <= *pszIn && *pszIn <= 90) ||//ABC...XYZ
- (97 <= *pszIn && *pszIn <= 122) ||//abc...xyz
+ if ((48 <= *pszIn && *pszIn <= 57) || //0-9
+ (65 <= *pszIn && *pszIn <= 90) || //ABC...XYZ
+ (97 <= *pszIn && *pszIn <= 122) || //abc...xyz
*pszIn == '-' || *pszIn == '_' || *pszIn == '.' || *pszIn == ' ') outputLen++;
else outputLen+=3;
}
@@ -432,9 +432,9 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) return (INT_PTR)(unsigned char*)NULL;
}
for (pszOut=szOutput, pszIn=szInput;*pszIn;pszIn++) {
- if ((48 <= *pszIn && *pszIn <= 57) ||
- (65 <= *pszIn && *pszIn <= 90) ||
- (97 <= *pszIn && *pszIn <= 122) ||
+ if ((48 <= *pszIn && *pszIn <= 57) ||
+ (65 <= *pszIn && *pszIn <= 90) ||
+ (97 <= *pszIn && *pszIn <= 122) ||
*pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
else if (*pszIn == ' ') *pszOut++='+';
else {
@@ -539,7 +539,7 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam) void UnloadNetlibModule(void)
{
- if (!bModuleInitialized) return;
+ if ( !bModuleInitialized) return;
if (hConnectionHeaderMutex != NULL)
{
@@ -594,7 +594,7 @@ int LoadNetlibModule(void) DWORD dwType = 0;
tGetProductInfo pGetProductInfo = (tGetProductInfo) GetProcAddress(GetModuleHandleA("kernel32"), "GetProductInfo");
if (pGetProductInfo != NULL) pGetProductInfo(6, 0, 0, 0, &dwType);
- switch( dwType )
+ switch(dwType)
{
case 0x01: // Vista Ultimate edition have connection limit of 25 / sec - plenty for Miranda
case 0x1c:
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp index a3164216cd..37c3e88e22 100644 --- a/src/modules/netlib/netlibautoproxy.cpp +++ b/src/modules/netlib/netlibautoproxy.cpp @@ -90,7 +90,7 @@ BOOL __stdcall IsInNet(LPSTR lpszIPAddress, LPSTR lpszDest, LPSTR lpszMask) dwDest = inet_addr(lpszDest);
dwMask = inet_addr(lpszMask);
- if ((dwDest == INADDR_NONE) ||
+ if ((dwDest == INADDR_NONE) ||
(dwIpAddr == INADDR_NONE) || ((dwIpAddr & dwMask) != dwDest))
return (FALSE);
@@ -234,9 +234,9 @@ static void NetlibInitAutoProxy(void) {
if (bAutoProxyInit) return;
- if (!hModJS)
+ if ( !hModJS)
{
- if (!(hModJS = LoadLibraryA("jsproxy.dll")))
+ if ( !(hModJS = LoadLibraryA("jsproxy.dll")))
return;
pInternetInitializeAutoProxyDll = (pfnInternetInitializeAutoProxyDll)
@@ -269,7 +269,7 @@ static unsigned __stdcall NetlibIeProxyThread(void * arg) IeProxyParam *param = (IeProxyParam*)arg;
param->szProxy = NULL;
- if (!bAutoProxyInit)
+ if ( !bAutoProxyInit)
{
WaitForSingleObject(hIeProxyMutex, INFINITE);
NetlibInitAutoProxy();
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index 22e3876e42..ada02da36e 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -82,7 +82,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn) ++portnum;
if (s == INVALID_SOCKET) continue;
- if (!before && portnum <= *portn) continue;
+ if ( !before && portnum <= *portn) continue;
if (before && portnum >= *portn)
{
LeaveCriticalSection(&csNetlibUser);
@@ -163,7 +163,7 @@ static unsigned __stdcall NetlibBindAcceptThread(void* param) }
char *szHostA = NetlibAddressToString(&sin);
- NetlibLogf(nlbp->nlu, "New incoming connection on port %u from %s (%p )", nlbp->wPort, szHostA, s);
+ NetlibLogf(nlbp->nlu, "New incoming connection on port %u from %s (%p)", nlbp->wPort, szHostA, s);
mir_free(szHostA);
nlc = (NetlibConnection*)mir_calloc(sizeof(NetlibConnection));
nlc->handleType = NLH_CONNECTION;
@@ -191,7 +191,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) int foundPort = 0;
UINT dwThreadId;
- if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_INCOMING) ||
+ if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_INCOMING) ||
nlb == NULL || nlb->pfnNewConnection == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
@@ -224,7 +224,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) they better have given wPort == 0, let's hope so */
if (nlu->settings.specifyIncomingPorts && nlu->settings.szIncomingPorts && nlb->wPort == 0)
{
- if (!BindSocketToPort(nlu->settings.szIncomingPorts, nlbp->s, nlbp->s6, &nlu->outportnum))
+ if ( !BindSocketToPort(nlu->settings.szIncomingPorts, nlbp->s, nlbp->s6, &nlu->outportnum))
{
NetlibLogf(nlu, "Netlib bind: Not enough ports for incoming connections specified");
SetLastError(WSAEADDRINUSE);
@@ -246,7 +246,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) {
SOCKADDR_IN sin = {0};
int len = sizeof(sin);
- if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
+ if ( !getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
sin6.sin6_port = sin.sin_port;
foundPort = 1;
}
@@ -254,7 +254,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (bind(nlbp->s6, (PSOCKADDR)&sin6, sizeof(sin6)) == 0)
foundPort = 1;
}
- if (!foundPort)
+ if ( !foundPort)
{
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError());
closesocket(nlbp->s);
@@ -284,12 +284,12 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) {
SOCKADDR_INET_M sin = {0};
int len = sizeof(sin);
- if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
+ if ( !getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
{
nlb->wPort = ntohs(sin.Ipv4.sin_port);
nlb->dwInternalIP = ntohl(sin.Ipv4.sin_addr.S_un.S_addr);
}
- else if (!getsockname(nlbp->s6, (PSOCKADDR)&sin, &len))
+ else if ( !getsockname(nlbp->s6, (PSOCKADDR)&sin, &len))
nlb->wPort = ntohs(sin.Ipv6.sin6_port);
else
{
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index 708ebf962f..1805558ac3 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -50,7 +50,7 @@ struct ProxyAuth mir_free(szServer);
mir_free(szMethod);
}
- static int Compare(const ProxyAuth* p1, const ProxyAuth* p2 )
+ static int Compare(const ProxyAuth* p1, const ProxyAuth* p2)
{ return lstrcmpiA(p1->szServer, p2->szServer); }
};
@@ -112,7 +112,7 @@ static int RecvWithTimeoutTime(struct NetlibConnection *nlc, unsigned dwTimeoutT {
DWORD dwTimeNow;
- if (!si.pending(nlc->hSsl))
+ if ( !si.pending(nlc->hSsl))
{
while ((dwTimeNow = GetTickCount()) < dwTimeoutTime)
{
@@ -167,9 +167,9 @@ static char* NetlibHttpFindAuthHeader(NETLIBHTTPREQUEST *nlhrReply, const char * }
}
- if (szNegoHdr && (!szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr;
- if (szNtlmHdr && (!szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr;
- if (!szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr;
+ if (szNegoHdr && ( !szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr;
+ if (szNtlmHdr && ( !szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr;
+ if ( !szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr;
return NULL;
}
@@ -215,7 +215,7 @@ static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUse bool httpProxy = !(nloc.flags & NLOCF_SSL) && nlc->proxyType == PROXYTYPE_HTTP;
bool sameHost = lstrcmpA(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
- if (!httpProxy && !sameHost)
+ if ( !httpProxy && !sameHost)
{
NetlibDoClose(nlc);
@@ -245,7 +245,7 @@ struct HttpSecurityContext void Destroy(void)
{
- if (!m_hNtlmSecurity) return;
+ if ( !m_hNtlmSecurity) return;
NetlibDestroySecurityProvider(m_hNtlmSecurity);
m_hNtlmSecurity = NULL;
@@ -267,7 +267,7 @@ struct HttpSecurityContext if (m_hNtlmSecurity)
{
bool newAuth = !m_szProvider || !szProvider || _stricmp(m_szProvider, szProvider);
- newAuth = newAuth || (m_szHost != szHost && (!m_szHost || !szHost || _stricmp(m_szHost, szHost)));
+ newAuth = newAuth || (m_szHost != szHost && ( !m_szHost || !szHost || _stricmp(m_szHost, szHost)));
if (newAuth)
Destroy();
}
@@ -307,7 +307,7 @@ struct HttpSecurityContext szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity,
szChallenge, szLogin, szPassw, true, complete);
- if (!szAuthHdr)
+ if ( !szAuthHdr)
{
NetlibLogf(NULL, "Security login %s failed, user: " TCHAR_STR_PARAM " pssw: " TCHAR_STR_PARAM,
szProvider, szLogin ? szLogin : _T("(no user)"), szPassw ? _T("(exist)") : _T("(no psw)"));
@@ -466,9 +466,9 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR;
}
- if (!nlc->usingHttpGateway)
+ if ( !nlc->usingHttpGateway)
{
- if (!NetlibEnterNestedCS(nlc, NLNCS_SEND))
+ if ( !NetlibEnterNestedCS(nlc, NLNCS_SEND))
return SOCKET_ERROR;
}
@@ -479,13 +479,13 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) int count = 11;
while (--count)
{
- if (!NetlibReconnect(nlc))
+ if ( !NetlibReconnect(nlc))
{
bytesSent = SOCKET_ERROR;
break;
}
- if (!pszUrl)
+ if ( !pszUrl)
{
pszUrl = pszFullUrl;
if (nlhr->flags & (NLHRF_SMARTREMOVEHOST | NLHRF_REMOVEHOST | NLHRF_GENERATEHOST))
@@ -577,11 +577,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) doneHostHeader = doneContentLengthHeader = doneProxyAuthHeader = doneAuthHeader = 0;
for (i=0; i < nlhr->headersCount; i++)
{
- if (!lstrcmpiA(nlhr->headers[i].szName, "Host")) doneHostHeader = 1;
- else if (!lstrcmpiA(nlhr->headers[i].szName, "Content-Length")) doneContentLengthHeader = 1;
- else if (!lstrcmpiA(nlhr->headers[i].szName, "Proxy-Authorization")) doneProxyAuthHeader = 1;
- else if (!lstrcmpiA(nlhr->headers[i].szName, "Authorization")) doneAuthHeader = 1;
- else if (!lstrcmpiA(nlhr->headers[i].szName, "Connection")) continue;
+ if ( !lstrcmpiA(nlhr->headers[i].szName, "Host")) doneHostHeader = 1;
+ else if ( !lstrcmpiA(nlhr->headers[i].szName, "Content-Length")) doneContentLengthHeader = 1;
+ else if ( !lstrcmpiA(nlhr->headers[i].szName, "Proxy-Authorization")) doneProxyAuthHeader = 1;
+ else if ( !lstrcmpiA(nlhr->headers[i].szName, "Authorization")) doneAuthHeader = 1;
+ else if ( !lstrcmpiA(nlhr->headers[i].szName, "Connection")) continue;
if (nlhr->headers[i].szValue == NULL) continue;
AppendToCharBuffer(&httpRequest, "%s: %s\r\n", nlhr->headers[i].szName, nlhr->headers[i].szValue);
}
@@ -603,13 +603,13 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) if (bytesSent == SOCKET_ERROR) break;
//ntlm reply
- if (!doneContentLengthHeader || nlhr->requestType == REQUEST_HEAD)
+ if ( !doneContentLengthHeader || nlhr->requestType == REQUEST_HEAD)
{
int resultCode = 0;
DWORD fflags = MSG_PEEK | MSG_NODUMP | ((nlhr->flags & NLHRF_NOPROXY) ? MSG_RAW : 0);
DWORD dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout;
- if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &resultCode, NULL, NULL))
+ if ( !HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &resultCode, NULL, NULL))
{
NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", GetLastError(), count);
DWORD err = GetLastError();
@@ -702,14 +702,14 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) if (nlhrReply)
{
char *szAuthStr = NULL;
- if (!complete)
+ if ( !complete)
{
szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate",
httpSecurity.m_szProvider);
if (szAuthStr)
{
char *szChallenge = strchr(szAuthStr, ' ');
- if (!szChallenge || !*lrtrimp(szChallenge)) complete = true;
+ if ( !szChallenge || !*lrtrimp(szChallenge)) complete = true;
}
}
if (complete && httpSecurity.m_hNtlmSecurity)
@@ -745,14 +745,14 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) if (nlhrReply)
{
char *szAuthStr = NULL;
- if (!complete)
+ if ( !complete)
{
szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate",
httpSecurity.m_szProvider);
if (szAuthStr)
{
char *szChallenge = strchr(szAuthStr, ' ');
- if (!szChallenge || !*lrtrimp(szChallenge + 1)) complete = true;
+ if ( !szChallenge || !*lrtrimp(szChallenge + 1)) complete = true;
}
}
if (complete && httpSecurity.m_hNtlmSecurity)
@@ -807,7 +807,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(szHost);
mir_free(szNewUrl);
- if (!nlc->usingHttpGateway)
+ if ( !nlc->usingHttpGateway)
NetlibLeaveNestedCS(&nlc->ncsSend);
return bytesSent;
@@ -850,7 +850,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) int headersCount = 0, bufferSize = 8192;
bool headersCompleted = false;
- if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
+ if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV))
return 0;
dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT;
@@ -859,7 +859,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) nlhr->nlc = nlc; // Needed to id connection in the protocol HTTP gateway wrapper functions
nlhr->requestType = REQUEST_RESPONSE;
- if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK,
+ if ( !HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK,
&nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength))
{
NetlibLeaveNestedCS(&nlc->ncsRecv);
@@ -880,7 +880,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) // Make sure all headers arrived
bytesPeeked = 0;
- while (!headersCompleted)
+ while ( !headersCompleted)
{
if (bytesPeeked >= bufferSize)
{
@@ -985,12 +985,12 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) bool doneUserAgentHeader = NetlibHttpFindHeader(nlhr, "User-Agent") != NULL;
bool doneAcceptEncoding = NetlibHttpFindHeader(nlhr, "Accept-Encoding") != NULL;
- if (!doneUserAgentHeader || !doneAcceptEncoding)
+ if ( !doneUserAgentHeader || !doneAcceptEncoding)
{
nlhrSend.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER) * (nlhrSend.headersCount + 2));
memcpy(nlhrSend.headers, nlhr->headers, sizeof(NETLIBHTTPHEADER) * nlhr->headersCount);
}
- if (!doneUserAgentHeader)
+ if ( !doneUserAgentHeader)
{
char *pspace, szMirandaVer[64];
@@ -1007,7 +1007,7 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) else
mir_snprintf(szUserAgent, SIZEOF(szUserAgent), "Miranda/%s", szMirandaVer);
}
- if (!doneAcceptEncoding)
+ if ( !doneAcceptEncoding)
{
nlhrSend.headers[nlhrSend.headersCount].szName = "Accept-Encoding";
nlhrSend.headers[nlhrSend.headersCount].szValue = "deflate, gzip";
@@ -1015,11 +1015,11 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) }
if (NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) == SOCKET_ERROR)
{
- if (!doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
+ if ( !doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
NetlibCloseHandle((WPARAM)nlc, 0);
return 0;
}
- if (!doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
+ if ( !doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
}
dflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT:0) |
@@ -1173,10 +1173,10 @@ next: for (i=0; i<nlhrReply->headersCount; i++)
{
- if (!lstrcmpiA(nlhrReply->headers[i].szName, "Content-Length"))
+ if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Content-Length"))
dataLen = atoi(nlhrReply->headers[i].szValue);
- if (!lstrcmpiA(nlhrReply->headers[i].szName, "Content-Encoding"))
+ if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Content-Encoding"))
{
cenc = i;
if (strstr(nlhrReply->headers[i].szValue, "gzip"))
@@ -1185,10 +1185,10 @@ next: cenctype = 2;
}
- if (!lstrcmpiA(nlhrReply->headers[i].szName, "Connection"))
+ if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Connection"))
close = !lstrcmpiA(nlhrReply->headers[i].szValue, "close");
- if (!lstrcmpiA(nlhrReply->headers[i].szName, "Transfer-Encoding") &&
+ if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Transfer-Encoding") &&
!lstrcmpiA(nlhrReply->headers[i].szValue, "chunked"))
{
chunked = true;
@@ -1197,7 +1197,7 @@ next: }
}
- if (nlhrReply->resultCode >= 200 && (dataLen > 0 || (!isConnect && dataLen < 0)))
+ if (nlhrReply->resultCode >= 200 && (dataLen > 0 || ( !isConnect && dataLen < 0)))
{
int recvResult, chunksz = -1;
int dataBufferAlloced;
@@ -1275,10 +1275,10 @@ next: if (chunked)
{
- nlhrReply->headers[chunkhdr].szName = ( char* )mir_realloc(nlhrReply->headers[chunkhdr].szName, 16);
+ nlhrReply->headers[chunkhdr].szName = (char*)mir_realloc(nlhrReply->headers[chunkhdr].szName, 16);
lstrcpyA(nlhrReply->headers[chunkhdr].szName, "Content-Length");
- nlhrReply->headers[chunkhdr].szValue = ( char* )mir_realloc(nlhrReply->headers[chunkhdr].szValue, 16);
+ nlhrReply->headers[chunkhdr].szValue = (char*)mir_realloc(nlhrReply->headers[chunkhdr].szValue, 16);
mir_snprintf(nlhrReply->headers[chunkhdr].szValue, 16, "%u", nlhrReply->dataLength);
}
@@ -1324,7 +1324,7 @@ next: if (close &&
(nlc->proxyType != PROXYTYPE_HTTP || nlc->nloc.flags & NLOCF_SSL) &&
- (!isConnect || nlhrReply->resultCode != 200))
+ ( !isConnect || nlhrReply->resultCode != 200))
NetlibDoClose(nlc);
return nlhrReply;
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp index 6b48894d34..7e0472c155 100644 --- a/src/modules/netlib/netlibhttpproxy.cpp +++ b/src/modules/netlib/netlibhttpproxy.cpp @@ -41,7 +41,7 @@ static int HttpGatewayReadSetResult(NetlibConnection *nlc, char *buf, int num, i int rbytes = nlc->dataBufferLen - bytes;
memcpy(buf, nlc->dataBuffer, bytes);
- if (!peek)
+ if ( !peek)
{
memmove(nlc->dataBuffer, nlc->dataBuffer + bytes, rbytes);
nlc->dataBufferLen = rbytes;
@@ -127,13 +127,13 @@ static bool NetlibHttpGatewaySend(struct NetlibConnection *nlc, RequestType reqT bool sameHost = lstrcmpA(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
- if (!sameHost)
+ if ( !sameHost)
{
NetlibDoClose(nlc);
mir_free((char*)nlc->nloc.szHost);
nlc->nloc = nloc;
- if (!NetlibDoConnect(nlc))
+ if ( !NetlibDoConnect(nlc))
return false;
}
else
@@ -195,7 +195,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i nlcSend.wProxyPort = nlc->wProxyPort;
nlcSend.proxyType = nlc->proxyType;
- if (!NetlibReconnect(&nlcSend)) return false;
+ if ( !NetlibReconnect(&nlcSend)) return false;
nlc->s2 = nlcSend.s;
nlcSend.hOkToCloseEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
@@ -256,8 +256,8 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i * with the new plugins that use this code.
*/
- p = ( NetlibHTTPProxyPacketQueue* )mir_alloc(sizeof(struct NetlibHTTPProxyPacketQueue));
- p->dataBuffer = ( PBYTE )mir_alloc(len);
+ p = (NetlibHTTPProxyPacketQueue*)mir_alloc(sizeof(struct NetlibHTTPProxyPacketQueue));
+ p->dataBuffer = (PBYTE)mir_alloc(len);
memcpy(p->dataBuffer, buf, len);
p->dataBufferLen = len;
p->next = NULL;
@@ -292,19 +292,19 @@ int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int {
bool peek = (flags & MSG_PEEK) != 0;
- if (nlc->dataBufferLen != 0 && (!peek || nlc->dataBufferLen >= len))
+ if (nlc->dataBufferLen != 0 && ( !peek || nlc->dataBufferLen >= len))
{
return HttpGatewayReadSetResult(nlc, buf, len, peek);
}
- for (int retryCount = 0; retryCount < NETLIBHTTP_RETRYCOUNT; )
+ for (int retryCount = 0; retryCount < NETLIBHTTP_RETRYCOUNT;)
{
if (nlc->nlhpi.szHttpGetUrl == NULL && retryCount == 0)
{
if (nlc->pollingTimeout == 0) nlc->pollingTimeout = 30;
/* We Need to sleep/wait for the data to send before we do receive */
- for (int pollCount = nlc->pollingTimeout; pollCount--; )
+ for (int pollCount = nlc->pollingTimeout; pollCount--;)
{
if (nlc->pHttpProxyPacketQueue != NULL && GetTickCount() - nlc->lastPost > 1000)
break;
@@ -324,7 +324,7 @@ int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int int numPackets = 0;
if (nlc->nlhpi.szHttpGetUrl)
{
- if (!NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0))
+ if ( !NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0))
{
if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested)
break;
@@ -335,7 +335,7 @@ int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int }
else
{
- if (!NetlibHttpGatewayStdPost(nlc, numPackets))
+ if ( !NetlibHttpGatewayStdPost(nlc, numPackets))
{
if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested)
break;
@@ -451,7 +451,7 @@ int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nl return 0;
}
}
- if (!nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply))
+ if ( !nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply))
{
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return 0;
@@ -481,7 +481,7 @@ INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam) NETLIBHTTPPROXYINFO *nlhpi=(NETLIBHTTPPROXYINFO*)lParam;
struct NetlibConnection *nlc=(struct NetlibConnection*)wParam;
- if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == NULL ||
+ if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == NULL ||
nlhpi->cbSize < (sizeof(NETLIBHTTPPROXYINFO) - sizeof(int)) ||
nlhpi->szHttpPostUrl == NULL)
{
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 6f633a6622..5c4656fd90 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -59,10 +59,10 @@ static HANDLE hLogEvent = NULL; static const TCHAR* szTimeFormats[] =
{
- _T( "No times" ),
- _T( "Standard hh:mm:ss times" ),
- _T( "Times in milliseconds" ),
- _T( "Times in microseconds" )
+ _T("No times"),
+ _T("Standard hh:mm:ss times"),
+ _T("Times in milliseconds"),
+ _T("Times in microseconds")
};
static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -78,8 +78,8 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa CheckDlgButton(hwndDlg, IDC_TEXTDUMPS, logOptions.textDumps?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTODETECTTEXT, logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED);
{ int i;
- for ( i=0; i < SIZEOF(szTimeFormats); i++ )
- SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateTS( szTimeFormats[i] ));
+ for (i=0; i < SIZEOF(szTimeFormats); i++)
+ SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTimeFormats[i]));
}
SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_SETCURSEL, logOptions.timeFormat, 0);
CheckDlgButton(hwndDlg, IDC_SHOWNAMES, logOptions.showUser?BST_CHECKED:BST_UNCHECKED);
@@ -89,7 +89,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa SetDlgItemText(hwndDlg, IDC_PATH, logOptions.szFile);
CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart", 0)?BST_CHECKED:BST_UNCHECKED);
{ DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "Netlib", "RunAtStart", &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "Netlib", "RunAtStart", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_RUNATSTART, dbv.pszVal);
DBFreeVariant(&dbv);
}
@@ -111,12 +111,12 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa {
tvis.item.pszText=netlibUser[i]->user.ptszDescriptiveName;
tvis.item.lParam=i;
- tvis.item.state=INDEXTOSTATEIMAGEMASK((netlibUser[i]->toLog) ? 2 : 1 );
+ tvis.item.state=INDEXTOSTATEIMAGEMASK((netlibUser[i]->toLog) ? 2 : 1);
TreeView_InsertItem(hwndFilter, &tvis);
}
tvis.item.lParam=-1;
tvis.item.pszText=TranslateT("(Miranda Core Logging)");
- tvis.item.state=INDEXTOSTATEIMAGEMASK((logOptions.toLog) ? 2 : 1 );
+ tvis.item.state=INDEXTOSTATEIMAGEMASK((logOptions.toLog) ? 2 : 1);
TreeView_InsertItem(hwndFilter, &tvis);
}
return TRUE;
@@ -178,9 +178,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa ofn.nMaxFile=SIZEOF(str)-2;
ofn.nMaxFileTitle=MAX_PATH;
if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
- if (!GetSaveFileName(&ofn)) return 1;
+ if ( !GetSaveFileName(&ofn)) return 1;
} else {
- if (!GetOpenFileName(&ofn)) return 1;
+ if ( !GetOpenFileName(&ofn)) return 1;
}
if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
MoveMemory(str+1, str, SIZEOF(str)-2);
@@ -213,11 +213,11 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa EnterCriticalSection(&logOptions.cs);
mir_free(logOptions.szUserFile);
- GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH );
+ GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH);
logOptions.szUserFile = mir_tstrdup(str);
mir_free(logOptions.szFile);
- GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH );
+ GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH);
logOptions.szFile = mir_tstrdup(str);
logOptions.dumpRecv=IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV);
@@ -248,13 +248,13 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa if (tvi.lParam == -1) {
logOptions.toLog = checked;
- if ( logOptions.save )
+ if (logOptions.save)
DBWriteContactSettingDword(NULL, "Netlib", "NLlog", checked);
}
else
if (tvi.lParam < netlibUser.getCount()) {
netlibUser[tvi.lParam]->toLog = checked;
- if ( logOptions.save )
+ if (logOptions.save)
DBWriteContactSettingDword(NULL, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
}
@@ -262,7 +262,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa }
}
- if ( logOptions.save ) {
+ if (logOptions.save) {
DBWriteContactSettingByte(NULL, "Netlib", "DumpRecv", (BYTE)logOptions.dumpRecv);
DBWriteContactSettingByte(NULL, "Netlib", "DumpSent", (BYTE)logOptions.dumpSent);
DBWriteContactSettingByte(NULL, "Netlib", "DumpProxy", (BYTE)logOptions.dumpProxy);
@@ -318,7 +318,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) LARGE_INTEGER liTimeNow;
DWORD dwOriginalLastError;
- if (!bIsActive)
+ if ( !bIsActive)
return 0;
if ((nlu != NULL && GetNetlibHandleType(nlu) != NLH_USER) || pszMsg == NULL)
@@ -328,12 +328,12 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) }
if (nlu == NULL) /* if the Netlib user handle is NULL, just pretend its not */
{
- if (!logOptions.toLog)
+ if ( !logOptions.toLog)
return 1;
nlu = &nludummy;
nlu->user.szSettingsModule = "(NULL)";
}
- else if (!nlu->toLog)
+ else if ( !nlu->toLog)
return 1;
dwOriginalLastError = GetLastError();
@@ -383,7 +383,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) FILE *fp;
fp = _tfopen(logOptions.szFile, _T("ab"));
- if (!fp)
+ if ( !fp)
{
CreatePathToFileT(logOptions.szFile);
fp = _tfopen(logOptions.szFile, _T("at"));
@@ -420,10 +420,10 @@ void NetlibLogf(NetlibUser* nlu, const char *fmt, ...) {
if (nlu == NULL)
{
- if (!logOptions.toLog)
+ if ( !logOptions.toLog)
return;
}
- else if (!nlu->toLog)
+ else if ( !nlu->toLog)
return;
va_list va;
@@ -454,12 +454,12 @@ void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, return;
// Check user's log settings
- if (!(logOptions.toOutputDebugString ||
- ((THook*)hLogEvent)->subscriberCount ||
+ if ( !(logOptions.toOutputDebugString ||
+ ((THook*)hLogEvent)->subscriberCount ||
(logOptions.toFile && logOptions.szFile[0])))
return;
- if ((sent && !logOptions.dumpSent) ||
- (!sent && !logOptions.dumpRecv))
+ if ((sent && !logOptions.dumpSent) ||
+ ( !sent && !logOptions.dumpRecv))
return;
if ((flags & MSG_DUMPPROXY) && !logOptions.dumpProxy)
return;
@@ -475,15 +475,15 @@ void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, // check filter settings
if (nlu == NULL)
{
- if (!logOptions.toLog)
+ if ( !logOptions.toLog)
return;
}
- else if (!nlu->toLog)
+ else if ( !nlu->toLog)
return;
- if (!logOptions.textDumps)
+ if ( !logOptions.textDumps)
isText = 0;
- else if (!(flags&MSG_DUMPASTEXT))
+ else if ( !(flags&MSG_DUMPASTEXT))
{
if (logOptions.autoDetectText)
{
@@ -502,12 +502,12 @@ void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, }
// Text data
- if ( isText ) {
+ if (isText) {
int sz = titleLineLen + len + 1;
useStack = sz <= 8192;
szBuf = (char*)(useStack ? alloca(sz) : mir_alloc(sz));
- CopyMemory( szBuf, szTitleLine, titleLineLen );
- CopyMemory( szBuf + titleLineLen, (const char*)buf, len );
+ CopyMemory(szBuf, szTitleLine, titleLineLen);
+ CopyMemory(szBuf + titleLineLen, (const char*)buf, len);
szBuf[titleLineLen + len] = '\0';
}
// Binary data
@@ -520,14 +520,14 @@ void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, szBuf = (char*)(useStack ? alloca(sz) : mir_alloc(sz));
CopyMemory(szBuf, szTitleLine, titleLineLen);
pszBuf = szBuf + titleLineLen;
- for ( line = 0;; line += 16 ) {
+ for (line = 0;; line += 16) {
colsInLine = min(16, len - line);
if (colsInLine == 16) {
PBYTE p = buf + line;
pszBuf += wsprintfA(
pszBuf, "%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ",
- line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] );
+ line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
}
else {
pszBuf += wsprintfA(pszBuf, "%08X: ", line);
@@ -556,7 +556,7 @@ void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, }
NetlibLog((WPARAM)nlu, (LPARAM)szBuf);
- if (!useStack) mir_free(szBuf);
+ if ( !useStack) mir_free(szBuf);
}
void NetlibLogInit(void)
@@ -564,30 +564,30 @@ void NetlibLogInit(void) DBVARIANT dbv;
LARGE_INTEGER li;
- QueryPerformanceFrequency( &li );
+ QueryPerformanceFrequency(&li);
perfCounterFreq = li.QuadPart;
- QueryPerformanceCounter( &li );
+ QueryPerformanceCounter(&li);
mirandaStartTime = li.QuadPart;
- CreateServiceFunction( MS_NETLIB_LOGWIN, ShowOptions );
- CreateServiceFunction( MS_NETLIB_LOG, NetlibLog );
- CreateServiceFunction( MS_NETLIB_LOGW, NetlibLogW );
- hLogEvent = CreateHookableEvent( ME_NETLIB_FASTDUMP );
+ CreateServiceFunction(MS_NETLIB_LOGWIN, ShowOptions);
+ CreateServiceFunction(MS_NETLIB_LOG, NetlibLog);
+ CreateServiceFunction(MS_NETLIB_LOGW, NetlibLogW);
+ hLogEvent = CreateHookableEvent(ME_NETLIB_FASTDUMP);
InitializeCriticalSection(&logOptions.cs);
- logOptions.dumpRecv = DBGetContactSettingByte( NULL, "Netlib", "DumpRecv", 1 );
- logOptions.dumpSent = DBGetContactSettingByte( NULL, "Netlib", "DumpSent", 1 );
- logOptions.dumpProxy = DBGetContactSettingByte( NULL, "Netlib", "DumpProxy", 1 );
- logOptions.dumpSsl = DBGetContactSettingByte( NULL, "Netlib", "DumpSsl", 0 );
- logOptions.textDumps = DBGetContactSettingByte( NULL, "Netlib", "TextDumps", 1 );
- logOptions.autoDetectText = DBGetContactSettingByte( NULL, "Netlib", "AutoDetectText", 1 );
- logOptions.timeFormat = DBGetContactSettingByte( NULL, "Netlib", "TimeFormat", TIMEFORMAT_HHMMSS );
- logOptions.showUser = DBGetContactSettingByte( NULL, "Netlib", "ShowUser", 1 );
- logOptions.toOutputDebugString = DBGetContactSettingByte( NULL, "Netlib", "ToOutputDebugString", 0 );
- logOptions.toFile = DBGetContactSettingByte( NULL, "Netlib", "ToFile", 0 );
- logOptions.toLog = DBGetContactSettingDword( NULL, "Netlib", "NLlog", 1 );
-
- if (!DBGetContactSettingTString(NULL, "Netlib", "File", &dbv))
+ logOptions.dumpRecv = DBGetContactSettingByte(NULL, "Netlib", "DumpRecv", 1);
+ logOptions.dumpSent = DBGetContactSettingByte(NULL, "Netlib", "DumpSent", 1);
+ logOptions.dumpProxy = DBGetContactSettingByte(NULL, "Netlib", "DumpProxy", 1);
+ logOptions.dumpSsl = DBGetContactSettingByte(NULL, "Netlib", "DumpSsl", 0);
+ logOptions.textDumps = DBGetContactSettingByte(NULL, "Netlib", "TextDumps", 1);
+ logOptions.autoDetectText = DBGetContactSettingByte(NULL, "Netlib", "AutoDetectText", 1);
+ logOptions.timeFormat = DBGetContactSettingByte(NULL, "Netlib", "TimeFormat", TIMEFORMAT_HHMMSS);
+ logOptions.showUser = DBGetContactSettingByte(NULL, "Netlib", "ShowUser", 1);
+ logOptions.toOutputDebugString = DBGetContactSettingByte(NULL, "Netlib", "ToOutputDebugString", 0);
+ logOptions.toFile = DBGetContactSettingByte(NULL, "Netlib", "ToFile", 0);
+ logOptions.toLog = DBGetContactSettingDword(NULL, "Netlib", "NLlog", 1);
+
+ if ( !DBGetContactSettingTString(NULL, "Netlib", "File", &dbv))
{
logOptions.szUserFile = mir_tstrdup(dbv.ptszVal);
TCHAR *pszNewPath = Utils_ReplaceVarsT(dbv.ptszVal);
@@ -605,33 +605,33 @@ void NetlibLogInit(void) logOptions.szFile = Utils_ReplaceVarsT(logOptions.szUserFile);
}
- if ( logOptions.toFile && logOptions.szFile[0] ) {
+ if (logOptions.toFile && logOptions.szFile[0]) {
FILE *fp;
- fp = _tfopen( logOptions.szFile, _T("wt"));
- if ( fp )
+ fp = _tfopen(logOptions.szFile, _T("wt"));
+ if (fp)
fclose(fp);
}
- if ( DBGetContactSettingByte( NULL, "Netlib", "ShowLogOptsAtStart", 0 ))
+ if (DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
- if ( !DBGetContactSettingTString( NULL, "Netlib", "RunAtStart", &dbv )) {
+ if ( !DBGetContactSettingTString(NULL, "Netlib", "RunAtStart", &dbv)) {
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi;
- si.cb = sizeof( si );
- if ( dbv.ptszVal[0] )
- CreateProcess( NULL, dbv.ptszVal, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
- DBFreeVariant( &dbv );
+ si.cb = sizeof(si);
+ if (dbv.ptszVal[0])
+ CreateProcess(NULL, dbv.ptszVal, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ DBFreeVariant(&dbv);
}
}
void NetlibLogShutdown(void)
{
bIsActive = FALSE;
- DestroyHookableEvent( hLogEvent ); hLogEvent = NULL;
- if ( IsWindow( logOptions.hwndOpts ))
- DestroyWindow( logOptions.hwndOpts );
- DeleteCriticalSection( &logOptions.cs );
- mir_free( logOptions.szFile );
- mir_free( logOptions.szUserFile );
+ DestroyHookableEvent(hLogEvent); hLogEvent = NULL;
+ if (IsWindow(logOptions.hwndOpts))
+ DestroyWindow(logOptions.hwndOpts);
+ DeleteCriticalSection(&logOptions.cs);
+ mir_free(logOptions.szFile);
+ mir_free(logOptions.szUserFile);
}
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 5cc1e7635e..3bc19e684f 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -42,7 +42,7 @@ DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost) __try
{
host = gethostbyname(szHost);
- if ( host )
+ if (host)
return *(u_long*)host->h_addr_list[0];
NetlibLogf(nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "gethostbyname", szHost, WSAGetLastError());
@@ -106,14 +106,14 @@ bool RecvUntilTimeout(struct NetlibConnection *nlc, char *buf, int len, int flag len -= nReceived;
if (len <= 0) return true;
}
- SetLastError( ERROR_TIMEOUT );
+ SetLastError(ERROR_TIMEOUT);
return false;
}
static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
// http://www.socks.nec.com/protocol/socks4.protocol and http://www.socks.nec.com/protocol/socks4a.protocol
- if (!nloc->szHost || !nloc->szHost[0]) return 0;
+ if ( !nloc->szHost || !nloc->szHost[0]) return 0;
size_t nHostLen = strlen(nloc->szHost) + 1;
size_t nUserLen = nlu->settings.szProxyAuthUser ? strlen(nlu->settings.szProxyAuthUser) + 1 : 1;
@@ -130,7 +130,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE //if cannot resolve host, try resolving through proxy (requires SOCKS4a)
DWORD ip = DnsLookup(nlu, nloc->szHost);
*(PDWORD)&pInit[4] = ip ? ip : 0x01000000;
- if (!ip)
+ if ( !ip)
{
memcpy(&pInit[len], nloc->szHost, nHostLen);
len += nHostLen;
@@ -143,7 +143,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE }
char reply[8];
- if (!RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT))
+ if ( !RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT))
{
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
@@ -174,7 +174,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli }
//confirmation of auth method
- if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if ( !RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -203,7 +203,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli }
mir_free(pAuthBuf);
- if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if ( !RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -255,14 +255,14 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli mir_free(pInit);
}
- if (!RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if ( !RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
- if ( buf[0] != 5 || buf[1] ) {
+ if (buf[0] != 5 || buf[1]) {
const char* err = "Unknown response";
- if ( buf[0] != 5 )
+ if (buf[0] != 5)
SetLastError(ERROR_BAD_FORMAT);
else
{
@@ -284,7 +284,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli }
{
int nRecvSize = 0;
- switch( buf[3] ) {
+ switch(buf[3]) {
case 1:// ipv4 addr
nRecvSize = 5;
break;
@@ -298,7 +298,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli NetlibLogf(nlu, "%s %d: %s() unknown address type (%u)", __FILE__, __LINE__, "NetlibInitSocks5Connection", (int)buf[3]);
return 0;
}
- if (!RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if ( !RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -404,7 +404,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) if (nlc->proxyType)
{
- if (!nlc->szProxyServer) return false;
+ if ( !nlc->szProxyServer) return false;
if (nloc)
NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
@@ -416,7 +416,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) }
else
{
- if (!nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false;
+ if ( !nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false;
NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
sin.sin_port = htons(nloc->wPort);
@@ -440,7 +440,7 @@ retry: if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0])
{
- if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum))
+ if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum))
NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
}
@@ -573,7 +573,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) if (nlc->proxyType)
{
- if (!nlc->szProxyServer) return false;
+ if ( !nlc->szProxyServer) return false;
if (nloc)
NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
@@ -589,7 +589,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) }
else
{
- if (!nloc || !nloc->szHost) return false;
+ if ( !nloc || !nloc->szHost) return false;
NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
_itoa(nlc->nloc.wPort, szPort, 10);
@@ -617,7 +617,7 @@ retry: {
SOCKET s = ai->ai_family == AF_INET ? nlc->s : INVALID_SOCKET;
SOCKET s6 = ai->ai_family == AF_INET6 ? nlc->s : INVALID_SOCKET;
- if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum))
+ if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum))
NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
}
@@ -726,7 +726,7 @@ static int NetlibHttpFallbackToDirect(struct NetlibConnection *nlc, struct Netli nlc->proxyAuthNeeded = false;
nlc->proxyType = 0;
mir_free(nlc->szProxyServer); nlc->szProxyServer = NULL;
- if (!my_connect(nlc, nloc))
+ if ( !my_connect(nlc, nloc))
{
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError());
return false;
@@ -763,13 +763,13 @@ bool NetlibDoConnect(NetlibConnection *nlc) retry:
if (usingProxy)
{
- if (!my_connect(nlc, nloc))
+ if ( !my_connect(nlc, nloc))
{
usingProxy = false;
nlc->proxyType = 0;
}
}
- if (!usingProxy)
+ if ( !usingProxy)
{
my_connect(nlc, nloc);
}
@@ -779,7 +779,7 @@ retry: if (usingProxy && (nlc->proxyType == PROXYTYPE_HTTPS || nlc->proxyType == PROXYTYPE_HTTP))
{
usingProxy = false;
- if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc))
+ if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc))
{
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError());
return false;
@@ -801,44 +801,44 @@ retry: if (usingProxy && !((nloc->flags & (NLOCF_HTTP | NLOCF_SSL)) == NLOCF_HTTP &&
(nlc->proxyType == PROXYTYPE_HTTP || nlc->proxyType == PROXYTYPE_HTTPS)))
{
- if (!WaitUntilWritable(nlc->s, 30000)) return false;
+ if ( !WaitUntilWritable(nlc->s, 30000)) return false;
switch (nlc->proxyType)
{
case PROXYTYPE_SOCKS4:
- if (!NetlibInitSocks4Connection(nlc, nlu, nloc)) return false;
+ if ( !NetlibInitSocks4Connection(nlc, nlu, nloc)) return false;
break;
case PROXYTYPE_SOCKS5:
- if (!NetlibInitSocks5Connection(nlc, nlu, nloc)) return false;
+ if ( !NetlibInitSocks5Connection(nlc, nlu, nloc)) return false;
break;
case PROXYTYPE_HTTPS:
nlc->proxyAuthNeeded = true;
- if (!NetlibInitHttpsConnection(nlc, nlu, nloc))
+ if ( !NetlibInitHttpsConnection(nlc, nlu, nloc))
{
usingProxy = false;
- if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc))
+ if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc))
return false;
}
break;
case PROXYTYPE_HTTP:
nlc->proxyAuthNeeded = true;
- if (!(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL)
+ if ( !(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL)
{
//NLOCF_HTTP not specified and no HTTP gateway available: try HTTPS
- if (!NetlibInitHttpsConnection(nlc, nlu, nloc))
+ if ( !NetlibInitHttpsConnection(nlc, nlu, nloc))
{
//can't do HTTPS: try direct
usingProxy = false;
- if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc))
+ if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc))
return false;
}
}
else
{
- if (!NetlibInitHttpConnection(nlc, nlu, nloc)) return false;
+ if ( !NetlibInitHttpConnection(nlc, nlu, nloc)) return false;
}
break;
@@ -850,7 +850,7 @@ retry: }
else if (nloc->flags & NLOCF_HTTPGATEWAY)
{
- if (!NetlibInitHttpConnection(nlc, nlu, nloc)) return false;
+ if ( !NetlibInitHttpConnection(nlc, nlu, nloc)) return false;
nlc->usingDirectHttpGateway = true;
}
@@ -886,11 +886,11 @@ bool NetlibReconnect(NetlibConnection *nlc) break;
}
- if (!opened)
+ if ( !opened)
NetlibDoClose(nlc, true);
}
- if (!opened)
+ if ( !opened)
{
if (Miranda_Terminated()) return false;
if (nlc->usingHttpGateway)
@@ -912,7 +912,7 @@ INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam) NetlibLogf(nlu, "Connection request to %s:%d (Flags %x)....", nloc->szHost, nloc->wPort, nloc->flags);
- if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) || nloc == NULL ||
+ if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) || nloc == NULL ||
(nloc->cbSize != NETLIBOPENCONNECTION_V1_SIZE && nloc->cbSize != sizeof(NETLIBOPENCONNECTION)) ||
nloc->szHost == NULL || nloc->wPort == 0)
{
@@ -934,7 +934,7 @@ INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam) NetlibInitializeNestedCS(&nlc->ncsSend);
NetlibInitializeNestedCS(&nlc->ncsRecv);
- if (!NetlibDoConnect(nlc))
+ if ( !NetlibDoConnect(nlc))
{
FreePartiallyInitedConnection(nlc);
return 0;
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 7649ab4ab1..2ce5282f2b 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -167,7 +167,7 @@ static void ChangeSettingIntByCheckbox(HWND hwndDlg, UINT ctrlId, int iUser, int if (iUser == -1)
{
for (i=0; i<tempSettings.getCount(); i++)
- if (!(tempSettings[i]->flags & NUF_NOOPTIONS))
+ if ( !(tempSettings[i]->flags & NUF_NOOPTIONS))
*(int*)(((PBYTE)&tempSettings[i]->settings) + memberOffset) = newValue;
}
else *(int*)(((PBYTE)&tempSettings[iUser]->settings) + memberOffset)=newValue;
@@ -185,7 +185,7 @@ static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int if (iUser == -1)
{
for (i=0; i<tempSettings.getCount(); ++i)
- if (!(tempSettings[i]->flags & NUF_NOOPTIONS))
+ if ( !(tempSettings[i]->flags & NUF_NOOPTIONS))
{
ppszNew=(char**)(((PBYTE)&tempSettings[i]->settings)+memberOffset);
if (*ppszNew) mir_free(*ppszNew);
@@ -323,7 +323,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS4, settings.proxyType);
AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS5, settings.proxyType);
if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType);
- if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType);
+ if ( !(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType);
if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY) || !(flags & NUF_NOHTTPSOPTION))
AddProxyTypeItem(hwndDlg, PROXYTYPE_IE, settings.proxyType);
SetDlgItemTextA(hwndDlg, IDC_PROXYHOST, settings.szProxyServer?settings.szProxyServer:"");
@@ -364,7 +364,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int i;
for (i = 0; i < tempSettings.getCount(); ++i)
{
- if (!tempSettings[i]->settings.useProxy ||
+ if ( !tempSettings[i]->settings.useProxy ||
tempSettings[i]->flags & NUF_NOOPTIONS || !(tempSettings[i]->flags & NUF_OUTGOING))
continue;
@@ -472,7 +472,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (iUser == -1)
{
for (i = 0; i < tempSettings.getCount(); ++i)
- if (!(tempSettings[i]->flags & NUF_NOOPTIONS))
+ if ( !(tempSettings[i]->flags & NUF_NOOPTIONS))
tempSettings[i]->settings.wProxyPort = newValue;
}
else tempSettings[iUser]->settings.wProxyPort = newValue;
@@ -536,7 +536,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) int optionsCount = 0;
EnterCriticalSection(&csNetlibUser);
for (int i = 0; i < netlibUser.getCount(); ++i)
- if (!(netlibUser[i]->user.flags & NUF_NOOPTIONS)) ++optionsCount;
+ if ( !(netlibUser[i]->user.flags & NUF_NOOPTIONS)) ++optionsCount;
LeaveCriticalSection(&csNetlibUser);
if (optionsCount == 0) return 0;
@@ -550,7 +550,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgProcNetlibOpts;
odp.flags = ODPF_BOLDGROUPS;
odp.expertOnlyControls = expertOnlyControls;
- odp.nExpertOnlyControls = SIZEOF( expertOnlyControls );
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ odp.nExpertOnlyControls = SIZEOF(expertOnlyControls);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp index 56f9b8ffae..d2b40559b3 100644 --- a/src/modules/netlib/netlibpktrecver.cpp +++ b/src/modules/netlib/netlibpktrecver.cpp @@ -73,7 +73,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam) nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed;
}
if (nlprParam->dwTimeout != INFINITE) {
- if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) {
+ if ( !si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) {
*nlprParam=nlpr->packetRecver;
return SOCKET_ERROR;
}
diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 46756ff3cc..9ff92944e3 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -123,7 +123,7 @@ HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrinci WaitForSingleObject(hSecMutex, INFINITE);
- if (secCnt == 0 )
+ if (secCnt == 0)
{
LoadSecurityLibrary();
secCnt += g_hSecurity != NULL;
@@ -188,7 +188,7 @@ void NetlibDestroySecurityProvider(HANDLE hSecurity) char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chlsz)
{
- if (!szChallenge || !szChallenge[0]) return NULL;
+ if ( !szChallenge || !szChallenge[0]) return NULL;
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
unsigned char inDataBuffer[1024];
@@ -257,7 +257,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls nlb64.pbDecoded = response;
nlb64.cchEncoded = Netlib_GetBase64EncodedBufferSize(nlb64.cbDecoded);
nlb64.pszEncoded = (char*)alloca(nlb64.cchEncoded);
- if (!NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
+ if ( !NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
return mir_strdup(nlb64.pszEncoded);
}
@@ -287,7 +287,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, nlb64.pszEncoded = (char*)szChallenge;
nlb64.cbDecoded = Netlib_GetBase64DecodedBufferSize(nlb64.cchEncoded);
nlb64.pbDecoded = (PBYTE)alloca(nlb64.cbDecoded);
- if (!NetlibBase64Decode(0, (LPARAM)&nlb64)) return NULL;
+ if ( !NetlibBase64Decode(0, (LPARAM)&nlb64)) return NULL;
if (isGSSAPI && complete)
return CompleteGssapi(hSecurity, nlb64.pbDecoded, nlb64.cbDecoded);
@@ -302,8 +302,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, // try to decode the domain name from the NTLM challenge
if (login != NULL && login[0] != '\0' && !hNtlm->hasDomain)
{
- NtlmType2packet* pkt = ( NtlmType2packet* )nlb64.pbDecoded;
- if (!strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2)
+ NtlmType2packet* pkt = (NtlmType2packet*)nlb64.pbDecoded;
+ if ( !strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2)
{
wchar_t* domainName = (wchar_t*)&nlb64.pbDecoded[pkt->targetName.offset];
@@ -421,7 +421,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, }
else
{
- if (!login || !psw) return NULL;
+ if ( !login || !psw) return NULL;
char *szLogin = mir_t2a(login);
char *szPassw = mir_t2a(psw);
@@ -439,7 +439,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, nlb64.cchEncoded = Netlib_GetBase64EncodedBufferSize(nlb64.cbDecoded);
nlb64.pszEncoded = (char*)alloca(nlb64.cchEncoded);
- if (!NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
+ if ( !NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
char* result;
if (http)
@@ -466,7 +466,7 @@ static INT_PTR InitSecurityProviderService(WPARAM, LPARAM lParam) static INT_PTR InitSecurityProviderService2(WPARAM, LPARAM lParam)
{
- NETLIBNTLMINIT2 *req = ( NETLIBNTLMINIT2* )lParam;
+ NETLIBNTLMINIT2 *req = (NETLIBNTLMINIT2*)lParam;
if (req->cbSize < sizeof(*req)) return 0;
HANDLE hSecurity;
@@ -481,26 +481,26 @@ static INT_PTR InitSecurityProviderService2(WPARAM, LPARAM lParam) return (INT_PTR)hSecurity;
}
-static INT_PTR DestroySecurityProviderService( WPARAM, LPARAM lParam )
+static INT_PTR DestroySecurityProviderService(WPARAM, LPARAM lParam)
{
- NetlibDestroySecurityProvider(( HANDLE )lParam );
+ NetlibDestroySecurityProvider((HANDLE)lParam);
return 0;
}
-static INT_PTR NtlmCreateResponseService( WPARAM wParam, LPARAM lParam )
+static INT_PTR NtlmCreateResponseService(WPARAM wParam, LPARAM lParam)
{
- NETLIBNTLMREQUEST* req = ( NETLIBNTLMREQUEST* )lParam;
+ NETLIBNTLMREQUEST* req = (NETLIBNTLMREQUEST*)lParam;
unsigned complete;
- char* response = NtlmCreateResponseFromChallenge(( HANDLE )wParam, req->szChallenge,
- StrConvT(req->userName), StrConvT(req->password), false, complete );
+ char* response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
+ StrConvT(req->userName), StrConvT(req->password), false, complete);
return (INT_PTR)response;
}
-static INT_PTR NtlmCreateResponseService2( WPARAM wParam, LPARAM lParam )
+static INT_PTR NtlmCreateResponseService2(WPARAM wParam, LPARAM lParam)
{
- NETLIBNTLMREQUEST2* req = ( NETLIBNTLMREQUEST2* )lParam;
+ NETLIBNTLMREQUEST2* req = (NETLIBNTLMREQUEST2*)lParam;
if (req->cbSize < sizeof(*req)) return 0;
char* response;
@@ -508,15 +508,15 @@ static INT_PTR NtlmCreateResponseService2( WPARAM wParam, LPARAM lParam ) if (req->flags & NNR_UNICODE)
{
- response = NtlmCreateResponseFromChallenge(( HANDLE )wParam, req->szChallenge,
- req->szUserName, req->szPassword, false, req->complete );
+ response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
+ req->szUserName, req->szPassword, false, req->complete);
}
else
{
TCHAR *szLogin = mir_a2t((char*)req->szUserName);
TCHAR *szPassw = mir_a2t((char*)req->szPassword);
- response = NtlmCreateResponseFromChallenge(( HANDLE )wParam, req->szChallenge,
- szLogin, szPassw, false, req->complete );
+ response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
+ szLogin, szPassw, false, req->complete);
mir_free(szLogin);
mir_free(szPassw);
}
@@ -529,11 +529,11 @@ void NetlibSecurityInit(void) {
hSecMutex = CreateMutex(NULL, FALSE, NULL);
- CreateServiceFunction( MS_NETLIB_INITSECURITYPROVIDER, InitSecurityProviderService );
- CreateServiceFunction( MS_NETLIB_INITSECURITYPROVIDER2, InitSecurityProviderService2 );
- CreateServiceFunction( MS_NETLIB_DESTROYSECURITYPROVIDER, DestroySecurityProviderService );
- CreateServiceFunction( MS_NETLIB_NTLMCREATERESPONSE, NtlmCreateResponseService );
- CreateServiceFunction( MS_NETLIB_NTLMCREATERESPONSE2, NtlmCreateResponseService2 );
+ CreateServiceFunction(MS_NETLIB_INITSECURITYPROVIDER, InitSecurityProviderService);
+ CreateServiceFunction(MS_NETLIB_INITSECURITYPROVIDER2, InitSecurityProviderService2);
+ CreateServiceFunction(MS_NETLIB_DESTROYSECURITYPROVIDER, DestroySecurityProviderService);
+ CreateServiceFunction(MS_NETLIB_NTLMCREATERESPONSE, NtlmCreateResponseService);
+ CreateServiceFunction(MS_NETLIB_NTLMCREATERESPONSE2, NtlmCreateResponseService2);
}
void NetlibSecurityDestroy(void)
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index a4894a52ff..eabbc79484 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -37,12 +37,12 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR;
}
- if (!NetlibEnterNestedCS(nlc, NLNCS_SEND))
+ if ( !NetlibEnterNestedCS(nlc, NLNCS_SEND))
return SOCKET_ERROR;
if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW))
{
- if (!(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend)
+ if ( !(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend)
{
NetlibDumpData(nlc, (PBYTE)nlb->buf, nlb->len, 1, nlb->flags);
result = nlc->nlu->user.pfnHttpGatewayWrapSend((HANDLE)nlc, (PBYTE)nlb->buf, nlb->len, nlb->flags | MSG_NOHTTPGATEWAYWRAP, NetlibSend);
@@ -77,7 +77,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR;
}
- if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
+ if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV))
return SOCKET_ERROR;
if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW))
@@ -140,9 +140,9 @@ INT_PTR NetlibSelect(WPARAM, LPARAM lParam) int pending = 0;
fd_set readfd, writefd, exceptfd;
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
- if (!ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
- || !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending)
- || !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending))
+ if ( !ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
+ || !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending)
+ || !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending))
{
ReleaseMutex(hConnectionHeaderMutex);
return SOCKET_ERROR;
@@ -170,9 +170,9 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) int pending = 0;
fd_set readfd, writefd, exceptfd;
- if (!ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
- || !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending)
- || !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending))
+ if ( !ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
+ || !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending)
+ || !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending))
{
ReleaseMutex(hConnectionHeaderMutex);
return SOCKET_ERROR;
@@ -217,7 +217,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr)
{
- if (!str) return false;
+ if ( !str) return false;
if (MyWSAStringToAddress)
{
@@ -227,7 +227,7 @@ bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr) else
{
unsigned iaddr = inet_addr(str);
- if (!iaddr) return false;
+ if ( !iaddr) return false;
addr->Ipv4.sin_addr.s_addr = iaddr;
addr->Ipv4.sin_family = AF_INET;
@@ -242,7 +242,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) if (MyWSAAddressToString)
{
DWORD len = sizeof(saddr);
- if (!MyWSAAddressToString((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
+ if ( !MyWSAAddressToString((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
return mir_strdup(saddr);
}
else if (addr->si_family == AF_INET)
@@ -261,12 +261,12 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo)
{
- if (!nlc || !connInfo || connInfo->cbSize < sizeof(NETLIBCONNINFO)) return;
+ if ( !nlc || !connInfo || connInfo->cbSize < sizeof(NETLIBCONNINFO)) return;
SOCKADDR_INET_M sin = {0};
int len = sizeof(sin);
- if (!getsockname(nlc->s, (PSOCKADDR)&sin, &len))
+ if ( !getsockname(nlc->s, (PSOCKADDR)&sin, &len))
{
connInfo->wPort = ntohs(sin.Ipv4.sin_port);
connInfo->dwIpv4 = sin.si_family == AF_INET ? htonl(sin.Ipv4.sin_addr.s_addr) : 0;
@@ -299,9 +299,9 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) for (ai = air; ai; ai = ai->ai_next)
{
SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
- if (ai->ai_family == AF_INET ||
+ if (ai->ai_family == AF_INET ||
(ai->ai_family == AF_INET6 &&
- (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
+ ( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
++n;
}
@@ -312,9 +312,9 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) for (ai = air; ai; ai = ai->ai_next)
{
SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
- if (ai->ai_family == AF_INET ||
+ if (ai->ai_family == AF_INET ||
(ai->ai_family == AF_INET6 &&
- (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
+ ( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
{
char* szIp = NetlibAddressToString(iaddr);
diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp index 76c663d5ba..77c6bec8c9 100644 --- a/src/modules/netlib/netlibssl.cpp +++ b/src/modules/netlib/netlibssl.cpp @@ -146,7 +146,7 @@ static bool SSL_library_init(void) WaitForSingleObject(g_hSslMutex, INFINITE);
- if (!bSslInitDone)
+ if ( !bSslInitDone)
{
g_hSchannel = LoadLibraryA("schannel.dll");
if (g_hSchannel)
@@ -197,12 +197,12 @@ void NetlibSslFree(SslHandle *ssl) BOOL NetlibSslPending(SslHandle *ssl)
{
- return ssl != NULL && ( ssl->cbRecDataBuf != 0 || ssl->cbIoBuffer != 0 );
+ return ssl != NULL && (ssl->cbRecDataBuf != 0 || ssl->cbIoBuffer != 0);
}
static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertFlags)
{
- if (!fnCertGetCertificateChain)
+ if ( !fnCertGetCertificateChain)
return true;
static LPSTR rgszUsages[] =
@@ -238,7 +238,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF ChainPara.RequestedUsage.Usage.cUsageIdentifier = SIZEOF(rgszUsages);
ChainPara.RequestedUsage.Usage.rgpszUsageIdentifier = rgszUsages;
- if (!fnCertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore,
+ if ( !fnCertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore,
&ChainPara, 0, NULL, &pChainContext))
{
scRet = GetLastError();
@@ -255,7 +255,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF PolicyStatus.cbSize = sizeof(PolicyStatus);
- if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext,
+ if ( !fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext,
&PolicyPara, &PolicyStatus))
{
scRet = GetLastError();
@@ -401,8 +401,8 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead) // If success (or if the error was one of the special extended ones),
// send the contents of the output buffer to the server.
- if (scRet == SEC_E_OK ||
- scRet == SEC_I_CONTINUE_NEEDED ||
+ if (scRet == SEC_E_OK ||
+ scRet == SEC_I_CONTINUE_NEEDED ||
(FAILED(scRet) && (dwSSPIOutFlags & ISC_RET_EXTENDED_ERROR)))
{
if (OutBuffers[0].cbBuffer != 0 && OutBuffers[0].pvBuffer != NULL)
@@ -567,7 +567,7 @@ SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) DWORD dwFlags = 0;
- if (!host || inet_addr(host) != INADDR_NONE)
+ if ( !host || inet_addr(host) != INADDR_NONE)
dwFlags |= 0x00001000;
bool res = SSL_library_init();
@@ -575,7 +575,7 @@ SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) if (res) res = ClientConnect(ssl, host);
if (res && verify) res = VerifyCertificate(ssl, host, dwFlags);
- if (!res)
+ if ( !res)
{
NetlibSslFree(ssl);
ssl = NULL;
@@ -666,7 +666,7 @@ static int NetlibSslReadSetResult(SslHandle *ssl, char *buf, int num, int peek) int rbytes = ssl->cbRecDataBuf - bytes;
memcpy(buf, ssl->pbRecDataBuf, bytes);
- if (!peek)
+ if ( !peek)
{
memmove(ssl->pbRecDataBuf, ssl->pbRecDataBuf + bytes, rbytes);
ssl->cbRecDataBuf = rbytes;
@@ -691,7 +691,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek) if (num <= 0) return 0;
- if (ssl->state != sockOpen || (ssl->cbRecDataBuf != 0 && (!peek || ssl->cbRecDataBuf >= num)))
+ if (ssl->state != sockOpen || (ssl->cbRecDataBuf != 0 && ( !peek || ssl->cbRecDataBuf >= num)))
{
return NetlibSslReadSetResult(ssl, buf, num, peek);
}
@@ -783,7 +783,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek) if (scRet == SEC_E_INCOMPLETE_MESSAGE)
continue;
- if ( scRet != SEC_E_OK && scRet != SEC_I_RENEGOTIATE && scRet != SEC_I_CONTEXT_EXPIRED)
+ if (scRet != SEC_E_OK && scRet != SEC_I_RENEGOTIATE && scRet != SEC_I_CONTEXT_EXPIRED)
{
ReportSslError(scRet, __LINE__);
ssl->state = sockError;
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 12e0345c27..45009fa341 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -235,7 +235,7 @@ static void validateSocket(void) break;
}
- if (!opened)
+ if ( !opened)
closeRouterConnection();
}
@@ -248,7 +248,7 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction bool needClose;
const char* szPostHdr = soap_post_hdr;
- char* szData = ( char* )mir_alloc(4096);
+ char* szData = (char*)mir_alloc(4096);
char* szReq = NULL;
parseURL(szUrl, szHost, &sPort, szPath);
@@ -349,7 +349,7 @@ retrycon: NetlibLogf(NULL, "UPnP connect timeout");
break;
}
- else if (!FD_ISSET(sock, &wfd))
+ else if ( !FD_ISSET(sock, &wfd))
{
closeRouterConnection();
NetlibLogf(NULL, "UPnP connect failed");
@@ -439,7 +439,7 @@ retrycon: if (hdrend != NULL)
{
// Get packet size if provided
- if (txtParseParam(szResult, NULL, "Content-Length:", "\n", szRes, sizeof(szRes)) ||
+ if (txtParseParam(szResult, NULL, "Content-Length:", "\n", szRes, sizeof(szRes)) ||
txtParseParam(szResult, NULL, "CONTENT-LENGTH:", "\n", szRes, sizeof(szRes)))
{
// Add size of HTTP header to the packet size to compute full transmission size
@@ -554,7 +554,7 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) txtParseParam(szData, szTemp, "<controlURL>", "</controlURL>", szUrl, sizeUrl);
// URL combining per RFC 2396
- if ( szUrl[0] != 0 )
+ if (szUrl[0] != 0)
{
if (strstr(szUrl, "://") != NULL) // absolute URI
rpth = szCtlUrl;
@@ -624,7 +624,7 @@ static void discoverUPnP(void) {
while (he->h_addr_list[nip]) ++nip;
- ips = ( unsigned* )mir_alloc(nip * sizeof(unsigned));
+ ips = (unsigned*)mir_alloc(nip * sizeof(unsigned));
for (j = 0; j < nip; ++j)
ips[j] = *(unsigned*)he->h_addr_list[j];
@@ -661,7 +661,7 @@ static void discoverUPnP(void) buf[buflen] = 0;
LongLog(buf);
- if (txtParseParam(buf, NULL, "LOCATION:", "\n", szUrl, sizeof(szUrl)) ||
+ if (txtParseParam(buf, NULL, "LOCATION:", "\n", szUrl, sizeof(szUrl)) ||
txtParseParam(buf, NULL, "Location:", "\n", szUrl, sizeof(szUrl)))
{
char age[30];
@@ -811,7 +811,7 @@ void NetlibUPnPCleanup(void*) }
}
LeaveCriticalSection(&csNetlibUser);
- if (!incoming) return;
+ if ( !incoming) return;
}
if (findUPnPGateway())
@@ -840,10 +840,10 @@ void NetlibUPnPCleanup(void*) if (httpTransact(szCtlUrl, szData, 4096, "GetGenericPortMappingEntry", ControlAction) != 200)
break;
- if (!txtParseParam(szData, "<NewPortMappingDescription", ">", "<", buf, sizeof(buf)) || strcmp(buf, "Miranda") != 0)
+ if ( !txtParseParam(szData, "<NewPortMappingDescription", ">", "<", buf, sizeof(buf)) || strcmp(buf, "Miranda") != 0)
continue;
- if (!txtParseParam(szData, "<NewInternalClient", ">", "<", buf, sizeof(buf)) || strcmp(buf, lip) != 0)
+ if ( !txtParseParam(szData, "<NewInternalClient", ">", "<", buf, sizeof(buf)) || strcmp(buf, lip) != 0)
continue;
if (txtParseParam(szData, "<NewExternalPort", ">", "<", buf, sizeof(buf)))
diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp index 08538fc41c..d4ceed2d44 100644 --- a/src/modules/options/descbutton.cpp +++ b/src/modules/options/descbutton.cpp @@ -107,7 +107,7 @@ static void MDescButton_SetupColors(MDescButtonCtrl *dat) dat->clSelBorder = RGB(dat->rgbSelTop.rgbRed, dat->rgbSelTop.rgbGreen, dat->rgbSelTop.rgbBlue);
dat->clHotBorder = RGB(dat->rgbHotTop.rgbRed, dat->rgbHotTop.rgbGreen, dat->rgbHotTop.rgbBlue);
- if (!dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
+ if ( !dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
}
static void MDescButton_FillRect(HDC hdc, int x, int y, int width, int height, COLORREF cl)
@@ -128,7 +128,7 @@ static void MDescButton_DrawGradient(HDC hdc, int x, int y, int width, int heigh COLORREF oldColor = SetBkColor(hdc, 0);
RECT rc; SetRect(&rc, x, 0, x+width, 0);
- for (int i=y+height; --i >= y; ) {
+ for (int i=y+height; --i >= y;) {
COLORREF color = RGB(
((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height,
@@ -251,7 +251,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
case WM_MOUSEMOVE:
- if (!dat->bMouseInside) {
+ if ( !dat->bMouseInside) {
TRACKMOUSEEVENT tme = {0};
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
diff --git a/src/modules/options/filter.cpp b/src/modules/options/filter.cpp index 3e003d720e..b68efeda9c 100644 --- a/src/modules/options/filter.cpp +++ b/src/modules/options/filter.cpp @@ -26,73 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE hOptionsInitialize;
-int HookFilterEvents()
-{
- hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
- return 0;
-}
-
-int UnhookFilterEvents()
-{
- UnhookEvent(hOptionsInitialize);
- return 0;
-}
-
-INT_PTR CALLBACK DlgProcOptSearch(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hWnd);
-
- CheckDlgButton(hWnd, IDC_ENABLE_KEYWORDFILTERING, DBGetContactSettingWord(NULL, "Options", "EnableKeywordFiltering", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ENABLE_KEYWORDFILTERING:
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_SETFOCUS:
- SetFocus(GetDlgItem(hWnd, IDC_ENABLE_KEYWORDFILTERING));
- break;
-
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- DBWriteContactSettingWord(NULL, "Options", "EnableKeywordFiltering", IsDlgButtonChecked(hWnd, IDC_ENABLE_KEYWORDFILTERING));
- break;
- }
- break;
- }
- break;
- }
-
- return 0;
-}
-
-int OnOptionsInitialise(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {0};
-
- odp.cbSize = sizeof(odp);
- odp.position = -190000000;
- odp.hInstance = hMirandaInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KEYWORDFILTER);
- odp.ptszTitle = TranslateT("Options search");
- odp.ptszGroup = TranslateT("Customize");
- odp.groupPosition = 810000000;
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.pfnDlgProc = DlgProcOptSearch;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
-
- return 0;
-}
-
CPageList filterStrings(1);
void AddFilterString(const PageHash key, TCHAR *data)
@@ -100,11 +33,11 @@ void AddFilterString(const PageHash key, TCHAR *data) if (ContainsFilterString(key, data)) return;
CPageKeywords * values = filterStrings[key];
- if ( values == NULL ) {
- values = new CPageKeywords( key );
- filterStrings.insert( values );
+ if (values == NULL) {
+ values = new CPageKeywords(key);
+ filterStrings.insert(values);
}
- values->AddKeyWord( data );
+ values->AddKeyWord(data);
}
void ClearFilterStrings()
@@ -115,7 +48,7 @@ void ClearFilterStrings() BOOL ContainsFilterString(const PageHash key, TCHAR *data)
{
CPageKeywords* values = filterStrings[key];
- return (values) ? values->ContainsString( data ) : FALSE;
+ return (values) ? values->ContainsString(data) : FALSE;
}
void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
@@ -146,7 +79,7 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root) void AddDialogString(HWND hWndDlg, const PageHash key)
{
TCHAR title[2048];
- GetWindowText(hWndDlg, title, SIZEOF( title ));
+ GetWindowText(hWndDlg, title, SIZEOF(title));
if (_tcslen(title) > 0)
AddFilterString(key, title);
@@ -201,13 +134,13 @@ static BOOL CALLBACK GetDialogStringsCallback(HWND hWnd, LPARAM lParam) return TRUE;
}
-void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *pluginName, HWND hWnd, TCHAR * group, TCHAR * title, TCHAR * tab, TCHAR * name )
+void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *pluginName, HWND hWnd, TCHAR * group, TCHAR * title, TCHAR * tab, TCHAR * name)
{
AddFilterString(key, pluginName); //add the plugin name as keyword
- if ( group ) AddFilterString(key, group);
- if ( title ) AddFilterString(key, title);
- if ( tab ) AddFilterString(key, tab);
- if ( name ) AddFilterString(key, name);
+ if (group) AddFilterString(key, group);
+ if (title) AddFilterString(key, title);
+ if (tab) AddFilterString(key, tab);
+ if (name) AddFilterString(key, name);
if ((enableKeywordFiltering) && (hWnd != 0)) {
AddDialogString(hWnd, key);
@@ -215,3 +148,70 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *plu EnumChildWindows(hWnd, GetDialogStringsCallback, (LPARAM) key);
}
}
+
+static INT_PTR CALLBACK DlgProcOptSearch(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWnd);
+
+ CheckDlgButton(hWnd, IDC_ENABLE_KEYWORDFILTERING, DBGetContactSettingWord(NULL, "Options", "EnableKeywordFiltering", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ENABLE_KEYWORDFILTERING:
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_SETFOCUS:
+ SetFocus(GetDlgItem(hWnd, IDC_ENABLE_KEYWORDFILTERING));
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ DBWriteContactSettingWord(NULL, "Options", "EnableKeywordFiltering", IsDlgButtonChecked(hWnd, IDC_ENABLE_KEYWORDFILTERING));
+ break;
+ }
+ break;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+static int OnOptionsInitialise(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {0};
+
+ odp.cbSize = sizeof(odp);
+ odp.position = -190000000;
+ odp.hInstance = hMirandaInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KEYWORDFILTER);
+ odp.ptszTitle = TranslateT("Options search");
+ odp.ptszGroup = TranslateT("Customize");
+ odp.groupPosition = 810000000;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ odp.pfnDlgProc = DlgProcOptSearch;
+ Options_AddPage(wParam, &odp);
+
+ return 0;
+}
+
+int HookFilterEvents()
+{
+ hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
+ return 0;
+}
+
+int UnhookFilterEvents()
+{
+ UnhookEvent(hOptionsInitialize);
+ return 0;
+}
diff --git a/src/modules/options/filter.h b/src/modules/options/filter.h index 68d9c4100a..d64801eee5 100644 --- a/src/modules/options/filter.h +++ b/src/modules/options/filter.h @@ -28,18 +28,17 @@ extern HANDLE hOptionsInitialize; int HookFilterEvents();
int UnhookFilterEvents();
-int OnOptionsInitialise(WPARAM wParam, LPARAM lParam);
typedef DWORD PageHash;
void AddFilterString(const PageHash key, const TCHAR *data);
BOOL ContainsFilterString(const PageHash key, TCHAR *data);
void ClearFilterStrings();
-void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *pluginName, HWND hWnd, TCHAR * group, TCHAR * title, TCHAR * tab, TCHAR * name );
+void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *pluginName, HWND hWnd, TCHAR * group, TCHAR * title, TCHAR * tab, TCHAR * name);
-_inline TCHAR * _tcslwr_locale( TCHAR * buf )
+_inline TCHAR * _tcslwr_locale(TCHAR * buf)
{
- LCMapString( LangPackGetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)_tcslen( buf ), buf, (int)_tcslen( buf ) );
+ LCMapString(LangPackGetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)_tcslen(buf), buf, (int)_tcslen(buf));
return buf;
}
@@ -48,37 +47,37 @@ class CPageKeywords {
PageHash _pageHashKey;
KeywordList _pageKeyWords;
- static int _KeyWordsSortFunc( const TCHAR* p1, const TCHAR* p2 ) { return _tcscmp( p1, p2 ); };
+ static int _KeyWordsSortFunc(const TCHAR* p1, const TCHAR* p2) { return _tcscmp(p1, p2); };
public:
- CPageKeywords( PageHash pageHashKey ) : _pageHashKey( pageHashKey ), _pageKeyWords( 1, _KeyWordsSortFunc ) {};
+ CPageKeywords(PageHash pageHashKey) : _pageHashKey(pageHashKey), _pageKeyWords(1, _KeyWordsSortFunc) {};
~CPageKeywords()
{
- for ( int j = 0; j < _pageKeyWords.getCount(); j++ )
+ for (int j = 0; j < _pageKeyWords.getCount(); j++)
{
TCHAR * data = _pageKeyWords[j];
- mir_free( data );
+ mir_free(data);
}
_pageKeyWords.destroy();
};
- void AddKeyWord( TCHAR * ptKeyWord )
+ void AddKeyWord(TCHAR * ptKeyWord)
{
- TCHAR * plwrWord = _tcslwr_locale( mir_tstrdup( ptKeyWord ) );
- if ( _pageKeyWords.getIndex( plwrWord ) == -1 )
- _pageKeyWords.insert( plwrWord );
+ TCHAR * plwrWord = _tcslwr_locale(mir_tstrdup(ptKeyWord));
+ if (_pageKeyWords.getIndex(plwrWord) == -1)
+ _pageKeyWords.insert(plwrWord);
else
- mir_free( plwrWord );
+ mir_free(plwrWord);
};
- BOOL ContainsString( TCHAR * data )
+ BOOL ContainsString(TCHAR * data)
{
- for ( int i = 0; i < _pageKeyWords.getCount(); i++)
+ for (int i = 0; i < _pageKeyWords.getCount(); i++)
if (_tcsstr(_pageKeyWords[i], data))
return TRUE;
return FALSE;
}
- static int PageSortFunc( const CPageKeywords* p1, const CPageKeywords* p2 )
+ static int PageSortFunc(const CPageKeywords* p1, const CPageKeywords* p2)
{
if (p1->_pageHashKey < p2->_pageHashKey) { return -1; }
else if (p1->_pageHashKey > p2->_pageHashKey) { return 1; }
@@ -90,11 +89,11 @@ class CPageList : public OBJLIST<CPageKeywords> {
CPageList();
public:
- CPageList( int aincr, FTSortFunc afunc = CPageKeywords::PageSortFunc ) : OBJLIST<CPageKeywords>( aincr, afunc ) {};
- CPageKeywords * operator[]( PageHash key )
+ CPageList( int aincr, FTSortFunc afunc = CPageKeywords::PageSortFunc) : OBJLIST<CPageKeywords>(aincr, afunc) {};
+ CPageKeywords * operator[](PageHash key)
{
- CPageKeywords keyToSearch( key );
- return this->find( &keyToSearch );
+ CPageKeywords keyToSearch(key);
+ return this->find(&keyToSearch);
}
~CPageList() {};
};
diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp index f47047ad19..66661b9983 100644 --- a/src/modules/options/headerbar.cpp +++ b/src/modules/options/headerbar.cpp @@ -48,15 +48,15 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, L // structure is used for storing list of tab info
struct MHeaderbarCtrl
{
- __inline void* operator new( size_t size )
- { return mir_calloc( size );
+ __inline void* operator new(size_t size)
+ { return mir_calloc(size);
}
- __inline void operator delete( void* p )
- { mir_free( p );
+ __inline void operator delete(void* p)
+ { mir_free(p);
}
MHeaderbarCtrl() {}
- ~MHeaderbarCtrl() { mir_free( controlsToRedraw ); }
+ ~MHeaderbarCtrl() { mir_free(controlsToRedraw); }
HWND hwnd;
@@ -103,7 +103,7 @@ static void MHeaderbar_SetupColors(MHeaderbarCtrl *dat) dat->clText = GetSysColor(COLOR_WINDOWTEXT);
- if (!dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
+ if ( !dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
}
static void MHeaderbar_FillRect(HDC hdc, int x, int y, int width, int height, COLORREF cl)
@@ -126,7 +126,7 @@ static void MHeaderbar_DrawGradient(HDC hdc, int x, int y, int width, int height COLORREF oldColor = SetBkColor(hdc, 0);
RECT rc; SetRect(&rc, x, 0, x+width, 0);
- for (i=y+height; --i >= y; )
+ for (i=y+height; --i >= y;)
{
COLORREF color = RGB(
((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
@@ -315,7 +315,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam RECT rcChild; GetWindowRect(hChild, &rcChild);
RECT rc;
IntersectRect(&rc, &rcChild, &rcWnd);
- if (!IsRectEmpty(&rc))
+ if ( !IsRectEmpty(&rc))
{
++itc->nControlsToRedraw;
itc->controlsToRedraw = (HWND *)mir_realloc(itc->controlsToRedraw, sizeof(HWND) * itc->nControlsToRedraw);
diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index 8499f3d470..01a3bc99bf 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -50,11 +50,11 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR // structure is used for storing list of tab info
struct MIcoTabCtrl
{
- __inline void* operator new( size_t size )
- { return mir_calloc( size );
+ __inline void* operator new(size_t size)
+ { return mir_calloc(size);
}
- __inline void operator delete( void* p )
- { mir_free( p );
+ __inline void operator delete(void* p)
+ { mir_free(p);
}
MIcoTabCtrl(): pList(1) {}
@@ -148,7 +148,7 @@ static void MIcoTab_SetupColors(MIcoTabCtrl *dat) dat->clSelBorder = RGB(dat->rgbSelTop.rgbRed, dat->rgbSelTop.rgbGreen, dat->rgbSelTop.rgbBlue);
dat->clHotBorder = RGB(dat->rgbHotTop.rgbRed, dat->rgbHotTop.rgbGreen, dat->rgbHotTop.rgbBlue);
- if (!dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
+ if ( !dat->hFont) dat->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
}
static void MIcoTab_FillRect(HDC hdc, int x, int y, int width, int height, COLORREF cl)
@@ -169,7 +169,7 @@ static void MIcoTab_DrawGradient(HDC hdc, int x, int y, int width, int height, R COLORREF oldColor = SetBkColor(hdc, 0);
RECT rc; SetRect(&rc, x, 0, x+width, 0);
- for ( int i=y+height; --i >= y; ) {
+ for (int i=y+height; --i >= y;) {
COLORREF color = RGB(
((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height,
@@ -370,7 +370,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return TRUE;
case WM_MOUSEMOVE:
- if (!itc->bMouseInside) {
+ if ( !itc->bMouseInside) {
TRACKMOUSEEVENT tme = {0};
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
@@ -474,7 +474,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case ITCM_SETBACKGROUND:
itc->hBkgBmp=(HBITMAP)lParam;
- if (!itc->hBkgDC)
+ if ( !itc->hBkgDC)
itc->hBkgDC = CreateCompatibleDC(NULL);
itc->hBkgOldBmp = (HBITMAP)SelectObject(itc->hBkgDC, itc->hBkgBmp);
{
@@ -488,7 +488,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case ITCM_ADDITEM:
{
MIcoTab* pMit=(MIcoTab *)wParam;
- if (!pMit)
+ if ( !pMit)
return FALSE;
MIcoTab* pListMit=(MIcoTab *)mir_calloc(sizeof(MIcoTab));
@@ -514,7 +514,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
case ITCM_SETSEL:
- if ( wParam >= 0 && (int)wParam < itc->pList.getCount()) {
+ if (wParam >= 0 && (int)wParam < itc->pList.getCount()) {
itc->nSelectedIdx = wParam;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
@@ -528,7 +528,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return itc->nSelectedIdx;
case ITCM_GETITEMDATA:
- if ( wParam >= 0 && (int)wParam < itc->pList.getCount())
+ if (wParam >= 0 && (int)wParam < itc->pList.getCount())
return ((MIcoTab *)itc->pList[wParam])->data;
return 0;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 17361b7a49..b603f93f25 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -40,7 +40,7 @@ static int FilterPage = 0; static int FilterLoadProgress = 100;
static int FilterTimerId = 0;
-char * GetPluginNameByInstance( HINSTANCE hInstance );
+char* GetPluginNameByInstance(HINSTANCE hInstance);
struct OptionsPageInit
{
@@ -76,7 +76,8 @@ struct OptionsPageData int nExpertOnlyControls;
UINT *expertOnlyControls;
DWORD flags;
- TCHAR *pszTitle, *pszGroup, *pszTab;
+ TCHAR *ptszTitle, *ptszGroup, *ptszTab;
+ int hLangpack;
BOOL insideTab;
LPARAM dwInitParam;
@@ -87,7 +88,7 @@ struct OptionsPageData struct OptionsDlgData
{
OptionsDlgData() :
- arOpd( 10 )
+ arOpd(10)
{}
int currentPage;
@@ -107,33 +108,32 @@ static HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name) tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF( str );
- tvi.hItem = TreeView_GetRoot( hwndTree );
- while ( tvi.hItem != NULL ) {
- SendMessage( hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi );
- if ( !_tcsicmp( str, name ))
+ tvi.cchTextMax = SIZEOF(str);
+ tvi.hItem = TreeView_GetRoot(hwndTree);
+ while (tvi.hItem != NULL) {
+ SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
+ if ( !_tcsicmp(str, name))
return tvi.hItem;
- tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
return NULL;
}
static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, const TCHAR* name)
{
- TVITEM tvi;
TCHAR str[128];
-
+ TVITEM tvi;
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF( str );
- tvi.hItem = TreeView_GetChild( hwndTree, hItem );
- while ( tvi.hItem != NULL ) {
- SendMessage( hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi );
- if ( !_tcsicmp( str, name ))
+ tvi.cchTextMax = SIZEOF(str);
+ tvi.hItem = TreeView_GetChild(hwndTree, hItem);
+ while (tvi.hItem != NULL) {
+ SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
+ if ( !_tcsicmp(str, name))
return tvi.hItem;
- tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
return NULL;
}
@@ -143,7 +143,7 @@ static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd, LPARAM lParam) TCHAR szClass[64];
GetClassName(hwnd, szClass, SIZEOF(szClass));
- if (!lstrcmp(szClass, _T("Button")) && (GetWindowLongPtr(hwnd, GWL_STYLE)&0x0F) == BS_GROUPBOX)
+ if ( !lstrcmp(szClass, _T("Button")) && (GetWindowLongPtr(hwnd, GWL_STYLE)&0x0F) == BS_GROUPBOX)
SendMessage(hwnd, WM_SETFONT, lParam, 0);
return TRUE;
}
@@ -156,22 +156,21 @@ struct MoveChildParam static BOOL CALLBACK MoveEnumChildren(HWND hwnd, LPARAM lParam)
{
- struct MoveChildParam * param = ( struct MoveChildParam *) lParam;
+ struct MoveChildParam * param = (struct MoveChildParam *) lParam;
RECT rcWnd;
- GetWindowRect( hwnd, &rcWnd);
+ GetWindowRect(hwnd, &rcWnd);
- HWND hwndParent = GetParent( hwnd );
- if ( hwndParent != param->hDlg )
+ HWND hwndParent = GetParent(hwnd);
+ if (hwndParent != param->hDlg)
return TRUE; // Do not move subchilds
- POINT pt; pt.x = 0; pt.y = 0;
-
- ClientToScreen( hwndParent, &pt );
- OffsetRect( &rcWnd, -pt.x, -pt.y );
+ POINT pt = { 0, 0 };
- SetWindowPos( hwnd, NULL, rcWnd.left + param->offset.x, rcWnd.top + param->offset.y, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE );
+ ClientToScreen(hwndParent, &pt);
+ OffsetRect(&rcWnd, -pt.x, -pt.y);
+ SetWindowPos(hwnd, NULL, rcWnd.left + param->offset.x, rcWnd.top + param->offset.y, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
return TRUE;
}
@@ -184,13 +183,13 @@ static void SaveOptionsTreeState(HWND hdlg) tvi.mask = TVIF_TEXT | TVIF_STATE;
tvi.pszText = str;
tvi.cchTextMax = SIZEOF(str);
- tvi.hItem = TreeView_GetRoot( GetDlgItem( hdlg, IDC_PAGETREE ));
- while ( tvi.hItem != NULL ) {
- if ( SendMessageA( GetDlgItem(hdlg, IDC_PAGETREE), TVM_GETITEMA, 0, (LPARAM)&tvi )) {
+ tvi.hItem = TreeView_GetRoot(GetDlgItem(hdlg, IDC_PAGETREE));
+ while (tvi.hItem != NULL) {
+ if (SendMessageA(GetDlgItem(hdlg, IDC_PAGETREE), TVM_GETITEMA, 0, (LPARAM)&tvi)) {
mir_snprintf(buf, SIZEOF(buf), "%s%s", OPTSTATE_PREFIX, str);
DBWriteContactSettingByte(NULL, "Options", buf, (BYTE)((tvi.state&TVIS_EXPANDED)?1:0));
}
- tvi.hItem = TreeView_GetNextSibling( GetDlgItem( hdlg, IDC_PAGETREE ), tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(GetDlgItem(hdlg, IDC_PAGETREE), tvi.hItem);
} }
#define DM_FOCUSPAGE (WM_USER+10)
@@ -207,11 +206,11 @@ static void ThemeDialogBackground(HWND hwnd, BOOL tabbed) static int lstrcmpnull(TCHAR *str1, TCHAR *str2)
{
- if ( str1 == NULL && str2 == NULL )
+ if (str1 == NULL && str2 == NULL)
return 0;
- if ( str1 != NULL && str2 == NULL )
+ if (str1 != NULL && str2 == NULL)
return 1;
- if ( str1 == NULL && str2 != NULL )
+ if (str1 == NULL && str2 != NULL)
return -1;
return lstrcmp(str1, str2);
@@ -222,7 +221,7 @@ static TCHAR *GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size) TCHAR tszModuleName[MAX_PATH];
GetModuleFileName(hInstance, tszModuleName, SIZEOF(tszModuleName));
TCHAR *dllName = _tcsrchr(tszModuleName, '\\');
- if (!dllName)
+ if ( !dllName)
{
dllName = tszModuleName;
}
@@ -237,7 +236,7 @@ static TCHAR *GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size) PageHash GetPluginPageHash(const OptionsPageData *page)
{
- return hashstr(page->pszGroup) + hashstr(page->pszTitle) + hashstr(page->pszTab);
+ return hashstr(page->ptszGroup) + hashstr(page->ptszTitle) + hashstr(page->ptszTab);
}
static void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWndParent, const OptionsPageData *page)
@@ -256,10 +255,10 @@ static void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWnd DWORD key = GetPluginPageHash(page); //get the plugin page hash
TCHAR * PluginFullName = NULL;
- char * temp = GetPluginNameByInstance( page->hInst );
- if ( temp ) PluginFullName = mir_a2t( temp );
- GetDialogStrings(enableKeywordFiltering, key, GetPluginName(page->hInst, pluginName, SIZEOF(pluginName)), hWnd, page->pszGroup, page->pszTitle, page->pszTab, PluginFullName );
- if ( PluginFullName ) mir_free( PluginFullName );
+ char * temp = GetPluginNameByInstance(page->hInst);
+ if (temp) PluginFullName = mir_a2t(temp);
+ GetDialogStrings(enableKeywordFiltering, key, GetPluginName(page->hInst, pluginName, SIZEOF(pluginName)), hWnd, page->ptszGroup, page->ptszTitle, page->ptszTab, PluginFullName);
+ if (PluginFullName) mir_free(PluginFullName);
if (enableKeywordFiltering && !current)
DestroyWindow(hWnd); //destroy the page, we're done with it
@@ -277,84 +276,84 @@ static WNDPROC OptionsFilterDefaultProc = NULL; static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message != WM_PAINT && message != WM_PRINT)
- return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam );
+ return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam);
- if ( GetFocus() == hWnd || GetWindowTextLength( hWnd ) )
- return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam );
+ if (GetFocus() == hWnd || GetWindowTextLength(hWnd))
+ return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam);
RECT rc;
- GetClientRect( hWnd, &rc);
+ GetClientRect(hWnd, &rc);
HDC hdc;
PAINTSTRUCT paint;
if (message == WM_PAINT)
- hdc = BeginPaint( hWnd, &paint);
+ hdc = BeginPaint(hWnd, &paint);
else
hdc = (HDC)wParam;
TCHAR buf[255];
- if ( bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0 )
- mir_sntprintf( buf, SIZEOF(buf), TranslateT("Loading... %d%%"), FilterLoadProgress );
+ if (bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0)
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("Loading... %d%%"), FilterLoadProgress);
else
- mir_sntprintf( buf, SIZEOF(buf), TranslateT( "Search" ) );
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("Search"));
BOOL bDrawnByTheme = FALSE;
- int oldMode = SetBkMode( hdc, TRANSPARENT );
+ int oldMode = SetBkMode(hdc, TRANSPARENT);
- if ( openThemeData ) {
- HTHEME hTheme = openThemeData( hWnd, L"EDIT");
- if ( hTheme ) {
- if ( isThemeBackgroundPartiallyTransparent( hTheme, EP_EDITTEXT, ETS_NORMAL ))
- drawThemeParentBackground( hWnd, hdc, &rc );
+ if (openThemeData) {
+ HTHEME hTheme = openThemeData(hWnd, L"EDIT");
+ if (hTheme) {
+ if (isThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
+ drawThemeParentBackground(hWnd, hdc, &rc);
RECT rc2;
- getThemeBackgroundContentRect( hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc, &rc2 );
+ getThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc, &rc2);
rc2.top = 2 * rc.top - rc2.top;
rc2.left = 2 * rc.left - rc2.left;
rc2.bottom = 2 * rc.bottom - rc2.bottom;
rc2.right = 2 * rc.right - rc2.right;
- drawThemeBackground( hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc2, &rc );
+ drawThemeBackground(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &rc2, &rc);
HFONT hFont = (HFONT) SendMessage(hWnd, WM_GETFONT, 0, 0);
- HFONT oldFont = (HFONT) SelectObject( hdc, hFont );
+ HFONT oldFont = (HFONT) SelectObject(hdc, hFont);
wchar_t *bufW = mir_t2u(buf);
- drawThemeText( hTheme, hdc, EP_EDITTEXT, ETS_DISABLED, bufW, -1, 0, 0, &rc );
+ drawThemeText(hTheme, hdc, EP_EDITTEXT, ETS_DISABLED, bufW, -1, 0, 0, &rc);
mir_free(bufW);
- SelectObject( hdc, oldFont );
- closeThemeData( hTheme );
+ SelectObject(hdc, oldFont);
+ closeThemeData(hTheme);
bDrawnByTheme = TRUE;
}
}
- SetBkMode( hdc, oldMode );
+ SetBkMode(hdc, oldMode);
- if ( !bDrawnByTheme ) {
+ if ( !bDrawnByTheme) {
HFONT hFont = (HFONT) SendMessage(hWnd, WM_GETFONT, 0, 0);
- HFONT oldFont = (HFONT) SelectObject( hdc, hFont );
- SetTextColor( hdc, GetSysColor(COLOR_GRAYTEXT) );
- FillRect( hdc, &rc, GetSysColorBrush( COLOR_WINDOW ) );
- int oldMode = SetBkMode( hdc, TRANSPARENT );
- DrawText( hdc, buf, -1, &rc, 0 );
- SetBkMode( hdc, oldMode );
- SelectObject( hdc, oldFont );
+ HFONT oldFont = (HFONT) SelectObject(hdc, hFont);
+ SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
+ FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
+ int oldMode = SetBkMode(hdc, TRANSPARENT);
+ DrawText(hdc, buf, -1, &rc, 0);
+ SetBkMode(hdc, oldMode);
+ SelectObject(hdc, oldFont);
}
if (message == WM_PAINT)
- EndPaint( hWnd, &paint);
+ EndPaint(hWnd, &paint);
return 0;
}
-static BOOL CheckPageShow( HWND hdlg, OptionsDlgData* dat, int i )
+static BOOL CheckPageShow(HWND hdlg, OptionsDlgData* dat, int i)
{
OptionsPageData* opd = dat->arOpd[i];
if (dat->szFilterString && dat->szFilterString[0] && !MatchesFilter(opd, dat->szFilterString)) return FALSE;
- if ((opd->flags & ODPF_SIMPLEONLY) && IsDlgButtonChecked( hdlg, IDC_EXPERT)) return FALSE;
- if ((opd->flags & ODPF_EXPERTONLY) && !IsDlgButtonChecked( hdlg, IDC_EXPERT)) return FALSE;
+ if ((opd->flags & ODPF_SIMPLEONLY) && IsDlgButtonChecked(hdlg, IDC_EXPERT)) return FALSE;
+ if ((opd->flags & ODPF_EXPERTONLY) && !IsDlgButtonChecked(hdlg, IDC_EXPERT)) return FALSE;
return TRUE;
}
@@ -364,13 +363,13 @@ static BOOL IsAeroMode() return dwmIsCompositionEnabled && (dwmIsCompositionEnabled(&result) == S_OK) && result;
}
-static void FreeOptionsData( OptionsPageInit* popi )
+static void FreeOptionsData(OptionsPageInit* popi)
{
- for (int i = 0; i < popi->pageCount; i++ ) {
- mir_free(( char* )popi->odp[i].pszTitle );
- mir_free( popi->odp[i].pszGroup );
- mir_free( popi->odp[i].pszTab );
- if (( DWORD_PTR )popi->odp[i].pszTemplate & 0xFFFF0000 )
+ for (int i = 0; i < popi->pageCount; i++) {
+ mir_free((char*)popi->odp[i].pszTitle);
+ mir_free(popi->odp[i].pszGroup);
+ mir_free(popi->odp[i].pszTab);
+ if ((DWORD_PTR)popi->odp[i].pszTemplate & 0xFFFF0000)
mir_free((char*)popi->odp[i].pszTemplate);
}
mir_free(popi->odp);
@@ -378,11 +377,11 @@ static void FreeOptionsData( OptionsPageInit* popi ) static void FreeOptionsPageData(OptionsPageData *opd)
{
- if ( opd->hwnd != NULL )
+ if (opd->hwnd != NULL)
DestroyWindow(opd->hwnd);
- mir_free(opd->pszGroup);
- mir_free(opd->pszTab);
- mir_free(opd->pszTitle);
+ mir_free(opd->ptszGroup);
+ mir_free(opd->ptszTab);
+ mir_free(opd->ptszTitle);
mir_free(opd->pTemplate);
mir_free(opd);
}
@@ -414,7 +413,7 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = // Fix alpha channel
GdiFlush();
for (int i = 0; i < rc.right*rc.bottom; ++i, pBits += 4)
- if (!pBits[3]) pBits[3] = 255;
+ if ( !pBits[3]) pBits[3] = 255;
//Copy to output
BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
@@ -429,7 +428,7 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam switch (msg)
{
case WM_CTLCOLOREDIT:
- if (!GetPropA((HWND)lParam, "Miranda.AeroRender.Active"))
+ if ( !GetPropA((HWND)lParam, "Miranda.AeroRender.Active"))
RedrawWindow((HWND)lParam, NULL, NULL, RDW_INVALIDATE);
break;
@@ -457,56 +456,56 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam return CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam);
}
-static void CALLBACK FilterSearchTimerFunc( HWND hwnd, UINT, UINT_PTR, DWORD )
+static void CALLBACK FilterSearchTimerFunc(HWND hwnd, UINT, UINT_PTR, DWORD)
{
- OptionsDlgData* dat = (OptionsDlgData* )GetWindowLongPtr( hwnd, GWLP_USERDATA );
- if ( !dat )
+ OptionsDlgData* dat = (OptionsDlgData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if ( !dat)
return;
- if ( hFilterSearchWnd == NULL)
- hFilterSearchWnd = CreateWindowA( "STATIC", "Test", WS_OVERLAPPED|WS_DISABLED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), 0 ); // Fake window to keep option page focused
+ if (hFilterSearchWnd == NULL)
+ hFilterSearchWnd = CreateWindowA("STATIC", "Test", WS_OVERLAPPED|WS_DISABLED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), 0); // Fake window to keep option page focused
if (FilterPage < dat->arOpd.getCount())
- FindFilterStrings( TRUE, dat->currentPage == FilterPage, hFilterSearchWnd, dat->arOpd[FilterPage] );
+ FindFilterStrings(TRUE, dat->currentPage == FilterPage, hFilterSearchWnd, dat->arOpd[FilterPage]);
FilterPage++;
- FilterLoadProgress = FilterPage*100/((dat->arOpd.getCount()) ? dat->arOpd.getCount() : FilterPage );
+ FilterLoadProgress = FilterPage*100/((dat->arOpd.getCount()) ? dat->arOpd.getCount() : FilterPage);
if (FilterPage >= dat->arOpd.getCount()) {
- KillTimer( hwnd, FilterTimerId );
+ KillTimer(hwnd, FilterTimerId);
FilterTimerId = 0;
bSearchState = 2;
FilterLoadProgress = 100;
- DestroyWindow( hFilterSearchWnd );
+ DestroyWindow(hFilterSearchWnd);
hFilterSearchWnd = NULL;
}
- RedrawWindow( GetDlgItem(hwnd, IDC_KEYWORD_FILTER ), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE );
+ RedrawWindow(GetDlgItem(hwnd, IDC_KEYWORD_FILTER), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
}
-static void ExecuteFindFilterStringsTimer( HWND hdlg )
+static void ExecuteFindFilterStringsTimer(HWND hdlg)
{
bSearchState = 1;
FilterPage = 0;
- if (FilterTimerId) KillTimer( hdlg, FilterTimerId );
- FilterTimerId = SetTimer( hdlg, NULL, 1, FilterSearchTimerFunc );
+ if (FilterTimerId) KillTimer(hdlg, FilterTimerId);
+ FilterTimerId = SetTimer(hdlg, NULL, 1, FilterSearchTimerFunc);
}
static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, OptionsDlgData* dat)
{
- HINSTANCE* KnownInstances = ( HINSTANCE* )alloca(sizeof(HINSTANCE)*dat->arOpd.getCount());
+ HINSTANCE* KnownInstances = (HINSTANCE*)alloca(sizeof(HINSTANCE)*dat->arOpd.getCount());
int countKnownInst = 0;
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_RESETCONTENT, 0, 0);
int index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)TranslateTS(ALL_MODULES_FILTER));
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)NULL);
index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)TranslateTS(CORE_MODULES_FILTER));
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)hMirandaInst);
- TCHAR* tszModuleName = ( TCHAR* )alloca(MAX_PATH*sizeof(TCHAR));
+ TCHAR* tszModuleName = (TCHAR*)alloca(MAX_PATH*sizeof(TCHAR));
for (int i = 0; i < dat->arOpd.getCount(); i++) {
TCHAR * dllName = NULL;
int j;
HINSTANCE inst = dat->arOpd[i]->hInst;
- if ( !enableKeywordFiltering )
- FindFilterStrings( enableKeywordFiltering, FALSE, hDlg, dat->arOpd[i]); // only modules name ( fast enougth )
+ if ( !enableKeywordFiltering)
+ FindFilterStrings(enableKeywordFiltering, FALSE, hDlg, dat->arOpd[i]); // only modules name (fast enougth)
if (inst == hMirandaInst) continue;
for (j = 0; j<countKnownInst; j++)
@@ -516,36 +515,36 @@ static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, OptionsDlgDat countKnownInst++;
GetModuleFileName(inst, tszModuleName, MAX_PATH);
{
- char * name = GetPluginNameByInstance( inst );
- if ( name )
- dllName = mir_a2t( name );
+ char * name = GetPluginNameByInstance(inst);
+ if (name)
+ dllName = mir_a2t(name);
}
- if (!dllName) dllName = mir_tstrdup( _tcsrchr(tszModuleName, _T('\\')) );
- if (!dllName) dllName = mir_tstrdup( tszModuleName );
+ if ( !dllName) dllName = mir_tstrdup(_tcsrchr(tszModuleName, _T('\\')));
+ if ( !dllName) dllName = mir_tstrdup(tszModuleName);
if (dllName) {
index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)dllName);
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)inst);
- mir_free( dllName );
+ mir_free(dllName);
}
}
FilterLoadProgress = 100;
- if ( enableKeywordFiltering)
- ExecuteFindFilterStringsTimer( hDlg );
+ if (enableKeywordFiltering)
+ ExecuteFindFilterStringsTimer(hDlg);
}
-static BOOL IsInsideTab( HWND hdlg, OptionsDlgData * dat, int i )
+static BOOL IsInsideTab(HWND hdlg, OptionsDlgData * dat, int i)
{
OptionsPageData* opd = dat->arOpd[i];
int pages = 0;
- if (opd->pszTab != NULL) {
+ if (opd->ptszTab != NULL) {
// Count tabs to calc position
- for (int j = 0; j < dat->arOpd.getCount() && pages < 2; j++ ) {
+ for (int j = 0; j < dat->arOpd.getCount() && pages < 2; j++) {
OptionsPageData* opd2 = dat->arOpd[j];
- if ( !CheckPageShow( hdlg, dat, j )) continue;
- if ( lstrcmp(opd2->pszTitle, opd->pszTitle) || lstrcmpnull(opd2->pszGroup, opd->pszGroup))
+ if ( !CheckPageShow(hdlg, dat, j)) continue;
+ if ( lstrcmp(opd2->ptszTitle, opd->ptszTitle) || lstrcmpnull(opd2->ptszGroup, opd->ptszGroup))
continue;
pages++;
}
@@ -562,10 +561,10 @@ static bool LoadOptionsPage(OPTIONSDIALOGPAGE *src, OptionsPageData *dst) if (hglb == NULL) return false;
DWORD resSize = SizeofResource(src->hInstance, hrsrc);
- dst->pTemplate = ( DLGTEMPLATE* )mir_alloc(resSize);
+ dst->pTemplate = (DLGTEMPLATE*)mir_alloc(resSize);
memcpy(dst->pTemplate, LockResource(hglb), resSize);
DlgTemplateExBegin *dte = (struct DlgTemplateExBegin*)dst->pTemplate;
- if ( dte->signature == 0xFFFF ) {
+ if (dte->signature == 0xFFFF) {
//this feels like an access violation, and is according to boundschecker
//...but it works - for now
//may well have to remove and sort out the original dialogs
@@ -587,27 +586,28 @@ static bool LoadOptionsPage(OPTIONSDIALOGPAGE *src, OptionsPageData *dst) dst->nExpertOnlyControls = src->nExpertOnlyControls;
dst->expertOnlyControls = src->expertOnlyControls;
dst->flags = src->flags;
+ dst->hLangpack = src->hLangpack;
dst->dwInitParam = src->dwInitParam;
- if ( src->pszTitle == NULL )
- dst->pszTitle = NULL;
- else if ( src->flags & ODPF_UNICODE ) {
- dst->pszTitle = ( TCHAR* )mir_wstrdup( src->ptszTitle );
- }
- else dst->pszTitle = ( TCHAR* )mir_strdup( src->pszTitle );
-
- if ( src->pszGroup == NULL )
- dst->pszGroup = NULL;
- else if ( src->flags & ODPF_UNICODE ) {
- dst->pszGroup = ( TCHAR* )mir_wstrdup( src->ptszGroup );
- }
- else dst->pszGroup = ( TCHAR* )mir_strdup( src->pszGroup );
+ if (src->pszTitle == NULL)
+ dst->ptszTitle = NULL;
+ else if (src->flags & ODPF_UNICODE)
+ dst->ptszTitle = mir_tstrdup(src->ptszTitle);
+ else
+ dst->ptszTitle = mir_a2t(src->pszTitle);
+
+ if (src->pszGroup == NULL)
+ dst->ptszGroup = NULL;
+ else if (src->flags & ODPF_UNICODE)
+ dst->ptszGroup = mir_tstrdup(src->ptszGroup);
+ else
+ dst->ptszGroup = mir_a2t(src->pszGroup);
- if ( src->pszTab == NULL )
- dst->pszTab = NULL;
- else if ( src->flags & ODPF_UNICODE ) {
- dst->pszTab = ( TCHAR* )mir_wstrdup( src->ptszTab );
- }
- else dst->pszTab = ( TCHAR* )mir_strdup( src->pszTab );
+ if (src->pszTab == NULL)
+ dst->ptszTab = NULL;
+ else if (src->flags & ODPF_UNICODE)
+ dst->ptszTab = mir_tstrdup(src->ptszTab);
+ else
+ dst->ptszTab = mir_a2t(src->pszTab);
return true;
}
@@ -615,19 +615,19 @@ static bool LoadOptionsPage(OPTIONSDIALOGPAGE *src, OptionsPageData *dst) static void LoadOptionsModule(HWND hdlg, OptionsDlgData *dat, HINSTANCE hInst)
{
OptionsPageInit opi = { 0 };
- CallPluginEventHook(hInst, hOptionsInitEvent, ( WPARAM )&opi, 0);
- if ( opi.pageCount == 0 )
+ CallPluginEventHook(hInst, hOptionsInitEvent, (WPARAM)&opi, 0);
+ if (opi.pageCount == 0)
return;
for (int i=0; i < opi.pageCount; i++) {
- OptionsPageData* opd = (OptionsPageData*)mir_calloc( sizeof(OptionsPageData));
- if ( LoadOptionsPage(&opi.odp[i], opd))
+ OptionsPageData* opd = (OptionsPageData*)mir_calloc(sizeof(OptionsPageData));
+ if (LoadOptionsPage(&opi.odp[i], opd))
dat->arOpd.insert(opd);
else
mir_free(opd);
}
- FreeOptionsData( &opi );
+ FreeOptionsData(&opi);
PostMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
}
@@ -653,16 +653,16 @@ static void UnloadOptionsModule(HWND hdlg, OptionsDlgData *dat, HINSTANCE hInst) static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- OptionsDlgData* dat = (OptionsDlgData* )GetWindowLongPtr( hdlg, GWLP_USERDATA );
+ OptionsDlgData* dat = (OptionsDlgData*)GetWindowLongPtr(hdlg, GWLP_USERDATA);
HWND hwndTree = GetDlgItem(hdlg, IDC_PAGETREE);
- switch ( message ) {
+ switch (message) {
case WM_CTLCOLORSTATIC:
- switch ( GetDlgCtrlID(( HWND )lParam )) {
+ switch (GetDlgCtrlID((HWND)lParam)) {
case IDC_WHITERECT:
case IDC_KEYWORD_FILTER:
- SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW ));
- return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW );
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
}
break;
@@ -679,8 +679,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L if (getComboBoxInfo) {
COMBOBOXINFO cbi;
cbi.cbSize = sizeof(COMBOBOXINFO);
- getComboBoxInfo(GetDlgItem( hdlg, IDC_KEYWORD_FILTER), &cbi);
- OptionsFilterDefaultProc = (WNDPROC)SetWindowLongPtr( cbi.hwndItem, GWLP_WNDPROC, (LONG_PTR) OptionsFilterSubclassProc );
+ getComboBoxInfo(GetDlgItem(hdlg, IDC_KEYWORD_FILTER), &cbi);
+ OptionsFilterDefaultProc = (WNDPROC)SetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC, (LONG_PTR) OptionsFilterSubclassProc);
if (IsAeroMode()) {
SetWindowLongPtr(cbi.hwndCombo, GWLP_USERDATA, GetWindowLongPtr(cbi.hwndCombo, GWLP_WNDPROC));
@@ -708,49 +708,49 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L dat->hPluginUnload = HookEventMessage(ME_SYSTEM_MODULEUNLOAD, hdlg, HM_MODULEUNLOAD);
dat->currentPage = -1;
- if ( ood->pszPage == NULL ) {
- if ( !DBGetContactSettingTString( NULL, "Options", "LastPage", &dbv )) {
- lastPage = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if (ood->pszPage == NULL) {
+ if ( !DBGetContactSettingTString(NULL, "Options", "LastPage", &dbv)) {
+ lastPage = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- if ( ood->pszGroup == NULL ) {
- if ( !DBGetContactSettingTString( NULL, "Options", "LastGroup", &dbv )) {
- lastGroup = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if (ood->pszGroup == NULL) {
+ if ( !DBGetContactSettingTString(NULL, "Options", "LastGroup", &dbv)) {
+ lastGroup = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
}
- else lastGroup = LangPackPcharToTchar( ood->pszGroup );
+ else lastGroup = LangPackPcharToTchar(ood->pszGroup);
}
else {
- lastPage = LangPackPcharToTchar( ood->pszPage );
- lastGroup = ( ood->pszGroup == NULL ) ? NULL : LangPackPcharToTchar( ood->pszGroup );
+ lastPage = LangPackPcharToTchar(ood->pszPage);
+ lastGroup = (ood->pszGroup == NULL) ? NULL : LangPackPcharToTchar(ood->pszGroup);
}
- if ( ood->pszTab == NULL ) {
- if ( !DBGetContactSettingTString( NULL, "Options", "LastTab", &dbv )) {
- lastTab = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if (ood->pszTab == NULL) {
+ if ( !DBGetContactSettingTString(NULL, "Options", "LastTab", &dbv)) {
+ lastTab = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
}
- else lastTab = LangPackPcharToTchar( ood->pszTab );
+ else lastTab = LangPackPcharToTchar(ood->pszTab);
- OPTIONSDIALOGPAGE *odp = ( OPTIONSDIALOGPAGE* )psh->ppsp;
+ OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
for (size_t i = 0; i < psh->nPages; i++, odp++) {
- OptionsPageData* opd = (OptionsPageData*)mir_calloc( sizeof(OptionsPageData));
+ OptionsPageData* opd = (OptionsPageData*)mir_calloc(sizeof(OptionsPageData));
if ( !LoadOptionsPage(odp, opd)) {
mir_free(opd);
continue;
}
dat->arOpd.insert(opd);
- if ( !lstrcmp( lastPage, odp->ptszTitle ) && !lstrcmpnull( lastGroup, odp->ptszGroup ) &&
- (( ood->pszTab == NULL && dat->currentPage == -1 ) || !lstrcmpnull( lastTab, odp->ptszTab )))
- dat->currentPage = i;
+ if ( !lstrcmp(lastPage, odp->ptszTitle) && !lstrcmpnull(lastGroup, odp->ptszGroup) &&
+ ((ood->pszTab == NULL && dat->currentPage == -1) || !lstrcmpnull(lastTab, odp->ptszTab)))
+ dat->currentPage = (int)i;
}
- mir_free( lastGroup );
- mir_free( lastPage );
- mir_free( lastTab );
+ mir_free(lastGroup);
+ mir_free(lastPage);
+ mir_free(lastTab);
GetWindowRect(GetDlgItem(hdlg, IDC_STNOPAGE), &dat->rcDisplay);
MapWindowPoints(NULL, hdlg, (LPPOINT)&dat->rcDisplay, 2);
@@ -767,7 +767,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L TabCtrl_AdjustRect(GetDlgItem(hdlg, IDC_TAB), FALSE, &dat->rcTab);
//!!!!!!!!!! int enableKeywordFiltering = DBGetContactSettingWord(NULL, "Options", "EnableKeywordFiltering", TRUE);
- FillFilterCombo( 0, hdlg, dat); //!!!!!!!!!! enableKeywordFiltering,
+ FillFilterCombo(0, hdlg, dat); //!!!!!!!!!! enableKeywordFiltering,
SendMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
return TRUE;
@@ -781,12 +781,12 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L GetDlgItemText(hdlg, IDC_KEYWORD_FILTER, dat->szFilterString, SIZEOF(dat->szFilterString));
//if filter string is set to all modules then make the filter string empty (this will return all modules)
- if (_tcscmp(dat->szFilterString, TranslateTS( ALL_MODULES_FILTER ) ) == 0) {
+ if (_tcscmp(dat->szFilterString, TranslateTS(ALL_MODULES_FILTER)) == 0) {
dat->szFilterString[0] = 0;
bRemoveFocusFromFilter = TRUE;
}
//if filter string is set to core modules replace it with the name of the executable (this will return all core modules)
- else if (_tcscmp(dat->szFilterString, TranslateTS( CORE_MODULES_FILTER) ) == 0) {
+ else if (_tcscmp(dat->szFilterString, TranslateTS(CORE_MODULES_FILTER)) == 0) {
//replace string with process name - that will show core settings
TCHAR szFileName[300];
GetModuleFileName(NULL, szFileName, SIZEOF(szFileName));
@@ -799,9 +799,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L _tcsncpy(dat->szFilterString, pos, SIZEOF(dat->szFilterString));
}
else {
- int sel = SendMessage( GetDlgItem(hdlg, IDC_KEYWORD_FILTER ), (UINT) CB_GETCURSEL, 0, 0 );
+ int sel = SendMessage(GetDlgItem(hdlg, IDC_KEYWORD_FILTER), (UINT) CB_GETCURSEL, 0, 0);
if (sel != -1) {
- HINSTANCE hinst = (HINSTANCE)SendMessage( GetDlgItem(hdlg, IDC_KEYWORD_FILTER ), (UINT) CB_GETITEMDATA, sel , 0 );
+ HINSTANCE hinst = (HINSTANCE)SendMessage(GetDlgItem(hdlg, IDC_KEYWORD_FILTER), (UINT) CB_GETITEMDATA, sel , 0);
TCHAR szFileName[300];
GetModuleFileName(hinst, szFileName, SIZEOF(szFileName));
TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
@@ -816,10 +816,10 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L HWND oldWnd = NULL;
HWND oldTab = NULL;
- if ( dat->currentPage != (-1)) {
+ if (dat->currentPage != (-1)) {
oldWnd = dat->arOpd[dat->currentPage]->hwnd;
- if ( dat->arOpd[dat->currentPage]->insideTab )
- oldTab = GetDlgItem( hdlg, IDC_TAB );
+ if (dat->arOpd[dat->currentPage]->insideTab)
+ oldTab = GetDlgItem(hdlg, IDC_TAB);
}
dat->hCurrentPage = NULL;
@@ -832,54 +832,57 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- for (int i = 0; i < dat->arOpd.getCount(); i++ ) {
+ for (int i = 0; i < dat->arOpd.getCount(); i++) {
static TCHAR *fullTitle = NULL;
mir_free(fullTitle); fullTitle = NULL;
- if ( !CheckPageShow( hdlg, dat, i ))
+ if ( !CheckPageShow(hdlg, dat, i))
continue;
OptionsPageData* opd = dat->arOpd[i];
+ TCHAR* ptszGroup = LangPackTranslateStringT(opd->hLangpack, opd->ptszGroup);
+ TCHAR* ptszTitle = LangPackTranslateStringT(opd->hLangpack, opd->ptszTitle);
+ TCHAR* ptszTab = LangPackTranslateStringT(opd->hLangpack, opd->ptszTab);
tvis.hParent = NULL;
- if ( FilterInst != NULL ) {
- size_t sz = opd->pszGroup ? _tcslen(opd->pszGroup)+1:0;
+ if (FilterInst != NULL) {
+ size_t sz = ptszGroup ? _tcslen(ptszGroup)+1:0;
if (sz) sz+=3;
- sz += opd->pszTitle ? _tcslen(opd->pszTitle)+1 : 0;
- fullTitle = ( TCHAR* )mir_alloc(sz*sizeof(TCHAR));
- mir_sntprintf(fullTitle, sz, (opd->pszGroup && opd->pszTitle)?_T("%s - %s"):_T("%s%s"),
- opd->pszGroup ? opd->pszGroup : _T(""),
- opd->pszTitle ? opd->pszTitle : _T(""));
+ sz += ptszTitle ? _tcslen(ptszTitle)+1 : 0;
+ fullTitle = (TCHAR*)mir_alloc(sz*sizeof(TCHAR));
+ mir_sntprintf(fullTitle, sz, (ptszGroup && ptszTitle)?_T("%s - %s"):_T("%s%s"),
+ ptszGroup ? ptszGroup : _T(""),
+ ptszTitle ? ptszTitle : _T(""));
}
- TCHAR *useTitle = fullTitle ? fullTitle : opd->pszTitle;
- if (opd->pszGroup != NULL && FilterInst == NULL) {
- tvis.hParent = FindNamedTreeItemAtRoot(hwndTree, opd->pszGroup);
+ TCHAR *useTitle = fullTitle ? fullTitle : ptszTitle;
+ if (ptszGroup != NULL && FilterInst == NULL) {
+ tvis.hParent = FindNamedTreeItemAtRoot(hwndTree, ptszGroup);
if (tvis.hParent == NULL) {
tvis.item.lParam = -1;
- tvis.item.pszText = opd->pszGroup;
+ tvis.item.pszText = ptszGroup;
tvis.hParent = TreeView_InsertItem(hwndTree, &tvis);
}
}
else {
TVITEM tvi;
tvi.hItem = FindNamedTreeItemAtRoot(hwndTree, useTitle);
- if ( tvi.hItem != NULL ) {
- if ( i == dat->currentPage ) dat->hCurrentPage = tvi.hItem;
+ if (tvi.hItem != NULL) {
+ if (i == dat->currentPage) dat->hCurrentPage = tvi.hItem;
tvi.mask = TVIF_PARAM;
TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.lParam == -1 ) {
+ if (tvi.lParam == -1) {
tvi.lParam = i;
TreeView_SetItem(hwndTree, &tvi);
continue;
} } }
- if ( opd->pszTab != NULL ) {
+ if (ptszTab != NULL) {
HTREEITEM hItem;
if (tvis.hParent == NULL)
hItem = FindNamedTreeItemAtRoot(hwndTree, useTitle);
else
hItem = FindNamedTreeItemAtChildren(hwndTree, tvis.hParent, useTitle);
- if ( hItem != NULL ) {
- if ( i == dat->currentPage ) {
+ if (hItem != NULL) {
+ if (i == dat->currentPage) {
TVITEM tvi;
tvi.hItem = hItem;
tvi.mask = TVIF_PARAM;
@@ -894,7 +897,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L tvis.item.pszText = useTitle;
tvis.item.lParam = i;
opd->hTreeItem = TreeView_InsertItem(hwndTree, &tvis);
- if ( i == dat->currentPage )
+ if (i == dat->currentPage)
dat->hCurrentPage = opd->hTreeItem;
if (fullTitle) mir_free(fullTitle);
@@ -907,14 +910,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L tvi.pszText = str;
tvi.cchTextMax = SIZEOF(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
- if ( SendMessageA( hwndTree, TVM_GETITEMA, 0, (LPARAM)&tvi )) {
+ while (tvi.hItem != NULL) {
+ if (SendMessageA(hwndTree, TVM_GETITEMA, 0, (LPARAM)&tvi)) {
char buf[130];
mir_snprintf(buf, SIZEOF(buf), "%s%s", OPTSTATE_PREFIX, str);
- if ( !DBGetContactSettingByte( NULL, "Options", buf, 1 ))
- TreeView_Expand( hwndTree, tvi.hItem, TVE_COLLAPSE );
+ if ( !DBGetContactSettingByte(NULL, "Options", buf, 1))
+ TreeView_Expand(hwndTree, tvi.hItem, TVE_COLLAPSE);
}
- tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
}
@@ -924,20 +927,20 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L }
TreeView_SelectItem(hwndTree, dat->hCurrentPage);
- if ( oldWnd ) {
- if ( dat->currentPage == -1 || oldWnd != dat->arOpd[dat->currentPage]->hwnd ) {
- ShowWindow( oldWnd, SW_HIDE);
- if ( oldTab && ( dat->currentPage == -1 || !dat->arOpd[dat->currentPage]->insideTab ) )
- ShowWindow( oldTab, SW_HIDE );
+ if (oldWnd) {
+ if (dat->currentPage == -1 || oldWnd != dat->arOpd[dat->currentPage]->hwnd) {
+ ShowWindow(oldWnd, SW_HIDE);
+ if (oldTab && (dat->currentPage == -1 || !dat->arOpd[dat->currentPage]->insideTab))
+ ShowWindow(oldTab, SW_HIDE);
}
}
- if ( dat->szFilterString[0] == 0 ) // Clear the keyword combo box
- SetWindowText( GetDlgItem(hdlg, IDC_KEYWORD_FILTER), _T("") );
- if ( !bRemoveFocusFromFilter )
+ if (dat->szFilterString[0] == 0) // Clear the keyword combo box
+ SetWindowText(GetDlgItem(hdlg, IDC_KEYWORD_FILTER), _T(""));
+ if ( !bRemoveFocusFromFilter)
SetFocus(GetDlgItem(hdlg, IDC_KEYWORD_FILTER)); //set the focus back to the combo box
- SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, CB_SETEDITSEL, 0, oldSel ); //but don't select any of the text
+ SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, CB_SETEDITSEL, 0, oldSel); //but don't select any of the text
ShowWindow(hwndTree, SW_SHOW);
}
@@ -1016,9 +1019,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L tvi.lParam = dat->currentPage;
TreeView_SetItem(hwndTree, &tvi);
}
- if ( dat->currentPage != -1 ) {
+ if (dat->currentPage != -1) {
OptionsPageData* p = dat->arOpd[dat->currentPage];
- if ( p->hwnd == NULL ) {
+ if (p->hwnd == NULL) {
RECT rcPage;
RECT rcControl, rc;
int w, h;
@@ -1057,7 +1060,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L p->offsetX = 0;
p->offsetY = 0;
- p->insideTab = IsInsideTab( hdlg, dat, dat->currentPage );
+ p->insideTab = IsInsideTab(hdlg, dat, dat->currentPage);
if (p->insideTab) {
SetWindowPos(p->hwnd, HWND_TOP, (dat->rcTab.left+dat->rcTab.right-w)>>1, dat->rcTab.top, w, h, 0);
ThemeDialogBackground(p->hwnd, TRUE);
@@ -1068,29 +1071,33 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L }
}
if (wParam != IDC_TAB) {
- p->insideTab = IsInsideTab( hdlg, dat, dat->currentPage );
+ p->insideTab = IsInsideTab(hdlg, dat, dat->currentPage);
if (p->insideTab) {
// Make tabbed pane
- int i, pages = 0, sel = 0;
- TCITEM tie;
+ int pages = 0, sel = 0;
HWND hwndTab = GetDlgItem(hdlg, IDC_TAB);
-
TabCtrl_DeleteAllItems(hwndTab);
+
+ TCITEM tie;
tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
tie.iImage = -1;
- for ( i = 0; i < dat->arOpd.getCount(); i++ ) {
- if (!CheckPageShow( hdlg, dat, i ) ) continue;
- if ( lstrcmp(dat->arOpd[i]->pszTitle, p->pszTitle) || lstrcmpnull(dat->arOpd[i]->pszGroup, p->pszGroup) ) continue;
+ for (int i = 0; i < dat->arOpd.getCount(); i++) {
+ if ( !CheckPageShow(hdlg, dat, i))
+ continue;
+
+ OptionsPageData* opd = dat->arOpd[i];
+ if ( lstrcmp(opd->ptszTitle, p->ptszTitle) || lstrcmpnull(opd->ptszGroup, p->ptszGroup))
+ continue;
- tie.pszText = dat->arOpd[i]->pszTab;
+ tie.pszText = LangPackTranslateStringT(opd->hLangpack, opd->ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if ( !lstrcmp(dat->arOpd[i]->pszTab, p->pszTab) )
+ if ( !lstrcmp(opd->ptszTab, p->ptszTab))
sel = pages;
pages++;
}
TabCtrl_SetCurSel(hwndTab, sel);
- ShowWindow(hwndTab, p->insideTab ? SW_SHOW : SW_HIDE );
+ ShowWindow(hwndTab, p->insideTab ? SW_SHOW : SW_HIDE);
}
if (p->insideTab)
@@ -1100,7 +1107,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L }
// Resizing
- if (!p->simpleBottomControlId) {
+ if ( !p->simpleBottomControlId) {
int pageWidth, pageHeight;
if (IsDlgButtonChecked(hdlg, IDC_EXPERT)) {
@@ -1113,28 +1120,28 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L }
RECT* parentPageRect = &dat->rcDisplay;
- if ( p->insideTab )
+ if (p->insideTab)
parentPageRect = &dat->rcTab;
- pageHeight = min( pageHeight, parentPageRect->bottom - parentPageRect->top );
- pageWidth = min( pageWidth, parentPageRect->right - parentPageRect->left );
+ pageHeight = min(pageHeight, parentPageRect->bottom - parentPageRect->top);
+ pageWidth = min(pageWidth, parentPageRect->right - parentPageRect->left);
- int newOffsetX = ( parentPageRect->right - parentPageRect->left - pageWidth ) >> 1;
- int newOffsetY = p->insideTab ? 0 : ( parentPageRect->bottom - parentPageRect->top - pageHeight ) >> 1;
+ int newOffsetX = (parentPageRect->right - parentPageRect->left - pageWidth) >> 1;
+ int newOffsetY = p->insideTab ? 0 : (parentPageRect->bottom - parentPageRect->top - pageHeight) >> 1;
struct MoveChildParam mcp;
mcp.hDlg = p->hwnd;
mcp.offset.x = newOffsetX - p->offsetX;
mcp.offset.y = newOffsetY - p->offsetY;
- if ( mcp.offset.x || mcp.offset.y ) {
+ if (mcp.offset.x || mcp.offset.y) {
EnumChildWindows(p->hwnd, MoveEnumChildren, (LPARAM)(&mcp));
- SetWindowPos( p->hwnd, NULL,
+ SetWindowPos(p->hwnd, NULL,
parentPageRect->left, parentPageRect->top,
parentPageRect->right - parentPageRect->left,
parentPageRect->bottom - parentPageRect->top,
- SWP_NOZORDER | SWP_NOACTIVATE );
+ SWP_NOZORDER | SWP_NOACTIVATE);
p->offsetX = newOffsetX;
p->offsetY = newOffsetY;
}
@@ -1169,7 +1176,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L case IDC_KEYWORD_FILTER:
//add a timer - when the timer elapses filter the option pages
if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
- if (!SetTimer(hdlg, FILTER_TIMEOUT_TIMER, 400, NULL))
+ if ( !SetTimer(hdlg, FILTER_TIMEOUT_TIMER, 400, NULL))
MessageBeep(MB_ICONSTOP);
break;
@@ -1190,9 +1197,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L for (int i = 0; i <dat->arOpd.getCount(); i++) {
OptionsPageData *opd = dat->arOpd[i];
if (opd->hwnd == NULL) continue;
- if (!CheckPageShow( hdlg, dat, i ) ) continue;
- //if (( opd->flags & ODPF_SIMPLEONLY ) && expert) continue;
- //if (( opd->flags & ODPF_EXPERTONLY ) && !expert) continue;
+ if ( !CheckPageShow(hdlg, dat, i)) continue;
+ //if ((opd->flags & ODPF_SIMPLEONLY) && expert) continue;
+ //if ((opd->flags & ODPF_EXPERTONLY) && !expert) continue;
pshn.hdr.hwndFrom = opd->hwnd;
SendMessage(opd->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -1308,7 +1315,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L return 0;
} }
- if ( LOWORD( wParam ) == IDOK )
+ if (LOWORD(wParam) == IDOK)
DestroyWindow(hdlg);
}
break;
@@ -1316,26 +1323,26 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L break;
case WM_DESTROY:
- if ( FilterTimerId )
- KillTimer ( hdlg, FilterTimerId );
- DestroyWindow ( hFilterSearchWnd );
+ if (FilterTimerId)
+ KillTimer (hdlg, FilterTimerId);
+ DestroyWindow (hFilterSearchWnd);
ClearFilterStrings();
dat->szFilterString[0] = 0;
UnhookEvent(dat->hPluginLoad);
UnhookEvent(dat->hPluginUnload);
- SaveOptionsTreeState( hdlg );
- Window_FreeIcon_IcoLib( hdlg );
-
- if ( dat->currentPage != -1 ) {
- if ( dat->arOpd[dat->currentPage]->pszTab )
- DBWriteContactSettingTString( NULL, "Options", "LastTab", dat->arOpd[dat->currentPage]->pszTab );
- else DBDeleteContactSetting( NULL, "Options", "LastTab" );
- if ( dat->arOpd[dat->currentPage]->pszGroup )
- DBWriteContactSettingTString( NULL, "Options", "LastGroup", dat->arOpd[dat->currentPage]->pszGroup );
- else DBDeleteContactSetting( NULL, "Options", "LastGroup" );
- DBWriteContactSettingTString( NULL, "Options", "LastPage", dat->arOpd[dat->currentPage]->pszTitle );
+ SaveOptionsTreeState(hdlg);
+ Window_FreeIcon_IcoLib(hdlg);
+
+ if (dat->currentPage != -1) {
+ if (dat->arOpd[dat->currentPage]->ptszTab)
+ DBWriteContactSettingTString(NULL, "Options", "LastTab", dat->arOpd[dat->currentPage]->ptszTab);
+ else DBDeleteContactSetting(NULL, "Options", "LastTab");
+ if (dat->arOpd[dat->currentPage]->ptszGroup)
+ DBWriteContactSettingTString(NULL, "Options", "LastGroup", dat->arOpd[dat->currentPage]->ptszGroup);
+ else DBDeleteContactSetting(NULL, "Options", "LastGroup");
+ DBWriteContactSettingTString(NULL, "Options", "LastPage", dat->arOpd[dat->currentPage]->ptszTitle);
}
else {
DBDeleteContactSetting(NULL, "Options", "LastTab");
@@ -1344,11 +1351,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L }
Utils_SaveWindowPosition(hdlg, NULL, "Options", "");
{
- for (int i = 0; i < dat->arOpd.getCount(); i++ )
- FreeOptionsPageData( dat->arOpd[i] );
+ for (int i = 0; i < dat->arOpd.getCount(); i++)
+ FreeOptionsPageData(dat->arOpd[i]);
}
- DeleteObject( dat->hBoldFont );
+ DeleteObject(dat->hBoldFont);
delete dat;
hwndOptions = NULL;
@@ -1358,23 +1365,23 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L return FALSE;
}
-void OpenAccountOptions( PROTOACCOUNT* pa )
+void OpenAccountOptions(PROTOACCOUNT* pa)
{
OptionsPageInit opi = { 0 };
- if ( pa->ppro == NULL )
+ if (pa->ppro == NULL)
return;
- pa->ppro->OnEvent( EV_PROTO_ONOPTIONS, ( WPARAM )&opi, 0 );
- if ( opi.pageCount > 0 ) {
+ pa->ppro->OnEvent(EV_PROTO_ONOPTIONS, (WPARAM)&opi, 0);
+ if (opi.pageCount > 0) {
TCHAR tszTitle[ 100 ];
OPENOPTIONSDIALOG ood = { 0 };
PROPSHEETHEADER psh = { 0 };
- mir_sntprintf( tszTitle, SIZEOF(tszTitle), TranslateT("%s options"), pa->tszAccountName );
+ mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("%s options"), pa->tszAccountName);
ood.cbSize = sizeof(ood);
ood.pszGroup = LPGEN("Network");
- ood.pszPage = mir_t2a( pa->tszAccountName );
+ ood.pszPage = mir_t2a(pa->tszAccountName);
psh.dwSize = sizeof(psh);
psh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW;
@@ -1384,16 +1391,16 @@ void OpenAccountOptions( PROTOACCOUNT* pa ) psh.pszCaption = tszTitle;
psh.ppsp = (PROPSHEETPAGE*)opi.odp;
hwndOptions = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_OPTIONSPAGE), NULL, OptionsDlgProc, (LPARAM)&psh);
- mir_free(( void* )ood.pszPage );
- FreeOptionsData( &opi );
+ mir_free((void*)ood.pszPage);
+ FreeOptionsData(&opi);
} }
static void OpenOptionsNow(const char *pszGroup, const char *pszPage, const char *pszTab, bool bSinglePage = false)
{
- if ( IsWindow( hwndOptions )) {
- ShowWindow( hwndOptions, SW_RESTORE );
- SetForegroundWindow( hwndOptions );
- if ( pszPage != NULL) {
+ if (IsWindow(hwndOptions)) {
+ ShowWindow(hwndOptions, SW_RESTORE);
+ SetForegroundWindow(hwndOptions);
+ if (pszPage != NULL) {
TCHAR *ptszPage = LangPackPcharToTchar(pszPage);
HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
@@ -1414,8 +1421,8 @@ static void OpenOptionsNow(const char *pszGroup, const char *pszPage, const char }
else {
OptionsPageInit opi = { 0 };
- NotifyEventHooks( hOptionsInitEvent, ( WPARAM )&opi, 0 );
- if ( opi.pageCount > 0 ) {
+ NotifyEventHooks(hOptionsInitEvent, (WPARAM)&opi, 0);
+ if (opi.pageCount > 0) {
OPENOPTIONSDIALOG ood = { 0 };
ood.pszGroup = pszGroup;
ood.pszPage = pszPage;
@@ -1433,19 +1440,19 @@ static void OpenOptionsNow(const char *pszGroup, const char *pszPage, const char MAKEINTRESOURCE(bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
NULL, OptionsDlgProc, (LPARAM)&psh);
- FreeOptionsData( &opi );
+ FreeOptionsData(&opi);
} } }
static INT_PTR OpenOptions(WPARAM, LPARAM lParam)
{
OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)lParam;
- if ( ood == NULL )
+ if (ood == NULL)
return 1;
- if ( ood->cbSize == OPENOPTIONSDIALOG_OLD_SIZE )
- OpenOptionsNow( ood->pszGroup, ood->pszPage, NULL );
+ if (ood->cbSize == OPENOPTIONSDIALOG_OLD_SIZE)
+ OpenOptionsNow(ood->pszGroup, ood->pszPage, NULL);
else if (ood->cbSize == sizeof(OPENOPTIONSDIALOG))
- OpenOptionsNow( ood->pszGroup, ood->pszPage, ood->pszTab );
+ OpenOptionsNow(ood->pszGroup, ood->pszPage, ood->pszTab);
else
return 1;
@@ -1455,13 +1462,13 @@ static INT_PTR OpenOptions(WPARAM, LPARAM lParam) static INT_PTR OpenOptionsPage(WPARAM, LPARAM lParam)
{
OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)lParam;
- if ( ood == NULL )
+ if (ood == NULL)
return 1;
- if ( ood->cbSize == OPENOPTIONSDIALOG_OLD_SIZE )
- OpenOptionsNow( ood->pszGroup, ood->pszPage, NULL, true );
+ if (ood->cbSize == OPENOPTIONSDIALOG_OLD_SIZE)
+ OpenOptionsNow(ood->pszGroup, ood->pszPage, NULL, true);
else if (ood->cbSize == sizeof(OPENOPTIONSDIALOG))
- OpenOptionsNow( ood->pszGroup, ood->pszPage, ood->pszTab, true );
+ OpenOptionsNow(ood->pszGroup, ood->pszPage, ood->pszTab, true);
else
return 1;
@@ -1482,57 +1489,44 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)lParam, *dst;
OptionsPageInit *opi = (OptionsPageInit*)wParam;
- if (odp == NULL||opi == NULL) return 1;
- if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE)
- && odp->cbSize != OPTIONPAGE_OLD_SIZE
- && odp->cbSize != OPTIONPAGE_OLD_SIZE2
- && odp->cbSize != OPTIONPAGE_OLD_SIZE3)
+ if (odp == NULL || opi == NULL) return 1;
+ if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE) && odp->cbSize != OPTIONPAGE_OLD_SIZE)
return 1;
opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1));
dst = opi->odp + opi->pageCount;
- memset( dst, 0, sizeof( OPTIONSDIALOGPAGE ));
- memcpy( dst, odp, odp->cbSize );
+ memset(dst, 0, sizeof(OPTIONSDIALOGPAGE));
+ memcpy(dst, odp, odp->cbSize);
- if ( odp->ptszTitle != NULL ) {
- if ( odp->flags & ODPF_DONTTRANSLATE ) {
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszTitle = mir_wstrdup( odp->ptszTitle );
- else {
- dst->ptszTitle = mir_a2u( odp->pszTitle );
- dst->flags |= ODPF_UNICODE;
- }
- }
+ if (odp->ptszTitle != NULL) {
+ if (odp->flags & ODPF_UNICODE)
+ dst->ptszTitle = mir_wstrdup(odp->ptszTitle);
else {
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszTitle = mir_wstrdup( TranslateW( odp->ptszTitle ));
- else {
- dst->ptszTitle = LangPackPcharToTchar( odp->pszTitle );
- dst->flags |= ODPF_UNICODE;
- }
- }
+ dst->ptszTitle = mir_a2u(odp->pszTitle);
+ dst->flags |= ODPF_UNICODE;
+ }
}
- if ( odp->ptszGroup != NULL ) {
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszGroup = mir_wstrdup( TranslateW( odp->ptszGroup ));
+ if (odp->ptszGroup != NULL) {
+ if (odp->flags & ODPF_UNICODE)
+ dst->ptszGroup = mir_wstrdup(odp->ptszGroup);
else {
- dst->ptszGroup = LangPackPcharToTchar( odp->pszGroup );
+ dst->ptszGroup = LangPackPcharToTchar(odp->pszGroup);
dst->flags |= ODPF_UNICODE;
}
}
- if ( odp->cbSize > OPTIONPAGE_OLD_SIZE2 && odp->ptszTab != NULL ) {
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszTab = mir_wstrdup( TranslateW( odp->ptszTab ));
+ if (odp->ptszTab != NULL) {
+ if (odp->flags & ODPF_UNICODE)
+ dst->ptszTab = mir_wstrdup(odp->ptszTab);
else {
- dst->ptszTab = LangPackPcharToTchar( odp->pszTab );
+ dst->ptszTab = LangPackPcharToTchar(odp->pszTab);
dst->flags |= ODPF_UNICODE;
}
}
- if (( DWORD_PTR )odp->pszTemplate & 0xFFFF0000 )
- dst->pszTemplate = mir_strdup( odp->pszTemplate );
+ if ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000)
+ dst->pszTemplate = mir_strdup(odp->pszTemplate);
opi->pageCount++;
return 0;
@@ -1543,7 +1537,7 @@ static int OptModulesLoaded(WPARAM, LPARAM) CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_OPTIONS );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_OPTIONS);
mi.position = 1900000000;
mi.pszName = LPGEN("&Options...");
mi.pszService = "Options/OptionsCommand";
@@ -1565,7 +1559,7 @@ int LoadOptionsModule(void) {
hwndOptions = NULL;
hOptionsInitEvent = CreateHookableEvent(ME_OPT_INITIALISE);
- CreateServiceFunction(MS_OPT_ADDPAGE, AddOptionsPage);
+ CreateServiceFunction("Opt/AddPage", AddOptionsPage);
CreateServiceFunction(MS_OPT_OPENOPTIONS, OpenOptions);
CreateServiceFunction(MS_OPT_OPENOPTIONSPAGE, OpenOptionsPage);
CreateServiceFunction("Options/OptionsCommand", OpenOptionsDialog);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index cc4829cc44..52f3f32702 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -23,19 +23,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "plugins.h"
-static int sttComparePlugins( const pluginEntry* p1, const pluginEntry* p2 )
+static int sttComparePlugins(const pluginEntry* p1, const pluginEntry* p2)
{
if (p1->bpi.hInst == p2->bpi.hInst)
return 0;
- return ( p1->bpi.hInst < p2->bpi.hInst ) ? -1 : 1;
+ return (p1->bpi.hInst < p2->bpi.hInst) ? -1 : 1;
}
-static int sttComparePluginsByName( const pluginEntry* p1, const pluginEntry* p2 )
-{ return lstrcmp( p1->pluginname, p2->pluginname );
+static int sttComparePluginsByName(const pluginEntry* p1, const pluginEntry* p2)
+{ return lstrcmp(p1->pluginname, p2->pluginname);
}
-LIST<pluginEntry> pluginList( 10, sttComparePluginsByName ), pluginListAddr( 10, sttComparePlugins );
+LIST<pluginEntry> pluginList(10, sttComparePluginsByName), pluginListAddr(10, sttComparePlugins);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -73,14 +73,14 @@ void UninitIni(void); #define PLUGINDISABLELIST "PluginDisable"
-int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam );
+int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
int LoadDatabaseModule(void);
-char* GetPluginNameByInstance( HINSTANCE hInstance )
+char* GetPluginNameByInstance(HINSTANCE hInstance)
{
int i = 0;
- if ( pluginList.getCount() == 0) return NULL;
+ if (pluginList.getCount() == 0) return NULL;
for (i = 0; i < pluginList.getCount(); i++) {
pluginEntry* pe = pluginList[i];
if (pe->bpi.pluginInfo && pe->bpi.hInst == hInstance)
@@ -89,24 +89,24 @@ char* GetPluginNameByInstance( HINSTANCE hInstance ) return NULL;
}
-HINSTANCE GetInstByAddress( void* codePtr )
+HINSTANCE GetInstByAddress(void* codePtr)
{
int idx;
HINSTANCE result;
- pluginEntry p; p.bpi.hInst = ( HINSTANCE )codePtr;
+ pluginEntry p; p.bpi.hInst = (HINSTANCE)codePtr;
- if ( pluginListAddr.getCount() == 0 )
+ if (pluginListAddr.getCount() == 0)
return NULL;
- List_GetIndex(( SortedList* )&pluginListAddr, &p, &idx );
- if ( idx > 0 )
+ List_GetIndex((SortedList*)&pluginListAddr, &p, &idx);
+ if (idx > 0)
idx--;
result = pluginListAddr[idx]->bpi.hInst;
if (result < hMirandaInst && codePtr > hMirandaInst)
result = hMirandaInst;
- else if ( idx == 0 && codePtr < ( void* )result )
+ else if (idx == 0 && codePtr < (void*)result)
result = NULL;
return result;
@@ -130,7 +130,7 @@ static bool validInterfaceList(Miranda_Plugin_Interfaces ifaceProc) if (piface == NULL)
return false;
- if ( equalUUID(miid_last, piface[0]))
+ if (equalUUID(miid_last, piface[0]))
return false;
return true;
@@ -177,31 +177,31 @@ static const TCHAR* expiredModulesToSkip[] = _T("clist_nicer.dll")
};
-static int checkPI( BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi )
+static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi)
{
int bHasValidInfo = FALSE;
- if ( pi == NULL )
+ if (pi == NULL)
return FALSE;
- if ( bpi->InfoEx ) {
- if ( pi->cbSize == sizeof(PLUGININFOEX))
- if ( !validInterfaceList(bpi->Interfaces) || isPluginBanned( pi->uuid, pi->version ))
+ if (bpi->InfoEx) {
+ if (pi->cbSize == sizeof(PLUGININFOEX))
+ if ( !validInterfaceList(bpi->Interfaces) || isPluginBanned(pi->uuid, pi->version))
return FALSE;
bHasValidInfo = TRUE;
}
- if ( !bHasValidInfo )
+ if ( !bHasValidInfo)
return FALSE;
- if ( pi->shortName == NULL || pi->description == NULL || pi->author == NULL ||
- pi->authorEmail == NULL || pi->copyright == NULL || pi->homepage == NULL )
+ if (pi->shortName == NULL || pi->description == NULL || pi->author == NULL ||
+ pi->authorEmail == NULL || pi->copyright == NULL || pi->homepage == NULL)
return FALSE;
- if ( pi->replacesDefaultModule > DEFMOD_HIGHEST ||
- pi->replacesDefaultModule == DEFMOD_REMOVED_UIPLUGINOPTS ||
- pi->replacesDefaultModule == DEFMOD_REMOVED_PROTOCOLNETLIB )
+ if (pi->replacesDefaultModule > DEFMOD_HIGHEST ||
+ pi->replacesDefaultModule == DEFMOD_REMOVED_UIPLUGINOPTS ||
+ pi->replacesDefaultModule == DEFMOD_REMOVED_PROTOCOLNETLIB)
return FALSE;
return TRUE;
@@ -214,15 +214,15 @@ int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int ch // this is evil but these plugins are buggy/old and people are blaming Miranda
// fontservice plugin is built into the core now
TCHAR* p = _tcsrchr(plugin, '\\');
- if ( p != NULL && ++p ) {
+ if (p != NULL && ++p) {
int i;
- for ( i = 0; i < SIZEOF(modulesToSkip); i++ )
- if ( lstrcmpi( p, modulesToSkip[i] ) == 0 )
+ for (i = 0; i < SIZEOF(modulesToSkip); i++)
+ if (lstrcmpi(p, modulesToSkip[i]) == 0)
return 0;
}
h = LoadLibrary(plugin);
- if ( h == NULL )
+ if (h == NULL)
return 0;
// loaded, check for exports
@@ -239,33 +239,33 @@ LBL_Error: }
PLUGININFOEX* pi = bpi->InfoEx(mirandaVersion);
- if ( !checkPI( bpi, pi ))
+ if ( !checkPI(bpi, pi))
goto LBL_Error;
bpi->pluginInfo = pi;
// basic API is present
- if ( checkTypeAPI == CHECKAPI_NONE ) {
+ if (checkTypeAPI == CHECKAPI_NONE) {
LBL_Ok:
bpi->hInst = h;
return 1;
}
// check for DB?
- if ( checkTypeAPI == CHECKAPI_DB ) {
+ if (checkTypeAPI == CHECKAPI_DB) {
bpi->DbInfo = (Database_Plugin_Info) GetProcAddress(h, "DatabasePluginInfo");
- if ( bpi->DbInfo ) {
+ if (bpi->DbInfo) {
// fetch internal database function pointers
bpi->dblink = bpi->DbInfo(NULL);
// validate returned link structure
- if ( bpi->dblink && bpi->dblink->cbSize == sizeof(DATABASELINK))
+ if (bpi->dblink && bpi->dblink->cbSize == sizeof(DATABASELINK))
goto LBL_Ok;
} }
// check clist ?
- if ( checkTypeAPI == CHECKAPI_CLIST ) {
+ if (checkTypeAPI == CHECKAPI_CLIST) {
bpi->clistlink = (CList_Initialise) GetProcAddress(h, "CListInitialise");
- if ( pi->flags & UNICODE_AWARE )
- if ( bpi->clistlink )
+ if (pi->flags & UNICODE_AWARE)
+ if (bpi->clistlink)
goto LBL_Ok;
}
@@ -276,7 +276,7 @@ LBL_Ok: static int valid_library_name(TCHAR *name)
{
TCHAR * dot = _tcsrchr(name, '.');
- if ( dot != NULL && lstrcmpi(dot + 1, _T("dll")) == 0)
+ if (dot != NULL && lstrcmpi(dot + 1, _T("dll")) == 0)
if (dot[4] == 0)
return 1;
@@ -326,24 +326,24 @@ void Plugin_Uninit(pluginEntry* p, bool bDynamic) CallPluginEventHook(p->bpi.hInst, hOkToExitEvent, 0, 0);
// if it was an installed database plugin, call its unload
- if ( p->pclass & PCLASS_DB )
- p->bpi.dblink->Unload( p->pclass & PCLASS_OK );
+ if (p->pclass & PCLASS_DB)
+ p->bpi.dblink->Unload(p->pclass & PCLASS_OK);
// if the basic API check had passed, call Unload if Load() was ever called
- if ( p->pclass & PCLASS_LOADED )
+ if (p->pclass & PCLASS_LOADED)
p->bpi.Unload();
// release the library
- if ( p->bpi.hInst != NULL ) {
+ if (p->bpi.hInst != NULL) {
// we need to kill all resources which belong to that DLL before calling FreeLibrary
- KillModuleEventHooks( p->bpi.hInst );
- KillModuleServices( p->bpi.hInst );
+ KillModuleEventHooks(p->bpi.hInst);
+ KillModuleServices(p->bpi.hInst);
- FreeLibrary( p->bpi.hInst );
- ZeroMemory( &p->bpi, sizeof( p->bpi ));
+ FreeLibrary(p->bpi.hInst);
+ ZeroMemory(&p->bpi, sizeof(p->bpi));
}
- pluginList.remove( p );
- pluginListAddr.remove( p );
+ pluginList.remove(p);
+ pluginListAddr.remove(p);
}
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
@@ -362,7 +362,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) HANDLE hFind = FindFirstFile(search, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
+ if ( !(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
cb(&ffd, exe, wParam, lParam);
}
while (FindNextFile(hFind, &ffd));
@@ -376,22 +376,22 @@ static INT_PTR PluginsEnum(WPARAM, LPARAM lParam) {
PLUGIN_DB_ENUM * de = (PLUGIN_DB_ENUM *) lParam;
pluginEntry * x = pluginListDb;
- if ( de == NULL || de->cbSize != sizeof(PLUGIN_DB_ENUM) || de->pfnEnumCallback == NULL ) return 1;
- while ( x != NULL ) {
+ if (de == NULL || de->cbSize != sizeof(PLUGIN_DB_ENUM) || de->pfnEnumCallback == NULL) return 1;
+ while (x != NULL) {
int rc = de->pfnEnumCallback(StrConvA(x->pluginname), x->bpi.dblink, de->lParam);
if (rc == DBPE_DONE) {
// this db has been picked, get rid of all the others
pluginEntry * y = pluginListDb, * n;
- while ( y != NULL ) {
+ while (y != NULL) {
n = y->nextclass;
- if ( x != y )
+ if (x != y)
Plugin_Uninit(y);
y = n;
} // while
x->pclass |= PCLASS_LOADED | PCLASS_OK | PCLASS_LAST;
return 0;
}
- else if ( rc == DBPE_HALT ) return 1;
+ else if (rc == DBPE_HALT) return 1;
x = x->nextclass;
} // while
return pluginListDb != NULL ? 1 : -1;
@@ -409,7 +409,7 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) pluginEntry* p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
_tcsncpy(p->pluginname, tszFileName, SIZEOF(p->pluginname));
// plugin name suggests its a db module, load it right now
- if ( isdb ) {
+ if (isdb) {
TCHAR buf[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\Plugins\\%s"), path, tszFileName);
if (checkAPI(buf, &bpi, mirandaVersion, CHECKAPI_DB)) {
@@ -418,7 +418,7 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) // copy the dblink stuff
p->bpi = bpi;
// keep a faster list.
- if ( pluginListDb != NULL ) p->nextclass = pluginListDb;
+ if (pluginListDb != NULL) p->nextclass = pluginListDb;
pluginListDb = p;
}
else
@@ -427,7 +427,7 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) }
else if (validguess_clist_name(tszFileName)) {
// keep a note of this plugin for later
- if ( pluginListUI != NULL ) p->nextclass=pluginListUI;
+ if (pluginListUI != NULL) p->nextclass=pluginListUI;
pluginListUI=p;
p->pclass |= PCLASS_CLIST;
}
@@ -440,11 +440,11 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) if (bpi.Interfaces) {
int i = 0;
MUUID *piface = bpi.Interfaces();
- while (!equalUUID(miid_last, piface[i])) {
- if (!equalUUID(miid_servicemode, piface[i++]))
+ while ( !equalUUID(miid_last, piface[i])) {
+ if ( !equalUUID(miid_servicemode, piface[i++]))
continue;
p->pclass |= (PCLASS_SERVICE);
- if ( pluginListSM != NULL ) p->nextclass = pluginListSM;
+ if (pluginListSM != NULL) p->nextclass = pluginListSM;
pluginListSM = p;
break;
}
@@ -456,7 +456,7 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) }
// add it to the list
- pluginList.insert( p );
+ pluginList.insert(p);
return p;
}
@@ -464,7 +464,7 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM)
{
pluginEntry* p = OpenPlugin(fd->cFileName, path);
- if ( !( p->pclass & PCLASS_FAILED)) {
+ if ( !(p->pclass & PCLASS_FAILED)) {
if (pluginList_freeimg == NULL && lstrcmpi(fd->cFileName, _T("advaimg.dll")) == 0)
pluginList_freeimg = p;
@@ -488,7 +488,7 @@ int isPluginOnWhiteList(const TCHAR* pluginname) char* pluginnameA = _strlwr(mir_t2a(pluginname));
int rc = DBGetContactSettingByte(NULL, PLUGINDISABLELIST, pluginnameA, 0);
mir_free(pluginnameA);
- if ( rc != 0 && askAboutIgnoredPlugins ) {
+ if (rc != 0 && askAboutIgnoredPlugins) {
TCHAR buf[256];
mir_sntprintf(buf, SIZEOF(buf), TranslateT("'%s' is disabled, re-enable?"), pluginname);
if (MessageBox(NULL, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
@@ -508,7 +508,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) if (slice) *slice = 0;
CharLower(p->pluginname);
- if (!(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST))) {
+ if ( !(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST))) {
if ( !bDynamic && !isPluginOnWhiteList(p->pluginname))
return false;
@@ -521,21 +521,21 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) p->bpi = bpi;
p->pclass |= PCLASS_OK | PCLASS_BASICAPI;
- if ( pluginDefModList[rm] != NULL ) {
- SetPluginOnWhiteList( p->pluginname, 0 );
+ if (pluginDefModList[rm] != NULL) {
+ SetPluginOnWhiteList(p->pluginname, 0);
return false;
}
- pluginListAddr.insert( p );
- if ( bpi.Load(&pluginCoreLink) != 0 )
+ pluginListAddr.insert(p);
+ if (bpi.Load(&pluginCoreLink) != 0)
return false;
p->pclass |= PCLASS_LOADED;
- if ( rm ) pluginDefModList[rm]=p;
+ if (rm) pluginDefModList[rm]=p;
}
}
- else if ( p->bpi.hInst != NULL ) {
- pluginListAddr.insert( p );
+ else if (p->bpi.hInst != NULL) {
+ pluginListAddr.insert(p);
p->pclass |= PCLASS_LOADED;
}
return true;
@@ -545,20 +545,20 @@ static pluginEntry* getCListModule(TCHAR * exe, TCHAR * slice, int useWhiteList) {
pluginEntry * p = pluginListUI;
BASIC_PLUGIN_INFO bpi;
- while ( p != NULL ) {
+ while (p != NULL) {
mir_sntprintf(slice, &exe[MAX_PATH] - slice, _T("\\Plugins\\%s"), p->pluginname);
CharLower(p->pluginname);
- if ( useWhiteList ? isPluginOnWhiteList(p->pluginname) : 1 ) {
- if ( checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_CLIST)) {
+ if (useWhiteList ? isPluginOnWhiteList(p->pluginname) : 1) {
+ if (checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_CLIST)) {
p->bpi = bpi;
p->pclass |= PCLASS_LAST | PCLASS_OK | PCLASS_BASICAPI;
- pluginListAddr.insert( p );
- if ( bpi.clistlink(&pluginCoreLink) == 0 ) {
+ pluginListAddr.insert(p);
+ if (bpi.clistlink(&pluginCoreLink) == 0) {
p->bpi = bpi;
p->pclass |= PCLASS_LOADED;
return p;
}
- else Plugin_Uninit( p );
+ else Plugin_Uninit(p);
} //if
} //if
p = p->nextclass;
@@ -569,11 +569,11 @@ static pluginEntry* getCListModule(TCHAR * exe, TCHAR * slice, int useWhiteList) int UnloadPlugin(TCHAR* buf, int bufLen)
{
int i;
- for ( i = pluginList.getCount()-1; i >= 0; i-- ) {
+ for (i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry* p = pluginList[i];
if ( !_tcsicmp(p->pluginname, buf)) {
- GetModuleFileName( p->bpi.hInst, buf, bufLen);
- Plugin_Uninit( p );
+ GetModuleFileName(p->bpi.hInst, buf, bufLen);
+ Plugin_Uninit(p);
return TRUE;
}
}
@@ -590,15 +590,15 @@ char **GetServiceModePluginsList(void) int i = 0;
char **list = NULL;
pluginEntry * p = pluginListSM;
- while ( p != NULL ) {
+ while (p != NULL) {
i++;
p = p->nextclass;
}
- if ( i ) {
- list = (char**)mir_calloc((i + 1) * sizeof(char*) );
+ if (i) {
+ list = (char**)mir_calloc((i + 1) * sizeof(char*));
p = pluginListSM;
i = 0;
- while ( p != NULL ) {
+ while (p != NULL) {
list[i++] = p->bpi.pluginInfo->shortName;
p = p->nextclass;
}
@@ -606,7 +606,7 @@ char **GetServiceModePluginsList(void) return list;
}
-void SetServiceModePlugin( int idx )
+void SetServiceModePlugin(int idx)
{
serviceModeIdx = idx;
}
@@ -616,20 +616,20 @@ int LoadServiceModePlugin(void) int i = 0;
pluginEntry* p = pluginListSM;
- if ( serviceModeIdx < 0 )
+ if (serviceModeIdx < 0)
return 0;
- while ( p != NULL ) {
- if ( serviceModeIdx == i++ ) {
- if ( p->bpi.Load(&pluginCoreLink) == 0 ) {
+ while (p != NULL) {
+ if (serviceModeIdx == i++) {
+ if (p->bpi.Load(&pluginCoreLink) == 0) {
p->pclass |= PCLASS_LOADED;
- if ( CallService( MS_SERVICEMODE_LAUNCH, 0, 0 ) != CALLSERVICE_NOTFOUND )
+ if (CallService(MS_SERVICEMODE_LAUNCH, 0, 0) != CALLSERVICE_NOTFOUND)
return 1;
MessageBox(NULL, TranslateT("Unable to load plugin in Service Mode!"), p->pluginname, 0);
return -1;
}
- Plugin_Uninit( p );
+ Plugin_Uninit(p);
return -1;
}
p = p->nextclass;
@@ -644,10 +644,10 @@ int LoadServiceModePlugin(void) void UnloadNewPlugins(void)
{
// unload everything but the special db/clist plugins
- for ( int i = pluginList.getCount()-1; i >= 0; i-- ) {
+ for (int i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry* p = pluginList[i];
if ( !(p->pclass & PCLASS_LAST) && (p->pclass & PCLASS_OK))
- Plugin_Uninit( p );
+ Plugin_Uninit(p);
} }
/////////////////////////////////////////////////////////////////////////////////////////
@@ -669,37 +669,37 @@ int LoadNewPluginsModule(void) if (slice) *slice = 0;
// remember some useful options
- askAboutIgnoredPlugins=(UINT) GetPrivateProfileInt( _T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
+ askAboutIgnoredPlugins=(UINT) GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
// if Crash Dumper is present, load it to provide Crash Reports
if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname))
{
- if ( pluginList_crshdmp->bpi.Load(&pluginCoreLink) == 0 )
+ if (pluginList_crshdmp->bpi.Load(&pluginCoreLink) == 0)
pluginList_crshdmp->pclass |= PCLASS_LOADED | PCLASS_LAST;
else
- Plugin_Uninit( pluginList_crshdmp );
+ Plugin_Uninit(pluginList_crshdmp);
}
// if freeimage is present, load it to provide the basic core functions
- if ( pluginList_freeimg != NULL ) {
+ if (pluginList_freeimg != NULL) {
BASIC_PLUGIN_INFO bpi;
mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\Plugins\\%s"), pluginList_freeimg->pluginname);
- if ( checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE) ) {
+ if (checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) {
pluginList_freeimg->bpi = bpi;
pluginList_freeimg->pclass |= PCLASS_OK | PCLASS_BASICAPI;
- if ( bpi.Load(&pluginCoreLink) == 0 )
+ if (bpi.Load(&pluginCoreLink) == 0)
pluginList_freeimg->pclass |= PCLASS_LOADED;
else
- Plugin_Uninit( pluginList_freeimg );
+ Plugin_Uninit(pluginList_freeimg);
} }
// first load the clist cos alot of plugins need that to be present at Load()
- for ( useWhiteList = 1; useWhiteList >= 0 && clist == NULL; useWhiteList-- )
+ for (useWhiteList = 1; useWhiteList >= 0 && clist == NULL; useWhiteList--)
clist=getCListModule(exe, slice, useWhiteList);
/* the loop above will try and get one clist DLL to work, if all fail then just bail now */
- if ( clist == NULL ) {
+ if (clist == NULL) {
// result = 0, no clist_* can be found
- if ( pluginListUI )
+ if (pluginListUI)
MessageBox(NULL, TranslateT("Unable to start any of the installed contact list plugins, I even ignored your preferences for which contact list couldn't load any."), _T("Miranda IM"), MB_OK | MB_ICONINFORMATION);
else
MessageBox(NULL, TranslateT("Can't find a contact list plugin! you need clist_classic or any other clist plugin.") , _T("Miranda IM"), MB_OK | MB_ICONINFORMATION);
@@ -708,23 +708,23 @@ int LoadNewPluginsModule(void) /* enable and disable as needed */
p = pluginListUI;
- while ( p != NULL ) {
- SetPluginOnWhiteList(p->pluginname, clist != p ? 0 : 1 );
+ while (p != NULL) {
+ SetPluginOnWhiteList(p->pluginname, clist != p ? 0 : 1);
p = p->nextclass;
}
/* now loop thru and load all the other plugins, do this in one pass */
- for ( i=0; i < pluginList.getCount(); i++ ) {
+ for (i=0; i < pluginList.getCount(); i++) {
p = pluginList[i];
if ( !TryLoadPlugin(p, false)) {
- Plugin_Uninit( p );
+ Plugin_Uninit(p);
i--;
}
else if (p->pclass & PCLASS_LOADED)
msgModule |= (p->bpi.pluginInfo->replacesDefaultModule == DEFMOD_SRMESSAGE);
}
- if (!msgModule)
+ if ( !msgModule)
MessageBox(NULL, TranslateT("No messaging plugins loaded. Please install/enable one of the messaging plugins, for instance, \"srmm.dll\""), _T("Miranda IM"), MB_OK | MB_ICONINFORMATION);
HookEvent(ME_OPT_INITIALISE, PluginOptionsInit);
@@ -793,27 +793,27 @@ void UnloadNewPluginsModule(void) {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
UnloadPluginOptions();
// unload everything but the DB
- for ( i = pluginList.getCount()-1; i >= 0; i-- ) {
+ for (i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry* p = pluginList[i];
- if ( !(p->pclass & PCLASS_DB) && p != pluginList_crshdmp )
- Plugin_Uninit( p );
+ if ( !(p->pclass & PCLASS_DB) && p != pluginList_crshdmp)
+ Plugin_Uninit(p);
}
- if ( pluginList_crshdmp )
- Plugin_Uninit( pluginList_crshdmp );
+ if (pluginList_crshdmp)
+ Plugin_Uninit(pluginList_crshdmp);
// unload the DB
- for ( i = pluginList.getCount()-1; i >= 0; i-- ) {
+ for (i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry* p = pluginList[i];
- Plugin_Uninit( p );
+ Plugin_Uninit(p);
}
- if ( hPluginListHeap ) HeapDestroy(hPluginListHeap);
+ if (hPluginListHeap) HeapDestroy(hPluginListHeap);
hPluginListHeap=0;
pluginList.destroy();
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 46b7823145..b87c86b8e5 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -55,53 +55,53 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA* fd, TCHAR* path, WPARAM, LPARAM l CharLower(fd->cFileName);
BASIC_PLUGIN_INFO pi;
- if ( checkAPI(buf, &pi, MIRANDA_VERSION_CORE, CHECKAPI_NONE) == 0 )
+ if (checkAPI(buf, &pi, MIRANDA_VERSION_CORE, CHECKAPI_NONE) == 0)
return TRUE;
int isdb = pi.pluginInfo->replacesDefaultModule == DEFMOD_DB;
int isclist = pi.pluginInfo->replacesDefaultModule == DEFMOD_CLISTALL;
- PluginListItemData* dat = (PluginListItemData*)mir_alloc( sizeof( PluginListItemData ));
+ PluginListItemData* dat = (PluginListItemData*)mir_alloc(sizeof(PluginListItemData));
dat->hInst = hInst;
_tcsncpy(dat->fileName, fd->cFileName, SIZEOF(dat->fileName));
HWND hwndList = (HWND)lParam;
LVITEM it = { 0 };
it.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
- it.iImage = ( pi.pluginInfo->flags & 1 ) ? 0 : 1;
+ it.iImage = (pi.pluginInfo->flags & 1) ? 0 : 1;
it.iItem = 100000; // add to the end
it.lParam = (LPARAM)dat;
- int iRow = ListView_InsertItem( hwndList, &it );
- if ( isPluginOnWhiteList(fd->cFileName) )
+ int iRow = ListView_InsertItem(hwndList, &it);
+ if (isPluginOnWhiteList(fd->cFileName))
ListView_SetItemState(hwndList, iRow, !isdb ? 0x2000 : 0x3000, LVIS_STATEIMAGEMASK);
- if ( iRow != -1 ) {
+ if (iRow != -1) {
it.mask = LVIF_IMAGE;
it.iItem = iRow;
it.iSubItem = 1;
- it.iImage = ( hInst != NULL ) ? 2 : 3;
+ it.iImage = (hInst != NULL) ? 2 : 3;
if (isdb || isclist)
it.iImage += 2;
- ListView_SetItem( hwndList, &it );
+ ListView_SetItem(hwndList, &it);
ListView_SetItemText(hwndList, iRow, 2, fd->cFileName);
dat->flags = pi.pluginInfo->replacesDefaultModule;
- dat->author = mir_strdup( pi.pluginInfo->author );
- dat->authorEmail = mir_strdup( pi.pluginInfo->authorEmail );
- dat->copyright = mir_strdup( pi.pluginInfo->copyright );
- dat->description = mir_strdup( pi.pluginInfo->description );
- dat->homepage = mir_strdup( pi.pluginInfo->homepage );
- if ( pi.pluginInfo->cbSize == sizeof( PLUGININFOEX ))
+ dat->author = mir_strdup(pi.pluginInfo->author);
+ dat->authorEmail = mir_strdup(pi.pluginInfo->authorEmail);
+ dat->copyright = mir_strdup(pi.pluginInfo->copyright);
+ dat->description = mir_strdup(pi.pluginInfo->description);
+ dat->homepage = mir_strdup(pi.pluginInfo->homepage);
+ if (pi.pluginInfo->cbSize == sizeof(PLUGININFOEX))
dat->uuid = pi.pluginInfo->uuid;
else
- memset( &dat->uuid, 0, sizeof(dat->uuid));
+ memset(&dat->uuid, 0, sizeof(dat->uuid));
TCHAR *shortNameT = mir_a2t(pi.pluginInfo->shortName);
ListView_SetItemText(hwndList, iRow, 3, shortNameT);
mir_free(shortNameT);
DWORD unused, verInfoSize = GetFileVersionInfoSize(buf, &unused);
- if ( verInfoSize != 0 ) {
+ if (verInfoSize != 0) {
UINT blockSize;
VS_FIXEDFILEINFO* fi;
void* pVerInfo = mir_alloc(verInfoSize);
@@ -109,7 +109,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA* fd, TCHAR* path, WPARAM, LPARAM l VerQueryValue(pVerInfo, _T("\\"), (LPVOID*)&fi, &blockSize);
mir_sntprintf(buf, SIZEOF(buf), _T("%d.%d.%d.%d"), HIWORD(fi->dwProductVersionMS),
LOWORD(fi->dwProductVersionMS), HIWORD(fi->dwProductVersionLS), LOWORD(fi->dwProductVersionLS));
- mir_free( pVerInfo );
+ mir_free(pVerInfo);
}
else
mir_sntprintf(buf, SIZEOF(buf), _T("%d.%d.%d.%d"), HIBYTE(HIWORD(pi.pluginInfo->version)),
@@ -118,32 +118,32 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA* fd, TCHAR* path, WPARAM, LPARAM l ListView_SetItemText(hwndList, iRow, 4, buf);
}
- else mir_free( dat );
+ else mir_free(dat);
FreeLibrary(pi.hInst);
return TRUE;
}
static int uuidToString(const MUUID uuid, char *szStr, int cbLen)
{
- if (cbLen<1||!szStr) return 0;
+ if (cbLen<1 || !szStr) return 0;
mir_snprintf(szStr, cbLen, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
uuid.a, uuid.b, uuid.c, uuid.d[0], uuid.d[1], uuid.d[2], uuid.d[3], uuid.d[4], uuid.d[5], uuid.d[6], uuid.d[7]);
return 1;
}
-static void RemoveAllItems( HWND hwnd )
+static void RemoveAllItems(HWND hwnd)
{
LVITEM lvi;
lvi.mask = LVIF_PARAM;
lvi.iItem = 0;
- while ( ListView_GetItem( hwnd, &lvi )) {
- PluginListItemData* dat = ( PluginListItemData* )lvi.lParam;
- mir_free( dat->author );
- mir_free( dat->authorEmail );
- mir_free( dat->copyright );
- mir_free( dat->description );
- mir_free( dat->homepage );
- mir_free( dat );
+ while (ListView_GetItem(hwnd, &lvi)) {
+ PluginListItemData* dat = (PluginListItemData*)lvi.lParam;
+ mir_free(dat->author);
+ mir_free(dat->authorEmail);
+ mir_free(dat->copyright);
+ mir_free(dat->description);
+ mir_free(dat->homepage);
+ mir_free(dat);
lvi.iItem ++;
} }
@@ -163,7 +163,7 @@ LBL_Error: if ( !TryLoadPlugin(pPlug, true))
goto LBL_Error;
- if ( CallPluginEventHook(pPlug->bpi.hInst, hModulesLoadedEvent, 0, 0) != 0)
+ if (CallPluginEventHook(pPlug->bpi.hInst, hModulesLoadedEvent, 0, 0) != 0)
goto LBL_Error;
dat->hInst = pPlug->bpi.hInst;
@@ -181,7 +181,7 @@ static int UnloadPluginDynamically(PluginListItemData* dat) return FALSE;
pluginEntry* pPlug = pluginList[idx];
- if ( CallPluginEventHook(pPlug->bpi.hInst, hOkToExitEvent, 0, 0) != 0)
+ if (CallPluginEventHook(pPlug->bpi.hInst, hOkToExitEvent, 0, 0) != 0)
return FALSE;
CallHookSubscribers(hevUnloadModule, (WPARAM)pPlug->bpi.InfoEx, (LPARAM)pPlug->bpi.hInst);
@@ -200,29 +200,29 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP LVHITTESTINFO hi;
hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam);
ListView_SubItemHitTest(hwnd, &hi);
- if ( hi.iSubItem == 1 ) {
+ if (hi.iSubItem == 1) {
LVITEM lvi = {0};
lvi.mask = LVIF_IMAGE | LVIF_PARAM;
lvi.stateMask = -1;
lvi.iItem = hi.iItem;
lvi.iSubItem = 1;
- if ( ListView_GetItem( hwnd, &lvi )) {
+ if (ListView_GetItem(hwnd, &lvi)) {
lvi.mask = LVIF_IMAGE;
- PluginListItemData* dat = ( PluginListItemData* )lvi.lParam;
+ PluginListItemData* dat = (PluginListItemData*)lvi.lParam;
if (lvi.iImage == 3) {
- if ( LoadPluginDynamically(dat)) {
+ if (LoadPluginDynamically(dat)) {
lvi.iImage = 2;
ListView_SetItem(hwnd, &lvi);
}
}
else if (lvi.iImage == 2) {
- if ( UnloadPluginDynamically(dat)) {
+ if (UnloadPluginDynamically(dat)) {
lvi.iImage = 3;
ListView_SetItem(hwnd, &lvi);
} } } } }
- WNDPROC wnProc = ( WNDPROC )GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ WNDPROC wnProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
return CallWindowProc(wnProc, hwnd, msg, wParam, lParam);
}
@@ -268,102 +268,102 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_InsertColumn(hwndList, 4, &col);
// XXX: Won't work on windows 95 without IE3+ or 4.70
- ListView_SetExtendedListViewStyleEx( hwndList, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT );
+ ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT);
// scan the plugin dir for plugins, cos
- enumPlugins( dialogListPlugins, ( WPARAM )hwndDlg, ( LPARAM )hwndList );
+ enumPlugins(dialogListPlugins, (WPARAM)hwndDlg, (LPARAM)hwndList);
// sort out the headers
- ListView_SetColumnWidth( hwndList, 2, LVSCW_AUTOSIZE ); // dll name
- int w = ListView_GetColumnWidth( hwndList, 2 );
+ ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); // dll name
+ int w = ListView_GetColumnWidth(hwndList, 2);
if (w > 110) {
- ListView_SetColumnWidth( hwndList, 2, 110 );
+ ListView_SetColumnWidth(hwndList, 2, 110);
w = 110;
}
int max = w < 110 ? 199+110-w:199;
- ListView_SetColumnWidth( hwndList, 3, LVSCW_AUTOSIZE ); // short name
- w = ListView_GetColumnWidth( hwndList, 3 );
+ ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); // short name
+ w = ListView_GetColumnWidth(hwndList, 3);
if (w > max)
- ListView_SetColumnWidth( hwndList, 3, max );
+ ListView_SetColumnWidth(hwndList, 3, max);
}
return TRUE;
case WM_NOTIFY:
- if ( lParam ) {
+ if (lParam) {
NMLISTVIEW * hdr = (NMLISTVIEW *) lParam;
- if ( hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom)) {
- if (hdr->uOldState != 0 && (hdr->uNewState == 0x1000 || hdr->uNewState == 0x2000 )) {
+ if (hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom)) {
+ if (hdr->uOldState != 0 && (hdr->uNewState == 0x1000 || hdr->uNewState == 0x2000)) {
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
LVITEM it;
it.mask = LVIF_PARAM | LVIF_STATE;
it.iItem = hdr->iItem;
- if ( !ListView_GetItem( hwndList, &it ))
+ if ( !ListView_GetItem(hwndList, &it))
break;
- PluginListItemData* dat = ( PluginListItemData* )it.lParam;
- if ( dat->flags == DEFMOD_DB ) {
+ PluginListItemData* dat = (PluginListItemData*)it.lParam;
+ if (dat->flags == DEFMOD_DB) {
ListView_SetItemState(hwndList, hdr->iItem, 0x3000, LVIS_STATEIMAGEMASK);
return FALSE;
}
// if enabling and replaces, find all other replaces and toggle off
- if (( hdr->uNewState & 0x2000) && dat->flags != 0 ) {
- for ( int iRow=0; iRow != -1; ) {
- if ( iRow != hdr->iItem ) {
+ if ((hdr->uNewState & 0x2000) && dat->flags != 0) {
+ for (int iRow=0; iRow != -1;) {
+ if (iRow != hdr->iItem) {
LVITEM dt;
dt.mask = LVIF_PARAM;
dt.iItem = iRow;
- if ( ListView_GetItem( hwndList, &dt )) {
- PluginListItemData* dat2 = ( PluginListItemData* )dt.lParam;
- if ( dat2->flags == dat->flags ) {
+ if (ListView_GetItem(hwndList, &dt)) {
+ PluginListItemData* dat2 = (PluginListItemData*)dt.lParam;
+ if (dat2->flags == dat->flags) {
// the lParam is unset, so when the check is unset the clist block doesnt trigger
int lParam = dat2->flags;
dat2->flags = 0;
- ListView_SetItemState(hwndList, iRow, 0x1000, LVIS_STATEIMAGEMASK );
+ ListView_SetItemState(hwndList, iRow, 0x1000, LVIS_STATEIMAGEMASK);
dat2->flags = lParam;
} } }
- iRow = ListView_GetNextItem( hwndList, iRow, LVNI_ALL );
+ iRow = ListView_GetNextItem(hwndList, iRow, LVNI_ALL);
} }
- ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART ), TRUE );
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), TRUE);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
- if ( hdr->iItem != -1 ) {
+ if (hdr->iItem != -1) {
TCHAR buf[1024];
int sel = hdr->uNewState & LVIS_SELECTED;
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
LVITEM lvi = { 0 };
lvi.mask = LVIF_PARAM;
lvi.iItem = hdr->iItem;
- if ( ListView_GetItem( hwndList, &lvi )) {
- PluginListItemData* dat = ( PluginListItemData* )lvi.lParam;
+ if (ListView_GetItem(hwndList, &lvi)) {
+ PluginListItemData* dat = (PluginListItemData*)lvi.lParam;
ListView_GetItemText(hwndList, hdr->iItem, 1, buf, SIZEOF(buf));
SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGININFOFRAME), sel ? buf : _T(""));
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), sel ? dat->author : "" );
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), sel ? dat->authorEmail : "" );
+ SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), sel ? dat->author : "");
+ SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), sel ? dat->authorEmail : "");
{
- TCHAR* p = LangPackPcharToTchar( dat->description );
+ TCHAR* p = LangPackPcharToTchar(dat->description);
SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? p : _T(""));
- mir_free( p );
+ mir_free(p);
}
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINCPYR), sel ? dat->copyright : "" );
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINURL), sel ? dat->homepage : "" );
+ SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINCPYR), sel ? dat->copyright : "");
+ SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINURL), sel ? dat->homepage : "");
if (equalUUID(miid_last, dat->uuid))
SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? TranslateT("<none>") : _T(""));
else {
char szUID[128];
- uuidToString( dat->uuid, szUID, sizeof(szUID));
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? szUID : "" );
+ uuidToString(dat->uuid, szUID, sizeof(szUID));
+ SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? szUID : "");
} } } }
- if ( hdr->hdr.code == PSN_APPLY ) {
+ if (hdr->hdr.code == PSN_APPLY) {
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
TCHAR buf[1024];
- for (int iRow=0; iRow != -1; ) {
+ for (int iRow=0; iRow != -1;) {
ListView_GetItemText(hwndList, iRow, 2, buf, SIZEOF(buf));
int iState = ListView_GetItemState(hwndList, iRow, LVIS_STATEIMAGEMASK);
SetPluginOnWhiteList(buf, (iState & 0x2000) ? 1 : 0);
@@ -372,7 +372,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break;
case WM_COMMAND:
- if ( HIWORD(wParam) == STN_CLICKED ) {
+ if (HIWORD(wParam) == STN_CLICKED) {
switch (LOWORD(wParam)) {
case IDC_PLUGINEMAIL:
case IDC_PLUGINURL:
@@ -380,18 +380,18 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char buf[512];
char *p = &buf[7];
lstrcpyA(buf, "mailto:");
- if ( GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) (LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p) );
+ if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7))
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM) (LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p));
break;
}
case IDC_GETMOREPLUGINS:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://addons.miranda-im.org/index.php?action=display&id=1" );
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://addons.miranda-im.org/index.php?action=display&id=1");
break;
} }
break;
case WM_DESTROY:
- RemoveAllItems( GetDlgItem( hwndDlg, IDC_PLUGLIST ));
+ RemoveAllItems(GetDlgItem(hwndDlg, IDC_PLUGLIST));
break;
}
return FALSE;
@@ -409,7 +409,7 @@ int PluginOptionsInit(WPARAM wParam, LPARAM) odp.position = 1300000000;
odp.pszTitle = LPGEN("Plugins");
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/plugins/plugins.h b/src/modules/plugins/plugins.h index 00033c8142..6b03fad7c0 100644 --- a/src/modules/plugins/plugins.h +++ b/src/modules/plugins/plugins.h @@ -9,16 +9,16 @@ #define DEFMOD_REMOVED_PROTOCOLNETLIB 22
// basic export prototypes
-typedef int (__cdecl * Miranda_Plugin_Load) ( PLUGINLINK * );
-typedef int (__cdecl * Miranda_Plugin_Unload) ( void );
+typedef int (__cdecl * Miranda_Plugin_Load) (PLUGINLINK *);
+typedef int (__cdecl * Miranda_Plugin_Unload) (void);
// version control
-typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) ( DWORD mirandaVersion );
+typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) (DWORD mirandaVersion);
// prototype for databases
-typedef DATABASELINK * (__cdecl * Database_Plugin_Info) ( void * reserved );
+typedef DATABASELINK * (__cdecl * Database_Plugin_Info) (void * reserved);
// prototype for clists
-typedef int (__cdecl * CList_Initialise) ( PLUGINLINK * );
+typedef int (__cdecl * CList_Initialise) (PLUGINLINK *);
// Interface support
-typedef MUUID * (__cdecl * Miranda_Plugin_Interfaces) ( void );
+typedef MUUID * (__cdecl * Miranda_Plugin_Interfaces) (void);
typedef struct { // can all be NULL
HINSTANCE hInst;
@@ -66,5 +66,5 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path); bool TryLoadPlugin(pluginEntry *p, bool bDynamic);
void Plugin_Uninit(pluginEntry* p, bool bDynamic=false);
-typedef BOOL (*SCAN_PLUGINS_CALLBACK) ( WIN32_FIND_DATA * fd, TCHAR * path, WPARAM wParam, LPARAM lParam );
+typedef BOOL (*SCAN_PLUGINS_CALLBACK) (WIN32_FIND_DATA * fd, TCHAR * path, WPARAM wParam, LPARAM lParam);
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index ccb88a3269..891474baed 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -30,32 +30,32 @@ void BuildProtoMenus(); static BOOL bModuleInitialized = FALSE;
-static int CompareAccounts( const PROTOACCOUNT* p1, const PROTOACCOUNT* p2 )
+static int CompareAccounts(const PROTOACCOUNT* p1, const PROTOACCOUNT* p2)
{
- return lstrcmpA( p1->szModuleName, p2->szModuleName );
+ return lstrcmpA(p1->szModuleName, p2->szModuleName);
}
-LIST<PROTOACCOUNT> accounts( 10, CompareAccounts );
+LIST<PROTOACCOUNT> accounts(10, CompareAccounts);
/////////////////////////////////////////////////////////////////////////////////////////
static int EnumDbModules(const char *szModuleName, DWORD ofsModuleName, LPARAM lParam)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString( NULL, szModuleName, "AM_BaseProto", &dbv )) {
- if (!Proto_GetAccount( szModuleName )) {
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )mir_calloc( sizeof( PROTOACCOUNT ));
- pa->cbSize = sizeof( *pa );
+ if ( !DBGetContactSettingString(NULL, szModuleName, "AM_BaseProto", &dbv)) {
+ if ( !Proto_GetAccount(szModuleName)) {
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
+ pa->cbSize = sizeof(*pa);
pa->type = PROTOTYPE_PROTOCOL;
- pa->szModuleName = mir_strdup( szModuleName );
- pa->szProtoName = mir_strdup( dbv.pszVal );
- pa->tszAccountName = mir_a2t( szModuleName );
+ pa->szModuleName = mir_strdup(szModuleName);
+ pa->szProtoName = mir_strdup(dbv.pszVal);
+ pa->tszAccountName = mir_a2t(szModuleName);
pa->bIsVisible = TRUE;
pa->bIsEnabled = FALSE;
pa->iOrder = accounts.getCount();
- accounts.insert( pa );
+ accounts.insert(pa);
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
return 0;
}
@@ -63,58 +63,58 @@ static int EnumDbModules(const char *szModuleName, DWORD ofsModuleName, LPARAM l void LoadDbAccounts(void)
{
DBVARIANT dbv;
- int ver = DBGetContactSettingDword( NULL, "Protocols", "PrVer", -1 );
- int count = DBGetContactSettingDword( NULL, "Protocols", "ProtoCount", 0 ), i;
+ int ver = DBGetContactSettingDword(NULL, "Protocols", "PrVer", -1);
+ int count = DBGetContactSettingDword(NULL, "Protocols", "ProtoCount", 0), i;
- for ( i=0; i < count; i++ ) {
+ for (i=0; i < count; i++) {
char buf[10];
- _itoa( i, buf, 10 );
- if ( DBGetContactSettingString( NULL, "Protocols", buf, &dbv ))
+ _itoa(i, buf, 10);
+ if (DBGetContactSettingString(NULL, "Protocols", buf, &dbv))
continue;
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )mir_calloc( sizeof( PROTOACCOUNT ));
- if ( pa == NULL ) {
- DBFreeVariant( &dbv );
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
+ if (pa == NULL) {
+ DBFreeVariant(&dbv);
continue;
}
- pa->cbSize = sizeof( *pa );
+ pa->cbSize = sizeof(*pa);
pa->type = PROTOTYPE_PROTOCOL;
- pa->szModuleName = mir_strdup( dbv.pszVal );
- DBFreeVariant( &dbv );
+ pa->szModuleName = mir_strdup(dbv.pszVal);
+ DBFreeVariant(&dbv);
- _itoa( OFFSET_VISIBLE+i, buf, 10 );
- pa->bIsVisible = DBGetContactSettingDword( NULL, "Protocols", buf, 1 );
+ _itoa(OFFSET_VISIBLE+i, buf, 10);
+ pa->bIsVisible = DBGetContactSettingDword(NULL, "Protocols", buf, 1);
- _itoa( OFFSET_PROTOPOS+i, buf, 10 );
- pa->iOrder = DBGetContactSettingDword( NULL, "Protocols", buf, 1 );
+ _itoa(OFFSET_PROTOPOS+i, buf, 10);
+ pa->iOrder = DBGetContactSettingDword(NULL, "Protocols", buf, 1);
- if ( ver >= 4 ) {
- DBFreeVariant( &dbv );
- _itoa( OFFSET_NAME+i, buf, 10 );
- if ( !DBGetContactSettingTString( NULL, "Protocols", buf, &dbv )) {
- pa->tszAccountName = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if (ver >= 4) {
+ DBFreeVariant(&dbv);
+ _itoa(OFFSET_NAME+i, buf, 10);
+ if ( !DBGetContactSettingTString(NULL, "Protocols", buf, &dbv)) {
+ pa->tszAccountName = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- _itoa( OFFSET_ENABLED+i, buf, 10 );
- pa->bIsEnabled = DBGetContactSettingDword( NULL, "Protocols", buf, 1 );
+ _itoa(OFFSET_ENABLED+i, buf, 10);
+ pa->bIsEnabled = DBGetContactSettingDword(NULL, "Protocols", buf, 1);
- if ( !DBGetContactSettingString( NULL, pa->szModuleName, "AM_BaseProto", &dbv )) {
- pa->szProtoName = mir_strdup( dbv.pszVal );
- DBFreeVariant( &dbv );
+ if ( !DBGetContactSettingString(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) {
+ pa->szProtoName = mir_strdup(dbv.pszVal);
+ DBFreeVariant(&dbv);
}
}
else pa->bIsEnabled = TRUE;
- if ( !pa->szProtoName ) {
- pa->szProtoName = mir_strdup( pa->szModuleName );
- DBWriteContactSettingString( NULL, pa->szModuleName, "AM_BaseProto", pa->szProtoName );
+ if ( !pa->szProtoName) {
+ pa->szProtoName = mir_strdup(pa->szModuleName);
+ DBWriteContactSettingString(NULL, pa->szModuleName, "AM_BaseProto", pa->szProtoName);
}
- if ( !pa->tszAccountName )
- pa->tszAccountName = mir_a2t( pa->szModuleName );
+ if ( !pa->tszAccountName)
+ pa->tszAccountName = mir_a2t(pa->szModuleName);
- accounts.insert( pa );
+ accounts.insert(pa);
}
if (CheckProtocolOrder()) WriteDbAccounts();
@@ -133,14 +133,14 @@ typedef struct }
enumDB_ProtoProcParam;
-static int enumDB_ProtoProc( const char* szSetting, LPARAM lParam )
+static int enumDB_ProtoProc(const char* szSetting, LPARAM lParam)
{
- if ( szSetting ) {
- enumDB_ProtoProcParam* p = ( enumDB_ProtoProcParam* )lParam;
+ if (szSetting) {
+ enumDB_ProtoProcParam* p = (enumDB_ProtoProcParam*)lParam;
p->arrlen++;
- p->pszSettingName = ( char** )mir_realloc( p->pszSettingName, p->arrlen*sizeof( char* ));
- p->pszSettingName[ p->arrlen-1 ] = mir_strdup( szSetting );
+ p->pszSettingName = (char**)mir_realloc(p->pszSettingName, p->arrlen*sizeof(char*));
+ p->pszSettingName[ p->arrlen-1 ] = mir_strdup(szSetting);
}
return 0;
}
@@ -156,43 +156,43 @@ void WriteDbAccounts() dbces.pfnEnumProc = enumDB_ProtoProc;
dbces.szModule = "Protocols";
dbces.ofsSettings = 0;
- dbces.lParam = ( LPARAM )¶m;
- CallService( MS_DB_CONTACT_ENUMSETTINGS, 0, ( LPARAM )&dbces );
+ dbces.lParam = (LPARAM)¶m;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
// delete all settings
- if ( param.arrlen ) {
+ if (param.arrlen) {
int i;
- for ( i=0; i < param.arrlen; i++ ) {
- DBDeleteContactSetting( 0, "Protocols", param.pszSettingName[i] );
- mir_free( param.pszSettingName[i] );
+ for (i=0; i < param.arrlen; i++) {
+ DBDeleteContactSetting(0, "Protocols", param.pszSettingName[i]);
+ mir_free(param.pszSettingName[i]);
}
- mir_free( param.pszSettingName );
+ mir_free(param.pszSettingName);
}
// write new data
- for ( i=0; i < accounts.getCount(); i++ ) {
+ for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
char buf[ 20 ];
- _itoa( i, buf, 10 );
- DBWriteContactSettingString( NULL, "Protocols", buf, pa->szModuleName );
+ _itoa(i, buf, 10);
+ DBWriteContactSettingString(NULL, "Protocols", buf, pa->szModuleName);
- _itoa( OFFSET_PROTOPOS+i, buf, 10 );
- DBWriteContactSettingDword( NULL, "Protocols", buf, pa->iOrder );
+ _itoa(OFFSET_PROTOPOS+i, buf, 10);
+ DBWriteContactSettingDword(NULL, "Protocols", buf, pa->iOrder);
- _itoa( OFFSET_VISIBLE+i, buf, 10 );
- DBWriteContactSettingDword( NULL, "Protocols", buf, pa->bIsVisible );
+ _itoa(OFFSET_VISIBLE+i, buf, 10);
+ DBWriteContactSettingDword(NULL, "Protocols", buf, pa->bIsVisible);
- _itoa( OFFSET_ENABLED+i, buf, 10 );
- DBWriteContactSettingDword( NULL, "Protocols", buf, pa->bIsEnabled );
+ _itoa(OFFSET_ENABLED+i, buf, 10);
+ DBWriteContactSettingDword(NULL, "Protocols", buf, pa->bIsEnabled);
- _itoa( OFFSET_NAME+i, buf, 10 );
- DBWriteContactSettingTString( NULL, "Protocols", buf, pa->tszAccountName );
+ _itoa(OFFSET_NAME+i, buf, 10);
+ DBWriteContactSettingTString(NULL, "Protocols", buf, pa->tszAccountName);
}
- DBDeleteContactSetting( 0, "Protocols", "ProtoCount" );
- DBWriteContactSettingDword( 0, "Protocols", "ProtoCount", accounts.getCount() );
- DBWriteContactSettingDword( 0, "Protocols", "PrVer", 4 );
+ DBDeleteContactSetting(0, "Protocols", "ProtoCount");
+ DBWriteContactSettingDword(0, "Protocols", "ProtoCount", accounts.getCount());
+ DBWriteContactSettingDword(0, "Protocols", "PrVer", 4);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -221,161 +221,161 @@ static int OnDbSettingsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-static int InitializeStaticAccounts( WPARAM, LPARAM )
+static int InitializeStaticAccounts(WPARAM, LPARAM)
{
int count = 0;
- for ( int i = 0; i < accounts.getCount(); i++ ) {
+ for (int i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !pa->ppro || !Proto_IsAccountEnabled( pa ))
+ if ( !pa->ppro || !Proto_IsAccountEnabled(pa))
continue;
- pa->ppro->OnEvent( EV_PROTO_ONLOAD, 0, 0 );
+ pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
- if ( !pa->bOldProto )
+ if ( !pa->bOldProto)
count++;
}
BuildProtoMenus();
- if ( count == 0 && !DBGetContactSettingByte( NULL, "FirstRun", "AccManager", 0 )) {
- DBWriteContactSettingByte( NULL, "FirstRun", "AccManager", 1 );
- CallService( MS_PROTO_SHOWACCMGR, 0, 0 );
+ if (count == 0 && !DBGetContactSettingByte(NULL, "FirstRun", "AccManager", 0)) {
+ DBWriteContactSettingByte(NULL, "FirstRun", "AccManager", 1);
+ CallService(MS_PROTO_SHOWACCMGR, 0, 0);
}
return 0;
}
-static int UninitializeStaticAccounts( WPARAM, LPARAM )
+static int UninitializeStaticAccounts(WPARAM, LPARAM)
{
- for ( int i = 0; i < accounts.getCount(); i++ ) {
+ for (int i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !pa->ppro || !Proto_IsAccountEnabled( pa ))
+ if ( !pa->ppro || !Proto_IsAccountEnabled(pa))
continue;
- pa->ppro->OnEvent( EV_PROTO_ONREADYTOEXIT, 0, 0 );
- pa->ppro->OnEvent( EV_PROTO_ONEXIT, 0, 0 );
+ pa->ppro->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0);
+ pa->ppro->OnEvent(EV_PROTO_ONEXIT, 0, 0);
}
return 0;
}
-int LoadAccountsModule( void )
+int LoadAccountsModule(void)
{
int i;
bModuleInitialized = TRUE;
- for ( i = 0; i < accounts.getCount(); i++ ) {
+ for (i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- pa->bDynDisabled = !Proto_IsProtocolLoaded( pa->szProtoName );
- if ( pa->ppro )
+ pa->bDynDisabled = !Proto_IsProtocolLoaded(pa->szProtoName);
+ if (pa->ppro)
continue;
- if (!Proto_IsAccountEnabled( pa )) {
+ if ( !Proto_IsAccountEnabled(pa)) {
pa->type = PROTOTYPE_DISPROTO;
continue;
}
- if ( !ActivateAccount( pa )) {
+ if ( !ActivateAccount(pa)) {
pa->bDynDisabled = TRUE;
pa->type = PROTOTYPE_DISPROTO;
} }
- HookEvent( ME_SYSTEM_MODULESLOADED, InitializeStaticAccounts );
- HookEvent( ME_SYSTEM_PRESHUTDOWN, UninitializeStaticAccounts );
- HookEvent( ME_DB_CONTACT_DELETED, OnContactDeleted );
- HookEvent( ME_DB_CONTACT_SETTINGCHANGED, OnDbSettingsChanged );
+ HookEvent(ME_SYSTEM_MODULESLOADED, InitializeStaticAccounts);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, UninitializeStaticAccounts);
+ HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnDbSettingsChanged);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR stub1( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ return ( INT_PTR )ppi->AddToList( wParam, (PROTOSEARCHRESULT*)lParam );
+static INT_PTR stub1(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
}
-static INT_PTR stub2( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ return ( INT_PTR )ppi->AddToListByEvent( HIWORD(wParam), LOWORD(wParam), (HANDLE)lParam );
+static INT_PTR stub2(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)ppi->AddToListByEvent(HIWORD(wParam), LOWORD(wParam), (HANDLE)lParam);
}
-static INT_PTR stub3( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM )
-{ return ( INT_PTR )ppi->Authorize(( HANDLE )wParam );
+static INT_PTR stub3(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM)
+{ return (INT_PTR)ppi->Authorize((HANDLE)wParam);
}
-static INT_PTR stub4( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, StrConvT(( const char* )lParam ));
+static INT_PTR stub4(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvT((const char*)lParam));
}
-static INT_PTR stub7( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ return ( INT_PTR )ppi->ChangeInfo( wParam, ( void* )lParam );
+static INT_PTR stub7(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)ppi->ChangeInfo(wParam, (void*)lParam);
}
-static INT_PTR stub11( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ PROTOFILERESUME* pfr = ( PROTOFILERESUME* )lParam;
- return ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename );
+static INT_PTR stub11(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
}
-static INT_PTR stub12( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ return ( INT_PTR )ppi->GetCaps( wParam, (HANDLE)lParam );
+static INT_PTR stub12(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)ppi->GetCaps(wParam, (HANDLE)lParam);
}
-static INT_PTR stub13( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM )
-{ return ( INT_PTR )ppi->GetIcon( wParam );
+static INT_PTR stub13(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM)
+{ return (INT_PTR)ppi->GetIcon(wParam);
}
-static INT_PTR stub15( PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam )
-{ return ( INT_PTR )ppi->SearchBasic( StrConvT(( char* )lParam ));
+static INT_PTR stub15(PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam)
+{ return (INT_PTR)ppi->SearchBasic(StrConvT((char*)lParam));
}
-static INT_PTR stub16( PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam )
-{ return ( INT_PTR )ppi->SearchByEmail( StrConvT(( char* )lParam ));
+static INT_PTR stub16(PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam)
+{ return (INT_PTR)ppi->SearchByEmail(StrConvT((char*)lParam));
}
-static INT_PTR stub17( PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam )
-{ PROTOSEARCHBYNAME* psbn = ( PROTOSEARCHBYNAME* )lParam;
- return ( INT_PTR )ppi->SearchByName( StrConvT(( char* )psbn->pszNick ),
- StrConvT(( char* )psbn->pszFirstName ), StrConvT(( char* )psbn->pszLastName ));
+static INT_PTR stub17(PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam)
+{ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ return (INT_PTR)ppi->SearchByName(StrConvT((char*)psbn->pszNick),
+ StrConvT((char*)psbn->pszFirstName), StrConvT((char*)psbn->pszLastName));
}
-static INT_PTR stub18( PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam )
-{ return ( INT_PTR )ppi->SearchAdvanced(( HWND )lParam );
+static INT_PTR stub18(PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam)
+{ return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
}
-static INT_PTR stub19( PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam )
-{ return ( INT_PTR )ppi->CreateExtendedSearchUI (( HWND )lParam );
+static INT_PTR stub19(PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam)
+{ return (INT_PTR)ppi->CreateExtendedSearchUI ((HWND)lParam);
}
-static INT_PTR stub22( PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam )
-{ CCSDATA *ccs = ( CCSDATA* )lParam;
- ppi->RecvMsg( ccs->hContact, ( PROTORECVEVENT* )ccs->lParam );
+static INT_PTR stub22(PROTO_INTERFACE* ppi, WPARAM, LPARAM lParam)
+{ CCSDATA *ccs = (CCSDATA*)lParam;
+ ppi->RecvMsg(ccs->hContact, (PROTORECVEVENT*)ccs->lParam);
return 0;
}
-static INT_PTR stub29( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM )
-{ return ( INT_PTR )ppi->SetStatus( wParam );
+static INT_PTR stub29(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM)
+{ return (INT_PTR)ppi->SetStatus(wParam);
}
-static INT_PTR stub33( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ return ( INT_PTR )ppi->SetAwayMsg( wParam, StrConvT(( const char* )lParam ));
+static INT_PTR stub33(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvT((const char*)lParam));
}
-static INT_PTR stub41( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
-{ lstrcpynA(( char* )lParam, ppi->m_szModuleName, wParam );
+static INT_PTR stub41(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
+{ lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam);
return 0;
}
-static INT_PTR stub42( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
+static INT_PTR stub42(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{ return ppi->m_iStatus;
}
-static INT_PTR stub43( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
+static INT_PTR stub43(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* p = ( PROTO_AVATAR_INFORMATION* )lParam;
+ PROTO_AVATAR_INFORMATION* p = (PROTO_AVATAR_INFORMATION*)lParam;
PROTO_AVATAR_INFORMATIONW tmp = { 0 };
- tmp.cbSize = sizeof( tmp );
+ tmp.cbSize = sizeof(tmp);
tmp.hContact = p->hContact;
- int result = CallProtoService( ppi->m_szModuleName, PS_GETAVATARINFOW, wParam, ( LPARAM )&tmp );
+ int result = CallProtoService(ppi->m_szModuleName, PS_GETAVATARINFOW, wParam, (LPARAM)&tmp);
p->format = tmp.format;
@@ -383,96 +383,96 @@ static INT_PTR stub43( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam ) wcscpy(filename, tmp.filename);
GetShortPathNameW(tmp.filename, filename, SIZEOF(filename));
- WideCharToMultiByte( CP_ACP, 0, filename, -1, p->filename, MAX_PATH, 0, 0 );
+ WideCharToMultiByte(CP_ACP, 0, filename, -1, p->filename, MAX_PATH, 0, 0);
return result;
}
-static INT_PTR stub44( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
+static INT_PTR stub44(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{
- wchar_t* buf = ( wchar_t* )_alloca( sizeof(wchar_t) * (lParam + 1));
- int result = CallProtoService( ppi->m_szModuleName, PS_GETMYAVATARW, WPARAM( buf ), lParam );
- if ( result == 0 )
+ wchar_t* buf = (wchar_t*)_alloca(sizeof(wchar_t) * (lParam + 1));
+ int result = CallProtoService(ppi->m_szModuleName, PS_GETMYAVATARW, WPARAM(buf), lParam);
+ if (result == 0)
{
- wchar_t* filename = ( wchar_t* )_alloca( sizeof(wchar_t) * (lParam + 1));
+ wchar_t* filename = (wchar_t*)_alloca(sizeof(wchar_t) * (lParam + 1));
wcscpy(filename, buf);
GetShortPathNameW(buf, filename, lParam + 1);
- WideCharToMultiByte( CP_ACP, 0, filename, -1, ( char* )wParam, lParam, 0, 0 );
+ WideCharToMultiByte(CP_ACP, 0, filename, -1, (char*)wParam, lParam, 0, 0);
}
return result;
}
-static INT_PTR stub45( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
+static INT_PTR stub45(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{
- return CallProtoService( ppi->m_szModuleName, PS_SETMYAVATARW, wParam, ( LPARAM )( LPCTSTR )StrConvT(( char* )lParam ));
+ return CallProtoService(ppi->m_szModuleName, PS_SETMYAVATARW, wParam, (LPARAM)(LPCTSTR)StrConvT((char*)lParam));
}
-static HANDLE CreateProtoServiceEx( const char* szModule, const char* szService, MIRANDASERVICEOBJ pFunc, void* param )
+static HANDLE CreateProtoServiceEx(const char* szModule, const char* szService, MIRANDASERVICEOBJ pFunc, void* param)
{
char tmp[100];
- mir_snprintf( tmp, sizeof( tmp ), "%s%s", szModule, szService );
- return CreateServiceFunctionObj( tmp, pFunc, param );
+ mir_snprintf(tmp, sizeof(tmp), "%s%s", szModule, szService);
+ return CreateServiceFunctionObj(tmp, pFunc, param);
}
-BOOL ActivateAccount( PROTOACCOUNT* pa )
+BOOL ActivateAccount(PROTOACCOUNT* pa)
{
PROTO_INTERFACE* ppi;
- PROTOCOLDESCRIPTOR* ppd = Proto_IsProtocolLoaded( pa->szProtoName );
- if ( ppd == NULL )
+ PROTOCOLDESCRIPTOR* ppd = Proto_IsProtocolLoaded(pa->szProtoName);
+ if (ppd == NULL)
return FALSE;
- if ( ppd->fnInit == NULL )
+ if (ppd->fnInit == NULL)
return FALSE;
- ppi = ppd->fnInit( pa->szModuleName, pa->tszAccountName );
- if ( ppi == NULL )
+ ppi = ppd->fnInit(pa->szModuleName, pa->tszAccountName);
+ if (ppi == NULL)
return FALSE;
pa->type = PROTOTYPE_PROTOCOL;
pa->ppro = ppi;
ppi->m_iDesiredStatus = ppi->m_iStatus = ID_STATUS_OFFLINE;
- CreateProtoServiceEx( pa->szModuleName, PS_ADDTOLIST, (MIRANDASERVICEOBJ)stub1, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_ADDTOLISTBYEVENT, (MIRANDASERVICEOBJ)stub2, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_AUTHALLOW, (MIRANDASERVICEOBJ)stub3, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_AUTHDENY, (MIRANDASERVICEOBJ)stub4, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_CHANGEINFO, (MIRANDASERVICEOBJ)stub7, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_FILERESUME, (MIRANDASERVICEOBJ)stub11, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_GETCAPS, (MIRANDASERVICEOBJ)stub12, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_LOADICON, (MIRANDASERVICEOBJ)stub13, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_BASICSEARCH, (MIRANDASERVICEOBJ)stub15, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_SEARCHBYEMAIL, (MIRANDASERVICEOBJ)stub16, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_SEARCHBYNAME, (MIRANDASERVICEOBJ)stub17, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_SEARCHBYADVANCED, (MIRANDASERVICEOBJ)stub18, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_CREATEADVSEARCHUI, (MIRANDASERVICEOBJ)stub19, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PSR_MESSAGE, (MIRANDASERVICEOBJ)stub22, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_SETSTATUS, (MIRANDASERVICEOBJ)stub29, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_SETAWAYMSG, (MIRANDASERVICEOBJ)stub33, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro );
- CreateProtoServiceEx( pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro );
+ CreateProtoServiceEx(pa->szModuleName, PS_ADDTOLIST, (MIRANDASERVICEOBJ)stub1, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_ADDTOLISTBYEVENT, (MIRANDASERVICEOBJ)stub2, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_AUTHALLOW, (MIRANDASERVICEOBJ)stub3, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_AUTHDENY, (MIRANDASERVICEOBJ)stub4, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_CHANGEINFO, (MIRANDASERVICEOBJ)stub7, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_FILERESUME, (MIRANDASERVICEOBJ)stub11, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_GETCAPS, (MIRANDASERVICEOBJ)stub12, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_LOADICON, (MIRANDASERVICEOBJ)stub13, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_BASICSEARCH, (MIRANDASERVICEOBJ)stub15, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_SEARCHBYEMAIL, (MIRANDASERVICEOBJ)stub16, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_SEARCHBYNAME, (MIRANDASERVICEOBJ)stub17, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_SEARCHBYADVANCED, (MIRANDASERVICEOBJ)stub18, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_CREATEADVSEARCHUI, (MIRANDASERVICEOBJ)stub19, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PSR_MESSAGE, (MIRANDASERVICEOBJ)stub22, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_SETSTATUS, (MIRANDASERVICEOBJ)stub29, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_SETAWAYMSG, (MIRANDASERVICEOBJ)stub33, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro);
+ CreateProtoServiceEx(pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro);
char szServiceName[ 200 ];
- mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFO );
- if ( !ServiceExists( szServiceName )) {
- mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFOW );
- if ( ServiceExists( szServiceName ))
- CreateProtoServiceEx( pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro );
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFO);
+ if ( !ServiceExists(szServiceName)) {
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFOW);
+ if (ServiceExists(szServiceName))
+ CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro);
}
- mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATAR );
- if ( !ServiceExists( szServiceName )) {
- mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATARW );
- if ( ServiceExists( szServiceName ))
- CreateProtoServiceEx( pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro );
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATAR);
+ if ( !ServiceExists(szServiceName)) {
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATARW);
+ if (ServiceExists(szServiceName))
+ CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro);
}
- mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATAR );
- if ( !ServiceExists( szServiceName )) {
- mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATARW );
- if ( ServiceExists( szServiceName ))
- CreateProtoServiceEx( pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro );
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATAR);
+ if ( !ServiceExists(szServiceName)) {
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATARW);
+ if (ServiceExists(szServiceName))
+ CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro);
}
return TRUE;
@@ -488,47 +488,47 @@ struct DeactivationThreadParam bool bErase;
};
-pfnUninitProto GetProtocolDestructor( char* szProto );
+pfnUninitProto GetProtocolDestructor(char* szProto);
-static int DeactivationThread( DeactivationThreadParam* param )
+static int DeactivationThread(DeactivationThreadParam* param)
{
- tagPROTO_INTERFACE* p = ( tagPROTO_INTERFACE* )param->ppro;
+ tagPROTO_INTERFACE* p = (tagPROTO_INTERFACE*)param->ppro;
p->SetStatus(ID_STATUS_OFFLINE);
char * szModuleName = NEWSTR_ALLOCA(p->m_szModuleName);
- if ( param->bIsDynamic ) {
- p->OnEvent( EV_PROTO_ONREADYTOEXIT, 0, 0 );
- p->OnEvent( EV_PROTO_ONEXIT, 0, 0 );
+ if (param->bIsDynamic) {
+ p->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0);
+ p->OnEvent(EV_PROTO_ONEXIT, 0, 0);
}
- KillObjectThreads( p ); // waits for them before terminating
- KillObjectEventHooks( p ); // untie an object from the outside world
+ KillObjectThreads(p); // waits for them before terminating
+ KillObjectEventHooks(p); // untie an object from the outside world
- if ( param->bErase )
- p->OnEvent( EV_PROTO_ONERASE, 0, 0 );
+ if (param->bErase)
+ p->OnEvent(EV_PROTO_ONERASE, 0, 0);
- if ( param->fnUninit )
- param->fnUninit( p );
+ if (param->fnUninit)
+ param->fnUninit(p);
- KillObjectServices( p );
+ KillObjectServices(p);
- if ( param->bErase )
- EraseAccount( szModuleName );
+ if (param->bErase)
+ EraseAccount(szModuleName);
delete param;
return 0;
}
-void DeactivateAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase )
+void DeactivateAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase)
{
- if ( pa->ppro == NULL ) {
- if ( bErase )
- EraseAccount( pa->szModuleName );
+ if (pa->ppro == NULL) {
+ if (bErase)
+ EraseAccount(pa->szModuleName);
return;
}
- if ( pa->hwndAccMgrUI ) {
+ if (pa->hwndAccMgrUI) {
DestroyWindow(pa->hwndAccMgrUI);
pa->hwndAccMgrUI = NULL;
pa->bAccMgrUIChanged = FALSE;
@@ -536,20 +536,20 @@ void DeactivateAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase ) DeactivationThreadParam* param = new DeactivationThreadParam;
param->ppro = pa->ppro;
- param->fnUninit = GetProtocolDestructor( pa->szProtoName );
+ param->fnUninit = GetProtocolDestructor(pa->szProtoName);
param->bIsDynamic = bIsDynamic;
param->bErase = bErase;
pa->ppro = NULL;
pa->type = PROTOTYPE_DISPROTO;
- if ( bIsDynamic )
- mir_forkthread(( pThreadFunc )DeactivationThread, param );
+ if (bIsDynamic)
+ mir_forkthread((pThreadFunc)DeactivationThread, param);
else
- DeactivationThread( param );
+ DeactivationThread(param);
}
/////////////////////////////////////////////////////////////////////////////////////////
-void EraseAccount( const char* pszModuleName )
+void EraseAccount(const char* pszModuleName)
{
DBVARIANT dbv;
DBCONTACTGETSETTING dbcgs;
@@ -560,41 +560,41 @@ void EraseAccount( const char* pszModuleName ) dbcgs.szSetting = "p";
// remove protocol contacts first
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
- while ( hContact != NULL ) {
+ HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ while (hContact != NULL) {
HANDLE h1 = hContact;
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )h1, 0 );
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)h1, 0);
dbv.type = DBVT_ASCIIZ;
dbv.pszVal = szProtoName;
dbv.cchVal = SIZEOF(szProtoName);
- if ( CallService( MS_DB_CONTACT_GETSETTINGSTATIC, ( WPARAM )h1, ( LPARAM )&dbcgs ))
+ if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)h1, (LPARAM)&dbcgs))
continue;
- if ( !lstrcmpA( szProtoName, pszModuleName ))
- CallService( MS_DB_CONTACT_DELETE, ( WPARAM )h1, 0 );
+ if ( !lstrcmpA(szProtoName, pszModuleName))
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)h1, 0);
}
// remove all protocol settings
- CallService( MS_DB_MODULE_DELETE, 0, ( LPARAM )pszModuleName );
+ CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)pszModuleName);
}
/////////////////////////////////////////////////////////////////////////////////////////
-void UnloadAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase )
+void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase)
{
- DeactivateAccount( pa, bIsDynamic, bErase );
+ DeactivateAccount(pa, bIsDynamic, bErase);
- mir_free( pa->tszAccountName );
- mir_free( pa->szProtoName );
+ mir_free(pa->tszAccountName);
+ mir_free(pa->szProtoName);
// szModuleName should be freed only on a program's exit.
// otherwise many plugins dependand on static protocol names will crash!
// do NOT fix this 'leak', please
- if ( !bIsDynamic ) {
- mir_free( pa->szModuleName );
- mir_free( pa );
+ if ( !bIsDynamic) {
+ mir_free(pa->szModuleName);
+ mir_free(pa);
}
}
@@ -602,11 +602,11 @@ void UnloadAccountsModule() {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
- for ( i=accounts.getCount()-1; i >= 0; i-- ) {
+ for (i=accounts.getCount()-1; i >= 0; i--) {
PROTOACCOUNT* pa = accounts[ i ];
- UnloadAccount( pa, false, false );
+ UnloadAccount(pa, false, false);
accounts.remove(i);
}
@@ -617,19 +617,19 @@ void UnloadAccountsModule() void BuildProtoMenus()
{
- for ( int i = 0; i < accounts.getCount(); i++ ) {
+ for (int i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[ i ];
- if ( cli.pfnGetProtocolVisibility( pa->szModuleName ) == 0 )
+ if (cli.pfnGetProtocolVisibility(pa->szModuleName) == 0)
continue;
- if ( pa->ppro )
- pa->ppro->OnEvent( EV_PROTO_ONMENU, 0, 0 );
+ if (pa->ppro)
+ pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
}
-void RebuildProtoMenus( int iNewValue )
+void RebuildProtoMenus(int iNewValue)
{
- DBWriteContactSettingByte( NULL, "CList", "MoveProtoMenus", iNewValue );
+ DBWriteContactSettingByte(NULL, "CList", "MoveProtoMenus", iNewValue);
RebuildMenuOrder();
BuildProtoMenus();
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index f75418cb5c..73a12d2bd5 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -34,33 +34,33 @@ INT_PTR Proto_CallContactService(WPARAM wParam, LPARAM lParam) INT_PTR ret;
PROTOACCOUNT* pa;
- if ( wParam == (WPARAM)(-1))
+ if (wParam == (WPARAM)(-1))
return 1;
- for ( i = wParam;; i++ ) {
- _itoa( i, str, 10 );
- if ( DBGetContactSettingString( ccs->hContact, "_Filter", str, &dbv ))
+ for (i = wParam;; i++) {
+ _itoa(i, str, 10);
+ if (DBGetContactSettingString(ccs->hContact, "_Filter", str, &dbv))
break;
- if (( ret = CallProtoService( dbv.pszVal, ccs->szProtoService, i+1, lParam )) != CALLSERVICE_NOTFOUND ) {
+ if ((ret = CallProtoService(dbv.pszVal, ccs->szProtoService, i+1, lParam)) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
return ret;
}
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
}
- if ( DBGetContactSettingString( ccs->hContact, "Protocol", "p", &dbv ))
+ if (DBGetContactSettingString(ccs->hContact, "Protocol", "p", &dbv))
return 1;
- pa = Proto_GetAccount( dbv.pszVal );
- if ( pa == NULL || pa->ppro == NULL )
+ pa = Proto_GetAccount(dbv.pszVal);
+ if (pa == NULL || pa->ppro == NULL)
ret = 1;
else {
- if ( pa->bOldProto )
- ret = CallProtoServiceInt( ccs->hContact, dbv.pszVal, ccs->szProtoService, (WPARAM)(-1), ( LPARAM)ccs );
+ if (pa->bOldProto)
+ ret = CallProtoServiceInt(ccs->hContact, dbv.pszVal, ccs->szProtoService, (WPARAM)(-1), (LPARAM)ccs);
else
- ret = CallProtoServiceInt( ccs->hContact, dbv.pszVal, ccs->szProtoService, ccs->wParam, ccs->lParam );
- if ( ret == CALLSERVICE_NOTFOUND )
+ ret = CallProtoServiceInt(ccs->hContact, dbv.pszVal, ccs->szProtoService, ccs->wParam, ccs->lParam);
+ if (ret == CALLSERVICE_NOTFOUND)
ret = 1;
}
@@ -77,47 +77,47 @@ static INT_PTR CallRecvChain(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
PROTOACCOUNT* pa;
- if ( wParam == (WPARAM)(-1)) return 1; //shouldn't happen - sanity check
- if ( wParam == 0 ) { //begin processing by finding end of chain
- for (;;wParam++ ) {
- _itoa( wParam, str, 10 );
- if ( DBGetContactSettingString( ccs->hContact, "_Filter", str, &dbv ))
+ if (wParam == (WPARAM)(-1)) return 1; //shouldn't happen - sanity check
+ if (wParam == 0) { //begin processing by finding end of chain
+ for (;;wParam++) {
+ _itoa(wParam, str, 10);
+ if (DBGetContactSettingString(ccs->hContact, "_Filter", str, &dbv))
break;
mir_free(dbv.pszVal);
}
}
else wParam--;
- for ( i = wParam-1; i >= 0; i-- ) {
- _itoa( i, str, 10 );
- if ( DBGetContactSettingString( ccs->hContact, "_Filter", str, &dbv )) //never happens
+ for (i = wParam-1; i >= 0; i--) {
+ _itoa(i, str, 10);
+ if (DBGetContactSettingString(ccs->hContact, "_Filter", str, &dbv)) //never happens
return 1;
- if (( ret = CallProtoService( dbv.pszVal, ccs->szProtoService, i+1, lParam )) != CALLSERVICE_NOTFOUND ) {
+ if ((ret = CallProtoService(dbv.pszVal, ccs->szProtoService, i+1, lParam)) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
return ret;
}
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
}
//end of chain, call network protocol again
- if ( DBGetContactSettingString( ccs->hContact, "Protocol", "p", &dbv ))
+ if (DBGetContactSettingString(ccs->hContact, "Protocol", "p", &dbv))
return 1;
- pa = Proto_GetAccount( dbv.pszVal );
- if ( pa == NULL || pa->ppro == NULL )
+ pa = Proto_GetAccount(dbv.pszVal);
+ if (pa == NULL || pa->ppro == NULL)
ret = 1;
else {
- if ( pa->bOldProto )
- ret = CallProtoServiceInt( ccs->hContact, dbv.pszVal, ccs->szProtoService, (WPARAM)(-1), ( LPARAM)ccs );
+ if (pa->bOldProto)
+ ret = CallProtoServiceInt(ccs->hContact, dbv.pszVal, ccs->szProtoService, (WPARAM)(-1), (LPARAM)ccs);
else
- ret = CallProtoServiceInt( ccs->hContact, dbv.pszVal, ccs->szProtoService, ccs->wParam, ccs->lParam );
- if ( ret == CALLSERVICE_NOTFOUND )
+ ret = CallProtoServiceInt(ccs->hContact, dbv.pszVal, ccs->szProtoService, ccs->wParam, ccs->lParam);
+ if (ret == CALLSERVICE_NOTFOUND)
ret = 1;
}
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
return ret;
}
@@ -142,13 +142,13 @@ PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact) if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&dbcgs))
return 0;
- return Proto_GetAccount((char* )dbv.pszVal);
+ return Proto_GetAccount((char*)dbv.pszVal);
}
static INT_PTR Proto_GetContactBaseProto(WPARAM wParam, LPARAM)
{
PROTOACCOUNT* pa = Proto_GetAccount((HANDLE)wParam);
- return (INT_PTR)(Proto_IsAccountEnabled( pa ) ? pa->szModuleName : NULL);
+ return (INT_PTR)(Proto_IsAccountEnabled(pa) ? pa->szModuleName : NULL);
}
static INT_PTR Proto_GetContactBaseAccount(WPARAM wParam, LPARAM)
@@ -163,10 +163,10 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam) char str[10];
DBVARIANT dbv;
- if (!lParam) return 0;
+ if ( !lParam) return 0;
- if (!DBGetContactSettingString((HANDLE)wParam, "Protocol", "p", &dbv)) {
- if (!_stricmp((char*)lParam, dbv.pszVal)) {
+ if ( !DBGetContactSettingString((HANDLE)wParam, "Protocol", "p", &dbv)) {
+ if ( !_stricmp((char*)lParam, dbv.pszVal)) {
mir_free(dbv.pszVal);
return -1;
}
@@ -175,7 +175,7 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam) for (i=0;;i++) {
_itoa(i, str, 10);
if (DBGetContactSettingString((HANDLE)wParam, "_Filter", str, &dbv)) break;
- if (!strcmp((char*)lParam, dbv.pszVal)) {
+ if ( !strcmp((char*)lParam, dbv.pszVal)) {
mir_free(dbv.pszVal);
return i+1;
}
@@ -188,17 +188,17 @@ static INT_PTR Proto_AddToContact(WPARAM wParam, LPARAM lParam) {
PROTOCOLDESCRIPTOR *pd, *pdCompare;
- pd = Proto_IsProtocolLoaded(( char* )lParam );
- if ( pd == NULL ) {
- PROTOACCOUNT* pa = Proto_GetAccount(( char* )lParam );
- if ( pa ) {
+ pd = Proto_IsProtocolLoaded((char*)lParam);
+ if (pd == NULL) {
+ PROTOACCOUNT* pa = Proto_GetAccount((char*)lParam);
+ if (pa) {
DBWriteContactSettingString((HANDLE)wParam, "Protocol", "p", (char*)lParam);
return 0;
}
return 1;
}
- if ( pd->type == PROTOTYPE_PROTOCOL ) {
+ if (pd->type == PROTOTYPE_PROTOCOL) {
DBWriteContactSettingString((HANDLE)wParam, "Protocol", "p", (char*)lParam);
return 0;
}
@@ -211,7 +211,7 @@ static INT_PTR Proto_AddToContact(WPARAM wParam, LPARAM lParam) for (i=0;;i++) {
_itoa(i, str, 10);
if (DBGetContactSettingString((HANDLE)wParam, "_Filter", str, &dbv)) break;
- pdCompare = Proto_IsProtocolLoaded(( char* )dbv.pszVal );
+ pdCompare = Proto_IsProtocolLoaded((char*)dbv.pszVal);
mir_free(dbv.pszVal);
if (pdCompare == NULL) continue;
if (pd->type > pdCompare->type) break;
@@ -240,7 +240,7 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam, LPARAM lParam) char str[10];
i = Proto_IsProtoOnContact(wParam, lParam);
- if (!i) return 1;
+ if ( !i) return 1;
if (i == -1)
DBDeleteContactSetting((HANDLE)wParam, "Protocol", "p");
else {
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 7b8b3d647a..1ec4872e23 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
int LoadProtoChains(void);
-int LoadProtoOptions( void );
+int LoadProtoOptions(void);
HANDLE hAccListChanged;
static HANDLE hAckEvent, hTypeEvent;
@@ -36,19 +36,19 @@ typedef struct }
TServiceListItem;
-static int CompareServiceItems( const TServiceListItem* p1, const TServiceListItem* p2 )
-{ return strcmp( p1->name, p2->name );
+static int CompareServiceItems(const TServiceListItem* p1, const TServiceListItem* p2)
+{ return strcmp(p1->name, p2->name);
}
-static LIST<TServiceListItem> serviceItems( 10, CompareServiceItems );
+static LIST<TServiceListItem> serviceItems(10, CompareServiceItems);
//------------------------------------------------------------------------------------
-static int CompareProtos( const PROTOCOLDESCRIPTOR* p1, const PROTOCOLDESCRIPTOR* p2 )
-{ return strcmp( p1->szName, p2->szName );
+static int CompareProtos(const PROTOCOLDESCRIPTOR* p1, const PROTOCOLDESCRIPTOR* p2)
+{ return strcmp(p1->szName, p2->szName);
}
-static LIST<PROTOCOLDESCRIPTOR> protos( 10, CompareProtos );
+static LIST<PROTOCOLDESCRIPTOR> protos(10, CompareProtos);
static INT_PTR Proto_BroadcastAck(WPARAM wParam, LPARAM lParam)
{
@@ -68,65 +68,65 @@ static INT_PTR Proto_BroadcastAck(WPARAM wParam, LPARAM lParam) return NotifyEventHooks(hAckEvent, wParam, lParam);
}
-INT_PTR __fastcall MyCallProtoService( const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam );
-void FreeFilesMatrix( TCHAR ***files );
+INT_PTR __fastcall MyCallProtoService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
+void FreeFilesMatrix(TCHAR ***files);
-PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded( const char* szProtoName )
+PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char* szProtoName)
{
- if ( szProtoName ) {
+ if (szProtoName) {
PROTOCOLDESCRIPTOR tmp;
- tmp.szName = ( char* )szProtoName;
- return protos.find( &tmp );
+ tmp.szName = (char*)szProtoName;
+ return protos.find(&tmp);
}
return NULL;
}
INT_PTR srvProto_IsLoaded(WPARAM, LPARAM lParam)
{
- return (INT_PTR)Proto_GetAccount(( char* )lParam );
+ return (INT_PTR)Proto_GetAccount((char*)lParam);
}
INT_PTR Proto_EnumProtocols(WPARAM wParam, LPARAM lParam)
{
- *( int* )wParam = protos.getCount();
- *( PROTOCOLDESCRIPTOR*** )lParam = protos.getArray();
+ *(int*)wParam = protos.getCount();
+ *(PROTOCOLDESCRIPTOR***)lParam = protos.getArray();
return 0;
}
-static PROTO_INTERFACE* defInitProto( const char* szModuleName, const TCHAR* )
+static PROTO_INTERFACE* defInitProto(const char* szModuleName, const TCHAR*)
{
- return AddDefaultAccount( szModuleName );
+ return AddDefaultAccount(szModuleName);
}
static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam)
{
- PROTOCOLDESCRIPTOR* pd = ( PROTOCOLDESCRIPTOR* )lParam, *p;
- if ( pd->cbSize != sizeof( PROTOCOLDESCRIPTOR ) && pd->cbSize != PROTOCOLDESCRIPTOR_V3_SIZE )
+ PROTOCOLDESCRIPTOR* pd = (PROTOCOLDESCRIPTOR*)lParam, *p;
+ if (pd->cbSize != sizeof(PROTOCOLDESCRIPTOR) && pd->cbSize != PROTOCOLDESCRIPTOR_V3_SIZE)
return 1;
- p = ( PROTOCOLDESCRIPTOR* )mir_alloc( sizeof( PROTOCOLDESCRIPTOR ));
- if ( !p )
+ p = (PROTOCOLDESCRIPTOR*)mir_alloc(sizeof(PROTOCOLDESCRIPTOR));
+ if ( !p)
return 2;
- if ( pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE ) {
- memset( p, 0, sizeof( PROTOCOLDESCRIPTOR ));
+ if (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) {
+ memset(p, 0, sizeof(PROTOCOLDESCRIPTOR));
p->cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
p->type = pd->type;
- if ( p->type == PROTOTYPE_PROTOCOL ) {
+ if (p->type == PROTOTYPE_PROTOCOL) {
// let's create a new container
- PROTO_INTERFACE* ppi = AddDefaultAccount( pd->szName );
- if ( ppi ) {
- PROTOACCOUNT* pa = Proto_GetAccount( pd->szName );
- if ( pa == NULL ) {
- pa = (PROTOACCOUNT*)mir_calloc( sizeof( PROTOACCOUNT ));
+ PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
+ if (ppi) {
+ PROTOACCOUNT* pa = Proto_GetAccount(pd->szName);
+ if (pa == NULL) {
+ pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
pa->cbSize = sizeof(PROTOACCOUNT);
pa->type = PROTOTYPE_PROTOCOL;
- pa->szModuleName = mir_strdup( pd->szName );
- pa->szProtoName = mir_strdup( pd->szName );
- pa->tszAccountName = mir_a2t( pd->szName );
+ pa->szModuleName = mir_strdup(pd->szName);
+ pa->szProtoName = mir_strdup(pd->szName);
+ pa->tszAccountName = mir_a2t(pd->szName);
pa->bIsVisible = pa->bIsEnabled = TRUE;
pa->iOrder = accounts.getCount();
- accounts.insert( pa );
+ accounts.insert(pa);
}
pa->bOldProto = TRUE;
pa->ppro = ppi;
@@ -136,8 +136,8 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam) }
}
else *p = *pd;
- p->szName = mir_strdup( pd->szName );
- protos.insert( p );
+ p->szName = mir_strdup(pd->szName);
+ protos.insert(p);
return 0;
}
@@ -146,112 +146,112 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam) static INT_PTR Proto_RecvFile(WPARAM, LPARAM lParam)
{
- CCSDATA* ccs = ( CCSDATA* )lParam;
- PROTORECVEVENT* pre = ( PROTORECVEVENT* )ccs->lParam;
- char* szFile = pre->szMessage + sizeof( DWORD );
- char* szDescr = szFile + strlen( szFile ) + 1;
+ CCSDATA* ccs = (CCSDATA*)lParam;
+ PROTORECVEVENT* pre = (PROTORECVEVENT*)ccs->lParam;
+ char* szFile = pre->szMessage + sizeof(DWORD);
+ char* szDescr = szFile + strlen(szFile) + 1;
// Suppress the standard event filter
- if ( pre->lParam != NULL )
- *( DWORD* )pre->szMessage = 0;
+ if (pre->lParam != NULL)
+ *(DWORD*)pre->szMessage = 0;
DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof( dbei );
- dbei.szModule = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
dbei.timestamp = pre->timestamp;
- dbei.flags = ( pre->flags & PREF_CREATEREAD ) ? DBEF_READ : 0;
- dbei.flags |= ( pre->flags & PREF_UTF ) ? DBEF_UTF : 0;
+ dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0;
+ dbei.flags |= (pre->flags & PREF_UTF) ? DBEF_UTF : 0;
dbei.eventType = EVENTTYPE_FILE;
- dbei.cbBlob = (DWORD)(sizeof( DWORD ) + strlen( szFile ) + strlen( szDescr ) + 2);
- dbei.pBlob = ( PBYTE )pre->szMessage;
- HANDLE hdbe = ( HANDLE )CallService( MS_DB_EVENT_ADD, ( WPARAM )ccs->hContact, ( LPARAM )&dbei );
+ dbei.cbBlob = (DWORD)(sizeof(DWORD) + strlen(szFile) + strlen(szDescr) + 2);
+ dbei.pBlob = (PBYTE)pre->szMessage;
+ HANDLE hdbe = (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)ccs->hContact, (LPARAM)&dbei);
- if ( pre->lParam != NULL )
- PushFileEvent( ccs->hContact, hdbe, pre->lParam );
+ if (pre->lParam != NULL)
+ PushFileEvent(ccs->hContact, hdbe, pre->lParam);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-static void sttRecvCreateBlob( DBEVENTINFO& dbei, int fileCount, char** pszFiles, char* szDescr )
+static void sttRecvCreateBlob(DBEVENTINFO& dbei, int fileCount, char** pszFiles, char* szDescr)
{
- dbei.cbBlob = sizeof( DWORD );
+ dbei.cbBlob = sizeof(DWORD);
{
- for ( int i=0; i < fileCount; i++ )
- dbei.cbBlob += lstrlenA( pszFiles[i] ) + 1;
+ for (int i=0; i < fileCount; i++)
+ dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
}
- dbei.cbBlob += lstrlenA( szDescr ) + 1;
+ dbei.cbBlob += lstrlenA(szDescr) + 1;
- if (( dbei.pBlob = ( BYTE* )mir_alloc( dbei.cbBlob )) == 0 )
+ if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == 0)
return;
- *( DWORD* )dbei.pBlob = 0;
- BYTE* p = dbei.pBlob + sizeof( DWORD );
- for ( int i=0; i < fileCount; i++ ) {
- strcpy(( char* )p, pszFiles[i] );
- p += lstrlenA( pszFiles[i] ) + 1;
+ *(DWORD*)dbei.pBlob = 0;
+ BYTE* p = dbei.pBlob + sizeof(DWORD);
+ for (int i=0; i < fileCount; i++) {
+ strcpy((char*)p, pszFiles[i]);
+ p += lstrlenA(pszFiles[i]) + 1;
}
- strcpy(( char* )p, ( szDescr == NULL ) ? "" : szDescr );
+ strcpy((char*)p, (szDescr == NULL) ? "" : szDescr);
}
static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
{
- CCSDATA* ccs = ( CCSDATA* )lParam;
- PROTORECVFILET* pre = ( PROTORECVFILET* )ccs->lParam;
- if ( pre->fileCount == 0 )
+ CCSDATA* ccs = (CCSDATA*)lParam;
+ PROTORECVFILET* pre = (PROTORECVFILET*)ccs->lParam;
+ if (pre->fileCount == 0)
return 0;
DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof( dbei );
- dbei.szModule = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
dbei.timestamp = pre->timestamp;
- dbei.flags = ( pre->flags & PREF_CREATEREAD ) ? DBEF_READ : 0;
+ dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0;
dbei.eventType = EVENTTYPE_FILE;
- char** pszFiles = ( char** )alloca( pre->fileCount * sizeof(char*));
+ char** pszFiles = (char**)alloca(pre->fileCount * sizeof(char*));
{
- for ( int i=0; i < pre->fileCount; i++ )
- pszFiles[i] = Utf8EncodeT( pre->ptszFiles[i] );
+ for (int i=0; i < pre->fileCount; i++)
+ pszFiles[i] = Utf8EncodeT(pre->ptszFiles[i]);
}
- char* szDescr = Utf8EncodeT( pre->tszDescription );
+ char* szDescr = Utf8EncodeT(pre->tszDescription);
dbei.flags |= DBEF_UTF;
- sttRecvCreateBlob( dbei, pre->fileCount, pszFiles, szDescr );
+ sttRecvCreateBlob(dbei, pre->fileCount, pszFiles, szDescr);
{
- for ( int i=0; i < pre->fileCount; i++ )
- mir_free( pszFiles[i] );
+ for (int i=0; i < pre->fileCount; i++)
+ mir_free(pszFiles[i]);
}
- mir_free( szDescr );
+ mir_free(szDescr);
- HANDLE hdbe = ( HANDLE )CallService( MS_DB_EVENT_ADD, ( WPARAM )ccs->hContact, ( LPARAM )&dbei );
+ HANDLE hdbe = (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)ccs->hContact, (LPARAM)&dbei);
- PushFileEvent( ccs->hContact, hdbe, pre->lParam );
- mir_free( dbei.pBlob );
+ PushFileEvent(ccs->hContact, hdbe, pre->lParam);
+ mir_free(dbei.pBlob);
return 0;
}
static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam)
{
- CCSDATA *ccs = ( CCSDATA* )lParam;
- PROTORECVEVENT *pre = ( PROTORECVEVENT* )ccs->lParam;
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
if (pre->szMessage == NULL) return NULL;
DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof( dbei );
- dbei.szModule = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
dbei.timestamp = pre->timestamp;
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (DWORD)strlen( pre->szMessage ) + 1;
- if ( pre->flags & PREF_CREATEREAD )
+ dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
+ if (pre->flags & PREF_CREATEREAD)
dbei.flags |= DBEF_READ;
- if ( pre->flags & PREF_UTF )
+ if (pre->flags & PREF_UTF)
dbei.flags |= DBEF_UTF;
- if ( pre->flags & PREF_UNICODE )
- dbei.cbBlob += sizeof( wchar_t )*((DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob+1] )+1 );
+ if (pre->flags & PREF_UNICODE)
+ dbei.cbBlob += sizeof(wchar_t)*((DWORD)wcslen((wchar_t*)&pre->szMessage[dbei.cbBlob+1])+1);
- dbei.pBlob = ( PBYTE ) pre->szMessage;
- return CallService( MS_DB_EVENT_ADD, ( WPARAM ) ccs->hContact, ( LPARAM )&dbei );
+ dbei.pBlob = (PBYTE) pre->szMessage;
+ return CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM)&dbei);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -259,21 +259,21 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) static int Proto_ValidTypingContact(HANDLE hContact, char *szProto)
{
- if ( !hContact || !szProto )
+ if ( !hContact || !szProto)
return 0;
- return ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING ) ? 1 : 0;
+ return (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
}
static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
{
- if ( lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON ) {
- char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if ( !szProto )
+ if (lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON) {
+ char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if ( !szProto)
return 0;
- if ( Proto_ValidTypingContact(( HANDLE )wParam, szProto ))
- CallProtoService( szProto, PSS_USERISTYPING, wParam, lParam );
+ if (Proto_ValidTypingContact((HANDLE)wParam, szProto))
+ CallProtoService(szProto, PSS_USERISTYPING, wParam, lParam);
}
return 0;
@@ -282,18 +282,18 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam)
{
int type = (int)lParam;
- char *szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if ( !szProto )
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if ( !szProto)
return 0;
- if ( CallService( MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_TYPINGNOTIFY ))
+ if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_TYPINGNOTIFY))
return 0;
- if ( type < PROTOTYPE_CONTACTTYPING_OFF )
+ if (type < PROTOTYPE_CONTACTTYPING_OFF)
return 0;
- if ( Proto_ValidTypingContact(( HANDLE )wParam, szProto ))
- NotifyEventHooks( hTypeEvent, wParam, lParam );
+ if (Proto_ValidTypingContact((HANDLE)wParam, szProto))
+ NotifyEventHooks(hTypeEvent, wParam, lParam);
return 0;
}
@@ -302,7 +302,7 @@ void Proto_SetStatus(const char* szProto, unsigned status) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)
{
- TCHAR* awayMsg = (TCHAR* )CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM) status, (LPARAM) szProto);
+ TCHAR* awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM) status, (LPARAM) szProto);
if ((INT_PTR)awayMsg == CALLSERVICE_NOTFOUND)
{
char* awayMsgA = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM) status, (LPARAM) szProto);
@@ -321,30 +321,30 @@ void Proto_SetStatus(const char* szProto, unsigned status) }
-char** __fastcall Proto_FilesMatrixA( wchar_t **files )
+char** __fastcall Proto_FilesMatrixA(wchar_t **files)
{
- if ( files == NULL ) return NULL;
+ if (files == NULL) return NULL;
int count = 0;
- while ( files[ count++ ] );
+ while (files[ count++ ]);
- char** filesA = ( char** )mir_alloc( count * sizeof( char* ));
- for ( int i = 0; i < count; ++i )
- filesA[ i ] = mir_u2a( files[ i ] );
+ char** filesA = (char**)mir_alloc(count * sizeof(char*));
+ for (int i = 0; i < count; ++i)
+ filesA[ i ] = mir_u2a(files[ i ]);
return filesA;
}
-static wchar_t** __fastcall Proto_FilesMatrixU( char **files )
+static wchar_t** __fastcall Proto_FilesMatrixU(char **files)
{
- if ( files == NULL ) return NULL;
+ if (files == NULL) return NULL;
int count = 0;
- while ( files[ count++ ] );
+ while (files[ count++ ]);
- wchar_t** filesU = ( wchar_t** )mir_alloc( count * sizeof( wchar_t* ));
- for ( int i = 0; i < count; ++i )
- filesU[ i ] = mir_a2u( files[ i ] );
+ wchar_t** filesU = (wchar_t**)mir_alloc(count * sizeof(wchar_t*));
+ for (int i = 0; i < count; ++i)
+ filesU[ i ] = mir_a2u(files[ i ]);
return filesU;
}
@@ -353,12 +353,12 @@ static wchar_t** __fastcall Proto_FilesMatrixU( char **files ) /////////////////////////////////////////////////////////////////////////////////////////
// 0.8.0+ - accounts
-PROTOACCOUNT* __fastcall Proto_GetAccount( const char* accName )
+PROTOACCOUNT* __fastcall Proto_GetAccount(const char* accName)
{
int idx;
PROTOACCOUNT temp;
- temp.szModuleName = ( char* )accName;
- if (( idx = accounts.getIndex( &temp )) == -1 )
+ temp.szModuleName = (char*)accName;
+ if ((idx = accounts.getIndex(&temp)) == -1)
return NULL;
return accounts[idx];
@@ -366,299 +366,299 @@ PROTOACCOUNT* __fastcall Proto_GetAccount( const char* accName ) static INT_PTR srvProto_GetAccount(WPARAM, LPARAM lParam)
{
- return ( INT_PTR )Proto_GetAccount(( char* )lParam );
+ return (INT_PTR)Proto_GetAccount((char*)lParam);
}
static INT_PTR Proto_EnumAccounts(WPARAM wParam, LPARAM lParam)
{
- *( int* )wParam = accounts.getCount();
- *( PROTOACCOUNT*** )lParam = accounts.getArray();
+ *(int*)wParam = accounts.getCount();
+ *(PROTOACCOUNT***)lParam = accounts.getArray();
return 0;
}
-bool __fastcall Proto_IsAccountEnabled( PROTOACCOUNT* pa )
+bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT* pa)
{
- return pa && (( pa->bIsEnabled && !pa->bDynDisabled ) || pa->bOldProto );
+ return pa && ((pa->bIsEnabled && !pa->bDynDisabled) || pa->bOldProto);
}
static INT_PTR srvProto_IsAccountEnabled(WPARAM, LPARAM lParam)
{
- return ( INT_PTR )Proto_IsAccountEnabled(( PROTOACCOUNT* )lParam);
+ return (INT_PTR)Proto_IsAccountEnabled((PROTOACCOUNT*)lParam);
}
-bool __fastcall Proto_IsAccountLocked( PROTOACCOUNT* pa )
+bool __fastcall Proto_IsAccountLocked(PROTOACCOUNT* pa)
{
return pa && DBGetContactSettingByte(NULL, pa->szModuleName, "LockMainStatus", 0) != 0;
}
static INT_PTR srvProto_IsAccountLocked(WPARAM, LPARAM lParam)
{
- return ( INT_PTR )Proto_IsAccountLocked( Proto_GetAccount(( char* )lParam ));
+ return (INT_PTR)Proto_IsAccountLocked(Proto_GetAccount((char*)lParam));
}
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam )
+INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
{
- PROTOACCOUNT* pa = Proto_GetAccount( szModule );
- if ( pa && !pa->bOldProto ) {
+ PROTOACCOUNT* pa = Proto_GetAccount(szModule);
+ if (pa && !pa->bOldProto) {
PROTO_INTERFACE* ppi;
- if (( ppi = pa->ppro ) == NULL )
+ if ((ppi = pa->ppro) == NULL)
return CALLSERVICE_NOTFOUND;
else {
- TServiceListItem *item = serviceItems.find(( TServiceListItem* )&szService );
- if ( item ) {
- switch( item->id ) {
+ TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
+ if (item) {
+ switch(item->id) {
case 1:
- if ( ppi->m_iVersion > 1 || !((( PROTOSEARCHRESULT* )lParam)->flags & PSR_UNICODE))
- return ( INT_PTR )ppi->AddToList( wParam, (PROTOSEARCHRESULT*)lParam );
+ if (ppi->m_iVersion > 1 || !(((PROTOSEARCHRESULT*)lParam)->flags & PSR_UNICODE))
+ return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
else {
- PROTOSEARCHRESULT *psr = ( PROTOSEARCHRESULT* )lParam;
- PROTOSEARCHRESULT *psra =( PROTOSEARCHRESULT* )mir_alloc( psr->cbSize );
- memcpy( psra, psr, psr->cbSize );
- psra->nick = ( PROTOCHAR* )mir_u2a( psr->nick );
- psra->firstName = ( PROTOCHAR* )mir_u2a( psr->firstName );
- psra->lastName = ( PROTOCHAR* )mir_u2a( psr->lastName );
- psra->email = ( PROTOCHAR* )mir_u2a( psr->email );
+ PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
+ PROTOSEARCHRESULT *psra =(PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ memcpy(psra, psr, psr->cbSize);
+ psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
+ psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
+ psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
+ psra->email = (PROTOCHAR*)mir_u2a(psr->email);
- INT_PTR res = ( INT_PTR )ppi->AddToList( wParam, psra );
+ INT_PTR res = (INT_PTR)ppi->AddToList(wParam, psra);
- mir_free( psra->nick );
- mir_free( psra->firstName );
- mir_free( psra->lastName );
- mir_free( psra->email );
- mir_free( psra );
+ mir_free(psra->nick);
+ mir_free(psra->firstName);
+ mir_free(psra->lastName);
+ mir_free(psra->email);
+ mir_free(psra);
return res;
}
- case 2: return ( INT_PTR )ppi->AddToListByEvent( LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam );
- case 3: return ( INT_PTR )ppi->Authorize(( HANDLE )wParam );
+ case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam);
+ case 3: return (INT_PTR)ppi->Authorize((HANDLE)wParam);
case 4:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, ( PROTOCHAR* )lParam );
- case 5: return ( INT_PTR )ppi->AuthRecv( hContact, ( PROTORECVEVENT* )lParam );
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, (PROTOCHAR*)lParam);
+ case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT*)lParam);
case 6:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->AuthRequest( hContact, StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthRequest(hContact, StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->AuthRequest( hContact, ( PROTOCHAR* )lParam );
- case 7: return ( INT_PTR )ppi->ChangeInfo( wParam, ( void* )lParam );
+ return (INT_PTR)ppi->AuthRequest(hContact, (PROTOCHAR*)lParam);
+ case 7: return (INT_PTR)ppi->ChangeInfo(wParam, (void*)lParam);
case 8:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->FileAllow( hContact, ( HANDLE )wParam, StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->FileAllow( hContact, ( HANDLE )wParam, ( PROTOCHAR* )lParam );
- case 9: return ( INT_PTR )ppi->FileCancel( hContact, ( HANDLE )wParam );
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
+ case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
case 10:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->FileDeny( hContact, ( HANDLE )wParam, StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->FileDeny( hContact, ( HANDLE )wParam, ( PROTOCHAR* )lParam );
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
case 11: {
- PROTOFILERESUME* pfr = ( PROTOFILERESUME* )lParam;
-
- if ( ppi->m_iVersion > 1 ) {
- PROTOCHAR* szFname = mir_a2t(( char* )pfr->szFilename );
- INT_PTR res = ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action,
- ( const PROTOCHAR** )&szFname);
- mir_free(( PROTOCHAR* )pfr->szFilename );
- pfr->szFilename = ( PROTOCHAR* )mir_t2a( szFname ); mir_free( szFname );
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+
+ if (ppi->m_iVersion > 1) {
+ PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
+ INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
+ (const PROTOCHAR**)&szFname);
+ mir_free((PROTOCHAR*)pfr->szFilename);
+ pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
}
else
- return ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action,
- ( const PROTOCHAR** )&pfr->szFilename );
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
+ (const PROTOCHAR**)&pfr->szFilename);
}
- case 12: return ( INT_PTR )ppi->GetCaps( wParam, (HANDLE)lParam );
- case 13: return ( INT_PTR )ppi->GetIcon( wParam );
- case 14: return ( INT_PTR )ppi->GetInfo( hContact, wParam );;
+ case 12: return (INT_PTR)ppi->GetCaps(wParam, (HANDLE)lParam);
+ case 13: return (INT_PTR)ppi->GetIcon(wParam);
+ case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);;
case 15:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SearchBasic( StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchBasic(StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->SearchBasic(( TCHAR* )lParam );
+ return (INT_PTR)ppi->SearchBasic((TCHAR*)lParam);
case 16:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SearchByEmail( StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByEmail(StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->SearchByEmail(( TCHAR* )lParam );
+ return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
case 17: {
- PROTOSEARCHBYNAME* psbn = ( PROTOSEARCHBYNAME* )lParam;
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SearchByName( StrConvT(( char* )psbn->pszNick ),
- StrConvT(( char* )psbn->pszFirstName ), StrConvT(( char* )psbn->pszLastName ));
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByName(StrConvT((char*)psbn->pszNick),
+ StrConvT((char*)psbn->pszFirstName), StrConvT((char*)psbn->pszLastName));
else
- return ( INT_PTR )ppi->SearchByName( psbn->pszNick, psbn->pszFirstName, psbn->pszLastName );
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
}
- case 18: return ( INT_PTR )ppi->SearchAdvanced(( HWND )lParam );
- case 19: return ( INT_PTR )ppi->CreateExtendedSearchUI (( HWND )lParam );
- case 20: return ( INT_PTR )ppi->RecvContacts( hContact, ( PROTORECVEVENT* )lParam );
- case 21: return ( INT_PTR )ppi->RecvFile( hContact, ( PROTOFILEEVENT* )lParam );
- case 22: return ( INT_PTR )ppi->RecvMsg( hContact, ( PROTORECVEVENT* )lParam );
- case 23: return ( INT_PTR )ppi->RecvUrl( hContact, ( PROTORECVEVENT* )lParam );
- case 24: return ( INT_PTR )ppi->SendContacts( hContact, LOWORD( wParam ), HIWORD( wParam ),
- ( HANDLE* )lParam );
+ case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
+ case 19: return (INT_PTR)ppi->CreateExtendedSearchUI ((HWND)lParam);
+ case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT*)lParam);
+ case 21: return (INT_PTR)ppi->RecvFile(hContact, (PROTOFILEEVENT*)lParam);
+ case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam);
+ case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam);
+ case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam),
+ (HANDLE*)lParam);
case 25:
- if ( ppi->m_iVersion > 1 ) {
- TCHAR** files = Proto_FilesMatrixU(( char** )lParam );
- INT_PTR res = ( INT_PTR )ppi->SendFile( hContact, StrConvT(( char* )wParam ), ( TCHAR** )files );
- if ( res == 0 ) FreeFilesMatrix( &files );
+ if (ppi->m_iVersion > 1) {
+ TCHAR** files = Proto_FilesMatrixU((char**)lParam);
+ INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvT((char*)wParam), (TCHAR**)files);
+ if (res == 0) FreeFilesMatrix(&files);
return res;
}
else
- return ( INT_PTR )ppi->SendFile( hContact, ( TCHAR* )wParam, ( TCHAR** )lParam );
- case 26: return ( INT_PTR )ppi->SendMsg( hContact, wParam, ( const char* )lParam );
- case 27: return ( INT_PTR )ppi->SendUrl( hContact, wParam, ( const char* )lParam );
- case 28: return ( INT_PTR )ppi->SetApparentMode( hContact, wParam );
- case 29: return ( INT_PTR )ppi->SetStatus( wParam );
- case 30: return ( INT_PTR )ppi->GetAwayMsg( hContact );
- case 31: return ( INT_PTR )ppi->RecvAwayMsg( hContact, wParam, ( PROTORECVEVENT* )lParam );
- case 32: return ( INT_PTR )ppi->SendAwayMsg( hContact, ( HANDLE )wParam, ( const char* )lParam );
+ return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
+ case 26: return (INT_PTR)ppi->SendMsg(hContact, wParam, (const char*)lParam);
+ case 27: return (INT_PTR)ppi->SendUrl(hContact, wParam, (const char*)lParam);
+ case 28: return (INT_PTR)ppi->SetApparentMode(hContact, wParam);
+ case 29: return (INT_PTR)ppi->SetStatus(wParam);
+ case 30: return (INT_PTR)ppi->GetAwayMsg(hContact);
+ case 31: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT*)lParam);
+ case 32: return (INT_PTR)ppi->SendAwayMsg(hContact, (HANDLE)wParam, (const char*)lParam);
case 33:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SetAwayMsg( wParam, StrConvT(( char* )lParam ));
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvT((char*)lParam));
else
- return ( INT_PTR )ppi->SetAwayMsg( wParam, ( TCHAR* )lParam );
- case 34: return ( INT_PTR )ppi->UserIsTyping(( HANDLE )wParam, lParam );
- case 35: lstrcpynA(( char* )lParam, ppi->m_szModuleName, wParam ); return 0;
+ return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
+ case 34: return (INT_PTR)ppi->UserIsTyping((HANDLE)wParam, lParam);
+ case 35: lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam); return 0;
case 36: return ppi->m_iStatus;
case 100:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SetAwayMsg( wParam, ( TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
else
- return ( INT_PTR )ppi->SetAwayMsg( wParam, StrConvA(( TCHAR* )lParam ));
+ return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvA((TCHAR*)lParam));
case 102:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SendFile( hContact, ( TCHAR* )wParam, ( TCHAR** )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
else {
- char** files = Proto_FilesMatrixA(( TCHAR** )lParam );
- INT_PTR res = ( INT_PTR )ppi->SendFile( hContact, StrConvA(( TCHAR* )wParam ), ( TCHAR** )files );
- if ( res == 0 ) FreeFilesMatrix(( TCHAR*** )&files );
+ char** files = Proto_FilesMatrixA((TCHAR**)lParam);
+ INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvA((TCHAR*)wParam), (TCHAR**)files);
+ if (res == 0) FreeFilesMatrix((TCHAR***)&files);
return res;
}
case 103:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->FileAllow( hContact, ( HANDLE )wParam, ( TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
else
- return ( INT_PTR )ppi->FileAllow( hContact, ( HANDLE )wParam, StrConvA(( TCHAR* )lParam ));
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
case 104:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->FileDeny( hContact, ( HANDLE )wParam, ( TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
else
- return ( INT_PTR )ppi->FileDeny( hContact, ( HANDLE )wParam, StrConvA(( TCHAR* )lParam ));
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
case 105: {
- PROTOFILERESUME* pfr = ( PROTOFILERESUME* )lParam;
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action,
- ( const PROTOCHAR** )&pfr->szFilename );
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
+ (const PROTOCHAR**)&pfr->szFilename);
else {
- char* szFname = mir_t2a( pfr->szFilename );
- INT_PTR res = ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action,
- ( const PROTOCHAR** )&szFname);
- mir_free( szFname );
+ char* szFname = mir_t2a(pfr->szFilename);
+ INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
+ (const PROTOCHAR**)&szFname);
+ mir_free(szFname);
} }
case 106:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->AuthRequest( hContact, ( const TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthRequest(hContact, (const TCHAR*)lParam);
else
- return ( INT_PTR )ppi->AuthRequest( hContact, StrConvA(( const TCHAR* )lParam ));
+ return (INT_PTR)ppi->AuthRequest(hContact, StrConvA((const TCHAR*)lParam));
case 107:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, ( const TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, (const TCHAR*)lParam);
else
- return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, StrConvA(( const TCHAR* )lParam ));
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvA((const TCHAR*)lParam));
case 108:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SearchBasic(( const TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchBasic((const TCHAR*)lParam);
else
- return ( INT_PTR )ppi->SearchBasic(StrConvA(( const TCHAR* )lParam ));
+ return (INT_PTR)ppi->SearchBasic(StrConvA((const TCHAR*)lParam));
case 109: {
- PROTOSEARCHBYNAME* psbn = ( PROTOSEARCHBYNAME* )lParam;
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SearchByName( psbn->pszNick, psbn->pszFirstName, psbn->pszLastName );
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
else
- return ( INT_PTR )ppi->SearchByName( StrConvA(( TCHAR* )psbn->pszNick ),
- StrConvA(( TCHAR* )psbn->pszFirstName ), StrConvA(( TCHAR* )psbn->pszLastName ));
+ return (INT_PTR)ppi->SearchByName(StrConvA((TCHAR*)psbn->pszNick),
+ StrConvA((TCHAR*)psbn->pszFirstName), StrConvA((TCHAR*)psbn->pszLastName));
}
case 110:
- if ( ppi->m_iVersion > 1 )
- return ( INT_PTR )ppi->SearchByEmail(( const TCHAR* )lParam );
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByEmail((const TCHAR*)lParam);
else
- return ( INT_PTR )ppi->SearchByEmail(StrConvA(( const TCHAR* )lParam ));
+ return (INT_PTR)ppi->SearchByEmail(StrConvA((const TCHAR*)lParam));
} } } }
- if ( !strcmp( szService, PS_ADDTOLIST )) {
- PROTOSEARCHRESULT *psr = ( PROTOSEARCHRESULT* )lParam;
- if ( !( psr->flags & PSR_UNICODE )) {
- PROTOSEARCHRESULT *psra =( PROTOSEARCHRESULT* )mir_alloc( psr->cbSize );
- memcpy( psra, psr, psr->cbSize );
- psra->nick = ( PROTOCHAR* )mir_u2a( psr->nick );
- psra->firstName = ( PROTOCHAR* )mir_u2a( psr->firstName );
- psra->lastName = ( PROTOCHAR* )mir_u2a( psr->lastName );
- psra->email = ( PROTOCHAR* )mir_u2a( psr->email );
+ if ( !strcmp(szService, PS_ADDTOLIST)) {
+ PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
+ if ( !(psr->flags & PSR_UNICODE)) {
+ PROTOSEARCHRESULT *psra =(PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ memcpy(psra, psr, psr->cbSize);
+ psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
+ psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
+ psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
+ psra->email = (PROTOCHAR*)mir_u2a(psr->email);
- INT_PTR res = MyCallProtoService( szModule, szService, wParam, ( LPARAM )psra );
+ INT_PTR res = MyCallProtoService(szModule, szService, wParam, (LPARAM)psra);
- mir_free( psra->nick );
- mir_free( psra->firstName );
- mir_free( psra->lastName );
- mir_free( psra->email );
- mir_free( psra );
+ mir_free(psra->nick);
+ mir_free(psra->firstName);
+ mir_free(psra->lastName);
+ mir_free(psra->email);
+ mir_free(psra);
return res;
}
}
- INT_PTR res = MyCallProtoService( szModule, szService, wParam, lParam );
+ INT_PTR res = MyCallProtoService(szModule, szService, wParam, lParam);
- if ( res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr( szService, 'W' )) {
- TServiceListItem *item = serviceItems.find(( TServiceListItem* )&szService );
- if ( !item ) return res;
+ if (res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr(szService, 'W')) {
+ TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
+ if ( !item) return res;
- switch( item->id ) {
+ switch(item->id) {
case 100:
- return ( INT_PTR )pa->ppro->SetAwayMsg( wParam, ( TCHAR* )lParam );
+ return (INT_PTR)pa->ppro->SetAwayMsg(wParam, (TCHAR*)lParam);
case 102: {
- CCSDATA *ccs = ( CCSDATA* )lParam;
- return ( INT_PTR )pa->ppro->SendFile( ccs->hContact, ( TCHAR* )ccs->wParam, ( TCHAR** )ccs->lParam );
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ return (INT_PTR)pa->ppro->SendFile(ccs->hContact, (TCHAR*)ccs->wParam, (TCHAR**)ccs->lParam);
}
case 103: {
- CCSDATA *ccs = ( CCSDATA* )lParam;
- return ( INT_PTR )pa->ppro->FileAllow( ccs->hContact, ( HANDLE )ccs->wParam, ( TCHAR* )ccs->lParam );
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ return (INT_PTR)pa->ppro->FileAllow(ccs->hContact, (HANDLE)ccs->wParam, (TCHAR*)ccs->lParam);
}
case 104: {
- CCSDATA *ccs = ( CCSDATA* )lParam;
- return ( INT_PTR )pa->ppro->FileDeny( ccs->hContact, ( HANDLE )ccs->wParam, ( TCHAR* )ccs->lParam );
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ return (INT_PTR)pa->ppro->FileDeny(ccs->hContact, (HANDLE)ccs->wParam, (TCHAR*)ccs->lParam);
}
case 105: {
- PROTOFILERESUME* pfr = ( PROTOFILERESUME* )lParam;
- return ( INT_PTR )pa->ppro->FileResume(( HANDLE )wParam, &pfr->action, &pfr->szFilename );
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ return (INT_PTR)pa->ppro->FileResume((HANDLE)wParam, &pfr->action, &pfr->szFilename);
}
case 106: {
- CCSDATA *ccs = ( CCSDATA* )lParam;
- return ( INT_PTR )pa->ppro->AuthRequest( ccs->hContact, ( const TCHAR* )ccs->lParam );
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ return (INT_PTR)pa->ppro->AuthRequest(ccs->hContact, (const TCHAR*)ccs->lParam);
}
case 107:
- return ( INT_PTR )pa->ppro->AuthDeny(( HANDLE )wParam, ( const TCHAR* )lParam );
+ return (INT_PTR)pa->ppro->AuthDeny((HANDLE)wParam, (const TCHAR*)lParam);
case 108:
- return ( INT_PTR )pa->ppro->SearchBasic(( const TCHAR* )lParam );
+ return (INT_PTR)pa->ppro->SearchBasic((const TCHAR*)lParam);
case 109: {
- PROTOSEARCHBYNAME* psbn = ( PROTOSEARCHBYNAME* )lParam;
- return ( INT_PTR )pa->ppro->SearchByName( psbn->pszNick, psbn->pszFirstName, psbn->pszLastName );
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ return (INT_PTR)pa->ppro->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
}
case 110:
- return ( INT_PTR )pa->ppro->SearchByEmail(( const TCHAR* )lParam );
+ return (INT_PTR)pa->ppro->SearchByEmail((const TCHAR*)lParam);
} }
@@ -667,7 +667,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * /////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR CallContactService( HANDLE hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam )
+INT_PTR CallContactService(HANDLE hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam)
{
int i;
DBVARIANT dbv;
@@ -675,126 +675,126 @@ INT_PTR CallContactService( HANDLE hContact, const char *szProtoService, WPARAM PROTOACCOUNT* pa;
CCSDATA ccs = { hContact, szProtoService, wParam, lParam };
- for ( i = 0;; i++ ) {
+ for (i = 0;; i++) {
char str[10];
- _itoa( i, str, 10 );
- if ( DBGetContactSettingString( hContact, "_Filter", str, &dbv ))
+ _itoa(i, str, 10);
+ if (DBGetContactSettingString(hContact, "_Filter", str, &dbv))
break;
- if (( ret = CallProtoServiceInt( hContact, dbv.pszVal, szProtoService, i+1, ( LPARAM)&ccs )) != CALLSERVICE_NOTFOUND ) {
+ if ((ret = CallProtoServiceInt(hContact, dbv.pszVal, szProtoService, i+1, (LPARAM)&ccs)) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
return ret;
}
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
}
- if ( DBGetContactSettingString( hContact, "Protocol", "p", &dbv ))
+ if (DBGetContactSettingString(hContact, "Protocol", "p", &dbv))
return 1;
- pa = Proto_GetAccount( dbv.pszVal );
- if ( pa == NULL || pa->ppro == NULL )
+ pa = Proto_GetAccount(dbv.pszVal);
+ if (pa == NULL || pa->ppro == NULL)
ret = 1;
else {
- if ( pa->bOldProto )
- ret = CallProtoServiceInt( hContact, dbv.pszVal, szProtoService, (WPARAM)(-1), ( LPARAM)&ccs );
+ if (pa->bOldProto)
+ ret = CallProtoServiceInt(hContact, dbv.pszVal, szProtoService, (WPARAM)(-1), (LPARAM)&ccs);
else
- ret = CallProtoServiceInt( hContact, dbv.pszVal, szProtoService, wParam, lParam );
- if ( ret == CALLSERVICE_NOTFOUND )
+ ret = CallProtoServiceInt(hContact, dbv.pszVal, szProtoService, wParam, lParam);
+ if (ret == CALLSERVICE_NOTFOUND)
ret = 1;
}
- mir_free( dbv.pszVal );
+ mir_free(dbv.pszVal);
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////////
-static void InsertServiceListItem( int id, const char* szName )
+static void InsertServiceListItem(int id, const char* szName)
{
- TServiceListItem* p = ( TServiceListItem* )mir_alloc( sizeof( TServiceListItem ));
+ TServiceListItem* p = (TServiceListItem*)mir_alloc(sizeof(TServiceListItem));
p->id = id;
p->name = szName;
- serviceItems.insert( p );
+ serviceItems.insert(p);
}
int LoadProtocolsModule(void)
{
bModuleInitialized = TRUE;
- if ( LoadProtoChains() )
+ if (LoadProtoChains())
return 1;
- InsertServiceListItem( 1, PS_ADDTOLIST );
- InsertServiceListItem( 2, PS_ADDTOLISTBYEVENT );
- InsertServiceListItem( 3, PS_AUTHALLOW );
- InsertServiceListItem( 4, PS_AUTHDENY );
- InsertServiceListItem( 5, PSR_AUTH );
- InsertServiceListItem( 6, PSS_AUTHREQUEST );
- InsertServiceListItem( 7, PS_CHANGEINFO );
- InsertServiceListItem( 8, PSS_FILEALLOW );
- InsertServiceListItem( 9, PSS_FILECANCEL );
- InsertServiceListItem( 10, PSS_FILEDENY );
- InsertServiceListItem( 11, PS_FILERESUME );
- InsertServiceListItem( 12, PS_GETCAPS );
- InsertServiceListItem( 13, PS_LOADICON );
- InsertServiceListItem( 14, PSS_GETINFO );
- InsertServiceListItem( 15, PS_BASICSEARCH );
- InsertServiceListItem( 16, PS_SEARCHBYEMAIL );
- InsertServiceListItem( 17, PS_SEARCHBYNAME );
- InsertServiceListItem( 18, PS_SEARCHBYADVANCED );
- InsertServiceListItem( 19, PS_CREATEADVSEARCHUI );
- InsertServiceListItem( 20, PSR_CONTACTS );
- InsertServiceListItem( 21, PSR_FILE );
- InsertServiceListItem( 22, PSR_MESSAGE );
- InsertServiceListItem( 23, PSR_URL );
- InsertServiceListItem( 24, PSS_CONTACTS );
- InsertServiceListItem( 25, PSS_FILE );
- InsertServiceListItem( 26, PSS_MESSAGE );
- InsertServiceListItem( 27, PSS_URL );
- InsertServiceListItem( 28, PSS_SETAPPARENTMODE );
- InsertServiceListItem( 29, PS_SETSTATUS );
- InsertServiceListItem( 30, PSS_GETAWAYMSG );
- InsertServiceListItem( 31, PSR_AWAYMSG );
- InsertServiceListItem( 32, PSS_AWAYMSG );
- InsertServiceListItem( 33, PS_SETAWAYMSG );
- InsertServiceListItem( 34, PSS_USERISTYPING );
- InsertServiceListItem( 35, PS_GETNAME );
- InsertServiceListItem( 36, PS_GETSTATUS );
-
-
- InsertServiceListItem( 100, PS_SETAWAYMSGW );
- InsertServiceListItem( 102, PSS_FILEW );
- InsertServiceListItem( 103, PSS_FILEALLOWW );
- InsertServiceListItem( 104, PSS_FILEDENYW );
- InsertServiceListItem( 105, PS_FILERESUMEW );
- InsertServiceListItem( 106, PSS_AUTHREQUESTW );
- InsertServiceListItem( 107, PS_AUTHDENYW );
- InsertServiceListItem( 108, PS_BASICSEARCHW );
- InsertServiceListItem( 109, PS_SEARCHBYNAMEW );
- InsertServiceListItem( 110, PS_SEARCHBYEMAILW );
+ InsertServiceListItem( 1, PS_ADDTOLIST);
+ InsertServiceListItem( 2, PS_ADDTOLISTBYEVENT);
+ InsertServiceListItem( 3, PS_AUTHALLOW);
+ InsertServiceListItem( 4, PS_AUTHDENY);
+ InsertServiceListItem( 5, PSR_AUTH);
+ InsertServiceListItem( 6, PSS_AUTHREQUEST);
+ InsertServiceListItem( 7, PS_CHANGEINFO);
+ InsertServiceListItem( 8, PSS_FILEALLOW);
+ InsertServiceListItem( 9, PSS_FILECANCEL);
+ InsertServiceListItem(10, PSS_FILEDENY);
+ InsertServiceListItem(11, PS_FILERESUME);
+ InsertServiceListItem(12, PS_GETCAPS);
+ InsertServiceListItem(13, PS_LOADICON);
+ InsertServiceListItem(14, PSS_GETINFO);
+ InsertServiceListItem(15, PS_BASICSEARCH);
+ InsertServiceListItem(16, PS_SEARCHBYEMAIL);
+ InsertServiceListItem(17, PS_SEARCHBYNAME);
+ InsertServiceListItem(18, PS_SEARCHBYADVANCED);
+ InsertServiceListItem(19, PS_CREATEADVSEARCHUI);
+ InsertServiceListItem(20, PSR_CONTACTS);
+ InsertServiceListItem(21, PSR_FILE);
+ InsertServiceListItem(22, PSR_MESSAGE);
+ InsertServiceListItem(23, PSR_URL);
+ InsertServiceListItem(24, PSS_CONTACTS);
+ InsertServiceListItem(25, PSS_FILE);
+ InsertServiceListItem(26, PSS_MESSAGE);
+ InsertServiceListItem(27, PSS_URL);
+ InsertServiceListItem(28, PSS_SETAPPARENTMODE);
+ InsertServiceListItem(29, PS_SETSTATUS);
+ InsertServiceListItem(30, PSS_GETAWAYMSG);
+ InsertServiceListItem(31, PSR_AWAYMSG);
+ InsertServiceListItem(32, PSS_AWAYMSG);
+ InsertServiceListItem(33, PS_SETAWAYMSG);
+ InsertServiceListItem(34, PSS_USERISTYPING);
+ InsertServiceListItem(35, PS_GETNAME);
+ InsertServiceListItem(36, PS_GETSTATUS);
+
+
+ InsertServiceListItem(100, PS_SETAWAYMSGW);
+ InsertServiceListItem(102, PSS_FILEW);
+ InsertServiceListItem(103, PSS_FILEALLOWW);
+ InsertServiceListItem(104, PSS_FILEDENYW);
+ InsertServiceListItem(105, PS_FILERESUMEW);
+ InsertServiceListItem(106, PSS_AUTHREQUESTW);
+ InsertServiceListItem(107, PS_AUTHDENYW);
+ InsertServiceListItem(108, PS_BASICSEARCHW);
+ InsertServiceListItem(109, PS_SEARCHBYNAMEW);
+ InsertServiceListItem(110, PS_SEARCHBYEMAILW);
hAckEvent = CreateHookableEvent(ME_PROTO_ACK);
hTypeEvent = CreateHookableEvent(ME_PROTO_CONTACTISTYPING);
hAccListChanged = CreateHookableEvent(ME_PROTO_ACCLISTCHANGED);
- CreateServiceFunction( MS_PROTO_BROADCASTACK, Proto_BroadcastAck );
- CreateServiceFunction( MS_PROTO_ISPROTOCOLLOADED, srvProto_IsLoaded );
- CreateServiceFunction( MS_PROTO_ENUMPROTOS, Proto_EnumProtocols );
- CreateServiceFunction( MS_PROTO_REGISTERMODULE, Proto_RegisterModule );
- CreateServiceFunction( MS_PROTO_SELFISTYPING, Proto_SelfIsTyping );
- CreateServiceFunction( MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping );
+ CreateServiceFunction(MS_PROTO_BROADCASTACK, Proto_BroadcastAck);
+ CreateServiceFunction(MS_PROTO_ISPROTOCOLLOADED, srvProto_IsLoaded);
+ CreateServiceFunction(MS_PROTO_ENUMPROTOS, Proto_EnumProtocols);
+ CreateServiceFunction(MS_PROTO_REGISTERMODULE, Proto_RegisterModule);
+ CreateServiceFunction(MS_PROTO_SELFISTYPING, Proto_SelfIsTyping);
+ CreateServiceFunction(MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping);
- CreateServiceFunction( MS_PROTO_RECVFILE, Proto_RecvFile );
- CreateServiceFunction( MS_PROTO_RECVFILET, Proto_RecvFileT );
- CreateServiceFunction( MS_PROTO_RECVMSG, Proto_RecvMessage );
+ CreateServiceFunction(MS_PROTO_RECVFILE, Proto_RecvFile);
+ CreateServiceFunction(MS_PROTO_RECVFILET, Proto_RecvFileT);
+ CreateServiceFunction(MS_PROTO_RECVMSG, Proto_RecvMessage);
- CreateServiceFunction( "Proto/EnumProtocols", Proto_EnumAccounts );
- CreateServiceFunction( MS_PROTO_ENUMACCOUNTS, Proto_EnumAccounts );
- CreateServiceFunction( MS_PROTO_GETACCOUNT, srvProto_GetAccount );
+ CreateServiceFunction("Proto/EnumProtocols", Proto_EnumAccounts);
+ CreateServiceFunction(MS_PROTO_ENUMACCOUNTS, Proto_EnumAccounts);
+ CreateServiceFunction(MS_PROTO_GETACCOUNT, srvProto_GetAccount);
- CreateServiceFunction( MS_PROTO_ISACCOUNTENABLED, srvProto_IsAccountEnabled );
- CreateServiceFunction( MS_PROTO_ISACCOUNTLOCKED, srvProto_IsAccountLocked );
+ CreateServiceFunction(MS_PROTO_ISACCOUNTENABLED, srvProto_IsAccountEnabled);
+ CreateServiceFunction(MS_PROTO_ISACCOUNTLOCKED, srvProto_IsAccountLocked);
return LoadProtoOptions();
}
@@ -803,38 +803,38 @@ void UnloadProtocolsModule() {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
- if ( hAckEvent ) {
+ if (hAckEvent) {
DestroyHookableEvent(hAckEvent);
hAckEvent = NULL;
}
- if ( hAccListChanged ) {
+ if (hAccListChanged) {
DestroyHookableEvent(hAccListChanged);
hAccListChanged = NULL;
}
- if ( protos.getCount() ) {
- for ( i=0; i < protos.getCount(); i++ ) {
- mir_free( protos[i]->szName);
- mir_free( protos[i] );
+ if (protos.getCount()) {
+ for (i=0; i < protos.getCount(); i++) {
+ mir_free(protos[i]->szName);
+ mir_free(protos[i]);
}
protos.destroy();
}
- for ( i=0; i < serviceItems.getCount(); i++ )
- mir_free( serviceItems[i] );
+ for (i=0; i < serviceItems.getCount(); i++)
+ mir_free(serviceItems[i]);
serviceItems.destroy();
}
/////////////////////////////////////////////////////////////////////////////////////////
-pfnUninitProto GetProtocolDestructor( char* szProto )
+pfnUninitProto GetProtocolDestructor(char* szProto)
{
int idx;
PROTOCOLDESCRIPTOR temp;
temp.szName = szProto;
- if (( idx = protos.getIndex( &temp )) != -1 )
+ if ((idx = protos.getIndex(&temp)) != -1)
return protos[idx]->fnUninit;
return NULL;
diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp index fa2ec3b729..8470ef308a 100644 --- a/src/modules/protocols/protoint.cpp +++ b/src/modules/protocols/protoint.cpp @@ -23,208 +23,208 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
-char** __fastcall Proto_FilesMatrixA( TCHAR **files );
-void FreeFilesMatrix( TCHAR ***files );
+char** __fastcall Proto_FilesMatrixA(TCHAR **files);
+void FreeFilesMatrix(TCHAR ***files);
-INT_PTR __fastcall MyCallProtoService( const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam )
+INT_PTR __fastcall MyCallProtoService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
{
char str[MAXMODULELABELLENGTH];
- mir_snprintf( str, sizeof(str), "%s%s", szModule, szService );
+ mir_snprintf(str, sizeof(str), "%s%s", szModule, szService);
return CallService(str, wParam, lParam);
}
struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
{
- HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr )
- { return ( HANDLE )MyCallProtoService( m_szModuleName, PS_ADDTOLIST, flags, (LPARAM)psr );
+ HANDLE __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr)
+ { return (HANDLE)MyCallProtoService(m_szModuleName, PS_ADDTOLIST, flags, (LPARAM)psr);
}
- HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent )
- { return ( HANDLE )MyCallProtoService( m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), (LPARAM)hDbEvent );
+ HANDLE __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
+ { return (HANDLE)MyCallProtoService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), (LPARAM)hDbEvent);
}
- int __cdecl Authorize( HANDLE hContact )
- { return ( int )MyCallProtoService( m_szModuleName, PS_AUTHALLOW, (WPARAM)hContact, 0 );
+ int __cdecl Authorize(HANDLE hContact)
+ { return (int)MyCallProtoService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hContact, 0);
}
- int __cdecl AuthDeny( HANDLE hContact, const TCHAR* szReason )
- { return ( int )MyCallProtoService( m_szModuleName, PS_AUTHDENY, (WPARAM)hContact, (LPARAM)StrConvA(szReason));
+ int __cdecl AuthDeny(HANDLE hContact, const TCHAR* szReason)
+ { return (int)MyCallProtoService(m_szModuleName, PS_AUTHDENY, (WPARAM)hContact, (LPARAM)StrConvA(szReason));
}
- int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* evt )
+ int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT* evt)
{ CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)evt };
- return ( int )MyCallProtoService( m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs);
}
- int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage )
+ int __cdecl AuthRequest(HANDLE hContact, const TCHAR* szMessage)
{ CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage };
- ccs.lParam = ( LPARAM )mir_t2a( szMessage );
- int res = ( int )MyCallProtoService( m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs );
- mir_free(( char* )ccs.lParam );
+ ccs.lParam = (LPARAM)mir_t2a(szMessage);
+ int res = (int)MyCallProtoService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
+ mir_free((char*)ccs.lParam);
return res;
}
- HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData )
- { return ( HANDLE )MyCallProtoService( m_szModuleName, PS_CHANGEINFO, iInfoType, ( LPARAM )pInfoData );
+ HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData)
+ { return (HANDLE)MyCallProtoService(m_szModuleName, PS_CHANGEINFO, iInfoType, (LPARAM)pInfoData);
}
- HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath )
+ HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath)
{ CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
- ccs.lParam = ( LPARAM )mir_t2a( szPath );
- HANDLE res = ( HANDLE )MyCallProtoService( m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs );
- mir_free(( char* )ccs.lParam );
+ ccs.lParam = (LPARAM)mir_t2a(szPath);
+ HANDLE res = (HANDLE)MyCallProtoService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
+ mir_free((char*)ccs.lParam);
return res;
}
- int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer )
+ int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer)
{ CCSDATA ccs = { hContact, PSS_FILECANCEL, (WPARAM)hTransfer, 0 };
- return ( int )MyCallProtoService( m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs);
}
- int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason )
+ int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason)
{ CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
- ccs.lParam = ( LPARAM )mir_t2a( szReason );
- int res = ( int )MyCallProtoService( m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs );
- mir_free(( char* )ccs.lParam );
+ ccs.lParam = (LPARAM)mir_t2a(szReason);
+ int res = (int)MyCallProtoService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
+ mir_free((char*)ccs.lParam);
return res;
}
- int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename )
+ int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename)
{ PROTOFILERESUME pfr = { *action, *szFilename };
- pfr.szFilename = ( PROTOCHAR* )mir_t2a( pfr.szFilename );
- int res = ( int )MyCallProtoService( m_szModuleName, PS_FILERESUME, ( WPARAM )hTransfer, ( LPARAM )&pfr);
- mir_free(( PROTOCHAR* )*szFilename );
+ pfr.szFilename = (PROTOCHAR*)mir_t2a(pfr.szFilename);
+ int res = (int)MyCallProtoService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
+ mir_free((PROTOCHAR*)*szFilename);
*action = pfr.action; *szFilename = (PROTOCHAR*)pfr.szFilename;
return res;
}
- DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact )
- { return ( DWORD_PTR )MyCallProtoService( m_szModuleName, PS_GETCAPS, type, (LPARAM)hContact );
+ DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact)
+ { return (DWORD_PTR)MyCallProtoService(m_szModuleName, PS_GETCAPS, type, (LPARAM)hContact);
}
- HICON __cdecl GetIcon( int iconIndex )
- { return ( HICON )MyCallProtoService( m_szModuleName, PS_LOADICON, iconIndex, 0 );
+ HICON __cdecl GetIcon(int iconIndex)
+ { return (HICON)MyCallProtoService(m_szModuleName, PS_LOADICON, iconIndex, 0);
}
- int __cdecl GetInfo( HANDLE hContact, int flags )
+ int __cdecl GetInfo(HANDLE hContact, int flags)
{ CCSDATA ccs = { hContact, PSS_GETINFO, flags, 0 };
- return MyCallProtoService( m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs );
+ return MyCallProtoService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SearchBasic( const PROTOCHAR* id )
- { return ( HANDLE )MyCallProtoService( m_szModuleName, PS_BASICSEARCH, 0, ( LPARAM )StrConvA( id ));
+ HANDLE __cdecl SearchBasic(const PROTOCHAR* id)
+ { return (HANDLE)MyCallProtoService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)StrConvA(id));
}
- HANDLE __cdecl SearchByEmail( const PROTOCHAR* email )
- { return ( HANDLE )MyCallProtoService( m_szModuleName, PS_SEARCHBYEMAIL, 0, ( LPARAM )StrConvA( email ));
+ HANDLE __cdecl SearchByEmail(const PROTOCHAR* email)
+ { return (HANDLE)MyCallProtoService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)StrConvA(email));
}
- HANDLE __cdecl SearchByName( const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName )
+ HANDLE __cdecl SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName)
{ PROTOSEARCHBYNAME psn;
- psn.pszNick = ( PROTOCHAR* )mir_t2a( nick );
- psn.pszFirstName = ( PROTOCHAR* )mir_t2a( firstName );
- psn.pszLastName = ( PROTOCHAR* )mir_t2a( lastName );
- HANDLE res = ( HANDLE )MyCallProtoService( m_szModuleName, PS_SEARCHBYNAME, 0, ( LPARAM )&psn );
- mir_free( psn.pszNick );
- mir_free( psn.pszFirstName );
- mir_free( psn.pszLastName );
+ psn.pszNick = (PROTOCHAR*)mir_t2a(nick);
+ psn.pszFirstName = (PROTOCHAR*)mir_t2a(firstName);
+ psn.pszLastName = (PROTOCHAR*)mir_t2a(lastName);
+ HANDLE res = (HANDLE)MyCallProtoService(m_szModuleName, PS_SEARCHBYNAME, 0, (LPARAM)&psn);
+ mir_free(psn.pszNick);
+ mir_free(psn.pszFirstName);
+ mir_free(psn.pszLastName);
return res;
}
- HWND __cdecl SearchAdvanced( HWND owner )
- { return ( HWND )MyCallProtoService( m_szModuleName, PS_SEARCHBYADVANCED, 0, ( LPARAM )owner );
+ HWND __cdecl SearchAdvanced(HWND owner)
+ { return (HWND)MyCallProtoService(m_szModuleName, PS_SEARCHBYADVANCED, 0, (LPARAM)owner);
}
- HWND __cdecl CreateExtendedSearchUI( HWND owner )
- { return ( HWND )MyCallProtoService( m_szModuleName, PS_CREATEADVSEARCHUI, 0, ( LPARAM )owner );
+ HWND __cdecl CreateExtendedSearchUI(HWND owner)
+ { return (HWND)MyCallProtoService(m_szModuleName, PS_CREATEADVSEARCHUI, 0, (LPARAM)owner);
}
- int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* evt )
+ int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT* evt)
{ CCSDATA ccs = { hContact, PSR_CONTACTS, 0, (LPARAM)evt };
- return ( int )MyCallProtoService( m_szModuleName, PSR_CONTACTS, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSR_CONTACTS, 0, (LPARAM)&ccs);
}
- int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* evt )
+ int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT* evt)
{ CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)evt };
- return MyCallProtoService( m_szModuleName, PSR_FILE, 0, (LPARAM)&ccs );
+ return MyCallProtoService(m_szModuleName, PSR_FILE, 0, (LPARAM)&ccs);
}
- int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* evt )
+ int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT* evt)
{ CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)evt };
- return ( int )MyCallProtoService( m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs);
}
- int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* evt )
+ int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT* evt)
{ CCSDATA ccs = { hContact, PSR_URL, 0, (LPARAM)evt };
- return ( int )MyCallProtoService( m_szModuleName, PSR_URL, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSR_URL, 0, (LPARAM)&ccs);
}
- int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList )
+ int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList)
{ CCSDATA ccs = { hContact, PSS_CONTACTS, MAKEWPARAM(flags, nContacts), (LPARAM)hContactsList };
- return ( int )MyCallProtoService( m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles )
+ HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles)
{ CCSDATA ccs = { hContact, PSS_FILE, (WPARAM)szDescription, (LPARAM)ppszFiles };
- ccs.wParam = ( WPARAM )mir_t2a( szDescription );
- ccs.lParam = ( LPARAM )Proto_FilesMatrixA( ppszFiles );
- HANDLE res = ( HANDLE )MyCallProtoService( m_szModuleName, PSS_FILE, 0, ( LPARAM )&ccs );
- if ( res == 0 ) FreeFilesMatrix(( TCHAR*** )&ccs.lParam );
- mir_free(( char* )ccs.wParam );
+ ccs.wParam = (WPARAM)mir_t2a(szDescription);
+ ccs.lParam = (LPARAM)Proto_FilesMatrixA(ppszFiles);
+ HANDLE res = (HANDLE)MyCallProtoService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
+ if (res == 0) FreeFilesMatrix((TCHAR***)&ccs.lParam);
+ mir_free((char*)ccs.wParam);
return res;
}
- int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg )
+ int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg)
{ CCSDATA ccs = { hContact, PSS_MESSAGE, flags, (LPARAM)msg };
- return ( int )MyCallProtoService( m_szModuleName, PSS_MESSAGE, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSS_MESSAGE, 0, (LPARAM)&ccs);
}
- int __cdecl SendUrl( HANDLE hContact, int flags, const char* url )
+ int __cdecl SendUrl(HANDLE hContact, int flags, const char* url)
{ CCSDATA ccs = { hContact, PSS_URL, flags, (LPARAM)url };
- return ( int )MyCallProtoService( m_szModuleName, PSS_URL, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSS_URL, 0, (LPARAM)&ccs);
}
- int __cdecl SetApparentMode( HANDLE hContact, int mode )
+ int __cdecl SetApparentMode(HANDLE hContact, int mode)
{ CCSDATA ccs = { hContact, PSS_SETAPPARENTMODE, mode, 0 };
- return ( int )MyCallProtoService( m_szModuleName, PSS_SETAPPARENTMODE, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSS_SETAPPARENTMODE, 0, (LPARAM)&ccs);
}
- int __cdecl SetStatus( int iNewStatus )
- { return ( int )MyCallProtoService( m_szModuleName, PS_SETSTATUS, iNewStatus, 0 );
+ int __cdecl SetStatus(int iNewStatus)
+ { return (int)MyCallProtoService(m_szModuleName, PS_SETSTATUS, iNewStatus, 0);
}
- HANDLE __cdecl GetAwayMsg( HANDLE hContact )
+ HANDLE __cdecl GetAwayMsg(HANDLE hContact)
{ CCSDATA ccs = { hContact, PSS_GETAWAYMSG, 0, 0 };
- return ( HANDLE )MyCallProtoService( m_szModuleName, PSS_GETAWAYMSG, 0, (LPARAM)&ccs );
+ return (HANDLE)MyCallProtoService(m_szModuleName, PSS_GETAWAYMSG, 0, (LPARAM)&ccs);
}
- int __cdecl RecvAwayMsg( HANDLE hContact, int statusMode, PROTORECVEVENT* evt )
+ int __cdecl RecvAwayMsg(HANDLE hContact, int statusMode, PROTORECVEVENT* evt)
{ CCSDATA ccs = { hContact, PSR_AWAYMSG, statusMode, (LPARAM)evt };
- return ( int )MyCallProtoService( m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs);
}
- int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg )
+ int __cdecl SendAwayMsg(HANDLE hContact, HANDLE hProcess, const char* msg)
{ CCSDATA ccs = { hContact, PSS_AWAYMSG, (WPARAM)hProcess, (LPARAM)msg };
- return ( int )MyCallProtoService( m_szModuleName, PSS_AWAYMSG, 0, (LPARAM)&ccs );
+ return (int)MyCallProtoService(m_szModuleName, PSS_AWAYMSG, 0, (LPARAM)&ccs);
}
- int __cdecl SetAwayMsg( int iStatus, const TCHAR* msg )
- { return ( int )MyCallProtoService( m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)StrConvA(msg));
+ int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg)
+ { return (int)MyCallProtoService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)StrConvA(msg));
}
- int __cdecl UserIsTyping( HANDLE hContact, int type )
+ int __cdecl UserIsTyping(HANDLE hContact, int type)
{ CCSDATA ccs = { hContact, PSS_USERISTYPING, (WPARAM)hContact, type };
- return MyCallProtoService( m_szModuleName, PSS_USERISTYPING, 0, (LPARAM)&ccs );
+ return MyCallProtoService(m_szModuleName, PSS_USERISTYPING, 0, (LPARAM)&ccs);
}
- int __cdecl OnEvent( PROTOEVENTTYPE, WPARAM, LPARAM )
+ int __cdecl OnEvent(PROTOEVENTTYPE, WPARAM, LPARAM)
{
return 0;
}
@@ -232,23 +232,23 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE // creates the default protocol container for compatibility with the old plugins
-PROTO_INTERFACE* AddDefaultAccount( const char* szProtoName )
+PROTO_INTERFACE* AddDefaultAccount(const char* szProtoName)
{
PROTO_INTERFACE* ppi = new DEFAULT_PROTO_INTERFACE;
- if ( ppi != NULL ) {
+ if (ppi != NULL) {
ppi->m_iVersion = 1;
- ppi->m_szModuleName = mir_strdup( szProtoName );
- ppi->m_szProtoName = mir_strdup( szProtoName );
- ppi->m_tszUserName = mir_a2t( szProtoName );
+ ppi->m_szModuleName = mir_strdup(szProtoName);
+ ppi->m_szProtoName = mir_strdup(szProtoName);
+ ppi->m_tszUserName = mir_a2t(szProtoName);
}
return ppi;
}
-int FreeDefaultAccount( PROTO_INTERFACE* ppi )
+int FreeDefaultAccount(PROTO_INTERFACE* ppi)
{
- mir_free( ppi->m_szModuleName );
- mir_free( ppi->m_szProtoName );
- mir_free( ppi->m_tszUserName );
+ mir_free(ppi->m_szModuleName);
+ mir_free(ppi->m_szProtoName);
+ mir_free(ppi->m_tszUserName);
delete ppi;
return 0;
}
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 10beb627c7..9339c1e282 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WM_MY_REFRESH (WM_USER+0x1000)
#define WM_MY_RENAME (WM_USER+0x1001)
-INT_PTR Proto_EnumProtocols( WPARAM, LPARAM );
+INT_PTR Proto_EnumProtocols(WPARAM, LPARAM);
bool CheckProtocolOrder(void);
#define errMsg \
@@ -56,7 +56,7 @@ static HWND hAccMgr = NULL; extern HANDLE hAccListChanged;
-int UnloadPlugin( TCHAR* buf, int bufLen );
+int UnloadPlugin(TCHAR* buf, int bufLen);
///////////////////////////////////////////////////////////////////////////////////////////////////
// Account edit form
@@ -71,65 +71,65 @@ typedef struct static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch( message ) {
+ switch(message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
PROTOCOLDESCRIPTOR** proto;
int protoCount, i, cnt = 0;
- Proto_EnumProtocols(( WPARAM )&protoCount, ( LPARAM )&proto );
- for ( i=0; i < protoCount; i++ ) {
+ Proto_EnumProtocols((WPARAM)&protoCount, (LPARAM)&proto);
+ for (i=0; i < protoCount; i++) {
PROTOCOLDESCRIPTOR* pd = proto[i];
- if ( pd->type == PROTOTYPE_PROTOCOL && pd->cbSize == sizeof( *pd )) {
- SendDlgItemMessageA( hwndDlg, IDC_PROTOTYPECOMBO, CB_ADDSTRING, 0, (LPARAM)proto[i]->szName );
+ if (pd->type == PROTOTYPE_PROTOCOL && pd->cbSize == sizeof(*pd)) {
+ SendDlgItemMessageA(hwndDlg, IDC_PROTOTYPECOMBO, CB_ADDSTRING, 0, (LPARAM)proto[i]->szName);
++cnt;
}
}
- SendDlgItemMessage( hwndDlg, IDC_PROTOTYPECOMBO, CB_SETCURSEL, 0, 0 );
- EnableWindow( GetDlgItem( hwndDlg, IDOK ), cnt != 0 );
+ SendDlgItemMessage(hwndDlg, IDC_PROTOTYPECOMBO, CB_SETCURSEL, 0, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), cnt != 0);
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
- AccFormDlgParam* param = ( AccFormDlgParam* )lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ AccFormDlgParam* param = (AccFormDlgParam*)lParam;
- if ( param->action == PRAC_ADDED ) // new account
- SetWindowText( hwndDlg, TranslateT( "Create new account" ));
+ if (param->action == PRAC_ADDED) // new account
+ SetWindowText(hwndDlg, TranslateT("Create new account"));
else {
TCHAR str[200];
- if ( param->action == PRAC_CHANGED ) { // update
- EnableWindow( GetDlgItem( hwndDlg, IDC_PROTOTYPECOMBO ), FALSE );
- mir_sntprintf( str, SIZEOF(str), _T("%s: %s"), TranslateT( "Editing account" ), param->pa->tszAccountName );
+ if (param->action == PRAC_CHANGED) { // update
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOTYPECOMBO), FALSE);
+ mir_sntprintf(str, SIZEOF(str), _T("%s: %s"), TranslateT("Editing account"), param->pa->tszAccountName);
}
- else mir_sntprintf( str, SIZEOF(str), _T("%s: %s"), TranslateT( "Upgrading account" ), param->pa->tszAccountName );
+ else mir_sntprintf(str, SIZEOF(str), _T("%s: %s"), TranslateT("Upgrading account"), param->pa->tszAccountName);
- SetWindowText( hwndDlg, str );
- SetDlgItemText( hwndDlg, IDC_ACCNAME, param->pa->tszAccountName );
- SetDlgItemTextA( hwndDlg, IDC_ACCINTERNALNAME, param->pa->szModuleName );
- SendDlgItemMessageA( hwndDlg, IDC_PROTOTYPECOMBO, CB_SELECTSTRING, -1, (LPARAM)param->pa->szProtoName );
+ SetWindowText(hwndDlg, str);
+ SetDlgItemText(hwndDlg, IDC_ACCNAME, param->pa->tszAccountName);
+ SetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, param->pa->szModuleName);
+ SendDlgItemMessageA(hwndDlg, IDC_PROTOTYPECOMBO, CB_SELECTSTRING, -1, (LPARAM)param->pa->szProtoName);
- EnableWindow( GetDlgItem( hwndDlg, IDC_ACCINTERNALNAME ), FALSE );
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ACCINTERNALNAME), FALSE);
}
- SendDlgItemMessage( hwndDlg, IDC_ACCINTERNALNAME, EM_LIMITTEXT, 40, 0 );
+ SendDlgItemMessage(hwndDlg, IDC_ACCINTERNALNAME, EM_LIMITTEXT, 40, 0);
}
return TRUE;
case WM_COMMAND:
- switch( LOWORD(wParam)) {
+ switch(LOWORD(wParam)) {
case IDOK:
{
- AccFormDlgParam* param = ( AccFormDlgParam* )GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ AccFormDlgParam* param = (AccFormDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
PROTOACCOUNT* pa = param->pa;
- if ( param->action == PRAC_ADDED ) {
+ if (param->action == PRAC_ADDED) {
char buf[200];
- GetDlgItemTextA( hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF( buf ));
- rtrim( buf );
- if ( buf[0] ) {
+ GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF(buf));
+ rtrim(buf);
+ if (buf[0]) {
for (int i = 0; i < accounts.getCount(); ++i)
if (_stricmp(buf, accounts[i]->szModuleName) == 0)
return FALSE;
} }
- switch( param->action ) {
+ switch(param->action) {
case PRAC_UPGRADED:
{
int idx;
@@ -149,8 +149,8 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam // fall through
case PRAC_ADDED:
- pa = (PROTOACCOUNT*)mir_calloc( sizeof( PROTOACCOUNT ));
- pa->cbSize = sizeof( PROTOACCOUNT );
+ pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
+ pa->cbSize = sizeof(PROTOACCOUNT);
pa->bIsEnabled = TRUE;
pa->bIsVisible = TRUE;
@@ -160,55 +160,55 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam }
{
TCHAR buf[256];
- GetDlgItemText( hwndDlg, IDC_ACCNAME, buf, SIZEOF( buf ));
+ GetDlgItemText(hwndDlg, IDC_ACCNAME, buf, SIZEOF(buf));
mir_free(pa->tszAccountName);
- pa->tszAccountName = mir_tstrdup( buf );
+ pa->tszAccountName = mir_tstrdup(buf);
}
- if ( param->action == PRAC_ADDED || param->action == PRAC_UPGRADED )
+ if (param->action == PRAC_ADDED || param->action == PRAC_UPGRADED)
{
char buf[200];
- GetDlgItemTextA( hwndDlg, IDC_PROTOTYPECOMBO, buf, SIZEOF( buf ));
- pa->szProtoName = mir_strdup( buf );
- GetDlgItemTextA( hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF( buf ));
- rtrim( buf );
- if ( buf[0] == 0 ) {
+ GetDlgItemTextA(hwndDlg, IDC_PROTOTYPECOMBO, buf, SIZEOF(buf));
+ pa->szProtoName = mir_strdup(buf);
+ GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF(buf));
+ rtrim(buf);
+ if (buf[0] == 0) {
int count = 1;
- for (;; ) {
+ for (;;) {
DBVARIANT dbv;
- mir_snprintf( buf, SIZEOF(buf), "%s_%d", pa->szProtoName, count++ );
- if ( DBGetContactSettingString( NULL, buf, "AM_BaseProto", &dbv ))
+ mir_snprintf(buf, SIZEOF(buf), "%s_%d", pa->szProtoName, count++);
+ if (DBGetContactSettingString(NULL, buf, "AM_BaseProto", &dbv))
break;
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
} }
- pa->szModuleName = mir_strdup( buf );
+ pa->szModuleName = mir_strdup(buf);
- if ( !pa->tszAccountName[0] ) {
+ if ( !pa->tszAccountName[0]) {
mir_free(pa->tszAccountName);
pa->tszAccountName = mir_a2t(buf);
}
- DBWriteContactSettingString( NULL, pa->szModuleName, "AM_BaseProto", pa->szProtoName );
- accounts.insert( pa );
+ DBWriteContactSettingString(NULL, pa->szModuleName, "AM_BaseProto", pa->szProtoName);
+ accounts.insert(pa);
- if ( ActivateAccount( pa )) {
- pa->ppro->OnEvent( EV_PROTO_ONLOAD, 0, 0 );
- if (!DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
- pa->ppro->OnEvent( EV_PROTO_ONMENU, 0, 0 );
+ if (ActivateAccount(pa)) {
+ pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
+ if ( !DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
+ pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
else pa->type = PROTOTYPE_DISPROTO;
}
WriteDbAccounts();
- NotifyEventHooks( hAccListChanged, param->action, ( LPARAM )pa );
+ NotifyEventHooks(hAccListChanged, param->action, (LPARAM)pa);
- SendMessage( GetParent(hwndDlg), WM_MY_REFRESH, 0, 0 );
+ SendMessage(GetParent(hwndDlg), WM_MY_REFRESH, 0, 0);
}
- EndDialog( hwndDlg, TRUE );
+ EndDialog(hwndDlg, TRUE);
break;
case IDCANCEL:
- EndDialog( hwndDlg, FALSE );
+ EndDialog(hwndDlg, FALSE);
break;
}
}
@@ -267,7 +267,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_KILLFOCUS:
{
int length = GetWindowTextLength(hwnd) + 1;
- TCHAR *str = ( TCHAR* )mir_alloc(sizeof(TCHAR) * length);
+ TCHAR *str = (TCHAR*)mir_alloc(sizeof(TCHAR) * length);
GetWindowText(hwnd, str, length);
SendMessage(GetParent(GetParent(hwnd)), WM_COMMAND, MAKEWPARAM(GetWindowLongPtr(GetParent(hwnd), GWL_ID), LBN_MY_RENAME), (LPARAM)str);
}
@@ -280,7 +280,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct TAccListData *dat = (struct TAccListData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if ( !dat )
+ if ( !dat)
return DefWindowProc(hwnd, msg, wParam, lParam);
switch (msg) {
@@ -331,7 +331,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA RECT rc;
struct TAccMgrData *parentDat = (struct TAccMgrData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwnd, ListBox_GetCurSel(hwnd));
- if (!pa || pa->bOldProto || pa->bDynDisabled)
+ if ( !pa || pa->bOldProto || pa->bDynDisabled)
return 0;
ListBox_GetItemRect(hwnd, ListBox_GetCurSel(hwnd), &rc);
@@ -405,29 +405,29 @@ static void sttSelectItem(struct TAccMgrData *dat, HWND hwndList, int iItem) static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_ACCLIST);
- int curSel = ListBox_GetCurSel( hwndList );
- if ( curSel != LB_ERR ) {
+ int curSel = ListBox_GetCurSel(hwndList);
+ if (curSel != LB_ERR) {
HWND hwnd;
char svc[MAXMODULELABELLENGTH];
PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, curSel);
- if ( pa ) {
- EnableWindow( GetDlgItem( hwndDlg, IDC_UPGRADE ), pa->bOldProto || pa->bDynDisabled );
- EnableWindow( GetDlgItem( hwndDlg, IDC_EDIT ), !pa->bOldProto && !pa->bDynDisabled );
- EnableWindow( GetDlgItem( hwndDlg, IDC_REMOVE ), TRUE );
- EnableWindow( GetDlgItem( hwndDlg, IDC_OPTIONS ), pa->ppro != 0 );
+ if (pa) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPGRADE), pa->bOldProto || pa->bDynDisabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), !pa->bOldProto && !pa->bDynDisabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS), pa->ppro != 0);
- if ( dat->iSelected >= 0 ) {
+ if (dat->iSelected >= 0) {
PROTOACCOUNT *pa_old = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, dat->iSelected);
if (pa_old && pa_old != pa && pa_old->hwndAccMgrUI)
ShowWindow(pa_old->hwndAccMgrUI, SW_HIDE);
}
- if ( pa->hwndAccMgrUI ) {
+ if (pa->hwndAccMgrUI) {
ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_HIDE);
ShowWindow(pa->hwndAccMgrUI, SW_SHOW);
}
- else if ( !pa->ppro ) {
+ else if ( !pa->ppro) {
ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW);
SetWindowText(GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT("Account is disabled. Please activate it to access options."));
}
@@ -452,10 +452,10 @@ static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat) return;
} }
- EnableWindow( GetDlgItem( hwndDlg, IDC_UPGRADE ), FALSE );
- EnableWindow( GetDlgItem( hwndDlg, IDC_EDIT ), FALSE );
- EnableWindow( GetDlgItem( hwndDlg, IDC_REMOVE ), FALSE );
- EnableWindow( GetDlgItem( hwndDlg, IDC_OPTIONS ), FALSE );
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPGRADE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW);
SetWindowText(GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT(welcomeMsg));
@@ -472,12 +472,12 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
TranslateDialogDefault(hwndDlg);
- Window_SetIcon_IcoLib( hwndDlg, SKINICON_OTHER_ACCMGR );
+ Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_ACCMGR);
Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("New account"));
Button_SetIcon_IcoLib(hwndDlg, IDC_EDIT, SKINICON_OTHER_RENAME, LPGEN("Edit"));
Button_SetIcon_IcoLib(hwndDlg, IDC_REMOVE, SKINICON_OTHER_DELETE, LPGEN("Remove account"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_OPTIONS, SKINICON_OTHER_OPTIONS, LPGEN( "Configure..."));
+ Button_SetIcon_IcoLib(hwndDlg, IDC_OPTIONS, SKINICON_OTHER_OPTIONS, LPGEN("Configure..."));
Button_SetIcon_IcoLib(hwndDlg, IDC_UPGRADE, SKINICON_OTHER_ACCMGR, LPGEN("Upgrade account"));
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), FALSE);
@@ -499,7 +499,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM dat->hfntTitle = CreateFontIndirect(&lf);
hdc = GetDC(hwndDlg);
- hfnt = ( HFONT )SelectObject(hdc, dat->hfntTitle);
+ hfnt = (HFONT)SelectObject(hdc, dat->hfntTitle);
GetTextMetrics(hdc, &tm);
dat->titleHeight = tm.tmHeight;
SelectObject(hdc, dat->hfntText);
@@ -518,18 +518,18 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM dat->iSelected = -1;
sttSubclassAccList(GetDlgItem(hwndDlg, IDC_ACCLIST), TRUE);
- SendMessage( hwndDlg, WM_MY_REFRESH, 0, 0 );
+ SendMessage(hwndDlg, WM_MY_REFRESH, 0, 0);
Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "AccMgr", "");
}
return TRUE;
case WM_CTLCOLORSTATIC:
- switch ( GetDlgCtrlID(( HWND )lParam )) {
+ switch (GetDlgCtrlID((HWND)lParam)) {
case IDC_WHITERECT:
case IDC_NAME:
- SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW ));
- return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW );
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
}
break;
@@ -578,9 +578,9 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lps->rcItem.top += 2;
lps->rcItem.bottom -= 2;
- if ( acc->bOldProto )
+ if (acc->bOldProto)
tmp = SKINICON_OTHER_ON;
- else if ( acc->bDynDisabled )
+ else if (acc->bDynDisabled)
tmp = SKINICON_OTHER_OFF;
else
tmp = acc->bIsEnabled ? SKINICON_OTHER_TICK : SKINICON_OTHER_NOTICK;
@@ -592,7 +592,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lps->rcItem.left += cxIcon + 2;
if (acc->ppro) {
- hIcon = acc->ppro->GetIcon( PLI_PROTOCOL | PLIF_SMALL );
+ hIcon = acc->ppro->GetIcon(PLI_PROTOCOL | PLIF_SMALL);
DrawIconEx(lps->hDC, lps->rcItem.left, lps->rcItem.top, hIcon, cxIcon, cyIcon, 0, hbrBack, DI_NORMAL);
DestroyIcon(hIcon);
}
@@ -624,7 +624,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM TCHAR *tszIdName;
CONTACTINFO ci = { 0 };
- szIdName = (char *)acc->ppro->GetCaps( PFLAG_UNIQUEIDTEXT, 0 );
+ szIdName = (char *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
tszIdName = szIdName ? mir_a2t(szIdName) : mir_tstrdup(TranslateT("Account ID"));
ci.cbSize = sizeof(ci);
@@ -634,11 +634,11 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_sntprintf( text, size, _T("%s: %s"), tszIdName, ci.pszVal );
+ mir_sntprintf(text, size, _T("%s: %s"), tszIdName, ci.pszVal);
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
- mir_sntprintf( text, size, _T("%s: %d"), tszIdName, ci.dVal );
+ mir_sntprintf(text, size, _T("%s: %d"), tszIdName, ci.dVal);
break;
}
}
@@ -661,7 +661,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM PROTOACCOUNT *acc = (i == LB_ERR) ? NULL : (PROTOACCOUNT *)ListBox_GetItemData(hList, i);
dat->iSelected = -1;
- SendMessage( hList, LB_RESETCONTENT, 0, 0 );
+ SendMessage(hList, LB_RESETCONTENT, 0, 0);
for (i = 0; i < accounts.getCount(); ++i) {
int iItem = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)accounts[i]->tszAccountName);
SendMessage(hList, LB_SETITEMDATA, iItem, (LPARAM)accounts[i]);
@@ -681,24 +681,24 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM break;
case WM_CONTEXTMENU:
- if ( GetWindowLongPtr(( HWND )wParam, GWL_ID ) == IDC_ACCLIST ) {
- HWND hwndList = GetDlgItem( hwndDlg, IDC_ACCLIST );
- POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
- int iItem = ListBox_GetCurSel( hwndList );
+ if (GetWindowLongPtr((HWND)wParam, GWL_ID) == IDC_ACCLIST) {
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_ACCLIST);
+ POINT pt = { (signed short)LOWORD(lParam), (signed short)HIWORD(lParam) };
+ int iItem = ListBox_GetCurSel(hwndList);
- if (( pt.x == -1 ) && ( pt.y == -1 )) {
+ if ((pt.x == -1) && (pt.y == -1)) {
if (iItem != LB_ERR) {
RECT rc;
- ListBox_GetItemRect( hwndList, iItem, &rc );
+ ListBox_GetItemRect(hwndList, iItem, &rc);
pt.x = rc.left + GetSystemMetrics(SM_CXSMICON) + 4;
pt.y = rc.top + 4 + max(GetSystemMetrics(SM_CXSMICON), dat->titleHeight);
- ClientToScreen( hwndList, &pt );
+ ClientToScreen(hwndList, &pt);
}
}
else {
// menu was activated with mouse => find item under cursor & set focus to our control.
POINT ptItem = pt;
- ScreenToClient( hwndList, &ptItem );
+ ScreenToClient(hwndList, &ptItem);
iItem = (short)LOWORD(SendMessage(hwndList, LB_ITEMFROMPOINT, 0, MAKELPARAM(ptItem.x, ptItem.y)));
if (iItem != LB_ERR)
{
@@ -709,21 +709,21 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM }
}
- if ( iItem != LB_ERR ) {
+ if (iItem != LB_ERR) {
PROTOACCOUNT* pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, iItem);
HMENU hMenu = CreatePopupMenu();
- if ( !pa->bOldProto && !pa->bDynDisabled )
+ if ( !pa->bOldProto && !pa->bDynDisabled)
AppendMenu(hMenu, MF_STRING, 1, TranslateT("Rename"));
AppendMenu(hMenu, MF_STRING, 3, TranslateT("Delete"));
- if ( Proto_IsAccountEnabled( pa ))
+ if (Proto_IsAccountEnabled(pa))
AppendMenu(hMenu, MF_STRING, 4, TranslateT("Configure"));
- if ( pa->bOldProto || pa->bDynDisabled )
+ if (pa->bOldProto || pa->bDynDisabled)
AppendMenu(hMenu, MF_STRING, 5, TranslateT("Upgrade"));
- switch (TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL )) {
+ switch (TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
case 1:
PostMessage(hwndList, WM_MY_RENAME, 0, 0);
break;
@@ -744,13 +744,13 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM sttClickButton(hwndDlg, IDC_UPGRADE);
break;
}
- DestroyMenu( hMenu );
+ DestroyMenu(hMenu);
}
}
break;
case WM_COMMAND:
- switch( LOWORD(wParam)) {
+ switch(LOWORD(wParam)) {
case IDC_ACCLIST:
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_ACCLIST);
@@ -768,16 +768,16 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM case LBN_MY_CHECK:
{
PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, lParam);
- if ( pa ) {
- if ( pa->bOldProto || pa->bDynDisabled)
+ if (pa) {
+ if (pa->bOldProto || pa->bDynDisabled)
break;
pa->bIsEnabled = !pa->bIsEnabled;
- if ( pa->bIsEnabled ) {
- if ( ActivateAccount( pa )) {
- pa->ppro->OnEvent( EV_PROTO_ONLOAD, 0, 0 );
- if (!DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
- pa->ppro->OnEvent( EV_PROTO_ONMENU, 0, 0 );
+ if (pa->bIsEnabled) {
+ if (ActivateAccount(pa)) {
+ pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
+ if ( !DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
+ pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
else pa->type = PROTOTYPE_DISPROTO; }
else {
@@ -790,12 +790,12 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM }
}
- if ( !pa->bIsEnabled )
- DeactivateAccount( pa, true, false );
+ if ( !pa->bIsEnabled)
+ DeactivateAccount(pa, true, false);
}
WriteDbAccounts();
- NotifyEventHooks( hAccListChanged, PRAC_CHECKED, ( LPARAM )pa );
+ NotifyEventHooks(hAccListChanged, PRAC_CHECKED, (LPARAM)pa);
sttUpdateAccountInfo(hwndDlg, dat);
RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE);
} }
@@ -805,7 +805,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM {
int iItem = ListBox_GetCurSel(hwndList);
PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, iItem);
- if ( pa ) {
+ if (pa) {
mir_free(pa->tszAccountName);
pa->tszAccountName = (TCHAR*)lParam;
WriteDbAccounts();
@@ -829,82 +829,82 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM case IDC_ADD:
{
AccFormDlgParam param = { PRAC_ADDED, NULL };
- if ( IDOK == DialogBoxParam( hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m ))
- SendMessage( hwndDlg, WM_MY_REFRESH, 0, 0 );
+ if (IDOK == DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m))
+ SendMessage(hwndDlg, WM_MY_REFRESH, 0, 0);
}
break;
case IDC_EDIT:
{
- HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST );
- int idx = ListBox_GetCurSel( hList );
- if ( idx != -1 )
+ HWND hList = GetDlgItem(hwndDlg, IDC_ACCLIST);
+ int idx = ListBox_GetCurSel(hList);
+ if (idx != -1)
PostMessage(hList, WM_MY_RENAME, 0, 0);
}
break;
case IDC_REMOVE:
{
- HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST );
- int idx = ListBox_GetCurSel( hList );
- if ( idx != -1 ) {
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )ListBox_GetItemData( hList, idx );
+ HWND hList = GetDlgItem(hwndDlg, IDC_ACCLIST);
+ int idx = ListBox_GetCurSel(hList);
+ if (idx != -1) {
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)ListBox_GetItemData(hList, idx);
TCHAR buf[ 200 ];
- mir_sntprintf( buf, SIZEOF(buf), TranslateT( "Account %s is being deleted" ), pa->tszAccountName );
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("Account %s is being deleted"), pa->tszAccountName);
if (pa->bOldProto) {
- MessageBox( NULL, TranslateT( "You need to disable plugin to delete this account" ), buf,
- MB_ICONERROR | MB_OK );
+ MessageBox(NULL, TranslateT("You need to disable plugin to delete this account"), buf,
+ MB_ICONERROR | MB_OK);
break;
}
- if ( IDYES == MessageBox( NULL, TranslateT( errMsg ), buf, MB_ICONSTOP | MB_DEFBUTTON2 | MB_YESNO )) {
+ if (IDYES == MessageBox(NULL, TranslateT(errMsg), buf, MB_ICONSTOP | MB_DEFBUTTON2 | MB_YESNO)) {
// lock controls to avoid changes during remove process
- ListBox_SetCurSel( hList, -1 );
- sttUpdateAccountInfo( hwndDlg, dat );
- EnableWindow( hList, FALSE );
- EnableWindow( GetDlgItem(hwndDlg, IDC_ADD), FALSE );
+ ListBox_SetCurSel(hList, -1);
+ sttUpdateAccountInfo(hwndDlg, dat);
+ EnableWindow(hList, FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
- ListBox_SetItemData( hList, idx, 0 );
+ ListBox_SetItemData(hList, idx, 0);
- accounts.remove( pa );
+ accounts.remove(pa);
CheckProtocolOrder();
WriteDbAccounts();
- NotifyEventHooks( hAccListChanged, PRAC_REMOVED, ( LPARAM )pa );
+ NotifyEventHooks(hAccListChanged, PRAC_REMOVED, (LPARAM)pa);
- UnloadAccount( pa, true, true );
- SendMessage( hwndDlg, WM_MY_REFRESH, 0, 0 );
+ UnloadAccount(pa, true, true);
+ SendMessage(hwndDlg, WM_MY_REFRESH, 0, 0);
- EnableWindow( hList, TRUE );
- EnableWindow( GetDlgItem(hwndDlg, IDC_ADD), TRUE );
+ EnableWindow(hList, TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE);
} } }
break;
case IDC_OPTIONS:
{
- HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST );
- int idx = ListBox_GetCurSel( hList );
- if ( idx != -1 ) {
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )ListBox_GetItemData( hList, idx );
- if ( pa->bOldProto ) {
+ HWND hList = GetDlgItem(hwndDlg, IDC_ACCLIST);
+ int idx = ListBox_GetCurSel(hList);
+ if (idx != -1) {
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)ListBox_GetItemData(hList, idx);
+ if (pa->bOldProto) {
OPENOPTIONSDIALOG ood;
ood.cbSize = sizeof(ood);
ood.pszGroup = "Network";
ood.pszPage = pa->szModuleName;
ood.pszTab = NULL;
- CallService( MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood );
+ CallService(MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood);
}
- else OpenAccountOptions( pa );
+ else OpenAccountOptions(pa);
} }
break;
case IDC_UPGRADE:
{
- HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST );
- int idx = ListBox_GetCurSel( hList );
- if ( idx != -1 ) {
- AccFormDlgParam param = { PRAC_UPGRADED, ( PROTOACCOUNT* )ListBox_GetItemData( hList, idx ) };
- DialogBoxParam( hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m );
+ HWND hList = GetDlgItem(hwndDlg, IDC_ACCLIST);
+ int idx = ListBox_GetCurSel(hList);
+ if (idx != -1) {
+ AccFormDlgParam param = { PRAC_UPGRADED, (PROTOACCOUNT*)ListBox_GetItemData(hList, idx) };
+ DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m);
} }
break;
@@ -918,7 +918,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM OPENOPTIONSDIALOG ood = {0};
ood.cbSize = sizeof(ood);
ood.pszPage = "Network";
- CallService( MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood );
+ CallService(MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood);
break;
}
@@ -948,9 +948,9 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM }
case PSM_CHANGED:
{
- HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST );
- int idx = ListBox_GetCurSel( hList );
- if ( idx != -1 ) {
+ HWND hList = GetDlgItem(hwndDlg, IDC_ACCLIST);
+ int idx = ListBox_GetCurSel(hList);
+ if (idx != -1) {
PROTOACCOUNT *acc = (PROTOACCOUNT *)ListBox_GetItemData(hList, idx);
if (acc)
{
@@ -970,7 +970,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM PSHNOTIFY pshn = {0};
pshn.hdr.code = PSN_APPLY;
for (i = 0; i < accounts.getCount(); ++i) {
- if ( accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged ) {
+ if (accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged) {
pshn.hdr.hwndFrom = accounts[i]->hwndAccMgrUI;
SendMessage(accounts[i]->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn);
accounts[i]->bAccMgrUIChanged = FALSE;
@@ -983,7 +983,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM PSHNOTIFY pshn = {0};
pshn.hdr.code = PSN_RESET;
for (i = 0; i < accounts.getCount(); ++i) {
- if ( accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged ) {
+ if (accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged) {
pshn.hdr.hwndFrom = accounts[i]->hwndAccMgrUI;
SendMessage(accounts[i]->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn);
accounts[i]->bAccMgrUIChanged = FALSE;
@@ -1003,13 +1003,13 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM accounts[i]->hwndAccMgrUI = NULL;
} } }
- Window_FreeIcon_IcoLib( hwndDlg );
- Button_FreeIcon_IcoLib( hwndDlg, IDC_ADD );
- Button_FreeIcon_IcoLib( hwndDlg, IDC_EDIT );
- Button_FreeIcon_IcoLib( hwndDlg, IDC_REMOVE );
- Button_FreeIcon_IcoLib( hwndDlg, IDC_OPTIONS );
- Button_FreeIcon_IcoLib( hwndDlg, IDC_UPGRADE );
- Utils_SaveWindowPosition( hwndDlg, NULL, "AccMgr", "");
+ Window_FreeIcon_IcoLib(hwndDlg);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_EDIT);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_REMOVE);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_OPTIONS);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_UPGRADE);
+ Utils_SaveWindowPosition(hwndDlg, NULL, "AccMgr", "");
sttSubclassAccList(GetDlgItem(hwndDlg, IDC_ACCLIST), FALSE);
DeleteObject(dat->hfntTitle);
DeleteObject(dat->hfntText);
@@ -1023,12 +1023,12 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM static INT_PTR OptProtosShow(WPARAM, LPARAM)
{
- if ( !hAccMgr )
- hAccMgr = CreateDialogParam( hMirandaInst, MAKEINTRESOURCE(IDD_ACCMGR), NULL, AccMgrDlgProc, 0 );
+ if ( !hAccMgr)
+ hAccMgr = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ACCMGR), NULL, AccMgrDlgProc, 0);
- ShowWindow( hAccMgr, SW_RESTORE );
- SetForegroundWindow( hAccMgr );
- SetActiveWindow( hAccMgr );
+ ShowWindow(hAccMgr, SW_RESTORE);
+ SetForegroundWindow(hAccMgr);
+ SetActiveWindow(hAccMgr);
return 0;
}
@@ -1037,7 +1037,7 @@ int OptProtosLoaded(WPARAM, LPARAM) CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_ACCMGR );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ACCMGR);
mi.position = 1900000000;
mi.pszName = LPGEN("&Accounts...");
mi.pszService = MS_PROTO_SHOWACCMGR;
@@ -1045,16 +1045,16 @@ int OptProtosLoaded(WPARAM, LPARAM) return 0;
}
-static int OnAccListChanged( WPARAM eventCode, LPARAM lParam )
+static int OnAccListChanged(WPARAM eventCode, LPARAM lParam)
{
PROTOACCOUNT* pa = (PROTOACCOUNT*)lParam;
- switch( eventCode ) {
+ switch(eventCode) {
case PRAC_CHANGED:
- if ( pa->ppro ) {
- mir_free( pa->ppro->m_tszUserName );
- pa->ppro->m_tszUserName = mir_tstrdup( pa->tszAccountName );
- pa->ppro->OnEvent( EV_PROTO_ONRENAME, 0, lParam );
+ if (pa->ppro) {
+ mir_free(pa->ppro->m_tszUserName);
+ pa->ppro->m_tszUserName = mir_tstrdup(pa->tszAccountName);
+ pa->ppro->OnEvent(EV_PROTO_ONRENAME, 0, lParam);
}
}
@@ -1063,18 +1063,18 @@ static int OnAccListChanged( WPARAM eventCode, LPARAM lParam ) static int ShutdownAccMgr(WPARAM, LPARAM)
{
- if ( IsWindow( hAccMgr ))
- DestroyWindow( hAccMgr );
+ if (IsWindow(hAccMgr))
+ DestroyWindow(hAccMgr);
hAccMgr = NULL;
return 0;
}
-int LoadProtoOptions( void )
+int LoadProtoOptions(void)
{
- CreateServiceFunction( MS_PROTO_SHOWACCMGR, OptProtosShow );
+ CreateServiceFunction(MS_PROTO_SHOWACCMGR, OptProtosShow);
- HookEvent( ME_SYSTEM_MODULESLOADED, OptProtosLoaded );
- HookEvent( ME_PROTO_ACCLISTCHANGED, OnAccListChanged );
- HookEvent( ME_SYSTEM_PRESHUTDOWN, ShutdownAccMgr );
+ HookEvent(ME_SYSTEM_MODULESLOADED, OptProtosLoaded);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownAccMgr);
return 0;
}
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 64987b4aa4..e9588c30ad 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -55,18 +55,18 @@ struct _THotkeyItem static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2)
{
int res;
- if ( res = lstrcmp( p1->ptszSection_tr, p2->ptszSection_tr ))
+ if (res = lstrcmp(p1->ptszSection_tr, p2->ptszSection_tr))
return res;
- if ( res = lstrcmp( p1->ptszDescription_tr, p2->ptszDescription_tr ))
+ if (res = lstrcmp(p1->ptszDescription_tr, p2->ptszDescription_tr))
return res;
- if (!p1->rootHotkey && p2->rootHotkey)
+ if ( !p1->rootHotkey && p2->rootHotkey)
return -1;
if (p1->rootHotkey && !p2->rootHotkey)
return 1;
return 0;
}
-static LIST<THotkeyItem> hotkeys( 10, sttCompareHotkeys );
+static LIST<THotkeyItem> hotkeys(10, sttCompareHotkeys);
static void sttFreeHotkey(THotkeyItem *item);
@@ -107,12 +107,12 @@ static void sttWordToModAndVk(WORD w, BYTE *mod, BYTE *vk) static LRESULT CALLBACK sttHotkeyHostWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (msg == WM_HOTKEY ) {
+ if (msg == WM_HOTKEY) {
int i;
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
if (item->type != HKT_GLOBAL) continue;
- if (!item->Enabled) continue;
+ if ( !item->Enabled) continue;
if (item->pszService && (wParam == item->idHotkey)) {
CallService(item->pszService, 0, item->lParam);
break;
@@ -130,19 +130,19 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) int i;
BYTE mod=0, vk=wParam;
- if ( vk ) {
+ if (vk) {
if (GetAsyncKeyState(VK_CONTROL)) mod |= MOD_CONTROL;
if (GetAsyncKeyState(VK_MENU)) mod |= MOD_ALT;
if (GetAsyncKeyState(VK_SHIFT)) mod |= MOD_SHIFT;
if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) mod |= MOD_WIN;
- for ( i = 0; i < hotkeys.getCount(); i++ ) {
+ for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
BYTE hkMod, hkVk;
if (item->type != HKT_LOCAL) continue;
sttWordToModAndVk(item->Hotkey, &hkMod, &hkVk);
- if (!hkVk) continue;
- if (!item->Enabled) continue;
+ if ( !hkVk) continue;
+ if ( !item->Enabled) continue;
if (item->pszService && (vk == hkVk) && (mod == hkMod)) {
CallService(item->pszService, 0, item->lParam);
return TRUE;
@@ -166,18 +166,18 @@ static INT_PTR svcHotkeyUnsubclass(WPARAM wParam, LPARAM) static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam)
{
HOTKEYDESC *desc = (HOTKEYDESC *)lParam;
- if ( desc->cbSize != sizeof(HOTKEYDESC) && desc->cbSize != HOTKEYDESC_SIZE_V1 )
+ if (desc->cbSize != sizeof(HOTKEYDESC) && desc->cbSize != HOTKEYDESC_SIZE_V1)
return 0;
- THotkeyItem *item = ( THotkeyItem* )mir_alloc(sizeof(THotkeyItem));
- DWORD dwFlags = ( desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
- if ( dwFlags & HKD_UNICODE ) {
- item->ptszSection = mir_tstrdup( desc->ptszSection );
- item->ptszDescription = mir_tstrdup( desc->ptszDescription );
+ THotkeyItem *item = (THotkeyItem*)mir_alloc(sizeof(THotkeyItem));
+ DWORD dwFlags = (desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
+ if (dwFlags & HKD_UNICODE) {
+ item->ptszSection = mir_tstrdup(desc->ptszSection);
+ item->ptszDescription = mir_tstrdup(desc->ptszDescription);
}
else {
- item->ptszSection = mir_a2u( desc->pszSection );
- item->ptszDescription = mir_a2u( desc->pszDescription );
+ item->ptszSection = mir_a2u(desc->pszSection);
+ item->ptszDescription = mir_a2u(desc->pszDescription);
}
item->ptszSection_tr = TranslateTS(item->ptszSection);
@@ -186,7 +186,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->rootHotkey = NULL;
item->nSubHotkeys = 0;
- if ( item->rootHotkey = hotkeys.find( item )) {
+ if (item->rootHotkey = hotkeys.find(item)) {
if (item->rootHotkey->allowSubHotkeys) {
char nameBuf[MAXMODULELABELLENGTH];
mir_snprintf(nameBuf, SIZEOF(nameBuf), "%s$%d", item->rootHotkey->pszName, item->rootHotkey->nSubHotkeys);
@@ -211,7 +211,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->DefHotkey = desc->DefHotKey & ~HKF_MIRANDA_LOCAL;
item->Hotkey = DBGetContactSettingWord(NULL, DBMODULENAME, item->pszName, item->DefHotkey);
item->type = item->pszService ?
- ( THotkeyType )DBGetContactSettingByte(NULL, DBMODULENAME "Types", item->pszName,
+ (THotkeyType)DBGetContactSettingByte(NULL, DBMODULENAME "Types", item->pszName,
(desc->DefHotKey & HKF_MIRANDA_LOCAL) ? HKT_LOCAL : HKT_GLOBAL) : HKT_MANUAL;
item->lParam = desc->lParam;
@@ -225,16 +225,16 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) if (vk) RegisterHotKey(g_hwndHotkeyHost, item->idHotkey, mod, vk);
} }
- hotkeys.insert( item );
+ hotkeys.insert(item);
- if ( !item->rootHotkey ) {
+ if ( !item->rootHotkey) {
/* try to load alternatives from db */
int count, i;
mir_snprintf(buf, SIZEOF(buf), "%s$count", item->pszName);
count = (int)DBGetContactSettingDword(NULL, DBMODULENAME, buf, -1);
for (i = 0; i < count; i++) {
mir_snprintf(buf, SIZEOF(buf), "%s$%d", item->pszName, i);
- if (!DBGetContactSettingWord(NULL, DBMODULENAME, buf, 0))
+ if ( !DBGetContactSettingWord(NULL, DBMODULENAME, buf, 0))
continue;
svcHotkeyRegister(wParam, lParam);
@@ -242,7 +242,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->allowSubHotkeys = count < 0;
}
else {
- mir_free( item->pszName );
+ mir_free(item->pszName);
item->pszName = NULL;
}
@@ -263,10 +263,10 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) char *pszCurrentName = hotkeys[i]->rootHotkey ?
hotkeys[i]->rootHotkey->pszName :
hotkeys[i]->pszName;
- if (!pszCurrentName) continue;
+ if ( !pszCurrentName) continue;
hotkeys[i]->UnregisterHotkey =
- !lstrcmpA(pszCurrentName, pszName) ||
+ !lstrcmpA(pszCurrentName, pszName) ||
!strncmp(pszCurrentName, pszNamePrefix, cbNamePrefix);
}
@@ -298,13 +298,13 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) if (GetAsyncKeyState(VK_SHIFT)) mod |= MOD_SHIFT;
if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) mod |= MOD_WIN;
- for ( i = 0; i < hotkeys.getCount(); i++ ) {
+ for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
BYTE hkMod, hkVk;
if ((item->type != HKT_MANUAL) || lstrcmp(pszSection, item->ptszSection)) continue;
sttWordToModAndVk(item->Hotkey, &hkMod, &hkVk);
- if (!hkVk) continue;
- if (!item->Enabled) continue;
+ if ( !hkVk) continue;
+ if ( !item->Enabled) continue;
if ((vk == hkVk) && (mod == hkMod)) {
mir_free(pszSection);
return item->lParam;
@@ -316,7 +316,7 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) static void sttFreeHotkey(THotkeyItem *item)
{
- if ( item->type == HKT_GLOBAL && item->Enabled )
+ if (item->type == HKT_GLOBAL && item->Enabled)
UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey);
GlobalDeleteAtom(item->idHotkey);
mir_free(item->pszName);
@@ -329,7 +329,7 @@ static void sttFreeHotkey(THotkeyItem *item) static void sttRegisterHotkeys()
{
int i;
- for ( i = 0; i < hotkeys.getCount(); i++ ) {
+ for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey);
if (item->type != HKT_GLOBAL) continue;
@@ -344,7 +344,7 @@ static void sttUnregisterHotkeys() int i;
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
- if ( item->type == HKT_GLOBAL && item->Enabled )
+ if (item->type == HKT_GLOBAL && item->Enabled)
UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey);
}
}
@@ -420,7 +420,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP {
THotkeyBoxData *data = (THotkeyBoxData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
BOOL bKeyDown = FALSE;
- if (!data) return 0;
+ if ( !data) return 0;
switch (msg) {
case HKM_GETHOTKEY:
@@ -460,7 +460,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP BYTE shift = 0;
BYTE key = wParam;
TCHAR *name = sttHokeyVkToName(key);
- if (!*name || !bKeyDown) key = 0;
+ if ( !*name || !bKeyDown) key = 0;
if (GetAsyncKeyState(VK_CONTROL)) shift |= HOTKEYF_CONTROL;
if (GetAsyncKeyState(VK_MENU)) shift |= HOTKEYF_ALT;
@@ -518,7 +518,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item) LVITEM lvi = {0};
lvi.iItem = idx;
- if ( !item->rootHotkey ) {
+ if ( !item->rootHotkey) {
lvi.mask = LVIF_TEXT|LVIF_IMAGE;
lvi.iSubItem = COL_NAME;
lvi.pszText = item->ptszDescription_tr;
@@ -534,7 +534,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item) lvi.pszText = buf;
ListView_SetItem(hwndList, &lvi);
- if ( item->rootHotkey ) {
+ if (item->rootHotkey) {
lvi.mask = LVIF_IMAGE;
lvi.iSubItem = COL_TYPE;
lvi.iImage = item->OptType;
@@ -588,16 +588,16 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP if (ListView_GetItem((HWND)lParamSort, &lvi))
item2 = (THotkeyItem *)lvi.lParam;
- if (!item1 && !item2)
+ if ( !item1 && !item2)
return lstrcmp(title1, title2);
- if (!item1) {
+ if ( !item1) {
if (res = lstrcmp(title1, item2->ptszSection_tr))
return res;
return -1;
}
- if (!item2) {
+ if ( !item2) {
if (res = lstrcmp(item1->ptszSection_tr, title2))
return res;
return 1;
@@ -627,7 +627,7 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) newItem->OptChanged = newItem->OptDeleted = FALSE;
newItem->OptNew = TRUE;
- hotkeys.insert( newItem );
+ hotkeys.insert(newItem);
SendMessage(hwndList, WM_SETREDRAW, FALSE, 0);
@@ -655,7 +655,7 @@ static void sttOptionsSaveItem(THotkeyItem *item) char buf[MAXMODULELABELLENGTH];
if (item->rootHotkey) return;
- if (!item->OptChanged) return;
+ if ( !item->OptChanged) return;
item->Hotkey = item->OptHotkey;
item->type = item->OptType;
@@ -697,7 +697,7 @@ static void sttBuildHotkeyList(HWND hwndList, TCHAR *section) if (item->OptDeleted) continue;
if (section && lstrcmp(section, item->ptszSection)) continue;
- if ( !section && (!i || lstrcmp(item->ptszSection, ((THotkeyItem *)hotkeys[i-1])->ptszSection ))) {
+ if ( !section && ( !i || lstrcmp(item->ptszSection, ((THotkeyItem *)hotkeys[i-1])->ptszSection))) {
lvi.mask = LVIF_TEXT|LVIF_PARAM;
lvi.iItem = nItems++;
lvi.iSubItem = 0;
@@ -715,7 +715,7 @@ static void sttBuildHotkeyList(HWND hwndList, TCHAR *section) }
lvi.mask = LVIF_PARAM;
- if (!section) {
+ if ( !section) {
lvi.mask |= LVIF_INDENT;
lvi.iIndent = 1;
}
@@ -901,7 +901,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int count;
LVITEM lvi = {0};
- if (!initialized) break;
+ if ( !initialized) break;
newLanguage = LOWORD(GetKeyboardLayout(0));
if (newLanguage == currentLanguage) break;
@@ -910,7 +910,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM;
for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) {
ListView_GetItem(hwndHotkey, &lvi);
- if (!lvi.lParam) continue;
+ if ( !lvi.lParam) continue;
sttOptionsSetupItem(hwndHotkey, lvi.iItem, (THotkeyItem *)lvi.lParam);
}
@@ -928,7 +928,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM;
for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) {
ListView_GetItem(hwndHotkey, &lvi);
- if (!lvi.lParam) continue;
+ if ( !lvi.lParam) continue;
if (((THotkeyItem *)lvi.lParam)->UnregisterHotkey) {
ListView_DeleteItem(hwndHotkey, lvi.iItem);
@@ -996,14 +996,14 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
case WM_COMMAND:
- if (( LOWORD( wParam ) == IDC_HOTKEY) && (( HIWORD( wParam ) == EN_KILLFOCUS) || (HIWORD(wParam) == 0 ))) {
+ if ((LOWORD(wParam) == IDC_HOTKEY) && ((HIWORD(wParam) == EN_KILLFOCUS) || (HIWORD(wParam) == 0))) {
LVITEM lvi;
THotkeyItem *item;
WORD wHotkey = (WORD)SendDlgItemMessage(hwndDlg, IDC_HOTKEY, HKM_GETHOTKEY, 0, 0);
ShowWindow(GetDlgItem(hwndDlg, IDC_HOTKEY), SW_HIDE);
SetFocus(hwndHotkey);
- if ( !wHotkey || (wHotkey == VK_ESCAPE) || (HIWORD(wParam) != 0 ))
+ if ( !wHotkey || (wHotkey == VK_ESCAPE) || (HIWORD(wParam) != 0))
break;
lvi.mask = LVIF_PARAM;
@@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (GetWindowLongPtr((HWND)wParam, GWL_ID) == IDC_LV_HOTKEYS)
{
HWND hwndList = (HWND)wParam;
- POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
+ POINT pt = { (signed short)LOWORD(lParam), (signed short)HIWORD(lParam) };
LVITEM lvi = {0};
THotkeyItem *item = NULL;
@@ -1032,9 +1032,9 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM;
ListView_GetItem(hwndList, &lvi);
- if (!(item = (THotkeyItem *)lvi.lParam)) return FALSE;
+ if ( !(item = (THotkeyItem *)lvi.lParam)) return FALSE;
- if (( pt.x == -1 ) && ( pt.y == -1 )) {
+ if ((pt.x == -1) && (pt.y == -1)) {
RECT rc;
ListView_GetItemRect(hwndList, lvi.iItem, &rc, LVIR_LABEL);
pt.x = rc.left;
@@ -1063,7 +1063,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, (UINT_PTR)MI_LOCAL, TranslateT("Miranda scope"));
}
AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- if (!item->rootHotkey)
+ if ( !item->rootHotkey)
AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_ADD, TranslateT("Add binding"));
else
AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_REMOVE, TranslateT("Remove"));
@@ -1101,7 +1101,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttOptionsSetupItem(hwndList, lvi.iItem, item);
break;
}
- DestroyMenu( hMenu );
+ DestroyMenu(hMenu);
}
break;
@@ -1116,20 +1116,20 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, {
int i;
- if (( lpnmhdr->code != PSN_APPLY) && (lpnmhdr->code != PSN_RESET ))
+ if ((lpnmhdr->code != PSN_APPLY) && (lpnmhdr->code != PSN_RESET))
break;
sttUnregisterHotkeys();
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
- if (item->OptNew && item->OptDeleted ||
- item->rootHotkey && !item->OptHotkey ||
- (lpnmhdr->code == PSN_APPLY) && item->OptDeleted ||
+ if (item->OptNew && item->OptDeleted ||
+ item->rootHotkey && !item->OptHotkey ||
+ (lpnmhdr->code == PSN_APPLY) && item->OptDeleted ||
(lpnmhdr->code == PSN_RESET) && item->OptNew)
{
sttFreeHotkey(item);
- hotkeys.remove( i-- );
+ hotkeys.remove(i--);
}
}
@@ -1149,7 +1149,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttRegisterHotkeys();
- NotifyEventHooks( hEvChanged, 0, 0 );
+ NotifyEventHooks(hEvChanged, 0, 0);
break;
}
case IDC_LV_HOTKEYS:
@@ -1172,7 +1172,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_HitTest(lpnmia->hdr.hwndFrom, &lvhti);
if (item &&
- (!item->rootHotkey && (lpnmia->iSubItem == COL_NAME) && ((lvhti.flags & LVHT_ONITEM) == LVHT_ONITEMICON) ||
+ ( !item->rootHotkey && (lpnmia->iSubItem == COL_NAME) && ((lvhti.flags & LVHT_ONITEM) == LVHT_ONITEMICON) ||
item->rootHotkey && (lpnmia->iSubItem == COL_TYPE)) &&
((item->OptType == HKT_GLOBAL) || (item->OptType == HKT_LOCAL)))
{
@@ -1200,7 +1200,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case LVN_KEYDOWN:
{
LPNMLVKEYDOWN param = (LPNMLVKEYDOWN)lParam;
- if ((param->wVKey == VK_SUBTRACT) || (param->wVKey == VK_LEFT) ||
+ if ((param->wVKey == VK_SUBTRACT) || (param->wVKey == VK_LEFT) ||
(param->wVKey == VK_ADD) || (param->wVKey == VK_RIGHT))
{
LVITEM lvi = {0};
@@ -1242,7 +1242,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, {
LPNMLISTVIEW param = (LPNMLISTVIEW)lParam;
THotkeyItem *item = (THotkeyItem *)param->lParam;
- if (!initialized || (param->uNewState>>12 == param->uOldState>>12))
+ if ( !initialized || (param->uNewState>>12 == param->uOldState>>12))
break;
if (item && !item->rootHotkey) {
@@ -1250,7 +1250,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttOptionsSetChanged(item);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- else if (!item) {
+ else if ( !item) {
TCHAR buf[256];
LVITEM lvi = {0};
lvi.mask = LVIF_TEXT;
@@ -1267,8 +1267,8 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, THotkeyItem *item;
ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
item = (THotkeyItem *)lvi.lParam;
- if (!item) continue;
- if (!lstrcmp(item->ptszSection_tr, buf)) {
+ if ( !item) continue;
+ if ( !lstrcmp(item->ptszSection_tr, buf)) {
ListView_DeleteItem(lpnmhdr->hwndFrom, lvi.iItem);
--lvi.iItem;
--count;
@@ -1303,7 +1303,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (param->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
case CDDS_ITEMPREPAINT:
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
return TRUE;
case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
@@ -1318,7 +1318,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
item = (THotkeyItem *)lvi.lParam;
- if (!item) {
+ if ( !item) {
RECT rc;
HFONT hfnt;
@@ -1333,12 +1333,12 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_GetCheckState(hwndHotkey, lvi.iItem) ? 6 : 7,
param->nmcd.hdc, rc.left, (rc.top+rc.bottom-16)/2, ILD_TRANSPARENT);
rc.left += 18;
- hfnt = ( HFONT )SelectObject(param->nmcd.hdc, (HFONT)SendMessage(GetParent(hwndDlg), PSM_GETBOLDFONT, 0, 0));
+ hfnt = (HFONT)SelectObject(param->nmcd.hdc, (HFONT)SendMessage(GetParent(hwndDlg), PSM_GETBOLDFONT, 0, 0));
DrawText(param->nmcd.hdc, buf, -1, &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
SelectObject(param->nmcd.hdc, hfnt);
}
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
}
@@ -1346,7 +1346,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, RECT rc;
ListView_GetSubItemRect(lpnmhdr->hwndFrom, param->nmcd.dwItemSpec, param->iSubItem, LVIR_BOUNDS, &rc);
FillRect(param->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
}
break;
@@ -1373,7 +1373,7 @@ static int sttOptionsInit(WPARAM wParam, LPARAM) odp.ptszTitle = TranslateT("Hotkeys");
odp.ptszGroup = TranslateT("Customize");
odp.pfnDlgProc = sttOptionsDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -1428,18 +1428,18 @@ int LoadSkinHotkeys(void) {
WORD key;
int i;
- for ( i = 0; i < SIZEOF( oldSettings ); i++ ) {
+ for (i = 0; i < SIZEOF(oldSettings); i++) {
char szSetting[ 100 ];
- mir_snprintf( szSetting, SIZEOF(szSetting), "HK%s", oldSettings[i] );
- if (( key = DBGetContactSettingWord( NULL, "Clist", szSetting, 0 ))) {
- DBDeleteContactSetting( NULL, "Clist", szSetting );
- DBWriteContactSettingWord( NULL, DBMODULENAME, newSettings[i], key );
+ mir_snprintf(szSetting, SIZEOF(szSetting), "HK%s", oldSettings[i]);
+ if ((key = DBGetContactSettingWord(NULL, "Clist", szSetting, 0))) {
+ DBDeleteContactSetting(NULL, "Clist", szSetting);
+ DBWriteContactSettingWord(NULL, DBMODULENAME, newSettings[i], key);
}
- mir_snprintf( szSetting, SIZEOF(szSetting), "HKEn%s", oldSettings[i] );
- if (( key = DBGetContactSettingByte( NULL, "Clist", szSetting, 0 ))) {
- DBDeleteContactSetting( NULL, "Clist", szSetting );
- DBWriteContactSettingByte( NULL, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0) );
+ mir_snprintf(szSetting, SIZEOF(szSetting), "HKEn%s", oldSettings[i]);
+ if ((key = DBGetContactSettingByte(NULL, "Clist", szSetting, 0))) {
+ DBDeleteContactSetting(NULL, "Clist", szSetting);
+ DBWriteContactSettingByte(NULL, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0));
} } }
return 0;
@@ -1449,13 +1449,13 @@ void UnloadSkinHotkeys(void) {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
DestroyHookableEvent(hEvChanged);
UnhookWindowsHookEx(hhkKeyboard);
sttUnregisterHotkeys();
DestroyWindow(g_hwndHotkeyHost);
- for ( i = 0; i < hotkeys.getCount(); i++ )
+ for (i = 0; i < hotkeys.getCount(); i++)
sttFreeHotkey(hotkeys[i]);
hotkeys.destroy();
}
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index a291309d93..787d22eca9 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -116,17 +116,17 @@ const char* protoIconsFmt = LPGEN("%s Icons"); static HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName)
{
int cx = GetSystemMetrics(SM_CXSMICON);
- return ( HICON )LoadImage( hInstance, lpIconName, IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED );
+ return (HICON)LoadImage(hInstance, lpIconName, IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED);
}
// load small icon (not shared) it IS NEED to be destroyed
static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
{
HICON hIcon = NULL; // icon handle
- int index = -( int )lpIconName;
+ int index = -(int)lpIconName;
TCHAR filename[MAX_PATH] = {0};
- GetModuleFileName( hInstance, filename, MAX_PATH );
- ExtractIconEx( filename, index, NULL, &hIcon, 1 );
+ GetModuleFileName(hInstance, filename, MAX_PATH);
+ ExtractIconEx(filename, index, NULL, &hIcon, 1);
return hIcon;
}
@@ -134,9 +134,9 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared)
{
HICON hResIcon = bShared ? LoadSmallIcon(hInstance, lpIconName) : LoadSmallIconShared(hInstance, lpIconName);
- if ( !hResIcon ) { //Icon not found in hInstance lets try to load it from core
+ if ( !hResIcon) { //Icon not found in hInstance lets try to load it from core
HINSTANCE hCoreInstance=hMirandaInst;
- if ( hCoreInstance != hInstance )
+ if (hCoreInstance != hInstance)
hResIcon = bShared ? LoadSmallIcon(hCoreInstance, lpIconName) : LoadSmallIconShared(hCoreInstance, lpIconName);
}
return hResIcon;
@@ -144,7 +144,7 @@ HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource)
{
- HICON hTempIcon=LoadIconEx( hMirandaInst, szResource, 0);
+ HICON hTempIcon=LoadIconEx(hMirandaInst, szResource, 0);
int res = ImageList_AddIcon(hIml, hTempIcon);
Safe_DestroyIcon(hTempIcon);
return res;
@@ -152,7 +152,7 @@ int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource) int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId)
{
- HICON hIcon = LoadSkinIcon( iconId );
+ HICON hIcon = LoadSkinIcon(iconId);
int res = ImageList_AddIcon(hIml, hIcon);
IconLib_ReleaseIcon(hIcon, 0);
return res;
@@ -160,7 +160,7 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char* szProto, int iconId)
{
- HICON hIcon = LoadSkinProtoIcon( szProto, iconId );
+ HICON hIcon = LoadSkinProtoIcon(szProto, iconId);
int res = ImageList_AddIcon(hIml, hIcon);
IconLib_ReleaseIcon(hIcon, 0);
return res;
@@ -183,33 +183,33 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon void Window_SetIcon_IcoLib(HWND hWnd, int iconId)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadSkinIcon( iconId, true ));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadSkinIcon( iconId ));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinIcon(iconId, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinIcon(iconId));
}
void Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadSkinProtoIcon( szProto, iconId, true ));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadSkinProtoIcon( szProto, iconId ));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinProtoIcon(szProto, iconId, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinProtoIcon(szProto, iconId));
}
void Window_FreeIcon_IcoLib(HWND hWnd)
{
- IconLib_ReleaseIcon(( HICON )SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), NULL);
- IconLib_ReleaseIcon(( HICON )SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL);
+ IconLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), NULL);
+ IconLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL);
}
void Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char* tooltip)
{
- HWND hWnd = GetDlgItem( hwndDlg, itemId );
- SendMessage( hWnd, BM_SETIMAGE, IMAGE_ICON, ( LPARAM )LoadSkinIcon( iconId ));
- SendMessage( hWnd, BUTTONSETASFLATBTN, 0, 0 );
- SendMessage( hWnd, BUTTONADDTOOLTIP, (WPARAM)tooltip, 0);
+ HWND hWnd = GetDlgItem(hwndDlg, itemId);
+ SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinIcon(iconId));
+ SendMessage(hWnd, BUTTONSETASFLATBTN, 0, 0);
+ SendMessage(hWnd, BUTTONADDTOOLTIP, (WPARAM)tooltip, 0);
}
void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId)
{
- HICON hIcon = ( HICON )SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0 );
+ HICON hIcon = (HICON)SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0);
IconLib_ReleaseIcon(hIcon, 0);
}
@@ -217,52 +217,52 @@ void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId) // wParam = szProto
// lParam = status
//
-HICON LoadSkinProtoIcon( const char* szProto, int status, bool big )
+HICON LoadSkinProtoIcon(const char* szProto, int status, bool big)
{
int i, statusIndx = -1;
char iconName[MAX_PATH];
HICON hIcon;
- DWORD caps2 = ( szProto == NULL ) ? ( DWORD )-1 : CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0);
+ DWORD caps2 = (szProto == NULL) ? (DWORD)-1 : CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0);
- if ( status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7 );
- return IcoLib_GetIcon( iconName, big );
+ if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) {
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7);
+ return IcoLib_GetIcon(iconName, big);
}
- for ( i = 0; i < SIZEOF(statusIcons); i++ ) {
- if ( statusIcons[i].id == status ) {
+ for (i = 0; i < SIZEOF(statusIcons); i++) {
+ if (statusIcons[i].id == status) {
statusIndx = i;
break;
} }
- if ( statusIndx == -1 )
+ if (statusIndx == -1)
return NULL;
- if ( !szProto ) {
+ if ( !szProto) {
// Only return a protocol specific icon if there is only one protocol
// Otherwise return the global icon. This affects the global status menu mainly.
- if ( accounts.getCount() == 1 ) {
+ if (accounts.getCount() == 1) {
HICON hIcon;
// format: core_status_%proto%statusindex
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
- hIcon = IcoLib_GetIcon( iconName, big );
- if ( hIcon )
+ hIcon = IcoLib_GetIcon(iconName, big);
+ if (hIcon)
return hIcon;
}
// format: core_status_%s%d
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
- return IcoLib_GetIcon( iconName, big );
+ return IcoLib_GetIcon(iconName, big);
}
// format: core_status_%s%d
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
- hIcon = IcoLib_GetIcon( iconName, big );
- if ( hIcon == NULL && ( caps2 == 0 || ( caps2 & statusIcons[statusIndx].pf2 ))) {
- PROTOACCOUNT* pa = Proto_GetAccount( szProto );
- if ( pa ) {
+ hIcon = IcoLib_GetIcon(iconName, big);
+ if (hIcon == NULL && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) {
+ PROTOACCOUNT* pa = Proto_GetAccount(szProto);
+ if (pa) {
TCHAR szPath[MAX_PATH], szFullPath[MAX_PATH], *str;
SKINICONDESC sid = { 0 };
@@ -270,29 +270,29 @@ HICON LoadSkinProtoIcon( const char* szProto, int status, bool big ) // Queried protocol isn't in list, adding
//
TCHAR tszSection[MAX_PATH];
- mir_sntprintf( tszSection, SIZEOF(tszSection), _T("%s%s"), _T(PROTOCOLS_PREFIX), pa->tszAccountName );
+ mir_sntprintf(tszSection, SIZEOF(tszSection), _T("%s%s"), _T(PROTOCOLS_PREFIX), pa->tszAccountName);
sid.ptszSection = tszSection;
sid.cbSize = sizeof(sid);
sid.flags = SIDF_ALL_TCHAR;
- GetModuleFileName( hMirandaInst, szPath, MAX_PATH );
- str = _tcsrchr( szPath, '\\' );
- if ( str != NULL )
+ GetModuleFileName(hMirandaInst, szPath, MAX_PATH);
+ str = _tcsrchr(szPath, '\\');
+ if (str != NULL)
*str = 0;
- mir_sntprintf( szFullPath, SIZEOF(szFullPath), _T("%s\\Icons\\proto_") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, pa->szProtoName );
- if ( GetFileAttributes( szFullPath ) != INVALID_FILE_ATTRIBUTES )
+ mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Icons\\proto_") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, pa->szProtoName);
+ if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
sid.ptszDefaultFile = szFullPath;
else {
- mir_sntprintf( szFullPath, SIZEOF(szFullPath), _T("%s\\Plugins\\") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, szProto );
- if (( int )ExtractIconEx( szFullPath, statusIcons[i].resource_id, NULL, &hIcon, 1 ) > 0 ) {
- DestroyIcon( hIcon );
+ mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Plugins\\") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, szProto);
+ if ((int)ExtractIconEx(szFullPath, statusIcons[i].resource_id, NULL, &hIcon, 1) > 0) {
+ DestroyIcon(hIcon);
sid.ptszDefaultFile = szFullPath;
hIcon = NULL;
}
- if ( sid.pszDefaultFile == NULL ) {
- if ( str != NULL )
+ if (sid.pszDefaultFile == NULL) {
+ if (str != NULL)
*str = '\\';
sid.ptszDefaultFile = szPath;
} }
@@ -302,108 +302,108 @@ HICON LoadSkinProtoIcon( const char* szProto, int status, bool big ) //
{
int lowidx, highidx;
- if ( caps2 == 0 )
+ if (caps2 == 0)
lowidx = statusIndx, highidx = statusIndx+1;
else
lowidx = 0, highidx = SIZEOF(statusIcons);
- for ( i = lowidx; i < highidx; i++ ) {
- if ( caps2 == 0 || ( caps2 & statusIcons[i].pf2 )) {
+ for (i = lowidx; i < highidx; i++) {
+ if (caps2 == 0 || (caps2 & statusIcons[i].pf2)) {
// format: core_%s%d
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, i );
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, i);
sid.pszName = iconName;
- sid.ptszDescription = cli.pfnGetStatusModeDescription( statusIcons[i].id, 0 );
+ sid.ptszDescription = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0);
sid.iDefaultIndex = statusIcons[i].resource_id;
- IcoLib_AddNewIcon( &sid );
+ IcoLib_AddNewIcon(&sid);
} } } }
// format: core_status_%s%d
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx );
- hIcon = IcoLib_GetIcon( iconName, big );
- if ( hIcon )
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
+ hIcon = IcoLib_GetIcon(iconName, big);
+ if (hIcon)
return hIcon;
}
- if ( hIcon == NULL ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx );
- hIcon = IcoLib_GetIcon( iconName, big );
+ if (hIcon == NULL) {
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
+ hIcon = IcoLib_GetIcon(iconName, big);
}
return hIcon;
}
-HANDLE GetSkinIconHandle( int idx )
+HANDLE GetSkinIconHandle(int idx)
{
int i;
- for ( i = 0; i < SIZEOF(mainIcons); i++ )
- if ( idx == mainIcons[i].id )
+ for (i = 0; i < SIZEOF(mainIcons); i++)
+ if (idx == mainIcons[i].id)
return hMainIcons[i];
return NULL;
}
-HICON LoadSkinIcon( int idx, bool big )
+HICON LoadSkinIcon(int idx, bool big)
{
//
// Query for global status icons
//
- if ( idx < SKINICON_EVENT_MESSAGE ) {
- if ( idx >= SIZEOF( statusIcons ))
+ if (idx < SKINICON_EVENT_MESSAGE) {
+ if (idx >= SIZEOF(statusIcons))
return NULL;
- return LoadSkinProtoIcon( NULL, statusIcons[ idx ].id, big );
+ return LoadSkinProtoIcon(NULL, statusIcons[ idx ].id, big);
}
- return IcoLib_GetIconByHandle( GetSkinIconHandle( idx ), big );
+ return IcoLib_GetIconByHandle(GetSkinIconHandle(idx), big);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Initializes the icon skin module
-static void convertOneProtocol( char* moduleName, char* iconName )
+static void convertOneProtocol(char* moduleName, char* iconName)
{
- char* pm = moduleName + strlen( moduleName );
- char* pi = iconName + strlen( iconName );
+ char* pm = moduleName + strlen(moduleName);
+ char* pi = iconName + strlen(iconName);
DBVARIANT dbv;
int i;
- for ( i = 0; i < SIZEOF(statusIcons); i++ ) {
- _itoa( statusIcons[i].id, pm, 10 );
+ for (i = 0; i < SIZEOF(statusIcons); i++) {
+ _itoa(statusIcons[i].id, pm, 10);
- if ( !DBGetContactSettingTString( NULL, "Icons", moduleName, &dbv ) ) {
- _itoa( i, pi, 10 );
+ if ( !DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv)) {
+ _itoa(i, pi, 10);
- DBWriteContactSettingTString( NULL, "SkinIcons", iconName, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ DBWriteContactSettingTString(NULL, "SkinIcons", iconName, dbv.ptszVal);
+ DBFreeVariant(&dbv);
- DBDeleteContactSetting( NULL, "Icons", moduleName );
+ DBDeleteContactSetting(NULL, "Icons", moduleName);
} } }
-static INT_PTR sttLoadSkinIcon( WPARAM wParam, LPARAM lParam )
+static INT_PTR sttLoadSkinIcon(WPARAM wParam, LPARAM lParam)
{
switch (lParam)
{
case 0:
- return (INT_PTR)LoadSkinIcon( wParam );
+ return (INT_PTR)LoadSkinIcon(wParam);
case 1:
- return (INT_PTR)GetSkinIconHandle( wParam );
+ return (INT_PTR)GetSkinIconHandle(wParam);
case 2:
- return (INT_PTR)LoadSkinIcon( wParam, true );
+ return (INT_PTR)LoadSkinIcon(wParam, true);
}
return 0;
}
-static INT_PTR sttLoadSkinProtoIcon( WPARAM wParam, LPARAM lParam )
+static INT_PTR sttLoadSkinProtoIcon(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, false );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, false);
}
-static INT_PTR sttLoadSkinProtoIconBig( WPARAM wParam, LPARAM lParam )
+static INT_PTR sttLoadSkinProtoIconBig(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, true );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, true);
}
int LoadSkinIcons(void)
@@ -417,46 +417,46 @@ int LoadSkinIcons(void) //
// Perform "1st-time running import"
- for ( i = 0; i < SIZEOF(mainIcons); i++ ) {
- _itoa( mainIcons[i].id, moduleName, 10 );
- if ( DBGetContactSettingTString( NULL, "Icons", moduleName, &dbv ))
+ for (i = 0; i < SIZEOF(mainIcons); i++) {
+ _itoa(mainIcons[i].id, moduleName, 10);
+ if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv))
break;
- mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i );
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
- DBWriteContactSettingTString( NULL, "SkinIcons", iconName, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ DBWriteContactSettingTString(NULL, "SkinIcons", iconName, dbv.ptszVal);
+ DBFreeVariant(&dbv);
- DBDeleteContactSetting( NULL, "Icons", moduleName );
+ DBDeleteContactSetting(NULL, "Icons", moduleName);
}
- for (;; ) {
+ for (;;) {
// get the next protocol name
moduleName[0] = 'p';
moduleName[1] = 0;
- _itoa( j++, moduleName+1, 100 );
- if ( DBGetContactSettingTString( NULL, "Icons", moduleName, &dbv ))
+ _itoa(j++, moduleName+1, 100);
+ if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv))
break;
- DBDeleteContactSetting( NULL, "Icons", moduleName );
+ DBDeleteContactSetting(NULL, "Icons", moduleName);
// make old skinicons' prefix
- mir_snprintf( moduleName, SIZEOF(moduleName), TCHAR_STR_PARAM, dbv.ptszVal );
+ mir_snprintf(moduleName, SIZEOF(moduleName), TCHAR_STR_PARAM, dbv.ptszVal);
// make IcoLib's prefix
- mir_snprintf( iconName, SIZEOF(iconName), "%s" TCHAR_STR_PARAM, statusIconsFmt, dbv.ptszVal );
+ mir_snprintf(iconName, SIZEOF(iconName), "%s" TCHAR_STR_PARAM, statusIconsFmt, dbv.ptszVal);
- convertOneProtocol( moduleName, iconName );
- DBFreeVariant( &dbv );
+ convertOneProtocol(moduleName, iconName);
+ DBFreeVariant(&dbv);
}
moduleName[0] = 0;
strcpy(iconName, "core_status_" GLOBAL_PROTO_NAME);
- convertOneProtocol( moduleName, iconName );
+ convertOneProtocol(moduleName, iconName);
- CreateServiceFunction( MS_SKIN_LOADICON, sttLoadSkinIcon );
- CreateServiceFunction( MS_SKIN_LOADPROTOICON, sttLoadSkinProtoIcon );
- CreateServiceFunction( MS_SKIN_LOADPROTOICONBIG, sttLoadSkinProtoIconBig );
+ CreateServiceFunction(MS_SKIN_LOADICON, sttLoadSkinIcon);
+ CreateServiceFunction(MS_SKIN_LOADPROTOICON, sttLoadSkinProtoIcon);
+ CreateServiceFunction(MS_SKIN_LOADPROTOICONBIG, sttLoadSkinProtoIconBig);
- ZeroMemory( &sid, sizeof(sid) );
+ ZeroMemory(&sid, sizeof(sid));
sid.cbSize = sizeof(sid);
GetModuleFileName(NULL, modulePath, SIZEOF(modulePath));
sid.ptszDefaultFile = modulePath;
@@ -466,12 +466,12 @@ int LoadSkinIcons(void) //
// Add main icons to list
//
- for ( i = 0; i < SIZEOF(mainIcons); i++ ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i );
+ for (i = 0; i < SIZEOF(mainIcons); i++) {
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
sid.pszSection = mainIcons[i].section == NULL ? "Main Icons" : (char*)mainIcons[i].section;
sid.pszDescription = (char*)mainIcons[i].description;
sid.iDefaultIndex = mainIcons[i].resource_id;
- hMainIcons[i] = IcoLib_AddNewIcon( &sid );
+ hMainIcons[i] = IcoLib_AddNewIcon(&sid);
}
//
// Add global icons to list
@@ -480,12 +480,12 @@ int LoadSkinIcons(void) //
// Asterisk is used, to avoid conflict with proto-plugins
// 'coz users can't rename it to name with '*'
- for ( i = 0; i < SIZEOF(statusIcons); i++ ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i );
+ for (i = 0; i < SIZEOF(statusIcons); i++) {
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i);
sid.pszName = iconName;
sid.pszDescription = (char*)statusIcons[i].description;
sid.iDefaultIndex = statusIcons[i].resource_id;
- hStatusIcons[i] = IcoLib_AddNewIcon( &sid );
+ hStatusIcons[i] = IcoLib_AddNewIcon(&sid);
}
return 0;
}
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index fad684a80a..4bd66ff50b 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -36,9 +36,9 @@ static HANDLE hPlayEvent = NULL; static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam)
{
- SKINSOUNDDESCEX *ssd = ( SKINSOUNDDESCEX* )lParam;
- switch( ssd->cbSize ) {
- case sizeof( SKINSOUNDDESCEX ):
+ SKINSOUNDDESCEX *ssd = (SKINSOUNDDESCEX*)lParam;
+ switch(ssd->cbSize) {
+ case sizeof(SKINSOUNDDESCEX):
case SKINSOUNDDESC_SIZE_V1:
case SKINSOUNDDESC_SIZE_V2:
break;
@@ -47,35 +47,35 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) return 1;
}
- if ( ssd->pszName == NULL || ssd->pszDescription == NULL)
+ if (ssd->pszName == NULL || ssd->pszDescription == NULL)
return 1;
DBVARIANT dbv;
- DWORD dwFlags = ( ssd->cbSize == sizeof(SKINSOUNDDESCEX)) ? ssd->dwFlags : 0;
+ DWORD dwFlags = (ssd->cbSize == sizeof(SKINSOUNDDESCEX)) ? ssd->dwFlags : 0;
soundList=(struct SoundItem*)mir_realloc(soundList, sizeof(struct SoundItem)*(soundCount+1));
SoundItem* item = &soundList[soundCount++];
- item->name = mir_strdup( ssd->pszName );
+ item->name = mir_strdup(ssd->pszName);
item->tempFile = NULL;
TCHAR* ptszDefaultFile;
- if ( dwFlags & SSDF_UNICODE ) {
- item->description = mir_tstrdup( TranslateTS( ssd->ptszDescription ));
- item->section = mir_tstrdup( TranslateTS( ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->ptszSection : _T("Other")));
- ptszDefaultFile = mir_tstrdup( ssd->ptszDefaultFile );
+ if (dwFlags & SSDF_UNICODE) {
+ item->description = mir_tstrdup(TranslateTS(ssd->ptszDescription));
+ item->section = mir_tstrdup(TranslateTS(ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->ptszSection : _T("Other")));
+ ptszDefaultFile = mir_tstrdup(ssd->ptszDefaultFile);
}
else {
- item->description = LangPackPcharToTchar( ssd->pszDescription );
- item->section = LangPackPcharToTchar( ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->pszSection : "Other" );
- ptszDefaultFile = mir_a2t( ssd->pszDefaultFile );
+ item->description = LangPackPcharToTchar(ssd->pszDescription);
+ item->section = LangPackPcharToTchar(ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->pszSection : "Other");
+ ptszDefaultFile = mir_a2t(ssd->pszDefaultFile);
}
- if ( ptszDefaultFile ) {
- if ( DBGetContactSettingString(NULL, "SkinSounds", item->name, &dbv))
+ if (ptszDefaultFile) {
+ if (DBGetContactSettingString(NULL, "SkinSounds", item->name, &dbv))
DBWriteContactSettingTString(NULL, "SkinSounds", item->name, ptszDefaultFile);
else
DBFreeVariant(&dbv);
- mir_free( ptszDefaultFile );
+ mir_free(ptszDefaultFile);
}
return 0;
@@ -84,7 +84,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
char * pszFile = (char *) lParam;
- if ( pszFile && (DBGetContactSettingByte(NULL, "Skin", "UseSound", 0) || (int)wParam == 1))
+ if (pszFile && (DBGetContactSettingByte(NULL, "Skin", "UseSound", 0) || (int)wParam == 1))
PlaySoundA(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
return 0;
@@ -92,11 +92,11 @@ static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam) static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam)
{
- char* pszSoundName = ( char* )lParam;
+ char* pszSoundName = (char*)lParam;
int j;
for (j=0; j<soundCount; j++) {
- if ( pszSoundName && strcmp( soundList[j].name, pszSoundName ) == 0) {
+ if (pszSoundName && strcmp(soundList[j].name, pszSoundName) == 0) {
if (DBGetContactSettingByte(NULL, "SkinSoundsOff", pszSoundName, 0) == 0) {
DBVARIANT dbv;
@@ -123,12 +123,12 @@ static HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name) tvi.pszText = str;
tvi.cchTextMax = SIZEOF(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
- TreeView_GetItem( hwndTree, &tvi );
- if ( !_tcsicmp( str, name ))
+ while (tvi.hItem != NULL) {
+ TreeView_GetItem(hwndTree, &tvi);
+ if ( !_tcsicmp(str, name))
return tvi.hItem;
- tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
return NULL;
}
@@ -166,30 +166,30 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- for ( i=0; i < soundCount; i++ ) {
+ for (i=0; i < soundCount; i++) {
tvis.item.stateMask = TVIS_EXPANDED;
tvis.item.state = TVIS_EXPANDED;
- tvis.hParent = FindNamedTreeItemAtRoot( hwndTree, soundList[i].section );
- if ( tvis.hParent == NULL ) {
+ tvis.hParent = FindNamedTreeItemAtRoot(hwndTree, soundList[i].section);
+ if (tvis.hParent == NULL) {
tvis.item.lParam = -1;
tvis.item.pszText = soundList[i].section;
- tvis.hParent = tvis.item.hItem = TreeView_InsertItem( hwndTree, &tvis );
+ tvis.hParent = tvis.item.hItem = TreeView_InsertItem(hwndTree, &tvis);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.state = INDEXTOSTATEIMAGEMASK(0);
- TreeView_SetItem( hwndTree, &tvis.item );
+ TreeView_SetItem(hwndTree, &tvis.item);
}
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(!DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[i].name, 0)?2:1);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK( !DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[i].name, 0)?2:1);
tvis.item.lParam = i;
tvis.item.pszText = soundList[i].description;
- TreeView_InsertItem( hwndTree, &tvis );
+ TreeView_InsertItem(hwndTree, &tvis);
} }
{ TVITEM tvi;
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.lParam == -1 )
+ if (tvi.lParam == -1)
TreeView_SetItemState(hwndTree, tvi.hItem, INDEXTOSTATEIMAGEMASK(0), TVIS_STATEIMAGEMASK);
tvi.hItem=TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -222,17 +222,17 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case DM_CHECKENABLED:
EnableWindow(GetDlgItem(hwndDlg, IDC_SOUNDTREE), IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS));
- if (!IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS))
+ if ( !IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS))
SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
else if (TreeView_GetSelection(hwndTree)&&TreeView_GetParent(hwndTree, TreeView_GetSelection(hwndTree)))
SendMessage(hwndDlg, DM_SHOWPANE, 0, 0);
break;
case WM_COMMAND:
- if ( LOWORD(wParam) == IDC_ENABLESOUNDS )
+ if (LOWORD(wParam) == IDC_ENABLESOUNDS)
SendMessage(hwndDlg, DM_CHECKENABLED, 0, 0);
- if ( LOWORD(wParam) == IDC_PREVIEW ) {
+ if (LOWORD(wParam) == IDC_PREVIEW) {
TVITEM tvi;
HTREEITEM hti;
@@ -248,7 +248,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NotifyEventHooks(hPlayEvent, 1, (LPARAM)soundList[tvi.lParam].tempFile);
else {
DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
char szPathFull[MAX_PATH];
pathToAbsolute(dbv.pszVal, szPathFull, NULL);
@@ -257,7 +257,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } }
break;
}
- if ( LOWORD( wParam ) == IDC_CHANGE ) {
+ if (LOWORD(wParam) == IDC_CHANGE) {
char str[MAX_PATH] = "", strFull[MAX_PATH], strdir[MAX_PATH]="", filter[MAX_PATH];
OPENFILENAMEA ofn;
TVITEM tvi;
@@ -301,7 +301,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "wav";
- if (!GetOpenFileNameA(&ofn)) break;
+ if ( !GetOpenFileNameA(&ofn)) break;
CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strFull);
soundList[tvi.lParam].tempFile = mir_strdup(strFull);
SetDlgItemTextA(hwndDlg, IDC_LOCATION, strFull);
@@ -323,21 +323,21 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int i;
DBWriteContactSettingByte(NULL, "Skin", "UseSound", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS));
- for ( i=0; i < soundCount; i++ )
- if ( soundList[i].tempFile )
+ for (i=0; i < soundCount; i++)
+ if (soundList[i].tempFile)
DBWriteContactSettingString(NULL, "SkinSounds", soundList[i].name, soundList[i].tempFile);
{
TVITEM tvi, tvic;
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.lParam == -1 ) {
+ if (tvi.lParam == -1) {
tvic.hItem = TreeView_GetChild(hwndTree, tvi.hItem);
- while ( tvic.hItem != NULL ) {
+ while (tvic.hItem != NULL) {
tvic.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvic);
- if ((( tvic.state & TVIS_STATEIMAGEMASK ) >> 12 == 2 )) {
+ if (((tvic.state & TVIS_STATEIMAGEMASK) >> 12 == 2)) {
DBCONTACTGETSETTING cgs;
cgs.szModule = "SkinSoundsOff";
cgs.szSetting = soundList[tvic.lParam].name;
@@ -370,7 +370,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_NAMEVAL, buf);
if (soundList[tvi.lParam].tempFile)
SetDlgItemTextA(hwndDlg, IDC_LOCATION, soundList[tvi.lParam].tempFile);
- else if (!DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
+ else if ( !DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_LOCATION, dbv.pszVal);
DBFreeVariant(&dbv);
}
@@ -420,7 +420,7 @@ static int SkinOptionsInit(WPARAM wParam, LPARAM) odp.pszTitle = LPGEN("Sounds");
odp.pfnDlgProc = DlgProcSoundOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -448,7 +448,7 @@ void UnloadSkinSounds(void) {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
for (i=0;i<soundCount;i++) {
mir_free(soundList[i].name);
diff --git a/src/modules/srauth/auth.cpp b/src/modules/srauth/auth.cpp index 44fca593c4..d0fbe24de5 100644 --- a/src/modules/srauth/auth.cpp +++ b/src/modules/srauth/auth.cpp @@ -74,7 +74,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) ci.hContact = hContact;
ci.szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
{
switch (ci.type)
{
diff --git a/src/modules/srauth/authdialogs.cpp b/src/modules/srauth/authdialogs.cpp index 8d3e90a836..b5693e01dd 100644 --- a/src/modules/srauth/authdialogs.cpp +++ b/src/modules/srauth/authdialogs.cpp @@ -77,7 +77,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar else
mir_sntprintf(name, SIZEOF(name), _T("%s"), nickT);
}
- if (!name[0])
+ if ( !name[0])
_tcscpy(name, TranslateT("<Unknown>"));
TCHAR hdr[256];
@@ -210,7 +210,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else
mir_sntprintf(name, SIZEOF(name), _T("%s"), nickT);
}
- if (!name[0])
+ if ( !name[0])
_tcscpy(name, TranslateT("<Unknown>"));
TCHAR hdr[256];
@@ -239,7 +239,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwndDlg, IDC_DENYREASON), FALSE);
SetDlgItemText(hwndDlg, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
}
- if (!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if ( !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
{
EnableWindow(GetDlgItem(hwndDlg, IDC_ADDCHECK), FALSE);
CheckDlgButton(hwndDlg, IDC_ADDCHECK, BST_UNCHECKED);
diff --git a/src/modules/srawaymsg/awaymsg.cpp b/src/modules/srawaymsg/awaymsg.cpp index 46ce60bd14..e480dab74a 100644 --- a/src/modules/srawaymsg/awaymsg.cpp +++ b/src/modules/srawaymsg/awaymsg.cpp @@ -140,19 +140,19 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) clmi.cbSize = sizeof(clmi);
clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR;
- if ( szProto != NULL ) {
+ if (szProto != NULL) {
int chatRoom = szProto ? DBGetContactSettingByte((HANDLE)wParam, szProto, "ChatRoom", 0) : 0;
- if ( !chatRoom ) {
+ if ( !chatRoom) {
int status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
- mir_sntprintf( str, SIZEOF(str), TranslateT("Re&ad %s Message"), cli.pfnGetStatusModeDescription( status, 0 ));
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s Message"), cli.pfnGetStatusModeDescription(status, 0));
clmi.ptszName = str;
- if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0 ) & PF1_MODEMSGRECV ) {
- if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_3, 0 ) & Proto_Status2Flag( status )) {
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_NOTOFFLINE | CMIM_ICON | CMIF_TCHAR;
clmi.hIcon = LoadSkinProtoIcon(szProto, status);
} } } }
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hAwayMsgMenuItem, ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAwayMsgMenuItem, (LPARAM)&clmi);
IconLib_ReleaseIcon(clmi.hIcon, 0);
return 0;
}
diff --git a/src/modules/srawaymsg/sendmsg.cpp b/src/modules/srawaymsg/sendmsg.cpp index 4c5ceec8ab..d11f80715a 100644 --- a/src/modules/srawaymsg/sendmsg.cpp +++ b/src/modules/srawaymsg/sendmsg.cpp @@ -93,7 +93,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) for (i=0; dbv.ptszVal[i]; i++)
{
if (dbv.ptszVal[i] != '%') continue;
- if (!_tcsnicmp(dbv.ptszVal + i, _T("%time%"), 6))
+ if ( !_tcsnicmp(dbv.ptszVal + i, _T("%time%"), 6))
{
MIRANDA_IDLE_INFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -112,7 +112,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) }
else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, SIZEOF(substituteStr));
}
- else if (!_tcsnicmp(dbv.ptszVal + i, _T("%date%"), 6))
+ else if ( !_tcsnicmp(dbv.ptszVal + i, _T("%date%"), 6))
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, SIZEOF(substituteStr));
else continue;
if (lstrlen(substituteStr) > 6)
@@ -175,7 +175,7 @@ void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg) for (int i=0; i < accounts.getCount(); i++)
{
PROTOACCOUNT* pa = accounts[i];
- if (!Proto_IsAccountEnabled(pa)) continue;
+ if ( !Proto_IsAccountEnabled(pa)) continue;
if ((CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) &&
!Proto_IsAccountLocked(pa))
CallProtoService(pa->szModuleName, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
@@ -222,7 +222,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa TCHAR str[256], format[128];
GetWindowText(hwndDlg, format, SIZEOF(format));
mir_sntprintf(str, SIZEOF(str), format, cli.pfnGetStatusModeDescription(dat->statusMode, 0));
- SetWindowText(hwndDlg, str );
+ SetWindowText(hwndDlg, str);
}
GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, SIZEOF(dat->okButtonFormat));
{
@@ -315,15 +315,15 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) if (protoModeMsgFlags == 0) return 0;
// If its a global change check the complete PFLAGNUM_3 flags to see if a popup might be needed
- if (!szProto)
+ if ( !szProto)
{
- if (!(protoModeMsgFlags & Proto_Status2Flag(statusMode)))
+ if ( !(protoModeMsgFlags & Proto_Status2Flag(statusMode)))
return 0;
}
else
{
// If its a single protocol check the PFLAGNUM_3 for the single protocol
- if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) ||
+ if ( !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) ||
!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode)))
return 0;
}
@@ -333,7 +333,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) {
ChangeAllProtoMessages(szProto, statusMode, NULL);
}
- else if (bScreenSaverRunning || ((!GetAsyncKeyState(VK_CONTROL) || prochotkey) &&
+ else if (bScreenSaverRunning || (( !GetAsyncKeyState(VK_CONTROL) || prochotkey) &&
DBGetContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(statusMode, "NoDlg"), 0)))
{
TCHAR *msg = GetAwayMessage(statusMode, szProto);
@@ -389,7 +389,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam for (int i = 0; i < SIZEOF(statusModes); i++)
{
int j;
- if (!(protoModeMsgFlags & Proto_Status2Flag(statusModes[i])))
+ if ( !(protoModeMsgFlags & Proto_Status2Flag(statusModes[i])))
continue;
if (hLst)
@@ -553,7 +553,7 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Status");
odp.pfnDlgProc = DlgProcAwayMsgOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -589,7 +589,7 @@ static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) protoModeMsgFlags = 0;
for (int i=0; i < accounts.getCount(); i++)
{
- if (!Proto_IsAccountEnabled(accounts[i])) continue;
+ if ( !Proto_IsAccountEnabled(accounts[i])) continue;
protoModeMsgFlags |= CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
}
diff --git a/src/modules/sremail/email.cpp b/src/modules/sremail/email.cpp index db8893b570..0f7ca69020 100644 --- a/src/modules/sremail/email.cpp +++ b/src/modules/sremail/email.cpp @@ -26,7 +26,7 @@ static HANDLE hEMailMenuItem; void SendEmailThread(void *szUrl)
{
- ShellExecuteA(NULL, "open", ( char* )szUrl, "", "", SW_SHOW);
+ ShellExecuteA(NULL, "open", (char*)szUrl, "", "", SW_SHOW);
mir_free(szUrl);
return;
}
@@ -78,7 +78,7 @@ int LoadSendRecvEMailModule(void) mi.cbSize = sizeof(mi);
mi.position = -2000010000;
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_SENDEMAIL );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_SENDEMAIL);
mi.pszName = LPGEN("&E-mail");
mi.pszService = MS_EMAIL_SENDEMAIL;
hEMailMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/src/modules/srfile/file.cpp b/src/modules/srfile/file.cpp index 6570bc296a..9d142fcdbe 100644 --- a/src/modules/srfile/file.cpp +++ b/src/modules/srfile/file.cpp @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "file.h"
-TCHAR* PFTS_StringToTchar( int flags, const PROTOCHAR* s );
-int PFTS_CompareWithTchar( PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR* r );
+TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s);
+int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR* r);
static HANDLE hSRFileMenuItem;
@@ -42,19 +42,19 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) FileSendData fsd;
fsd.hContact=(HANDLE)wParam;
- char** ppFiles = ( char** )lParam;
+ char** ppFiles = (char**)lParam;
int count = 0;
- while ( ppFiles[count] != NULL )
+ while (ppFiles[count] != NULL)
count++;
- fsd.ppFiles = (const TCHAR**)alloca(( count+1 ) * sizeof( void* ));
- for ( int i=0; i < count; i++ )
- fsd.ppFiles[i] = ( const TCHAR* )mir_a2t( ppFiles[i] );
+ fsd.ppFiles = (const TCHAR**)alloca((count+1) * sizeof(void*));
+ for (int i=0; i < count; i++)
+ fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
fsd.ppFiles[ count ] = NULL;
CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
- for ( int j=0; j < count; j++ )
- mir_free(( void* )fsd.ppFiles[j] );
+ for (int j=0; j < count; j++)
+ mir_free((void*)fsd.ppFiles[j]);
return 0;
}
@@ -83,25 +83,25 @@ static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) return 0;
}
-void PushFileEvent( HANDLE hContact, HANDLE hdbe, LPARAM lParam )
+void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam)
{
CLISTEVENT cle={0};
cle.cbSize = sizeof(cle);
cle.hContact = hContact;
cle.hDbEvent = hdbe;
cle.lParam = lParam;
- if ( DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
+ if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
SkinPlaySound("RecvFile");
TCHAR szTooltip[256];
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("File from %s"), cli.pfnGetContactDisplayName( hContact, 0 ));
+ mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("File from %s"), cli.pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
cle.flags |= CLEF_TCHAR;
- cle.hIcon = LoadSkinIcon( SKINICON_EVENT_FILE );
+ cle.hIcon = LoadSkinIcon(SKINICON_EVENT_FILE);
cle.pszService = "SRFile/RecvFile";
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
} }
@@ -112,13 +112,13 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei={0};
dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = sizeof( DWORD );
- dbei.pBlob = ( PBYTE )&dwSignature;
- CallService( MS_DB_EVENT_GET, lParam, ( LPARAM )&dbei );
- if ( dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0 )
+ dbei.cbBlob = sizeof(DWORD);
+ dbei.pBlob = (PBYTE)&dwSignature;
+ CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei);
+ if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0)
return 0;
- PushFileEvent(( HANDLE )wParam, ( HANDLE )lParam, 0 );
+ PushFileEvent((HANDLE)wParam, (HANDLE)lParam, 0);
return 0;
}
@@ -127,10 +127,10 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu HKEY hKey;
DWORD cbOut=cbOutput;
- if ( RegOpenKeyEx( hKeyBase, szSubKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS)
+ if (RegOpenKeyEx(hKeyBase, szSubKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
return 0;
- if ( RegQueryValueEx( hKey, szValue, NULL, NULL, (PBYTE)szOutput, &cbOut ) != ERROR_SUCCESS ) {
+ if (RegQueryValueEx(hKey, szValue, NULL, NULL, (PBYTE)szOutput, &cbOut) != ERROR_SUCCESS) {
RegCloseKey(hKey);
return 0;
}
@@ -141,7 +141,7 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed)
{
- if (!unitsOverride) {
+ if ( !unitsOverride) {
if (size<1000) unitsOverride=UNITS_BYTES;
else if (size<100*1024) unitsOverride=UNITS_KBPOINT1;
else if (size<1024*1024) unitsOverride=UNITS_KBPOINT0;
@@ -182,7 +182,7 @@ void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts) {
mir_free(fts->tszCurrentFile);
if (fts->ptszFiles) {
- for ( int i=0;i<fts->totalFiles;i++) mir_free(fts->ptszFiles[i]);
+ for (int i=0;i<fts->totalFiles;i++) mir_free(fts->ptszFiles[i]);
mir_free(fts->ptszFiles);
}
mir_free(fts->tszWorkingDir);
@@ -191,13 +191,13 @@ void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts) void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src)
{
*dest=*src;
- if ( src->tszCurrentFile ) dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
- if ( src->ptszFiles ) {
+ if (src->tszCurrentFile) dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
+ if (src->ptszFiles) {
dest->ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*)*src->totalFiles);
- for ( int i=0; i < src->totalFiles; i++ )
- dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i] );
+ for (int i=0; i < src->totalFiles; i++)
+ dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
}
- if ( src->tszWorkingDir ) dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir );
+ if (src->tszWorkingDir) dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
dest->flags &= ~PFTS_UTF;
dest->flags |= PFTS_TCHAR;
}
@@ -206,46 +206,46 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS {
dest->hContact = src->hContact;
dest->flags = src->flags;
- if ( dest->totalFiles != src->totalFiles ) {
- for ( int i=0;i<dest->totalFiles;i++) mir_free(dest->ptszFiles[i]);
+ if (dest->totalFiles != src->totalFiles) {
+ for (int i=0;i<dest->totalFiles;i++) mir_free(dest->ptszFiles[i]);
mir_free(dest->ptszFiles);
dest->ptszFiles = NULL;
dest->totalFiles = src->totalFiles;
}
- if ( src->ptszFiles ) {
- if ( !dest->ptszFiles )
- dest->ptszFiles = ( TCHAR** )mir_calloc( sizeof(TCHAR*)*src->totalFiles);
- for ( int i=0; i < src->totalFiles; i++ )
- if ( !dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar( src, src->ptszFiles[i], dest->ptszFiles[i] )) {
- mir_free( dest->ptszFiles[i] );
- if ( src->ptszFiles[i] )
- dest->ptszFiles[i] = PFTS_StringToTchar( src->flags, src->ptszFiles[i] );
+ if (src->ptszFiles) {
+ if ( !dest->ptszFiles)
+ dest->ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)*src->totalFiles);
+ for (int i=0; i < src->totalFiles; i++)
+ if ( !dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar(src, src->ptszFiles[i], dest->ptszFiles[i])) {
+ mir_free(dest->ptszFiles[i]);
+ if (src->ptszFiles[i])
+ dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
else
dest->ptszFiles[i] = NULL;
}
}
else if (dest->ptszFiles) {
- for ( int i=0; i < dest->totalFiles; i++ )
+ for (int i=0; i < dest->totalFiles; i++)
mir_free(dest->ptszFiles[i]);
- mir_free( dest->ptszFiles );
+ mir_free(dest->ptszFiles);
dest->ptszFiles = NULL;
}
dest->currentFileNumber = src->currentFileNumber;
dest->totalBytes = src->totalBytes;
dest->totalProgress = src->totalProgress;
- if (src->tszWorkingDir && (!dest->tszWorkingDir || PFTS_CompareWithTchar( src, src->tszWorkingDir, dest->tszWorkingDir))) {
- mir_free( dest->tszWorkingDir );
- if ( src->tszWorkingDir )
- dest->tszWorkingDir = PFTS_StringToTchar( src->flags, src->tszWorkingDir );
+ if (src->tszWorkingDir && ( !dest->tszWorkingDir || PFTS_CompareWithTchar(src, src->tszWorkingDir, dest->tszWorkingDir))) {
+ mir_free(dest->tszWorkingDir);
+ if (src->tszWorkingDir)
+ dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
else
dest->tszWorkingDir = NULL;
}
- if ( !dest->tszCurrentFile || !src->tszCurrentFile || PFTS_CompareWithTchar( src, src->tszCurrentFile, dest->tszCurrentFile )) {
- mir_free( dest->tszCurrentFile );
- if ( src->tszCurrentFile )
- dest->tszCurrentFile = PFTS_StringToTchar( src->flags, src->tszCurrentFile );
+ if ( !dest->tszCurrentFile || !src->tszCurrentFile || PFTS_CompareWithTchar(src, src->tszCurrentFile, dest->tszCurrentFile)) {
+ mir_free(dest->tszCurrentFile);
+ if (src->tszCurrentFile)
+ dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
else
dest->tszCurrentFile = NULL;
}
@@ -268,7 +268,7 @@ static void RemoveUnreadFileEvents(void) while (hDbEvent) {
dbei.cbBlob=0;
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
+ if ( !(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
CallService(MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent);
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0);
}
@@ -284,10 +284,10 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto != NULL) {
- if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0 ) & PF1_FILESEND) {
- if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0 ) & PF4_OFFLINEFILES )
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND) {
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
mi.flags = CMIM_FLAGS;
- else if ( DBGetContactSettingWord(( HANDLE )wParam, szProto, "Status", ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE )
+ else if (DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mi.flags = CMIM_FLAGS;
} }
@@ -300,7 +300,7 @@ static int SRFileModulesLoaded(WPARAM, LPARAM) CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.position = -2000020000;
- mi.icolibItem = GetSkinIconHandle( SKINICON_EVENT_FILE );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_FILE);
mi.pszName = LPGEN("&File");
mi.pszService = MS_FILE_SENDFILE;
mi.flags = CMIF_ICONFROMICOLIB;
@@ -340,7 +340,7 @@ int LoadSendRecvFileModule(void) CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_EVENT_FILE );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_FILE);
mi.position = 1900000000;
mi.pszName = LPGEN("File &Transfers...");
mi.pszService = "FtMgr/Show"; //MS_PROTO_SHOWFTMGR;
diff --git a/src/modules/srfile/file.h b/src/modules/srfile/file.h index f4e9a63336..b152812467 100644 --- a/src/modules/srfile/file.h +++ b/src/modules/srfile/file.h @@ -110,6 +110,6 @@ HWND FtMgr_Show(bool bForceActivate, bool bFromMenu); void FtMgr_Destroy();
HWND FtMgr_AddTransfer(struct FileDlgData *dat);
-void FreeFileDlgData( FileDlgData* dat );
+void FreeFileDlgData(FileDlgData* dat);
TCHAR *GetContactID(HANDLE hContact);
diff --git a/src/modules/srfile/fileexistsdlg.cpp b/src/modules/srfile/fileexistsdlg.cpp index 4414e69c2a..d98ce59f78 100644 --- a/src/modules/srfile/fileexistsdlg.cpp +++ b/src/modules/srfile/fileexistsdlg.cpp @@ -54,7 +54,7 @@ static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd, IShellFolder *pDesktopFolder;
if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) {
ITEMIDLIST *pCurrentIdl;
- WCHAR* wszFilename = ( LPWSTR )szFilename;
+ WCHAR* wszFilename = (LPWSTR)szFilename;
if (pDesktopFolder->ParseDisplayName(NULL, NULL, wszFilename, NULL, &pCurrentIdl, NULL) == NOERROR) {
if (pCurrentIdl->mkid.cb) {
@@ -127,8 +127,8 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_RBUTTONUP:
{ POINT pt;
pt.x=(short)LOWORD(lParam); pt.y=(short)HIWORD(lParam);
- ClientToScreen( hwnd, &pt );
- DoAnnoyingShellCommand( hwnd, pft->tszCurrentFile, C_CONTEXTMENU, &pt );
+ ClientToScreen(hwnd, &pt);
+ DoAnnoyingShellCommand(hwnd, pft->tszCurrentFile, C_CONTEXTMENU, &pt);
return 0;
}
}
@@ -141,33 +141,33 @@ struct loadiconsstartinfo { };
void __cdecl LoadIconsAndTypesThread(void* param)
{
- loadiconsstartinfo *info = ( loadiconsstartinfo* )param;
+ loadiconsstartinfo *info = (loadiconsstartinfo*)param;
SHFILEINFO fileInfo;
- if ( SHGetFileInfo( info->szFilename, 0, &fileInfo, sizeof(fileInfo), SHGFI_TYPENAME|SHGFI_ICON|SHGFI_LARGEICON)) {
+ if (SHGetFileInfo(info->szFilename, 0, &fileInfo, sizeof(fileInfo), SHGFI_TYPENAME|SHGFI_ICON|SHGFI_LARGEICON)) {
TCHAR *pszExtension, *pszFilename;
TCHAR szExtension[64];
TCHAR szIconFile[MAX_PATH];
pszFilename = _tcsrchr(info->szFilename, '\\');
- if ( pszFilename == NULL )
+ if (pszFilename == NULL)
pszFilename = info->szFilename;
- pszExtension = _tcsrchr( pszFilename, '.' );
- if ( pszExtension )
- lstrcpyn( szExtension, pszExtension+1, SIZEOF( szExtension ));
+ pszExtension = _tcsrchr(pszFilename, '.');
+ if (pszExtension)
+ lstrcpyn(szExtension, pszExtension+1, SIZEOF(szExtension));
else {
pszExtension = _T(".");
szExtension[0]='\0';
}
CharUpper(szExtension);
- if ( fileInfo.szTypeName[0] == '\0' )
- mir_sntprintf( fileInfo.szTypeName, SIZEOF(fileInfo.szTypeName), TranslateT("%s File"), szExtension);
+ if (fileInfo.szTypeName[0] == '\0')
+ mir_sntprintf(fileInfo.szTypeName, SIZEOF(fileInfo.szTypeName), TranslateT("%s File"), szExtension);
SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName);
SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName);
SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0);
szIconFile[0]='\0';
- if ( !lstrcmp( szExtension, _T("EXE"))) {
+ if ( !lstrcmp(szExtension, _T("EXE"))) {
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("2"), szIconFile, SIZEOF(szIconFile));
}
else {
@@ -175,22 +175,22 @@ void __cdecl LoadIconsAndTypesThread(void* param) if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, SIZEOF(szTypeName))) {
lstrcat(szTypeName, _T("\\DefaultIcon"));
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, SIZEOF(szIconFile))) {
- if ( _tcsstr( szIconFile, _T("%1")))
+ if (_tcsstr(szIconFile, _T("%1")))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("0"), szIconFile, SIZEOF(szIconFile));
else szIconFile[0]='\0';
} } }
- if ( szIconFile[0]) {
+ if (szIconFile[0]) {
int iconIndex;
HICON hIcon;
TCHAR *pszComma = _tcsrchr(szIconFile, ',');
- if ( pszComma == NULL )
+ if (pszComma == NULL)
iconIndex=0;
else {
iconIndex = _ttoi(pszComma+1); *pszComma='\0';
}
- hIcon = ExtractIcon( hMirandaInst, szIconFile, iconIndex );
- if ( hIcon )
+ hIcon = ExtractIcon(hMirandaInst, szIconFile, iconIndex);
+ if (hIcon)
fileInfo.hIcon = hIcon;
}
SendDlgItemMessage(info->hwndDlg, IDC_NEWICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0);
@@ -227,7 +227,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM pfnIconWindowProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EXISTINGICON), GWLP_WNDPROC, (LONG_PTR)IconCtrlSubclassProc);
hwndFocus=GetDlgItem(hwndDlg, IDC_RESUME);
- if ( _tstati64(fts->tszCurrentFile, &statbuf) == 0) {
+ if (_tstati64(fts->tszCurrentFile, &statbuf) == 0) {
SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime);
GetSensiblyFormattedSize(statbuf.st_size, szSize, SIZEOF(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_EXISTINGSIZE, szSize);
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hwndFocus=GetDlgItem(hwndDlg, IDC_OVERWRITE);
} }
- loadiconsstartinfo *lisi = ( loadiconsstartinfo* )mir_alloc(sizeof(loadiconsstartinfo));
+ loadiconsstartinfo *lisi = (loadiconsstartinfo*)mir_alloc(sizeof(loadiconsstartinfo));
lisi->hwndDlg=hwndDlg;
lisi->szFilename = mir_tstrdup(fts->tszCurrentFile);
//can be a little slow, so why not?
@@ -250,15 +250,15 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM PROTOFILERESUME pfr={0};
switch(LOWORD(wParam)) {
case IDC_OPENFILE:
- ShellExecute( hwndDlg, NULL, fts->tszCurrentFile, NULL, NULL, SW_SHOW );
+ ShellExecute(hwndDlg, NULL, fts->tszCurrentFile, NULL, NULL, SW_SHOW);
return FALSE;
case IDC_OPENFOLDER:
{
TCHAR szFile[MAX_PATH];
- lstrcpyn( szFile, fts->tszCurrentFile, SIZEOF(szFile));
- TCHAR* pszLastBackslash = _tcsrchr( szFile, '\\' );
- if ( pszLastBackslash )
+ lstrcpyn(szFile, fts->tszCurrentFile, SIZEOF(szFile));
+ TCHAR* pszLastBackslash = _tcsrchr(szFile, '\\');
+ if (pszLastBackslash)
*pszLastBackslash = '\0';
ShellExecute(hwndDlg, NULL, szFile, NULL, NULL, SW_SHOW);
return FALSE;
@@ -289,21 +289,21 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR filter[512], *pfilter;
TCHAR str[MAX_PATH];
- lstrcpyn( str, fts->tszCurrentFile, SIZEOF(str));
+ lstrcpyn(str, fts->tszCurrentFile, SIZEOF(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- _tcscpy( filter, TranslateT("All Files"));
- _tcscat( filter, _T(" (*)"));
+ _tcscpy(filter, TranslateT("All Files"));
+ _tcscat(filter, _T(" (*)"));
pfilter = filter + _tcslen(filter) + 1;
- _tcscpy( pfilter, _T("*"));
+ _tcscpy(pfilter, _T("*"));
pfilter = pfilter + _tcslen(pfilter) + 1;
*pfilter='\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
- if (!GetSaveFileName(&ofn))
+ if ( !GetSaveFileName(&ofn))
return FALSE;
pfr.szFilename = mir_tstrdup(str);
diff --git a/src/modules/srfile/fileopts.cpp b/src/modules/srfile/fileopts.cpp index e0189fc56f..bc6bafc3b5 100644 --- a/src/modules/srfile/fileopts.cpp +++ b/src/modules/srfile/fileopts.cpp @@ -84,15 +84,15 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR szScanExe[MAX_PATH];
int i, iItem;
- for ( i=0; i < SIZEOF(virusScanners); i++ ) {
+ for (i=0; i < SIZEOF(virusScanners); i++) {
if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, SIZEOF(szScanExe))) {
iItem=SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)virusScanners[i].szProductName);
SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, i);
}
}
- if ( SendDlgItemMessageA(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0) == 0 )
+ if (SendDlgItemMessageA(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0) == 0)
{
- iItem = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)_T("") );
+ iItem = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)_T(""));
SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, (LPARAM)-1);
}
}
@@ -192,7 +192,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (pszSpace) *pszSpace = 0;
}
ofn.nMaxFileTitle = MAX_PATH;
- if (!GetOpenFileName(&ofn)) break;
+ if ( !GetOpenFileName(&ofn)) break;
if (_tcschr(str, ' ') != NULL) {
MoveMemory(str+1, str, SIZEOF(str) - 2 * sizeof(TCHAR));
str[0] = '"';
@@ -241,7 +241,7 @@ int FileOptInitialise(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgProcFileOpts;
odp.flags = ODPF_BOLDGROUPS;
odp.nIDBottomSimpleControl = IDC_VIRUSSCANNERGROUP;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/srfile/filerecvdlg.cpp b/src/modules/srfile/filerecvdlg.cpp index 5b10dfbf16..bdd4445ef7 100644 --- a/src/modules/srfile/filerecvdlg.cpp +++ b/src/modules/srfile/filerecvdlg.cpp @@ -105,28 +105,28 @@ int BrowseForFolder(HWND hwnd, TCHAR *szPath) static REPLACEVARSARRAY sttVarsToReplace[] =
{
- { ( TCHAR* )"///", ( TCHAR* )"//" },
- { ( TCHAR* )"//", ( TCHAR* )"/" },
- { ( TCHAR* )"()", ( TCHAR* )"" },
+ { (TCHAR*)"///", (TCHAR*)"//" },
+ { (TCHAR*)"//", (TCHAR*)"/" },
+ { (TCHAR*)"()", (TCHAR*)"" },
{ NULL, NULL }
};
-static void patchDir( TCHAR* str, size_t strSize )
+static void patchDir(TCHAR* str, size_t strSize)
{
REPLACEVARSDATA dat = { 0 };
- dat.cbSize = sizeof( dat );
+ dat.cbSize = sizeof(dat);
dat.dwFlags = RVF_TCHAR;
dat.variables = sttVarsToReplace;
- TCHAR* result = ( TCHAR* )CallService( MS_UTILS_REPLACEVARS, (WPARAM)str, (LPARAM)&dat );
- if ( result ) {
- _tcsncpy( str, result, strSize );
- mir_free( result );
+ TCHAR* result = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)str, (LPARAM)&dat);
+ if (result) {
+ _tcsncpy(str, result, strSize);
+ mir_free(result);
}
- size_t len = lstrlen( str );
- if ( len+1 < strSize && str[len-1] != '\\' )
- lstrcpy( str+len, _T("\\") );
+ size_t len = lstrlen(str);
+ if (len+1 < strSize && str[len-1] != '\\')
+ lstrcpy(str+len, _T("\\"));
}
void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL patchVars)
@@ -135,18 +135,18 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL TCHAR szTemp[MAX_PATH];
szTemp[0] = 0;
- if ( !DBGetContactSettingTString( NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
- if ( lstrlen( dbv.ptszVal ) > 0 )
- lstrcpyn( szTemp, dbv.ptszVal, SIZEOF( szTemp ));
- DBFreeVariant( &dbv );
+ if ( !DBGetContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
+ if (lstrlen(dbv.ptszVal) > 0)
+ lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
+ DBFreeVariant(&dbv);
}
- if ( !szTemp[0] )
+ if ( !szTemp[0])
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My Received Files"));
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My Received Files"));
- if ( hContact ) {
+ if (hContact) {
REPLACEVARSDATA dat = { 0 };
REPLACEVARSARRAY rvaVarsToReplace[4];
rvaVarsToReplace[0].lptzKey = _T("nick");
@@ -160,22 +160,22 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL for (int i=0; i < (SIZEOF(rvaVarsToReplace)-1);i++)
RemoveInvalidFilenameChars(rvaVarsToReplace[i].lptzValue);
- dat.cbSize = sizeof( dat );
+ dat.cbSize = sizeof(dat);
dat.dwFlags = RVF_TCHAR;
dat.variables = rvaVarsToReplace;
dat.hContact = hContact;
- TCHAR* result = ( TCHAR* )CallService( MS_UTILS_REPLACEVARS, (WPARAM)szTemp, (LPARAM)&dat );
- if ( result ) {
- _tcsncpy( szTemp, result, SIZEOF(szTemp));
- mir_free( result );
+ TCHAR* result = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szTemp, (LPARAM)&dat);
+ if (result) {
+ _tcsncpy(szTemp, result, SIZEOF(szTemp));
+ mir_free(result);
for (int i=0; i < (SIZEOF(rvaVarsToReplace)-1);i++)
mir_free(rvaVarsToReplace[i].lptzValue);
} }
if (patchVars)
- patchDir( szTemp, SIZEOF(szTemp));
+ patchDir(szTemp, SIZEOF(szTemp));
RemoveInvalidPathChars(szTemp);
- lstrcpyn( szDir, szTemp, cchDir );
+ lstrcpyn(szDir, szTemp, cchDir);
}
void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
@@ -184,20 +184,20 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) TCHAR szTemp[MAX_PATH];
szTemp[0] = 0;
- if ( !DBGetContactSettingTString( NULL, "SRFile", "RecvFilesDirAdv", &dbv )) {
- if ( lstrlen( dbv.ptszVal ) > 0 )
- lstrcpyn( szTemp, dbv.ptszVal, SIZEOF( szTemp ));
+ if ( !DBGetContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
+ if (lstrlen(dbv.ptszVal) > 0)
+ lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
DBFreeVariant(&dbv);
}
- if ( !szTemp[0] )
+ if ( !szTemp[0])
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s"), TranslateT("My Received Files"));
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s"), TranslateT("My Received Files"));
- patchDir( szTemp, SIZEOF(szTemp));
+ patchDir(szTemp, SIZEOF(szTemp));
RemoveInvalidPathChars(szTemp);
- lstrcpyn( szDir, szTemp, cchDir );
+ lstrcpyn(szDir, szTemp, cchDir);
}
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -228,7 +228,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View User's History"));
Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User Menu"));
- contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 );
+ contactName = cli.pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
GetContactReceivedFilesDir(dat->hContact, szPath, SIZEOF(szPath), TRUE);
SetDlgItemText(hwndDlg, IDC_FILEDIR, szPath);
@@ -260,11 +260,11 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CallService(MS_DB_EVENT_GET, (WPARAM)dat->hDbEvent, (LPARAM)&dbei);
dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
lstrcpynA(buf, (char*)dbei.pBlob+4, min(dbei.cbBlob+1, SIZEOF(buf)));
- TCHAR* ptszFileName = DbGetEventStringT( &dbei, buf );
+ TCHAR* ptszFileName = DbGetEventStringT(&dbei, buf);
SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName);
mir_free(ptszFileName);
lstrcpynA(buf, (char*)dbei.pBlob+4+strlen((char*)dbei.pBlob+4)+1, min((int)(dbei.cbBlob-4-strlen((char*)dbei.pBlob+4)), SIZEOF(buf)));
- TCHAR* ptszDescription = DbGetEventStringT( &dbei, buf );
+ TCHAR* ptszDescription = DbGetEventStringT(&dbei, buf);
SetDlgItemText(hwndDlg, IDC_MSG, ptszDescription);
mir_free(ptszDescription);
mir_free(dbei.pBlob);
@@ -284,7 +284,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ci.hContact = dat->hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
case CNFT_ASCIIZ:
hasName = 1;
@@ -297,7 +297,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break;
} }
if (hasName)
- SetDlgItemTextA(hwndDlg, IDC_NAME, buf );
+ SetDlgItemTextA(hwndDlg, IDC_NAME, buf);
else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
} }
@@ -313,7 +313,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l //don't check auto-min here to fix BUG#647620
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK));
}
- if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
return TRUE;
}
@@ -338,10 +338,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_COMMAND:
- if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact ))
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
- switch ( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDC_FILEDIRBROWSE:
{
TCHAR szDirName[MAX_PATH], szExistingDirName[MAX_PATH];
@@ -382,7 +382,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
dat->hwndTransfer = FtMgr_AddTransfer(dat);
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, 0);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
//check for auto-minimize here to fix BUG#647620
if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0)) {
ShowWindow(hwndDlg, SW_HIDE);
@@ -404,7 +404,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l acs.handleType=HANDLE_CONTACT;
acs.szProto="";
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
break;
@@ -435,7 +435,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY);
Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU);
- if ( dat ) FreeFileDlgData( dat );
+ if (dat) FreeFileDlgData(dat);
break;
}
return FALSE;
diff --git a/src/modules/srfile/filesenddlg.cpp b/src/modules/srfile/filesenddlg.cpp index 7d35eec275..d1d0f26c16 100644 --- a/src/modules/srfile/filesenddlg.cpp +++ b/src/modules/srfile/filesenddlg.cpp @@ -31,9 +31,9 @@ static void SetFileListAndSizeControls(HWND hwndDlg, struct FileDlgData *dat) struct _stat statbuf;
TCHAR str[64];
- for ( i=0; dat->files[i]; i++ ) {
- if ( _tstat( dat->files[i], &statbuf ) == 0 ) {
- if ( statbuf.st_mode & _S_IFDIR)
+ for (i=0; dat->files[i]; i++) {
+ if (_tstat(dat->files[i], &statbuf) == 0) {
+ if (statbuf.st_mode & _S_IFDIR)
dirCount++;
else
fileCount++;
@@ -71,12 +71,12 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA FreeFilesMatrix(&dat->files);
// Get the file attributes of selection
- dwFileAttributes = GetFileAttributes( buf );
+ dwFileAttributes = GetFileAttributes(buf);
if (dwFileAttributes == INVALID_FILE_ATTRIBUTES)
return;
// Check if the selection is a directory or a file
- if ( GetFileAttributes( buf ) & FILE_ATTRIBUTE_DIRECTORY ) {
+ if (GetFileAttributes(buf) & FILE_ATTRIBUTE_DIRECTORY) {
const TCHAR* pBuf;
int nNumberOfFiles = 0;
int nTemp;
@@ -90,13 +90,13 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA // Count number of files
pBuf = buf + fileOffset;
- while ( *pBuf ) {
+ while (*pBuf) {
pBuf += lstrlen(pBuf) + 1;
nNumberOfFiles++;
}
// Allocate memory for a pointer array
- if (( dat->files = ( TCHAR* *)mir_alloc((nNumberOfFiles + 1) * sizeof(TCHAR*))) == NULL )
+ if ((dat->files = (TCHAR* *)mir_alloc((nNumberOfFiles + 1) * sizeof(TCHAR*))) == NULL)
return;
// Fill the array
@@ -105,11 +105,11 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA while (*pBuf)
{
// Allocate space for path+filename
- int cbFileNameLen = lstrlen( pBuf );
- dat->files[nTemp] = ( TCHAR* )mir_alloc( sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
+ int cbFileNameLen = lstrlen(pBuf);
+ dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
- CopyMemory(dat->files[nTemp], buf, (fileOffset-1)*sizeof( TCHAR ));
+ CopyMemory(dat->files[nTemp], buf, (fileOffset-1)*sizeof(TCHAR));
dat->files[nTemp][fileOffset-1] = '\\';
_tcscpy(dat->files[nTemp] + fileOffset - (buf[fileOffset-2] == '\\'?1:0), pBuf);
@@ -123,7 +123,7 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA // ...the selection is a single file
else
{
- if (( dat->files = ( TCHAR **)mir_alloc(2 * sizeof( TCHAR*))) == NULL ) // Leaks when aborted
+ if ((dat->files = (TCHAR **)mir_alloc(2 * sizeof(TCHAR*))) == NULL) // Leaks when aborted
return;
dat->files[0] = mir_tstrdup(buf);
@@ -137,30 +137,30 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA #define M_FILECHOOSEDONE (WM_USER+100)
void __cdecl ChooseFilesThread(void* param)
{
- HWND hwndDlg = ( HWND )param;
+ HWND hwndDlg = (HWND)param;
TCHAR filter[128], *pfilter;
- TCHAR* buf = ( TCHAR* )mir_alloc( sizeof(TCHAR)*32767 );
- if ( buf == NULL )
- PostMessage( hwndDlg, M_FILECHOOSEDONE, 0, ( LPARAM )( TCHAR* )NULL );
+ TCHAR* buf = (TCHAR*)mir_alloc(sizeof(TCHAR)*32767);
+ if (buf == NULL)
+ PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)(TCHAR*)NULL);
else {
OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- lstrcpy( filter, TranslateT( "All Files" ));
- lstrcat( filter, _T(" (*)" ));
- pfilter = filter + lstrlen( filter )+1;
- lstrcpy( pfilter, _T( "*" ));
- pfilter = filter + lstrlen( filter )+1;
+ lstrcpy(filter, TranslateT("All Files"));
+ lstrcat(filter, _T(" (*)"));
+ pfilter = filter + lstrlen(filter)+1;
+ lstrcpy(pfilter, _T("*"));
+ pfilter = filter + lstrlen(filter)+1;
pfilter[ 0 ] = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = buf; *buf = 0;
ofn.nMaxFile = 32767;
ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- if ( GetOpenFileName( &ofn ))
- PostMessage( hwndDlg, M_FILECHOOSEDONE, 0, ( LPARAM )buf );
+ if (GetOpenFileName(&ofn))
+ PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)buf);
else {
- mir_free( buf );
- PostMessage( hwndDlg, M_FILECHOOSEDONE, 0, ( LPARAM )( TCHAR* )NULL );
+ mir_free(buf);
+ PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)(TCHAR*)NULL);
} } }
static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM)
@@ -221,15 +221,15 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
int totalCount, i;
for (totalCount=0;fsd->ppFiles[totalCount];totalCount++);
- dat->files = ( TCHAR** )mir_alloc( sizeof(TCHAR*)*(totalCount+1)); // Leaks
+ dat->files = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(totalCount+1)); // Leaks
for (i=0;i<totalCount;i++)
- dat->files[i] = mir_tstrdup( fsd->ppFiles[i] );
+ dat->files[i] = mir_tstrdup(fsd->ppFiles[i]);
dat->files[totalCount]=NULL;
SetFileListAndSizeControls(hwndDlg, dat);
}
{
char *szProto;
- TCHAR* contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 );
+ TCHAR* contactName = cli.pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_TO, contactName);
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ci.hContact = dat->hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
case CNFT_ASCIIZ:
hasName = 1;
@@ -256,13 +256,13 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break;
} }
- if ( hasName )
+ if (hasName)
SetDlgItemTextA(hwndDlg, IDC_NAME, buf);
else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
} }
- if ( fsd->ppFiles == NULL ) {
+ if (fsd->ppFiles == NULL) {
EnableWindow(hwndDlg, FALSE);
dat->closeIfFileChooseCancelled=1;
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHOOSE, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDC_CHOOSE));
@@ -289,9 +289,9 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case M_FILECHOOSEDONE:
- if ( lParam != 0 ) {
- FilenameToFileList( hwndDlg, dat, ( TCHAR* )lParam );
- mir_free(( TCHAR* )lParam );
+ if (lParam != 0) {
+ FilenameToFileList(hwndDlg, dat, (TCHAR*)lParam);
+ mir_free((TCHAR*)lParam);
dat->closeIfFileChooseCancelled = 0;
}
else if (dat->closeIfFileChooseCancelled) DestroyWindow(hwndDlg);
@@ -317,7 +317,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
dat->hwndTransfer = FtMgr_AddTransfer(dat);
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, 0);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
DestroyWindow(hwndDlg);
return TRUE;
@@ -348,8 +348,8 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY);
Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU);
- if ( dat )
- FreeFileDlgData( dat );
+ if (dat)
+ FreeFileDlgData(dat);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc);
return TRUE;
diff --git a/src/modules/srfile/filexferdlg.cpp b/src/modules/srfile/filexferdlg.cpp index 5775f29265..7864eb5a96 100644 --- a/src/modules/srfile/filexferdlg.cpp +++ b/src/modules/srfile/filexferdlg.cpp @@ -42,30 +42,30 @@ struct virusscanthreadstartinfo { HWND hwndReply;
};
-TCHAR* PFTS_StringToTchar( int flags, const PROTOCHAR* s )
+TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s)
{
- if ( flags & PFTS_UTF )
- return Utf8DecodeUcs2(( char* )s );
- else if ( flags & PFTS_UNICODE )
- return mir_tstrdup( s );
+ if (flags & PFTS_UTF)
+ return Utf8DecodeUcs2((char*)s);
+ else if (flags & PFTS_UNICODE)
+ return mir_tstrdup(s);
else
- return mir_a2t(( char* )s );
+ return mir_a2t((char*)s);
}
-int PFTS_CompareWithTchar( PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR* r )
+int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR* r)
{
- if ( ft->flags & PFTS_UTF ) {
- TCHAR* ts = Utf8DecodeUcs2(( char* )s );
- int res = _tcscmp( ts, r );
- mir_free( ts );
+ if (ft->flags & PFTS_UTF) {
+ TCHAR* ts = Utf8DecodeUcs2((char*)s);
+ int res = _tcscmp(ts, r);
+ mir_free(ts);
return res;
}
- else if ( ft->flags & PFTS_UNICODE )
- return _tcscmp( s, r );
+ else if (ft->flags & PFTS_UNICODE)
+ return _tcscmp(s, r);
else {
- TCHAR* ts = mir_a2t(( char* )s );
- int res = _tcscmp( ts, r );
- mir_free( ts );
+ TCHAR* ts = mir_a2t((char*)s);
+ int res = _tcscmp(ts, r);
+ mir_free(ts);
return res;
}
}
@@ -75,7 +75,7 @@ static void SetOpenFileButtonStyle(HWND hwndButton, int enabled) EnableWindow(hwndButton, enabled);
}
-void FillSendData( FileDlgData* dat, DBEVENTINFO& dbei )
+void FillSendData(FileDlgData* dat, DBEVENTINFO& dbei)
{
dbei.cbSize = sizeof(dbei);
dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
@@ -91,7 +91,7 @@ void FillSendData( FileDlgData* dat, DBEVENTINFO& dbei ) lstrcpyA((char*)dbei.pBlob+sizeof(DWORD), szFileNames);
lstrcpyA((char*)dbei.pBlob+sizeof(DWORD)+lstrlenA(szFileNames)+1, szMsg);
- mir_free( szFileNames ), mir_free( szMsg );
+ mir_free(szFileNames), mir_free(szMsg);
}
@@ -102,7 +102,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) DBVARIANT dbv;
TCHAR szCmdLine[768];
- if (!DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv))
+ if ( !DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv))
{
if (dbv.ptszVal[0])
{
@@ -111,7 +111,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) pszReplace = _tcsstr(dbv.ptszVal, _T("%f"));
if (pszReplace)
{
- if ( info->szFile[_tcslen(info->szFile) - 1] == '\\')
+ if (info->szFile[_tcslen(info->szFile) - 1] == '\\')
info->szFile[_tcslen(info->szFile) - 1] = '\0';
*pszReplace = 0;
mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace+2);
@@ -136,9 +136,9 @@ static void SetFilenameControls(HWND hwndDlg, struct FileDlgData *dat, PROTOFILE TCHAR *fnbuf = NULL, *fn = NULL;
SHFILEINFO shfi = {0};
- if ( fts->tszCurrentFile ) {
- fnbuf = mir_tstrdup( fts->tszCurrentFile );
- if (( fn = _tcsrchr( fnbuf, '\\' )) == NULL )
+ if (fts->tszCurrentFile) {
+ fnbuf = mir_tstrdup(fts->tszCurrentFile);
+ if ((fn = _tcsrchr(fnbuf, '\\')) == NULL)
fn = fnbuf;
else fn++;
}
@@ -147,26 +147,26 @@ static void SetFilenameControls(HWND hwndDlg, struct FileDlgData *dat, PROTOFILE if (fn && (fts->totalFiles > 1)) {
mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s (%d %s %d)"),
- cli.pfnGetContactDisplayName( fts->hContact, 0 ),
+ cli.pfnGetContactDisplayName(fts->hContact, 0),
fn, fts->currentFileNumber+1, TranslateT("of"), fts->totalFiles);
SHGetFileInfo(fn, FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES|SHGFI_ICON|SHGFI_SMALLICON);
dat->hIcon = shfi.hIcon;
}
else if (fn) {
- mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s"), cli.pfnGetContactDisplayName( fts->hContact, 0 ), fn);
+ mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s"), cli.pfnGetContactDisplayName(fts->hContact, 0), fn);
SHGetFileInfo(fn, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES|SHGFI_ICON|SHGFI_SMALLICON);
dat->hIcon = shfi.hIcon;
}
else {
- lstrcpyn(msg, cli.pfnGetContactDisplayName( fts->hContact, 0 ), SIZEOF(msg));
+ lstrcpyn(msg, cli.pfnGetContactDisplayName(fts->hContact, 0), SIZEOF(msg));
HICON hIcon = LoadSkinIcon(SKINICON_OTHER_DOWNARROW);
dat->hIcon = CopyIcon(hIcon);
IconLib_ReleaseIcon(hIcon, NULL);
}
- mir_free( fnbuf );
+ mir_free(fnbuf);
SendDlgItemMessage(hwndDlg, IDC_FILEICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->hIcon);
SetDlgItemText(hwndDlg, IDC_CONTACTNAME, msg);
@@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
{
/* check we actually got an fs handle back from the protocol */
- if (!dat->fs) {
+ if ( !dat->fs) {
SetFtStatus(hwndDlg, LPGENT("Unable to initiate transfer."), FTS_TEXT);
dat->waitingForAcceptance=0;
}
@@ -295,14 +295,14 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR Button_SetIcon_IcoLib(hwndDlg, IDCANCEL, SKINICON_OTHER_DELETE, LPGEN("Cancel"));
- SetDlgItemText(hwndDlg, IDC_CONTACTNAME, cli.pfnGetContactDisplayName( dat->hContact, 0 ));
+ SetDlgItemText(hwndDlg, IDC_CONTACTNAME, cli.pfnGetContactDisplayName(dat->hContact, 0));
- if (!dat->waitingForAcceptance) SetTimer(hwndDlg, 1, 1000, NULL);
+ if ( !dat->waitingForAcceptance) SetTimer(hwndDlg, 1, 1000, NULL);
return TRUE;
case WM_TIMER:
MoveMemory(dat->bytesRecvedHistory+1, dat->bytesRecvedHistory, sizeof(dat->bytesRecvedHistory)-sizeof(dat->bytesRecvedHistory[0]));
dat->bytesRecvedHistory[0]=dat->transferStatus.totalProgress;
- if ( dat->bytesRecvedHistorySize < SIZEOF(dat->bytesRecvedHistory))
+ if (dat->bytesRecvedHistorySize < SIZEOF(dat->bytesRecvedHistory))
dat->bytesRecvedHistorySize++;
{ TCHAR szSpeed[32], szTime[32], szDisplay[96];
@@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_FT_CLEANUP:
- if (!dat->fs)
+ if ( !dat->fs)
{
PostMessage(GetParent(hwndDlg), WM_FT_REMOVE, 0, (LPARAM)hwndDlg);
DestroyWindow(hwndDlg);
@@ -346,7 +346,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
case WM_COMMAND:
- if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact ))
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
switch (LOWORD(wParam))
@@ -374,10 +374,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
case IDC_OPENFOLDER:
- if ( dat )
+ if (dat)
{
TCHAR* path = dat->transferStatus.tszWorkingDir;
- if (!path || !path[0])
+ if ( !path || !path[0])
{
path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile);
TCHAR* p = _tcsrchr(path, '\\'); if (p) *p = 0;
@@ -427,7 +427,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (pszFilename) {
size_t cbFileNameLen = _tcslen(pszFilename);
- pszNewFileName = (TCHAR*)mir_alloc( cbFileNameLen*2*sizeof( TCHAR ));
+ pszNewFileName = (TCHAR*)mir_alloc(cbFileNameLen*2*sizeof(TCHAR));
TCHAR *p = pszNewFileName;
for (size_t pszlen=0; pszlen < cbFileNameLen; pszlen++) {
*p++ = pszFilename[pszlen];
@@ -451,7 +451,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ret == 1)
{
TCHAR* path = dat->transferStatus.tszWorkingDir;
- if (!path || !path[0])
+ if ( !path || !path[0])
{
path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile);
TCHAR* p = _tcsrchr(path, '\\'); if (p) *p = 0;
@@ -547,9 +547,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR UpdateProtoFileTransferStatus(&dat->transferStatus, (PROTOFILETRANSFERSTATUS*)ack->lParam);
PROTOFILETRANSFERSTATUS *fts = &dat->transferStatus;
- SetFilenameControls( hwndDlg, dat, fts );
- int res = _taccess( fts->tszCurrentFile, 0 );
- if ( res )
+ SetFilenameControls(hwndDlg, dat, fts);
+ int res = _taccess(fts->tszCurrentFile, 0);
+ if (res)
break;
SetFtStatus(hwndDlg, LPGENT("File already exists"), FTS_TEXT);
@@ -575,11 +575,11 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TCHAR str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName;
int units;
- if ( dat->fileVirusScanned == NULL )
+ if (dat->fileVirusScanned == NULL)
dat->fileVirusScanned=(int*)mir_calloc(sizeof(int) * fts->totalFiles);
// This needs to be here - otherwise we get holes in the files array
- if (!dat->send) {
+ if ( !dat->send) {
if (dat->files == NULL)
dat->files = (TCHAR**)mir_calloc((fts->totalFiles + 1) * sizeof(TCHAR*));
if (fts->currentFileNumber < fts->totalFiles && dat->files[fts->currentFileNumber] == NULL)
@@ -597,7 +597,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR bool firstTime = false;
if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_ALLFILESPROGRESS), GWL_STYLE) & WS_VISIBLE) == 0)
{
- SetFtStatus(hwndDlg, ( fts->flags & PFTS_SENDING ) ? LPGENT("Sending...") : LPGENT("Receiving..."), FTS_PROGRESS);
+ SetFtStatus(hwndDlg, (fts->flags & PFTS_SENDING) ? LPGENT("Sending...") : LPGENT("Receiving..."), FTS_PROGRESS);
SetFilenameControls(hwndDlg, dat, fts);
firstTime = true;
}
@@ -627,7 +627,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HideProgressControls(hwndDlg);
KillTimer(hwndDlg, 1);
- if (!dat->send)
+ if ( !dat->send)
SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1);
SetDlgItemText(hwndDlg, IDCANCEL, TranslateT("Close"));
if (dat->hNotifyEvent)
@@ -652,7 +652,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetFtStatus(hwndDlg, LPGENT("Transfer completed."), FTS_TEXT);
DBEVENTINFO dbei={0};
- FillSendData( dat, dbei );
+ FillSendData(dat, dbei);
CallService(MS_DB_EVENT_ADD, (WPARAM)dat->hContact, (LPARAM)&dbei);
if (dbei.pBlob)
mir_free(dbei.pBlob);
@@ -672,7 +672,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR vstsi->hwndReply=hwndDlg;
if (useScanner == VIRUSSCAN_DURINGDL) {
vstsi->returnCode=dat->transferStatus.currentFileNumber;
- if ( GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) {
+ if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) {
PostMessage(hwndDlg, M_VIRUSSCANDONE, vstsi->returnCode, 0);
mir_free(vstsi);
vstsi=NULL;
@@ -706,7 +706,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
else {
dat->fileVirusScanned[wParam]=1;
- for (i=0;i<dat->transferStatus.totalFiles;i++) if (!dat->fileVirusScanned[i]) {done=0; break;}
+ for (i=0;i<dat->transferStatus.totalFiles;i++) if ( !dat->fileVirusScanned[i]) {done=0; break;}
}
if (done)
{
@@ -747,7 +747,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE;
}
-void FreeFileDlgData( FileDlgData* dat )
+void FreeFileDlgData(FileDlgData* dat)
{
if (dat->fs)
CallContactService(dat->hContact, PSS_FILECANCEL, (WPARAM)dat->fs, 0);
diff --git a/src/modules/srfile/ftmanager.cpp b/src/modules/srfile/ftmanager.cpp index 0b321ee16c..3c675b5acf 100644 --- a/src/modules/srfile/ftmanager.cpp +++ b/src/modules/srfile/ftmanager.cpp @@ -205,7 +205,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA {
int i, nScrollLines = 0;
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0);
- for (i = 0; i < (nScrollLines + 1) / 2; i++ )
+ for (i = 0; i < (nScrollLines + 1) / 2; i++)
SendMessage(hwnd, WM_VSCROLL, (zDelta < 0) ? SB_LINEDOWN : SB_LINEUP, 0);
}
@@ -483,7 +483,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break;
case WM_SHOWWINDOW:
{
- if (!wParam) // hiding
+ if ( !wParam) // hiding
{
KillTimer(hwnd, 1);
break;
@@ -504,7 +504,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (dat->errorState)
{
pTaskbarInterface->SetProgressState(hwnd, dat->errorState);
- if (!prg.run)
+ if ( !prg.run)
pTaskbarInterface->SetProgressValue(hwnd, 1, 1);
} else if (prg.run)
{
@@ -559,7 +559,7 @@ HWND FtMgr_Show(bool bForceActivate, bool bFromMenu) SetForegroundWindow(hwndFtMgr);
return hwndFtMgr;
}
- if (!bJustCreated && IsWindowVisible(hwndFtMgr))
+ if ( !bJustCreated && IsWindowVisible(hwndFtMgr))
return hwndFtMgr;
ShowWindow(hwndFtMgr, bAutoMin ? SW_SHOWMINNOACTIVE : SW_SHOWNOACTIVATE);
diff --git a/src/modules/srurl/url.cpp b/src/modules/srurl/url.cpp index 4ad806c111..9a7c6b3c32 100644 --- a/src/modules/srurl/url.cpp +++ b/src/modules/srurl/url.cpp @@ -56,9 +56,9 @@ static int UrlEventAdded(WPARAM wParam, LPARAM lParam) cle.flags = CLEF_TCHAR;
cle.hContact=(HANDLE)wParam;
cle.hDbEvent=(HANDLE)lParam;
- cle.hIcon = LoadSkinIcon( SKINICON_EVENT_URL );
+ cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL);
cle.pszService="SRUrl/ReadUrl";
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), cli.pfnGetContactDisplayName(( HANDLE )wParam, 0 ));
+ mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), cli.pfnGetContactDisplayName((HANDLE)wParam, 0));
cle.ptszTooltip=szTooltip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
return 0;
@@ -79,7 +79,7 @@ static void RestoreUnreadUrlAlerts(void) dbei.cbSize=sizeof(dbei);
cle.cbSize=sizeof(cle);
- cle.hIcon = LoadSkinIcon( SKINICON_EVENT_URL );
+ cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL);
cle.pszService="SRUrl/ReadUrl";
hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
@@ -88,11 +88,11 @@ static void RestoreUnreadUrlAlerts(void) while (hDbEvent) {
dbei.cbBlob=0;
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_URL) {
+ if ( !(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_URL) {
cle.hContact=hContact;
cle.hDbEvent=hDbEvent;
cle.flags = CLEF_TCHAR;
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("URL from %s"), cli.pfnGetContactDisplayName( hContact, 0 ));
+ mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("URL from %s"), cli.pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip=toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -120,11 +120,11 @@ static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM) mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if ( szProto != NULL )
- if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_URLSEND )
+ if (szProto != NULL)
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_URLSEND)
mi.flags = CMIM_FLAGS;
- CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hSRUrlMenuItem, (LPARAM)&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSRUrlMenuItem, (LPARAM)&mi);
return 0;
}
@@ -134,7 +134,7 @@ static int SRUrlModulesLoaded(WPARAM, LPARAM) mi.cbSize = sizeof(mi);
mi.position = -2000040000;
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_EVENT_URL );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_URL);
mi.pszName = LPGEN("Web Page Address (&URL)");
mi.pszService = MS_URL_SENDURL;
hSRUrlMenuItem = Menu_AddContactMenuItem(&mi);
@@ -145,14 +145,14 @@ static int SRUrlModulesLoaded(WPARAM, LPARAM) static int SRUrlShutdown(WPARAM, LPARAM)
{
- if ( hEventContactSettingChange )
- UnhookEvent( hEventContactSettingChange );
+ if (hEventContactSettingChange)
+ UnhookEvent(hEventContactSettingChange);
- if ( hContactDeleted )
- UnhookEvent( hContactDeleted );
+ if (hContactDeleted)
+ UnhookEvent(hContactDeleted);
- if ( hUrlWindowList )
- WindowList_BroadcastAsync( hUrlWindowList, WM_CLOSE, 0, 0 );
+ if (hUrlWindowList)
+ WindowList_BroadcastAsync(hUrlWindowList, WM_CLOSE, 0, 0);
return 0;
}
@@ -160,7 +160,7 @@ static int SRUrlShutdown(WPARAM, LPARAM) int UrlContactDeleted(WPARAM wParam, LPARAM)
{
HWND h = WindowList_Find(hUrlWindowList, (HANDLE)wParam);
- if ( h )
+ if (h)
SendMessage(h, WM_CLOSE, 0, 0);
return 0;
diff --git a/src/modules/srurl/urldialogs.cpp b/src/modules/srurl/urldialogs.cpp index 8e6be8347a..6e26068ce8 100644 --- a/src/modules/srurl/urldialogs.cpp +++ b/src/modules/srurl/urldialogs.cpp @@ -27,15 +27,15 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP extern HANDLE hUrlWindowList;
-static void sttUpdateTitle( HWND hwndDlg, HANDLE hContact )
+static void sttUpdateTitle(HWND hwndDlg, HANDLE hContact)
{
TCHAR newtitle[256], oldtitle[256];
TCHAR *szStatus, *contactName, *pszNewTitleStart = TranslateT("Send URL to");
char *szProto;
- if ( hContact ) {
+ if (hContact) {
szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if ( szProto ) {
+ if (szProto) {
CONTACTINFO ci;
int hasName = 0;
char buf[128];
@@ -45,7 +45,7 @@ static void sttUpdateTitle( HWND hwndDlg, HANDLE hContact ) ci.hContact = hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
case CNFT_ASCIIZ:
hasName = 1;
@@ -58,22 +58,22 @@ static void sttUpdateTitle( HWND hwndDlg, HANDLE hContact ) break;
} }
- contactName = cli.pfnGetContactDisplayName( hContact, 0 );
- if ( hasName )
- SetDlgItemTextA( hwndDlg, IDC_NAME, buf );
+ contactName = cli.pfnGetContactDisplayName(hContact, 0);
+ if (hasName)
+ SetDlgItemTextA(hwndDlg, IDC_NAME, buf);
else
- SetDlgItemText( hwndDlg, IDC_NAME, contactName );
+ SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- szStatus = cli.pfnGetStatusModeDescription( szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord( hContact, szProto, "Status", ID_STATUS_OFFLINE ), 0 );
- mir_sntprintf( newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
+ szStatus = cli.pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
}
}
- else lstrcpyn( newtitle, pszNewTitleStart, SIZEOF(newtitle));
+ else lstrcpyn(newtitle, pszNewTitleStart, SIZEOF(newtitle));
- GetWindowText( hwndDlg, oldtitle, SIZEOF(oldtitle));
+ GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
- if ( lstrcmp( newtitle, oldtitle )) //swt() flickers even if the title hasn't actually changed
- SetWindowText( hwndDlg, newtitle );
+ if (lstrcmp(newtitle, oldtitle)) //swt() flickers even if the title hasn't actually changed
+ SetWindowText(hwndDlg, newtitle);
}
INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -112,7 +112,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CallService(MS_DB_EVENT_MARKREAD, (WPARAM)dat->hContact, (LPARAM)dat->hDbEvent);
- contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 );
+ contactName = cli.pfnGetContactDisplayName(dat->hContact, 0);
mir_sntprintf(msg, SIZEOF(msg), TranslateT("URL from %s"), contactName);
SetWindowText(hwndDlg, msg);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
@@ -123,7 +123,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } }
// From message dlg
- if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
@@ -145,15 +145,15 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (szProto) {
HICON hIcon;
- hIcon = ( HICON )CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- DestroyIcon( hIcon );
+ DestroyIcon(hIcon);
} } } }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case DM_UPDATETITLE:
- sttUpdateTitle( hwndDlg, dat->hContact );
+ sttUpdateTitle(hwndDlg, dat->hContact);
break;
case WM_COMMAND:
@@ -180,7 +180,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDM_COPYLINK:
{ HGLOBAL hData;
- if (!OpenClipboard(hwndDlg)) break;
+ if ( !OpenClipboard(hwndDlg)) break;
EmptyClipboard();
hData=GlobalAlloc(GMEM_MOVEABLE, lstrlenA(url)+1);
lstrcpyA((char*)GlobalLock(hData), url);
@@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.szProto=0;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
}
- if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
}
break;
@@ -267,16 +267,16 @@ static LRESULT DdeMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_DDE_DATA:
UnpackDDElParam(msg, lParam, (PUINT_PTR)&hGlobalDdeData, (PUINT_PTR)&hSzItem);
ddeData = 1;
- if ( hGlobalDdeData ) {
- DDEDATA* data = ( DDEDATA* )GlobalLock( hGlobalDdeData );
- if ( data->fAckReq ) {
+ if (hGlobalDdeData) {
+ DDEDATA* data = (DDEDATA*)GlobalLock(hGlobalDdeData);
+ if (data->fAckReq) {
DDEACK ack = {0};
- PostMessage(( HWND )wParam, WM_DDE_ACK, ( WPARAM )hwndDlg, PackDDElParam( WM_DDE_ACK, *(PUINT)&ack, hSzItem ));
+ PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwndDlg, PackDDElParam(WM_DDE_ACK, *(PUINT)&ack, hSzItem));
}
- else GlobalDeleteAtom(( ATOM )hSzItem );
- GlobalUnlock( hGlobalDdeData );
+ else GlobalDeleteAtom((ATOM)hSzItem);
+ GlobalUnlock(hGlobalDdeData);
}
- else GlobalDeleteAtom(( ATOM )hSzItem );
+ else GlobalDeleteAtom((ATOM)hSzItem);
break;
}
return 0;
@@ -289,7 +289,7 @@ static HGLOBAL DoDdeRequest(const char *szItemName, HWND hwndDlg) MSG msg;
hSzItemName=GlobalAddAtomA(szItemName);
- if (!PostMessage(hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDlg, MAKELPARAM(CF_TEXT, hSzItemName))) {
+ if ( !PostMessage(hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDlg, MAKELPARAM(CF_TEXT, hSzItemName))) {
GlobalDeleteAtom(hSzItemName);
return NULL;
}
@@ -306,7 +306,7 @@ static HGLOBAL DoDdeRequest(const char *szItemName, HWND hwndDlg) }
while (MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutTick-thisTick, QS_ALLINPUT) == WAIT_OBJECT_0);
- if (!ddeData) {
+ if ( !ddeData) {
GlobalDeleteAtom(hSzItemName);
return NULL;
}
@@ -357,7 +357,7 @@ static void AddBrowserPageToCombo(char *url, HWND hwndCombo) if (SendMessage(hwndCombo, CB_GETLBTEXTLEN, i, 0) >= SIZEOF(szExistingUrl))
continue;
SendMessageA(hwndCombo, CB_GETLBTEXT, i, (LPARAM)szExistingUrl);
- if (!lstrcmpA(szExistingUrl, url)) return;
+ if ( !lstrcmpA(szExistingUrl, url)) return;
}
i=SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LPARAM)url);
szItemData=mir_strdup(title);
@@ -380,7 +380,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW hSzTopic=GlobalAddAtomA("WWW_ListWindows");
ddeAcked=0;
- if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult)
+ if ( !SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult)
|| !ddeAcked) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
@@ -404,7 +404,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW hSzTopic=GlobalAddAtomA("WWW_GetWindowInfo");
ddeAcked=0;
- if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult)
+ if ( !SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult)
|| !ddeAcked) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
@@ -480,7 +480,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP WindowList_Add(hUrlWindowList, hwndDlg, dat->hContact);
{
- TCHAR *str = cli.pfnGetContactDisplayName( dat->hContact, 0 );
+ TCHAR *str = cli.pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_NAME, str);
}
@@ -493,7 +493,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc);
// From message dlg
- if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
@@ -505,7 +505,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return DdeMessage(hwndDlg, msg, wParam, lParam);
case WM_TIMER:
- if ( wParam == 0 ) {
+ if (wParam == 0) {
//ICQ sendurl timed out
KillTimer(hwndDlg, 0);
MessageBox(hwndDlg, TranslateT("Send timed out"), _T(""), MB_OK);
@@ -520,19 +520,19 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_DRAWITEM:
{
- LPDRAWITEMSTRUCT dis = ( LPDRAWITEMSTRUCT )lParam;
- if ( dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
- char *szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
+ if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto) {
HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
- if ( hIcon ) {
+ if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
} } } }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case DM_UPDATETITLE:
- sttUpdateTitle( hwndDlg, dat->hContact );
+ sttUpdateTitle(hwndDlg, dat->hContact);
break;
case WM_COMMAND:
@@ -613,7 +613,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.szProto=0;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
}
- if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
}
break;
diff --git a/src/modules/updatenotify/updatenotify.cpp b/src/modules/updatenotify/updatenotify.cpp index b29753c216..6732fe777b 100644 --- a/src/modules/updatenotify/updatenotify.cpp +++ b/src/modules/updatenotify/updatenotify.cpp @@ -128,7 +128,7 @@ int LoadUpdateNotifyModule(void) { void UnloadUpdateNotifyModule()
{
- if (!bModuleInitialized) return;
+ if ( !bModuleInitialized) return;
UnhookEvent(hHookModules);
UnhookEvent(hHookPreShutdown);
}
@@ -145,7 +145,7 @@ static int UpdateNotifyOptInit(WPARAM wParam, LPARAM) { odp.pszTitle = LPGEN("Update Notify");
odp.pfnDlgProc = UpdateNotifyOptsProc;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -171,7 +171,7 @@ static INT_PTR UpdateNotifyMenuCommand(WPARAM, LPARAM) { static VOID CALLBACK UpdateNotifyTimerCheck(HWND, UINT, UINT_PTR, DWORD)
{
KillTimer(NULL, updateTimerId);
- if (!DBGetContactSettingByte(NULL, UN_MOD, UN_ENABLE, UN_ENABLE_DEF))
+ if ( !DBGetContactSettingByte(NULL, UN_MOD, UN_ENABLE, UN_ENABLE_DEF))
return;
if (dwUpdateThreadID != 0) {
Netlib_Logf(hNetlibUser, "Update notification already running, ignoring attempt");
@@ -180,10 +180,10 @@ static VOID CALLBACK UpdateNotifyTimerCheck(HWND, UINT, UINT_PTR, DWORD) {
DWORD lastCheck = 0;
- if (!hNetlibUser)
+ if ( !hNetlibUser)
return;
lastCheck = DBGetContactSettingDword(NULL, UN_MOD, UN_LASTCHECK, 0);
- if (!lastCheck) { // never checked for update before
+ if ( !lastCheck) { // never checked for update before
Netlib_Logf(hNetlibUser, "Running update notify check for the first time.");
dwUpdateThreadID = mir_forkthread(UpdateNotifyPerform, 0);
}
@@ -208,7 +208,7 @@ static VOID CALLBACK UpdateNotifyTimerCheck(HWND, UINT, UINT_PTR, DWORD) static DWORD UpdateNotifyMakeVersion(char *str) {
DWORD a1, a2, a3, a4;
- if (!str)
+ if ( !str)
return 0;
sscanf(str, "%u.%u.%u.%u", &a1, &a2, &a3, &a4);
return PLUGIN_MAKE_VERSION(a1, a2, a3, a4);
@@ -221,7 +221,7 @@ inline bool UpdateNotifyReleaseDataValid(UpdateNotifyReleaseData *d) { return d && d->szVersionPublic && d->szVersion && d->szDownload && d->szNotes; }
static void UpdateNotifyFreeReleaseData(UpdateNotifyReleaseData *d) {
- if (!d)
+ if ( !d)
return;
if (d->szVersionPublic) mir_free(d->szVersionPublic);
if (d->szVersion) mir_free(d->szVersion);
@@ -230,7 +230,7 @@ static void UpdateNotifyFreeReleaseData(UpdateNotifyReleaseData *d) { }
static void UpdateNotifyReleaseLogUpdate(UpdateNotifyReleaseData *d) {
- if (!UpdateNotifyReleaseDataValid(d))
+ if ( !UpdateNotifyReleaseDataValid(d))
return;
#ifdef _WIN64
Netlib_Logf(hNetlibUser, "Update server version: %s [%s] [64-bit]", d->szVersionPublic, d->szVersion);
@@ -240,7 +240,7 @@ static void UpdateNotifyReleaseLogUpdate(UpdateNotifyReleaseData *d) { }
static void UpdateNotifyReleaseCopyData(UpdateNotifyReleaseData *d, UpdateNotifyData *und) {
- if (!UpdateNotifyReleaseDataValid(d)||!und)
+ if ( !UpdateNotifyReleaseDataValid(d) || !und)
return;
mir_snprintf(und->version, sizeof(und->version), "%s", d->szVersionPublic);
mir_snprintf(und->versionReal, sizeof(und->versionReal), "%s", d->szVersion);
@@ -257,7 +257,7 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { int isUnicode, isAlphaCheck, isBetaCheck;
DBVARIANT dbv;
- if (!und)
+ if ( !und)
return 0;
und->version[0] = 0;
und->versionReal[0] = 0;
@@ -274,7 +274,7 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { mir_snprintf(szVersion, sizeof(szVersion), "%d.%d.%d.%d",
HIBYTE(HIWORD(dwVersion)), LOBYTE(HIWORD(dwVersion)),
HIBYTE(LOWORD(dwVersion)), LOBYTE(LOWORD(dwVersion)));
- if (!DBGetContactSettingString(NULL, UN_MOD, UN_CUSTOMXMLURL, &dbv)) {
+ if ( !DBGetContactSettingString(NULL, UN_MOD, UN_CUSTOMXMLURL, &dbv)) {
mir_snprintf(szUrl, sizeof(szUrl), "%s", dbv.pszVal?dbv.pszVal:UN_URLXML);
DBFreeVariant(&dbv);
}
@@ -382,7 +382,7 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { rdAlphaValid = UpdateNotifyReleaseDataValid(&rdAlpha);
if (isBetaCheck) {
- if (!rdBetaValid&&rdStableValid) {
+ if ( !rdBetaValid&&rdStableValid) {
UpdateNotifyReleaseLogUpdate(&rdStable);
if (UpdateNotifyIsNewer(dwVersion, rdStable.dwVersion))
resUpdate = 1;
@@ -402,7 +402,7 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { }
}
else if (isAlphaCheck) {
- if (!rdAlphaValid&&rdStableValid) {
+ if ( !rdAlphaValid&&rdStableValid) {
if (UpdateNotifyIsNewer(rdStable.dwVersion, rdAlpha.dwVersion)) {
UpdateNotifyReleaseLogUpdate(&rdAlpha);
if (UpdateNotifyIsNewer(dwVersion, rdAlpha.dwVersion))
@@ -422,7 +422,7 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { resUpdate = 1;
UpdateNotifyReleaseCopyData(&rdStable, und);
}
- else if (!rdAlphaValid&&rdBetaValid&&rdStableValid) {
+ else if ( !rdAlphaValid&&rdBetaValid&&rdStableValid) {
if (UpdateNotifyIsNewer(rdStable.dwVersion, rdBeta.dwVersion)) {
UpdateNotifyReleaseLogUpdate(&rdBeta);
if (UpdateNotifyIsNewer(dwVersion, rdBeta.dwVersion))
@@ -500,8 +500,8 @@ static void UpdateNotifyPerform(void *) if (und.isNew) {
int notify = 1;
- if (!DBGetContactSettingString(NULL, UN_MOD, UN_CURRENTVERSION, &dbv)) {
- if (!strcmp(dbv.pszVal, und.versionReal)) { // already notified of this version
+ if ( !DBGetContactSettingString(NULL, UN_MOD, UN_CURRENTVERSION, &dbv)) {
+ if ( !strcmp(dbv.pszVal, und.versionReal)) { // already notified of this version
DWORD dwNotifyLast = DBGetContactSettingDword(NULL, UN_MOD, UN_CURRENTVERSIONFND, 0);
@@ -527,7 +527,7 @@ static void UpdateNotifyPerform(void *) static INT_PTR CALLBACK UpdateNotifyProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA);
@@ -540,7 +540,7 @@ static INT_PTR CALLBACK UpdateNotifyProc(HWND hwndDlg, UINT msg, WPARAM wParam, hwndManualUpdateDlg = hwndDlg;
else hwndUpdateDlg = hwndDlg;
if (und->isNew) {
- TCHAR* ptszVer = mir_a2t( und->version );
+ TCHAR* ptszVer = mir_a2t(und->version);
mir_sntprintf(szTmp, SIZEOF(szTmp), TranslateT("Miranda IM %s Now Available"), ptszVer);
mir_free(ptszVer);
ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATE), SW_HIDE);
@@ -608,7 +608,7 @@ static INT_PTR CALLBACK UpdateNotifyProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_DESTROY:
- Window_FreeIcon_IcoLib( hwndDlg );
+ Window_FreeIcon_IcoLib(hwndDlg);
break;
}
return FALSE;
diff --git a/src/modules/userinfo/contactinfo.cpp b/src/modules/userinfo/contactinfo.cpp index 42658c8fd1..f83c1c5a5c 100644 --- a/src/modules/userinfo/contactinfo.cpp +++ b/src/modules/userinfo/contactinfo.cpp @@ -88,7 +88,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, 252);
if (lstrlenA(szText)<7 || szText[0] != '+') isValid=0;
if (isValid) isValid=(lstrlenA(szText+1) == (int)strspn(szText+1, "0123456789 ()-"));
- if (!isValid) {
+ if ( !isValid) {
MessageBox(hwndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid Phone Number"), MB_OK);
break;
}
@@ -124,21 +124,21 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (szText[0] != '+')
isValid=0;
- if ( isValid ) {
- int i, country = strtol( szText+1, &pText, 10 );
- if ( pText - szText > 4 )
+ if (isValid) {
+ int i, country = strtol(szText+1, &pText, 10);
+ if (pText - szText > 4)
isValid = 0;
else {
- for ( i = SendDlgItemMessage( hwndDlg, IDC_COUNTRY, CB_GETCOUNT, 0, 0 )-1; i >= 0; i-- )
- if ( country == SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, i, 0)) {
+ for (i = SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCOUNT, 0, 0)-1; i >= 0; i--)
+ if (country == SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, i, 0)) {
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETCURSEL, i, 0);
break;
}
- if ( i < 0 )
+ if (i < 0)
isValid = 0;
}
}
- if ( isValid ) {
+ if (isValid) {
pArea = pText+strcspn(pText, "0123456789");
pText = pArea+strspn(pArea, "0123456789");
if (*pText) {
@@ -148,7 +148,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar }
SetDlgItemTextA(hwndDlg, IDC_AREA, pArea);
}
- if ( !isValid ) {
+ if ( !isValid) {
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETCURSEL, -1, 0);
SetDlgItemTextA(hwndDlg, IDC_AREA, "");
SetDlgItemTextA(hwndDlg, IDC_NUMBER, "");
@@ -176,10 +176,10 @@ static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail) GetCursorPos(&hti.pt);
ScreenToClient(hwndEmails, &hti.pt);
GetClientRect(hwndEmails, &rc);
- if (!PtInRect(&rc, hti.pt)) return 0;
+ if ( !PtInRect(&rc, hti.pt)) return 0;
if (ListView_SubItemHitTest(hwndEmails, &hti) == -1) return 0;
if (hti.iSubItem != 1) return 0;
- if (!(hti.flags&LVHT_ONITEMLABEL)) return 0;
+ if ( !(hti.flags&LVHT_ONITEMLABEL)) return 0;
ListView_GetSubItemRect(hwndEmails, hti.iItem, 1, LVIR_LABEL, &rc);
szText[0] = 0;
ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, SIZEOF(szText));
@@ -260,7 +260,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.pszText=TranslateT("Primary");
}
else {
- mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i );
+ mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i);
if (DBGetContactSettingTString(hContact, szProto, idstr, &dbv))
break;
lvi.pszText=idstr2;
@@ -293,21 +293,21 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.lParam=(LPARAM)(-1);
lvi.iSubItem=0;
lvi.iItem=0;
- if (!DBGetContactSettingTString(hContact, szProto, "Phone", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "Phone", &dbv)) {
lvi.pszText=TranslateT("Primary");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact, szProto, "Fax", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "Fax", &dbv)) {
lvi.pszText=TranslateT("Fax");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact, szProto, "Cellular", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "Cellular", &dbv)) {
lvi.pszText=TranslateT("Mobile");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
if (lstrlenA(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4, " SMS")) {
@@ -318,14 +318,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact, szProto, "CompanyPhone", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "CompanyPhone", &dbv)) {
lvi.pszText=TranslateT("Work Phone");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact, szProto, "CompanyFax", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "CompanyFax", &dbv)) {
lvi.pszText=TranslateT("Work Fax");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
@@ -392,15 +392,15 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP HICON hIcon = NULL;
if (nm->nmcd.lItemlParam == (LPARAM)(-2) && nm->iSubItem-3 == (nm->nmcd.hdr.idFrom == IDC_PHONES))
- hIcon = LoadSkinIcon( SKINICON_OTHER_ADDCONTACT );
+ hIcon = LoadSkinIcon(SKINICON_OTHER_ADDCONTACT);
else if (nm->iSubItem>1 && nm->nmcd.lItemlParam != (LPARAM)(-1) && nm->nmcd.lItemlParam != (LPARAM)(-2)) {
static int iconResources[3]={SKINICON_OTHER_RENAME, SKINICON_OTHER_DELETE};
if (nm->iSubItem == 2 && nm->nmcd.hdr.idFrom == IDC_PHONES) {
TCHAR szText[2];
ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
- if (szText[0]) hIcon = LoadSkinIcon( SKINICON_OTHER_SMS );
+ if (szText[0]) hIcon = LoadSkinIcon(SKINICON_OTHER_SMS);
}
- else hIcon = LoadSkinIcon( iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom == IDC_EMAILS)] );
+ else hIcon = LoadSkinIcon(iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom == IDC_EMAILS)]);
}
else break;
DrawIconEx(nm->nmcd.hdc, (rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2, (rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
diff --git a/src/modules/userinfo/stdinfo.cpp b/src/modules/userinfo/stdinfo.cpp index 7cc4e348ac..40f749efdf 100644 --- a/src/modules/userinfo/stdinfo.cpp +++ b/src/modules/userinfo/stdinfo.cpp @@ -43,7 +43,7 @@ static int Proto_GetContactInfoSetting(HANDLE hContact, const char *szProto, con static void Proto_FreeInfoVariant(DBVARIANT *dbv)
{
- switch ( dbv->type ) {
+ switch (dbv->type) {
case DBVT_ASCIIZ:
case DBVT_UTF8:
case DBVT_WCHAR:
@@ -75,7 +75,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, if (szModule == NULL) unspecified=1;
else if (proto_service) unspecified=Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
else unspecified=DBGetContactSettingW(hContact, szModule, szSetting, &dbv);
- if (!unspecified) {
+ if ( !unspecified) {
switch(dbv.type) {
case DBVT_BYTE:
if (special == SVS_GENDER) {
@@ -105,9 +105,9 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, case DBVT_WORD:
if (special == SVS_COUNTRY) {
WORD wSave = dbv.wVal;
- if (wSave == ( WORD )-1) {
+ if (wSave == (WORD)-1) {
char szSettingName[100];
- mir_snprintf( szSettingName, SIZEOF(szSettingName), "%sName", szSetting );
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sName", szSetting);
if ( !DBGetContactSettingTString(hContact, szModule, szSettingName, &dbv)) {
ptstr = dbv.ptszVal;
unspecified = false;
@@ -139,23 +139,23 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, break;
case DBVT_UTF8:
unspecified=(special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
- if ( !unspecified )
+ if ( !unspecified)
{ WCHAR* wszStr;
- Utf8Decode( dbv.pszVal, &wszStr );
- SetDlgItemTextW( hwndDlg, idCtrl, TranslateTS(wszStr));
- mir_free( wszStr );
+ Utf8Decode(dbv.pszVal, &wszStr);
+ SetDlgItemTextW(hwndDlg, idCtrl, TranslateTS(wszStr));
+ mir_free(wszStr);
goto LBL_Exit;
}
pstr=dbv.pszVal;
- Utf8Decode( dbv.pszVal, NULL );
+ Utf8Decode(dbv.pszVal, NULL);
break;
default: pstr=str; lstrcpyA(str, "???"); break;
} }
if (unspecified)
SetDlgItemText(hwndDlg, idCtrl, TranslateT("<not specified>"));
- else if ( ptstr != NULL )
+ else if (ptstr != NULL)
SetDlgItemText(hwndDlg, idCtrl, ptstr);
else
SetDlgItemTextA(hwndDlg, idCtrl, pstr);
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED )
+ if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED)
{ char *szProto;
HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
@@ -256,7 +256,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED )
+ if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED)
{ char *szProto;
HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
@@ -395,8 +395,8 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem=0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i);
- if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
- (!proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
+ if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
+ ( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i);
if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText))
@@ -414,8 +414,8 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i);
- if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
- (!proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
+ if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
+ ( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i);
if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText))
@@ -440,8 +440,8 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem=0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i);
- if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
- (!proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
+ if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
+ ( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i);
if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText))
@@ -507,7 +507,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0));
- if (!DBGetContactSettingString((HANDLE)lParam, "UserInfo", "MyNotes", &dbv)) {
+ if ( !DBGetContactSettingString((HANDLE)lParam, "UserInfo", "MyNotes", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_MYNOTES, dbv.pszVal);
DBFreeVariant(&dbv);
}
@@ -565,7 +565,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) if ((HANDLE)lParam == NULL)
return 0;
- if ( CallService(MS_PROTO_GETCONTACTBASEPROTO, lParam, 0) == 0 )
+ if (CallService(MS_PROTO_GETCONTACTBASEPROTO, lParam, 0) == 0)
return 0;
odp.cbSize = sizeof(odp);
@@ -577,36 +577,36 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) odp.position = -2100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SUMMARY);
odp.pszTitle = LPGEN("Summary");
- CallService(MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp);
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = ContactDlgProc;
odp.position = -1800000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_CONTACT);
odp.pszTitle = LPGEN("Contact");
- CallService(MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = LocationDlgProc;
odp.position = -1500000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_LOCATION);
odp.pszTitle = LPGEN("Location");
- CallService(MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp);
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = WorkDlgProc;
odp.position = -1200000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_WORK);
odp.pszTitle = LPGEN("Work");
- CallService(MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp);
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = BackgroundDlgProc;
odp.position = -900000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_BACKGROUND);
odp.pszTitle = LPGEN("Background info");
- CallService(MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp );
+ UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = NotesDlgProc;
odp.position = 0;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_NOTES);
odp.pszTitle = LPGEN("Notes");
- CallService(MS_USERINFO_ADDPAGE, wParam, ( LPARAM )&odp);
+ UserInfo_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp index 7fb79822d5..599902f9ad 100644 --- a/src/modules/userinfo/userinfo.cpp +++ b/src/modules/userinfo/userinfo.cpp @@ -61,12 +61,12 @@ struct DetailsData { static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2)
{
int res;
- if (!lstrcmp(item1->ptszTitle, TranslateT("Summary"))) return -1;
- if (!lstrcmp(item2->ptszTitle, TranslateT("Summary"))) return 1;
+ if ( !lstrcmp(item1->ptszTitle, TranslateT("Summary"))) return -1;
+ if ( !lstrcmp(item2->ptszTitle, TranslateT("Summary"))) return 1;
if (res = lstrcmp(item1->ptszTitle, item2->ptszTitle)) return res;
if (item1->ptszTab && !item2->ptszTab) return -1;
- if (!item1->ptszTab && item2->ptszTab) return 1;
- if (!item1->ptszTab && !item2->ptszTab) return 0;
+ if ( !item1->ptszTab && item2->ptszTab) return 1;
+ if ( !item1->ptszTab && !item2->ptszTab) return 0;
if (item1->ptszTab && !lstrcmp(item1->ptszTab, TranslateT("General"))) return -1;
if (item2->ptszTab && !lstrcmp(item2->ptszTab, TranslateT("General"))) return 1;
return lstrcmp(item1->ptszTab, item2->ptszTab);
@@ -117,10 +117,8 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE *odp=(OPTIONSDIALOGPAGE*)lParam, *dst;
struct DetailsPageInit *opi=(struct DetailsPageInit*)wParam;
- if (odp == NULL||opi == NULL) return 1;
- if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE)
- && odp->cbSize != OPTIONPAGE_OLD_SIZE2
- && odp->cbSize != OPTIONPAGE_OLD_SIZE3)
+ if (odp == NULL || opi == NULL) return 1;
+ if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE) && odp->cbSize != OPTIONPAGE_OLD_SIZE)
return 1;
opi->odp=(OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1));
@@ -133,26 +131,26 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) else dst->pszTemplate = odp->pszTemplate;
- if ( odp->flags & ODPF_UNICODE )
+ if (odp->flags & ODPF_UNICODE)
{
dst->ptszTitle = (odp->ptszTitle == 0) ? NULL : mir_wstrdup(odp->ptszTitle);
- dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->ptszTab) ? NULL : mir_wstrdup(odp->ptszTab);
+ dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->ptszTab) ? NULL : mir_wstrdup(odp->ptszTab);
}
else
{
- if ( odp->flags & ODPF_DONTTRANSLATE )
+ if (odp->flags & ODPF_DONTTRANSLATE)
dst->ptszTitle = (odp->pszTitle == 0) ? NULL : mir_a2t(odp->pszTitle);
else
dst->ptszTitle = (odp->pszTitle == 0) ? NULL : LangPackPcharToTchar(odp->pszTitle);
- dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : LangPackPcharToTchar(odp->pszTab);
+ dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : LangPackPcharToTchar(odp->pszTab);
}
dst->pszGroup = NULL;
dst->groupPosition = odp->groupPosition;
dst->hGroupIcon = odp->hGroupIcon;
dst->hIcon = odp->hIcon;
- if ( odp->cbSize == sizeof(OPTIONSDIALOGPAGE))
+ if (odp->cbSize == sizeof(OPTIONSDIALOGPAGE))
dst->dwInitParam = odp->dwInitParam;
opi->pageCount++;
return 0;
@@ -164,7 +162,7 @@ static void ThemeDialogBackground(HWND hwnd) enableThemeDialogTexture(hwnd, ETDT_ENABLETAB);
}
-static void CreateDetailsTabs( HWND hwndDlg, struct DetailsData* dat, struct DetailsPageData* ppg )
+static void CreateDetailsTabs(HWND hwndDlg, struct DetailsData* dat, struct DetailsPageData* ppg)
{
HWND hwndTab = GetDlgItem(hwndDlg, IDC_TABS);
int i, sel=0, pages=0;
@@ -172,13 +170,13 @@ static void CreateDetailsTabs( HWND hwndDlg, struct DetailsData* dat, struct Det tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
tie.iImage = -1;
TabCtrl_DeleteAllItems(hwndTab);
- for ( i=0; i < dat->pageCount; i++ ) {
- if (!dat->opd[i].ptszTab || lstrcmp(dat->opd[i].ptszTitle, ppg->ptszTitle)) continue;
+ for (i=0; i < dat->pageCount; i++) {
+ if ( !dat->opd[i].ptszTab || lstrcmp(dat->opd[i].ptszTitle, ppg->ptszTitle)) continue;
tie.pszText = TranslateTS(dat->opd[i].ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if (!lstrcmp(dat->opd[i].ptszTab, ppg->ptszTab))
+ if ( !lstrcmp(dat->opd[i].ptszTab, ppg->ptszTab))
sel = pages;
pages++;
}
@@ -188,7 +186,7 @@ static void CreateDetailsTabs( HWND hwndDlg, struct DetailsData* dat, struct Det SetWindowLongPtr(hwndTab, GWL_STYLE, pages > 1 ? style | WS_TABSTOP : style & ~WS_TABSTOP);
}
-static void CreateDetailsPageWindow( HWND hwndDlg, struct DetailsData* dat, struct DetailsPageData* ppg )
+static void CreateDetailsPageWindow(HWND hwndDlg, struct DetailsData* dat, struct DetailsPageData* ppg)
{
RECT *rc = ppg->ptszTab ? &dat->rcDisplayTab : &dat->rcDisplay;
ppg->hwnd=CreateDialogIndirectParam(ppg->hInst, ppg->pTemplate, hwndDlg, ppg->dlgProc, (LPARAM)dat->hContact);
@@ -241,15 +239,15 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->hContact == NULL)
name = TranslateT("Owner");
else
- name = cli.pfnGetContactDisplayName( dat->hContact, 0 );
+ name = cli.pfnGetContactDisplayName(dat->hContact, 0);
- GetWindowText( hwndDlg, oldTitle, SIZEOF( oldTitle ));
- mir_sntprintf( newTitle, SIZEOF(newTitle), oldTitle, name );
- SetWindowText( hwndDlg, newTitle );
+ GetWindowText(hwndDlg, oldTitle, SIZEOF(oldTitle));
+ mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, name);
+ SetWindowText(hwndDlg, newTitle);
- GetDlgItemText( hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF( oldTitle ));
- mir_sntprintf( newTitle, SIZEOF(newTitle), oldTitle, name );
- SetDlgItemText( hwndDlg, IDC_HEADERBAR, newTitle );
+ GetDlgItemText(hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF(oldTitle));
+ mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, name);
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, newTitle);
}
{ LOGFONT lf;
HFONT hNormalFont=(HFONT)SendDlgItemMessage(hwndDlg, IDC_NAME, WM_GETFONT, 0, 0);
@@ -266,13 +264,13 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND hwndTree = GetDlgItem(hwndDlg, IDC_PAGETREE);
dat->currentPage = 0;
- if ( DBGetContactSettingTString( NULL, "UserInfo", "LastTab", &dbv ))
+ if (DBGetContactSettingTString(NULL, "UserInfo", "LastTab", &dbv))
dbv.type = DBVT_DELETED;
dat->pageCount = psh->nPages;
dat->opd = (DetailsPageData*)mir_calloc(sizeof(DetailsPageData) * dat->pageCount);
odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
- for ( i=0; i < dat->pageCount; i++ ) {
+ for (i=0; i < dat->pageCount; i++) {
dat->opd[i].pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(odp[i].hInstance,
FindResourceA(odp[i].hInstance, odp[i].pszTemplate, MAKEINTRESOURCEA(5))));
dat->opd[i].dlgProc = odp[i].pfnDlgProc;
@@ -295,7 +293,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvis.item.pszText = mir_tstrdup(odp[i].ptszTitle);
else
tvis.item.pszText = TranslateTS(odp[i].ptszTitle);
- if ( dbv.type != DBVT_DELETED && !lstrcmp( tvis.item.pszText, dbv.ptszVal ))
+ if (dbv.type != DBVT_DELETED && !lstrcmp(tvis.item.pszText, dbv.ptszVal))
dat->currentPage = i;
dat->opd[i].hItem = TreeView_InsertItem(hwndTree, &tvis);
}
@@ -332,7 +330,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->updateAnimFrame = 0;
GetDlgItemText(hwndDlg, IDC_UPDATING, dat->szUpdating, SIZEOF(dat->szUpdating));
SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
- if (!CallContactService(dat->hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) {
+ if ( !CallContactService(dat->hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
SetTimer(hwndDlg, 1, 100, NULL);
} else
@@ -417,7 +415,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (ack->type != ACKTYPE_GETINFO) break;
SendMessage(hwndDlg, PSM_FORCECHANGED, 0, 0);
/* if they're not gonna send any more ACK's don't let that mean we should crash */
- if (!ack->hProcess && !ack->lParam) {
+ if ( !ack->hProcess && !ack->lParam) {
ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE);
KillTimer(hwndDlg, 1);
SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
@@ -556,7 +554,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_UPDATE:
if (dat->infosUpdated != NULL) {mir_free(dat->infosUpdated); dat->infosUpdated=NULL;}
if (dat->hContact != NULL) {
- if (!CallContactService(dat->hContact, PSS_GETINFO, 0, 0)) {
+ if ( !CallContactService(dat->hContact, PSS_GETINFO, 0, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_SHOW);
SetTimer(hwndDlg, 1, 100, NULL);
@@ -617,12 +615,12 @@ int LoadUserInfoModule(void) HookEvent(ME_USERINFO_INITIALISE, DetailsInit);
HookEvent(ME_DB_CONTACT_DELETED, UserInfoContactDelete);
HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownUserInfo);
- CreateServiceFunction(MS_USERINFO_ADDPAGE, AddDetailsPage);
+ CreateServiceFunction("UserInfo/AddPage", AddDetailsPage);
mi.cbSize = sizeof(mi);
mi.flags = CMIF_ICONFROMICOLIB;
mi.position = 1000050000;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_USERDETAILS );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_USERDETAILS);
mi.pszName = LPGEN("User &Details");
mi.pszService = MS_USERINFO_SHOWDIALOG;
Menu_AddContactMenuItem(&mi);
diff --git a/src/modules/useronline/useronline.cpp b/src/modules/useronline/useronline.cpp index c3a4562ae4..bc41bb2a69 100644 --- a/src/modules/useronline/useronline.cpp +++ b/src/modules/useronline/useronline.cpp @@ -49,7 +49,7 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) {
DWORD ticked = db_dword_get(NULL, "UserOnline", cws->szModule, GetTickCount());
// only play the sound (or show event) if this event happens at least 10 secs after the proto went from offline
- if ( GetTickCount() - ticked > (1000*10) ) {
+ if (GetTickCount() - ticked > (1000*10)) {
CLISTEVENT cle;
TCHAR tooltip[256];
@@ -58,12 +58,12 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) cle.flags=CLEF_ONLYAFEW | CLEF_TCHAR;
cle.hContact=(HANDLE)wParam;
cle.hDbEvent=(HANDLE)(uniqueEventId++);
- cle.hIcon = LoadSkinIcon( SKINICON_OTHER_USERONLINE, false );
+ cle.hIcon = LoadSkinIcon(SKINICON_OTHER_USERONLINE, false);
cle.pszService="UserOnline/Description";
- mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is Online"), cli.pfnGetContactDisplayName(( HANDLE )wParam, 0 ));
+ mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is Online"), cli.pfnGetContactDisplayName((HANDLE)wParam, 0));
cle.ptszTooltip=tooltip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
- IconLib_ReleaseIcon( cle.hIcon, 0 );
+ IconLib_ReleaseIcon(cle.hIcon, 0);
DBWriteContactSettingDword(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent);
SkinPlaySound("UserOnline");
}
@@ -75,7 +75,7 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) static int UserOnlineAck(WPARAM, LPARAM lParam)
{
ACKDATA * ack = (ACKDATA*) lParam;
- if ( ack != 0 && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS && ack->hProcess == (HANDLE)ID_STATUS_OFFLINE) {
+ if (ack != 0 && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS && ack->hProcess == (HANDLE)ID_STATUS_OFFLINE) {
// if going from offline to any other mode, remember when it happened.
db_dword_set(NULL, "UserOnline", ack->szModule, GetTickCount());
}
@@ -85,22 +85,22 @@ static int UserOnlineAck(WPARAM, LPARAM lParam) static int UserOnlineModulesLoaded(WPARAM, LPARAM)
{
// reset the counter
- for ( int j = 0; j < accounts.getCount(); j++ )
- if ( Proto_IsAccountEnabled( accounts[j] )) db_dword_set( NULL, "UserOnline", accounts[j]->szModuleName, GetTickCount());
+ for (int j = 0; j < accounts.getCount(); j++)
+ if (Proto_IsAccountEnabled(accounts[j])) db_dword_set(NULL, "UserOnline", accounts[j]->szModuleName, GetTickCount());
return 0;
}
-static int UserOnlineAccountsChanged( WPARAM eventCode, LPARAM lParam )
+static int UserOnlineAccountsChanged(WPARAM eventCode, LPARAM lParam)
{
PROTOACCOUNT* pa = (PROTOACCOUNT*)lParam;
- switch( eventCode ) {
+ switch(eventCode) {
case PRAC_ADDED:
case PRAC_CHECKED:
// reset the counter
- if ( Proto_IsAccountEnabled( pa ))
- db_dword_set( NULL, "UserOnline", pa->szModuleName, GetTickCount());
+ if (Proto_IsAccountEnabled(pa))
+ db_dword_set(NULL, "UserOnline", pa->szModuleName, GetTickCount());
break;
}
return 0;
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index 8cedc1ba87..2e656dbf63 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_png.h"
#include "m_imgsrvc.h"
-static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName )
+static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName)
{
IPicture *pic;
HBITMAP hBmp, hBmpCopy;
@@ -36,63 +36,63 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) short picType;
TCHAR szFilename[MAX_PATH];
- if ( !pathToAbsoluteT(ptszFileName, szFilename, NULL ))
+ if ( !pathToAbsoluteT(ptszFileName, szFilename, NULL))
mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s"), ptszFileName);
int filenameLen = lstrlen(szFilename);
- if ( filenameLen > 4 ) {
+ if (filenameLen > 4) {
TCHAR* pszExt = szFilename + filenameLen - 4;
- if ( ServiceExists( MS_IMG_LOAD ))
- return CallService( MS_IMG_LOAD, (WPARAM)szFilename, IMGL_TCHAR );
+ if (ServiceExists(MS_IMG_LOAD))
+ return CallService(MS_IMG_LOAD, (WPARAM)szFilename, IMGL_TCHAR);
- if ( !lstrcmpi( pszExt, _T(".bmp")) || !lstrcmpi( pszExt, _T(".rle"))) {
+ if ( !lstrcmpi(pszExt, _T(".bmp")) || !lstrcmpi(pszExt, _T(".rle"))) {
//LoadImage can do this much faster
- return (INT_PTR)LoadImage( hMirandaInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
+ return (INT_PTR)LoadImage(hMirandaInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
}
- if ( !lstrcmpi( pszExt, _T(".png"))) {
+ if ( !lstrcmpi(pszExt, _T(".png"))) {
HANDLE hFile, hMap = NULL;
BYTE* ppMap = NULL;
INT_PTR cbFileSize = 0;
BITMAPINFOHEADER* pDib;
BYTE* pDibBits;
- if ( !ServiceExists( MS_PNG2DIB )) {
- MessageBox( NULL, TranslateT( "You need an image services plugin to process PNG images." ), TranslateT( "Error" ), MB_OK );
+ if ( !ServiceExists(MS_PNG2DIB)) {
+ MessageBox(NULL, TranslateT("You need an image services plugin to process PNG images."), TranslateT("Error"), MB_OK);
return 0;
}
- if (( hFile = CreateFile( szFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )) != INVALID_HANDLE_VALUE )
- if (( hMap = CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, 0, NULL )) != NULL )
- if (( ppMap = ( BYTE* )MapViewOfFile( hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL )
- cbFileSize = GetFileSize( hFile, NULL );
+ if ((hFile = CreateFile(szFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
+ if ((ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL)
+ cbFileSize = GetFileSize(hFile, NULL);
- if ( cbFileSize != 0 ) {
+ if (cbFileSize != 0) {
PNG2DIB param;
param.pSource = ppMap;
param.cbSourceSize = cbFileSize;
param.pResult = &pDib;
- if ( CallService( MS_PNG2DIB, 0, ( LPARAM )¶m )) {
- pDibBits = ( BYTE* )( pDib+1 );
- HDC sDC = GetDC( NULL );
- HBITMAP hBitmap = CreateDIBitmap( sDC, pDib, CBM_INIT, pDibBits, ( BITMAPINFO* )pDib, DIB_PAL_COLORS );
- SelectObject( sDC, hBitmap );
- ReleaseDC( NULL, sDC );
- GlobalFree( pDib );
+ if (CallService(MS_PNG2DIB, 0, (LPARAM)¶m)) {
+ pDibBits = (BYTE*)(pDib+1);
+ HDC sDC = GetDC(NULL);
+ HBITMAP hBitmap = CreateDIBitmap(sDC, pDib, CBM_INIT, pDibBits, (BITMAPINFO*)pDib, DIB_PAL_COLORS);
+ SelectObject(sDC, hBitmap);
+ ReleaseDC(NULL, sDC);
+ GlobalFree(pDib);
cbFileSize = (INT_PTR)hBitmap;
}
else cbFileSize = 0;
}
- if ( ppMap != NULL ) UnmapViewOfFile( ppMap );
- if ( hMap != NULL ) CloseHandle( hMap );
- if ( hFile != NULL ) CloseHandle( hFile );
+ if (ppMap != NULL) UnmapViewOfFile(ppMap);
+ if (hMap != NULL) CloseHandle(hMap);
+ if (hFile != NULL) CloseHandle(hFile);
return (INT_PTR)cbFileSize;
} }
- if (S_OK != OleLoadPicturePath( LPOLESTR(( const wchar_t* )StrConvU(szFilename)), NULL, 0, 0, IID_IPicture, (PVOID*)&pic ))
+ if (S_OK != OleLoadPicturePath(LPOLESTR((const wchar_t*)StrConvU(szFilename)), NULL, 0, 0, IID_IPicture, (PVOID*)&pic))
return 0;
pic->get_Type(&picType);
@@ -109,9 +109,9 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) hdc=GetDC(NULL);
hdcMem1=CreateCompatibleDC(hdc);
hdcMem2=CreateCompatibleDC(hdc);
- hOldBitmap=( HBITMAP )SelectObject(hdcMem1, hBmp);
+ hOldBitmap=(HBITMAP)SelectObject(hdcMem1, hBmp);
hBmpCopy=CreateCompatibleBitmap(hdcMem1, bmpInfo.bmWidth, bmpInfo.bmHeight);
- hOldBitmap2=( HBITMAP )SelectObject(hdcMem2, hBmpCopy);
+ hOldBitmap2=(HBITMAP)SelectObject(hdcMem2, hBmpCopy);
BitBlt(hdcMem2, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, hdcMem1, 0, 0, SRCCOPY);
SelectObject(hdcMem1, hOldBitmap);
SelectObject(hdcMem2, hOldBitmap2);
@@ -126,12 +126,12 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) static INT_PTR BmpFilterLoadBitmap(WPARAM, LPARAM lParam)
{
- return sttBitmapLoader( StrConvT(( const char* )lParam ));
+ return sttBitmapLoader(StrConvT((const char*)lParam));
}
static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam)
{
- return sttBitmapLoader(( const wchar_t* )lParam );
+ return sttBitmapLoader((const wchar_t*)lParam);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -187,7 +187,7 @@ static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam) TCHAR *filter=(TCHAR*)lParam, *pfilter;
lstrcpyn(filter, TranslateT("All Bitmaps"), bytesLeft); bytesLeft-=lstrlen(filter);
- _tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft );
+ _tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft);
pfilter=filter+lstrlen(filter)+1; bytesLeft=wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft);
pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index bde00a35ef..2705347f36 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -47,12 +47,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); /* always succeeds */
/* fall thru */
case WM_SYSCOLORCHANGE:
- if (!(dat->flags&HLKF_HASENABLECOLOR)) {
+ if ( !(dat->flags&HLKF_HASENABLECOLOR)) {
if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor=RGB(0, 0, 255);
else dat->enableColor=GetSysColor(COLOR_HOTLIGHT);
dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2);
}
- if (!(dat->flags&HLKF_HASDISABLECOLOR))
+ if ( !(dat->flags&HLKF_HASDISABLECOLOR))
dat->disableColor=GetSysColor(COLOR_GRAYTEXT);
break;
@@ -101,7 +101,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_LBUTTONDOWN:
{ POINT pt;
POINTSTOPOINT(pt, MAKEPOINTS(lParam));
- if (!PtInRect(&dat->rcText, pt)) break;
+ if ( !PtInRect(&dat->rcText, pt)) break;
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), STN_CLICKED), (LPARAM)hwnd);
return 0;
}
@@ -131,12 +131,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA { RECT rcWnd;
POINT pt;
HWND hwndParent;
- if (!GetWindowRect(hwnd, &rcWnd)) break;
+ if ( !GetWindowRect(hwnd, &rcWnd)) break;
pt.x=rcWnd.left;
pt.y=rcWnd.top;
hwndParent=GetParent(hwnd);
if (hwndParent == NULL) hwndParent=hwnd;
- if (!ScreenToClient(hwndParent, &pt)) break;
+ if ( !ScreenToClient(hwndParent, &pt)) break;
rcWnd.right=pt.x+(rcWnd.right-rcWnd.left);
rcWnd.bottom=pt.y+(rcWnd.bottom-rcWnd.top);
rcWnd.left=pt.x;
@@ -149,7 +149,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_CREATE:
case HLK_MEASURETEXT:
{ TCHAR szText[256];
- if (!GetWindowText(hwnd, szText, SIZEOF(szText))) return 0;
+ if ( !GetWindowText(hwnd, szText, SIZEOF(szText))) return 0;
lParam=(LPARAM)szText;
/* fall thru */
case WM_SETTEXT:
@@ -176,15 +176,15 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA }
if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc, hPrevFont);
ReleaseDC(hwnd, hdc);
- if (!fMeasured) return 0; /* text change failed */
+ if ( !fMeasured) return 0; /* text change failed */
SendMessage(hwnd, HLK_INVALIDATE, 0, 0);
break;
}}
case WM_SETCURSOR:
{ POINT pt;
HCURSOR hCursor;
- if (!GetCursorPos(&pt)) return FALSE;
- if (!ScreenToClient(hwnd, &pt)) return FALSE;
+ if ( !GetCursorPos(&pt)) return FALSE;
+ if ( !ScreenToClient(hwnd, &pt)) return FALSE;
if (PtInRect(&dat->rcText, pt)) {
hCursor=(HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR);
if (hCursor == NULL) hCursor=LoadCursor(NULL, IDC_HAND); /* Win2000+ */
diff --git a/src/modules/utils/imgconv.cpp b/src/modules/utils/imgconv.cpp index 118ffc3acb..d4d72f066e 100644 --- a/src/modules/utils/imgconv.cpp +++ b/src/modules/utils/imgconv.cpp @@ -46,9 +46,9 @@ void ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cx ULONG cxDelta = cxRow - bmi.bmiHeader.biWidth;
ARGB *pargbMask = (ARGB *)pvBits;
- for (ULONG y = bmi.bmiHeader.biHeight + 1; --y; )
+ for (ULONG y = bmi.bmiHeader.biHeight + 1; --y;)
{
- for (ULONG x = bmi.bmiHeader.biWidth + 1; --x; )
+ for (ULONG x = bmi.bmiHeader.biWidth + 1; --x;)
{
if (*pargbMask++)
{
@@ -68,12 +68,12 @@ void ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cx free(pvBits);
}
-bool HasAlpha( ARGB *pargb, SIZE& sizImage, int cxRow)
+bool HasAlpha(ARGB *pargb, SIZE& sizImage, int cxRow)
{
ULONG cxDelta = cxRow - sizImage.cx;
- for (ULONG y = sizImage.cy; y--; )
+ for (ULONG y = sizImage.cy; y--;)
{
- for (ULONG x = sizImage.cx; x--; )
+ for (ULONG x = sizImage.cx; x--;)
{
if (*pargb++ & 0xFF000000)
return true;
@@ -92,7 +92,7 @@ void ConvertBufferToPARGB32(HANDLE hPaintBuffer, HDC hdc, HICON hIcon, SIZE& siz if (SUCCEEDED(hr))
{
ARGB *pargb = (ARGB *)prgbQuad;
- if (!HasAlpha(pargb, sizIcon, cxRow))
+ if ( !HasAlpha(pargb, sizIcon, cxRow))
{
ICONINFO info;
if (GetIconInfo(hIcon, &info))
diff --git a/src/modules/utils/md5.cpp b/src/modules/utils/md5.cpp index 241aa2270f..94cd69bbe2 100644 --- a/src/modules/utils/md5.cpp +++ b/src/modules/utils/md5.cpp @@ -147,7 +147,7 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]* * On little-endian machines, we can process properly aligned
* data without copying it.
*/
- if (!((data - (const mir_md5_byte_t *)0) & 3)) {
+ if ( !((data - (const mir_md5_byte_t *)0) & 3)) {
/* data are properly aligned */
X = (const mir_md5_word_t *)data;
} else {
@@ -361,9 +361,9 @@ void md5_hash_string(const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[ INT_PTR GetMD5Interface(WPARAM, LPARAM lParam)
{
struct MD5_INTERFACE *md5i = (struct MD5_INTERFACE*) lParam;
- if ( md5i == NULL )
+ if (md5i == NULL)
return 1;
- if ( md5i->cbSize != sizeof( struct MD5_INTERFACE ))
+ if (md5i->cbSize != sizeof(struct MD5_INTERFACE))
return 1;
md5i->md5_init = md5_init;
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 46e95f954e..296b9a3ecc 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -73,7 +73,7 @@ static int DoDdeRequest(const char *szItemName, HWND hwndDdeMsg) struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg, 0);
hSzItemName=GlobalAddAtomA(szItemName);
- if (!PostMessage(dat->hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDdeMsg, MAKELPARAM(CF_TEXT, hSzItemName))) {
+ if ( !PostMessage(dat->hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDdeMsg, MAKELPARAM(CF_TEXT, hSzItemName))) {
GlobalDeleteAtom(hSzItemName);
return 1;
}
@@ -89,7 +89,7 @@ static int DoDdeRequest(const char *szItemName, HWND hwndDdeMsg) if (thisTick>timeoutTick) break;
} while (MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutTick-thisTick, QS_ALLINPUT) == WAIT_OBJECT_0);
- if (!dat->fData) {
+ if ( !dat->fData) {
GlobalDeleteAtom(hSzItemName);
return 1;
}
@@ -107,7 +107,7 @@ static int DdeOpenUrl(const char *szBrowser, char *szUrl, int newWindow, HWND hw hSzBrowser=GlobalAddAtomA(szBrowser);
hSzTopic=GlobalAddAtomA("WWW_OpenURL");
dat->fAcked=0;
- if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDdeMsg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, &dwResult)
+ if ( !SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDdeMsg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, &dwResult)
|| !dat->fAcked) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
@@ -146,13 +146,13 @@ static void OpenURLThread(void *arg) DWORD dataLength;
int success=0;
- if (!hUrlInfo->szUrl) return;
+ if ( !hUrlInfo->szUrl) return;
hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW, _T(""), 0, 0, 0, 0, 0, NULL, NULL, hMirandaInst, NULL);
SetWindowLongPtr(hwndDdeMsg, 0, (LONG_PTR)&msgWndData);
- if (!_strnicmp(hUrlInfo->szUrl, "ftp:", 4) || !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) pszProtocol="ftp";
- if (!_strnicmp(hUrlInfo->szUrl, "mailto:", 7)) pszProtocol="mailto";
- if (!_strnicmp(hUrlInfo->szUrl, "news:", 5)) pszProtocol="news";
+ if ( !_strnicmp(hUrlInfo->szUrl, "ftp:", 4) || !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) pszProtocol="ftp";
+ if ( !_strnicmp(hUrlInfo->szUrl, "mailto:", 7)) pszProtocol="mailto";
+ if ( !_strnicmp(hUrlInfo->szUrl, "news:", 5)) pszProtocol="news";
else pszProtocol="http";
wsprintfA(szSubkey, "%s\\shell\\open\\command", pszProtocol);
if (RegOpenKeyExA(HKEY_CURRENT_USER, szSubkey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS
@@ -184,7 +184,7 @@ static void OpenURLThread(void *arg) for (i=0;isalpha(hUrlInfo->szUrl[i]);i++);
if (hUrlInfo->szUrl[i] == ':') szResult=mir_strdup(hUrlInfo->szUrl);
else {
- if (!_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) {
+ if ( !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) {
szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+7);
wsprintfA(szResult, "ftp://%s", hUrlInfo->szUrl);
}
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index c2915fb7ed..c38f09bcf5 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -33,9 +33,9 @@ static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam); static int pathIsAbsolute(const char *path)
{
- if ( strlen(path) <= 2 )
+ if (strlen(path) <= 2)
return 0;
- if ((path[1] == ':'&&path[2] == '\\')||(path[0] == '\\'&&path[1] == '\\'))
+ if ((path[1] == ':'&&path[2] == '\\') || (path[0] == '\\'&&path[1] == '\\'))
return 1;
return 0;
}
@@ -44,8 +44,8 @@ static INT_PTR pathToRelative(WPARAM wParam, LPARAM lParam) {
char *pSrc = (char*)wParam;
char *pOut = (char*)lParam;
- if (!pSrc||!strlen(pSrc)||strlen(pSrc)>MAX_PATH) return 0;
- if (!pathIsAbsolute(pSrc)) {
+ if ( !pSrc || !strlen(pSrc) || strlen(pSrc)>MAX_PATH) return 0;
+ if ( !pathIsAbsolute(pSrc)) {
mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
return strlen(pOut);
}
@@ -67,21 +67,21 @@ static INT_PTR pathToRelative(WPARAM wParam, LPARAM lParam) int pathToAbsolute(const char *pSrc, char *pOut, char* base)
{
- if ( !pSrc || !strlen( pSrc ) || strlen( pSrc ) > MAX_PATH )
+ if ( !pSrc || !strlen(pSrc) || strlen(pSrc) > MAX_PATH)
return 0;
- if ( base == NULL )
+ if (base == NULL)
base = szMirandaPath;
char buf[MAX_PATH];
- if ( pSrc[0] < ' ')
- return mir_snprintf( pOut, MAX_PATH, "%s", pSrc );
- else if ( pathIsAbsolute( pSrc ))
+ if (pSrc[0] < ' ')
+ return mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
+ else if (pathIsAbsolute(pSrc))
return GetFullPathNameA(pSrc, MAX_PATH, pOut, NULL);
- else if ( pSrc[0] != '\\' )
- mir_snprintf( buf, MAX_PATH, "%s%s", base, pSrc );
+ else if (pSrc[0] != '\\')
+ mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc);
else
- mir_snprintf( buf, MAX_PATH, "%s%s", base, pSrc+1 );
+ mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc+1);
return GetFullPathNameA(buf, MAX_PATH, pOut, NULL);
}
@@ -91,42 +91,42 @@ static INT_PTR pathToAbsolute(WPARAM wParam, LPARAM lParam) return pathToAbsolute((char*)wParam, (char*)lParam, szMirandaPath);
}
-void CreatePathToFile( char* szFilePath )
+void CreatePathToFile(char* szFilePath)
{
- char* pszLastBackslash = strrchr( szFilePath, '\\' );
- if ( pszLastBackslash == NULL )
+ char* pszLastBackslash = strrchr(szFilePath, '\\');
+ if (pszLastBackslash == NULL)
return;
*pszLastBackslash = '\0';
- CreateDirectoryTree( szFilePath );
+ CreateDirectoryTree(szFilePath);
*pszLastBackslash = '\\';
}
-int CreateDirectoryTree( const char *szDir )
+int CreateDirectoryTree(const char *szDir)
{
DWORD dwAttributes;
char *pszLastBackslash, szTestDir[ MAX_PATH ];
- lstrcpynA( szTestDir, szDir, SIZEOF( szTestDir ));
- if (( dwAttributes = GetFileAttributesA( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
+ lstrcpynA(szTestDir, szDir, SIZEOF(szTestDir));
+ if ((dwAttributes = GetFileAttributesA(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
- pszLastBackslash = strrchr( szTestDir, '\\' );
- if ( pszLastBackslash == NULL )
+ pszLastBackslash = strrchr(szTestDir, '\\');
+ if (pszLastBackslash == NULL)
return 0;
*pszLastBackslash = '\0';
- CreateDirectoryTree( szTestDir );
+ CreateDirectoryTree(szTestDir);
*pszLastBackslash = '\\';
- return ( CreateDirectoryA( szTestDir, NULL ) == 0 ) ? GetLastError() : 0;
+ return (CreateDirectoryA(szTestDir, NULL) == 0) ? GetLastError() : 0;
}
static INT_PTR createDirTree(WPARAM, LPARAM lParam)
{
- if ( lParam == 0 )
+ if (lParam == 0)
return 1;
- return CreateDirectoryTree(( char* )lParam );
+ return CreateDirectoryTree((char*)lParam);
}
static TCHAR szMirandaPathW[MAX_PATH];
@@ -134,9 +134,9 @@ static TCHAR szMirandaPathWLower[MAX_PATH]; static int pathIsAbsoluteW(const TCHAR *path)
{
- if ( lstrlen(path) <= 2 )
+ if (lstrlen(path) <= 2)
return 0;
- if ((path[1] == ':'&&path[2] == '\\')||(path[0] == '\\'&&path[1] == '\\'))
+ if ((path[1] == ':'&&path[2] == '\\') || (path[0] == '\\'&&path[1] == '\\'))
return 1;
return 0;
}
@@ -145,10 +145,10 @@ static INT_PTR pathToRelativeW(WPARAM wParam, LPARAM lParam) {
TCHAR *pSrc = (TCHAR*)wParam;
TCHAR *pOut = (TCHAR*)lParam;
- if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH )
+ if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
return 0;
- if ( !pathIsAbsoluteW( pSrc ))
+ if ( !pathIsAbsoluteW(pSrc))
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
else {
TCHAR szTmp[MAX_PATH];
@@ -168,18 +168,18 @@ int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base) if ( !pSrc || !wcslen(pSrc) || wcslen(pSrc) > MAX_PATH)
return 0;
- if ( base == NULL )
+ if (base == NULL)
base = szMirandaPathW;
TCHAR buf[MAX_PATH];
- if ( pSrc[0] < ' ')
- return mir_sntprintf( pOut, MAX_PATH, _T("%s"), pSrc );
- else if ( pathIsAbsoluteW( pSrc ))
+ if (pSrc[0] < ' ')
+ return mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
+ else if (pathIsAbsoluteW(pSrc))
return GetFullPathName(pSrc, MAX_PATH, pOut, NULL);
- else if ( pSrc[0] != '\\' )
- mir_sntprintf( buf, MAX_PATH, _T("%s%s"), base, pSrc );
+ else if (pSrc[0] != '\\')
+ mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc);
else
- mir_sntprintf( buf, MAX_PATH, _T("%s%s"), base, pSrc+1 );
+ mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc+1);
return GetFullPathName(buf, MAX_PATH, pOut, NULL);
}
@@ -189,49 +189,49 @@ static INT_PTR pathToAbsoluteW(WPARAM wParam, LPARAM lParam) return pathToAbsoluteW((TCHAR*)wParam, (TCHAR*)lParam, szMirandaPathW);
}
-void CreatePathToFileW( WCHAR* wszFilePath )
+void CreatePathToFileW(WCHAR* wszFilePath)
{
- WCHAR* pszLastBackslash = wcsrchr( wszFilePath, '\\' );
- if ( pszLastBackslash == NULL )
+ WCHAR* pszLastBackslash = wcsrchr(wszFilePath, '\\');
+ if (pszLastBackslash == NULL)
return;
*pszLastBackslash = '\0';
- CreateDirectoryTreeW( wszFilePath );
+ CreateDirectoryTreeW(wszFilePath);
*pszLastBackslash = '\\';
}
-int CreateDirectoryTreeW( const WCHAR* szDir )
+int CreateDirectoryTreeW(const WCHAR* szDir)
{
DWORD dwAttributes;
WCHAR* pszLastBackslash, szTestDir[ MAX_PATH ];
- lstrcpynW( szTestDir, szDir, SIZEOF( szTestDir ));
- if (( dwAttributes = GetFileAttributesW( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
+ lstrcpynW(szTestDir, szDir, SIZEOF(szTestDir));
+ if ((dwAttributes = GetFileAttributesW(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
- pszLastBackslash = wcsrchr( szTestDir, '\\' );
- if ( pszLastBackslash == NULL )
+ pszLastBackslash = wcsrchr(szTestDir, '\\');
+ if (pszLastBackslash == NULL)
return 0;
*pszLastBackslash = '\0';
- CreateDirectoryTreeW( szTestDir );
+ CreateDirectoryTreeW(szTestDir);
*pszLastBackslash = '\\';
- return ( CreateDirectoryW( szTestDir, NULL ) == 0 ) ? GetLastError() : 0;
+ return (CreateDirectoryW(szTestDir, NULL) == 0) ? GetLastError() : 0;
}
static INT_PTR createDirTreeW(WPARAM, LPARAM lParam)
{
- if ( lParam == 0 )
+ if (lParam == 0)
return 1;
- return CreateDirectoryTreeW(( WCHAR* )lParam );
+ return CreateDirectoryTreeW((WCHAR*)lParam);
}
int InitPathUtilsW(void)
{
GetModuleFileName(hMirandaInst, szMirandaPathW, SIZEOF(szMirandaPathW));
TCHAR *p = _tcsrchr(szMirandaPathW, '\\');
- if ( p )
+ if (p)
p[1] = 0;
mir_sntprintf(szMirandaPathWLower, SIZEOF(szMirandaPathWLower), _T("%s"), szMirandaPathW);
_tcslwr(szMirandaPathWLower);
@@ -244,10 +244,10 @@ int InitPathUtilsW(void) TCHAR *GetContactID(HANDLE hContact)
{
TCHAR *theValue = {0};
- char *szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0) == 1) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, szProto, "ChatRoomID", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "ChatRoomID", &dbv)) {
theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
return theValue;
@@ -258,7 +258,7 @@ TCHAR *GetContactID(HANDLE hContact) ci.hContact = hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
return (TCHAR *)ci.pszVal;
@@ -301,9 +301,9 @@ static __forceinline char *GetEnvironmentVariableX(char *variable) return mir_strdup(result);
return NULL;
}
-static __forceinline char *GetProfileDirX( char* )
+static __forceinline char *GetProfileDirX(char*)
{
- return mir_t2a( g_profileDir );
+ return mir_t2a(g_profileDir);
}
static __forceinline char *SHGetSpecialFolderPathX(int iCSIDL, char* var)
{
@@ -331,22 +331,22 @@ static __forceinline char *GetUserNameX(char *) static __forceinline char *GetProfileNameX(char *)
{
TCHAR szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
+ _tcscpy(szProfileName, g_profileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- return mir_t2a( szProfileName );
+ return mir_t2a(szProfileName);
}
static __forceinline char *GetPathVarX(char *, int code)
{
TCHAR szFullPath[MAX_PATH], szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
- _tcslwr( szProfileName );
+ _tcscpy(szProfileName, g_profileName);
+ _tcslwr(szProfileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- switch( code ) {
+ switch(code) {
case 1:
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, szProfileName);
break;
@@ -357,7 +357,7 @@ static __forceinline char *GetPathVarX(char *, int code) mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s"), g_profileDir, szProfileName);
break;
}
- return makeFileName( szFullPath );
+ return makeFileName(szFullPath);
}
static __forceinline int _xcscmp(const TCHAR *s1, const TCHAR *s2) { return _tcscmp(s1, s2); }
@@ -390,9 +390,9 @@ static __forceinline TCHAR *SHGetSpecialFolderPathX(int iCSIDL, TCHAR* var) return mir_tstrdup(result);
return NULL;
}
-static __forceinline TCHAR *GetProfileDirX( TCHAR* )
+static __forceinline TCHAR *GetProfileDirX(TCHAR*)
{
- return mir_tstrdup( g_profileDir );
+ return mir_tstrdup(g_profileDir);
}
static __forceinline TCHAR *GetModulePathX(TCHAR *, HMODULE hModule)
{
@@ -413,21 +413,21 @@ static __forceinline TCHAR *GetUserNameX(TCHAR *) static __forceinline TCHAR *GetProfileNameX(TCHAR *)
{
TCHAR szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
+ _tcscpy(szProfileName, g_profileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- return mir_tstrdup( szProfileName );
+ return mir_tstrdup(szProfileName);
}
static __forceinline TCHAR *GetPathVarX(TCHAR *, int code)
{
TCHAR szFullPath[MAX_PATH], szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
+ _tcscpy(szProfileName, g_profileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- switch( code ) {
+ switch(code) {
case 1:
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, szProfileName);
break;
@@ -438,7 +438,7 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code) mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s"), g_profileDir, szProfileName);
break;
}
- return mir_tstrdup( szFullPath );
+ return mir_tstrdup(szFullPath);
}
template<typename XCHAR>
@@ -450,38 +450,38 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) theKey[keyLength] = 0;
if (hContact) {
- if (!_xcscmp(theKey, XSTR(key, "nick")))
+ if ( !_xcscmp(theKey, XSTR(key, "nick")))
theValue = GetContactNickX(key, hContact);
- else if (!_xcscmp(theKey, XSTR(key, "proto")))
+ else if ( !_xcscmp(theKey, XSTR(key, "proto")))
theValue = mir_a2x(key, (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0));
- else if (!_xcscmp(theKey, XSTR(key, "userid")))
+ else if ( !_xcscmp(theKey, XSTR(key, "userid")))
theValue = GetContactIDX(key, hContact);
}
- if (!theValue) {
- if (!_xcscmp(theKey, XSTR(key, "miranda_path")))
+ if ( !theValue) {
+ if ( !_xcscmp(theKey, XSTR(key, "miranda_path")))
theValue = GetModulePathX(key, NULL);
- else if (!_xcscmp(theKey, XSTR(key, "appdata")))
+ else if ( !_xcscmp(theKey, XSTR(key, "appdata")))
theValue = SHGetSpecialFolderPathX(CSIDL_APPDATA, theKey);
- else if (!_xcscmp(theKey, XSTR(key, "mydocuments")))
+ else if ( !_xcscmp(theKey, XSTR(key, "mydocuments")))
theValue = SHGetSpecialFolderPathX(CSIDL_PERSONAL, theKey);
- else if (!_xcscmp(theKey, XSTR(key, "desktop")))
+ else if ( !_xcscmp(theKey, XSTR(key, "desktop")))
theValue = SHGetSpecialFolderPathX(CSIDL_DESKTOPDIRECTORY, theKey);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_profile")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_profile")))
theValue = GetProfileDirX(key);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_profilename")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_profilename")))
theValue = GetProfileNameX(key);
- else if (!_xcscmp(theKey, XSTR(key, "username")))
+ else if ( !_xcscmp(theKey, XSTR(key, "username")))
theValue = GetUserNameX(key);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_avatarcache")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_avatarcache")))
theValue = GetPathVarX(key, 1);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_logpath")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_logpath")))
theValue = GetPathVarX(key, 2);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_userdata")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_userdata")))
theValue = GetPathVarX(key, 3);
}
- if (!theValue)
+ if ( !theValue)
theValue = GetEnvironmentVariableX(theKey);
return theValue;
@@ -502,7 +502,7 @@ XCHAR *GetVariableFromArray(REPLACEVARSARRAY *vars, XCHAR *key, size_t keyLength template<typename XCHAR>
XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data)
{
- if (!str)
+ if ( !str)
return NULL;
XCHAR *p;
@@ -526,7 +526,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) }
else varStart = p+1;
}
- else if (!varStart)
+ else if ( !varStart)
length++;
}
@@ -553,7 +553,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) }
else varStart = p+1;
}
- else if (!varStart)
+ else if ( !varStart)
*q++ = *p;
}
@@ -565,7 +565,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam)
{
REPLACEVARSDATA *data = (REPLACEVARSDATA *)lParam;
- if (!(data->dwFlags & RVF_UNICODE))
+ if ( !(data->dwFlags & RVF_UNICODE))
return (INT_PTR)ReplaceVariables<char>((char *)wParam, data);
@@ -577,7 +577,7 @@ int InitPathUtils(void) char *p = 0;
GetModuleFileNameA(hMirandaInst, szMirandaPath, SIZEOF(szMirandaPath));
p = strrchr(szMirandaPath, '\\');
- if ( p )
+ if (p)
p[1] = 0;
mir_snprintf(szMirandaPathLower, MAX_PATH, "%s", szMirandaPath);
_strlwr(szMirandaPathLower);
diff --git a/src/modules/utils/resizer.cpp b/src/modules/utils/resizer.cpp index 1ddfa3fb75..a443fef0ae 100644 --- a/src/modules/utils/resizer.cpp +++ b/src/modules/utils/resizer.cpp @@ -61,7 +61,7 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) int procResult;
int extendedDlg, itemCount;
- if (urd == NULL||urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
+ if (urd == NULL || urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance, FindResourceA(urd->hInstance, urd->lpTemplate, MAKEINTRESOURCEA(5))));
pTemplateEx=(START_OF_DLGTEMPLATEEX*)pTemplate;
extendedDlg=pTemplateEx->signature == 0xFFFF;
diff --git a/src/modules/utils/sha1.cpp b/src/modules/utils/sha1.cpp index 3d71239bab..2fede54718 100644 --- a/src/modules/utils/sha1.cpp +++ b/src/modules/utils/sha1.cpp @@ -162,9 +162,9 @@ static void shaHashBlock(mir_sha1_ctx *ctx) { INT_PTR GetSHA1Interface(WPARAM, LPARAM lParam)
{
struct SHA1_INTERFACE *sha1i = (struct SHA1_INTERFACE*) lParam;
- if ( sha1i == NULL )
+ if (sha1i == NULL)
return 1;
- if ( sha1i->cbSize != sizeof( struct SHA1_INTERFACE ))
+ if (sha1i->cbSize != sizeof(struct SHA1_INTERFACE))
return 1;
sha1i->sha1_init = shaInit;
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index c562ce6460..05e83afa51 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -138,7 +138,7 @@ static void CalcTsOffset(MIM_TIMEZONE *tz) SystemTimeToFileTime(&st, &ft);
time_t ts1 = FileTimeToUnixTime(&ft);
- if (!fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl))
+ if ( !fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl))
return;
SystemTimeToFileTime(&stl, &ft);
@@ -187,7 +187,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
+ if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);
DBFreeVariant(&dbv);
@@ -198,7 +198,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) if (timezone == -1)
{
char* szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (!DBGetContactSettingTString(hContact, szProto, "TzName", &dbv))
+ if ( !DBGetContactSettingTString(hContact, szProto, "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);
DBFreeVariant(&dbv);
@@ -349,13 +349,13 @@ static const ListMessages cbMessages = static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags)
{
- if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB)))
+ if ( !(dwFlags & (TZF_PLF_CB | TZF_PLF_LB)))
{
TCHAR tszClassName[128];
GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
- if (!_tcsicmp(tszClassName, _T("COMBOBOX")))
+ if ( !_tcsicmp(tszClassName, _T("COMBOBOX")))
dwFlags |= TZF_PLF_CB;
- else if (!_tcsicmp(tszClassName, _T("LISTBOX")))
+ else if ( !_tcsicmp(tszClassName, _T("LISTBOX")))
dwFlags |= TZF_PLF_LB;
}
if (dwFlags & TZF_PLF_CB)
@@ -379,7 +379,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) if (hContact)
{
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
+ if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
unsigned hash = hashstr(dbv.ptszVal);
for (int i = 0; i < g_timezonesBias.getCount(); ++i)
@@ -442,7 +442,7 @@ static void timeapiStoreListResult(HANDLE hContact, HWND hWnd, DWORD dwFlags) }
-static INT_PTR GetTimeApi( WPARAM, LPARAM lParam )
+static INT_PTR GetTimeApi(WPARAM, LPARAM lParam)
{
TIME_API* tmi = (TIME_API*)lParam;
if (tmi == NULL)
@@ -542,9 +542,9 @@ void RecalculateTime(void) MIM_TIMEZONE &tz = g_timezones[i];
if (tz.offset != INT_MIN) tz.offset = INT_MIN;
- if (!found)
+ if ( !found)
{
- if (!wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) ||
+ if ( !wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) ||
!wcscmp(tz.tzi.DaylightName, myInfo.myTZ.tzi.DaylightName))
{
_tcscpy(myInfo.myTZ.tszName, tz.tszName);
diff --git a/src/modules/utils/utf.cpp b/src/modules/utils/utf.cpp index 4c86e1c4ee..d9479f59d3 100644 --- a/src/modules/utils/utf.cpp +++ b/src/modules/utils/utf.cpp @@ -78,7 +78,7 @@ static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen) len += 2;
continue;
}
- if (!(val = getSurrogateValue(src, srclen)))
+ if ( !(val = getSurrogateValue(src, srclen)))
{
return -2;
}
@@ -96,10 +96,10 @@ static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen) int Ucs2toUtf8Len(const wchar_t *src)
{
- if ( src == 0 )
+ if (src == 0)
return 0;
- return Ucs2toUtf8Len( src, (int)wcslen( src ));
+ return Ucs2toUtf8Len(src, (int)wcslen(src));
}
/* wide char to UTF-8 string conversion */
@@ -115,7 +115,7 @@ int Ucs2toUtf8(const wchar_t *src, int srclen, char *dst, int dstlen) if (ch < 0x80) /* 0x00-0x7f: 1 byte */
{
- if (!len--) return -1; /* overflow */
+ if ( !len--) return -1; /* overflow */
*dst++ = ch;
continue;
}
@@ -130,7 +130,7 @@ int Ucs2toUtf8(const wchar_t *src, int srclen, char *dst, int dstlen) continue;
}
- if (!(val = getSurrogateValue(src, srclen)))
+ if ( !(val = getSurrogateValue(src, srclen)))
{
return -2;
}
@@ -259,7 +259,7 @@ char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2) int len;
bool needs_free = false;
wchar_t* tempBuf = NULL;
- if ( ucs2 )
+ if (ucs2)
*ucs2 = NULL;
if (str == NULL)
@@ -292,9 +292,9 @@ char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2) }
}
- if ( tempBuf == NULL ) {
+ if (tempBuf == NULL) {
tempBuf = (wchar_t*)mir_alloc((destlen + 1) * sizeof(wchar_t));
- if ( tempBuf == NULL )
+ if (tempBuf == NULL)
return NULL;
}
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 6372bac5cb..96b69de775 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -301,7 +301,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM) {
int i;
- for (i=0; i < SIZEOF(countries); i++ )
+ for (i=0; i < SIZEOF(countries); i++)
if ((int)wParam == countries[i].id) return (INT_PTR)countries[i].szName;
return (INT_PTR)NULL;
}
@@ -406,7 +406,7 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam) if (wParam & RWPF_NOACTIVATE)
wp.showCmd = SW_SHOWNOACTIVATE;
- if (!(wParam & RWPF_NOMOVE))
+ if ( !(wParam & RWPF_NOMOVE))
AssertInsideScreen((WPARAM) &wp.rcNormalPosition, 0);
SetWindowPlacement(swp->hwnd, &wp);
@@ -421,15 +421,15 @@ static INT_PTR RestartMiranda(WPARAM, LPARAM) PROCESS_INFORMATION pi;
STARTUPINFO si = { 0 };
si.cb = sizeof(si);
- GetModuleFileName( NULL, mirandaPath, SIZEOF(mirandaPath));
- mir_sntprintf( cmdLine, SIZEOF( cmdLine ), _T("/restart:%d"), GetCurrentProcessId());
- CreateProcess( mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
+ GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("/restart:%d"), GetCurrentProcessId());
+ CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-typedef BOOL (APIENTRY *PGENRANDOM)( PVOID, ULONG );
+typedef BOOL (APIENTRY *PGENRANDOM)(PVOID, ULONG);
static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam)
{
@@ -442,7 +442,7 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) pfnRtlGenRandom = (PGENRANDOM)GetProcAddress(hModule, "SystemFunction036");
if (pfnRtlGenRandom)
{
- if (!pfnRtlGenRandom((PVOID)lParam, wParam))
+ if ( !pfnRtlGenRandom((PVOID)lParam, wParam))
pfnRtlGenRandom = NULL;
}
}
@@ -450,7 +450,7 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) {
srand(GetTickCount());
unsigned short* buf = (unsigned short*)lParam;
- for (; (long)(wParam-=2) >= 0; )
+ for (; (long)(wParam-=2) >= 0;)
*(buf++) = (unsigned short)rand();
if (lParam < 0)
*(char*)buf = (char)(rand() & 0xFF);
@@ -578,7 +578,7 @@ int LoadUtilsModule(void) void UnloadUtilsModule(void)
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
FreeWindowList();
UninitTimeZones();
diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index 059d3dd1d7..f1ccff236b 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.cpp @@ -92,7 +92,7 @@ int InitWindowList(void) void FreeWindowList(void)
{
- if ( windowList ) {
+ if (windowList) {
mir_free(windowList);
windowList = NULL;
}
diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index f3b581947c..9575830f63 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -37,7 +37,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt while (hItem) {
hChildItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for ( i=0; i < SIZEOF(iconOn); i++)
+ for (i=0; i < SIZEOF(iconOn); i++)
if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i]=0;
hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
@@ -45,7 +45,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem;
else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for ( i=0; i < SIZEOF(iconOn); i++) {
+ for (i=0; i < SIZEOF(iconOn); i++) {
iImage=SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if (iconOn[i] && iImage == 0) iconOn[i]=0;
if (iImage != 0xFF) childCount[i]++;
@@ -53,7 +53,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for ( i=0; i < SIZEOF(iconOn); i++) {
+ for (i=0; i < SIZEOF(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+1:0):0xFF));
if (groupChildCount) groupChildCount[i]+=childCount[i];
}
@@ -194,7 +194,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP // Nothing was clicked
if (hItem == NULL) break;
// It was not a visbility icon
- if (!(hitFlags & CLCHT_ONITEMEXTRA)) break;
+ if ( !(hitFlags & CLCHT_ONITEMEXTRA)) break;
// Get image in clicked column (0=none, 1=visible, 2=invisible)
iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP break;
}
}
- if (!set) CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0);
+ if ( !set) CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0);
}
} while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
return TRUE;
@@ -286,7 +286,7 @@ static int VisibilityOptInitialise(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Status");
odp.pfnDlgProc = DlgProcVisibilityOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/xml/xmlApi.cpp b/src/modules/xml/xmlApi.cpp index c574da4f6d..dc6387b80a 100644 --- a/src/modules/xml/xmlApi.cpp +++ b/src/modules/xml/xmlApi.cpp @@ -24,252 +24,252 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "xmlParser.h"
-static HXML xmlapiCreateNode( LPCTSTR name, LPCTSTR text, char isDeclaration )
+static HXML xmlapiCreateNode(LPCTSTR name, LPCTSTR text, char isDeclaration)
{
- XMLNode result = XMLNode::createXMLTopNode( name, isDeclaration );
- if ( text )
- result.updateText( text );
+ XMLNode result = XMLNode::createXMLTopNode(name, isDeclaration);
+ if (text)
+ result.updateText(text);
return result.detach();
}
-static void xmlapiDestroyNode( HXML n )
+static void xmlapiDestroyNode(HXML n)
{
XMLNode tmp; tmp.attach(n);
}
-static HXML xmlapiParseString( LPCTSTR str, int* datalen, LPCTSTR tag )
+static HXML xmlapiParseString(LPCTSTR str, int* datalen, LPCTSTR tag)
{
if (str == NULL) return NULL;
XMLResults res;
- XMLNode result = XMLNode::parseString( str, tag, &res );
+ XMLNode result = XMLNode::parseString(str, tag, &res);
- if ( datalen != NULL )
+ if (datalen != NULL)
datalen[0] += res.nChars;
return (res.error == eXMLErrorNone || (tag != NULL && res.error == eXMLErrorMissingEndTag)) ? result.detach() : NULL;
}
-static HXML xmlapiAddChild( HXML _n, LPCTSTR name, LPCTSTR text )
+static HXML xmlapiAddChild(HXML _n, LPCTSTR name, LPCTSTR text)
{
- XMLNode result = XMLNode(_n).addChild( name );
- if ( text != NULL )
- result.updateText( text );
+ XMLNode result = XMLNode(_n).addChild(name);
+ if (text != NULL)
+ result.updateText(text);
return result;
}
-static void xmlapiAddChild2( HXML _child, HXML _parent )
+static void xmlapiAddChild2(HXML _child, HXML _parent)
{
XMLNode child(_child), parent(_parent);
- parent.addChild( child );
+ parent.addChild(child);
}
-static HXML xmlapiCopyNode( HXML _n )
+static HXML xmlapiCopyNode(HXML _n)
{
XMLNode result = XMLNode(_n);
return result.detach();
}
-static LPCTSTR xmlapiGetAttr( HXML _n, int i )
+static LPCTSTR xmlapiGetAttr(HXML _n, int i)
{
- return XMLNode(_n).getAttributeValue( i );
+ return XMLNode(_n).getAttributeValue(i);
}
-static int xmlapiGetAttrCount( HXML _n )
+static int xmlapiGetAttrCount(HXML _n)
{
return XMLNode(_n).nAttribute();
}
-static LPCTSTR xmlapiGetAttrName( HXML _n, int i )
+static LPCTSTR xmlapiGetAttrName(HXML _n, int i)
{
- return XMLNode(_n).getAttributeName( i );
+ return XMLNode(_n).getAttributeName(i);
}
-static HXML xmlapiGetChild( HXML _n, int i )
+static HXML xmlapiGetChild(HXML _n, int i)
{
- return XMLNode(_n).getChildNode( i );
+ return XMLNode(_n).getChildNode(i);
}
-static HXML xmlapiGetChildByAttrValue( HXML _n, LPCTSTR name, LPCTSTR attrName, LPCTSTR attrValue )
+static HXML xmlapiGetChildByAttrValue(HXML _n, LPCTSTR name, LPCTSTR attrName, LPCTSTR attrValue)
{
- return XMLNode(_n).getChildNodeWithAttribute( name, attrName, attrValue );
+ return XMLNode(_n).getChildNodeWithAttribute(name, attrName, attrValue);
}
-static int xmlapiGetChildCount( HXML _n )
+static int xmlapiGetChildCount(HXML _n)
{
return XMLNode(_n).nChildNode();
}
-static HXML xmlapiGetFirstChild( HXML _n )
+static HXML xmlapiGetFirstChild(HXML _n)
{
- return XMLNode(_n).getChildNode( 0 );
+ return XMLNode(_n).getChildNode(0);
}
-static HXML xmlapiGetNthChild( HXML _n, LPCTSTR name, int i )
+static HXML xmlapiGetNthChild(HXML _n, LPCTSTR name, int i)
{
- return XMLNode(_n).getChildNode( name, i );
+ return XMLNode(_n).getChildNode(name, i);
}
-static HXML xmlapiGetNextChild( HXML _n, LPCTSTR name, int* i )
+static HXML xmlapiGetNextChild(HXML _n, LPCTSTR name, int* i)
{
- return XMLNode(_n).getChildNode( name, i );
+ return XMLNode(_n).getChildNode(name, i);
}
-static HXML xmlapiGetNextNode( HXML _n )
+static HXML xmlapiGetNextNode(HXML _n)
{
- return XMLNode(_n).getNextNode( );
+ return XMLNode(_n).getNextNode();
}
-static HXML xmlapiGetChildByPath( HXML _n, LPCTSTR path, char createNodeIfMissing )
+static HXML xmlapiGetChildByPath(HXML _n, LPCTSTR path, char createNodeIfMissing)
{
- return XMLNode(_n).getChildNodeByPath( path, createNodeIfMissing );
+ return XMLNode(_n).getChildNodeByPath(path, createNodeIfMissing);
}
-static LPCTSTR xmlapiGetName( HXML _n )
+static LPCTSTR xmlapiGetName(HXML _n)
{
return XMLNode(_n).getName();
}
-static HXML xmlapiGetParent( HXML _n )
+static HXML xmlapiGetParent(HXML _n)
{
return XMLNode(_n).getParentNode();
}
-static LPCTSTR xmlapiGetText( HXML _n )
+static LPCTSTR xmlapiGetText(HXML _n)
{
return XMLNode(_n).getInnerText();
}
-static LPCTSTR xmlapiGetAttrValue( HXML _n, LPCTSTR attrName )
+static LPCTSTR xmlapiGetAttrValue(HXML _n, LPCTSTR attrName)
{
- return XMLNode(_n).getAttribute( attrName );
+ return XMLNode(_n).getAttribute(attrName);
}
-static void xmlapiSetText( HXML _n, LPCTSTR _text )
+static void xmlapiSetText(HXML _n, LPCTSTR _text)
{
- XMLNode(_n).updateText( _text );
+ XMLNode(_n).updateText(_text);
}
-static LPTSTR xmlapiToString( HXML _n, int* datalen )
+static LPTSTR xmlapiToString(HXML _n, int* datalen)
{
- return XMLNode(_n).createXMLString( 0, datalen );
+ return XMLNode(_n).createXMLString(0, datalen);
}
-static void xmlapiAddAttr( HXML _n, LPCTSTR attrName, LPCTSTR attrValue )
+static void xmlapiAddAttr(HXML _n, LPCTSTR attrName, LPCTSTR attrValue)
{
- if ( attrName != NULL && attrValue != NULL )
- XMLNode(_n).addAttribute( attrName, attrValue );
+ if (attrName != NULL && attrValue != NULL)
+ XMLNode(_n).addAttribute(attrName, attrValue);
}
-static void xmlapiAddAttrInt( HXML _n, LPCTSTR attrName, int attrValue )
+static void xmlapiAddAttrInt(HXML _n, LPCTSTR attrName, int attrValue)
{
TCHAR buf[40];
- _itot( attrValue, buf, 10 );
- XMLNode(_n).addAttribute( attrName, buf );
+ _itot(attrValue, buf, 10);
+ XMLNode(_n).addAttribute(attrName, buf);
}
-static void xmlapiFree( void* p )
+static void xmlapiFree(void* p)
{
- free( p );
+ free(p);
}
// XML API v2 methods
-static int xmlapiGetTextCount( HXML _n )
+static int xmlapiGetTextCount(HXML _n)
{
return XMLNode(_n).nText();
}
-static LPCTSTR xmlapiGetTextByIndex( HXML _n, int i )
+static LPCTSTR xmlapiGetTextByIndex(HXML _n, int i)
{
- return XMLNode(_n).getText( i );
+ return XMLNode(_n).getText(i);
}
-static void xmlapiSetTextByIndex( HXML _n, int i, LPCTSTR value )
+static void xmlapiSetTextByIndex(HXML _n, int i, LPCTSTR value)
{
- XMLNode(_n).updateText( value, i );
+ XMLNode(_n).updateText(value, i);
}
-static void xmlapiAddText( HXML _n, LPCTSTR value, XML_ELEMENT_POS pos )
+static void xmlapiAddText(HXML _n, LPCTSTR value, XML_ELEMENT_POS pos)
{
- XMLNode(_n).addText( value, ( XMLElementPosition )pos );
+ XMLNode(_n).addText(value, (XMLElementPosition)pos);
}
-static LPTSTR xmlapiToStringWithFormatting( HXML _n, int* datalen )
+static LPTSTR xmlapiToStringWithFormatting(HXML _n, int* datalen)
{
- return XMLNode(_n).createXMLString( 1, datalen );
+ return XMLNode(_n).createXMLString(1, datalen);
}
-static int xmlapiGetClearCount( HXML _n )
+static int xmlapiGetClearCount(HXML _n)
{
return XMLNode(_n).nClear();
}
-static LPCTSTR xmlapiGetClear( HXML _n, int i, LPCTSTR *openTag, LPCTSTR *closeTag )
+static LPCTSTR xmlapiGetClear(HXML _n, int i, LPCTSTR *openTag, LPCTSTR *closeTag)
{
- XMLClear c = XMLNode(_n).getClear( i );
- if ( openTag )
+ XMLClear c = XMLNode(_n).getClear(i);
+ if (openTag)
*openTag = c.lpszOpenTag;
- if ( closeTag )
+ if (closeTag)
*closeTag = c.lpszCloseTag;
return c.lpszValue;
}
-static void xmlapiAddClear( HXML _n, LPCTSTR lpszValue, LPCTSTR openTag, LPCTSTR closeTag, XML_ELEMENT_POS pos )
+static void xmlapiAddClear(HXML _n, LPCTSTR lpszValue, LPCTSTR openTag, LPCTSTR closeTag, XML_ELEMENT_POS pos)
{
- XMLNode(_n).addClear( lpszValue, openTag, closeTag, ( XMLElementPosition )pos );
+ XMLNode(_n).addClear(lpszValue, openTag, closeTag, (XMLElementPosition)pos);
}
-static void xmlapiSetClear( HXML _n, int i, LPCTSTR lpszValue )
+static void xmlapiSetClear(HXML _n, int i, LPCTSTR lpszValue)
{
- XMLNode(_n).updateClear( lpszValue, i );
+ XMLNode(_n).updateClear(lpszValue, i);
}
-static int xmlapiGetElement( HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *type, HXML *child, LPCTSTR *value, LPCTSTR *name, LPCTSTR *openTag, LPCTSTR *closeTag )
+static int xmlapiGetElement(HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *type, HXML *child, LPCTSTR *value, LPCTSTR *name, LPCTSTR *openTag, LPCTSTR *closeTag)
{
// reset all values
- if ( child )
+ if (child)
*child = NULL;
- if ( value )
+ if (value)
*value = NULL;
- if ( name )
+ if (name)
*name = NULL;
- if ( openTag )
+ if (openTag)
*openTag = NULL;
- if ( closeTag )
+ if (closeTag)
*closeTag = NULL;
if ( !type || pos >= XMLNode(_n).nElement())
return false;
- XMLNodeContents c( XMLNode(_n).enumContents(( XMLElementPosition )pos ));
- switch ( c.etype ) {
+ XMLNodeContents c(XMLNode(_n).enumContents((XMLElementPosition)pos));
+ switch (c.etype) {
case eNodeChild:
{
*type = XML_ELEM_TYPE_CHILD;
- if ( child )
+ if (child)
*child = c.child;
} break;
case eNodeAttribute:
{
*type = XML_ELEM_TYPE_ATTRIBUTE;
- if ( name )
+ if (name)
*name = c.attrib.lpszName;
- if ( value )
+ if (value)
*value = c.attrib.lpszValue;
} break;
case eNodeText:
{
*type = XML_ELEM_TYPE_TEXT;
- if ( value )
+ if (value)
*value = c.text;
} break;
case eNodeClear:
{
*type = XML_ELEM_TYPE_CLEAR;
- if ( value )
+ if (value)
*value = c.clear.lpszValue;
- if ( openTag )
+ if (openTag)
*openTag = c.clear.lpszOpenTag;
- if ( closeTag )
+ if (closeTag)
*closeTag = c.clear.lpszCloseTag;
} break;
case eNodeNULL:
@@ -280,100 +280,100 @@ static int xmlapiGetElement( HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *typ return true;
}
-static int xmlapiGetElementCount( HXML _n )
+static int xmlapiGetElementCount(HXML _n)
{
return XMLNode(_n).nElement();
}
-static char xmlapiIsDeclaration( HXML _n )
+static char xmlapiIsDeclaration(HXML _n)
{
return XMLNode(_n).isDeclaration();
}
-static HXML xmlapiDeepCopy( HXML _n )
+static HXML xmlapiDeepCopy(HXML _n)
{
return XMLNode(_n).deepCopy().detach();
}
-static HXML xmlapiAddChildEx( HXML _n, LPCTSTR name, char isDeclaration, XML_ELEMENT_POS pos )
+static HXML xmlapiAddChildEx(HXML _n, LPCTSTR name, char isDeclaration, XML_ELEMENT_POS pos)
{
- return XMLNode(_n).addChild( name, isDeclaration, ( XMLElementPosition )pos );
+ return XMLNode(_n).addChild(name, isDeclaration, (XMLElementPosition)pos);
}
-static void xmlapiAddChildEx2( HXML _n, HXML parent, XML_ELEMENT_POS pos )
+static void xmlapiAddChildEx2(HXML _n, HXML parent, XML_ELEMENT_POS pos)
{
- XMLNode(_n).addChild( parent, ( XMLElementPosition )pos );
+ XMLNode(_n).addChild(parent, (XMLElementPosition)pos);
}
-static void xmlapiSetAttrByIndex( HXML _n, int i, LPCTSTR value )
+static void xmlapiSetAttrByIndex(HXML _n, int i, LPCTSTR value)
{
- XMLNode(_n).updateAttribute( value, NULL, i );
+ XMLNode(_n).updateAttribute(value, NULL, i);
}
-static void xmlapiSetAttrByName( HXML _n, LPCTSTR name, LPCTSTR value )
+static void xmlapiSetAttrByName(HXML _n, LPCTSTR name, LPCTSTR value)
{
- XMLNode(_n).updateAttribute( value, NULL, name );
+ XMLNode(_n).updateAttribute(value, NULL, name);
}
-static void xmlapiDeleteNodeContent( HXML _n )
+static void xmlapiDeleteNodeContent(HXML _n)
{
XMLNode(_n).deleteNodeContent();
}
-static void xmlapiDeleteAttrByIndex( HXML _n, int i )
+static void xmlapiDeleteAttrByIndex(HXML _n, int i)
{
- XMLNode(_n).deleteAttribute( i );
+ XMLNode(_n).deleteAttribute(i);
}
-static void xmlapiDeleteAttrByName( HXML _n, LPCTSTR name )
+static void xmlapiDeleteAttrByName(HXML _n, LPCTSTR name)
{
- XMLNode(_n).deleteAttribute( name );
+ XMLNode(_n).deleteAttribute(name);
}
-static void xmlapiDeleteText( HXML _n, int i )
+static void xmlapiDeleteText(HXML _n, int i)
{
- XMLNode(_n).deleteText( i );
+ XMLNode(_n).deleteText(i);
}
-static void xmlapiDeleteClear( HXML _n, int i )
+static void xmlapiDeleteClear(HXML _n, int i)
{
- XMLNode(_n).deleteClear( i );
+ XMLNode(_n).deleteClear(i);
}
-static XML_ELEMENT_POS xmlapiPositionOfText( HXML _n, int i )
+static XML_ELEMENT_POS xmlapiPositionOfText(HXML _n, int i)
{
- return ( XML_ELEMENT_POS )XMLNode(_n).positionOfText( i );
+ return (XML_ELEMENT_POS)XMLNode(_n).positionOfText(i);
}
-static XML_ELEMENT_POS xmlapiPositionOfClear( HXML _n, int i )
+static XML_ELEMENT_POS xmlapiPositionOfClear(HXML _n, int i)
{
- return ( XML_ELEMENT_POS )XMLNode(_n).positionOfClear( i );
+ return (XML_ELEMENT_POS)XMLNode(_n).positionOfClear(i);
}
-static XML_ELEMENT_POS xmlapiPositionOfChildByIndex( HXML _n, int i )
+static XML_ELEMENT_POS xmlapiPositionOfChildByIndex(HXML _n, int i)
{
- return ( XML_ELEMENT_POS )XMLNode(_n).positionOfChildNode( i );
+ return (XML_ELEMENT_POS)XMLNode(_n).positionOfChildNode(i);
}
-static XML_ELEMENT_POS xmlapiPositionOfChildByNode( HXML _n, HXML child )
+static XML_ELEMENT_POS xmlapiPositionOfChildByNode(HXML _n, HXML child)
{
- return ( XML_ELEMENT_POS )XMLNode(_n).positionOfChildNode( child );
+ return (XML_ELEMENT_POS)XMLNode(_n).positionOfChildNode(child);
}
-static XML_ELEMENT_POS xmlapiPositionOfChildByName( HXML _n, LPCTSTR name, int i )
+static XML_ELEMENT_POS xmlapiPositionOfChildByName(HXML _n, LPCTSTR name, int i)
{
- return ( XML_ELEMENT_POS )XMLNode(_n).positionOfChildNode( name, i );
+ return (XML_ELEMENT_POS)XMLNode(_n).positionOfChildNode(name, i);
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR GetXmlApi( WPARAM, LPARAM lParam )
+static INT_PTR GetXmlApi(WPARAM, LPARAM lParam)
{
- XML_API* xi = ( XML_API* )lParam;
- if ( xi == NULL )
+ XML_API* xi = (XML_API*)lParam;
+ if (xi == NULL)
return FALSE;
- if ( xi->cbSize != XML_API_SIZEOF_V1 && xi->cbSize != sizeof(XML_API))
+ if (xi->cbSize != XML_API_SIZEOF_V1 && xi->cbSize != sizeof(XML_API))
return FALSE;
xi->createNode = xmlapiCreateNode;
@@ -406,7 +406,7 @@ static INT_PTR GetXmlApi( WPARAM, LPARAM lParam ) xi->addAttr = xmlapiAddAttr;
xi->addAttrInt = xmlapiAddAttrInt;
- if ( xi->cbSize > XML_API_SIZEOF_V1 ) {
+ if (xi->cbSize > XML_API_SIZEOF_V1) {
xi->isDeclaration = xmlapiIsDeclaration;
xi->toStringWithFormatting = xmlapiToStringWithFormatting;
xi->deepCopy = xmlapiDeepCopy;
@@ -440,7 +440,7 @@ static INT_PTR GetXmlApi( WPARAM, LPARAM lParam ) return TRUE;
}
-void InitXmlApi( void )
+void InitXmlApi(void)
{
- CreateServiceFunction( MS_SYSTEM_GET_XI, GetXmlApi );
+ CreateServiceFunction(MS_SYSTEM_GET_XI, GetXmlApi);
}
diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index c596d99c3f..32c81c88c8 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -65,7 +65,7 @@ void freeXMLString(XMLSTR t) {if(t)free(t);} static XMLNode::XMLCharEncoding characterEncoding=XMLNode::char_encoding_UTF8;
static char guessWideCharChars=1, dropWhiteSpace=1, removeCommentsInMiddleOfText=1;
-inline int mmin( const int t1, const int t2 ) { return t1 < t2 ? t1 : t2; }
+inline int mmin(const int t1, const int t2) { return t1 < t2 ? t1 : t2; }
// You can modify the initialization of the variable "XMLClearTags" below
// to change the clearTags that are currently recognized by the library.
@@ -92,9 +92,9 @@ static ALLXMLClearTag XMLClearTags[] = typedef struct { XMLCSTR s; int l; XMLCHAR c;} XMLCharacterEntity;
static XMLCharacterEntity XMLEntities[] =
{
- { _CXML("&" ), 5, _CXML('&' )},
- { _CXML("<" ), 4, _CXML('<' )},
- { _CXML(">" ), 4, _CXML('>' )},
+ { _CXML("&"), 5, _CXML('&')},
+ { _CXML("<"), 4, _CXML('<')},
+ { _CXML(">"), 4, _CXML('>')},
{ _CXML("""), 6, _CXML('\"')},
{ _CXML("'"), 6, _CXML('\'')},
{ NULL , 0, '\0' }
@@ -177,7 +177,7 @@ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIs if (stats>len/2) return TRUE;
// Check for UNICODE NULL chars
- for (i=0; i<len; i++) if (!s[i]) return TRUE;
+ for (i=0; i<len; i++) if ( !s[i]) return TRUE;
return FALSE;
}
@@ -306,7 +306,7 @@ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) while (l--)
{
left=towlower(*c1++); right=towlower(*c2++);
- if ((!left)||(left != right)) return (int)left-(int)right;
+ if (( !left) || (left != right)) return (int)left-(int)right;
}
return 0;
}
@@ -433,7 +433,7 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) // If "characterEncoding=ShiftJIS" then the characters have different lengths (from 1 byte to 2 bytes).
// This table is used as lookup-table to know the length of a character (in byte) based on the
// content of the first byte of the character.
-// (note: if you modify this, you must always have XML_utf8ByteTable[0]=0 ).
+// (note: if you modify this, you must always have XML_utf8ByteTable[0]=0).
static const char XML_utf8ByteTable[256] =
{
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
@@ -584,32 +584,32 @@ typedef enum XMLStatus XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nFormat) const
{
- if (!d) return eXMLErrorNone;
+ if ( !d) return eXMLErrorNone;
FILE *f=xfopen(filename, _CXML("wb"));
- if (!f) return eXMLErrorCannotOpenWriteFile;
+ if ( !f) return eXMLErrorCannotOpenWriteFile;
#ifdef _XMLWIDECHAR
unsigned char h[2]={ 0xFF, 0xFE };
- if (!fwrite(h, 2, 1, f))
+ if ( !fwrite(h, 2, 1, f))
{
fclose(f);
return eXMLErrorCannotWriteFile;
}
- if ((!isDeclaration())&&((d->lpszName)||(!getChildNode().isDeclaration())))
+ if (( !isDeclaration())&&((d->lpszName) || ( !getChildNode().isDeclaration())))
{
- if (!fwrite(L"<?xml version=\"1.0\" encoding=\"utf-16\"?>\n", sizeof(wchar_t)*40, 1, f))
+ if ( !fwrite(L"<?xml version=\"1.0\" encoding=\"utf-16\"?>\n", sizeof(wchar_t)*40, 1, f))
{
fclose(f);
return eXMLErrorCannotWriteFile;
}
}
#else
- if ((!isDeclaration())&&((d->lpszName)||(!getChildNode().isDeclaration())))
+ if (( !isDeclaration())&&((d->lpszName) || ( !getChildNode().isDeclaration())))
{
if (characterEncoding == char_encoding_UTF8)
{
// header so that windows recognize the file as UTF-8:
unsigned char h[3]={0xEF, 0xBB, 0xBF};
- if (!fwrite(h, 3, 1, f))
+ if ( !fwrite(h, 3, 1, f))
{
fclose(f);
return eXMLErrorCannotWriteFile;
@@ -617,7 +617,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm encoding="utf-8";
} else if (characterEncoding == char_encoding_ShiftJIS) encoding="SHIFT-JIS";
- if (!encoding) encoding="ISO-8859-1";
+ if ( !encoding) encoding="ISO-8859-1";
if (fprintf(f, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding)<0)
{
fclose(f);
@@ -628,7 +628,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm if (characterEncoding == char_encoding_UTF8)
{
unsigned char h[3]={0xEF, 0xBB, 0xBF};
- if (!fwrite(h, 3, 1, f))
+ if ( !fwrite(h, 3, 1, f))
{
fclose(f);
return eXMLErrorCannotWriteFile;
@@ -638,7 +638,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm #endif
int i;
XMLSTR t=createXMLString(nFormat, &i);
- if (!fwrite(t, sizeof(XMLCHAR)*i, 1, f))
+ if ( !fwrite(t, sizeof(XMLCHAR)*i, 1, f))
{
free(t);
fclose(f);
@@ -729,7 +729,7 @@ ToXMLStringTool::~ToXMLStringTool() { freeBuffer(); } void ToXMLStringTool::freeBuffer() { if (buf) free(buf); buf=NULL; buflen=0; }
XMLSTR ToXMLStringTool::toXML(XMLCSTR source)
{
- if (!source)
+ if ( !source)
{
if (buflen<1) { buflen=1; buf=(XMLSTR)malloc(sizeof(XMLCHAR)); }
*buf=0;
@@ -750,7 +750,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) //
// in: string (s) and length (lo) of string
// out: new allocated string converted from xml
- if (!s) return NULL;
+ if ( !s) return NULL;
int ll=0, j;
XMLSTR d;
@@ -763,7 +763,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if ((lo>2)&&(s[1] == _CXML('#')))
{
s+=2; lo-=2;
- if ((*s == _CXML('X'))||(*s == _CXML('x'))) { s++; lo--; }
+ if ((*s == _CXML('X')) || (*s == _CXML('x'))) { s++; lo--; }
while ((*s)&&(*s != _CXML(';'))&&((lo--)>0)) s++;
if (*s != _CXML(';'))
{
@@ -779,7 +779,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if ((lo>=entity->l)&&(xstrnicmp(s, entity->s, entity->l) == 0)) { s+=entity->l; lo-=entity->l; break; }
entity++;
} while (entity->s);
- if (!entity->s)
+ if ( !entity->s)
{
pXML->error=eXMLErrorUnknownCharacterEntity;
return NULL;
@@ -805,7 +805,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if (ss[1] == _CXML('#'))
{
ss+=2; j=0;
- if ((*ss == _CXML('X'))||(*ss == _CXML('x')))
+ if ((*ss == _CXML('X')) || (*ss == _CXML('x')))
{
ss++;
while (*ss != _CXML(';'))
@@ -857,13 +857,13 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) #ifndef _XMLWIDECHAR
if (characterEncoding != XMLNode::char_encoding_legacy)
- Utf8Decode((XMLSTR)s, NULL );
+ Utf8Decode((XMLSTR)s, NULL);
#endif
return (XMLSTR)s;
}
-#define XML_isSPACECHAR(ch) ((ch == _CXML('\n'))||(ch == _CXML(' '))||(ch == _CXML('\t'))||(ch == _CXML('\r')))
+#define XML_isSPACECHAR(ch) ((ch == _CXML('\n')) || (ch == _CXML(' ')) || (ch == _CXML('\t')) || (ch == _CXML('\r')))
// private:
char myTagCompare(XMLCSTR cclose, XMLCSTR copen)
@@ -871,15 +871,15 @@ char myTagCompare(XMLCSTR cclose, XMLCSTR copen) // return 0 if equals
// return 1 if different
{
- if (!cclose) return 1;
+ if ( !cclose) return 1;
int l=(int)xstrlen(cclose);
if (xstrnicmp(cclose, copen, l) != 0) return 1;
const XMLCHAR c=copen[l];
- if (XML_isSPACECHAR(c)||
- (c == _CXML('/' ))||
- (c == _CXML('<' ))||
- (c == _CXML('>' ))||
- (c == _CXML('=' ))) return 0;
+ if (XML_isSPACECHAR(c) ||
+ (c == _CXML('/')) ||
+ (c == _CXML('<')) ||
+ (c == _CXML('>')) ||
+ (c == _CXML('='))) return 0;
return 1;
}
@@ -965,7 +965,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT ALLXMLClearTag *ctag=XMLClearTags;
do
{
- if (!xstrncmp(ctag->lpszOpen, result.pStr, ctag->openTagLen))
+ if ( !xstrncmp(ctag->lpszOpen, result.pStr, ctag->openTagLen))
{
result.pClr=ctag;
pXML->nIndex+=ctag->openTagLen-1;
@@ -1046,7 +1046,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT // If we found a short hand end tag then we need to exit the loop
if (ch == _CXML('>')) { pXML->nIndex--; break; }
- } else if ((ch == _CXML('<'))||(ch == _CXML('>'))||(ch == _CXML('=')))
+ } else if ((ch == _CXML('<')) || (ch == _CXML('>')) || (ch == _CXML('=')))
{
pXML->nIndex--; break;
}
@@ -1066,7 +1066,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT XMLCSTR XMLNode::updateName_WOSD(XMLSTR lpszName)
{
- if (!d) { free(lpszName); return NULL; }
+ if ( !d) { free(lpszName); return NULL; }
if (d->lpszName&&(lpszName != d->lpszName)) free((void*)d->lpszName);
d->lpszName=lpszName;
return lpszName;
@@ -1099,9 +1099,9 @@ XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration) updateName_WOSD(lpszName);
d->lpszNS = NULL;
- if ( lpszName && pParent && pParent->lpszName && !pParent->isDeclaration) {
- TCHAR* p = _tcschr( lpszName, ':' );
- if ( p ) {
+ if (lpszName && pParent && pParent->lpszName && !pParent->isDeclaration) {
+ TCHAR* p = _tcschr(lpszName, ':');
+ if (p) {
*p = 0;
d->lpszNS = d->lpszName;
d->lpszName = p+1;
@@ -1118,8 +1118,8 @@ static inline void myFree(void *p) { if (p) free(p); } static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem)
{
if (p == NULL) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); }
- if ((memInc == 0)||((newsize%memInc) == 0)) p=realloc(p, (newsize+memInc)*sizeofElem);
- // if (!p)
+ if ((memInc == 0) || ((newsize%memInc) == 0)) p=realloc(p, (newsize+memInc)*sizeofElem);
+ // if ( !p)
// {
// printf("XMLParser Error: Not enough memory! Aborting...\n"); exit(220);
// }
@@ -1157,7 +1157,7 @@ void *XMLNode::addToOrder(int memoryIncrease, int *_pos, int nc, void *p, int si d->pOrder=(int*)myRealloc(d->pOrder, n+1, memoryIncrease*3, sizeof(int));
int pos=*_pos, *o=d->pOrder;
- if ((pos<0)||(pos>=n)) { *_pos=nc; o[n]=(int)((nc<<2)+xtype); return p; }
+ if ((pos<0) || (pos>=n)) { *_pos=nc; o[n]=(int)((nc<<2)+xtype); return p; }
int i=pos;
memmove(o+i+1, o+i, (n-i)*sizeof(int));
@@ -1177,7 +1177,7 @@ void *XMLNode::addToOrder(int memoryIncrease, int *_pos, int nc, void *p, int si // Add a child node to the given element.
XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDeclaration, int pos)
{
- if (!lpszName) return emptyXMLNode;
+ if ( !lpszName) return emptyXMLNode;
d->pChild=(XMLNode*)addToOrder(memoryIncrease, &pos, d->nChild, d->pChild, sizeof(XMLNode), eNodeChild);
d->pChild[pos].d=NULL;
d->pChild[pos]=XMLNode(d, lpszName, isDeclaration);
@@ -1188,8 +1188,8 @@ XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDecla // Add an attribute to an element.
XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XMLSTR lpszValuev)
{
- if (!lpszName) return &emptyXMLAttribute;
- if (!d) { myFree(lpszName); myFree(lpszValuev); return &emptyXMLAttribute; }
+ if ( !lpszName) return &emptyXMLAttribute;
+ if ( !d) { myFree(lpszName); myFree(lpszValuev); return &emptyXMLAttribute; }
int nc=d->nAttribute;
d->pAttribute=(XMLAttribute*)myRealloc(d->pAttribute, (nc+1), memoryIncrease, sizeof(XMLAttribute));
XMLAttribute *pAttr=d->pAttribute+nc;
@@ -1197,9 +1197,9 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM pAttr->lpszValue = lpszValuev;
d->nAttribute++;
- TCHAR* p = _tcschr( lpszName, ':' );
- if ( p )
- if ( !lstrcmp( p+1, d->lpszNS ) || ( d->pParent && !lstrcmp( p+1, d->pParent->lpszNS )))
+ TCHAR* p = _tcschr(lpszName, ':');
+ if (p)
+ if ( !lstrcmp(p+1, d->lpszNS) || (d->pParent && !lstrcmp(p+1, d->pParent->lpszNS)))
*p = 0;
return pAttr;
@@ -1208,8 +1208,8 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM // Add text to the element.
XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos)
{
- if (!lpszValue) return NULL;
- if (!d) { myFree(lpszValue); return NULL; }
+ if ( !lpszValue) return NULL;
+ if ( !d) { myFree(lpszValue); return NULL; }
invalidateInnerText();
d->pText=(XMLCSTR*)addToOrder(memoryIncrease, &pos, d->nText, d->pText, sizeof(XMLSTR), eNodeText);
d->pText[pos]=lpszValue;
@@ -1220,14 +1220,14 @@ XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos) // Add clear (unformatted) text to the element.
XMLClear *XMLNode::addClear_priv(int memoryIncrease, XMLSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, int pos)
{
- if (!lpszValue) return &emptyXMLClear;
- if (!d) { myFree(lpszValue); return &emptyXMLClear; }
+ if ( !lpszValue) return &emptyXMLClear;
+ if ( !d) { myFree(lpszValue); return &emptyXMLClear; }
invalidateInnerText();
d->pClear=(XMLClear *)addToOrder(memoryIncrease, &pos, d->nClear, d->pClear, sizeof(XMLClear), eNodeClear);
XMLClear *pNewClear=d->pClear+pos;
pNewClear->lpszValue = lpszValue;
- if (!lpszOpen) lpszOpen=XMLClearTags->lpszOpen;
- if (!lpszClose) lpszClose=XMLClearTags->lpszClose;
+ if ( !lpszOpen) lpszOpen=XMLClearTags->lpszOpen;
+ if ( !lpszClose) lpszClose=XMLClearTags->lpszClose;
pNewClear->lpszOpenTag = lpszOpen;
pNewClear->lpszCloseTag = lpszClose;
d->nClear++;
@@ -1292,14 +1292,14 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) {
XML *pXML=(XML *)pa;
XMLCSTR lpszText=pXML->lpszText;
- if (!lpszText) return 0;
+ if ( !lpszText) return 0;
if (dropWhiteSpace) while (XML_isSPACECHAR(*lpszText)&&(lpszText != tokenPStr)) lpszText++;
int cbText = (int)(tokenPStr - lpszText);
- if (!cbText) { pXML->lpszText=NULL; return 0; }
+ if ( !cbText) { pXML->lpszText=NULL; return 0; }
if (dropWhiteSpace) { cbText--; while ((cbText)&&XML_isSPACECHAR(lpszText[cbText])) cbText--; cbText++; }
- if (!cbText) { pXML->lpszText=NULL; return 0; }
+ if ( !cbText) { pXML->lpszText=NULL; return 0; }
XMLSTR lpt=fromXMLString(lpszText, cbText, pXML);
- if (!lpt) return 1;
+ if ( !lpt) return 1;
pXML->lpszText=NULL;
if (removeCommentsInMiddleOfText && d->nText && d->nClear)
{
@@ -1316,7 +1316,7 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) n=xstrlen(d->pText[i]);
int n2=xstrlen(lpt)+1;
d->pText[i]=(XMLSTR)realloc((void*)d->pText[i], (n+n2)*sizeof(XMLCHAR));
- if (!d->pText[i]) return 1;
+ if ( !d->pText[i]) return 1;
memcpy((void*)(d->pText[i]+n), lpt, n2*sizeof(XMLCHAR));
free(lpt);
return 0;
@@ -1422,13 +1422,13 @@ int XMLNode::ParseXMLElement(void *pa) // the current one and recurse
pNew = addChild_priv(MEMORYINCREASE, stringDup(token.pStr, cbToken), nDeclaration, -1);
- while (!pNew.isEmpty())
+ while ( !pNew.isEmpty())
{
// Callself to process the new node. If we return
// FALSE this means we dont have any more
// processing to do...
- if (!pNew.ParseXMLElement(pXML)) return FALSE;
+ if ( !pNew.ParseXMLElement(pXML)) return FALSE;
else
{
// If the call to recurse this function
@@ -1441,7 +1441,7 @@ int XMLNode::ParseXMLElement(void *pa) {
// If we are back at the root node then we
// have an unmatched end tag
- if (!d->lpszName)
+ if ( !d->lpszName)
{
pXML->error=eXMLErrorUnmatchedEndTag;
return FALSE;
@@ -1517,7 +1517,7 @@ int XMLNode::ParseXMLElement(void *pa) // We need to return to the previous caller. If the name
// of the tag cannot be found we need to keep returning to
// caller until we find a match
- if (!d->lpszNS) {
+ if ( !d->lpszNS) {
if (myTagCompare(d->lpszName, lpszTemp) != 0)
#ifdef STRICT_PARSING
{
@@ -1537,8 +1537,8 @@ LBL_Error: #endif
}
else {
- const TCHAR* p = _tcschr( lpszTemp, ':' );
- if ( !p )
+ const TCHAR* p = _tcschr(lpszTemp, ':');
+ if ( !p)
goto LBL_Error;
if (myTagCompare(d->lpszName, p+1) != 0)
@@ -1707,7 +1707,7 @@ LBL_Error: if (attrVal)
{
attrVal=fromXMLString(attrVal, cbToken, pXML);
- if (!attrVal) return FALSE;
+ if ( !attrVal) return FALSE;
}
addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), attrVal);
}
@@ -1735,7 +1735,7 @@ LBL_Error: // If we failed to obtain the next token
else
{
- if ((!d->isDeclaration)&&(d->pParent))
+ if (( !d->isDeclaration)&&(d->pParent))
{
#ifdef STRICT_PARSING
pXML->error=eXMLErrorUnmatchedEndTag;
@@ -1776,7 +1776,7 @@ static void CountLinesAndColumns(XMLCSTR lpXML, int nUpto, XMLResults *pResults) // Parse XML and return the root element.
XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults)
{
- if (!lpszXML)
+ if ( !lpszXML)
{
if (pResults)
{
@@ -1793,14 +1793,14 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) // Create header element
xnode.ParseXMLElement(&xml);
enum XMLError error = xml.error;
- if (!xnode.nChildNode()) error=eXMLErrorNoXMLTagFound;
+ if ( !xnode.nChildNode()) error=eXMLErrorNoXMLTagFound;
if ((xnode.nChildNode() == 1)&&(xnode.nElement() == 1)) xnode=xnode.getChildNode(); // skip the empty node
// If no error occurred
- if ((error == eXMLErrorNone)||(error == eXMLErrorMissingEndTag)||(error == eXMLErrorNoXMLTagFound))
+ if ((error == eXMLErrorNone) || (error == eXMLErrorMissingEndTag) || (error == eXMLErrorNoXMLTagFound))
{
XMLCSTR name=xnode.getName();
- if (tag&&(*tag)&&((!name)||(xstricmp(name, tag))))
+ if (tag&&(*tag)&&(( !name) || (xstricmp(name, tag))))
{
xnode=xnode.getChildNode(tag);
if (xnode.isEmpty())
@@ -1847,7 +1847,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) if (f == NULL) { if (pResults) pResults->error=eXMLErrorFileNotFound; return emptyXMLNode; }
fseek(f, 0, SEEK_END);
int l=(int)ftell(f), headerSz=0;
- if (!l) { if (pResults) pResults->error=eXMLErrorEmpty; fclose(f); return emptyXMLNode; }
+ if ( !l) { if (pResults) pResults->error=eXMLErrorEmpty; fclose(f); return emptyXMLNode; }
fseek(f, 0, SEEK_SET);
unsigned char *buf=(unsigned char*)malloc(l+4);
l=(int)fread(buf, 1, l, f);
@@ -1856,12 +1856,12 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) #ifdef _XMLWIDECHAR
if (guessWideCharChars)
{
- if (!myIsTextWideChar(buf, l))
+ if ( !myIsTextWideChar(buf, l))
{
XMLNode::XMLCharEncoding ce=XMLNode::char_encoding_legacy;
if ((buf[0] == 0xef)&&(buf[1] == 0xbb)&&(buf[2] == 0xbf)) { headerSz=3; ce=XMLNode::char_encoding_UTF8; }
XMLSTR b2=myMultiByteToWideChar((const char*)(buf+headerSz), ce);
- if (!b2)
+ if ( !b2)
{
// todo: unable to convert
}
@@ -1898,7 +1898,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) }
#endif
- if (!buf) { if (pResults) pResults->error=eXMLErrorCharConversionError; return emptyXMLNode; }
+ if ( !buf) { if (pResults) pResults->error=eXMLErrorCharConversionError; return emptyXMLNode; }
XMLNode x=parseString((XMLSTR)(buf+headerSz), tag, pResults);
free(buf);
return x;
@@ -1919,7 +1919,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma int nChildFormat=-1;
int nElementI=pEntry->nChild+pEntry->nText+pEntry->nClear;
int i, j;
- if ((nFormat>=0)&&(nElementI == 1)&&(pEntry->nText == 1)&&(!pEntry->isDeclaration)) nFormat=-2;
+ if ((nFormat>=0)&&(nElementI == 1)&&(pEntry->nText == 1)&&( !pEntry->isDeclaration)) nFormat=-2;
assert(pEntry);
@@ -2006,7 +2006,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma // determine the number of spaces used for prefixes.
if (nFormat != -1)
{
- if (cbElement&&(!pEntry->isDeclaration)) nChildFormat=nFormat+1;
+ if (cbElement&&( !pEntry->isDeclaration)) nChildFormat=nFormat+1;
else nChildFormat=nFormat;
}
@@ -2101,7 +2101,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma }
}
- if ((cbElement)&&(!pEntry->isDeclaration))
+ if ((cbElement)&&( !pEntry->isDeclaration))
{
// If we have child entries we need to use long XML notation for
// closing the element - "<elementname>blah blah blah</elementname>"
@@ -2164,13 +2164,13 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma // this with free().
XMLSTR XMLNode::createXMLString(int nFormat, int *pnSize) const
{
- if (!d) { if (pnSize) *pnSize=0; return NULL; }
+ if ( !d) { if (pnSize) *pnSize=0; return NULL; }
XMLSTR lpszResult = NULL;
int cbStr;
// Recursively Calculate the size of the XML string
- if (!dropWhiteSpace) nFormat=0;
+ if ( !dropWhiteSpace) nFormat=0;
nFormat = nFormat ? 0 : -1;
cbStr = CreateXMLStringR(d, 0, nFormat);
// Alllocate memory for the XML string + the NULL terminator and
@@ -2195,20 +2195,20 @@ int XMLNode::detachFromParent(XMLNodeData *d) XMLNode::~XMLNode()
{
- if (!d) return;
+ if ( !d) return;
d->ref_count--;
emptyTheNode(0);
}
void XMLNode::deleteNodeContent()
{
- if (!d) return;
+ if ( !d) return;
if (d->pParent) { detachFromParent(d); d->pParent=NULL; d->ref_count--; }
emptyTheNode(1);
}
void XMLNode::emptyTheNode(char force)
{
XMLNodeData *dd=d; // warning: must stay this way!
- if ((dd->ref_count == 0)||force)
+ if ((dd->ref_count == 0) || force)
{
if (d->pParent) detachFromParent(d);
int i;
@@ -2249,12 +2249,12 @@ void XMLNode::emptyTheNode(char force) }
void XMLNode::invalidateInnerText()
{
- if (!d) return;
+ if ( !d) return;
myFree(d->pInnerText);
d->pInnerText= NULL;
}
-XMLNode& XMLNode::operator=( const XMLNode& A )
+XMLNode& XMLNode::operator=(const XMLNode& A)
{
// shallow copy
if (this != &A)
@@ -2275,7 +2275,7 @@ XMLNode::XMLNode(const XMLNode &A) XMLNode XMLNode::deepCopy() const
{
- if (!d) return XMLNode::emptyXMLNode;
+ if ( !d) return XMLNode::emptyXMLNode;
XMLNode x(NULL, stringDup(d->lpszName), d->isDeclaration);
XMLNodeData *p=x.d;
int n=d->nAttribute;
@@ -2326,8 +2326,8 @@ XMLNode XMLNode::deepCopy() const XMLNode XMLNode::addChild(XMLNode childNode, int pos)
{
XMLNodeData *dc=childNode.d;
- if ((!dc)||(!d)) return childNode;
- if (!dc->lpszName)
+ if (( !dc) || ( !d)) return childNode;
+ if ( !dc->lpszName)
{
// this is a root node: todo: correct fix
int j=pos;
@@ -2350,7 +2350,7 @@ XMLNode XMLNode::addChild(XMLNode childNode, int pos) void XMLNode::deleteAttribute(int i)
{
- if ((!d)||(i<0)||(i>=d->nAttribute)) return;
+ if (( !d) || (i<0) || (i>=d->nAttribute)) return;
d->nAttribute--;
XMLAttribute *p=d->pAttribute+i;
free((void*)p->lpszName);
@@ -2368,7 +2368,7 @@ void XMLNode::deleteAttribute(XMLCSTR lpszName) XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, int i)
{
- if (!d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; }
+ if ( !d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; }
if (i>=d->nAttribute)
{
if (lpszNewName) return addAttribute_WOSD(lpszNewName, lpszNewValue);
@@ -2401,9 +2401,9 @@ XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewN int XMLNode::indexText(XMLCSTR lpszValue) const
{
- if (!d) return -1;
+ if ( !d) return -1;
int i, l=d->nText;
- if (!lpszValue) { if (l) return 0; return -1; }
+ if ( !lpszValue) { if (l) return 0; return -1; }
XMLCSTR *p=d->pText;
for (i=0; i<l; i++) if (lpszValue == p[i]) return i;
return -1;
@@ -2411,7 +2411,7 @@ int XMLNode::indexText(XMLCSTR lpszValue) const void XMLNode::deleteText(int i)
{
- if ((!d)||(i<0)||(i>=d->nText)) return;
+ if (( !d) || (i<0) || (i>=d->nText)) return;
invalidateInnerText();
d->nText--;
XMLCSTR *p=d->pText+i;
@@ -2424,7 +2424,7 @@ void XMLNode::deleteText(XMLCSTR lpszValue) { deleteText(indexText(lpszValue)); XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i)
{
- if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; }
+ if ( !d) { if (lpszNewValue) free(lpszNewValue); return NULL; }
if (i>=d->nText) return addText_WOSD(lpszNewValue);
invalidateInnerText();
XMLCSTR *p=d->pText+i;
@@ -2434,7 +2434,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i) XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue)
{
- if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; }
+ if ( !d) { if (lpszNewValue) free(lpszNewValue); return NULL; }
int i=indexText(lpszOldValue);
if (i>=0) return updateText_WOSD(lpszNewValue, i);
return addText_WOSD(lpszNewValue);
@@ -2442,7 +2442,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue) void XMLNode::deleteClear(int i)
{
- if ((!d)||(i<0)||(i>=d->nClear)) return;
+ if (( !d) || (i<0) || (i>=d->nClear)) return;
invalidateInnerText();
d->nClear--;
XMLClear *p=d->pClear+i;
@@ -2453,9 +2453,9 @@ void XMLNode::deleteClear(int i) int XMLNode::indexClear(XMLCSTR lpszValue) const
{
- if (!d) return -1;
+ if ( !d) return -1;
int i, l=d->nClear;
- if (!lpszValue) { if (l) return 0; return -1; }
+ if ( !lpszValue) { if (l) return 0; return -1; }
XMLClear *p=d->pClear;
for (i=0; i<l; i++) if (lpszValue == p[i].lpszValue) return i;
return -1;
@@ -2466,7 +2466,7 @@ void XMLNode::deleteClear(XMLClear *a) { if (a) deleteClear(a->lpszValue); } XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i)
{
- if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; }
+ if ( !d) { if (lpszNewContent) free(lpszNewContent); return NULL; }
if (i>=d->nClear) return addClear_WOSD(lpszNewContent);
invalidateInnerText();
XMLClear *p=d->pClear+i;
@@ -2476,7 +2476,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i) XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, XMLCSTR lpszOldValue)
{
- if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; }
+ if ( !d) { if (lpszNewContent) free(lpszNewContent); return NULL; }
int i=indexClear(lpszOldValue);
if (i>=0) return updateClear_WOSD(lpszNewContent, i);
return addClear_WOSD(lpszNewContent);
@@ -2490,7 +2490,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLClear *newP, XMLClear *oldP) int XMLNode::nChildNode(XMLCSTR name) const
{
- if (!d) return 0;
+ if ( !d) return 0;
int i, j=0, n=d->nChild;
XMLNode *pc=d->pChild;
for (i=0; i<n; i++)
@@ -2503,13 +2503,13 @@ int XMLNode::nChildNode(XMLCSTR name) const XMLNode XMLNode::getChildNode(XMLCSTR name, int *j) const
{
- if (!d) return emptyXMLNode;
+ if ( !d) return emptyXMLNode;
int i=0, n=d->nChild;
if (j) i=*j;
XMLNode *pc=d->pChild+i;
for (; i<n; i++)
{
- if (!xstricmp(pc->d->lpszName, name))
+ if ( !xstricmp(pc->d->lpszName, name))
{
if (j) *j=i+1;
return *pc;
@@ -2521,7 +2521,7 @@ XMLNode XMLNode::getChildNode(XMLCSTR name, int *j) const XMLNode XMLNode::getChildNode(XMLCSTR name, int j) const
{
- if (!d) return emptyXMLNode;
+ if ( !d) return emptyXMLNode;
if (j>=0)
{
int i=0;
@@ -2529,16 +2529,16 @@ XMLNode XMLNode::getChildNode(XMLCSTR name, int j) const return getChildNode(name, &i);
}
int i=d->nChild;
- while (i--) if (!xstricmp(name, d->pChild[i].d->lpszName)) break;
+ while (i--) if ( !xstricmp(name, d->pChild[i].d->lpszName)) break;
if (i<0) return emptyXMLNode;
return getChildNode(i);
}
XMLNode XMLNode::getNextNode() const
{
- if (!d) return emptyXMLNode;
+ if ( !d) return emptyXMLNode;
XMLNodeDataTag *par=d->pParent;
- if (!par) return emptyXMLNode;
+ if ( !par) return emptyXMLNode;
int i, n=par->nChild;
for (i=0; i<n; ++i)
{
@@ -2557,7 +2557,7 @@ XMLNode XMLNode::getChildNodeByPath(XMLCSTR _path, char createMissing, XMLCHAR s XMLNode XMLNode::getChildNodeByPathNonConst(XMLSTR path, char createIfMissing, XMLCHAR sep)
{
- if ((!path)||(!(*path))) return *this;
+ if (( !path) || ( !(*path))) return *this;
XMLNode xn, xbase=*this;
XMLCHAR *tend1, sepString[2]; sepString[0]=sep; sepString[1]=0;
tend1=xstrstr(path, sepString);
@@ -2580,7 +2580,7 @@ XMLNode XMLNode::getChildNodeByPathNonConst(XMLSTR path, char createIfMissing, X return xn;
}
-XMLElementPosition XMLNode::positionOfText (int i) const { if (i>=d->nText ) i=d->nText-1; return findPosition(d, i, eNodeText ); }
+XMLElementPosition XMLNode::positionOfText (int i) const { if (i>=d->nText) i=d->nText-1; return findPosition(d, i, eNodeText); }
XMLElementPosition XMLNode::positionOfClear (int i) const { if (i>=d->nClear) i=d->nClear-1; return findPosition(d, i, eNodeClear); }
XMLElementPosition XMLNode::positionOfChildNode(int i) const { if (i>=d->nChild) i=d->nChild-1; return findPosition(d, i, eNodeChild); }
XMLElementPosition XMLNode::positionOfText (XMLCSTR lpszValue) const { return positionOfText (indexText (lpszValue)); }
@@ -2588,7 +2588,7 @@ XMLElementPosition XMLNode::positionOfClear(XMLCSTR lpszValue) const { return po XMLElementPosition XMLNode::positionOfClear(XMLClear *a) const { if (a) return positionOfClear(a->lpszValue); return positionOfClear(); }
XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const
{
- if ((!d)||(!x.d)) return -1;
+ if (( !d) || ( !x.d)) return -1;
XMLNodeData *dd=x.d;
XMLNode *pc=d->pChild;
int i=d->nChild;
@@ -2597,7 +2597,7 @@ XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const }
XMLElementPosition XMLNode::positionOfChildNode(XMLCSTR name, int count) const
{
- if (!name) return positionOfChildNode(count);
+ if ( !name) return positionOfChildNode(count);
int j=0;
do { getChildNode(name, &j); if (j<0) return -1; } while (count--);
return findPosition(d, j-1, eNodeChild);
@@ -2612,7 +2612,7 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name, XMLCSTR attributeName, do
{
x=getChildNode(name, &i);
- if (!x.isEmpty())
+ if ( !x.isEmpty())
{
if (attributeValue)
{
@@ -2627,14 +2627,14 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name, XMLCSTR attributeName, if (x.isAttributeSet(attributeName)) { if (k) *k=i; return x; }
}
}
- } while (!x.isEmpty());
+ } while ( !x.isEmpty());
return emptyXMLNode;
}
// Find an attribute on an node.
XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const
{
- if (!d) return NULL;
+ if ( !d) return NULL;
int i=0, n=d->nAttribute;
if (j) i=*j;
XMLAttribute *pAttr=d->pAttribute+i;
@@ -2652,7 +2652,7 @@ XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const
{
- if (!d) return FALSE;
+ if ( !d) return FALSE;
int i, n=d->nAttribute;
XMLAttribute *pAttr=d->pAttribute;
for (i=0; i<n; i++)
@@ -2668,7 +2668,7 @@ char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const XMLCSTR XMLNode::getAttribute(XMLCSTR name, int j) const
{
- if (!d) return NULL;
+ if ( !d) return NULL;
int i=0;
while (j-->0) getAttribute(name, &i);
return getAttribute(name, &i);
@@ -2677,7 +2677,7 @@ XMLCSTR XMLNode::getAttribute(XMLCSTR name, int j) const XMLNodeContents XMLNode::enumContents(int i) const
{
XMLNodeContents c;
- if (!d) { c.etype=eNodeNULL; return c; }
+ if ( !d) { c.etype=eNodeNULL; return c; }
if (i<d->nAttribute)
{
c.etype=eNodeAttribute;
@@ -2699,7 +2699,7 @@ XMLNodeContents XMLNode::enumContents(int i) const XMLCSTR XMLNode::getInnerText() const
{
- if (!d) return NULL;
+ if ( !d) return NULL;
if (nText() <= 1 && nClear() == 0) return getText();
if (d->pInnerText) return d->pInnerText;
@@ -2738,22 +2738,22 @@ XMLCSTR XMLNode::getInnerText() const return d->pInnerText = buf;
}
-XMLCSTR XMLNode::getName() const { if (!d) return NULL; return d->lpszName; }
-int XMLNode::nText() const { if (!d) return 0; return d->nText; }
-int XMLNode::nChildNode() const { if (!d) return 0; return d->nChild; }
-int XMLNode::nAttribute() const { if (!d) return 0; return d->nAttribute; }
-int XMLNode::nClear() const { if (!d) return 0; return d->nClear; }
-int XMLNode::nElement() const { if (!d) return 0; return d->nAttribute+d->nChild+d->nText+d->nClear; }
-XMLClear XMLNode::getClear (int i) const { if ((!d)||(i>=d->nClear )) return emptyXMLClear; return d->pClear[i]; }
-XMLAttribute XMLNode::getAttribute (int i) const { if ((!d)||(i>=d->nAttribute)) return emptyXMLAttribute; return d->pAttribute[i]; }
-XMLCSTR XMLNode::getAttributeName (int i) const { if ((!d)||(i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszName; }
-XMLCSTR XMLNode::getAttributeValue(int i) const { if ((!d)||(i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszValue; }
-XMLCSTR XMLNode::getText (int i) const { if ((!d)||(i>=d->nText )) return NULL; return d->pText[i]; }
-XMLNode XMLNode::getChildNode (int i) const { if ((!d)||(i>=d->nChild )) return emptyXMLNode; return d->pChild[i]; }
-XMLNode XMLNode::getParentNode ( ) const { if ((!d)||(!d->pParent )) return emptyXMLNode; return XMLNode(d->pParent); }
-char XMLNode::isDeclaration ( ) const { if (!d) return 0; return d->isDeclaration; }
-char XMLNode::isEmpty ( ) const { return (d == NULL); }
-XMLNode XMLNode::emptyNode ( ) { return XMLNode::emptyXMLNode; }
+XMLCSTR XMLNode::getName() const { if ( !d) return NULL; return d->lpszName; }
+int XMLNode::nText() const { if ( !d) return 0; return d->nText; }
+int XMLNode::nChildNode() const { if ( !d) return 0; return d->nChild; }
+int XMLNode::nAttribute() const { if ( !d) return 0; return d->nAttribute; }
+int XMLNode::nClear() const { if ( !d) return 0; return d->nClear; }
+int XMLNode::nElement() const { if ( !d) return 0; return d->nAttribute+d->nChild+d->nText+d->nClear; }
+XMLClear XMLNode::getClear (int i) const { if (( !d) || (i>=d->nClear)) return emptyXMLClear; return d->pClear[i]; }
+XMLAttribute XMLNode::getAttribute (int i) const { if (( !d) || (i>=d->nAttribute)) return emptyXMLAttribute; return d->pAttribute[i]; }
+XMLCSTR XMLNode::getAttributeName (int i) const { if (( !d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszName; }
+XMLCSTR XMLNode::getAttributeValue(int i) const { if (( !d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszValue; }
+XMLCSTR XMLNode::getText (int i) const { if (( !d) || (i>=d->nText)) return NULL; return d->pText[i]; }
+XMLNode XMLNode::getChildNode (int i) const { if (( !d) || (i>=d->nChild)) return emptyXMLNode; return d->pChild[i]; }
+XMLNode XMLNode::getParentNode () const { if (( !d) || ( !d->pParent)) return emptyXMLNode; return XMLNode(d->pParent); }
+char XMLNode::isDeclaration () const { if ( !d) return 0; return d->isDeclaration; }
+char XMLNode::isEmpty () const { return (d == NULL); }
+XMLNode XMLNode::emptyNode () { return XMLNode::emptyXMLNode; }
XMLNode XMLNode::addChild(XMLCSTR lpszName, char isDeclaration, XMLElementPosition pos)
{ return addChild_priv(0, stringDup(lpszName), isDeclaration, pos); }
@@ -2833,7 +2833,7 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf, int l, char useXM case 1: i++; break;
case 0: i=l;
}
- if (!useXMLEncodingAttribute) return bestGuess;
+ if ( !useXMLEncodingAttribute) return bestGuess;
// if encoding is specified and different from utf-8 than it's non-utf8
// otherwise it's utf-8
char bb[201];
@@ -2841,20 +2841,20 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf, int l, char useXM memcpy(bb, buf, l); // copy buf into bb to be able to do "bb[l]=0"
bb[l]=0;
b=(unsigned char*)strstr(bb, "encoding");
- if (!b) return bestGuess;
+ if ( !b) return bestGuess;
b+=8; while XML_isSPACECHAR(*b) b++; if (*b != '=') return bestGuess;
b++; while XML_isSPACECHAR(*b) b++; if ((*b != '\'')&&(*b != '"')) return bestGuess;
b++; while XML_isSPACECHAR(*b) b++;
- if ((xstrnicmp((char*)b, "utf-8", 5) == 0)||
+ if ((xstrnicmp((char*)b, "utf-8", 5) == 0) ||
(xstrnicmp((char*)b, "utf8", 4) == 0))
{
if (bestGuess == char_encoding_legacy) return char_encoding_error;
return char_encoding_UTF8;
}
- if ((xstrnicmp((char*)b, "shiftjis", 8) == 0)||
- (xstrnicmp((char*)b, "shift-jis", 9) == 0)||
+ if ((xstrnicmp((char*)b, "shiftjis", 8) == 0) ||
+ (xstrnicmp((char*)b, "shift-jis", 9) == 0) ||
(xstrnicmp((char*)b, "sjis", 4) == 0)) return char_encoding_ShiftJIS;
if (xstrnicmp((char*)b, "GB2312", 6) == 0) return char_encoding_GB2312;
@@ -2913,8 +2913,8 @@ XMLSTR XMLParserBase64Tool::encode(unsigned char *inbuf, unsigned int inlen, cha *(curr++)=base64EncodeTable[ j>>18 ];
*(curr++)=base64EncodeTable[(j>>12)&0x3f];
*(curr++)=base64EncodeTable[(j>> 6)&0x3f];
- *(curr++)=base64EncodeTable[(j )&0x3f];
- if (formatted) { if (!k) { *(curr++)=_CXML('\n'); k=18; } k--; }
+ *(curr++)=base64EncodeTable[(j)&0x3f];
+ if (formatted) { if ( !k) { *(curr++)=_CXML('\n'); k=18; } k--; }
}
eLen=inlen-eLen*3; // 0 - 2.
if (eLen == 1)
@@ -2937,7 +2937,7 @@ XMLSTR XMLParserBase64Tool::encode(unsigned char *inbuf, unsigned int inlen, cha unsigned int XMLParserBase64Tool::decodeSize(XMLCSTR data, XMLError *xe)
{
- if (!data) return 0;
+ if ( !data) return 0;
if (xe) *xe=eXMLErrorNone;
int size=0;
unsigned char c;
@@ -2960,7 +2960,7 @@ unsigned int XMLParserBase64Tool::decodeSize(XMLCSTR data, XMLError *xe) unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int len, XMLError *xe)
{
- if (!data) return 0;
+ if ( !data) return 0;
if (xe) *xe=eXMLErrorNone;
int i=0, p=0;
unsigned char d, c;
@@ -2990,7 +2990,7 @@ unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int }
BASE64DECODE_READ_NEXT_CHAR(d)
- if ((d == 99)||(d == 96)) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if ((d == 99) || (d == 96)) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
if (p == (int)len) { if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall; return 0; }
buf[p++]=(unsigned char)((c<<2)|((d>>4)&0x3));
@@ -3006,7 +3006,7 @@ unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int buf[p++]=(unsigned char)(((d<<4)&0xf0)|((c>>2)&0xf));
BASE64DECODE_READ_NEXT_CHAR(d)
- if (d == 99 ) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (d == 99) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
if (p == (int)len)
{
if (d == 96) return 2;
@@ -3021,19 +3021,19 @@ unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int void XMLParserBase64Tool::alloc(int newsize)
{
- if ((!buf)&&(newsize)) { buf=malloc(newsize); buflen=newsize; return; }
+ if (( !buf)&&(newsize)) { buf=malloc(newsize); buflen=newsize; return; }
if (newsize>buflen) { buf=realloc(buf, newsize); buflen=newsize; }
}
unsigned char *XMLParserBase64Tool::decode(XMLCSTR data, int *outlen, XMLError *xe)
{
if (xe) *xe=eXMLErrorNone;
- if (!data) { *outlen=0; return (unsigned char*)""; }
+ if ( !data) { *outlen=0; return (unsigned char*)""; }
unsigned int len=decodeSize(data, xe);
if (outlen) *outlen=len;
- if (!len) return NULL;
+ if ( !len) return NULL;
alloc(len+1);
- if(!decode(data, (unsigned char*)buf, len, xe)) { return NULL; }
+ if( !decode(data, (unsigned char*)buf, len, xe)) { return NULL; }
return (unsigned char*)buf;
}
@@ -3041,16 +3041,16 @@ unsigned char *XMLParserBase64Tool::decode(XMLCSTR data, int *outlen, XMLError * // Helpers for external C APIs. //
//////////////////////////////////////////////////////////
-XMLNode::XMLNode( HXML h ) :
-d(( XMLNodeDataTag* )h )
+XMLNode::XMLNode(HXML h) :
+d((XMLNodeDataTag*)h)
{
if (d)
d->ref_count++;
}
-void XMLNode::attach( HXML h )
+void XMLNode::attach(HXML h)
{
- d = ( XMLNodeDataTag* )h;
+ d = (XMLNodeDataTag*)h;
}
HXML XMLNode::detach()
diff --git a/src/modules/xml/xmlParser.h b/src/modules/xml/xmlParser.h index e973fcf712..a166801d7c 100644 --- a/src/modules/xml/xmlParser.h +++ b/src/modules/xml/xmlParser.h @@ -350,7 +350,7 @@ public: ~XMLNode();
XMLNode(const XMLNode &A); ///< to allow shallow/fast copy:
- XMLNode& operator=( const XMLNode& A ); ///< to allow shallow/fast copy:
+ XMLNode& operator=(const XMLNode& A); ///< to allow shallow/fast copy:
XMLNode(): d(NULL) {};
static XMLNode emptyXMLNode;
@@ -358,8 +358,8 @@ public: static XMLAttribute emptyXMLAttribute;
/** helpers for external C applications **/
- XMLNode( HXML h );
- void attach( HXML h );
+ XMLNode(HXML h);
+ void attach(HXML h);
HXML detach();
operator HXML() const { return (HXML)d; }
|