Commit 8ee3bbe7 authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

window: Simplify filtering chat list

parent f4c2e3c9
......@@ -271,35 +271,26 @@ static gboolean
window_chat_name_matches (ChattyItem *item,
ChattyWindow *self)
{
PurpleBlistNode *node;
ChattyProtocol protocols;
g_assert (CHATTY_IS_CHAT (item));
g_assert (CHATTY_IS_WINDOW (self));
node = (PurpleBlistNode *) chatty_chat_get_purple_chat (CHATTY_CHAT (item));
if (!node)
node = (PurpleBlistNode *)chatty_chat_get_purple_buddy (CHATTY_CHAT (item));
protocols = chatty_manager_get_active_protocols (self->manager);
if (!(protocols & chatty_item_get_protocols (item)))
return FALSE;
/* FIXME: Not a good idea */
if (node && chatty_item_get_protocols (item) != CHATTY_PROTOCOL_SMS) {
PurpleAccount *account = NULL;
if (chatty_item_get_protocols (item) != CHATTY_PROTOCOL_SMS) {
ChattyAccount *account;
if (node && !purple_blist_node_get_bool (node, "chatty-autojoin"))
if (!chatty_chat_get_auto_join (CHATTY_CHAT (item)))
return FALSE;
if (PURPLE_BLIST_NODE_IS_CHAT (node))
account = PURPLE_CHAT (node)->account;
else if (PURPLE_BLIST_NODE_IS_BUDDY (node))
account = PURPLE_BUDDY (node)->account;
account = chatty_chat_get_account (CHATTY_CHAT (item));
if (!purple_account_is_connected (account))
if (!account || chatty_account_get_status (account) != CHATTY_CONNECTED)
return FALSE;
}
......
Markdown is supported
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