[project @ 2002-08-08 15:21:08 by unknown_lamer]
[clinton/bobotpp.git] / source / DCCConnection.C
index a708aaf..d5cd487 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
 
 #include <ctime>
+#include <string>
 
 #include "Socket.H"
 #include "DCCParser.H"
 #include "DCCConnection.H"
+#include "Person.H"
+#include "BotInterp.H"
+#include "Utils.H"
 
 DCCConnection::DCCConnection(Bot *b, String n, unsigned long address, 
                             int port)
@@ -33,13 +37,26 @@ DCCConnection::connect()
 {
   if (!socket.connect())
     return false;
+
+#ifdef USESCRIPTS
+  // run hooks/dcc/chat-begin
+  DCCPerson *tmp = new DCCPerson (this);
+  bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN, 
+                           tmp->getAddress (),
+                           scm_list_n (Utils::
+                                       string2SCM (tmp->getAddress ()),
+                                       SCM_UNDEFINED));
+  delete tmp;
+#endif
+
+
   return true;
 }
 
 bool
 DCCConnection::handleInput()
 {
-  String line = socket.readLine();
+  std::string line = socket.readLine();
 
   lastSpoken = time(0);