Changeset 57b4525


Ignore:
Timestamp:
2011-07-22T18:29:25Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
59c9adb4
Parents:
a010498
Message:

Nothing useful yet, this just generates an auth URL. Things to do: Ability
to process the answer. This is hard because the GTalk server will time out
very quickly which means we lose our state/scope/etc. (And the ability to
even receive the answer, at least if I'd do this the same way the Twitter
module does it.)

And then, get the access token and use it, of course. :-)

Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • lib/Makefile

    ra010498 r57b4525  
    1313
    1414# [SH] Program variables
    15 objects = arc.o base64.o $(DES) $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o
     15objects = arc.o base64.o $(DES) $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o oauth2.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o
    1616
    1717LFLAGS += -r
  • protocols/jabber/jabber.c

    ra010498 r57b4525  
    6060        s = set_add( &acc->set, "activity_timeout", "600", set_eval_int, acc );
    6161       
     62        s = set_add( &acc->set, "oauth", "false", set_eval_bool, acc );
     63
    6264        g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] );
    6365        s = set_add( &acc->set, "port", str, set_eval_int, acc );
  • protocols/jabber/sasl.c

    ra010498 r57b4525  
    2626#include "jabber.h"
    2727#include "base64.h"
     28#include "oauth2.h"
    2829
    2930xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
     
    3334        struct xt_node *c, *reply;
    3435        char *s;
    35         int sup_plain = 0, sup_digest = 0;
     36        int sup_plain = 0, sup_digest = 0, sup_oauth2 = 0;
    3637       
    3738        if( !sasl_supported( ic ) )
     
    5960                if( c->text && g_strcasecmp( c->text, "DIGEST-MD5" ) == 0 )
    6061                        sup_digest = 1;
     62                if( c->text && g_strcasecmp( c->text, "X-OAUTH2" ) == 0 )
     63                        sup_oauth2 = 1;
    6164               
    6265                c = c->next;
     
    7376        xt_add_attr( reply, "xmlns", XMLNS_SASL );
    7477       
    75         if( sup_digest )
     78        if( sup_oauth2 && set_getbool( &ic->acc->set, "oauth" ) )
     79        {
     80                imcb_log( ic, "Open this URL in your browser to authenticate: %s",
     81                          oauth2_url( &oauth2_service_google,
     82                                      "https://www.googleapis.com/auth/googletalk" ) );
     83                xt_free_node( reply );
     84                reply = NULL;
     85        }
     86        else if( sup_digest )
    7687        {
    7788                xt_add_attr( reply, "mechanism", "DIGEST-MD5" );
     
    96107        }
    97108       
    98         if( !jabber_write_packet( ic, reply ) )
     109        if( reply && !jabber_write_packet( ic, reply ) )
    99110        {
    100111                xt_free_node( reply );
Note: See TracChangeset for help on using the changeset viewer.