1 // DCCConnection.C -*- C++ -*-
2 // Copyright (c) 1998 Etienne BERNARD
3 // Copyright (C) 2002,2005 Clinton Ebadi
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "DCCChatConnection.H"
24 #include "DCCParser.H"
25 #include "DCCPerson.H"
32 #include "BotInterp.H"
36 DCCChatConnection::DCCChatConnection(Bot *b, String n, unsigned long address,
38 : DCCConnection(b, n, address, port)
42 DCCChatConnection::connect()
44 if (!socket.connect())
47 DCCPerson *from = new DCCPerson (this);
49 if (Utils::get_level (bot, from->getAddress()) < User::FRIEND)
52 ("\002You do not have permission to DCC CHAT the bot\002");
58 // run hooks/dcc/chat-begin
59 bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN,
62 str2scm (from->getAddress ()),
72 DCCChatConnection::handleInput()
74 std::string line = socket.readLine();
78 if (line.length() == 0)
82 std::cout << "DCC: <" << line << ">" << std::endl;
84 DCCParser::parseLine(this, line);
90 DCCChatConnection::sendNotice(String message)
92 socket.write(message, true);