Author Topic: Discord protocol  (Read 39569 times)

0 Members and 2 Guests are viewing this topic.

Offline Vulpix

Discord protocol
« on: 31 01 2017, 19:01:07 »
This topic is dedicated to Discord protocol development and alpha-testing.

Current state can be seen @ first post on github: https://github.com/miranda-ng/miranda-ng/issues/629
« Last Edit: 11 02 2017, 22:47:24 by Vulpix »
 
The following users thanked this post: Targaff

Offline Vulpix

Re: Discord protocol
« Reply #1 on: 01 02 2017, 11:01:01 »
What should work:
- 1on1 chats including message history syncing and offline messages (both sending and receiving)
- changing avatar + viewing other people's avatars
- chatting in guild (group) chats you are already a part of
- adding a new friend
- accepting a friend request
- changing status (Offline, Online, NA=idle, DND)
- websocket gateway

What doesn't work but can likely be made to work
- 2FA
- File transfers
- Joining new guilds/leaving guilds (groupchats) - you have to do it from within the discord program or website and relog to discord
- Joining/leaving channels
- Miranda doesn't reflect status change made in different endpoint (i.e. if you change your status in browser discord, miranda will not reflect that)
- likely none of the nitro features

File transfers are being worked on. I believe.

Please test and see for yourself.


See first post!

Please be aware that miranda attempts to sync all of your histories when you start it and if you have a long history with direct messaging with someone, it may take a while.
« Last Edit: 11 02 2017, 22:48:06 by Vulpix »
 

Offline mnguser

Re: Discord protocol
« Reply #2 on: 03 02 2017, 09:27:14 »
I would like to give it a try, but i can't load x64 development version of the plugin with the latest dev build of Miranda on Windows 10 x64.
Code: [Select]
The ordinal 397 could not be located in the dynamic link library <Miranda Root>\Plugins\Discord.dll.I tried scouting the plugin with Dependency Walker, but i can't spot anything unusual. Does it require some additional MSVC++ libraries? I've got all ordinary MSVC++ redistributables installed.
 

Offline ghazan

Re: Discord protocol
« Reply #3 on: 03 02 2017, 10:26:15 »
I would like to give it a try, but i can't load x64 development version of the plugin with the latest dev build of Miranda on Windows 10 x64.
you're using the stable version right now, you cannot load just one new plugin and try to launch it under this version.
go to Options - Services - Plugin updater, switch to the Development version (with or without symbols) and update everything first
 

Offline mnguser

Re: Discord protocol
« Reply #4 on: 03 02 2017, 10:40:40 »
My bad, it seems, I've left silent update mode enabled. Surprisingly, i tried skypeweb alpha about a year ago the same way and it never complained about compile options mismatch. :)
 

Offline mnguser

Re: Discord protocol
« Reply #5 on: 03 02 2017, 18:24:31 »
Impressive. I briefly compared running standalone client next to a plugin.

First of all, amazing job. Discord standalone client consumes more than a 100mb of RAM, while miranda is under 10mb for many protocols at once. That's a major debloating for something as basic as text IM when voice chat is not required.

Online status seems to work fine, however, client sees itself as online in group chats lists even when invisible, but it's probably an intended behavior.

Most of the unimplemented stuff, unsurprisingly, goes under group chats.

Group chat nicknames are not working (everyone is displayed as accountname#nnnn, including own name). I assume, this is because discord user can have unique nickname on per-group basis and it's not supported yet.
Group chat motd/channel title is not displayed in group chat window.
Group chat direct highlights don't work yet (@nickname as seen in Discord becomes <@nnnnnnnnnnnnnnnnn> in Miranda).
Group chat channel highlights are not decyphered (<#nnnnnnnnnnnnnnnnnnn> instead of #channel in Discord).
Group chat log is named after internal channel id (nnnnnnnnnnnnnnnnnnn.log) instead of group#channel.log.
Users with group chat moderation rights are not marked or highlighted via color in the channel chat window in any way.

The biggest disadvantage compared to native discord is probably the lack of discord group chat history sync (i.e. listing messages sent per channel while offline). Is this supported in miranda globally? I've noticed this is most likely the case with skypeweb and other group chats, excluding third-party assisted (IRC BNC services).

Thanks for keeping desktop instant messaging alive.
 
The following users thanked this post: ghazan

Offline Vulpix

Re: Discord protocol
« Reply #6 on: 03 02 2017, 21:58:36 »
Yeah, group chats were somewhat "out of scope" (or rather the message syncing) when I posted bounty on the discord support ( https://github.com/miranda-ng/miranda-ng/issues/629#issuecomment-268559665 )

Ghazan has done an amazing job implementing it because for better or worse, the actual messaging is not documented in the API.

At any rate, miranda isn't all that great for group chat history and syncing right now; we don't save history (we can log it into a text file) and in general group chats are handled differently than regular 1on1 conversations.

But I'm sure ghazan could make it work eventually :p hehe.
 

Offline Vulpix

Odp: Discord protocol
« Reply #7 on: 05 02 2017, 23:54:08 »
Experienced a random crash today after messaging someone:

Quote
Miranda Crash Report from 6 Feb 2017 0:50:42. Crash Dumper v.0.0.5.2

Likely cause of the crash plugin: Discord protocol

Exception: Access Violation at address 6E550A21. Writing to address 00000064.

Stack Trace:
---------------------------------------------------------------
6E550A21 (MSVCR100 6E540000): (filename not available) (0): unlock
100083A9 (Discord 10000000): w:\miranda-ng\protocols\discord\src\gateway.cpp (237): CDiscordProto::GatewayThreadWorker
100085FB (Discord 10000000): w:\miranda-ng\protocols\discord\src\gateway.cpp (133): CDiscordProto::GatewayThread
1232CFBD (mir_core 12320000): c:\sources\miranda_ng_compilation\src\mir_core\src\threads.cpp (159): forkthreadex_r
768762C4 (KERNEL32 76860000): (filename not available) (0): BaseThreadInitThunk
77E60FD9 (ntdll 77E00000): (filename not available) (0): RtlSubscribeWnfStateChangeNotification
77E60FA4 (ntdll 77E00000): (filename not available) (0): RtlSubscribeWnfStateChangeNotification
1232CF94 (mir_core 12320000): c:\sources\miranda_ng_compilation\src\mir_core\src\threads.cpp (284): Thread_Wait
0966FE38 ((module-name not available) 00000000): (filename not available) (0): (function-name not available)

Another one after just logging in:

Quote
Miranda Crash Report from 6 Feb 2017 3:07:58. Crash Dumper v.0.0.5.2

Likely cause of the crash plugin: Discord protocol

Exception: Access Violation at address 118484AA. Reading from address 1DD208E0.

Stack Trace:
---------------------------------------------------------------
118484AA (Discord 11840000): w:\miranda-ng\protocols\discord\src\gateway.cpp (265): CDiscordProto::GatewayThreadWorker
118485FB (Discord 11840000): w:\miranda-ng\protocols\discord\src\gateway.cpp (133): CDiscordProto::GatewayThread
1232CFBD (mir_core 12320000): c:\sources\miranda_ng_compilation\src\mir_core\src\threads.cpp (159): forkthreadex_r
768762C4 (KERNEL32 76860000): (filename not available) (0): BaseThreadInitThunk
77E60FD9 (ntdll 77E00000): (filename not available) (0): RtlSubscribeWnfStateChangeNotification
77E60FA4 (ntdll 77E00000): (filename not available) (0): RtlSubscribeWnfStateChangeNotification
1232CF94 (mir_core 12320000): c:\sources\miranda_ng_compilation\src\mir_core\src\threads.cpp (284): Thread_Wait
22F3FE8C ((module-name not available) 00000000): (filename not available) (0): (function-name not available)
« Last Edit: 06 02 2017, 02:11:52 by Vulpix »
 

Offline ghazan

Re: Discord protocol
« Reply #8 on: 06 02 2017, 13:56:30 »
Impressive. I briefly compared running standalone client next to a plugin.
Well, the "standalone client" is nothing but a Chromium, that executes tons of js :) So it's not so hard to outperform it considering RAM usage, though Miranda always was (and forever will be) very concerned about memory footprint :-)

First of all, amazing job. Discord standalone client consumes more than a 100mb of RAM, while miranda is under 10mb for many protocols at once. That's a major debloating for something as basic as text IM when voice chat is not required.
Thanks for the flattering review, the fact is that this plugin is in the very beginning, so your opinions and remarks are greatly appreciated. I'll implement them when I have spare time.
 

Offline ghazan

Re: Discord protocol
« Reply #9 on: 07 02 2017, 19:50:49 »
Group chat nicknames are not working (everyone is displayed as accountname#nnnn, including own name). I assume, this is because discord user can have unique nickname on per-group basis and it's not supported yet.
done. also I implemented joining / leaving guilds on the fly
 

Offline ghazan

Re: Discord protocol
« Reply #10 on: 08 02 2017, 19:25:54 »
now we can change our own nickname in chats
 

Offline Vulpix

Re: Discord protocol
« Reply #11 on: 08 02 2017, 21:22:47 »
now we can change our own nickname in chats

Already more advanced than Skype where you cannot change your nickname.. :D
 

Offline Vulpix

Re: Discord protocol
« Reply #12 on: 09 02 2017, 12:38:44 »
Crash after today's update while logging in:

Spoiler
Miranda Crash Report from 9 Feb 2017 13:37:37. Crash Dumper v.0.0.5.2

Likely cause of the crash plugin: Discord protocol

Exception: Access Violation at address 14BC8CCC. Reading from address 0DF507E2.

Stack Trace:
---------------------------------------------------------------
14BC8CCC (Discord 14BC0000): c:\sources\miranda_ng_compilation\protocols\discord\src\gateway.cpp (265): CDiscordProto::GatewayThreadWorker
14BC8E1D (Discord 14BC0000): c:\sources\miranda_ng_compilation\protocols\discord\src\gateway.cpp (133): CDiscordProto::GatewayThread
1232CFBD (mir_core 12320000): c:\sources\miranda_ng_compilation\src\mir_core\src\threads.cpp (159): forkthreadex_r
749662C4 (KERNEL32 74950000): (filename not available) (0): BaseThreadInitThunk
77E50FD9 (ntdll 77DF0000): (filename not available) (0): RtlSubscribeWnfStateChangeNotification
77E50FA4 (ntdll 77DF0000): (filename not available) (0): RtlSubscribeWnfStateChangeNotification
1232CF94 (mir_core 12320000): c:\sources\miranda_ng_compilation\src\mir_core\src\threads.cpp (284): Thread_Wait
09A7FE38 ((module-name not available) 00000000): (filename not available) (0): (function-name not available)
[close]

I actually had to roll back to previous discord because today's one wouldn't let me log in :o It'd always disconnect me silently ~1-2 seconds after login.
« Last Edit: 09 02 2017, 12:45:37 by Vulpix »
 

Offline mnguser

Re: Discord protocol
« Reply #13 on: 09 02 2017, 17:09:29 »
I've noticed group leaving messages showing up and some of the names in the chat list are now displayed without numeric index (#nnnn). Good job!
Aslo noticed, that picture attachments in group chats are displayed as clickable links and don't require auth to view from browser, so at least this doesn't require additional hassle to make it work, as opposed to skype.
 

Offline ghazan

Re: Discord protocol
« Reply #14 on: 11 02 2017, 20:36:33 »
topic is now retrieved/set