Changeset 8e5e2e9


Ignore:
Timestamp:
2006-09-24T19:25:06Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
4ecdc69
Parents:
cfbb3a6
Message:

Handling of incoming authorization requests, manual block/allow. (Doesn't
seem to be completely like how it works on other IM networks.)

Location:
protocols/jabber
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    rcfbb3a6 r8e5e2e9  
    171171        /* Just any whitespace character is enough as a keepalive for XMPP sessions. */
    172172        jabber_write( gc, "\n", 1 );
     173}
     174
     175static void jabber_add_permit( struct gaim_connection *gc, char *who )
     176{
     177        presence_send_request( gc, who, "subscribed" );
     178}
     179
     180static void jabber_rem_permit( struct gaim_connection *gc, char *who )
     181{
     182        presence_send_request( gc, who, "unsubscribed" );
     183}
     184
     185static void jabber_add_deny( struct gaim_connection *gc, char *who )
     186{
     187}
     188
     189static void jabber_rem_deny( struct gaim_connection *gc, char *who )
     190{
    173191}
    174192
     
    194212//      ret->chat_open = jabber_chat_open;
    195213        ret->keepalive = jabber_keepalive;
    196 //      ret->add_permit = jabber_add_permit;
    197 //      ret->rem_permit = jabber_rem_permit;
    198 //      ret->add_deny = jabber_add_deny;
    199 //      ret->rem_deny = jabber_rem_deny;
     214        ret->add_permit = jabber_add_permit;
     215        ret->rem_permit = jabber_rem_permit;
     216        ret->add_deny = jabber_add_deny;
     217        ret->rem_deny = jabber_rem_deny;
    200218//      ret->send_typing = jabber_send_typing;
    201219        ret->handle_cmp = g_strcasecmp;
  • protocols/jabber/jabber.h

    rcfbb3a6 r8e5e2e9  
    9292const struct jabber_away_state *jabber_away_state_by_code( char *code );
    9393const struct jabber_away_state *jabber_away_state_by_name( char *name );
     94void jabber_buddy_ask( struct gaim_connection *gc, char *handle );
    9495
    9596extern const struct jabber_away_state jabber_away_state_list[];
  • protocols/jabber/jabber_util.c

    rcfbb3a6 r8e5e2e9  
    149149        return NULL;
    150150}
     151
     152struct jabber_buddy_ask_data
     153{
     154        struct gaim_connection *gc;
     155        char *handle;
     156        char *realname;
     157};
     158
     159static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla )
     160{
     161        presence_send_request( bla->gc, bla->handle, "subscribed" );
     162       
     163        if( find_buddy( bla->gc, bla->handle ) == NULL )
     164                show_got_added( bla->gc, bla->handle, NULL );
     165       
     166        g_free( bla->handle );
     167        g_free( bla );
     168}
     169
     170static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla )
     171{
     172        presence_send_request( bla->gc, bla->handle, "subscribed" );
     173       
     174        g_free( bla->handle );
     175        g_free( bla );
     176}
     177
     178void jabber_buddy_ask( struct gaim_connection *gc, char *handle )
     179{
     180        struct jabber_buddy_ask_data *bla = g_new0( struct jabber_buddy_ask_data, 1 );
     181        char *buf;
     182       
     183        bla->gc = gc;
     184        bla->handle = g_strdup( handle );
     185       
     186        buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list.", handle );
     187        do_ask_dialog( gc, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
     188}
  • protocols/jabber/presence.c

    rcfbb3a6 r8e5e2e9  
    4242        else if( strcmp( type, "unavailable" ) == 0 )
    4343                serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
     44        else if( strcmp( type, "subscribe" ) == 0 )
     45                jabber_buddy_ask( gc, from );
     46        else if( strcmp( type, "subscribed" ) == 0 )
     47                serv_got_crap( gc, "%s just accepted your authorization request", from );
     48        else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 )
     49        {
     50                /* Do nothing here. Plenty of control freaks or over-curious
     51                   souls get excited when they can see who still has them in
     52                   their buddy list and who finally removed them. Somehow I
     53                   got the impression that those are the people who get
     54                   removed from many buddy lists for "some" reason...
     55                   
     56                   If you're one of those people, this is your chance to write
     57                   your first line of code in C... */
     58        }
    4459        else
    4560        {
Note: See TracChangeset for help on using the changeset viewer.