Changeset e5854a8


Ignore:
Timestamp:
2010-08-14T14:50:10Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
193dc74
Parents:
07874be
Message:

Show incoming auth. requests (although responding to them currently causes
a disconnect).

Location:
protocols/msn
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.h

    r07874be re5854a8  
    203203int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group );
    204204int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group );
    205 void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
     205void msn_buddy_ask( bee_user_t *bu );
    206206char *msn_findheader( char *text, char *header, int len );
    207207char **msn_linesplit( char *line );
  • protocols/msn/msn_util.c

    r07874be re5854a8  
    172172}
    173173
    174 void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname )
    175 {
    176         struct msn_buddy_ask_data *bla = g_new0( struct msn_buddy_ask_data, 1 );
     174void msn_buddy_ask( bee_user_t *bu )
     175{
     176        struct msn_buddy_ask_data *bla;
     177        struct msn_buddy_data *bd = bu->data;
    177178        char buf[1024];
    178179       
    179         bla->ic = ic;
    180         bla->handle = g_strdup( handle );
    181         bla->realname = g_strdup( realname );
     180        if( ( bd->flags & 30 ) != 8 && ( bd->flags & 30 ) != 16 )
     181                return;
     182       
     183        bla = g_new0( struct msn_buddy_ask_data, 1 );
     184        bla->ic = bu->ic;
     185        bla->handle = g_strdup( bu->handle );
     186        bla->realname = g_strdup( bu->fullname );
    182187       
    183188        g_snprintf( buf, sizeof( buf ),
    184189                    "The user %s (%s) wants to add you to his/her buddy list.",
    185                     handle, realname );
    186         imcb_ask( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
     190                    bu->handle, bu->fullname );
     191        imcb_ask( bu->ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
    187192}
    188193
  • protocols/msn/ns.c

    r07874be re5854a8  
    279279                        msn_write( ic, buf, strlen( buf ) );
    280280                }
     281                else if( num_parts >= 3 )
     282                {
     283                        md->handler->msglen = atoi( cmd[2] );
     284                }
    281285        }
    282286        else if( strcmp( cmd[0], "PRP" ) == 0 )
     
    412416                }
    413417        }
    414         else if( strcmp( cmd[0], "ADD" ) == 0 )
    415         {
    416                 if( num_parts >= 6 && strcmp( cmd[2], "RL" ) == 0 )
    417                 {
    418                         GSList *l;
    419                        
    420                         http_decode( cmd[5] );
    421                        
    422                         if( strchr( cmd[4], '@' ) == NULL )
    423                         {
    424                                 imcb_error( ic, "Syntax error" );
    425                                 imc_logout( ic, TRUE );
    426                                 return 0;
    427                         }
    428                        
    429                         /* We got added by someone. If we don't have this
    430                            person in permit/deny yet, inform the user. */
    431                         for( l = ic->permit; l; l = l->next )
    432                                 if( g_strcasecmp( l->data, cmd[4] ) == 0 )
    433                                         return 1;
    434                        
    435                         for( l = ic->deny; l; l = l->next )
    436                                 if( g_strcasecmp( l->data, cmd[4] ) == 0 )
    437                                         return 1;
    438                        
    439                         msn_buddy_ask( ic, cmd[4], cmd[5] );
    440                 }
    441                 else if( num_parts >= 6 && strcmp( cmd[2], "FL" ) == 0 )
    442                 {
    443                         const char *group = NULL;
    444                         int num;
    445                        
    446                         if( cmd[6] != NULL && sscanf( cmd[6], "%d", &num ) == 1 && num < md->groupcount )
    447                                 group = md->grouplist[num];
    448                        
    449                         http_decode( cmd[5] );
    450                         imcb_add_buddy( ic, cmd[4], group );
    451                         imcb_rename_buddy( ic, cmd[4], cmd[5] );
    452                 }
    453         }
    454418        else if( strcmp( cmd[0], "OUT" ) == 0 )
    455419        {
     
    486450                }
    487451        }
     452#if 0
    488453        else if( strcmp( cmd[0], "ADG" ) == 0 )
    489454        {
     
    530495                }
    531496        }
     497#endif
    532498        else if( strcmp( cmd[0], "GCF" ) == 0 )
    533499        {
     
    538504        else if( strcmp( cmd[0], "UBX" ) == 0 )
    539505        {
    540                 /* Status message. Parser coming soon. */
     506                /* Status message. */
    541507                if( num_parts >= 4 )
    542508                        md->handler->msglen = atoi( cmd[3] );
     
    544510        else if( strcmp( cmd[0], "NOT" ) == 0 )
    545511        {
    546                 /* Some kind of notification, not sure if it still exists
    547                    but we have to skip the payload or stuff breaks. */
    548                 if( num_parts >= 3 )
    549                         md->handler->msglen = atoi( cmd[2] );
     512                /* Some kind of notification, poorly documented but
     513                   apparently used to announce address book changes. */
     514                if( num_parts >= 2 )
     515                        md->handler->msglen = atoi( cmd[1] );
    550516        }
    551517        else if( isdigit( cmd[0][0] ) )
     
    670636                imcb_buddy_status_msg( ic, cmd[1], psm_text );
    671637                xt_free_node( psm );
     638        }
     639        else if( strcmp( cmd[0], "ADL" ) == 0 )
     640        {
     641                struct xt_node *adl, *d, *c;
     642               
     643                if( !( adl = xt_from_string( msg ) ) )
     644                        return 1;
     645               
     646                for( d = adl->children; d; d = d->next )
     647                {
     648                        char *dn;
     649                        if( strcmp( d->name, "d" ) != 0 ||
     650                            ( dn = xt_find_attr( d, "n" ) ) == NULL )
     651                                continue;
     652                        for( c = d->children; c; c = c->next )
     653                        {
     654                                bee_user_t *bu;
     655                                struct msn_buddy_data *bd;
     656                                char *cn, *handle, *f, *l;
     657                                int flags;
     658                               
     659                                if( strcmp( c->name, "c" ) != 0 ||
     660                                    ( l = xt_find_attr( c, "l" ) ) == NULL ||
     661                                    ( cn = xt_find_attr( c, "n" ) ) == NULL )
     662                                        continue;
     663                               
     664                                handle = g_strdup_printf( "%s@%s", cn, dn );
     665                                if( !( ( bu = bee_user_by_handle( ic->bee, ic, handle ) ) ||
     666                                       ( bu = bee_user_new( ic->bee, ic, handle, 0 ) ) ) )
     667                                {
     668                                        g_free( handle );
     669                                        continue;
     670                                }
     671                                g_free( handle );
     672                                bd = bu->data;
     673                               
     674                                if( ( f = xt_find_attr( c, "f" ) ) )
     675                                {
     676                                        http_decode( f );
     677                                        imcb_rename_buddy( ic, bu->handle, f );
     678                                }
     679                               
     680                                flags = atoi( l ) & 15;
     681                                if( bd->flags != flags )
     682                                {
     683                                        bd->flags = flags;
     684                                        msn_buddy_ask( bu );
     685                                }
     686                        }
     687                }
    672688        }
    673689       
     
    718734        char l[4];
    719735       
     736        if( ( bd->flags & 7 ) == 0 )
     737                return FALSE;
     738       
    720739        strcpy( handle, bu->handle );
    721740        if( ( domain = strchr( handle, '@' ) ) == NULL ) /* WTF */
  • protocols/msn/soap.c

    r07874be re5854a8  
    477477                bd->flags |= MSN_BUDDY_BL;
    478478        else if( strcmp( role, "Reverse" ) == 0 )
     479        {
    479480                bd->flags |= MSN_BUDDY_RL;
     481                msn_buddy_ask( bu );
     482        }
    480483        else if( strcmp( role, "Pending" ) == 0 )
     484        {
    481485                bd->flags |= MSN_BUDDY_PL;
     486                msn_buddy_ask( bu );
     487        }
     488       
     489        printf( "%s %d\n", handle, bd->flags );
    482490       
    483491        return XT_HANDLED;
Note: See TracChangeset for help on using the changeset viewer.