|
From: <Jef...@us...> - 2008-09-24 02:03:56
|
Revision: 372
http://libirc.svn.sourceforge.net/libirc/?rev=372&view=rev
Author: JeffM2501
Date: 2008-09-24 01:34:27 +0000 (Wed, 24 Sep 2008)
Log Message:
-----------
add invite event
Modified Paths:
--------------
trunk/libirc/include/IRCClient.h
trunk/libirc/include/IRCEvents.h
trunk/libirc/src/IRCClient.cpp
trunk/libirc/src/irClientEvents.cpp
trunk/libirc/src/ircBasicCommands.cpp
trunk/libirc/src/ircBasicCommands.h
Modified: trunk/libirc/include/IRCClient.h
===================================================================
--- trunk/libirc/include/IRCClient.h 2008-09-23 21:26:57 UTC (rev 371)
+++ trunk/libirc/include/IRCClient.h 2008-09-24 01:34:27 UTC (rev 372)
@@ -228,6 +228,7 @@
void nickNameError ( int error, std::string message );
void nickCommand ( BaseIRCCommandInfo &info );
void kickCommand ( BaseIRCCommandInfo &info );
+ void inviteCommand ( BaseIRCCommandInfo &info );
void QuitMessage ( BaseIRCCommandInfo &info );
// used by the defalt event handlers
Modified: trunk/libirc/include/IRCEvents.h
===================================================================
--- trunk/libirc/include/IRCEvents.h 2008-09-23 21:26:57 UTC (rev 371)
+++ trunk/libirc/include/IRCEvents.h 2008-09-24 01:34:27 UTC (rev 372)
@@ -47,6 +47,7 @@
eIRCChannelUserModeSet,
eIRCUserModeSet,
eIRCQuitEvent,
+ eIRCInviteEvent,
eIRCLastEvent
}teIRCEventType;
@@ -82,7 +83,7 @@
}trClientNickErrorEventInfo;
/**
- * join type evetns, used for eIRCChannelJoinEvent, eIRCUserJoinEvent
+ * join type events, used for eIRCChannelJoinEvent, eIRCUserJoinEvent, eIRCInviteEvent
*/
typedef struct trClientJoinEventInfo : public trBaseEventInfo
{
Modified: trunk/libirc/src/IRCClient.cpp
===================================================================
--- trunk/libirc/src/IRCClient.cpp 2008-09-23 21:26:57 UTC (rev 371)
+++ trunk/libirc/src/IRCClient.cpp 2008-09-24 01:34:27 UTC (rev 372)
@@ -575,6 +575,7 @@
addDefaultCommandHandlers(new IRCClientModeCommand );
addDefaultCommandHandlers(new IRCClientPrivMsgCommand );
addDefaultCommandHandlers(new IRCClientKickCommand );
+ addDefaultCommandHandlers(new IRCClientInviteCommand );
}
// logical event handlers
Modified: trunk/libirc/src/irClientEvents.cpp
===================================================================
--- trunk/libirc/src/irClientEvents.cpp 2008-09-23 21:26:57 UTC (rev 371)
+++ trunk/libirc/src/irClientEvents.cpp 2008-09-24 01:34:27 UTC (rev 372)
@@ -258,6 +258,16 @@
userManager.userPartChannel(eventInfo.user,eventInfo.channel);
}
+void IRCClient::inviteCommand ( BaseIRCCommandInfo &info )
+{
+ trClientJoinEventInfo eventInfo;
+
+ eventInfo.eventType = eIRCInviteEvent;
+ eventInfo.channel = info.params[1];
+ eventInfo.user = info.params[0];
+ callEventHandler(eventInfo.eventType,eventInfo);
+}
+
void IRCClient::QuitMessage ( BaseIRCCommandInfo &info )
{
string_list goodies = string_util::tokenize(info.source,std::string("!"));
Modified: trunk/libirc/src/ircBasicCommands.cpp
===================================================================
--- trunk/libirc/src/ircBasicCommands.cpp 2008-09-23 21:26:57 UTC (rev 371)
+++ trunk/libirc/src/ircBasicCommands.cpp 2008-09-24 01:34:27 UTC (rev 372)
@@ -305,6 +305,31 @@
return true;
}
+
+IRCClientInviteCommand::IRCClientInviteCommand()
+{
+ name = "INVITE";
+}
+
+bool IRCClientInviteCommand::receive ( IRCClient &client, const std::string &command, BaseIRCCommandInfo &info )
+{
+ client.inviteCommand(info);
+ return true;
+}
+
+bool IRCClientInviteCommand::send ( IRCClient &client, const std::string &command, BaseIRCCommandInfo &info )
+{
+ IRCCommandInfo &ircInfo = (IRCCommandInfo&)info;
+
+ std::string commandLine;
+
+ // KICK target user :reason
+ commandLine = ircInfo.target + delim + ircInfo.params[0]+ delim + std::string(":") + info.getAsString(1);
+ client.sendIRCCommandToServer(eCMD_INVITE,commandLine);
+
+ return true;
+}
+
// special case commands
// Generic handler for ALL
Modified: trunk/libirc/src/ircBasicCommands.h
===================================================================
--- trunk/libirc/src/ircBasicCommands.h 2008-09-23 21:26:57 UTC (rev 371)
+++ trunk/libirc/src/ircBasicCommands.h 2008-09-24 01:34:27 UTC (rev 372)
@@ -147,6 +147,16 @@
virtual bool send ( IRCClient &client, const std::string &command, BaseIRCCommandInfo &info );
};
+// IRC "INVITE" command
+// paramaters {user,channel}
+class IRCClientInviteCommand : public IRCClientCommandHandler
+{
+public:
+ IRCClientInviteCommand();
+ virtual bool receive ( IRCClient &client, const std::string &command, BaseIRCCommandInfo &info );
+ virtual bool send ( IRCClient &client, const std::string &command, BaseIRCCommandInfo &info );
+};
+
#endif //_IRC_BASIC_COMMANDS_
// Local Variables: ***
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|