netconf.cpp

00001 /* 00002 $Id: netconf_8cpp-source.html,v 1.1 2004/10/05 21:12:02 mentat Exp $ 00003 00004 GNU Messenger - The secure instant messenger 00005 00006 Copyright (C) 2003 Jesse Lovelace <jllovela@eos.ncsu.edu> 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #include <string> 00024 00025 #include "gm/netconf.h" 00026 #include "gm/buffer.h" 00027 00028 namespace GNUMessenger 00029 { 00030 00031 using namespace std; 00032 00033 NetConf::NetConf() 00034 {} 00035 00036 00037 NetConf::NetConf(const NetConf& net) 00038 : XMLNode(net) 00039 {} 00040 00041 00042 NetConf::NetConf(const XMLNode& node) 00043 : XMLNode(node) 00044 {} 00045 00046 string NetConf::getProtocol() 00047 { 00048 return name(); 00049 } 00050 00051 NetConf& NetConf::setProtocol(const string& name) 00052 { 00053 setName(name); 00054 return *this; 00055 } 00056 00057 string NetConf::getServer() 00058 { 00059 return child("server").property("host"); 00060 } 00061 00062 NetConf& NetConf::setServer(const string& name) 00063 { 00064 child("server").setProperty("host", name); 00065 return *this; 00066 } 00067 00068 00069 string NetConf::getLoginServer() 00070 { 00071 return child("loginserver").property("host"); 00072 } 00073 00074 00075 NetConf& NetConf::setLoginServer(const string& name) 00076 { 00077 child("loginserver").setProperty("host", name); 00078 return *this; 00079 } 00080 00081 NetConf& NetConf::setServerPort(unsigned int port) 00082 { 00083 child("server").setProperty("port", port); 00084 return *this; 00085 } 00086 00087 unsigned int NetConf::getServerPort() 00088 { 00089 return (unsigned int)child("server").intProperty("port"); 00090 } 00091 00092 NetConf& NetConf::setLoginPort(unsigned int port) 00093 { 00094 child("loginserver").setProperty("port", port); 00095 return *this; 00096 } 00097 00098 unsigned int NetConf::getLoginPort() 00099 { 00100 return (unsigned int)child("loginserver").intProperty("port"); 00101 } 00102 00103 NetConf& NetConf::setLogin(const string& name) 00104 { 00105 child("user").setProperty("username", name); 00106 return *this; 00107 } 00108 00109 string NetConf::getLogin() const 00110 { 00111 return child("user").property("username"); 00112 } 00113 #if 0 00114 NetConf& NetConf::setPassword(const SecByteBlock& pass) 00115 { 00116 child("user").setProperty("password", string((const char *)pass.ptr, pass.Size())); 00117 return *this; 00118 } 00119 #endif 00120 NetConf& NetConf::setPassword(const VBuffer& pass) 00121 { 00122 child("user").setProperty("password", string((const char *)pass.data(), pass.size())); 00123 return *this; 00124 } 00125 00126 00127 VBuffer NetConf::getPassword() const 00128 { 00129 return VBuffer(child("user").property("password")); 00130 } 00131 00132 }

Generated on Tue Oct 5 14:41:47 2004 for GNU Messenger by doxygen 1.3.8