Commit Graph

275 Commits

Author SHA1 Message Date
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
Mickaël Thomas f105bc066d Don't fail to login when no servers exist 2017-09-20 23:06:21 +02:00
Artem Savkov fcb733f73e Create datadir
While $(datadir) is guaranteed to exist because help.txt is already
there $(DESTDIR)$(datadir) is not, so mkdir it before install.
2017-09-10 20:06:52 +02:00
Artem Savkov c4ecc76fae Fix --with-bdatadir configure option
Make --with-bdatadir actually do something
2017-09-10 20:02:01 +02:00
Artem Savkov 00176aa937 Fix docdir check
Use DESTDIR for install only, do not add it to the path when checking
for help.txt location.
2017-09-10 19:52:01 +02:00
Artem Savkov 1d67b20daa Merge branch 'kensanata-kensanata/help' 2017-08-31 22:07:45 +02:00
Artem Savkov 58d1f73462 Docs installation
Try to install discord-help into bitlbee's datadir. It should work
better once we have datadir in bitlbee.pc
2017-08-31 22:05:29 +02:00
Artem Savkov 5acda539f7 Fix premature free
Do not free help filename before the open check as it is used in the
error message.
2017-08-31 21:33:37 +02:00
Alex Schroeder 27d4c5849e Add 'help discord'
Add help discord such that people don't have to search "bitlbee discord
how to" online whenever they want to join a new server or join new
channels.
2017-08-31 20:46:39 +02:00
Artem Savkov 0cc06bc867 discord_ws_send_payload: fixup char casting
Fix the way buf data is being casted in psize < 126 case so that it is
done the same way as in other cases.
2017-08-25 22:12:48 +02:00
Alex Schroeder 0b2e4f9a7f discord-websockets: fix implicit int to gchar cast
fix "warning: implicit conversion from 'int' to 'gchar'
(aka 'char') changes value from 255 to -1".
2017-08-25 22:04:26 +02:00
Alex Schroeder 3ea1a5cf31 discord-websockets: fix some warnings
As discord_data.seq is a guint64, use G_GUINT64_FORMAT instead of
PRIu64. This fixes "warning: format specifies type 'unsigned long
long' but the argument has type 'guint64'".
2017-08-25 21:58:37 +02:00
Artem Savkov 572647a5c8 Merge pull request #100 from kensanata/kensanata/readme
Fix typos in README
2017-08-25 21:27:54 +02:00
Alex Schroeder bdc7ad3f75 Fix typos in README 2017-08-25 11:29:47 +02:00
Artem Savkov ecee8f2490 Fix lingering writable event source
Sometimes on disconnect there might be leftover io event source. Clean
it up properly on logout to avoid any possible 'use-after-free' errors.

Fixes #97
2017-08-15 10:30:03 +02:00
Artem Savkov 6a2f160b92 Merge pull request #86 from dequis/utf8-server-prefix-len
Make server_prefix_len truncate by utf8 characters instead of bytes
2017-05-29 08:37:44 +02:00
Artem Savkov 9638d6f93b Merge pull request #87 from dequis/revert-cygwin
Revert "Makefile.am: add -no-undefined for cygwin"
2017-05-29 08:34:11 +02:00
dequis 4585eefed4 Revert "Makefile.am: add -no-undefined for cygwin"
This reverts commit 84315b6bfc.

Turns out it wasn't harmless, and it breaks mac OS. Instead of adding
platform checks here, this flag is now included in the cygwin-specific
parts of the bitlbee pkg-config file, as of bitlbee commit b9c10a1a
(version string 3.5.1+20170529+develop+18-gb9c10a1a-git)
2017-05-29 02:16:24 -03: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
Artem Savkov 0946484b7e Merge pull request #84 from dequis/cygwin
Makefile.am: add -no-undefined for cygwin
2017-05-13 23:56:29 +02:00
dequis 84315b6bfc Makefile.am: add -no-undefined for cygwin
Quoting https://cygwin.com/ml/cygwin/2013-07/msg00421.html

>despite popular misconception, this flag is harmless on non-PE targets

This also depends on changes on the bitlbee side to be able to link to
bitlbee itself, see bitlbee commit 54b2a367 (version string
3.5.1+20170513+develop+16-g54b2a367-git)
2017-05-13 18:09:57 -03:00
Artem Savkov dbad13173c Merge pull request #80 from dequis/includes
Change bitlbee includes from <bitlbee/*.h> to <*.h>
2017-04-26 08:42:16 +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 0f0485eae7 Report "email" errors on login.
Some times instead of ussing "message" field as always discord chooses
to report errors in "email" field, which results in "null" login errors.

Fixes: #65, #72
2017-02-21 22:50:38 +01: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 61a25240ff Remove bci from chatlist on channel deletion.
When channel is deleted we are currently freeing bci, but the pointer is
left in ic->chatlist list, which might have disastorous consequences.
Make sure we remove it.
2017-02-07 11:00:46 +01:00
Artem Savkov c6b5bc44a1 Make sure chan names are unique.
Bitlbee doesn't expect channels with the same name, so when you have
multiple channels with the same name only one of them can be joined.

This commit sets server_prefix_len to 3 by default and keeps adding '_'s
to the channel name until we get a unique name.

Fixes: #51
2017-02-07 10:45:59 +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 580a463e93 Don't allow backlog fetches with limit < 1.
Before listchan merge we checked if max_backlog > 0 before fetching
backlog, unfortunately this check was lost causing discord to throw
errros at users when limit wasn't right.
Adding the check and a note about this to README.
2017-01-19 09:59:39 +01:00
Artem Savkov 73708b540a Add a debug option to configure.
Add --enable-debug option to configure that enables bitlbee-discord to
dump all traffic to stdout.
Update README with some info on debugging.
2017-01-18 15:43:46 +01:00
Artem Savkov cda4010f14 Fix imcb_error format.
mfa_cb and login_cb used imcb_error without formatting, that leads to
compiler warnings/errors in some cases. Now using proper formatting
which gives us a bit more verbosity as well.

Issue #67.
2017-01-17 09:19:55 +01:00
Artem Savkov bf5c48dbc0 Add a fake "guild" for global frineds.
Previous fix for global frineds not showing up didn't really work
because we always need to tie a user to some "guild" and global users
didn't have one. Fixing it by adding a fake global "guild" with id 0 for
this.
2017-01-13 16:45:12 +01:00
Artem Savkov 3703e0d318 README update.
Update readme with new requirements and some basic explaination on how
to add channels.
2017-01-13 16:40:35 +01:00
Artem Savkov b55235c2c9 Update dependencies in configure.ac.
Change bitlbee dependency to v3.5 as it is needed for listchan
functionality.
2017-01-13 16:39:57 +01:00
Artem Savkov fdedcddd66 Merge branch 'listchan' 2017-01-09 10:39:05 +01:00
Artem Savkov 607647113a Add users from private channels.
Users from private channels no longer need to be on the same servers as
you are, so we need to add them separately. We still don't handle their
statuses, but at least you'll be able to communicate with them normally.

Fixes: #64
2017-01-03 10:47:33 +01:00
Artem Savkov 7c897faa82 Remove g_main_context_iteration.
Bitlbee can use both glib and libevent eventloops, but
g_main_context_iteration is glib's function so in case when bitlbee uses
libevent it would create and try to iterate a completely unrelated
eventloop.

Removing this doesn't seem to break anything as it was added at the
point where there was no mechanism to track if all servers are synced.

Should fix issue #62.
2016-12-21 11:14:28 +01:00
Artem Savkov 8c889d0969 Call imcb_connected() only on actual connect.
Before this commit beecord would call imcb_connected() on every
GUILD_CREATE since we now assynchronously do GUILD_SYNC for each of
those. We only need to call this if current state is WS_ALMOST_READY.
2016-12-12 15:45:20 +01:00
Artem Savkov c61bfec15b Add opcode enum.
Define discord opcodes in an enum so it is easier to read the sources.
Unfortunately there are more of them than it is listed here or in the
documentation, but at this point I can't tell what those do.
2016-12-12 10:13:26 +01:00
Artem Savkov d4c29da282 Update handlers to work with v6 api.
Change things around to work with poorly documented v6 api that is sure
to bring breathtaking debugging sessions with it.

Basic functionality seems to all be there, but some things might be
broken still.
2016-12-11 12:42:05 +01:00
Artem Savkov dcf97a7c51 Fix disconnects caused by wrong heartbeat messages.
Apparently discord changed the way they advertise heartbeat interval and
the value used in hearbeat pings client supposed to send. This seems to
fix the disconnect issue, although more testing is needed and further
changes might be needed.

Issue: #57
2016-12-11 12:42:05 +01:00
Artem Savkov 74e480b7ed Merge branch 'master' into listchan 2016-12-11 12:26:21 +01:00
Artem Savkov 2e53f18bcf Update handlers to work with v6 api.
Change things around to work with poorly documented v6 api that is sure
to bring breathtaking debugging sessions with it.

Basic functionality seems to all be there, but some things might be
broken still.
2016-12-11 11:27:01 +01:00
Artem Savkov 211ead9f5d Merge branch 'master' into listchan 2016-12-10 11:52:51 +01:00
Artem Savkov 67e693b6a7 Fix disconnects caused by wrong heartbeat messages.
Apparently discord changed the way they advertise heartbeat interval and
the value used in hearbeat pings client supposed to send. This seems to
fix the disconnect issue, although more testing is needed and further
changes might be needed.

Issue: #57
2016-12-10 11:51:46 +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 918ba598fe Send acks only for messages actually sent to bitlbee.
Before this commit bitlbee-discord would ack all incoming messages
regardless of whether they were actually sent to bitlbee for user to
see.
It will now check whether the message was actually posted to bitlbee
before acking it.

Fixes issue #52.
2016-11-15 21:40:10 +01:00