repo: ngircd
action: commit
revision: 
path_from: 
revision_from: c80b4eb3e435cc1cb77c9c97fb75e409b4992e92:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit c80b4eb3e435cc1cb77c9c97fb75e409b4992e92
Author: epoch 
Date:   Tue Dec 5 10:09:12 2023 +0000

    my shit attempt at getting extended-join working.

diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 253e9859933710b8922905052bd6f1f883ef0d69..
index ..3702d08de6d0054aec93929d5f341b7c1266ba63 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -239,7 +239,6 @@ join_forward(CLIENT *Client, CLIENT *target, CHANNEL *chan,
 	/* tell users in this channel about the new client */
 	CLIENT *c;
 	CHANNEL *Chan;
-	CONN_ID conn;
 	CL2CHAN *cl2chan;
 	Chan = chan;
 	cl2chan = Channel_FirstMember( Chan );
@@ -253,7 +252,6 @@ join_forward(CLIENT *Client, CLIENT *target, CHANNEL *chan,
 			c = Client_NextHop(c);
 		if(c && c != Client) {
 			/* Ok, another Client */
-			conn = Client_Conn(c);
 			if(Client_Cap(c) & CLIENT_CAP_EXTENDED_JOIN) {
 				char * account_name;
 				if(Client_AccountName(Client)) {
@@ -289,21 +287,7 @@ GLOBAL bool
 IRC_Send_Channel_Info(CLIENT *Client, CHANNEL *Chan)
 {
 	const char *topic;
-	if (Client_Type(Client) != CLIENT_USER)
-		return true;
-	/* acknowledge join */
-	CONN_ID conn;
-	conn = Client_Conn(Client);
-	if(Client_Cap(Client) & CLIENT_CAP_EXTENDED_JOIN) {
-		char * account_name;
-		if(Client_AccountName(Client))
-			account_name = Client_AccountName(Client);
-		else
-			account_name = "*";
-		Conn_WriteStr(conn, ":%s JOIN %s %s :%s", Client_MaskCloaked(Client), Channel_Name(Chan), account_name, Client_Info(Client));
-	}
-	else
-		Conn_WriteStr(conn, ":%s JOIN %s", Client_MaskCloaked(Client), Channel_Name(Chan));
+
 	/* Send the topic (if any) to the new client: */
 	topic = Channel_Topic(Chan);
 	assert(topic != NULL);
@@ -448,9 +432,18 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )

 		if (Client_Type(Client) == CLIENT_USER) {
 			/* Acknowledge join ... */
-			if (!IRC_WriteStrClientPrefix(Client, target,
-						      "JOIN :%s", channame))
-				break; /* write error */
+
+			if(Client_Cap(Client) & CLIENT_CAP_EXTENDED_JOIN) {
+				char * account_name;
+				if(Client_AccountName(Client))
+					account_name = Client_AccountName(Client);
+				else
+					account_name = "*";
+				if(!IRC_WriteStrClientPrefix(Client, target, "JOIN %s %s :%s", channame, account_name, Client_Info(Client))) break;
+			}
+			else
+				if(!IRC_WriteStrClientPrefix(Client, target, "JOIN %s", channame)) break;
+
 			/* ... and greet new user: */
 			if (!IRC_Send_Channel_Info(Client, chan))
 				break; /* write error */

-----END OF PAGE-----