chat windows opened in maximized state, stealing focus

Olaf Hering olaf at aepfle.de
Thu Jun 27 10:10:07 EDT 2019


Am Thu, 27 Jun 2019 14:31:31 +0200
schrieb Olaf Hering <olaf at aepfle.de>:

> But a simple '/JOIN' typed into a chat window does not have any context. Such chat will be joined, but it will not have a UI representation. I'm not sure how to fix that. Perhaps the code that receives the typed text needs to extract potential commands and create an UI representation. Are there other protocols that have a concept of a manual '/JOIN' command?

After poking around some more I discovered purple_cmd_do_command() and irc_parse_purple_cmd(). At least IRC, Jabber and RocketChat have JOIN commands.
The patch below almost fixes it for me. So for short, all protocols that provide a 'JOIN' command have to create and present a conversation upfront.

Unfortunately purple_conversation_new() just creates another PurpleConversation even if purple_find_conversation_with_account() finds something. I think the fix for this bug is to return 'conv' right away.

Do we know what "some prpls use unique names for different things" refers to?


Olaf

diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c
index 0641cc0f30..d8b30d8816 100644
--- a/libpurple/protocols/irc/parse.c
+++ b/libpurple/protocols/irc/parse.c
@@ -212,6 +212,15 @@ static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar *
 	if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL)
 		return PURPLE_CMD_RET_FAILED;
 
+	if (g_str_equal(cmd, "join") && args[0] && *args[0] == '#') {
+		const char *channel = args[0];
+		PurpleConversation *new_conv;
+		PurpleConversationType type = PURPLE_CONV_TYPE_CHAT;
+		new_conv = purple_find_conversation_with_account(type, channel, irc->account);
+		if (!new_conv)
+			new_conv = purple_conversation_new(type, irc->account, channel);
+		purple_conversation_present(new_conv);
+	}
 	(cmdent->cb)(irc, cmd, purple_conversation_get_name(conv), (const char **)args);
 
 	return PURPLE_CMD_RET_OK;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: Digitale Signatur von OpenPGP
URL: <https://lists.pidgin.im/pipermail/devel/attachments/20190627/e845b9ac/attachment.sig>


More information about the Devel mailing list