]> jfr.im git - irc/Ozafy/borknet_p10_irc_services.git/blob - core/modules/s/Server.java
Readme
[irc/Ozafy/borknet_p10_irc_services.git] / core / modules / s / Server.java
1 /**
2 #
3 # BorkNet Services Core
4 #
5
6 #
7 # Copyright (C) 2004 Ozafy - ozafy@borknet.org - http://www.borknet.org
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, USA.
22 #
23 */
24 import java.util.*;
25 import java.net.*;
26 import borknet_services.core.*;
27
28 /**
29 * The server communication class of the Q IRC Bot.
30 * @author Ozafy - ozafy@borknet.org - http://www.borknet.org
31 */
32 public class Server
33 {
34 /** the main bot */
35 private Core C;
36 /** the connection to the database */
37 private DBControl dbc;
38 /** Core commands */
39 private Commands CC;
40 /** the bot's nick */
41 private String nick;
42 /** the bot's host */
43 private String host;
44 /** the server's numeric */
45 private String numeric;
46 /** the bot's numeric */
47 private String corenum;
48 /** the channel we report to */
49 private String reportchan;
50 /** our version reply */
51 private String version;
52 /** counts the number of received pings, used as a timer for channel limits */
53 private int limit = 0;
54
55 private S Bot;
56
57
58 /**
59 * Constructs a Server communicator.
60 * @param B The main bot
61 * @param dbc The connection to the database
62 */
63 public Server(Core C, DBControl dbc, S Bot)
64 {
65 this.C = C;
66 this.Bot = Bot;
67 this.dbc = dbc;
68 CC = new Commands(C,Bot);
69 nick = C.get_nick();
70 host = C.get_host();
71 numeric = C.get_numeric();
72 corenum = C.get_corenum();
73 version = C.get_version();
74 reportchan = C.get_reportchan();
75 }
76
77 public void parse(ArrayList<String> params)
78 {
79 String source = params.get(0);
80 String command = params.get(1);
81 if(command.equals("P"))
82 {
83 privmsg(params);
84 }
85 }
86
87 /**
88 * Handles a privmsg
89 * @param me Server it's going to.
90 * @param username numeric of the user talking to me
91 * @param message the message we got from the user
92 */
93 public void privmsg(ArrayList<String> params)
94 {
95 CC.privmsg(params);
96 }
97 }