diff --git a/TelepathyQt/connection.cpp b/TelepathyQt/connection.cpp index aa74433..084ca63 100644 --- a/TelepathyQt/connection.cpp +++ b/TelepathyQt/connection.cpp @@ -1403,6 +1403,31 @@ ContactPtr Connection::selfContact() const } /** + * Set new contact information for this connection, replacing existing information. + * + * This method requires Contact::FeatureInfo to be ready. + * + * \param info New info to replace the old with + * \return A PendingOperation which will emit PendingOperation::finished + * when the call has finished. + */ +PendingOperation* Connection::setContactInfo(const ContactInfoFieldList& info) +{ + if (!mPriv->selfContact->actualFeatures().contains(Contact::FeatureInfo)) { + warning() << "Connection::setContactInfo() used on contact" + << "for which FeatureInfo hasn't been requested - the operation will fail"; + return new PendingFailure(TP_QT_ERROR_NOT_AVAILABLE, + QLatin1String("FeatureInfo needs to be ready in order to " + "use this method"), + ConnectionPtr(this)); + } + + Client::ConnectionInterfaceContactInfoInterface *iface = + interface(); + return new PendingVoid(iface->SetContactInfo(info), ConnectionPtr(this)); +} + +/** * Return the user's balance on the account corresponding to this connection. * * A negative amount may be possible on some services, and indicates that the user diff --git a/TelepathyQt/connection.h b/TelepathyQt/connection.h index 0ca47a5..6019805 100644 --- a/TelepathyQt/connection.h +++ b/TelepathyQt/connection.h @@ -171,6 +171,8 @@ public: uint selfHandle() const; ContactPtr selfContact() const; + PendingOperation* setContactInfo(const Tp::ContactInfoFieldList &info); + CurrencyAmount accountBalance() const; ConnectionCapabilities capabilities() const;