void IRCConnection::send_kill(const IRCEntity &target, const IRCText &comment) { std::vector<IRCRawString> params; params.push_back(target.to_raw()); if (!comment.empty()) params.push_back(comment.to_raw()); send_command("KILL", params); }
void IRCSession::extract_ctcp_command(const IRCText &ctcp_data, IRCRawString &command, IRCRawString &data) { command = ctcp_data.to_raw(); data = ctcp_data.to_raw(); IRCRawString::size_type pos = command.find(" "); if (pos != IRCRawString::npos) { command = command.substr(0, pos); data = data.substr(pos+1); } else { data.clear(); } }
void DCCChatConnection::send_line(const IRCText &text) { std::unique_lock<std::mutex> lock(mutex); send_queue.push_back(Message(Message::type_text, text.to_raw())); lock.unlock(); change_event.notify(); }
void IRCConnection::send_notice(const IRCEntity &receiver, const IRCText &text) { std::vector<IRCRawString> params; params.push_back(receiver.to_raw()); params.push_back(text.to_raw()); send_command("PRIVMSG", params); }
void IRCConnection::send_topic(const IRCChannel &channel, const IRCText &topic) { std::vector<IRCRawString> params; params.push_back(channel.to_raw()); params.push_back(topic.to_raw()); send_command("TOPIC", params); }
void IRCSession::on_ctcp_privmsg_dcc(const IRCText &data, const IRCPrivateMessage &message) { //uicore::Console::write_line(data.get_text()); std::vector<std::string> tokens = split_command_line(data.get_text()); if (tokens.size() >= 4 && tokens[0] == "SEND") { IRCFileOffer offer; offer.sender = message.get_prefix(); unsigned int address = uicore::Text::parse_uint32(tokens[2]); std::string ip_address = uicore::string_format( "%1.%2.%3.%4", uicore::Text::to_string((address>>24)&0xff), uicore::Text::to_string((address>>16)&0xff), uicore::Text::to_string((address>>8)&0xff), uicore::Text::to_string(address&0xff)); std::string port = tokens[3]; offer.host = uicore::SocketName(ip_address, port); offer.size = 0; offer.size_provided = false; if (tokens.size() >= 5) { offer.size = uicore::Text::parse_uint32(tokens[4]); offer.size_provided = true; } offer.filename = uicore::PathHelp::get_filename(tokens[1]); cb_dcc_file_offer(offer); }
void IRCConnection::send_kick(const IRCChannel &channel, const IRCNick &nickname, const IRCText &comment) { std::vector<IRCRawString> params; params.push_back(channel.to_raw()); params.push_back(nickname.to_raw()); params.push_back(comment.to_raw()); send_command("KICK", params); }
void ChatWindowViewController::irc_connection_text(IRCSession *session, const IRCEntity &room, const IRCNick &nick, const IRCText &text) { if (!room.is_channel() && workspace->find_page(nick.get_name()) == 0 && !text.is_ctcp()) { auto chat = std::make_shared<ChatController>(session, nick); workspace->add_page(nick.get_name(), chat, false); chat->add_private_text(nick, text); } }
void IRCConnection::send_quit(const IRCText &message) { std::vector<IRCRawString> params; params.push_back(message.to_raw()); send_command("QUIT", params); }