From 7b49d382f0c2afb83dffa71b3d63c71213543bee Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Tue, 5 May 2009 21:29:32 +0000 Subject: [PATCH] Added a couple more aliases to the IRC client git-svn-id: file:///srv/svn/ircclient/trunk@12 a9804ffe-773b-11dd-bd7c-89c3ef1d2733 --- guiapp/messagehandler.cpp | 11 +++++++++++ guiapp/messagehandler.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/guiapp/messagehandler.cpp b/guiapp/messagehandler.cpp index 996b7fe..22adb5f 100644 --- a/guiapp/messagehandler.cpp +++ b/guiapp/messagehandler.cpp @@ -22,11 +22,13 @@ MessageHandler::MessageHandler( IRCClient *irc, QWidget *parent ) : QTabWidget( // Register aliases this->scriptManager->register_alias("dcc", bind(&MessageHandler::alias_dcc, this, _1)); this->scriptManager->register_alias("echo", bind(&MessageHandler::alias_echo, this, _1)); + this->scriptManager->register_alias("ip", bind(&MessageHandler::alias_ip, this, _1)); this->scriptManager->register_alias("join", bind(&MessageHandler::alias_join, this, _1)); this->scriptManager->register_alias("msg", bind(&MessageHandler::alias_msg, this, _1)); this->scriptManager->register_alias("nick", bind(&MessageHandler::alias_nick, this, _1)); this->scriptManager->register_alias("notice", bind(&MessageHandler::alias_notice, this, _1)); this->scriptManager->register_alias("privmsg", bind(&MessageHandler::alias_msg, this, _1)); + this->scriptManager->register_alias("say", bind(&MessageHandler::alias_say, this, _1)); this->scriptManager->register_alias("quit", bind(&MessageHandler::alias_quit, this, _1)); } @@ -193,6 +195,9 @@ void MessageHandler::alias_dcc(QStringList args) { void MessageHandler::alias_echo(QStringList args) { ((ChatWindow*)this->currentWidget())->echo(args.join(" ")); } +void MessageHandler::alias_ip(QStringList args) { + scriptManager->return_value(irc->getIPAddress()); +} void MessageHandler::alias_join(QStringList args) { irc->join( args.join( "," ) ); } @@ -223,6 +228,12 @@ void MessageHandler::alias_notice(QStringList args) { QString dest = args.takeFirst(); irc->notice( dest, args.join( " " ) ); } +void MessageHandler::alias_say(QStringList args) { + QString target = this->tabText(this->currentIndex()); + if (target != "status") { + alias_msg(QStringList(target) + args); + } +} void MessageHandler::alias_quit(QStringList args) { if( args.count() > 0 ) { irc->quit( args.join( " " ) ); } else { irc->quit(); } diff --git a/guiapp/messagehandler.h b/guiapp/messagehandler.h index 3b9dd71..a942ec8 100644 --- a/guiapp/messagehandler.h +++ b/guiapp/messagehandler.h @@ -29,10 +29,12 @@ public: void alias_ctcp(QStringList args); void alias_dcc(QStringList args); void alias_echo(QStringList args); + void alias_ip(QStringList args); void alias_join(QStringList args); void alias_msg(QStringList args); void alias_nick(QStringList args); void alias_notice(QStringList args); + void alias_say(QStringList args); void alias_quit(QStringList args); public slots: void messageRcvd( QString type, QString src, QString dest, QStringList values, QString text );