Bug 13124

Summary: Setting your own alias unimplemented
Product: Telepathy Reporter: Will Thompson <will>
Component: hazeAssignee: Simon McVittie <smcv>
Status: RESOLVED NOTOURBUG QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: 84yelo3, bjoern.martensen, david, felipe.contreras, om26er, shadowarts, silveringking, unmacaque
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/smcv/haze-smcv.git;a=shortlog;h=refs/heads/04-self-aliasing
Whiteboard: r+
i915 platform: i915 features:
Attachments: Proposed patch

Description Will Thompson 2007-11-07 06:05:38 UTC
This is mainly because libpurple provides no protocol-independent mechanism to set your server alias/friendly name/whatever.

Someone claimed they were adding the necessary API, but it has not materialized.
Comment 1 Andrew Alm 2008-05-08 12:27:04 UTC
I was poking around on the Trac for libpurple and found this:

http://developer.pidgin.im/doxygen/2.2.0/html/account_8h.html#62c7f2f940b5da2091564321ad2fbde8

Wouldn't that mechanism be enough to set your own alias?
Comment 2 Will Thompson 2008-05-08 13:03:27 UTC
No.  purple_account_set_alias sets the local alias for the account, which is what Pidgin displays as your name in your own conversation windows.  It does not set the public alias that other people can see.
Comment 3 Nicolò Chieffo 2009-08-21 01:40:22 UTC
I forwarded it here: http://developer.pidgin.im/ticket/10005
Comment 4 Stefan Hammer 2009-11-28 04:22:00 UTC
Found Bug on Gnome Bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=599304

and Launchpad:
https://bugs.launchpad.net/telepathy-haze/+bug/404022
Comment 5 Will Thompson 2010-02-22 05:56:18 UTC
*** Bug 26697 has been marked as a duplicate of this bug. ***
Comment 6 Simon McVittie 2010-07-15 09:11:17 UTC
(In reply to comment #0)
> This is mainly because libpurple provides no protocol-independent mechanism to
> set your server alias/friendly name/whatever.

Since 2.7.0, it does; see attached (rather simplistic) patch.

Note that in current libpurple, only the MSN prpl can take advantage of this.
Comment 7 Felipe Contreras 2010-07-18 06:41:01 UTC
(In reply to comment #6)
> Since 2.7.0, it does; see attached (rather simplistic) patch.

Which patch?

For the record, I have been pushing for this feature since a long time, and my latest proposal didn't receive any comments from Pidgin devs:
http://pidgin.im/pipermail/devel/2010-January/009177.html

My suggested patch for haze was in #26119.

It seems they added the API on 2.7.0 without even mentioning where the idea came from, nor discussing it with any potential users, and they aren't exercising it in any of their UI's. They decided it was a good idea to have callbacks without user_data pointers (silly IMO).

Anyway, fortunately it seems we don't need those pointers for now. I'm attaching a patch.
Comment 8 Felipe Contreras 2010-07-18 06:42:52 UTC
Created attachment 37172 [details] [review]
Proposed patch
Comment 9 Felipe Contreras 2010-07-18 06:46:22 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Since 2.7.0, it does; see attached (rather simplistic) patch.
> 
> Which patch?

Ah, in the URL. Well, AFAICR I tried something like that on Maemo5 and it didn't work correctly: the UI wasn't aware of the change.
Comment 10 Simon McVittie 2010-07-19 03:20:34 UTC
Review of attachment 37172 [details] [review]:

You're right that producing change notification signals is desirable, so your patch is better than mine; thanks!

I think your patch is likely to end up with the change notification getting out of sync with the state recovery, due to Bug #25869? It's better than nothing, though.

(What I mean by that is: calling RequestAliases or whatever, just after the change signal, won't give the same answer as the signal)

I'd be inclined to not do the error reporting yet (i.e. behave like we both did here); I'll open a bug for the lack of error reporting.

::: src/connection-aliasing.c
@@ +179,2 @@
 static void
+set_alias_succeess_cb (PurpleAccount *account,

It's spelled "success" :-)

@@ +189,3 @@
+    g_value_init (&entry, HAZE_TP_ALIAS_PAIR_TYPE);
+    g_value_take_boxed (&entry,
+        dbus_g_type_specialized_construct (HAZE_TP_ALIAS_PAIR_TYPE));

It'd be better to include <telepathy-glib/gtypes.h> and use TP_STRUCT_TYPE_ALIAS_PAIR (we should kill off all the HAZE_TP_*_TYPE at some point, now that telepathy-glib generates them all).

With the change I suggest below, this wouldn't be necessary anyway.

@@ +197,3 @@
+
+    aliases = g_ptr_array_sized_new (1);
+    g_ptr_array_add (aliases, g_value_get_boxed (&entry));

We know that TP_STRUCT_TYPE_ALIAS_PAIR is a GValueArray<uint,string>, so since telepathy-glib 0.9.2 (sadly not available on Maemo 5), you could delete @entry entirely, and use:

aliases = g_ptr_array_sized_new (1);
g_ptr_array_add (aliases, tp_value_array_build (2,
    G_TYPE_UINT, base_conn->self_handle,
    G_TYPE_STRING, new_alias,
    G_TYPE_INVALID));

To make backporting to Maemo 5 easier, perhaps you could implement my other suggestions from above (producing a patch suitable for backporting to Maemo), then do this simplification as a second patch?
Comment 11 Felipe Contreras 2010-07-19 14:34:13 UTC
Hmm, all bugzillas I've seen add me to the Cc list by default... I just noticed I didn't receive a notification of this comment =/

(In reply to comment #10)
> Review of attachment 37172 [details] [review]:
> 
> You're right that producing change notification signals is desirable, so your
> patch is better than mine; thanks!
> 
> I think your patch is likely to end up with the change notification getting out
> of sync with the state recovery, due to Bug #25869? It's better than nothing,
> though.

Well, it works fine on Maemo5 and Empathy: I see my nickname on the chat window.

> (What I mean by that is: calling RequestAliases or whatever, just after the
> change signal, won't give the same answer as the signal)
> 
> I'd be inclined to not do the error reporting yet (i.e. behave like we both did
> here); I'll open a bug for the lack of error reporting.
> 
> ::: src/connection-aliasing.c
> @@ +179,2 @@
>  static void
> +set_alias_succeess_cb (PurpleAccount *account,
> 
> It's spelled "success" :-)

Agh, typo.

> @@ +189,3 @@
> +    g_value_init (&entry, HAZE_TP_ALIAS_PAIR_TYPE);
> +    g_value_take_boxed (&entry,
> +        dbus_g_type_specialized_construct (HAZE_TP_ALIAS_PAIR_TYPE));
> 
> It'd be better to include <telepathy-glib/gtypes.h> and use
> TP_STRUCT_TYPE_ALIAS_PAIR (we should kill off all the HAZE_TP_*_TYPE at some
> point, now that telepathy-glib generates them all).

Ok, I just copy-pasted the code from somewhere else.

> With the change I suggest below, this wouldn't be necessary anyway.
> 
> @@ +197,3 @@
> +
> +    aliases = g_ptr_array_sized_new (1);
> +    g_ptr_array_add (aliases, g_value_get_boxed (&entry));
> 
> We know that TP_STRUCT_TYPE_ALIAS_PAIR is a GValueArray<uint,string>, so since
> telepathy-glib 0.9.2 (sadly not available on Maemo 5), you could delete @entry
> entirely, and use:
> 
> aliases = g_ptr_array_sized_new (1);
> g_ptr_array_add (aliases, tp_value_array_build (2,
>     G_TYPE_UINT, base_conn->self_handle,
>     G_TYPE_STRING, new_alias,
>     G_TYPE_INVALID));
> 
> To make backporting to Maemo 5 easier, perhaps you could implement my other
> suggestions from above (producing a patch suitable for backporting to Maemo),
> then do this simplification as a second patch?

Ok, but I think the first patch should be just like the current patch... The second one might be of wider scope touching other parts of the code that have the same issues.
Comment 12 Simon McVittie 2010-08-06 07:30:46 UTC
I've done a branch based on Felipe's patch; I think it's ready for review, but it doesn't work ideally with the MSN prpl. When changing my alias from "wtf" to "omg", I get:

(haze:20880): haze-DEBUG: set_aliases_foreach: setting alias for myself to "omg"
purple/msn-INFO: C: NS 000: PRP 17 MFN omg
purple/msn-INFO: S: NS 000: PRP 17 MFN omg
purple/msn-Message: Update contact information for Me with new display name: omg
(haze:20880): haze-DEBUG: set_alias_success_cb: purple_account_set_public_alias succeeded, new alias omg
purple/msn-INFO: S: NS 000: NLN NLN XXXXXX@hotmail.com 1 omg 1074004004 0

but then the blist-node-aliased signal fires, and gives me a different alias, that I haven't used since several attempts ago:

(haze:20880): haze-DEBUG: blist_node_aliased_cb: Contact #1 'XXXXXX@hotmail.com' changed alias from "SMcV" to "SMcV"
purple/msn-Message: Update contact information for XXXXXX@hotmail.com with new display name: omg
purple/blist-Message: Updating buddy status for XXXXXX@hotmail.com (MSN)

This appears to be because I *also* have an AB.Nickname for myself (possibly from Butterfly?), which is "SMcV", overrides the public alias, and can't be changed via Haze.

Still, if it works in some situations (lack of an AB.Nickname), it's a minor improvement...
Comment 13 Felipe Contreras 2010-08-06 08:08:56 UTC
(In reply to comment #12)
> I've done a branch based on Felipe's patch; I think it's ready for review, but
> it doesn't work ideally with the MSN prpl. When changing my alias from "wtf" to
> "omg", I get:
> 
> (haze:20880): haze-DEBUG: set_aliases_foreach: setting alias for myself to
> "omg"
> purple/msn-INFO: C: NS 000: PRP 17 MFN omg
> purple/msn-INFO: S: NS 000: PRP 17 MFN omg
> purple/msn-Message: Update contact information for Me with new display name:
> omg
> (haze:20880): haze-DEBUG: set_alias_success_cb: purple_account_set_public_alias
> succeeded, new alias omg
> purple/msn-INFO: S: NS 000: NLN NLN XXXXXX@hotmail.com 1 omg 1074004004 0
> 
> but then the blist-node-aliased signal fires, and gives me a different alias,
> that I haven't used since several attempts ago:
> 
> (haze:20880): haze-DEBUG: blist_node_aliased_cb: Contact #1
> 'XXXXXX@hotmail.com' changed alias from "SMcV" to "SMcV"
> purple/msn-Message: Update contact information for XXXXXX@hotmail.com with new
> display name: omg
> purple/blist-Message: Updating buddy status for XXXXXX@hotmail.com (MSN)
> 
> This appears to be because I *also* have an AB.Nickname for myself (possibly
> from Butterfly?), which is "SMcV", overrides the public alias, and can't be
> changed via Haze.
> 
> Still, if it works in some situations (lack of an AB.Nickname), it's a minor
> improvement...

Yes, this would only happen if:
a) the user has himself on the list
b) has a private alias for himself
c) is using the stock msn protocol

(Works fine on msn-pecan)
Comment 14 Will Thompson 2010-09-22 06:44:22 UTC
yeah, this all looks kosher. did anyone file a bug against the stock prpl?
Comment 15 Simon McVittie 2010-09-22 08:33:59 UTC
Fixed in git for 0.4.1 and 0.5.0, which will both depend on libpurple 2.7 as a result (Maemo 5 Extras have caught up with that version, so it seems reasonable to have a hard dependency even in the stable branch).

(In reply to comment #14)
> did anyone file a bug against the stock prpl?

I haven't yet; perhaps someone with a login there (Felipe?) could do so?
Comment 16 Carlos Barros 2011-07-07 01:17:36 UTC
I am so sorry I was applying the patch on Ubuntu 11.04 (I have this issue on telepathy)...

[quote]carlos@ubuntu:~$ patch -p0 < 0001-aliasing-use-new-public_set_alias.patch
bash: 0001-aliasing-use-new-public_set_alias.patch: Ficheiro ou directoria inexistente[/quote]

It says here that the file or the directory is inexistent...
Comment 17 Will Thompson 2011-07-07 03:46:49 UTC
(Changing the resolution back to FIXED… Carlos, did you mean to change it to WONTFIX?)

And, wow, I haven't made a Haze release for … 11 months. Sorry about that. I'll cut a release now.

You're trying to apply a source code patch in your home directory, which is never going to work. The patch has been merged to Git master; if you want to try the latest development version of Haze, you'll want to clone and build <http://cgit.freedesktop.org/telepathy/telepathy-haze> — but better just wait for Haze 0.5.0.
Comment 18 Carlos Barros 2011-07-07 06:31:56 UTC
(In reply to comment #17)
> (Changing the resolution back to FIXED… Carlos, did you mean to change it to
> WONTFIX?)
> 
> And, wow, I haven't made a Haze release for … 11 months. Sorry about that. I'll
> cut a release now.
> 
> You're trying to apply a source code patch in your home directory, which is
> never going to work. The patch has been merged to Git master; if you want to
> try the latest development version of Haze, you'll want to clone and build
> <http://cgit.freedesktop.org/telepathy/telepathy-haze> — but better just wait
> for Haze 0.5.0.

Sorry I'm quite new to this, I meant that it doesn't fix to me... I have Ubuntu for 2 days :( But I have 9 years of windows so I know my ways ;) .
Comment 19 Will Thompson 2011-07-09 03:46:40 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > (Changing the resolution back to FIXED… Carlos, did you mean to change it to
> > WONTFIX?)
> > 
> > And, wow, I haven't made a Haze release for … 11 months. Sorry about that. I'll
> > cut a release now.
> > 
> > You're trying to apply a source code patch in your home directory, which is
> > never going to work. The patch has been merged to Git master; if you want to
> > try the latest development version of Haze, you'll want to clone and build
> > <http://cgit.freedesktop.org/telepathy/telepathy-haze> — but better just wait
> > for Haze 0.5.0.
> 
> Sorry I'm quite new to this, I meant that it doesn't fix to me...

WONTFIX is used by developers to say “we will not fix this bug” and/or “we don't think this is a bug”. In this case, the bug was fixed, just not released.

> I have Ubuntu
> for 2 days :( But I have 9 years of windows so I know my ways ;) .

I released version 0.5.0 of telepathy-haze just now. It'll show up in the Telepathy PPA soon, I hope.
Comment 20 Carlos Barros 2011-07-09 03:52:05 UTC
Sorry I am just a newbie ^^
Comment 21 Sven Romeike 2012-03-21 02:36:46 UTC
still occures in the Ubuntu 12.04 beta with telepathy-haze 0.5.0-1
Comment 22 Sven Romeike 2012-03-21 02:37:35 UTC
I had it confirmed by a friend so it occurs in two independent systems with that version of the package
Comment 23 unmacaque 2012-03-21 02:41:24 UTC
Which is me. I am using Arch Linux with:

empathy 3.2.2
telepathy-haze 0.5.0
libpurple 2.10.2

Though the bug is marked as fixed, I still cannot change aliases of haze accounts.
Comment 24 Simon McVittie 2012-03-21 04:48:12 UTC
(In reply to comment #6)
> Note that in current libpurple, only the MSN prpl can take advantage of this.

Are you trying to set the alias of MSN or non-MSN accounts?

If you're trying to set the alias of non-MSN accounts and it doesn't work, that probably means the prpl (libpurple protocol plugin) for that protocol doesn't support setting your own alias yet. As of libpurple 2.7.0, the MSN prpl was the only one to support this.

If other prpls are enhanced to work the same way as the MSN one (if that hasn't already been done, it would be a libpurple feature request), then they should work in Haze.
Comment 25 unmacaque 2012-03-21 07:01:42 UTC
Indeed, the problem is with non-MSN accounts, ICQ and Yahoo specifically.
Comment 26 Simon McVittie 2012-03-21 07:08:47 UTC
(In reply to comment #25)
> Indeed, the problem is with non-MSN accounts, ICQ and Yahoo specifically.

Then that's not a Haze bug; please ask the developers of Pidgin (libpurple) to support the virtual methods used by purple_account_set_public_alias() in the ICQ and Yahoo prpls.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.