Changes in protocols/jabber/jabber.c [3a620ff:73dd021]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r3a620ff r73dd021 114 114 s->flags |= ACC_SET_OFFLINE_ONLY | SET_NULL_OK; 115 115 116 s = set_add(&acc->set, "carbons", "true", set_eval_bool, acc);117 s->flags |= ACC_SET_OFFLINE_ONLY;118 119 116 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE | 120 117 ACC_FLAG_HANDLE_DOMAINS; … … 151 148 } 152 149 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 159 150 if ((s = strchr(jd->server, '/'))) { 160 151 *s = 0; … … 176 167 jd->fd = jd->r_inpa = jd->w_inpa = -1; 177 168 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 } 181 174 182 175 oauth_params_parse(&p_in, ic->acc->pass); … … 204 197 } else { 205 198 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;220 199 } 221 200 } … … 287 266 288 267 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); 290 272 } 291 273 … … 352 334 } 353 335 if (jd->fd >= 0) { 354 proxy_disconnect(jd->fd);336 closesocket(jd->fd); 355 337 } 356 338 … … 363 345 } 364 346 365 if (jd->buddies) { 366 jabber_buddy_remove_all(ic); 367 } 347 jabber_buddy_remove_all(ic); 368 348 369 349 xt_free(jd->xt); … … 375 355 g_free(jd->internal_jid); 376 356 g_free(jd->gmail_tid); 377 g_free(jd->muc_host);378 357 g_free(jd->username); 379 358 g_free(jd->me); … … 434 413 } 435 414 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 NULL447 };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 457 415 st = jabber_write_packet(ic, node); 458 416 xt_free_node(node); … … 514 472 static void jabber_add_buddy(struct im_connection *ic, char *who, char *group) 515 473 { 474 struct jabber_data *jd = ic->proto_data; 475 516 476 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); 518 479 return; 519 480 } … … 559 520 } 560 521 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 572 522 if (strchr(room, '@') == NULL) { 573 523 imcb_error(ic, "%s is not a valid Jabber room name. Maybe you mean %s@conference.%s?", … … 576 526 imcb_error(ic, "Already present in chat `%s'", room); 577 527 } else { 578 /* jabber_chat_join without the underscore is the conference.c one */579 528 return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password")); 580 529 } … … 641 590 { 642 591 struct jabber_data *jd = ic->proto_data; 643 struct jabber_buddy *bud , *bare;592 struct jabber_buddy *bud; 644 593 645 594 /* Enable typing notification related code from now. */ 646 595 jd->flags |= JFLAG_WANT_TYPING; 647 596 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) { 650 598 /* Sending typing notifications to unknown buddies is 651 599 unsupported for now. Shouldn't be a problem, I think. */ … … 653 601 } 654 602 655 656 if (bud->flags & JBFLAG_DOES_XEP85 || bare->flags & JBFLAG_DOES_XEP85) { 603 if (bud->flags & JBFLAG_DOES_XEP85) { 657 604 /* 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. */ 660 606 661 607 struct xt_node *node;
Note: See TracChangeset
for help on using the changeset viewer.