Ignore:
Timestamp:
2015-11-23T17:49:09Z (8 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
ad9ac5d
Parents:
c34247d
Message:

hipchat: 'chat add hipchat "channel name"' now tries to guess the JID

It's basically prepending the organization id, appending the default MUC
host from the success packet, and generating a slug based on the name
for the middle part, which is replacing a few characters with
underscores and doing a unicode aware lowercasing.

Includes tests, which are useless other than validating the initial
implementation with the test vectors that i already tested manually.
Guaranteed to detect zero breakages in the future. Good test code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    rc34247d r9c8dbc7  
    371371        g_free(jd->internal_jid);
    372372        g_free(jd->gmail_tid);
     373        g_free(jd->muc_host);
    373374        g_free(jd->username);
    374375        g_free(jd->me);
     
    533534        }
    534535
     536        if (jd->flags & JFLAG_HIPCHAT && jd->muc_host && !g_str_has_suffix(room, jd->muc_host)) {
     537                char *guessed_name = hipchat_guess_channel_name(ic, room);
     538                if (guessed_name) {
     539                        set_setstr(sets, "room", guessed_name);
     540                        g_free(guessed_name);
     541
     542                        /* call this same function again with the fixed name */
     543                        return jabber_chat_join_(ic, set_getstr(sets, "room"), nick, password, sets);
     544                }
     545        }
     546
    535547        if (strchr(room, '@') == NULL) {
    536548                imcb_error(ic, "%s is not a valid Jabber room name. Maybe you mean %s@conference.%s?",
     
    539551                imcb_error(ic, "Already present in chat `%s'", room);
    540552        } else {
     553                /* jabber_chat_join without the underscore is the conference.c one */
    541554                return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"));
    542555        }
Note: See TracChangeset for help on using the changeset viewer.