Commit Graph

30 Commits

Author SHA1 Message Date
Alcaro 42550cc33c
Fix paste_buffer 2019-09-28 11:35:52 +02:00
Artem Savkov 167450a870 Remove account-wide nonce
Now that we have per-message nonces we can remove the account-wide one.
2018-11-30 20:35:48 +01:00
Artem Savkov dc4e7a3c51 Make nonces unique
Send every message with a unique nonce saving and saving it in a
hashtable making sure we don't echo back our own messages.

Commit is based on a patch contributed by Trecourt Nicolas, thank you!

Fixes: #182
2018-11-30 20:32:14 +01:00
dequis 5bbbdcedab discord_canonize_name: Use str_reject_chars from bitlbee instead of a regex 2018-07-03 02:00:36 -03:00
Alcaro 19e0c63101 Add timestamp support
Discord sends message times which are useful in case of pinned/backlog messages, relay those to bitlbee so that it can timestamp messages like this.

Fixes: #152
2018-05-26 08:54:30 +02:00
Artem Savkov 063c8bb68a Keep track of session_id
Session_id is used to resume connection, write it down on connect.
2018-02-13 22:24:34 +01:00
Artem Savkov 24601035a1 Handle rate limiting
If the client sends http requests too fast discord will start
rate-limiting those asking to retry after some time. Do that instead of
failing the request.
2017-12-27 17:13:53 +01:00
arcnmx 0a2219acfa Group DMs (fixes #54) 2017-11-27 13:30:21 -05:00
Mickaël Thomas 0dd772784f Enable self messages (#103)
Messages sent from another discord client will now appear as if you sent
them from Bitlbee.

See https://wiki.bitlbee.org/SelfMessages for more information about
this feature.

Fixes: #7
2017-09-22 22:05:08 +02:00
dequis 945c77af05 Make server_prefix_len truncate by utf8 characters instead of bytes
Fixes issues with invalid utf8 in servers that start their names with
unicode characters (like emoji)

Oddly enough there's no glib function for this, and bitlbee's
truncate_utf8() does the opposite of what we need to do here (truncates
by bytes instead of characters and ensures those bytes are valid utf8)
2017-05-29 00:55:47 -03:00
Artem Savkov ad5b27bcc4 Use proper conversion specifiers in prints.
Using wrong conversion specifiers led to segfaults in g_strdup_vprintf()
on arm.

Fixes: #83
2017-05-20 13:53:24 +02:00
dequis 0b883a132c Change bitlbee includes from <bitlbee/*.h> to <*.h>
This is unfortunate (given the somewhat generic header names) but that's
how it should be used to support non-system-wide installs.

With the previous include set up, building this plugin only worked when
bitlbee's headers were in /usr/include/bitlbee, because /usr/include is
in the default include path and the -I/usr/include/bitlbee is unused
(because /usr/include/bitlbee/bitlbee does not exist)

Likely related to #77
2017-04-26 01:39:14 -03:00
Artem Savkov 88de238b83 Detect (un)pins properly.
Now that we have a list of pinned messages we can use it to track
pin/unpin changes and output proper prefixes.
2017-02-14 17:21:35 +01:00
Artem Savkov 6ba03f75ec Add fetch_pinned option.
Add an option to fetch pinned messages on channel join. As a sideeffect
we now account for lingering http requests and cancel them on logout.
This might have caused an occasional segfault when we get logged out
while some http request was still pending.
2017-02-14 15:07:06 +01:00
Artem Savkov 3338ea787b Debugging updates.
Switch from --enable-debug config option to BITLBEE_DEBUG env var to be
consistent with bitlbee. This allows us to remove some of the http printouts
as bitlbee will do it itself. Also adding account username to debug
output to distinguish traffic between accs.
2017-01-19 13:57:26 +01:00
Artem Savkov 88460d0e04 Merge branch 'master' into listchan 2016-12-07 14:55:11 +01:00
Artem Savkov 5cec9607f1 Fix renamed nick mentions.
Use irc name to look for users while parsing mentions or opening new direct
messages. This fixes issues #56 and #45.
2016-12-07 14:52:24 +01:00
Artem Savkov 9238062d82 List chats functionality.
Do not autojoin every channel that is advertised. Instead use "chat list"
command to add/join them one by one.
2016-10-05 14:02:33 +02:00
Artem Savkov c4f3426a3d Replace newlines with a space.
Replace newlines with a space instead of just removing it, since most of the
text pasted doesn't have trailing spaces and it looks weird after removing
newlines.
2016-08-18 16:09:06 +02:00
Artem Savkov 2d27e5eddc Strip out newlines in discord_escape_string.
Strip out \r and \n characters in discord_escape_string as those break json.
2016-08-16 12:49:56 +02:00
Artem Savkov bae729a009 Escape away strings as well.
Previously only outgoing messages were escaped, leaving characters like '"'
unusable in away messages.
2016-04-18 18:35:48 +02:00
Artem Savkov af442af9b8 Add support for outgoing #channel links.
Works the same way as @nick mentions, and is affected by mention_ignorecase
option.
2016-01-15 20:23:39 +01:00
Artem Savkov 9f9951c20a Add an option to ignore case when matching outgoing mentions.
Some of the nicks have casing that is a pain to type without
tabcompletion(can happen when user is offline), this commits adds a
"mention_ignorecase" option that can be enabled to ignore case when looking for
mentions.
2016-01-15 16:27:59 +01:00
Artem Savkov 2cc66576af Better support for non-canonical names.
Instead of relying on bitlbee to do this bitlbee-discord will now canonize (or
try to) nicknames itself. This fixes outgoing mentions for nicknames with
spaces.
2016-01-12 16:35:08 +01:00
Artem Savkov 1b0847ee28 Properly parse gateway websocket url.
Previously I just assumed that the path in gateway url will always be "/" and
that it will always use secure connection. Latest discord changes proved me
wrong. Properly parsing the url now.
2016-01-12 13:57:05 +01:00
Artem Savkov 32c412e230 Add outgoing mentions support.
This commit adds automatic conversion of outgoing messages from irc-style
highlighting (e.g. "nick:") to discord's "<@id>" format.  New "mention_suffix"
option is added.
Outgoing mentions currently won't work with names containing spaces.

Fixes: issue #9.
2016-01-12 10:38:43 +01:00
Artem Savkov 9990487e54 Add license info 2015-12-16 11:25:16 +01:00
Artem Savkov 432767279a Get user/channel info through functions from discrod-util.
Do not traverse the lists by hand, use get_*_by_id functions from discord-util.
This adds get_user_by_id and changes get_channel_by_id to traverse all servers
in case no server is specified.
2015-12-12 12:02:02 +01:00
Artem Savkov 978e3de1e4 Keep track of voice channels as well.
Get info and keep it in server_info channel list about voice channels. This
might later be used to somehow (imcb_log or nick changes) indicate buddies
being in voice channels (specific or in general).
2015-12-08 23:07:47 +01:00
Artem Savkov 19da06c348 Refactor all the things.
Split this huge prototyping mess in a single lump into separate files. Better
do this early then never.
2015-12-05 18:28:53 +01:00