1
/****************************************************************************
2
** info.cpp - manage contact information
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
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.
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.
19
****************************************************************************/
32
list.setAutoDelete(TRUE);
35
void InfoBank::put_item(Info *p)
37
Info *old = get_item(p->jid);
44
Info *InfoBank::get_item(const QString &)
48
/*for(Info *p = list.start(); p; p = list.next()) {
49
if(jidcmp(p->jid, jid))
56
/* static */ void InfoBank::put(Info *p)
61
/* static */ Info *InfoBank::get(const QString &jid)
63
return IB.get_item(jid);
66
/*bool InfoBank::readUserInfo(const QString &jid, VCard *info)
69
QString str = cleanJid(jid);
70
QString fname = path_home + "/" + qstrlower(jidEncode(str)) + ".info";
71
pdb(DEBUG_JABCON, QString("UserInfo: fname=[%1]\n").arg(fname.latin1()));
73
if(!f.open(IO_ReadOnly))
76
QDomDocument doc("info");
77
if(!doc.setContent(&f)) {
83
QDomElement docElem = doc.documentElement();
84
if(!info->fromXml(docElem))
92
bool InfoBank::writeUserInfo(const QString &jid, const VCard &info)
95
QString str = cleanJid(jid);
96
QString fname = path_home + "/" + qstrlower(jidEncode(str)) + ".info";
97
pdb(DEBUG_JABCON, QString("UserInfo: fname=[%1]\n").arg(fname.latin1()));
99
if(!f.open(IO_WriteOnly))