[Merge] lp:~phablet-team/messaging-framework/fix-bad-initiator into lp:messaging-framework

Gustavo Pichorim Boiko gustavo.boiko at canonical.com
Wed Jun 15 02:41:48 UTC 2016


Review: Needs Fixing

Just one comment, looks good otherwise.

Diff comments:

> 
> === modified file 'src/messaging/qt/tp/connection.cpp'
> --- src/messaging/qt/tp/connection.cpp	2016-06-07 18:15:24 +0000
> +++ src/messaging/qt/tp/connection.cpp	2016-06-15 02:14:23 +0000
> @@ -312,11 +312,27 @@
>          throw std::runtime_error{"recipient type should be of type RecipientType::group to create a new group"};
>      }
>  
> -    int handle = request_handles(Tp::HandleTypeRoom, QStringList() << QString::fromStdString(new_group->id()), NULL)[0];
> +    Tp::DBusError error;
> +    int handle = request_handles(Tp::HandleTypeRoom, QStringList() << QString::fromStdString(new_group->id()), &error)[0];
>      QString initiator_normalized_id = QString::fromStdString(connection->normalize_identifier(initiator->id()));
> -    int initiator_handle = request_handles(Tp::HandleTypeContact, QStringList() << initiator_normalized_id, NULL)[0];
> -
> -    Tp::DBusError error;
> +    int initiator_handle = request_handles(Tp::HandleTypeContact, QStringList() << initiator_normalized_id, &error)[0];
> +
> +    // if there is an error requesting handles, reject the group creation
> +    if (error.isValid()) {
> +        std::shared_ptr<GroupStarter> group_starter = connection->group_starter();
> +        messaging::Group::shared_ptr group = std::dynamic_pointer_cast<messaging::Group>(new_group);
> +        try
> +        {
> +            group_starter->reject_group(group);
> +        }
> +        catch (const std::exception &e)
> +        {
> +            LOG(ERROR) << "Group creation rejected, " << e.what();
> +            error.set(TP_QT_ERROR_CANCELLED, "Group creation rejected");

I think this should read "Group rejection failed"

> +        }
> +        return;
> +    }
> +
>      QVariantMap request;
>      request[TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")] = TP_QT_IFACE_CHANNEL_TYPE_TEXT;
>      request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")] = Tp::HandleTypeRoom;


-- 
https://code.launchpad.net/~phablet-team/messaging-framework/fix-bad-initiator/+merge/297416
Your team Ubuntu Phablet Team is subscribed to branch lp:messaging-framework.



More information about the Ubuntu-reviews mailing list