aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber
Commit message (Collapse)AuthorAgeLines
* jabber: Add "always_use_nicks" setting, for non-anonymous MUCsdequis2016-03-20-4/+21
| | | | | | | | | Basically the same thing as github PR #55, which fixes trac bug 415, but this one conditionalized that behavior and uses the API introduced a few commits ago. I didn't think too much about the setting name and i'm open to changing it to anything else
* jabber: Fix leak in jabber_si_set_proxiesdequis2016-03-20-0/+2
|
* jabber: Properly handle rejected file transfersdequis2016-03-20-20/+32
|
* jabber: Check for other resources before removing someone from a chatdequis2016-03-20-1/+14
| | | | | | So if someone has several connections with several clients to a chat, they won't appear as leaving from the chat until they leave from the last client.
* jabber: return XT_ABORT after failed IQ auth attemptsdequis2016-03-12-2/+2
|
* jabber: Mark messages from other resources as OPT_SELFMESSAGE toodequis2016-01-24-1/+3
| | | | | | | The jabber_buddy used for messages sent from other resources connected to the same groupchat has a different ext_jid and it's a different object than jc->me, so doing a string comparison against acc->user is needed.
* Revert "hipchat: Implement their own variant of self-messages [...]"dequis2016-01-21-19/+1
| | | | | | | This reverts commit d11ccbf6ea94264bde8b0f525c4bbedf50de0174. After thinking about this long enough I've decided this is a bad idea, and better wait for the hipchat server to support carbons.
* hipchat: Implement their own variant of self-messages (not working yet)dequis2015-12-16-1/+19
| | | | | | | | | | | | Reuses part of the carbons code, but it's not like it at all. To be able to receive these messages at all, a different cap node whitelisted by them is required. I could have used one of the official clients, but let's try to get things done the right way. This will start working once they make that change in their servers, right now this is still in their ticket backlog. I'm merging this now because it's harmless and nice to have as part of the upcoming release.
* jabber: Add message processing hints to OTR messages (XEP-0334/0364)dequis2015-12-15-0/+22
| | | | | This prevents them from being stored or copied to other clients when carbons are enabled.
* Remove facebook XMPP code, show error pointing at the new plugindequis2015-12-04-45/+12
| | | | | | | | | | | | | | Facebook's oauth has been broken for months, and in the last few days they broke plain logins too, so I just added an error message that says this when you do "account on": Facebook's XMPP service is gone. Try this instead: https://wiki.bitlbee.org/HowtoFacebookMQTT Also nuked all the oauth related code, except some parts of lib/oauth2.c which seemed generic enough to maybe help in the future with other not-really-compliant not-really-implementations of the not-really-oauth2 not-really-spec
* jabber: Reply unknown IQs with service-unavailable insteaddequis2015-11-25-4/+6
| | | | | | | | | | | It was sending 'feature-not-implemented' for <query> with unknown xmlns (which makes sense, but the RFC says that's wrong. idk.) and nothing at all for IQs that don't have query/ping/time elements or an xmlns attribute. Both get service-unavailable now. Addresses the rest of trac ticket 533: https://bugs.bitlbee.org/bitlbee/ticket/533
* jabber: Fix detection of away state in choose_priority()dequis2015-11-24-1/+1
| | | | | | | | | | | | Thanks to this clang warning: comparison of array 'jd->away_state->code' not equal to a null pointer is always true [-Wtautological-pointer-compare] Although... given how ->code is offset 0, that might have worked sometimes if jd->away_state is null, assuming a compiler that doesn't hate humanity. Sadly, that is not something we can safely assume. I bet gcc saw this and thought "let's optimize your poor soul away".
* hipchat: 'chat add hipchat "channel name"' now tries to guess the JIDdequis2015-11-23-0/+67
| | | | | | | | | | | 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.
* jabber_chat_join_failed: add a null check before freeing the chatdequis2015-11-23-1/+4
| | | | | | Had this one in a stash, i think it's about trying to join a channel with an invalid JID and getting an error with a different JID back, so doing jabber_chat_by_jid() doesn't find it.
* jabber: Implement carbons (XEP-0280)dequis2015-11-21-8/+90
| | | | | | | | | | | | | | "Message carbons" (XEP-0280) is a server feature to get copies of outgoing messages sent from other clients connected to the same account. It's not widely supported by most public XMPP servers (easier if you host your own), but this will probably change in the next few years. This is enabled by default if the server supports it. It can also be disabled with the "carbons" account setting. Loosely based on a patch by kormat from trac ticket 1021. (Thanks!) I moved stuff around, simplified things, fixed a few bugs, and used the new self-messages feature.
* Nuke imcb_clean_handle(), which was merging handles accidentallydequis2015-11-09-3/+0
| | | | | | | | | | | | | | | | Well, just deprecated and turned into a no-op. It was only used for jabber anonymous MUCs, but this is something the IRC layer must take care of. It stripped all whitespace, control and non-ascii characters, breaking utf8 nicks support and accidentally merging contacts whose cleaned-up handles were the same string. For example, you could have two users with nicks ' ' and ' ' (one and two spaces respectively) and imcb_clean_handle() would just merge them into a single handle, '', which makes them look like a single irc user. The same thing happens with nicks that are entirely made of utf8. Thanks to schoppenhauer from #bitlbee for reporting this and preparing a test case channel!
* jabber: Don't reply XEP-0184 receipts sent over MUCsdequis2015-10-30-7/+8
| | | | | XEP-0184 section 5.3 says those shouldn't be sent over MUCs, but some misbehaving clients do anyway, resulting in 'forbidden' errors
* jabber: Self message handling (echo removal) in MUCsdequis2015-10-30-11/+16
| | | | | | | | | | | | | | | | | | | | | XMPP MUCs always echo own messages, and send messages from other clients. So, we must display everything except the messages we just sent. This implementation uses the jabber stanza cache to add an ID to the message and attach it to a callback which always returns XT_ABORT. This way, if we do get the echo, the message packet handler can call jabber_cache_handle_packet(), and if it returns XT_ABORT, it can skip that particular message. Every other message that looks like it comes from our own JID and wasn't handled by the cache will be displayed, with the OPT_SELFMESSAGE flag Stanza cache entries expire after some time, so it's not a problem if the server doesn't echo messages for some reason. I actually wrote this forever ago, for hipchat, but it works the same way for standard XMPP MUCs.
* Use proxy_disconnect() in http, ssl, jabber, oscardequis2015-10-26-1/+1
| | | | | | | | | | Twitter and MSN are all HTTP/SSL, so they don't need it either. The out of tree facebook and steam plugins are also covered by the HTTP/SSL changes. Yahoo is written in a weird way and doesn't seem to need it (it seems it doesn't immediately stop connections when you tell it to logout)
* jabber: set BEE_USER_NOOTR flag to _xmlconsoledequis2015-10-21-8/+16
| | | | | | | Fixes trac ticket 1111, https://bugs.bitlbee.org/bitlbee/ticket/1111 One of the most annoying issues. You're trying to debug stuff and it just crashes even harder than without the debug enabled.
* jabber: Fix XEP85 detection (typing) between two bitlbee usersdequis2015-10-21-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes trac ticket 1143: https://bugs.bitlbee.org/bitlbee/ticket/1143 The "correct" way to discover XEP85 support is to send a discovery query. We take a more conservative approach: if the irc client claims to support typing (by sending CTCP TYPING at least once), we send an <active> tag along with next chat message, and set JBFLAG_PROBED_XEP85. The logic for that stuff is in jabber_buddy_msg(). That's all neat and clever and actually works fine. What was broken was the detection side. Whenever a <composing>, <active> or <pause> is received, the buddy is marked as supporting XEP85. However the <active> tag had an additional check: /* No need to send a "stopped typing" signal when there's a message. */ else if (xt_find_node(node->children, "active") && (body == NULL)) { It skipped the tag completely if it had a message too. This was changed to move the body == NULL condition inside, so that the flag is set. Took me longer to write this message than the diff itself. But even longer to actually decide to debug this behavior. I'm the one who submitted that ticket, one year and a half ago. Yep.
* jabber: Fix outgoing google talk typing notificationsdequis2015-10-21-4/+7
| | | | | | | | | | | Since bare JIDs from typing notifications are now accepted, the other buddy objects never get the flag JBFLAG_DOES_XEP85 set. This fixes it by checking both the buddy with resource and the bare one, with the implication that if the bare JID has that flag, all other resources get typing notifications. Follow up to the previous commit, splitting since they are actually unrelated fixes, although this one is a consequence of the previous one.
* jabber: Fix incoming google talk typing notificationsdequis2015-10-21-1/+5
| | | | | | | | | | | | | | | | | | | | | | | jabber_buddy_by_jid() does the following: head = g_hash_table_lookup(jd->buddies, jid); bud = (head && head->next) ? head->next : head; 'head' has the one without resource, 'bud' has the first resource. So if a resource is available, it uses it and ignores the head. When asked for a bare JID (with no resource) and GET_BUDDY_EXACT, it shouldn't do this, but it should return the head. In other words, the problem was a message in this format: <message from="username@gmail.com" ...> Instead of <message from="username@gmail.com/resource" ...> This only deals with incoming typing notifications. See next commit.
* jabber: Fix leak in jabber_gmail_handle_newdequis2015-10-08-2/+2
| | | | | | | From coverity. That g_strdup_printf() was really pointless, slightly ashamed we didn't notice that in the review of the patch.
* jabber: fix null handling with MUC topicsdequis2015-10-08-1/+2
| | | | From coverity.
* jabber: Improvements to the MUC part reason handlingdequis2015-08-26-15/+26
| | | | | | | - Look for a status message right inside <presence> (seen with ejabberd as a result of a s2s connection error) - Check status codes in a while loop, skipping unknown ones (such as 110, which means "Inform user that presence refers to itself")
* jabber/io: Split input buffer parsing to a jabber_feed_input() functiondequis2015-08-26-51/+71
| | | | | | | | | | | To simplify testing. Also allow passing a -1 as size to use strlen() Minor behavior change: The jabber_init_iq_auth() branch can no longer return immediately, which means it will continue through the ssl_pending() check in jabber_read_callback(). Other than that, the size -1 change, and one indentation level less, the function body is the same as before.
* jabber_logout: avoid null jd->buddies warnings in jabber_buddy_remove_alldequis2015-08-08-1/+3
|
* jabber: Show MUC kick/ban/leave reasonsdequis2015-08-08-2/+34
|
* typofix - https://github.com/vlajos/misspell_fixerVeres Lajos2015-08-07-5/+5
|
* Only try DIGEST-MD5 if there's no SSL/TLS or if PLAIN isn't supporteddequis2015-07-30-1/+5
| | | | | | | Which in practice means "don't bother with DIGEST-MD5 most of the time". It's weak, pointless over TLS, and often breaks with some servers (hi openfire)
* jabber: Add SASL ANONYMOUS support (XEP-0175)dequis2015-07-04-3/+18
| | | | Use "account jabber set anonymous on" to have bitlbee try that method
* jabber/s5bytestream: add G_GNUC_PRINTF to jabber_bs_abortdequis2015-06-28-1/+1
|
* Rename mail notification related settings for consistencydequis2015-05-28-7/+9
| | | | | - GMail notifications stuff is now just 'mail_notifications' - sed -i s/notify_handle/mail_notifications_handle/
* imcb_notify_email: change parameters to take a format stringdequis2015-05-28-5/+1
| | | | | | | Saves some messing with g_strdup_printf for the callers, and flags/sent_at weren't used anyway. Also check if the mail_notifications setting is enabled
* Simplify display of gmail notificationsdequis2015-05-28-18/+16
| | | | | | | | - Add gmail_notifications_limit hidden setting, set to 5 by default. - Don't show "snippets" in email notifications. Not very useful and they make the whole thing seem too spammy - Show sender name instead of your own email - Default values for empty subject / sender
* Gmail notifications support through new imcb_notify_email() APIArtem Savkov2015-05-28-0/+151
|
* jabber: Refactor conference message handlingdequis2015-05-28-55/+82
| | | | | | | | - Improve handling of "unknown 'from'" - Try a bit harder to detect the source of the message, and fall back to messages sent from a fake temporary user. - Fix receiving topic when it was set by someone who left the room. - Add jabber_get_bare_jid() utility function
* Lowering xmpp presence priority on away.Artem Savkov2015-05-28-1/+19
| | | | | When user set's away lower xmpp presence priority by 5 as most clients do, new priority won't go below zero though.
* More coverity fixes!dequis2015-05-07-1/+1
| | | | | | | | | | CID 18634: 'Logically dead code' in jabber_get_info CID 18638: 'Dereference after null check' in oauth2_access_token_done CID 18691: 'Copy into fixed size buffer' in bee_irc_user_new CID 20274: Leak in bee_irc_chat_invite CID 20297, CID 20283: Leaks in crypt_main Some the base64 leaks there weren't detected, needs modeling.
* hipchat: Basic implementation: Auth, profile and mention namesdequis2015-04-28-11/+148
| | | | | | | | This is enough to log in with their usernames, make 'chat add' based groupchat joins slightly more smooth, and see mention names as nicks. All the MUC list stuff is left out intentionally since that's not as stable as I wish.
* jabber: Register "hipchat" protocol (only minimal support for now)dequis2015-04-21-2/+17
| | | | | | | | | | | | | | | | | | | Another take on the subprotocols idea that, IMO, was a failure. Unlike the other implementation, this one doesn't touch gtalk/facebook accounts, it just adds another copy of the "jabber" prpl called "hipchat". And, based on the protocol name: - sets JFLAG_HIPCHAT to jabber_data - sets the default value of the "server" setting - only includes the oauth setting for jabber-type accounts This is slightly more "hardcoded" but honestly facebook and gtalk are just as hardcoded as this. Copying the prpl is needed because the meaning of the usernames is completely different (there's no srv lookup stuff either)
* jabber: Fixed null deref when receiving <subject> from oneselfdequis2015-04-03-2/+2
| | | | | | | | If the from="..." of the message that includes a subject refers to us, that buddy object won't have an ext_jid set, and passing that to strchr() results in pain. This happens with recent versions of an xmpp server called "lets-chat".
* Fix a bunch of memory leaksdequis2015-03-22-0/+1
| | | | | | | | | | | | | | | | | | | - irc_im.c: - bee_irc_user_msg: strdup leaks when otr swallows messages - bee_irc_user_action_response: GString leak in all ctcp replies - otr.c: - call g_slist_free() on the list of the otr_policy setting - otr_filter_msg_in: call otrl_tlv_free() if "tlvs" are returned - otr_filter_msg_out: don't g_strdup() if the message should be ignored - log_otr_message: g_strdup_vprintf() leaks always - nogaim.c: - imcb_ask_auth/imcb_ask_add: leaks in g_strdup_printf() - imcb_ask_add leaks imcb_ask_cb_data if the user already exists - add imcb_ask_cb_free() to correctly free its data - msn_util.c: add msn_buddy_ask_free(), ditto - storage_xml.c: pass_cr/password if base64_decode or arc_decode fail - ssl_gnutls.c: conn->hostname leak in error conditions, like invalid certs - jabber_util.c: jabber_buddy_by_ext_jid() leaks jid if it's not an ext jid
* Use https:// URL for Facebook OAuth2 now that there's a cert.Wilmer van der Gaast2015-02-24-1/+1
|
* s5bytestream: fix segfault (cleanup before trying next streamhost)dequis2015-02-22-14/+27
| | | | | | | | | | | | | | | | | | | | | | | | This segfault happened when none of the available streamhosts can be connected to - or if at least one of them fails to connect. Before this commit, it can be reproduced reliably by setting the "proxy" setting of the account to nonsense, for example, this is what i used: proxy.example.org,1.2.3.4,7777;proxy.example.com,173.194.42.65,80 jabber_bs_recv_handshake_abort() calls jabber_bs_recv_handshake(), which is supposed to restart the handshake with the next streamhost. And it replaced bt->tf->watch_out, which held an event ID, with a newer event ID. So the replaced event ID doesn't get removed, and it gets called again when its socket is closed by the timeout - and by the time that happens, the memory is free()'d already. Boom. The patch is simple - created jabber_bs_remove_events() to cleanup those events, and use it before any code that expects to restart the cycle. So basically the same as doing b_event_remove(bt->tf->watch_out). I hope there aren't more bugs like this in this code.
* s5bytestream: refactor some copypasted code into functionsdequis2015-02-22-89/+47
| | | | | | | | | - get_ft_by_sid() - generate_pseudoaddr() (also uses g_compute_checksum_for_string() to make the code shorter) - jabber_streamhost_new() Behavior should be the same.
* Reindent everything to K&R style with tabsIndent2015-02-20-3442/+3326
| | | | | | | Used uncrustify, with the configuration file in ./doc/uncrustify.cfg Commit author set to "Indent <please@skip.me>" so that it's easier to skip while doing git blame.
* Use glib's GChecksum for md5/sha1dequis2015-01-31-1/+3
| | | | | | | | | | | | | | | | | | | This changes behavior slightly: - md5_init()/sha1_init() allocate a GChecksum - md5_finish()/sha1_finish() close and free() it - md5_digest_keep() was added (no sha1 equivalent needed) And yes, glib has this concept of "closing" the GChecksum, which means it can't be used anymore after g_checksum_get_digest(). jabber_cache_add() actually seems to need to do that to generate some random-ish values, so i kept that working by adding a md5_digest_keep() function that copies the GChecksum before it gets closed GChecksum was introduced in glib 2.16, so the configure script version was bumped. We were already depending on glib 2.16 accidentally (some post-3.2.2 code uses GHashTableIter)
* jabber: Account-wide display_name setting, for groupchatsdequis2015-01-25-1/+11
| | | | | This sets the default value of 'nick' for newly created groupchats. There is no way to set an account-wide nick.