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.
23 #include "DCCParser.H"
24 #include "DCCChatConnection.H"
26 #include "BotInterp.H"
29 DCCChatConnection::DCCChatConnection(Bot *b, String n, unsigned long address,
31 : DCCConnection(b, n, address, port)
35 DCCChatConnection::connect()
37 if (!socket.connect())
40 DCCPerson *from = new DCCPerson (this);
42 if (Utils::get_level (bot, from->getAddress()) < User::FRIEND)
45 ("\002You do not have permission to DCC CHAT the bot\002");
51 // run hooks/dcc/chat-begin
52 bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN,
55 str2scm (from->getAddress ()),
65 DCCChatConnection::handleInput()
67 std::string line = socket.readLine();
71 if (line.length() == 0)
75 std::cout << "DCC: <" << line << ">" << std::endl;
77 DCCParser::parseLine(this, line);
83 DCCChatConnection::sendNotice(String message)
85 socket.write(message, true);