]>
Commit | Line | Data |
---|---|---|
c80af759 | 1 | /** |
2 | * SAYCommand.cc | |
3 | * | |
4 | * 08/16/2006 - Jimmy Lipham <music0m@alltel.net> | |
5 | * Initial Version | |
6 | * | |
7 | * Displays <text> in <#channel> | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU General Public License | |
11 | * as published by the Free Software Foundation; either version 2 | |
12 | * of the License, or (at your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
22 | * USA. | |
23 | * | |
24 | * $Id$ | |
25 | */ | |
26 | ||
27 | #include <string> | |
28 | ||
29 | #include "gnuworld_config.h" | |
30 | #include "StringTokenizer.h" | |
31 | ||
32 | #include "chanfix.h" | |
33 | #include "responses.h" | |
34 | #include "Network.h" | |
35 | ||
36 | ||
37 | namespace gnuworld | |
38 | { | |
39 | namespace cf | |
40 | { | |
41 | ||
13a50edb | 42 | void SAYCommand::Exec(iClient* theClient, sqlcfUser* theUser, const std::string& Message) |
c80af759 | 43 | { |
44 | StringTokenizer st(Message); | |
45 | ||
df9c6c77 | 46 | std::string option = st[1]; |
47 | std::string value = st.assemble(2); | |
c80af759 | 48 | |
49 | bot->logAdminMessage("%s (%s) SAY %s %s", | |
50 | theUser->getUserName().c_str(), | |
51 | theClient->getRealNickUserHost().c_str(), | |
52 | option.c_str(), value.c_str()); | |
53 | ||
54 | bot->logLastComMessage(theClient, Message); | |
55 | ||
56 | Channel* thisChan = Network->findChannel(option); | |
57 | ||
58 | if (!thisChan) | |
59 | bot->SendTo(theClient, | |
df9c6c77 | 60 | "The channel %s does not exist on the network.", |
c80af759 | 61 | option.c_str()); |
62 | else | |
df9c6c77 | 63 | bot->Message(thisChan,value); |
c80af759 | 64 | |
65 | return; | |
66 | } | |
67 | ||
68 | } // namespace cf | |
69 | } // namespace gnuworld |