00001 #include <qpe/global.h> 00002 #include <qpe/contact.h> 00003 00004 #include <qobject.h> 00005 #include <qfile.h> 00006 00007 #include "ircserver.h" 00008 #include "ircversion.h" 00009 00010 00011 IRCServer::IRCServer() { 00012 m_port = 6667; 00013 } 00014 00015 /* Setter implementations */ 00016 00017 void IRCServer::setHostname(QString hostname) { 00018 m_hostname = hostname; 00019 } 00020 00021 void IRCServer::setName(QString name) { 00022 m_name = name; 00023 } 00024 00025 void IRCServer::setPort(int port) { 00026 m_port = port; 00027 } 00028 00029 void IRCServer::setUsername(QString username) { 00030 m_username = username; 00031 } 00032 00033 void IRCServer::setPassword(QString password) { 00034 m_password = password; 00035 } 00036 00037 void IRCServer::setNick(QString nick) { 00038 m_nick = nick; 00039 } 00040 00041 void IRCServer::setRealname(QString realname) { 00042 m_realname = realname; 00043 } 00044 00045 void IRCServer::setChannels(QString channels) { 00046 m_channels = channels; 00047 } 00048 00049 /* Getter implementations */ 00050 00051 QString IRCServer::hostname() { 00052 return m_hostname; 00053 } 00054 00055 QString IRCServer::name() { 00056 return m_name; 00057 } 00058 00059 unsigned short int IRCServer::port() { 00060 if(m_port) 00061 return m_port; 00062 00063 return 6667; 00064 } 00065 00066 QString IRCServer::username() { 00067 return m_username; 00068 } 00069 00070 QString IRCServer::password() { 00071 return m_password; 00072 } 00073 00074 QString IRCServer::nick() { 00075 return m_nick; 00076 } 00077 00078 QString IRCServer::realname() { 00079 if(!m_realname.isEmpty()) 00080 return m_realname; 00081 // Try to fetch realname from addressbook 00082 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 00083 if ( QFile::exists( file ) ) { 00084 Contact cont = Contact::readVCard( file )[0]; 00085 QString realName = cont.fullName(); 00086 if(!realName.isEmpty()) 00087 return realName; 00088 } 00089 00090 return QString(APP_VERSION + QObject::tr(" User")); 00091 } 00092 00093 QString IRCServer::channels() { 00094 return m_channels; 00095 } 00096
1.4.2