[Telepathy] [SOS!!]how to get group members?
孟倩倩
tiny.qqm at gmail.com
Sun Oct 14 23:05:09 PDT 2007
hi, everyone:
I have a problem when I try to get group members of contactlist. Now I
can create account and have already got the connection interface and can
list channels of the connection, also can get channel
interface--org.freedesktop.Telepathy.Channel.Type.ContactList, but when I
try to get the members of the contacelist, I don't know how to thansfer the
parameter--DBusGProxy *proxy?
For implementations of the interface
org.freedesktop.Telepathy.channel.type.contacetlist must also implement
org.freedesktop.Telepathy.channel and
org.freedesktop.Telepathy.channel.interface.group.
I try to request channel list by the interface --
org.freedesktop.Telepathy.Channel.Type.ContactList, using the TpConn which I
already got, it generates "Segmentation fault", I don't know why, please
help me, thank you.
some source and result as follow:
1.mc = mission_control_new ( tp_get_bus() );
2.tp_cm = mission_control_get_connection(mc, account, &new_error);
//account I have already create correctly
3.tp_conn_get_status(DBUS_G_PROXY(tp_cm), &status, &new_error)---//the
status is connected
4.tp_conn_request_handles(DBUS_G_PROXY(tp_cm), TP_HANDLE_TYPE_CONTACT,
hdl_names, &hdl_list, &new_error)//hdl_list as follow:
guint i = 0;
for ( ; i < hdl_list->len; i++ ) {
guint handler =
g_array_index(hdl_list, guint, i);
g_debug("handler_name: %s
handler: %d", hdl_names[i], handler);
mission_control_request_channel
(mc, account, TP_IFACE_CHANNEL_TYPE_TEXT, handler,
TP_HANDLE_TYPE_CONTACT, NULL, NULL);
}
** (process:804): DEBUG:
handler_name: tester1 at ch-zlj.rd.fr
<tester1 at ch-zlj.rd.francetelecom.fr>handler: 1
5.tp_conn_list_channels(DBUS_G_PROXY(tp_cm), &channel_list,
&new_error)//channel_list as follow:
for(i=0; i < channel_list->len; i++) {
GValueArray *chan_struct;
const gchar *object_path;
const gchar *chan_iface;
TelepathyHandleType handle_type;
guint handle;
chan_struct = g_ptr_array_index (channel_list, i);
object_path = g_value_get_boxed (g_value_array_get_nth (chan_struct,
0));
chan_iface = g_value_get_string (g_value_array_get_nth (chan_struct,
1));
handle_type = g_value_get_uint (g_value_array_get_nth (chan_struct,
2));
handle = g_value_get_uint (g_value_array_get_nth (chan_struct, 3));
g_debug("object_path: %s", object_path);
g_debug("chan_iface : %s", chan_iface);
g_debug("handle_type: %d", handle_type);
g_debug("handle : %d", handle);
g_value_array_free (chan_struct);
}
** (process:804): DEBUG: object_path:
/org/freedesktop/Telepathy/Connection/gabble/jabber/tester1_40ch_2dzlj_2erd_2efrancetelecom_2efr_2fTelepathy/RosterChannel/Group/zzz
** (process:804): DEBUG: chan_iface :
org.freedesktop.Telepathy.Channel.Type.ContactList
** (process:804): DEBUG: handle_type: 4
** (process:804): DEBUG: handle : 1
** (process:804): DEBUG: object_path:
/org/freedesktop/Telepathy/Connection/gabble/jabber/tester1_40ch_2dzlj_2erd_2efrancetelecom_2efr_2fTelepathy/RosterChannel/Group/co_2dworkers
** (process:804): DEBUG: chan_iface :
org.freedesktop.Telepathy.Channel.Type.ContactList
** (process:804): DEBUG: handle_type: 4
** (process:804): DEBUG: handle : 2
** (process:804): DEBUG: object_path:
/org/freedesktop/Telepathy/Connection/gabble/jabber/tester1_40ch_2dzlj_2erd_2efrancetelecom_2efr_2fTelepathy/RosterChannel/List/publish
** (process:804): DEBUG: chan_iface :
org.freedesktop.Telepathy.Channel.Type.ContactList
** (process:804): DEBUG: handle_type: 3
** (process:804): DEBUG: handle : 1
** (process:804): DEBUG: object_path:
/org/freedesktop/Telepathy/Connection/gabble/jabber/tester1_40ch_2dzlj_2erd_2efrancetelecom_2efr_2fTelepathy/RosterChannel/List/subscribe
** (process:804): DEBUG: chan_iface :
org.freedesktop.Telepathy.Channel.Type.ContactList
** (process:804): DEBUG: handle_type: 3
** (process:804): DEBUG: handle : 2
** (process:804): DEBUG: object_path:
/org/freedesktop/Telepathy/Connection/gabble/jabber/tester1_40ch_2dzlj_2erd_2efrancetelecom_2efr_2fTelepathy/RosterChannel/List/known
** (process:804): DEBUG: chan_iface :
org.freedesktop.Telepathy.Channel.Type.ContactList
** (process:804): DEBUG: handle_type: 3
** (process:804): DEBUG: handle : 3
** (process:804): DEBUG: object_path:
/org/freedesktop/Telepathy/Connection/gabble/jabber/tester1_40ch_2dzlj_2erd_2efrancetelecom_2efr_2fTelepathy/ImChannel1
** (process:804): DEBUG: chan_iface :
org.freedesktop.Telepathy.Channel.Type.Text
** (process:804): DEBUG: handle_type: 1
** (process:804): DEBUG: handle : 1
6.Then I try to get members
gchar *object_path;
const gchar *bus_name;
TpChan *new_chan;
if (!tp_conn_request_channel (DBUS_G_PROXY (tp_cm),
TP_IFACE_CHANNEL_TYPE_CONTACT_LIST,
TP_HANDLE_TYPE_GROUP,
handle_test,
FALSE,
&object_path,
&new_error)) {
g_debug ("Couldn't request channel: %s",
new_error ? new_error->message : "No error given");
g_clear_error (&new_error);
g_object_unref (mc);
g_object_unref (tp_cm);
return;
}
bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_cm));
new_chan = tp_chan_new (tp_get_bus (),
bus_name,
object_path,
TP_IFACE_CHANNEL_TYPE_CONTACT_LIST,
TP_HANDLE_TYPE_GROUP,
handle);//when I use handle 0, the result is "Segmentation
fault"
when I use handle 3, the result is "Couldn't
request channel: invalid handle 3"
GArray *member_list = NULL;
tp_chan_iface_group_get_members (DBUS_G_PROXY(new_chan),
&member_list,
&new_error);
--tiny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/telepathy/attachments/20071015/48e4e44b/attachment.html
More information about the Telepathy
mailing list