On 15. Sep 20 11:38, Siim Salonen wrote:
> Still there were some issues. After a few days it forgot the topic and
> started using 19:.... names again.
> After investigating a bit more it seems better idea to patch skypeweb and
> use PurpleConversation->title instead of PurpleConversation->chat->topic.
> It's not enough to call purple_conversation_set_title() in skypeweb because
> the title is set after labels are already drawn. So I added a signal
> handler for "conversation-updated".

Tracking changes to conversation titles looks sensible to me and is something
that would be good to add. Below are proposed changes to the patch.

> diff --git a/src/Conversations.cpp b/src/Conversations.cpp
> index 16891b7..4f5b65e 100644
> --- a/src/Conversations.cpp
> +++ b/src/Conversations.cpp
> @@ -145,6 +145,10 @@ Conversations::Conversations()
>      handle, "buddy-typing", this, PURPLE_CALLBACK(buddy_typing_), this);
>    purple_signal_connect(
>      handle, "buddy-typing-stopped", this, PURPLE_CALLBACK(buddy_typing_), 
> this);
> +  purple_signal_connect(
> +    handle, "chat-topic-changed", this, PURPLE_CALLBACK(topic_changed_), 
> this);
> +  purple_signal_connect(
> +    handle, "conversation-updated", this, 
> PURPLE_CALLBACK(conversation_updated_), this);
>  
>    // Setup callbacks for connections in relation to conversations.
>    void *connections_handle = purple_connections_get_handle();
> diff --git a/src/Conversations.h b/src/Conversations.h
> index 51129f8..240c142 100644
> --- a/src/Conversations.h
> +++ b/src/Conversations.h
> @@ -153,6 +153,16 @@ private:
>    }
>    void buddy_typing(PurpleAccount *account, const char *who);
>  
> +  static void topic_changed_(PurpleAccount *account, const char *who, const 
> char *topic, void *data)
> +  {
> +    // reinterpret_cast<Conversations *>(data)->updateLabels();
> +  }

Handler for "chat-topic-changed" can be removed.

> +
> +  static void conversation_updated_(PurpleConversation *conv, 
> PurpleConvUpdateType type, gpointer data)
> +  {
> +    if(type==PURPLE_CONV_UPDATE_TITLE) reinterpret_cast<Conversations 
> *>(data)->updateLabels();
> +  }
> +

Handler for "conversation-updated" can be sped up by calling updateLabel() to
update only the changed conversation title. Something as follows should work:

static void conversation_updated_(PurpleConversation *conv, 
PurpleConvUpdateType type, gpointer data)
{
  reinterpret_cast<Conversations *>(data)->conversation_update(conv, type);
}

.. and in Conversations.cpp:

void Conversations::conversation_updated(PurpleConversation *conv,
  PurpleConvUpdateType type)
{
  if (type != PURPLE_CONV_UPDATE_TITLE)
    return;

  int i = findConversation(conv);
  if (i == -1)
    return;

  updateLabel(i);
}

Thanks,
Petr

-- 
_______________________________________________
Centerim-devel mailing list
Centerim-devel@centerim.org
http://centerim.org/mailman/listinfo/centerim-devel
http://www.centerim.org/

Reply via email to