Changeset a42fda4
- Timestamp:
- 2016-03-20T03:58:05Z (9 years ago)
- Branches:
- master
- Children:
- 8f8a56f
- Parents:
- 14f912d
- git-author:
- dequis <dx@…> (08-12-15 22:31:05)
- git-committer:
- dequis <dx@…> (20-03-16 03:58:05)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r14f912d ra42fda4 342 342 } 343 343 344 static gboolean bee_irc_user_nick_update(irc_user_t *iu );344 static gboolean bee_irc_user_nick_update(irc_user_t *iu, gboolean offline_only); 345 345 346 346 static gboolean bee_irc_user_fullname(bee_t *bee, bee_user_t *bu) … … 370 370 } 371 371 372 bee_irc_user_nick_update(iu );372 bee_irc_user_nick_update(iu, TRUE); 373 373 374 374 return TRUE; … … 377 377 static gboolean bee_irc_user_nick_hint(bee_t *bee, bee_user_t *bu, const char *hint) 378 378 { 379 bee_irc_user_nick_update((irc_user_t *) bu->ui_data); 379 bee_irc_user_nick_update((irc_user_t *) bu->ui_data, TRUE); 380 381 return TRUE; 382 } 383 384 static gboolean bee_irc_user_nick_change(bee_t *bee, bee_user_t *bu, const char *nick) 385 { 386 bee_irc_user_nick_update((irc_user_t *) bu->ui_data, FALSE); 380 387 381 388 return TRUE; … … 386 393 irc_user_t *iu = (irc_user_t *) bu->ui_data; 387 394 irc_t *irc = (irc_t *) bee->ui_data; 388 bee_user_flags_t online;389 390 /* Take the user offline temporarily so we can change the nick (if necessary). */391 if ((online = bu->flags & BEE_USER_ONLINE)) {392 bu->flags &= ~BEE_USER_ONLINE;393 }394 395 395 396 bee_irc_channel_update(irc, NULL, iu); 396 bee_irc_user_nick_update(iu); 397 398 if (online) { 399 bu->flags |= online; 400 bee_irc_channel_update(irc, NULL, iu); 401 } 402 403 return TRUE; 404 } 405 406 static gboolean bee_irc_user_nick_update(irc_user_t *iu) 397 bee_irc_user_nick_update(iu, FALSE); 398 399 return TRUE; 400 } 401 402 static gboolean bee_irc_user_nick_update(irc_user_t *iu, gboolean offline_only) 407 403 { 408 404 bee_user_t *bu = iu->bu; 409 405 char *newnick; 410 406 411 if ( bu->flags & BEE_USER_ONLINE) {407 if (offline_only && bu->flags & BEE_USER_ONLINE) { 412 408 /* Ignore if the user is visible already. */ 413 409 return TRUE; … … 432 428 { 433 429 bee_user_t *bu = iu->bu; 434 bee_user_flags_t online;435 430 436 431 if (bu == FALSE) { … … 438 433 } 439 434 440 /* In this case, pretend the user is offline. */441 if ((online = bu->flags & BEE_USER_ONLINE)) {442 bu->flags &= ~BEE_USER_ONLINE;443 }444 445 435 nick_del(bu); 446 bee_irc_user_nick_update(iu); 447 448 bu->flags |= online; 436 bee_irc_user_nick_update(iu, FALSE); 437 449 438 } 450 439 … … 1146 1135 1147 1136 bee_irc_log, 1137 bee_irc_user_nick_change, 1148 1138 }; -
protocols/bee.h
r14f912d ra42fda4 131 131 132 132 void (*log)(bee_t *bee, const char *tag, const char *msg); 133 gboolean (*user_nick_change)(bee_t *bee, bee_user_t *bu, const char *hint); 133 134 } bee_ui_funcs_t; 134 135 -
protocols/nogaim.c
r14f912d ra42fda4 479 479 } 480 480 481 /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM 482 modules to suggest a nickname for a handle. */ 483 void imcb_buddy_nick_hint(struct im_connection *ic, const char *handle, const char *nick) 481 /* Implements either imcb_buddy_nick_hint() or imcb_buddy_nick_change() depending on the value of 'change' */ 482 static void buddy_nick_hint_or_change(struct im_connection *ic, const char *handle, const char *nick, gboolean change) 484 483 { 485 484 bee_t *bee = ic->bee; … … 493 492 bu->nick = g_strdup(nick); 494 493 495 if (bee->ui->user_nick_hint) { 494 if (change && bee->ui->user_nick_change) { 495 bee->ui->user_nick_change(bee, bu, nick); 496 } else if (!change && bee->ui->user_nick_hint) { 496 497 bee->ui->user_nick_hint(bee, bu, nick); 497 498 } 498 499 } 499 500 501 /* Soft variant, for newly created users. Does nothing if it's already online */ 502 void imcb_buddy_nick_hint(struct im_connection *ic, const char *handle, const char *nick) 503 { 504 buddy_nick_hint_or_change(ic, handle, nick, FALSE); 505 } 506 507 /* Hard variant, always changes the nick */ 508 void imcb_buddy_nick_change(struct im_connection *ic, const char *handle, const char *nick) 509 { 510 buddy_nick_hint_or_change(ic, handle, nick, TRUE); 511 } 500 512 501 513 struct imcb_ask_cb_data { -
protocols/nogaim.h
r14f912d ra42fda4 324 324 G_MODULE_EXPORT void imcb_rename_buddy(struct im_connection *ic, const char *handle, const char *realname); 325 325 G_MODULE_EXPORT void imcb_buddy_nick_hint(struct im_connection *ic, const char *handle, const char *nick); 326 G_MODULE_EXPORT void imcb_buddy_nick_change(struct im_connection *ic, const char *handle, const char *nick); 326 327 G_MODULE_EXPORT void imcb_buddy_action_response(bee_user_t *bu, const char *action, char * const args[], void *data); 327 328
Note: See TracChangeset
for help on using the changeset viewer.