Changeset fa295e36
- Timestamp:
- 2009-10-10T13:39:51Z (15 years ago)
- Branches:
- master
- Children:
- ba16895
- Parents:
- e59b4f6
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
re59b4f6 rfa295e36 506 506 } 507 507 508 /* prpl.c */ 509 510 struct show_got_added_data 508 509 struct imcb_ask_cb_data 511 510 { 512 511 struct im_connection *ic; … … 514 513 }; 515 514 516 void show_got_added_no( void *data ) 517 { 518 g_free( ((struct show_got_added_data*)data)->handle ); 515 static void imcb_ask_auth_cb_no( void *data ) 516 { 517 struct imcb_ask_cb_data *cbd = data; 518 519 cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle ); 520 521 g_free( cbd->handle ); 522 g_free( cbd ); 523 } 524 525 static void imcb_ask_auth_cb_yes( void *data ) 526 { 527 struct imcb_ask_cb_data *cbd = data; 528 529 cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle ); 530 531 g_free( cbd->handle ); 532 g_free( cbd ); 533 } 534 535 void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) 536 { 537 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 538 char *s, *realname_ = NULL; 539 540 if( realname != NULL ) 541 realname_ = g_strdup_printf( " (%s)", realname ); 542 543 s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", 544 handle, realname_ ?: "" ); 545 546 g_free( realname_ ); 547 548 data->ic = ic; 549 data->handle = g_strdup( handle ); 550 query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); 551 } 552 553 554 static void imcb_ask_add_cb_no( void *data ) 555 { 556 g_free( ((struct imcb_ask_cb_data*)data)->handle ); 519 557 g_free( data ); 520 558 } 521 559 522 void show_got_added_yes( void *data ) 523 { 524 struct show_got_added_data *sga = data; 525 526 sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); 527 /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ 528 529 return show_got_added_no( data ); 530 } 531 532 void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) 533 { 534 struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); 560 static void imcb_ask_add_cb_yes( void *data ) 561 { 562 struct imcb_ask_cb_data *cbd = data; 563 564 cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); 565 566 return imcb_ask_add_cb_no( data ); 567 } 568 569 void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) 570 { 571 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 535 572 char *s; 536 573 … … 543 580 data->ic = ic; 544 581 data->handle = g_strdup( handle ); 545 query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );582 query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); 546 583 } 547 584 -
protocols/nogaim.h
re59b4f6 rfa295e36 224 224 * - Most protocols will just want to set this to g_strcasecmp().*/ 225 225 int (* handle_cmp) (const char *who1, const char *who2); 226 227 /* Implement these callbacks if you want to use imcb_ask_auth() */ 228 void (* auth_allow) (struct im_connection *, const char *who); 229 void (* auth_deny) (struct im_connection *, const char *who); 226 230 }; 227 231 … … 252 256 /* To tell the user an error, ie. before logging out when an error occurs. */ 253 257 G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 258 254 259 /* To ask a your about something. 255 260 * - 'msg' is the question. … … 258 263 */ 259 264 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); 260 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 265 266 /* Two common questions you may want to ask: 267 * - X added you to his contact list, allow? 268 * - X is not in your contact list, want to add? 269 */ 270 G_MODULE_EXPORT void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ); 271 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ); 261 272 262 273 /* Buddy management */ -
user.c
re59b4f6 rfa295e36 141 141 } 142 142 143 user_t *user_findhandle( struct im_connection *ic, c har *handle )143 user_t *user_findhandle( struct im_connection *ic, const char *handle ) 144 144 { 145 145 user_t *u; -
user.h
re59b4f6 rfa295e36 56 56 int user_del( irc_t *irc, char *nick ); 57 57 G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick ); 58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, c har *handle );58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, const char *handle ); 59 59 void user_rename( irc_t *irc, char *oldnick, char *newnick ); 60 60
Note: See TracChangeset
for help on using the changeset viewer.