Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r3a620ff r73dd021  
    114114        s->flags |= ACC_SET_OFFLINE_ONLY | SET_NULL_OK;
    115115
    116         s = set_add(&acc->set, "carbons", "true", set_eval_bool, acc);
    117         s->flags |= ACC_SET_OFFLINE_ONLY;
    118 
    119116        acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE |
    120117                      ACC_FLAG_HANDLE_DOMAINS;
     
    151148        }
    152149
    153         if (strstr(jd->server, ".facebook.com")) {
    154                 imcb_error(ic, "Facebook's XMPP service is gone. Try this instead: https://wiki.bitlbee.org/HowtoFacebookMQTT");
    155                 imc_logout(ic, FALSE);
    156                 return;
    157         }
    158 
    159150        if ((s = strchr(jd->server, '/'))) {
    160151                *s = 0;
     
    176167                jd->fd = jd->r_inpa = jd->w_inpa = -1;
    177168
    178                 /* There are no other options atm, so assume google for everything
    179                    Facebook and MSN XMPP used to be here. RIP. */
    180                 jd->oauth2_service = &oauth2_service_google;
     169                if (strstr(jd->server, ".facebook.com")) {
     170                        jd->oauth2_service = &oauth2_service_facebook;
     171                } else {
     172                        jd->oauth2_service = &oauth2_service_google;
     173                }
    181174
    182175                oauth_params_parse(&p_in, ic->acc->pass);
     
    204197        } else {
    205198                jabber_connect(ic);
    206         }
    207 }
    208 
    209 static void jabber_xmlconsole_enable(struct im_connection *ic)
    210 {
    211         struct jabber_data *jd = ic->proto_data;
    212         const char *handle = JABBER_XMLCONSOLE_HANDLE;
    213         bee_user_t *bu;
    214        
    215         jd->flags |= JFLAG_XMLCONSOLE;
    216 
    217         if (!(bu = bee_user_by_handle(ic->bee, ic, handle))) {
    218                 bu = bee_user_new(ic->bee, ic, handle, 0);
    219                 bu->flags |= BEE_USER_NOOTR;
    220199        }
    221200}
     
    287266
    288267        if (set_getbool(&acc->set, "xmlconsole")) {
    289                 jabber_xmlconsole_enable(ic);
     268                jd->flags |= JFLAG_XMLCONSOLE;
     269                /* Shouldn't really do this at this stage already, maybe. But
     270                   I think this shouldn't break anything. */
     271                imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL);
    290272        }
    291273
     
    352334        }
    353335        if (jd->fd >= 0) {
    354                 proxy_disconnect(jd->fd);
     336                closesocket(jd->fd);
    355337        }
    356338
     
    363345        }
    364346
    365         if (jd->buddies) {
    366                 jabber_buddy_remove_all(ic);
    367         }
     347        jabber_buddy_remove_all(ic);
    368348
    369349        xt_free(jd->xt);
     
    375355        g_free(jd->internal_jid);
    376356        g_free(jd->gmail_tid);
    377         g_free(jd->muc_host);
    378357        g_free(jd->username);
    379358        g_free(jd->me);
     
    434413        }
    435414
    436         /* XEP-0364 suggests we add message processing hints (XEP-0334) to OTR messages,
    437            mostly to avoid carbons (XEP-0280) and server-side message archiving.
    438            OTR messages are roughly like this: /^\?OTR(.*\?| Error:|:)/
    439            But I'm going to simplify it to messages starting with "?OTR". */
    440         if (g_str_has_prefix(message, "?OTR")) {
    441                 int i;
    442                 char *hints[] = {
    443                         "no-copy", XMLNS_HINTS,
    444                         "no-permanent-store", XMLNS_HINTS,
    445                         "private", XMLNS_CARBONS,
    446                         NULL
    447                 };
    448                        
    449                 for (i = 0; hints[i]; i += 2) {
    450                         struct xt_node *hint;
    451                         hint = xt_new_node(hints[i], NULL, NULL);
    452                         xt_add_attr(hint, "xmlns", hints[i + 1]);
    453                         xt_add_child(node, hint);
    454                 }
    455         }
    456 
    457415        st = jabber_write_packet(ic, node);
    458416        xt_free_node(node);
     
    514472static void jabber_add_buddy(struct im_connection *ic, char *who, char *group)
    515473{
     474        struct jabber_data *jd = ic->proto_data;
     475
    516476        if (g_strcasecmp(who, JABBER_XMLCONSOLE_HANDLE) == 0) {
    517                 jabber_xmlconsole_enable(ic);
     477                jd->flags |= JFLAG_XMLCONSOLE;
     478                imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL);
    518479                return;
    519480        }
     
    559520        }
    560521
    561         if (jd->flags & JFLAG_HIPCHAT && jd->muc_host && !g_str_has_suffix(room, jd->muc_host)) {
    562                 char *guessed_name = hipchat_guess_channel_name(ic, room);
    563                 if (guessed_name) {
    564                         set_setstr(sets, "room", guessed_name);
    565                         g_free(guessed_name);
    566 
    567                         /* call this same function again with the fixed name */
    568                         return jabber_chat_join_(ic, set_getstr(sets, "room"), nick, password, sets);
    569                 }
    570         }
    571 
    572522        if (strchr(room, '@') == NULL) {
    573523                imcb_error(ic, "%s is not a valid Jabber room name. Maybe you mean %s@conference.%s?",
     
    576526                imcb_error(ic, "Already present in chat `%s'", room);
    577527        } else {
    578                 /* jabber_chat_join without the underscore is the conference.c one */
    579528                return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"));
    580529        }
     
    641590{
    642591        struct jabber_data *jd = ic->proto_data;
    643         struct jabber_buddy *bud, *bare;
     592        struct jabber_buddy *bud;
    644593
    645594        /* Enable typing notification related code from now. */
    646595        jd->flags |= JFLAG_WANT_TYPING;
    647596
    648         if ((bud = jabber_buddy_by_jid(ic, who, 0)) == NULL ||
    649             (bare = jabber_buddy_by_jid(ic, who, GET_BUDDY_BARE)) == NULL) {
     597        if ((bud = jabber_buddy_by_jid(ic, who, 0)) == NULL) {
    650598                /* Sending typing notifications to unknown buddies is
    651599                   unsupported for now. Shouldn't be a problem, I think. */
     
    653601        }
    654602
    655 
    656         if (bud->flags & JBFLAG_DOES_XEP85 || bare->flags & JBFLAG_DOES_XEP85) {
     603        if (bud->flags & JBFLAG_DOES_XEP85) {
    657604                /* We're only allowed to send this stuff if we know the other
    658                    side supports it. If the bare JID has the flag, all other
    659                    resources get it, too (That is the case in gtalk) */
     605                   side supports it. */
    660606
    661607                struct xt_node *node;
Note: See TracChangeset for help on using the changeset viewer.