Changeset e14b47b8 for protocols/jabber
- Timestamp:
- 2011-12-21T10:48:08Z (13 years ago)
- Branches:
- master
- Children:
- ce199b7
- Parents:
- 68286eb
- Location:
- protocols/jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r68286eb re14b47b8 32 32 #include "bitlbee.h" 33 33 #include "jabber.h" 34 #include "oauth.h" 34 35 #include "md5.h" 35 36 … … 138 139 if( set_getbool( &acc->set, "oauth" ) ) 139 140 { 141 GSList *p_in = NULL; 142 const char *tok; 143 140 144 jd->fd = jd->r_inpa = jd->w_inpa = -1; 141 145 … … 147 151 jd->oauth2_service = &oauth2_service_google; 148 152 153 oauth_params_parse( &p_in, ic->acc->pass ); 154 149 155 /* First see if we have a refresh token, in which case any 150 156 access token we *might* have has probably expired already 151 157 anyway. */ 152 if( strstr( acc->pass, "refresh_token=") )158 if( ( tok = oauth_params_get( &p_in, "refresh_token" ) ) ) 153 159 { 154 sasl_oauth2_refresh( ic, acc->pass + 14);160 sasl_oauth2_refresh( ic, tok ); 155 161 } 156 162 /* If we don't have a refresh token, let's hope the access 157 163 token is still usable. */ 158 else if( strstr( acc->pass, "access_token=") )164 else if( ( tok = oauth_params_get( &p_in, "access_token" ) ) ) 159 165 { 160 sasl_oauth2_load_access_token( ic);166 jd->oauth2_access_token = g_strdup( tok ); 161 167 jabber_connect( ic ); 162 168 } … … 168 174 ic->flags |= OPT_SLOW_LOGIN; 169 175 } 176 177 oauth_params_free( &p_in ); 170 178 } 171 179 else -
protocols/jabber/jabber.h
r68286eb re14b47b8 329 329 int sasl_oauth2_get_refresh_token( struct im_connection *ic, const char *msg ); 330 330 int sasl_oauth2_refresh( struct im_connection *ic, const char *refresh_token ); 331 int sasl_oauth2_load_access_token( struct im_connection *ic );332 331 333 332 extern const struct oauth2_service oauth2_service_google; -
protocols/jabber/sasl.c
r68286eb re14b47b8 512 512 } 513 513 514 int sasl_oauth2_load_access_token( struct im_connection *ic )515 {516 struct jabber_data *jd = ic->proto_data;517 GSList *p_in = NULL;518 519 oauth_params_parse( &p_in, ic->acc->pass );520 jd->oauth2_access_token = g_strdup( oauth_params_get( &p_in, "access_token" ) );521 oauth_params_free( &p_in );522 523 return jd->oauth2_access_token != NULL;524 }525 526 514 static void sasl_oauth2_got_token( gpointer data, const char *access_token, const char *refresh_token ) 527 515 {
Note: See TracChangeset
for help on using the changeset viewer.