Changes in / [9ead105:4f7255d]


Ignore:
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • lib/xmltree.c

    r9ead105 r4f7255d  
    524524}
    525525
    526 struct xt_node *xt_find_node_by_attr( struct xt_node *xt, const char *tag, const char *key, const char *value )
    527 {
    528         struct xt_node *c;
    529         char *s;
    530 
    531         for( c = xt; ( c = xt_find_node( c, tag ) ); c = c->next )
    532         {
    533                 if( ( s = xt_find_attr( c, key ) ) && strcmp( s, value ) == 0 )
    534                 {
    535                         return c;
    536                 }
    537         }
    538         return NULL;
    539 }
    540 
    541 
    542526/* Strip a few non-printable characters that aren't allowed in XML streams
    543527   (and upset some XMPP servers for example). */
  • lib/xmltree.h

    r9ead105 r4f7255d  
    9292struct xt_node *xt_find_path( struct xt_node *node, const char *name );
    9393char *xt_find_attr( struct xt_node *node, const char *key );
    94 struct xt_node *xt_find_node_by_attr( struct xt_node *xt, const char *tag, const char *key, const char *value );
    9594
    9695struct xt_node *xt_new_node( char *name, const char *text, struct xt_node *children );
  • nick.c

    r9ead105 r4f7255d  
    408408       
    409409        for( i = 0; nick[i]; i ++ )
    410                 if( ((guchar)nick[i]) < 0x7f )
    411                         nick[i] = tab[(guchar)nick[i]];
     410                if( nick[i] < 0x7f )
     411                        nick[i] = tab[(int)nick[i]];
    412412       
    413413        return nick_ok( irc, nick );
  • protocols/jabber/io.c

    r9ead105 r4f7255d  
    506506                allow_reconnect = FALSE;
    507507        }
    508         else if( strcmp( err->code, "not-authorized" ) == 0 )
    509         {
    510                 imcb_error( ic, "Not authorized" );
    511                 allow_reconnect = FALSE;
    512         }
    513508        else
    514509        {
  • protocols/jabber/jabber.c

    r9ead105 r4f7255d  
    148148                jd->fd = jd->r_inpa = jd->w_inpa = -1;
    149149               
    150                 if( strstr( jd->server, ".facebook.com" ) )
     150                if( strstr( jd->server, ".live.com" ) )
     151                        jd->oauth2_service = &oauth2_service_mslive;
     152                else if( strstr( jd->server, ".facebook.com" ) )
    151153                        jd->oauth2_service = &oauth2_service_facebook;
    152154                else
  • protocols/jabber/jabber.h

    r9ead105 r4f7255d  
    229229#define XMLNS_RECEIPTS     "urn:xmpp:receipts"                                   /* XEP-0184 */
    230230#define XMLNS_VCARD        "vcard-temp"                                          /* XEP-0054 */
    231 #define XMLNS_DELAY_OLD    "jabber:x:delay"                                      /* XEP-0091 */
    232 #define XMLNS_DELAY        "urn:xmpp:delay"                                      /* XEP-0203 */
     231#define XMLNS_DELAY        "jabber:x:delay"                                      /* XEP-0091 */
    233232#define XMLNS_XDATA        "jabber:x:data"                                       /* XEP-0004 */
    234233#define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"               /* XEP-0085 */
     
    339338extern const struct oauth2_service oauth2_service_google;
    340339extern const struct oauth2_service oauth2_service_facebook;
     340extern const struct oauth2_service oauth2_service_mslive;
    341341
    342342/* conference.c */
  • protocols/jabber/jabber_util.c

    r9ead105 r4f7255d  
    726726        char *s = NULL;
    727727        struct tm tp;
    728         gboolean is_old = TRUE;
    729         const char *format;
    730 
    731         /* XEP-0091 has <x> */
    732         c = xt_find_node_by_attr( xt->children, "x", "xmlns", XMLNS_DELAY_OLD );
    733 
    734         if( !c || !( s = xt_find_attr( c, "stamp" ) ) ) {
    735                 is_old = FALSE;
    736 
    737                 /* XEP-0203 has <delay> */
    738                 c = xt_find_node_by_attr( xt->children, "delay", "xmlns", XMLNS_DELAY );
    739                 if( !c || !( s = xt_find_attr( c, "stamp" ) ) ) {
    740                         return 0;
    741                 }
    742         }
     728       
     729        for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
     730        {
     731                if( ( s = xt_find_attr( c, "xmlns" ) ) && strcmp( s, XMLNS_DELAY ) == 0 )
     732                        break;
     733        }
     734       
     735        if( !c || !( s = xt_find_attr( c, "stamp" ) ) )
     736                return 0;
    743737       
    744738        memset( &tp, 0, sizeof( tp ) );
    745 
    746         /* The other main difference between XEPs is the timestamp format */
    747         format = (is_old) ? "%4d%2d%2dT%2d:%2d:%2d" : "%4d-%2d-%2dT%2d:%2d:%2dZ";
    748 
    749         if( sscanf( s, format, &tp.tm_year, &tp.tm_mon, &tp.tm_mday,
    750                                &tp.tm_hour, &tp.tm_min, &tp.tm_sec ) != 6 )
     739        if( sscanf( s, "%4d%2d%2dT%2d:%2d:%2d", &tp.tm_year, &tp.tm_mon, &tp.tm_mday,
     740                                                &tp.tm_hour, &tp.tm_min, &tp.tm_sec ) != 6 )
    751741                return 0;
    752742       
  • protocols/jabber/sasl.c

    r9ead105 r4f7255d  
    4747        "4b100f0f244d620bf3f15f8b217d4c32",
    4848};
     49const struct oauth2_service oauth2_service_mslive =
     50{
     51        "https://oauth.live.com/authorize",
     52        "https://oauth.live.com/token",
     53        "http://www.bitlbee.org/main.php/Messenger/oauth2.html",
     54        "wl.offline_access%20wl.messenger",
     55        "000000004C06FCD1",
     56        "IRKlBPzJJAWcY-TbZjiTEJu9tn7XCFaV",
     57};
    4958
    5059xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
     
    5463        struct xt_node *c, *reply;
    5564        char *s;
    56         int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0;
     65        int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0, sup_ms = 0;
    5766        int want_oauth = FALSE;
    5867        GString *mechs;
     
    8998                else if( c->text && g_strcasecmp( c->text, "X-FACEBOOK-PLATFORM" ) == 0 )
    9099                        sup_fb = 1;
     100                else if( c->text && g_strcasecmp( c->text, "X-MESSENGER-OAUTH2" ) == 0 )
     101                        sup_ms = 1;
    91102               
    92103                if( c->text )
     
    98109        if( !want_oauth && !sup_plain && !sup_digest )
    99110        {
    100                 if( !sup_gtalk && !sup_fb )
     111                if( !sup_gtalk && !sup_fb && !sup_ms )
    101112                        imcb_error( ic, "This server requires OAuth "
    102113                                        "(supported schemes:%s)", mechs->str );
     
    130141                reply->text_len = strlen( reply->text );
    131142                g_free( s );
     143        }
     144        else if( sup_ms && want_oauth )
     145        {
     146                xt_add_attr( reply, "mechanism", "X-MESSENGER-OAUTH2" );
     147                reply->text = g_strdup( jd->oauth2_access_token );
     148                reply->text_len = strlen( jd->oauth2_access_token );
    132149        }
    133150        else if( sup_fb && want_oauth )
Note: See TracChangeset for help on using the changeset viewer.