diff --git a/main.c b/main.c index 5663958..5b968bb 100644 --- a/main.c +++ b/main.c @@ -721,6 +721,66 @@ static void handle_line(char *line) } } } + } else if (strcmp(cmd, "311") == 0 && params) { + /* RPL_WHOISUSER: * : */ + char *p = params; + char *sp = strchr(p, ' '); if (sp) p = sp + 1; /* skip our nick */ + char *wnick = p; + sp = strchr(p, ' '); if (sp) { *sp = '\0'; p = sp + 1; } + char *wuser = p; + sp = strchr(p, ' '); if (sp) { *sp = '\0'; p = sp + 1; } + char *whost = p; + sp = strchr(p, ' '); if (sp) { *sp = '\0'; p = sp + 1; } + /* skip the * */ + sp = strchr(p, ':'); char *real = sp ? sp + 1 : p; + wprintf(WL_STATUS, "*** %s is %s@%s (%s)\n", wnick, wuser, whost, real); + } else if (strcmp(cmd, "319") == 0 && params) { + /* RPL_WHOISCHANNELS: : */ + char *p = params; + char *sp = strchr(p, ' '); if (sp) p = sp + 1; + char *wnick = p; + sp = strchr(p, ' '); if (sp) *sp = '\0'; + char *chans = strchr(params, ':'); + if (chans) chans++; + wprintf(WL_STATUS, "*** %s on channels: %s\n", wnick, chans ? chans : ""); + } else if (strcmp(cmd, "312") == 0 && params) { + /* RPL_WHOISSERVER: : */ + char *p = params; + char *sp = strchr(p, ' '); if (sp) p = sp + 1; + char *wnick = p; + sp = strchr(p, ' '); if (sp) { *sp = '\0'; p = sp + 1; } + char *server = p; + sp = strchr(p, ' '); if (sp) *sp = '\0'; + char *info = strchr(params, ':'); + if (info) info++; + wprintf(WL_STATUS, "*** %s on irc via server %s (%s)\n", + wnick, server, info ? info : ""); + } else if (strcmp(cmd, "317") == 0 && params) { + /* RPL_WHOISIDLE: : */ + char *p = params; + char *sp = strchr(p, ' '); if (sp) p = sp + 1; + char *wnick = p; + sp = strchr(p, ' '); if (sp) { *sp = '\0'; p = sp + 1; } + int idle_secs = atoi(p); + int mins = idle_secs / 60; + int secs = idle_secs % 60; + if (mins > 0) + wprintf(WL_STATUS, "*** %s has been idle %d min %d sec\n", + wnick, mins, secs); + else + wprintf(WL_STATUS, "*** %s has been idle %d sec\n", wnick, secs); + } else if (strcmp(cmd, "320") == 0 && params) { + /* RPL_WHOISSPECIAL: : */ + char *p = params; + char *sp = strchr(p, ' '); if (sp) p = sp + 1; + char *wnick = p; + sp = strchr(p, ' '); if (sp) *sp = '\0'; + char *text = strchr(params, ':'); + if (text) text++; + wprintf(WL_STATUS, "*** %s %s\n", wnick, text ? text : ""); + } else if (strcmp(cmd, "318") == 0 && params) { + /* RPL_ENDOFWHOIS — suppress or show subtle */ + wprintf(WL_STATUS, "*** End of WHOIS\n"); } else if (strcmp(cmd, "332") == 0 && params) { /* RPL_TOPIC: : */ char *p = params;