]>
jfr.im git - irc/borknet/trunk.git/blob - core/modules/s/S.java
3 # BorkNet Services Core
7 # Copyright (C) 2004 Ozafy - ozafy@borknet.org - http://www.borknet.org
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.
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 # MERCHANTABotILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
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, Botoston, MA 02111-1307, USA.
27 import borknet_services
.core
.*;
29 public class S
implements Modules
33 private DBControl dbc
;
35 private String description
= "";
36 private String nick
= "";
37 private String ident
= "";
38 private String host
= "";
39 private String pass
= "";
40 private String numeric
= "";
41 private String num
= "";
42 private String reportchan
= "";
43 private String rules
= "";
44 private ArrayList
<Object
> cmds
= new ArrayList
<Object
>();
45 private ArrayList
<String
> cmdn
= new ArrayList
<String
>();
47 private int spamtext
=16;
48 private int spamchan
=64;
49 private int spamweb
=64;
50 private int spamrepeat
=24;
51 private int spamwarning
=80;
52 private int spamkill
=100;
58 public void start(Core C
)
62 numeric
= C
.get_numeric();
63 dbc
= new DBControl(C
,this);
64 ser
= new Server(C
,dbc
,this);
65 DP
= new DelPoints(dbc
);
66 Thread th1
= new Thread(DP
);
69 C
.cmd_create_service(num
, nick
, ident
, host
, "+oXwkgr", description
);
70 reportchan
= C
.get_reportchan();
71 C
.cmd_join(numeric
, num
, reportchan
);
72 List
<String
> channels
= dbc
.getChanTable();
73 //join my channels and set my modes
74 for(String channel
: channels
)
76 C
.cmd_join(numeric
,num
,channel
);
80 public void setCmnds(ArrayList
<Object
> cmds
,ArrayList
<String
> cmdn
)
86 public ArrayList
<Object
> getCmds()
91 public ArrayList
<String
> getCmdn()
99 C
.cmd_kill_service(numeric
+num
, "Quit: Spam away you trolls.");
105 C
.cmd_kill_service(numeric
+num
, "Quit: My bananas! Noes!");
108 private void load_conf()
112 ConfLoader loader
= new ConfLoader(C
,"core/modules/"+this.getClass().getName().toLowerCase()+"/"+this.getClass().getName().toLowerCase()+".conf");
114 Properties dataSrc
= loader
.getVars();
115 //set all the config file vars
116 description
= dataSrc
.getProperty("description");
117 nick
= dataSrc
.getProperty("nick");
118 ident
= dataSrc
.getProperty("ident");
119 host
= dataSrc
.getProperty("host");
120 pass
= dataSrc
.getProperty("pass");
121 num
= dataSrc
.getProperty("numeric");
122 rules
= dataSrc
.getProperty("rules");
123 spamtext
=Integer
.parseInt(dataSrc
.getProperty("spamtext"));
124 spamchan
=Integer
.parseInt(dataSrc
.getProperty("spamchan"));
125 spamweb
=Integer
.parseInt(dataSrc
.getProperty("spamweb"));
126 spamrepeat
=Integer
.parseInt(dataSrc
.getProperty("spamrepeat"));
127 spamwarning
=Integer
.parseInt(dataSrc
.getProperty("spamwarning"));
128 spamkill
=Integer
.parseInt(dataSrc
.getProperty("spamkill"));
132 C
.printDebug("Error loading configfile.");
134 C
.die("SQL error, trying to die gracefully.");
138 public void parse(String msg
)
150 public String
get_num()
154 public String
get_corenum()
158 public String
get_nick()
162 public String
get_host()
166 public String
getRules()
171 public int getSpamtext()
175 public int getSpamchan()
179 public int getSpamweb()
183 public int getSpamrepeat()
187 public int getSpamwarning()
191 public int getSpamkill()
196 public DBControl
getDBC()
205 public void reop(String chan
)
207 if(dbc
.SchanExists(chan
))
209 C
.cmd_mode(numeric
, numeric
+num
, chan
, "+o");