BuddyContactModel::BuddyContactModel(Buddy buddy, QObject *parent) : QAbstractListModel(parent), SourceBuddy(buddy), IncludeIdentityInDisplay(false) { connect(SourceBuddy, SIGNAL(contactAboutToBeAdded(Contact)), this, SLOT(contactAboutToBeAdded(Contact)), Qt::DirectConnection); connect(SourceBuddy, SIGNAL(contactAdded(Contact)), this, SLOT(contactAdded(Contact)), Qt::DirectConnection); connect(SourceBuddy, SIGNAL(contactAboutToBeRemoved(Contact)), this, SLOT(contactAboutToBeRemoved(Contact)), Qt::DirectConnection); connect(SourceBuddy, SIGNAL(contactRemoved(Contact)), this, SLOT(contactRemoved(Contact)), Qt::DirectConnection); }
void ContactManager::addContact(Contact contact) { if (contact.isNull()) return; ensureLoaded(); if (Contacts.contains(contact)) { contact.setType(ContactData::TypeNormal); return; } emit contactAboutToBeAdded(contact); Contacts.append(contact); emit contactAdded(contact); connect(contact.data(), SIGNAL(updated()), this, SLOT(contactDataUpdated())); connect(contact.data(), SIGNAL(accountDataAboutToBeAdded(Account *)), this, SLOT(contactAccountDataAboutToBeAdded(Account *))); connect(contact.data(), SIGNAL(accountDataAdded(Account *)), this, SLOT(contactAccountDataAdded(Account *))); connect(contact.data(), SIGNAL(accountDataAboutToBeRemoved(Account *)), this, SLOT(contactAccountDataAboutToBeRemoved(Account *))); connect(contact.data(), SIGNAL(accountDataRemoved(Account *)), this, SLOT(contactAccountDataRemoved(Account *))); connect(contact.data(), SIGNAL(accountDataIdChanged(Account *, const QString &)), this, SLOT(contactAccountDataIdChanged(Account *, const QString &))); }
void Kopete::ChatSession::addContact( const Kopete::Contact *c, bool suppress ) { //kdDebug( 14010 ) << k_funcinfo << endl; if ( d->mContactList.contains( c ) ) { kdDebug( 14010 ) << k_funcinfo << "Contact already exists" <<endl; emit contactAdded( c, suppress ); } else { if ( d->mContactList.count() == 1 && d->isEmpty ) { kdDebug( 14010 ) << k_funcinfo << " F****R ZONE " << endl; /* We have only 1 contact before, so the status of the message manager was given from that contact status */ Kopete::Contact *old = d->mContactList.first(); d->mContactList.remove( old ); d->mContactList.append( c ); disconnect( old, SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), this, SLOT( slotOnlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus &) ) ); if ( old->metaContact() ) { disconnect( old->metaContact(), SIGNAL( displayNameChanged( const QString &, const QString & ) ), this, SLOT( slotUpdateDisplayName() ) ); disconnect( old->metaContact(), SIGNAL( photoChanged() ), this, SIGNAL( photoChanged() ) ); } else
void GaduImporter::importContacts() { connect(ContactManager::instance(), SIGNAL(contactAdded(Contact &)), this, SLOT(contactAdded(Contact &))); foreach (Contact contact, ContactManager::instance()->contacts()) contactAdded(contact); importIgnored(); }
GaduRosterService::GaduRosterService(GaduListHelper *gaduListHelper, const QVector<Contact> &contacts, Protocol *protocol) : RosterService{contacts, protocol}, m_stateMachine{new GaduRosterStateMachine{this, protocol}}, m_gaduListHelper{gaduListHelper} { connect(this, SIGNAL(contactAdded(Contact)), this, SLOT(rosterChanged())); connect(this, SIGNAL(contactRemoved(Contact)), this, SLOT(rosterChanged())); connect(this, SIGNAL(contactUpdatedLocally(Contact)), this, SLOT(rosterChanged())); connect(m_stateMachine, SIGNAL(performGet()), SLOT(importContactList())); connect(m_stateMachine, SIGNAL(performPut()), SLOT(exportContactList())); }
bool SSIManager::newContact( const Oscar::SSI& contact ) { if ( d->SSIList.findIndex( contact ) == -1 ) { kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Adding contact '" << contact.name() << "' to SSI list" << endl; addID( contact ); d->SSIList.append( contact ); emit contactAdded( contact ); } else return false; return true; }
void Connection::ContactAdded (HalfPacket hp) { quint32 status = 0, contactId = 0; FromMRIM (hp.Data_, status, contactId); #ifdef PROTOCOL_LOGGING qDebug () << Q_FUNC_INFO << hp.Header_.Seq_ << status << contactId; #endif if (status == Proto::ContactAck::Success) emit contactAdded (hp.Header_.Seq_, contactId); else emit contactAdditionError (hp.Header_.Seq_, status); }
void ContactModel::addBot(MAGNORMOBOT *bot) { if (conduits.contains(bot)) { qWarning("ContactModel is already tracking %p\n", bot); return; } connect(bot, SIGNAL(contactPresenceUpdated(QString)), SLOT(updateContactPresence(QString))); connect(bot, SIGNAL(contactAdded(QString)), SLOT(addContact(QString))); connect(bot, SIGNAL(contactUpdated(QString)), SLOT(updateContact(QString))); connect(bot, SIGNAL(contactRemoved(QString)), SLOT(removeContact(QString))); connect(bot, SIGNAL(contactListReceived()), SLOT(receiveContactList())); connect(bot, SIGNAL(disconnected()), SLOT(botDisconnected()), Qt::QueuedConnection); connect(bot, SIGNAL(destroyed()), SLOT(botDestroyed())); refreshContacts(bot); }
ContactUser *ContactsManager::addContact(const QString &nickname) { Q_ASSERT(!nickname.isEmpty()); highestID++; ContactUser *user = ContactUser::addNewContact(identity, highestID); user->setParent(this); user->setNickname(nickname); connectSignals(user); qDebug() << "Added new contact" << nickname << "with ID" << user->uniqueID; pContacts.append(user); emit contactAdded(user); return user; }
void ContactsManager::loadFromSettings() { SettingsObject settings(QStringLiteral("contacts")); foreach (const QString &key, settings.data().keys()) { bool ok = false; int id = key.toInt(&ok); if (!ok) { qWarning() << "Ignoring contact" << key << " with a non-integer ID"; continue; } ContactUser *user = new ContactUser(identity, id, this); connectSignals(user); pContacts.append(user); emit contactAdded(user); highestID = qMax(id, highestID); } incomingRequests.loadRequests(); }
void Kopete::ChatSession::addContact( const Kopete::Contact *c, bool suppress ) { //kDebug( 14010 ) ; if ( d->contacts.contains( (Kopete::Contact*)c ) ) { kDebug( 14010 ) << "Contact already exists"; // emit contactAdded( c, suppress ); } else { if ( d->contacts.count() == 1 && d->isEmpty ) { kDebug( 14010 ) << " F****R ZONE "; /* We have only 1 contact before, so the status of the message manager was given from that contact status */ Kopete::Contact *old = d->contacts.first(); d->contacts.removeAll( old ); d->contacts.append( (Kopete::Contact*)c ); disconnect( old, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)), this, SLOT(slotOnlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) ); disconnect( old, SIGNAL(statusMessageChanged(Kopete::Contact*)), this, SIGNAL(statusMessageChanged(Kopete::Contact*)) ); if ( old->metaContact() ) { disconnect( old->metaContact(), SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) ); disconnect( old->metaContact(), SIGNAL(photoChanged()), this, SIGNAL(photoChanged()) ); } else disconnect( old, SIGNAL(propertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)), this, SLOT(slotUpdateDisplayName()) ); disconnect( old, SIGNAL(propertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)), this, SLOT(slotContactPropertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)) ); emit contactAdded( c, suppress ); emit contactRemoved( old, QString() ); } else {
ContactUser *ContactsManager::createContactRequest(const QString &contactid, const QString &nickname, const QString &myNickname, const QString &message) { QString hostname = ContactIDValidator::hostnameFromID(contactid); if (hostname.isEmpty() || lookupHostname(contactid) || lookupNickname(nickname)) { return 0; } bool b = blockSignals(true); ContactUser *user = addContact(nickname); blockSignals(b); if (!user) return user; user->setHostname(ContactIDValidator::hostnameFromID(contactid)); OutgoingContactRequest::createNewRequest(user, myNickname, message); /* Signal deferred from addContact to avoid changing the status immediately */ Q_ASSERT(user->status() == ContactUser::RequestPending); emit contactAdded(user); return user; }
void BuddiesAwareObject::triggerAllBuddiesAdded() { foreach (const Buddy &buddy, BuddyManager::instance()->items()) contactAdded(buddy); }
void GaduProtocol::init() { Connection = new ProtocolGaduConnection(this); Connection->setConnectionProtocol(this); m_gaduAccountAvatarService = new GaduAccountAvatarService(account(), this); CurrentChatImageService = new GaduChatImageService(account(), this); CurrentChatImageService->setConnection(Connection); CurrentImTokenService = new GaduIMTokenService{this}; CurrentFileTransferService = pluginInjectedFactory()->makeInjected<GaduFileTransferService>(this); CurrentFileTransferService->setGaduIMTokenService(CurrentImTokenService); CurrentChatService = pluginInjectedFactory()->makeInjected<GaduChatService>(account(), this); CurrentChatService->setConnection(Connection); CurrentChatService->setGaduChatImageService(CurrentChatImageService); CurrentChatService->setGaduFileTransferService(CurrentFileTransferService); CurrentChatImageService->setGaduChatService(CurrentChatService); CurrentContactPersonalInfoService = pluginInjectedFactory()->makeInjected<GaduContactPersonalInfoService>(account(), this); CurrentContactPersonalInfoService->setConnection(Connection); CurrentPersonalInfoService = pluginInjectedFactory()->makeInjected<GaduPersonalInfoService>(account(), this); CurrentPersonalInfoService->setConnection(Connection); CurrentSearchService = pluginInjectedFactory()->makeInjected<GaduSearchService>(account(), this); CurrentSearchService->setConnection(Connection); CurrentMultilogonService = new GaduMultilogonService(account(), this); CurrentMultilogonService->setConnection(Connection); CurrentChatStateService = pluginInjectedFactory()->makeInjected<GaduChatStateService>(account(), this); CurrentChatStateService->setConnection(Connection); m_gaduContactAvatarService = pluginInjectedFactory()->makeInjected<GaduContactAvatarService>(account(), this); connect( CurrentChatService, SIGNAL(messageReceived(Message)), CurrentChatStateService, SLOT(messageReceived(Message))); CurrentDriveService = pluginInjectedFactory()->makeInjected<GaduDriveService>(account(), this); CurrentDriveService->setGaduIMTokenService(CurrentImTokenService); CurrentUserDataService = pluginInjectedFactory()->makeInjected<GaduUserDataService>(m_gaduContactAvatarService, account(), this); auto contacts = contactManager()->contacts(account(), ContactManager::ExcludeAnonymous); auto rosterService = pluginInjectedFactory()->makeInjected<GaduRosterService>(m_gaduListHelper, contacts, this); rosterService->setConnection(Connection); CurrentNotifyService = new GaduNotifyService{Connection, this}; connect(rosterService, SIGNAL(contactAdded(Contact)), CurrentNotifyService, SLOT(contactAdded(Contact))); connect(rosterService, SIGNAL(contactRemoved(Contact)), CurrentNotifyService, SLOT(contactRemoved(Contact))); connect( rosterService, SIGNAL(contactUpdatedLocally(Contact)), CurrentNotifyService, SLOT(contactUpdatedLocally(Contact))); setRosterService(rosterService); configureServices(); connect(account(), SIGNAL(updated()), this, SLOT(accountUpdated())); OpenChatRunner = m_pluginInjectedFactory->makeInjected<GaduOpenChatWithRunner>(account()); OpenChatWithRunnerManager::instance()->registerRunner(OpenChatRunner); m_aggregatedAccountAvatarService->add(m_gaduAccountAvatarService); m_aggregatedContactAvatarService->add(m_gaduContactAvatarService); m_chatServiceRepository->addChatService(CurrentChatService); m_chatStateServiceRepository->addChatStateService(CurrentChatStateService); }
void PTUser::contactIsAdd() { emit contactAdded(); }
void ContactsAwareObject::triggerAllContactsAdded() { foreach (Contact contact, ContactManager::instance()->contacts()) contactAdded(contact); }