[Telepathy] Question in telepathy-glib DynamicHandleRepo

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Dec 10 04:13:15 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 10 Dec 2007 at 10:33:02 +0200, Naveen Verma wrote:
> I am using telepathy-glib to write a connection manager. In telepathy-glib
> we have TpDynamicHandleRepo GObject to allocate/deallocate the handles
> dynamically. In the tp_dynamic_handle_repo_new(), we need to set
> TpDynamicHandleRepoNormalizeFunc  function pointer. I did not understand the
> use of this function from the document.Is this function is to create a
> unique user id to map with a handle?

It takes as input a string (e.g. user ID or chatroom ID) supplied by the user,
and returns either a normalized version of that string, or an error if
the string isn't valid at all. By "normalized" I mean it should return the
same thing for strings that are "equivalent" in your particular IM protocol.

For instance, in the contact handle repository for an IRC connection manager,
you might convert to lower-case and replace []\~ with {}|^ respectively (the
second set is considered to be the lower-case equivalent of the first set, for
historical reasons - see RFC2812 section 2.2), and raise an error if the
nickname contains characters not allowed by the BNF in RFC2812 section 2.3.1.

In a SIP connection manager that can handle both SIP addresses and phone
numbers, you might do something more complex, like:

foo at example.com -> sip:foo at example.com
+441234567890 -> tel:+441234567890

The same principles can be applied to the other things you might use the
dynamic handle repo for (currently, chatroom names and server-side group
names).

    Simon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFHXS1bWSc8zVUw7HYRAl6IAKDLflkuNkyBFBs9TdaO1MO+exd7QwCgstXL
hBbqopDq9Z0ZwG65jXO3OBA=
=H2P3
-----END PGP SIGNATURE-----


More information about the Telepathy mailing list