Added a couple more aliases to the IRC client

git-svn-id: file:///srv/svn/ircclient/trunk@12 a9804ffe-773b-11dd-bd7c-89c3ef1d2733
This commit is contained in:
Correl Roush 2009-05-05 21:29:32 +00:00
parent d9a1aae58f
commit 7b49d382f0
2 changed files with 13 additions and 0 deletions

View file

@ -22,11 +22,13 @@ MessageHandler::MessageHandler( IRCClient *irc, QWidget *parent ) : QTabWidget(
// Register aliases // Register aliases
this->scriptManager->register_alias("dcc", bind(&MessageHandler::alias_dcc, this, _1)); 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("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("join", bind(&MessageHandler::alias_join, this, _1));
this->scriptManager->register_alias("msg", bind(&MessageHandler::alias_msg, 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("nick", bind(&MessageHandler::alias_nick, this, _1));
this->scriptManager->register_alias("notice", bind(&MessageHandler::alias_notice, 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("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)); 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) { void MessageHandler::alias_echo(QStringList args) {
((ChatWindow*)this->currentWidget())->echo(args.join(" ")); ((ChatWindow*)this->currentWidget())->echo(args.join(" "));
} }
void MessageHandler::alias_ip(QStringList args) {
scriptManager->return_value(irc->getIPAddress());
}
void MessageHandler::alias_join(QStringList args) { void MessageHandler::alias_join(QStringList args) {
irc->join( args.join( "," ) ); irc->join( args.join( "," ) );
} }
@ -223,6 +228,12 @@ void MessageHandler::alias_notice(QStringList args) {
QString dest = args.takeFirst(); QString dest = args.takeFirst();
irc->notice( dest, args.join( " " ) ); 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) { void MessageHandler::alias_quit(QStringList args) {
if( args.count() > 0 ) { irc->quit( args.join( " " ) ); } if( args.count() > 0 ) { irc->quit( args.join( " " ) ); }
else { irc->quit(); } else { irc->quit(); }

View file

@ -29,10 +29,12 @@ public:
void alias_ctcp(QStringList args); void alias_ctcp(QStringList args);
void alias_dcc(QStringList args); void alias_dcc(QStringList args);
void alias_echo(QStringList args); void alias_echo(QStringList args);
void alias_ip(QStringList args);
void alias_join(QStringList args); void alias_join(QStringList args);
void alias_msg(QStringList args); void alias_msg(QStringList args);
void alias_nick(QStringList args); void alias_nick(QStringList args);
void alias_notice(QStringList args); void alias_notice(QStringList args);
void alias_say(QStringList args);
void alias_quit(QStringList args); void alias_quit(QStringList args);
public slots: public slots:
void messageRcvd( QString type, QString src, QString dest, QStringList values, QString text ); void messageRcvd( QString type, QString src, QString dest, QStringList values, QString text );