int irc::send_privmsg(string message) { if (channels.size() > 0) return send_privmsg(channels[0], message); else return -1; }
void cmd_privmsg(t_message *msg, t_client *client, t_chan *chans) { char *str; if (msg == NULL || client == NULL) return; if (get_nb_params(msg->params) < 1) { dprintf(client->client, ERR_NORECIPIENT, S_NAME, S_ADDR, client->nick, msg->command); return; } else if (get_nb_params(msg->params) != 2) { dprintf(client->client, ERR_NOTEXTTOSEND, S_NAME, S_ADDR, client->nick); return; } str = strtok(msg->params[0], ","); while (str != NULL) { send_privmsg(msg, str, client, chans); str = strtok(NULL, ","); } }
void send_action(int fd, char *target, char *message) { send_privmsg(fd, target, strcat("ACTION", strcat(message, ""))); }