+
+ if (text[0] == '\x01') {
+ char *term, response[MAXLEN];
+
+ text++; /* Skip leading ^A. */
+ /* Chop off final ^A. */
+ term = strchr(text, '\x01');
+ if (!term)
+ return;
+ *term = '\0';
+ /* Parse out leading text. */
+ term = strchr(text, ' ');
+ if (term) {
+ *term++ = '\0';
+ if (!*term)
+ term = NULL;
+ }
+ /* No dict lookup since these are so few. */
+ if (!irccasecmp(text, "CLIENTINFO")) {
+ /* Use \001 instead of \x01 because apparently \x01C is
+ * interpreted as ASCII FS (\034, decimal 28, hex 1C).
+ */
+ irc_notice_user(bot, user, "\001CLIENTINFO CLIENTINFO PING TIME USERINFO VERSION\x01");
+ } else if (!irccasecmp(text, "PING")) {
+ if (term) {
+ snprintf(response, sizeof(response), "\x01PONG %s\x01", term);
+ irc_notice_user(bot, user, response);
+ } else {
+ irc_notice_user(bot,user, "\x01PONG\x01");
+ }
+ } else if (!irccasecmp(text, "TIME")) {
+ struct tm tm;
+ localtime_r(&now, &tm);
+ strftime(response, sizeof(response), "\x01TIME %a %b %d %H:%M:%S %Y\x01", &tm);
+ irc_notice_user(bot, user, response);
+ } else if (!irccasecmp(text, "USERINFO")) {
+ snprintf(response, sizeof(response), "\x01USERINFO %s\x01", bot->info);
+ irc_notice_user(bot, user, response);
+ } else if (!irccasecmp(text, "VERSION")) {
+ /* This function provides copyright management information
+ * to end users of srvx. You should not alter, disable or
+ * remove this command or its accessibility to normal IRC
+ * users, except to add copyright information pertaining
+ * to changes you make to srvx.
+ */
+ snprintf(response, sizeof(response), "\x01VERSION %s (%s) %s\x01", PACKAGE_STRING, CODENAME, ARCH_VERSION);
+ irc_notice_user(bot, user, response);
+ }
+ return;
+ }
+