1 /* Copyright (C) 2000-2006 Thomas Bopp, Thorsten Hampel, Ludger Merkens
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * $Id: login.pike,v 1.1 2008/03/31 13:39:57 exodusd Exp $
31 * Get the connected user object of this socket.
33 * @return the user object
35 object get_user_object()
41 * return the object id of this object - the id of the connected user
43 * @return the object id
45 final object get_object_id()
48 return oUser->get_object_id();
54 * Get the object class of the connected user object.
56 * @return the users object class (CLASS_USER)
58 final int get_object_class()
61 return oUser->get_object_class();
67 * Get the client description of this socket.
69 * @return client description of the socket.
71 string get_client_class()
77 * Check if a given object is the user object of this connection.
79 * @param object obj - object to check if its oUser
80 * @return true or false
85 is_user_object(object obj)
87 if ( !objectp(obj) || !objectp(oUser) )
89 if ( obj->get_object_id() == oUser->get_object_id() )
97 * Connect this socket object with an user object.
99 * @param object uid - the user to connect to
100 * @return the last login of the user
103 int login_user(object uid)
105 if ( objectp(oUser) ) {
106 // disconnect other user first
110 return oUser->connect(this_object());
118 if ( objectp(oUser) )
126 * Get the client features of the connection set upon login.
128 * @return client features described in client.h
130 int get_client_features()
132 return iClientFeatures;
137 return iClientFeatures;
140 string get_identifier()
142 if ( objectp(oUser) )
143 return oUser->get_identifier();
149 return "~" + (objectp(oUser) ? oUser->get_identifier(): "anonymous");