Commit e204078a authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

chat: Add API to get chat name

parent dbfccafd
......@@ -604,6 +604,30 @@ chatty_chat_get_username (ChattyChat *self)
return "";
}
const char *
chatty_chat_get_chat_name (ChattyChat *self)
{
const char *chat_name = NULL;
g_return_val_if_fail (CHATTY_IS_CHAT (self), "");
if (self->chat_name)
return self->chat_name;
if (self->conv)
chat_name = purple_conversation_get_name (self->conv);
else if (self->buddy)
chat_name = purple_buddy_get_name (self->buddy);
if (chat_name)
self->chat_name = chatty_utils_jabber_id_strip (chat_name);
if (self->chat_name)
return self->chat_name;
return "";
}
gboolean
chatty_chat_are_same (ChattyChat *a,
ChattyChat *b)
......
......@@ -43,6 +43,7 @@ PurpleChat *chatty_chat_get_purple_chat (ChattyChat *self)
PurpleBuddy *chatty_chat_get_purple_buddy (ChattyChat *self);
PurpleConversation *chatty_chat_get_purple_conv (ChattyChat *self);
const char *chatty_chat_get_username (ChattyChat *self);
const char *chatty_chat_get_chat_name (ChattyChat *self);
gboolean chatty_chat_are_same (ChattyChat *a,
ChattyChat *b);
gboolean chatty_chat_match_purple_conv (ChattyChat *self,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment