Hi, I've been playing with adding more user information support to LICQ. I have been able to add support for parsing the relevant packets, and also a bare-bones display in the qt-gui. This seems to do the trick on my computer. However because I'm trying to teach myself C++ in the process, I don't know if the way I've chosen to store the data is good, bad, or even buggy.
This information doesn't fit into LICQ's user data structure because any user can list any number of Interests, Pasts, and Email addresses. For example, each Interest is composed of a codenumber representing which interest group it belongs to, plus a text description provided by the user. Each user can have many Interests. Please help! Tom. - - - - - The data is stored in the ICQUser object in the variables: CUserInfoData m_cInterests, m_cPasts, m_cEmails which are initially set to NULL in user.cpp These can be set: void SetInterests (unsigned short n, unsigned short *cn, char **sp) { if (m_cInterests != NULL) delete m_cInterests; m_cInterests = new CUserInfoData(n, cn, sp); } And retrieved: CUserInfoData *GetInterests() { return m_cInterests; } But I haven't worked out any way to save them to disk yet. - - - - - In licq_user.h: class CUserInfoData { public: // n == number of items // *codenumber == array of item code numbers // **desc == array of item text descriptions CUserInfoData(unsigned short n, unsigned short* codenumber, char** desc); ~CUserInfoData(); unsigned short nCodes; unsigned short* nCodeNumber; char** szCodeDesc; }; - - - - - In user.cpp: CUserInfoData::CUserInfoData(unsigned short n, unsigned short* codenumber, char** desc) { nCodes = n; nCodeNumber = new unsigned short[n]; szCodeDesc = new char*[n]; for(int i=0;i<n;i++) { nCodeNumber[i] = codenumber[i]; szCodeDesc[i] = new char[strlen(desc[i]) + 1]; strcpy(szCodeDesc[i], desc[i]); } } CUserInfoData::~CUserInfoData() { delete[] nCodeNumber; for(int i=0;i<nCodes;i++) { delete[] szCodeDesc[i]; } delete[] szCodeDesc; } _______________________________________________ Licq-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/licq-devel