- else if(( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER ))
- {
- /* Falsche Anzahl Parameter? */
- return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+
+ /* Protocol type, see doc/Protocol.txt */
+ if (Req->argc >= 2 && strlen(Req->argv[1]) > 4)
+ type = &Req->argv[1][4];
+ else
+ type = NULL;
+
+ /* Protocol flags/options */
+ if (Req->argc >= 4)
+ orig_flags = Req->argv[3];
+ else
+ orig_flags = "";
+
+ /* Implementation, version and IRC+ flags */
+ if (Req->argc >= 3) {
+ char *impl, *ptr, *serverver, *flags;
+
+ impl = Req->argv[2];
+ ptr = strchr(impl, '|');
+ if (ptr)
+ *ptr = '\0';
+
+ if (type && strcmp(type, PROTOIRCPLUS) == 0) {
+ /* The peer seems to be a server which supports the
+ * IRC+ protocol (see doc/Protocol.txt). */
+ serverver = ptr ? ptr + 1 : "?";
+ flags = strchr(ptr ? serverver : impl, ':');
+ if (flags) {
+ *flags = '\0';
+ flags++;
+ } else
+ flags = "";
+ Log(LOG_INFO,
+ "Peer on connection %d announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").",
+ Client_Conn(Client), impl, serverver,
+ protohigh, protolow, flags);
+ } else {
+ /* The peer seems to be a server supporting the
+ * "original" IRC protocol (RFC 2813). */
+ if (strchr(orig_flags, 'Z'))
+ flags = "Z";
+ else
+ flags = "";
+ Log(LOG_INFO,
+ "Peer on connection %d announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").",
+ Client_Conn(Client), impl,
+ protohigh, protolow, flags);
+ }
+ Client_SetFlags(Client, flags);