KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freecs > content > BanObject


1 /**
2  * Copyright (C) 2003 Manfred Andres
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * Created on 07.05.2004
19  */

20
21 package freecs.content;
22
23 import freecs.Server;
24
25
26
27 public class BanObject {
28     public String JavaDoc msg, bannedBy; // infos on how this ban happened
29
public String JavaDoc usr, cookie, email; // properties, which are banned
30
public Connection con;
31     public String JavaDoc hostban;
32     public long time;
33     public BanObject (String JavaDoc msg, String JavaDoc bannedBy, long time) {
34         this.bannedBy = bannedBy;
35         this.time = time;
36         this.msg = msg;
37         if (Server.TRACE_CREATE_AND_FINALIZE)
38             Server.log (this, "++++++++++++++++++++++++++++++++++++++++CREATE", Server.MSG_STATE, Server.LVL_VERY_VERBOSE);
39     }
40     
41     public boolean equals (Object JavaDoc o) {
42         if (o == this)
43             return true;
44         if (!(o instanceof BanObject))
45             return false;
46         BanObject bo = (BanObject) o;
47         if (this.usr == null && bo.usr != null)
48             return false;
49         if (this.usr != null && !this.usr.equals(bo.usr))
50             return false;
51         if (this.cookie == null && bo.cookie != null)
52             return false;
53         if (this.cookie != null && !this.cookie.equals(bo.cookie))
54             return false;
55         if (this.con == null && bo.con != null)
56             return false;
57         if (this.con != null && bo.con==null)
58             return false;
59         if (this.con != null && !this.con.getBanKey().equals(bo.con.getBanKey()))
60             return false;
61         if (this.email != null && !this.email.equals(bo.email))
62             return false;
63         return true;
64     }
65
66     public void finalize() {
67         if (Server.TRACE_CREATE_AND_FINALIZE)
68             Server.log(this, "----------------------------------------FINALIZED", Server.MSG_STATE, Server.LVL_VERY_VERBOSE);
69     }
70 }
Popular Tags