Changeset a42fda4 for protocols/nogaim.c


Ignore:
Timestamp:
2016-03-20T03:58:05Z (5 years ago)
Author:
dequis <dx@…>
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)
Message:

Add imcb_buddy_nick_change(), like nick_hint but stronger

nick_hint only works when creating new users, it's a no-op after the
user is online. This new function takes care of nick changes after that.

It also helps clean up couple of hacks in irc_im.c \o/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r14f912d ra42fda4  
    479479}
    480480
    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' */
     482static void buddy_nick_hint_or_change(struct im_connection *ic, const char *handle, const char *nick, gboolean change)
    484483{
    485484        bee_t *bee = ic->bee;
     
    493492        bu->nick = g_strdup(nick);
    494493
    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) {
    496497                bee->ui->user_nick_hint(bee, bu, nick);
    497498        }
    498499}
    499500
     501/* Soft variant, for newly created users. Does nothing if it's already online */
     502void 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 */
     508void 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}
    500512
    501513struct imcb_ask_cb_data {
Note: See TracChangeset for help on using the changeset viewer.