View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.plugin.gift.net;
21  
22  import java.util.StringTokenizer;
23  
24  import javax.swing.Action;
25  
26  import org.xnap.XNap;
27  import org.xnap.peer.AbstractPeer;
28  
29  
30  /***
31   * GiFTUser
32   *
33   * @author <a href="mailto:tvanlessen@taval.de">Tammo van Lessen</a>
34   * @version CVS $Id: GiFTUser.java,v 1.4 2004/07/20 18:02:28 leist Exp $
35   */
36  public class GiFTUser extends AbstractPeer {
37      //~ Instance fields --------------------------------------------------------
38  
39      private String username;
40      private String host;
41  
42      //~ Constructors -----------------------------------------------------------
43  
44      /***
45       * Constructor for GiFTUser.
46       *
47       * @param user DOCUMENT ME!
48       */
49      public GiFTUser(String user) {
50      	super(null);
51      	
52          username = user;
53  
54  		if (user != null) {
55  			StringTokenizer st = new StringTokenizer(user, "@");
56  
57  			if (st.countTokens() == 1) {
58  				setName(user);
59  				this.host = user;
60  			} else {
61  				setName(st.nextToken());
62  				this.host = st.nextToken();
63  			}
64  		}
65      }
66  
67      //~ Methods ----------------------------------------------------------------
68  
69  	/***
70  	 * @see xnap.peer.Peer#getActions()
71  	 */
72  	public Action[] getActions() {
73  		return null;
74  	}
75  
76  	/***
77  	 * @see xnap.peer.Peer#getHost()
78  	 */
79  	public String getHost() {
80  		return host;
81  	}
82  
83  	/***
84  	 * @see xnap.peer.Peer#getLocalDownloadCount()
85  	 */
86  	public int getLocalDownloadCount() {
87  		return 0;
88  	}
89  
90  	/***
91  	 * @see xnap.peer.Peer#getLocalUploadCount()
92  	 */
93  	public int getLocalUploadCount() {
94  		return 0;
95  	}
96  
97  	/***
98  	 * @see xnap.peer.Peer#getStatus()
99  	 */
100 	public String getStatus() {
101 		return XNap.tr("Online");
102 	}
103 
104 	/***
105 	 * @return the username
106 	 */
107 	public String getUsername() {
108 		return username;
109 	}
110 
111 }