]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/numeric.c
Announce_User(): support RFC 1459 compatibility mode.
[ngircd.git] / src / ngircd / numeric.c
index d22bf3ae348c3b2ebeccf63dc3fbad1e5f3d56a0..af1ac027927f5215aa0070f0ca3b1c804f0125e3 100644 (file)
@@ -78,18 +78,27 @@ static bool
 Announce_User(CLIENT * Client, CLIENT * User)
 {
        CONN_ID conn;
+       char *modes;
+
        conn = Client_Conn(Client);
        if (Conn_Options(conn) & CONN_RFC1459) {
                /* RFC 1459 mode: separate NICK and USER commands */
                if (! Conn_WriteStr(conn, "NICK %s :%d",
                                    Client_ID(User), Client_Hops(User) + 1))
                        return DISCONNECTED;
-               return Conn_WriteStr(conn, ":%s USER %s %s %s :%s",
+               if (! Conn_WriteStr(conn, ":%s USER %s %s %s :%s",
                                     Client_ID(User), Client_User(User),
                                     Client_Hostname(User),
                                     Client_ID(Client_Introducer(User)),
-                                    Client_Info(User));
-               
+                                    Client_Info(User)))
+                       return DISCONNECTED;
+               modes = Client_Modes(User);
+               if (modes[0]) {
+                       return Conn_WriteStr(conn, ":%s MODE %s +%s",
+                                    Client_ID(User), Client_ID(User),
+                                    modes);
+               }
+               return CONNECTED;
        } else {
                /* RFC 2813 mode: one combined NICK command */
                return IRC_WriteStrClient(Client, "NICK %s %d %s %s %d +%s :%s",
@@ -158,20 +167,20 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan)
 {
        char *modes, *topic;
        bool has_k, has_l;
-       
+
 #ifdef DEBUG
        Log(LOG_DEBUG, "Sending CHANINFO commands ...");
 #endif
-       
+
        modes = Channel_Modes(Chan);
        topic = Channel_Topic(Chan);
-       
+
        if (!*modes && !*topic)
                return CONNECTED;
-       
+
        has_k = strchr(modes, 'k') != NULL;
        has_l = strchr(modes, 'l') != NULL;
-       
+
        /* send CHANINFO */
        if (!has_k && !has_l) {
                if (!*topic) {