--- proxy.cpp 2007-07-28 21:49:06.000000000 +0200 +++ /nfs/redrazor/downloads/dirt-1.0.0a25-source/proxy.cpp 2007-07-28 22:12:10.000000000 +0200 @@ -149,7 +149,36 @@ } } cmd = uppercase(pop_word_front(args)); - if (cmd == "PRIVMSG" || cmd == "NOTICE") { + + if(cmd == "332" || cmd == "TOPIC") { + string topic_command = line; + string target_user = ""; + + if(cmd == "332") + target_user = pop_word_front(args); + + string channel = pop_word_front(args); + string::size_type idx = args.find_first_of(":"); + if(idx != 0xffffffff) { + string topic = args.substr(idx + 1), topic_decoded; + string keyname; + + if(channel[0] == '#' || target[0] == '&') + keyname = channel; + else + keyname = source; + + key::decode(keyname, topic, topic_decoded); + + topic_command = prefix + " " + cmd + " " + target_user + " " + channel + " :" + topic_decoded; + if(topic_command[0] != ':') + topic_command.insert(0, ":"); + } + + user.putline(topic_command); + return; + } + else if (cmd == "PRIVMSG" || cmd == "NOTICE") { target = pop_word_front(args); if (target.empty()) return; if (args.substr(0, 1) == ":") args.erase(0, 1); @@ -249,6 +278,16 @@ if (cmd == "PRIVMSG" || cmd == "NOTICE") { string target = pop_word_front(args); message(prefix, cmd, target, args); + } else if (cmd == "TOPIC") { + string topic_encoded; + string target = pop_word_front(args); + + if(args.substr(0, 1) == ":") + args = args.erase(0, 1); + + key::encode(target, args, topic_encoded); + string buf = "TOPIC " + target + " :" + topic_encoded; + irc.putline(buf); } else if (cmd == "DIRT") { string dirtcmd = pop_word_front(args); dirt(dirtcmd, args);