return err_nosuchserver(client, args[0]), sendbuf(client), 0;
// Send welcome
sendMOTD(client);
+ } else if(strcmp(command, "HELP") == 0) {
+ if (!is_registered(client))
+ return err_notregistered(client), sendbuf(client), 0;
+ char line[512];
+ FILE *f = fopen("help.txt", "r");
+ if (f) {
+ copy_strf(&databuf, ":%s 704 %s * :** /HELP **\r\n", hostname, client->nick), sendbuf(client);
+ while (fgets(line, 512, f)) {
+ char *c = strchr(line, '\n');
+ if (*c)
+ *c = '\0';
+ copy_strf(&databuf, ":%s 705 %s * :%s\r\n", hostname, client->nick, line), sendbuf(client);
+ }
+ fclose(f);
+ copy_strf(&databuf, ":%s 706 %s * :End of /HELP\r\n", hostname, client->nick), sendbuf(client);
+ } else {
+ copy_strf(&databuf, ":%s 524 %s * :No help available on this topic\r\n", hostname, client->nick), sendbuf(client);
+ }
} else if(strcmp(command, "VERSION") == 0) {
if (!is_registered(client))
return err_notregistered(client), sendbuf(client), 0;