diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
commit | 3f23417a1099f73dc28ec1b7d6ec2a1a7fc2b7a2 (patch) | |
tree | 3e0bcd88c55dad310da0dc980e252bf9fbfa6dc5 /src/modules/protocols | |
parent | 537b94169bf2483798a651ee3b96f7904eebe7b4 (diff) |
- PLUGININFO structure removed at all;
- Options_AddPage & UserInfo_AddPage replaced MS_OPT_ADDPAGE & MS_USERINFO_ADDPAGE services respectively
- total internal redesign of options' translation
- code reformatting
git-svn-id: http://svn.miranda-ng.org/main/trunk@477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/protocols')
-rw-r--r-- | src/modules/protocols/protoaccs.cpp | 470 | ||||
-rw-r--r-- | src/modules/protocols/protochains.cpp | 92 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 766 | ||||
-rw-r--r-- | src/modules/protocols/protoint.cpp | 200 | ||||
-rw-r--r-- | src/modules/protocols/protoopts.cpp | 362 |
5 files changed, 945 insertions, 945 deletions
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;
}
|