Bug 311865 - KTP ContactsModel has repeated roleNames
Summary: KTP ContactsModel has repeated roleNames
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Unmaintained
Component: libktelepathy (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR major
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-18 05:38 UTC by Aleix Pol
Modified: 2013-03-05 20:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.6.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleix Pol 2012-12-18 05:38:21 UTC
At least "presence" is there twice. See
contacts-model.cpp:86
contacts-model.cpp:98

I haven't tried others

Reproducible: Always
Comment 1 Martin Klapetek 2012-12-18 06:58:09 UTC
For reference, here's the full code piece

    roles[CurrentPresenceRole] = "presence";
    roles[CurrentPresenceTypeRole] = "presenceType";
    roles[CurrentPresenceStatusRole] = "presenceStatus";
    roles[CurrentPresenceStatusMessageRole] = "presenceStatusMessage";
    roles[RequestedPresenceRole] = "requestedPresence";
    roles[RequestedPresenceTypeRole] = "requestedPresenceType";
    roles[RequestedPresenceStatusRole] = "requestedPresenceStatus";
    roles[RequestedPresenceStatusMessageRole] = "requestedPresenceStatusMessage";
    roles[ConnectionStatusRole] = "connectionStatus";
    roles[ConnectionStatusReasonRole] = "connectionStatusReason";
    roles[AliasRole] = "aliasName";
    roles[AvatarRole] = "avatar";
    roles[PresenceRole] = "presence";
    roles[PresenceIconRole] = "presenceIcon";
    roles[PresenceStatusRole] = "presenceStatus";
    roles[PresenceTypeRole] = "presenceType";
    roles[PresenceMessageRole] = "presenceMessage";

The presence on top is account presence, the presence towards bottom is contact presence (the model mixes accounts with contacts). We don't need half of these roles anyway and should return KTp::Presence where possible.

...also the license header is wrong, I'm sure I didn't write this model.
Comment 2 David Edmundson 2012-12-18 08:12:11 UTC
You didn't. It's from Tp-Qt4-Yell.

It's a bug that will be going away with my new models. 
If you want an immediate fix, remove the top "presence" as no-one uses it.
Comment 3 Martin Klapetek 2012-12-18 11:54:03 UTC
Git commit 8f2ceb81c1fdc8a11993175eab4c4aa6c4c48ce7 by Martin Klapetek.
Committed on 18/12/2012 at 12:53.
Pushed by mklapetek into branch 'master'.

Rename clashing role names
FIXED-IN: 0.6

M  +4    -4    KTp/Models/contacts-model.cpp

http://commits.kde.org/telepathy-common-internals/8f2ceb81c1fdc8a11993175eab4c4aa6c4c48ce7