Changes in irc_im.c [03df717:30093fa]
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r03df717 r30093fa 120 120 } 121 121 122 if ((irc->caps & CAP_AWAY_NOTIFY) &&123 ((bu->flags & BEE_USER_AWAY) != (old->flags & BEE_USER_AWAY) ||124 (bu->flags & BEE_USER_ONLINE) != (old->flags & BEE_USER_ONLINE))) {125 irc_send_away_notify(iu);126 }127 128 122 if ((bu->flags & BEE_USER_ONLINE) != (old->flags & BEE_USER_ONLINE)) { 129 123 if (bu->flags & BEE_USER_ONLINE) { … … 153 147 154 148 bee_irc_channel_update(irc, NULL, iu); 149 150 /* If away-notify enabled, send status updates when: 151 * Away or Online state changes 152 * Status changes (e.g. "Away" to "Mobile") 153 * Status message changes 154 */ 155 if ((irc->caps & CAP_AWAY_NOTIFY) && 156 ((bu->flags & BEE_USER_AWAY) != (old->flags & BEE_USER_AWAY) || 157 (bu->flags & BEE_USER_ONLINE) != (old->flags & BEE_USER_ONLINE) || 158 (g_strcmp0(bu->status, old->status) != 0) || 159 (g_strcmp0(bu->status_msg, old->status_msg) != 0))) { 160 irc_send_away_notify(iu); 161 } 155 162 156 163 return TRUE; … … 292 299 } 293 300 294 wrapped = word_wrap(msg, 425);301 wrapped = word_wrap(msg, IRC_WORD_WRAP); 295 302 irc_send_msg(src_iu, message_type, dst, wrapped, prefix); 296 303 g_free(wrapped); … … 342 349 } 343 350 344 static gboolean bee_irc_user_nick_update(irc_user_t *iu );351 static gboolean bee_irc_user_nick_update(irc_user_t *iu, gboolean offline_only); 345 352 346 353 static gboolean bee_irc_user_fullname(bee_t *bee, bee_user_t *bu) … … 370 377 } 371 378 372 bee_irc_user_nick_update(iu );379 bee_irc_user_nick_update(iu, TRUE); 373 380 374 381 return TRUE; … … 377 384 static gboolean bee_irc_user_nick_hint(bee_t *bee, bee_user_t *bu, const char *hint) 378 385 { 379 bee_irc_user_nick_update((irc_user_t *) bu->ui_data); 386 bee_irc_user_nick_update((irc_user_t *) bu->ui_data, TRUE); 387 388 return TRUE; 389 } 390 391 static gboolean bee_irc_user_nick_change(bee_t *bee, bee_user_t *bu, const char *nick) 392 { 393 bee_irc_user_nick_update((irc_user_t *) bu->ui_data, FALSE); 380 394 381 395 return TRUE; … … 386 400 irc_user_t *iu = (irc_user_t *) bu->ui_data; 387 401 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 402 395 403 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) 404 bee_irc_user_nick_update(iu, FALSE); 405 406 return TRUE; 407 } 408 409 static gboolean bee_irc_user_nick_update(irc_user_t *iu, gboolean offline_only) 407 410 { 408 411 bee_user_t *bu = iu->bu; 409 412 char *newnick; 410 413 411 if ( bu->flags & BEE_USER_ONLINE) {414 if (offline_only && bu->flags & BEE_USER_ONLINE) { 412 415 /* Ignore if the user is visible already. */ 413 416 return TRUE; … … 432 435 { 433 436 bee_user_t *bu = iu->bu; 434 bee_user_flags_t online;435 437 436 438 if (bu == FALSE) { … … 438 440 } 439 441 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 442 nick_del(bu); 446 bee_irc_user_nick_update(iu); 447 448 bu->flags |= online; 443 bee_irc_user_nick_update(iu, FALSE); 444 449 445 } 450 446 … … 461 457 } 462 458 463 if ((away = irc_user_get_away(iu)) && 459 if (iu->last_channel == NULL && 460 (away = irc_user_get_away(iu)) && 464 461 time(NULL) >= iu->away_reply_timeout) { 465 462 irc_send_num(iu->irc, 301, "%s :%s", iu->nick, away); … … 676 673 } 677 674 678 wrapped = word_wrap(msg, 425);675 wrapped = word_wrap(msg, IRC_WORD_WRAP); 679 676 irc_send_msg(iu, "PRIVMSG", ic->name, wrapped, ts); 680 677 g_free(ts); … … 1146 1143 1147 1144 bee_irc_log, 1145 bee_irc_user_nick_change, 1148 1146 };
Note: See TracChangeset
for help on using the changeset viewer.