registration.h

00001 /*
00002   Copyright (c) 2005 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef REGISTRATION_H__
00015 #define REGISTRATION_H__
00016 
00017 #include "iqhandler.h"
00018 #include "registrationhandler.h"
00019 
00020 #include <string>
00021 #include <map>
00022 
00023 namespace gloox
00024 {
00025 
00026   class ClientBase;
00027   class Stanza;
00028 
00056   class GLOOX_EXPORT Registration : public IqHandler
00057   {
00058     public:
00059 
00064       struct fieldStruct
00065       {
00066         std::string username;
00067         std::string nick;
00068         std::string password;
00069         std::string name;
00070         std::string first;
00071         std::string last;
00072         std::string email;
00073         std::string address;
00074         std::string city;
00075         std::string state;
00076         std::string zip;
00077         std::string phone;
00078         std::string url;
00079         std::string date;
00080         std::string misc;
00081         std::string text;
00082       };
00083 
00087       enum fieldEnum
00088       {
00089         FIELD_USERNAME =     1,
00090         FIELD_NICK     =     2,
00091         FIELD_PASSWORD =     4,
00092         FIELD_NAME     =     8,
00093         FIELD_FIRST    =    16,
00094         FIELD_LAST     =    32,
00095         FIELD_EMAIL    =    64,
00096         FIELD_ADDRESS  =   128,
00097         FIELD_CITY     =   256,
00098         FIELD_STATE    =   512,
00099         FIELD_ZIP      =  1024,
00100         FIELD_PHONE    =  2048,
00101         FIELD_URL      =  4096,
00102         FIELD_DATE     =  8192,
00103         FIELD_MISC     = 16384,
00104         FIELD_TEXT     = 32768
00105       };
00106 
00111       Registration( ClientBase *parent );
00112 
00116       virtual ~Registration();
00117 
00123       void fetchRegistrationFields();
00124 
00133       void createAccount( int fields, fieldStruct values );
00134 
00138       void removeAccount();
00139 
00144       void changePassword( const std::string& password );
00145 
00150       void registerRegistrationHandler( RegistrationHandler *rh );
00151 
00155       void removeRegistrationHandler();
00156 
00157       // reimplemented from IqHandler
00158       virtual bool handleIq( Stanza *stanza );
00159 
00160       // reimplemented from IqHandler
00161       virtual bool handleIqID( Stanza *stanza, int context );
00162 
00163     private:
00164       enum IdType
00165       {
00166         FETCH_REGISTRATION_FIELDS,
00167         CREATE_ACCOUNT,
00168         REMOVE_ACCOUNT,
00169         CHANGE_PASSWORD
00170       };
00171 
00172       ClientBase *m_parent;
00173       RegistrationHandler *m_registrationHandler;
00174   };
00175 
00176 }
00177 
00178 #endif // REGISTRATION_H__

Generated on Mon Jan 16 16:19:54 2006 for gloox by  doxygen 1.4.6