Commit Graph

275 Commits

Author SHA1 Message Date
Artem Savkov 607f9887ca Fix empty gateway->path with glib > 2.68
Starting with glib 2.69 g_match_info_fetch() returns an empty string
instead of NULL in case when no match was found. Properly handle this
case.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2021-09-28 18:38:48 +02:00
Artem Savkov eb768b4a81 Additional debuginfo on websocket upgrade
As mentioned in #226 there is some issue with newer glib versions. Add
the dump of our request for websocket upgrade to see if that'll make
things clearer.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2021-09-28 16:13:14 +02:00
Artem Savkov 068ed17a75 Basic implementation of discord's replies
No configuration, no proper parsing of the replied to message, nothing.
This is a quick and dirty implementation for replies. On reply this will
display the first 50 characters of the replied to message along with
original authors name and hardcoded IN_REPLY_TO prefix.

Fixes: #215

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2021-08-19 13:47:12 +02:00
Artem Savkov 48e96efb86
Update README.md
Conversion to md broke some things. Trying to make it more readable.
2020-08-21 11:35:06 +02:00
Artem Savkov 7bf6a5e2bd
Merge pull request #209 from NickSeagull/patch-1
Update and rename README to README.md
2020-08-16 20:20:49 +02:00
Nick Tchayka 5262b7acfa
Update and rename README to README.md
Fixes #206
2020-08-15 20:38:01 +01:00
Artem Savkov 7dd4bee918 Add verbosity toggle
Add a switch to turn off some of the unnecessary messages in control
channel.

Fixes: #207

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
2020-06-21 09:52:08 +02:00
Artem Savkov 9466079361 Bump version to 0.4.3
Bumping version since discord removed GUILD_SYNC which we relied on
breaking 0.4.2 in the process.
2020-03-31 22:20:38 +02:00
Artem Savkov 3061edd283
Merge pull request #203 from tricon/readme-account-off
Correct command in README
2020-02-16 18:43:29 +01:00
David Aaron Fendley a120a84e0f
Correct command in README
Command is actually: `account discord off`
2020-02-16 02:18:22 -06:00
Artem Savkov 69e16be9d1 Call imcb_connected only after we parsed the whole READY message
Do not call imcb_connceted prematurely as it breaks group dms for
instance.

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
2020-02-07 23:23:45 +01:00
Artem Savkov 3a300cd417 Sync private groups as well
Turns out opcode 13 is responsible for syncing private group DMs. Ask
for that on join. Don't have any way to check it currently, just hoping
it will return a familiar message.
2020-02-07 21:59:25 +01:00
Artem Savkov 1b9870a0ea Per-channel sync
Discord no longer seems to support per-guild sync, but per-channel sync
was added. Switch to that syncing user lists on channel join.

Fixes: #201

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
2020-02-06 13:32:26 +01:00
Artem Savkov 6500934bba Remove pending sync var
Since we are no longer syncing on connect - remove unused pending sync
variable.

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
2020-02-06 11:21:21 +01:00
Artem Savkov 44eab7466b Don't wait for GUILD_SYNC on login
For whatever reason discord stopped responding to REQUEST_SYNC
opcode(12) so we timeout on login. Temporary ignore the issue and assume
we have completed connections even though we are missing guild info.

I am no longer sure of the full list of effects this will have, we will
surely lose guild presence info.

This is a workaround for #201 and should be reverted once that is
properly fixed.

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
2020-02-05 21:47:22 +01:00
Artem Savkov b26bc599e4
Merge pull request #200 from kensanata/cygwin
Add BITLBEE_LIBS to discord_la_LDFLAGS
2020-01-27 11:45:51 +01:00
Alex Schroeder d4760a8d2d Add BITLBEE_LIBS to discord_la_LDFLAGS
This allows people to build on Cygwin.
2020-01-27 10:53:39 +01:00
Artem Savkov bc967eb6ab
Merge pull request #196 from Alcaro/patch-6
Fix paste_buffer
2019-12-08 10:51:35 +01:00
Alcaro 42550cc33c
Fix paste_buffer 2019-09-28 11:35:52 +02:00
Artem Savkov aa0bbf2df8 Bump version to 0.4.2
This release contains mostly fixes to catch up with recent changes in
the way discord operates plus a couple of new convenience options.
2018-12-04 18:45:11 +01: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
Artem Savkov d020155446 Revert "Emergency workaround for message send failures."
This reverts commit 8c81103d6e.
2018-11-30 19:37:35 +01:00
Artem Savkov 8c81103d6e Emergency workaround for message send failures.
This is a temporary workaround for #182, which, unfortunately, brings #7
back. This will have to do until a proper fix is ready.
2018-11-30 08:37:52 +01:00
Artem Savkov 2aec1fc456 websockets: handel SSL_AGAIN in non-connecting state
While it is harder to properly andle SSL_AGAIN in states other than
WS_CONNECTING first ssl_read is the same, so at least handle it
properly.
2018-11-14 19:47:21 +01:00
Artem Savkov 10073221cc websockets: continue logging in on SSL_AGAIN
It is possible for ssl_read to fail with SSL_AGAIN errno and in this
case we should just continue logging in instead of failing right away.
2018-11-14 19:42:04 +01:00
Artem Savkov 8eee0b713f Additional debuginfo on websocket switch failure.
Print-out whatever we read from ssl on failure to switch to websocket so
we can tell what is going on. This is mainly here to help debug #180 but
should be useful in future as well.
2018-11-14 15:52:24 +01:00
Artem Savkov 8f7f57eaf2
Merge pull request #177 from dgw/155-real-name
Set user real name to untouched nickname
2018-10-11 17:01:59 +02:00
dgw aeb95cec77 Set user real name to untouched nickname
Users' true (global) names will be available in WHOIS output and in
clients that display real names in the chat view, etc.

See / resolves #155
2018-10-11 00:16:16 -05:00
Artem Savkov ba47eed85a Add auto_join* option description to readme
When auto_join and auto_join_exclude were added their description was
added to the docs, but not to the README file. Copy paste that for
everyone to see.
2018-08-26 20:31:13 +02:00
kat 3e7c694bf9 Fixed crashing problems upon rejecting more than one friend request. (#172)
I think this is caused by uinf and uinf->user being a null pointer. Not really sure why that is, but this fixes the crash that would otherwise cause. I imagine it's because the user has never actually existed within the bitlbee user list and therefore doesn't need updating, but the real question is why it works for the first rejection but not the second.

I also slightly cleaned it up so uinf is defined before usage in either case, meaning there's only one definition statement.
2018-08-21 19:01:33 +02:00
kat 967df38048 Added fixes for crashing upon somebody removing you from their friends. (#171)
Before these fixes, RELATIONSHIP_REMOVE would cause a segfault. My understanding of this, is that RELATIONSHIP_REMOVE's json looks like: {"t":"RELATIONSHIP_REMOVE","s":97,"op":0,"d":{"type":1,"id":"<removed>"}} and this is the primary cause of this problem.

In the original code, json_value *uinfo = json_o_get(rinfo, "user"); would lead to a null pointer being fed into discord_canonize_name as char *name = discord_canonize_name(json_o_str(uinfo, "username")); has no handling for being fed a null pointer. 

Instead of adding in specific null pointer handling, I reworked it to get the ID from the request and to use get_user to get the user from that, instead.
2018-08-21 13:39:25 +02:00
Artem Savkov fd8213fbd9 Add "emoji_urls" boolean option
Add an option to control whether to show emoji urls next to the text
alias or not.

Fixes: #169
2018-07-25 16:34:09 +02:00
Artem Savkov ea210b62c4
Merge pull request #168 from Alcaro/patch-5
Let's tell what message failed to send
2018-07-18 18:22:24 +02:00
Alcaro 898302e99d Let's tell what message failed to send
This helps avoid wasted time in the other Discord client looking for which message is missing - especially in the case where the HTTP server reports failure, but the message actually arrived.
2018-07-18 17:29:13 +02:00
Alcaro fb58d48b79 Accept custom emotes in private message too (#166)
Handle mentions/emojis for both private and group channels.

Fixes #143
2018-07-11 21:15:40 +02:00
Artem Savkov 8848289491
Merge pull request #164 from dequis/faster-canonize-name
discord_canonize_name: Use str_reject_chars from bitlbee instead of a regex
2018-07-03 12:36:53 +02:00
dequis 5bbbdcedab discord_canonize_name: Use str_reject_chars from bitlbee instead of a regex 2018-07-03 02:00:36 -03:00
Artem Savkov b69685d568 set default away status to 'idle'
Starting with 98f3893 we support multiple awat statuses, that commit
changed the default away status to "online", resulting in commands like
'/away food' working the same way as 'set status food', i.e. leaving the
person in online state, but with a message set.
Change the default away status to 'idle' as it worked previously, this
should fix #161.
2018-06-24 10:55:17 +02:00
Artem Savkov 870ead9c90 Add always_afk option
Add an option to always report client's status as afk, this will
hopefuly force push notifications to be delivered to other clients when
bitlbee is connected. See #131 for more info.
2018-06-03 22:47:33 +02:00
ecx86 98f3893512 Set away status (#158)
Allow setting statuses 'online', 'dnd', 'idle', or 'invisible' via away variable's value. Also set 'afk' to true when away.
2018-06-03 22:19:46 +02:00
Artem Savkov 09bd77eafb keepalive: send payload right away
We can assume that websocket is always writable in WS_(ALMOST_)READY state
and thus clean up confusing writable callbacks from keepalive code.
2018-06-03 11:40:32 +02:00
Artem Savkov 98b03f4210 Merge remote-tracking branch 'origin/master' 2018-06-02 19:18:10 +02:00
Artem Savkov 54c06e6a52
Merge pull request #157 from Alcaro/patch-3
Compile as C99
2018-05-27 21:50:19 +02:00
Alcaro 5cf285d255 Compile as C99
This makes sure nobody else runs into traps involving 'unix', 'linux' and a few others being predefineds macro, and it improves compatibility with old compilers that default to -std=gnu89 and fail on variable declarations in for loops. (Modern GCCs default to -std=gnu11.)

Fixes #156
2018-05-27 10:57:29 +02: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 9e086eb68e Add more info about captcha issue
Recognize 'captcha-required' discord error instead of printing null
error message. Also add info on how to get the token and a link to
original  issue to README.
2018-05-19 08:40:37 +02:00
Alcaro ae2177abd5 Enforce space after emote URLs (#149)
Enclose emoji URLs in brackets.

Discord allows emoji to be sent back to back without any delimiters resulting in botched urls. Add <> brackets so that emoji urls are separated from the rest of the text.
2018-05-17 12:19:53 +02:00
Alcaro 020fe0f0b5 Fix crash when deleting a channel (#146)
* Fix crash when deleting a channel
2018-04-27 08:11:58 +02:00
Artem Savkov 4fc5649367 Fix crash on status change during reconnect
With soft reconnects it is now possible for bitlbee to request status
change in the middle of reconnect causing a write to uninitialized ssl
socket and consequent segfault.
Postpone setting status until we are in a WS_READY state.
2018-04-10 21:59:58 +02:00