[Telepathy] regarding sending and receiving messages using telepathy

harini satyanarayanan hpundis1 at binghamton.edu
Wed Feb 20 12:54:58 PST 2008


Hi,
   I have been using the telepathy spec and looking at the empathy
code to establish a chat channel on my Nokia N800. I succeded in it
with some help from the mailing list. currently there are a couple of
thisgs that i dont understand.

firstly when i query pending messages and then send a message it works
fine. now if i send a message put the program to sleep for sometime
then query for pending messages it throws a seg fault.

It is essentially not able to complete the pending message call
itself. and when it throws an error when i try to access the
error->message. I am not sure why it would throw an error if the
sequence of these calls changes.

here is a snipet of my code and the output,

this is to send messages,

        text_iface = tp_chan_get_interface (text_channel,
TELEPATHY_CHAN_IFACE_TEXT_QUARK);
        if (text_iface == NULL)
          {
            g_print("Could not acquire text interface proxy for
channel for sending messages \n");
          }
        else
          {

            dbus_g_proxy_add_signal(text_iface, "Received",
G_TYPE_UINT,G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,G_TYPE_STRING,
G_TYPE_INVALID);
            g_print("Text interface proxy acquired for sending messages. \n");
            g_print("Send Messages\n");


            if (!tp_chan_type_text_send(text_iface,TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,"trial
message", &error))
              {
                g_print("Error sending message list: %s.\n",error->message);
              }
            else
              {
                g_print("\n telepathy_send_message: handle: %d
handle_type: %d type: %s \n ", text_channel->handle,
text_channel->handle_type,
dbus_g_proxy_get_path(DBUS_G_PROXY(text_channel)));
              }


this is to query pending messages

 text_if = tp_chan_get_interface(text_channel ,
TELEPATHY_CHAN_IFACE_TEXT_QUARK);
        if (text_if == NULL)
          {
            g_print("Could not acquire text interface proxy for
channel for pending messages\n");
          }
        else
          {
            /*
             * Attach a received text handler to the type interface proxy
             */

            dbus_g_proxy_add_signal(text_if, "Received",
G_TYPE_UINT,G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,G_TYPE_STRING,
G_TYPE_INVALID);
            g_print("Text interface proxy acquired for pending messages. \n");
            g_print("ListPendingMessages\n");

            /* Set the boolean value to TRUE inorder to indicate that
            * all pending messages have already been queried
            */

            if (!tp_chan_type_text_list_pending_messages(text_if, TRUE
, &msglist, &error))
              {
                g_print("Error acquiring pending message list:
%s.\n",error->message);
              }
            else
              {
                //Print all the pending messages
                g_print("\n The length of pending message %d \n ",msglist->len);


here is how i call them

 TpChan* text_channel = tp_conn_new_channel(dbus_conn,
tp_connection,bus_name,TP_IFACE_CHANNEL_TYPE_TEXT,
                                          TP_HANDLE_TYPE_CONTACT,handle1, TRUE);

     telepathy_sending_messages(text_channel);

     sleep(5);

     telepathy_pending_message(text_channel);


output,
Attempting to create a text channel object.
Creation of a channel object succeeded.
mission-control-test[1301]: GLIB CRITICAL ** default -
dbus_g_proxy_add_signal: assertion `g_datalist_id_get_data
(&priv->signal_signatures, q) == NULL' failed
Text interface proxy acquired for sending messages.
Send Messages

 telepathy_send_message: handle: 11 handle_type: 1 type:
/org/freedesktop/Telepathy/Connection/gabble/jabber/hari85ni_40gmail_2ecom_2fTelepathy/ImChannel11
 mission-control-test[1301]: GLIB CRITICAL ** default -
dbus_g_proxy_add_signal: assertion `DBUS_IS_G_PROXY (proxy)' failed
Text interface proxy acquired for pending messages.
ListPendingMessages
mission-control-test[1301]: GLIB CRITICAL ** default -
dbus_g_proxy_call: assertion `DBUS_IS_G_PROXY (proxy)' failed
two
Segmentation fault


sorry about such a long mail buy any hekp is greatly appreciated

thanks,
harini


More information about the Telepathy mailing list