22
22
#include <kdebug.h>
23
23
#include <kmessagebox.h>
24
24
#include <kopeteaccountmanager.h>
25
#include <kopetecontactlist.h>
25
26
#include "kopeteuiglobal.h"
26
27
#include "jabberprotocol.h"
27
28
#include "jabberbasecontact.h"
118
119
JabberContactPoolItem *mContactItem = findPoolItem ( mContact );
119
120
if ( mContactItem)
121
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Updating existing contact " << mContact.jid().full() << endl;
123
// It exists, update it.
124
mContactItem->contact()->updateContact ( mContact );
125
mContactItem->setDirty ( dirty );
127
//we must tell to the originating function that no new contact has been added
128
return 0L;//mContactItem->contact ();
122
if(mContactItem->contact()->inherits(roomContact ?
123
(const char*)("JabberGroupContact") : (const char*)("JabberGroupMemberContact") ) )
126
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Updating existing contact " << mContact.jid().full() << endl;
128
// It exists, update it.
129
mContactItem->contact()->updateContact ( mContact );
130
mContactItem->setDirty ( dirty );
132
//we must tell to the originating function that no new contact has been added
133
return 0L;//mContactItem->contact ();
137
//this happen if we receive a MUC invitaiton: when the invitaiton is received, it's from the muc itself
138
//and then kopete will create a temporary contact for it. but it will not be a good contact.
139
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Bad contact will be removed and re-added " << mContact.jid().full() << endl;
140
Kopete::MetaContact *old_mc=mContactItem->contact()->metaContact();
141
delete mContactItem->contact();
143
if(old_mc->contacts().isEmpty() && old_mc!=metaContact)
145
Kopete::ContactList::self()->removeMetaContact( old_mc );
131
152
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Adding new contact " << mContact.jid().full() << endl;
161
182
* The following deletion will cause slotContactDestroyed()
162
183
* to be called, which will clean the up the list.
164
delete mContactItem->contact ();
185
if(mContactItem->contact())
187
Kopete::MetaContact *mc=mContactItem->contact()->metaContact();
188
delete mContactItem->contact ();
189
if(mc && mc->contacts().isEmpty())
191
Kopete::ContactList::self()->removeMetaContact(mc) ;