summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-09-22 15:09:03 (GMT)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-09-22 15:09:03 (GMT)
commitccd9e5bbb686f06d6000962726ea165748d0c22a (patch)
tree5dfe46e56d235ef789610e0b2f244513a46b1ae0
parentd23e93e48181f39e58e7bf90aaebd1bc33820b18 (diff)
parent3e9c56e9a4fa27c4abb63b85bf5012bb1dab50c8 (diff)
downloadtelepathy-haze-ccd9e5bbb686f06d6000962726ea165748d0c22a.tar.gz
telepathy-haze-ccd9e5bbb686f06d6000962726ea165748d0c22a.tar.xz
Merge branch 'telepathy-haze-0.4'
Conflicts: configure.ac src/connection-aliasing.c
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am1
-rw-r--r--src/connection-aliasing.c58
-rw-r--r--tools/Makefile.am3
-rw-r--r--tools/telepathy.am39
5 files changed, 95 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 1ee1784..a0bfcdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,8 @@ tags
/tests/haze-testing.log
/tests/org.freedesktop.Telepathy.ConnectionManager.haze.service
/tests/tmp-session-bus.conf
+/telepathy-haze*.tar.gz*
+/telepathy-haze*/
*.l[ao]
*.o
diff --git a/Makefile.am b/Makefile.am
index baab706..3997cc3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,3 +5,4 @@ SUBDIRS = tools extensions src data m4 tests
EXTRA_DIST = autogen.sh
include tools/lcov.am
+include tools/telepathy.am
diff --git a/src/connection-aliasing.c b/src/connection-aliasing.c
index a942d29..5a5a276 100644
--- a/src/connection-aliasing.c
+++ b/src/connection-aliasing.c
@@ -21,6 +21,7 @@
#include "connection-aliasing.h"
#include <telepathy-glib/contacts-mixin.h>
+#include <telepathy-glib/gtypes.h>
#include <telepathy-glib/handle.h>
#include <telepathy-glib/interfaces.h>
@@ -174,6 +175,45 @@ struct _g_hash_table_foreach_all_in_my_brain
};
static void
+set_alias_success_cb (PurpleAccount *account,
+ const char *new_alias)
+{
+ TpBaseConnection *base_conn;
+ GPtrArray *aliases;
+ GValue entry = {0, };
+
+ DEBUG ("purple_account_set_public_alias succeeded, new alias %s",
+ new_alias);
+
+ base_conn = ACCOUNT_GET_TP_BASE_CONNECTION (account);
+
+ g_value_init (&entry, TP_STRUCT_TYPE_ALIAS_PAIR);
+ g_value_take_boxed (&entry,
+ dbus_g_type_specialized_construct (TP_STRUCT_TYPE_ALIAS_PAIR));
+
+ dbus_g_type_struct_set (&entry,
+ 0, base_conn->self_handle,
+ 1, new_alias,
+ G_MAXUINT);
+
+ aliases = g_ptr_array_sized_new (1);
+ g_ptr_array_add (aliases, g_value_get_boxed (&entry));
+
+ tp_svc_connection_interface_aliasing_emit_aliases_changed (base_conn,
+ aliases);
+
+ g_value_unset (&entry);
+ g_ptr_array_free (aliases, TRUE);
+}
+
+static void
+set_alias_failure_cb (PurpleAccount *account,
+ const char *error)
+{
+ DEBUG ("couldn't set alias: %s\n", error);
+}
+
+static void
set_aliases_foreach (gpointer key,
gpointer value,
gpointer user_data)
@@ -183,33 +223,37 @@ set_aliases_foreach (gpointer key,
GError *error = NULL;
TpHandle handle = GPOINTER_TO_INT (key);
gchar *new_alias = (gchar *)value;
- const gchar *bname = tp_handle_inspect (data->contact_handles, handle);
g_assert (can_alias (data->conn));
- DEBUG ("setting alias for %s to \"%s\"", bname, new_alias);
-
if (!tp_handle_is_valid (data->contact_handles, handle, &error))
{
/* stop already */
}
else if (handle == TP_BASE_CONNECTION (data->conn)->self_handle)
{
- g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
- "Sadly, there's no general API in libpurple to set your own "
- "server alias.");
+ DEBUG ("setting alias for myself to \"%s\"", new_alias);
+ purple_account_set_public_alias (data->conn->account,
+ new_alias,
+ set_alias_success_cb,
+ set_alias_failure_cb);
}
else
{
+ const gchar *bname = tp_handle_inspect (data->contact_handles, handle);
PurpleBuddy *buddy = purple_find_buddy (data->conn->account, bname);
if (buddy == NULL)
{
+ DEBUG ("can't set alias for %s to \"%s\": not on contact list",
+ bname, new_alias);
g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
- "You can't set the alias of someone not on your contact list");
+ "can't set alias for %s to \"%s\": not on contact list",
+ bname, new_alias);
}
else
{
+ DEBUG ("setting alias for %s to \"%s\"", bname, new_alias);
purple_blist_alias_buddy (buddy, new_alias);
serv_alias_buddy (buddy);
}
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 4b14f39..2b1b1b2 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -8,7 +8,8 @@ EXTRA_DIST = \
glib-signals-marshal-gen.py \
identity.xsl \
libglibcodegen.py \
- libtpcodegen.py
+ libtpcodegen.py \
+ telepathy.am
CLEANFILES = *.pyc *.pyo
diff --git a/tools/telepathy.am b/tools/telepathy.am
new file mode 100644
index 0000000..6e11fc6
--- /dev/null
+++ b/tools/telepathy.am
@@ -0,0 +1,39 @@
+## Useful top-level Makefile.am snippets for Telepathy projects.
+
+dist-hook:
+ chmod u+w ${distdir}/ChangeLog
+ if test -d ${top_srcdir}/.git; then \
+ git log --date=iso $(CHANGELOG_RANGE) > ${distdir}/ChangeLog; \
+ fi
+
+distcheck-hook:
+ @test "z$(CHECK_FOR_UNRELEASED)" = z || \
+ case @VERSION@ in \
+ *.*.*.*) ;; \
+ *) \
+ if grep -r UNRELEASED $(CHECK_FOR_UNRELEASED); \
+ then \
+ echo "^^^ This is meant to be a release, but some files say UNRELEASED" >&2; \
+ exit 2; \
+ fi \
+ ;; \
+ esac
+
+maintainer-upload-release: _maintainer-upload-release
+
+_maintainer-upload-release-check:
+ @case @VERSION@ in \
+ (*.*.*.*) \
+ echo "@VERSION@ is not a release" >&2; \
+ exit 2; \
+ ;; \
+ esac
+ test -f @PACKAGE@-@VERSION@.tar.gz
+ test -f @PACKAGE@-@VERSION@.tar.gz.asc
+ gpg --verify @PACKAGE@-@VERSION@.tar.gz.asc
+
+_maintainer-upload-release: _maintainer-upload-release-check
+ rsync -vzP @PACKAGE@-@VERSION@.tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz
+ rsync -vzP @PACKAGE@-@VERSION@.tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz.asc
+
+## vim:set ft=automake: