Fix crash when providing bad command line argument
[clinton/bobotpp.git] / source / Person.C
CommitLineData
cb21075d 1// Person.C -*- C++ -*-
2// Copyright (c) 1998 Etienne BERNARD
a6339323 3// Copyright (c) 2005 Clinton Ebadi
cb21075d 4
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
8// any later version.
9
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.
14
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
7b564711 17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18// 02110-1301, USA.
cb21075d 19
cfa82921 20#include "Person.H"
21
2169cb10 22#include "Bot.H"
cfa82921 23#include "ServerConnection.H"
cb21075d 24#include "Utils.H"
cb21075d 25
26Person::Person(Bot *b, String a)
27 : bot(b), address(a)
28{ }
29
30Person::Person(Person &p)
31 : bot(p.bot), address(p.address)
32{ }
33
34Person *
35Person::copy()
36{
37 return new Person(*this);
38}
39
40String
41Person::getNick() const
42{
a6339323 43 return Utils::get_nick (address);
cb21075d 44}
45
46String
47Person::getAddress() const
48{
49 return address;
50}
51
52Person &
53Person::operator=(const String & a)
54{
55 address = a;
56 return *this;
57}
58
59void
60Person::sendNotice(String message)
61{
62 bot->serverConnection->queue->sendNotice(getNick(), message);
63}