Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/rakiura/mbot/LUser.java


1   
2   package org.rakiura.mbot;
3   
4   import java.io.*;
5   import java.util.*;
6   
7   /**
8    * Represents normal IRC user.
9    *
10   * <br><br>
11   * LUser.java
12   * Created: Sat Jul 24 01:03:47 1999
13   *
14   *@author Mariusz Nowostawski
15   *@version 0.3 $Revision: 1.1.1.1 $
16   */
17  public class LUser extends AbstractUser {
18  
19    private String nick;
20    private String server;
21    private String user;
22    private String ircServer;
23  
24    boolean op;
25    boolean oper;
26    boolean voice;
27      
28    /**/
29    public LUser(String nick, String user, String server) {
30      super();
31      this.nick = nick;
32      this.user = user;
33      this.server = server;
34      ircServer = "uknown";
35      op = oper = voice = false;
36    }
37  
38    public boolean isUser(String mask){
39      return Mask.isMatch(user+"@"+server, mask);
40    }
41      
42    public String getMask(){ return (user+"@"+server).toLowerCase(); }
43    public String getNick(){ return nick; }
44    public void setNick(String n){ nick = n; }
45    public String getIrcServer(){ return ircServer; }
46    public void setIrcServer(String s){ ircServer = s; }
47  
48    public void setOp(boolean op){ this.op = op; }
49    public boolean isOp(){ return op;}
50    public void setOper(boolean oper){ this.oper = oper; }
51    public boolean isOper(){ return oper;}
52    public void setVoice(boolean voice){ this.voice = voice; }
53    public boolean isVoice(){ return voice;}
54  
55    public void presentFull(PrintWriter out){
56      Enumeration enum = flags.elements();
57      String all = "+";
58      while(enum.hasMoreElements()) all += (Character)enum.nextElement();
59      all += "  ";
60      enum = chanflags.keys();
61      while(enum.hasMoreElements()){
62        String key = (String)enum.nextElement();
63        all += key + "  +";
64        HashSet f = (HashSet)chanflags.get(key);
65        if(f!=null){
66          Enumeration e = f.elements();
67          while(e.hasMoreElements()) all += (Character)enum.nextElement();
68        }
69        all += " ";
70      }
71      String status = "";
72      if(oper) status += "*";
73      if(op) status += "@";
74      if(voice) status += "+";
75      out.println(nick+"    \t"+user+"@"+server+"\t"+all+"\t"+ircServer+"\t"+status);
76    }
77      
78  } // LUser
79  //////////////////// end of file ////////////////////