Re: chat windows opened in maximized state, stealing focus

Olaf Hering <[email protected]> Thu, 27 Jun 2019 16:10:07 +0200
Newsgroups gmane.comp.gnome.gaim.devel
Message-ID <[email protected]>
--===============5747638611573078492==
Content-Type: multipart/signed; micalg=pgp-sha256;
 boundary="Sig_/z.OzQc1MS_9=8tx72x9vn7_"; protocol="application/pgp-signature"

--Sig_/z.OzQc1MS_9=8tx72x9vn7_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Am Thu, 27 Jun 2019 14:31:31 +0200
schrieb Olaf Hering <[email protected]>:

> 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 ot=
her 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 pr=
ovide a 'JOIN' command have to create and present a conversation upfront.

Unfortunately purple_conversation_new() just creates another PurpleConversa=
tion even if purple_find_conversation_with_account() finds something. I thi=
nk the fix for this bug is to return 'conv' right away.

Do we know what "some prpls use unique names for different things" refers t=
o?


Olaf

diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/pars=
e.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(PurpleConvers=
ation *conv, const gchar *
 	if ((cmdent =3D g_hash_table_lookup(irc->cmds, cmd)) =3D=3D NULL)
 		return PURPLE_CMD_RET_FAILED;
=20
+	if (g_str_equal(cmd, "join") && args[0] && *args[0] =3D=3D '#') {
+		const char *channel =3D args[0];
+		PurpleConversation *new_conv;
+		PurpleConversationType type =3D PURPLE_CONV_TYPE_CHAT;
+		new_conv =3D purple_find_conversation_with_account(type, channel, irc->a=
ccount);
+		if (!new_conv)
+			new_conv =3D purple_conversation_new(type, irc->account, channel);
+		purple_conversation_present(new_conv);
+	}
 	(cmdent->cb)(irc, cmd, purple_conversation_get_name(conv), (const char **=
)args);
=20
 	return PURPLE_CMD_RET_OK;

--Sig_/z.OzQc1MS_9=8tx72x9vn7_
Content-Type: application/pgp-signature
Content-Description: Digitale Signatur von OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE97o7Um30LT3B+5b/86SN7mm1DoAFAl0Uzj8ACgkQ86SN7mm1
DoCBrA//XBALsejNM1cRTpMWxFjWeQ4YoNllnkeew3DJ178z4o5LNY4vB8Y9Hxq2
FZzi9gnEMIGCSYtgYJdDGZI71WYrVqPBptmgjpez4FIXf4grq/gYKmpx5tQLxJrA
WCI+SeGpeJhdIDTz9QUdfYWa6BUPoOS1S8O4Yhkj1DBbZo7eMfz/ZlPhEWWGpfyn
vjbnQH/TX0UODdxEL6Hc1WMuFUqpIxdmPo7Wrk4ws1ISVxAO4Y/RZB0oSFcmbk+n
0Ya3MU8/65KMGv9HnCX2LN8R8Rk6aROSmchaUVcFY+MSNI4WsKPUUK/VJDlnP1wf
h2/3NA2asVmf8Cm734X6hheen0pQViF+GZeisRW4zzodihVDrjqGjIYWHFslhduq
FmlaaO4kERcpElJGo7yWOwq6i+YzcIYZ5nYkpqqv2Gg8V+0/tKeH6HBEo4X4oDbT
nsklNlnKqjSmST4WngCDY4wNhShEsSyIVoj8YvG28ZWAQpclP3IIW7eqc4m9lxKS
0WfOd7jayNFp2RbZk+2lWpuBG2iTwHyi5CbBQiwnHZAKUo28pHQAqLtj5c5FLzlT
wQhyZ7ZldyU2la29fL2M8/D8uk7qqXRI24KnEBrfk34jSNnI+nJPjcdjyLRU4QF3
HlX/0bOCNWEVG6ybRcHgaZ69gsMRhdXzqdX237M/JbFCQKI14bw=
=ICuO
-----END PGP SIGNATURE-----

--Sig_/z.OzQc1MS_9=8tx72x9vn7_--


--===============5747638611573078492==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KRGV2ZWwgbWFp
bGluZyBsaXN0CkRldmVsQHBpZGdpbi5pbQpodHRwczovL2xpc3RzLnBpZGdpbi5pbS9saXN0aW5m
by9kZXZlbA==

--===============5747638611573078492==--