=== modified file 'protocols/account.c'
|
|
|
|
| 168 | 168 | |
| 169 | 169 | g_free( acc->pass ); |
| 170 | 170 | acc->pass = g_strdup( value ); |
| | 171 | |
| | 172 | /* Callback protocol's set password function only if account |
| | 173 | is online. */ |
| | 174 | if( acc->ic && acc->prpl->set_password ) |
| | 175 | acc->prpl->set_password( acc->ic, value ); |
| | 176 | |
| 171 | 177 | return NULL; /* password shouldn't be visible in plaintext! */ |
| 172 | 178 | } |
| 173 | 179 | else if( strcmp( set->key, "tag" ) == 0 ) |
=== modified file 'protocols/jabber/iq.c'
|
|
|
|
| 931 | 931 | |
| 932 | 932 | return XT_HANDLED; |
| 933 | 933 | } |
| | 934 | |
| | 935 | int jabber_iq_register_password( struct im_connection *ic, const char *password ) |
| | 936 | { |
| | 937 | struct jabber_data *jd = ic->proto_data; |
| | 938 | struct xt_node *node; |
| | 939 | int st; |
| | 940 | |
| | 941 | node = xt_new_node( "query", NULL, NULL ); |
| | 942 | xt_add_attr( node, "xmlns", XMLNS_REGISTER ); |
| | 943 | xt_add_child( node, xt_new_node( "username", jd->username, NULL ) ); |
| | 944 | xt_add_child( node, xt_new_node( "password", password, NULL ) ); |
| | 945 | node = jabber_make_packet( "iq", "set", NULL, node ); |
| | 946 | st = jabber_write_packet( ic, node ); |
| | 947 | |
| | 948 | return st; |
| | 949 | } |
=== modified file 'protocols/jabber/jabber.c'
|
|
|
|
| 53 | 53 | 0 |
| 54 | 54 | }; |
| 55 | 55 | |
| | 56 | static char * jabber_password_blacklist[] = { |
| | 57 | "chat.facebook.com", |
| | 58 | "talk.google.com", |
| | 59 | 0 |
| | 60 | }; |
| | 61 | |
| 56 | 62 | static void jabber_init( account_t *acc ) |
| 57 | 63 | { |
| 58 | 64 | set_t *s; |
| … |
… |
|
| 579 | 585 | return 1; |
| 580 | 586 | } |
| 581 | 587 | |
| | 588 | static void jabber_set_password_( void *data ) |
| | 589 | { |
| | 590 | struct im_connection *ic = (struct im_connection *)data; |
| | 591 | jabber_iq_register_password( ic, ic->acc->pass ); |
| | 592 | } |
| | 593 | |
| | 594 | static void jabber_ask_set_password_( struct im_connection *ic, char *pass ) |
| | 595 | { |
| | 596 | struct jabber_data *jd = ic->proto_data; |
| | 597 | char *buf; |
| | 598 | int i; |
| | 599 | |
| | 600 | g_assert( jd->server == NULL ); |
| | 601 | |
| | 602 | for( i = 0; jabber_password_blacklist[i] > 0; i ++ ) |
| | 603 | if( g_strcasecmp( jd->server, jabber_password_blacklist[i] ) == 0 ) |
| | 604 | return; |
| | 605 | |
| | 606 | buf = g_strdup_printf( "Notify the server of the password change?" ); |
| | 607 | query_add( (irc_t *) ic->bee->ui_data, ic, buf, |
| | 608 | jabber_set_password_, NULL, NULL, // callbacks |
| | 609 | ic ); // data |
| | 610 | g_free( buf ); |
| | 611 | } |
| | 612 | |
| 582 | 613 | void jabber_chat_add_settings( account_t *acc, set_t **head ) |
| 583 | 614 | { |
| 584 | 615 | /* Meh. Stupid room passwords. Not trying to obfuscate/hide |
| … |
… |
|
| 652 | 683 | ret->transfer_request = jabber_si_transfer_request; |
| 653 | 684 | ret->buddy_action_list = jabber_buddy_action_list; |
| 654 | 685 | ret->buddy_action = jabber_buddy_action; |
| | 686 | ret->set_password = jabber_ask_set_password_; |
| 655 | 687 | |
| 656 | 688 | register_protocol( ret ); |
| 657 | 689 | } |
=== modified file 'protocols/jabber/jabber.h'
|
|
|
|
| 221 | 221 | #define XMLNS_ROSTER "jabber:iq:roster" |
| 222 | 222 | |
| 223 | 223 | /* Some supported extensions/legacy stuff */ |
| | 224 | #define XMLNS_REGISTER "jabber:iq:register" /* XEP-0077 */ |
| 224 | 225 | #define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */ |
| 225 | 226 | #define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */ |
| 226 | 227 | #define XMLNS_TIME_OLD "jabber:iq:time" /* XEP-0090 */ |
| … |
… |
|
| 256 | 257 | xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid ); |
| 257 | 258 | xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns ); |
| 258 | 259 | void jabber_iq_version_send( struct im_connection *ic, struct jabber_buddy *bud, void *data ); |
| | 260 | int jabber_iq_register_password( struct im_connection *ic, const char *password ); |
| 259 | 261 | |
| 260 | 262 | /* si.c */ |
| 261 | 263 | int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode ); |
=== modified file 'protocols/nogaim.h'
|
|
|
|
| 261 | 261 | |
| 262 | 262 | GList *(* buddy_action_list) (struct bee_user *bu); |
| 263 | 263 | void *(* buddy_action) (struct bee_user *bu, const char *action, char * const args[], void *data); |
| 264 | | |
| | 264 | |
| | 265 | /* Implement callback if you want to perform some action when account |
| | 266 | password is changed. */ |
| | 267 | void (* set_password) (struct im_connection *, char *pass); |
| | 268 | |
| 265 | 269 | /* Some placeholders so eventually older plugins may cooperate with newer BitlBees. */ |
| 266 | 270 | void *resv1; |
| 267 | 271 | void *resv2; |
| 268 | 272 | void *resv3; |
| 269 | 273 | void *resv4; |
| 270 | | void *resv5; |
| 271 | 274 | }; |
| 272 | 275 | |
| 273 | 276 | /* im_api core stuff. */ |