mirror of
https://github.com/irssi/irssi.git
synced 2026-08-23 10:32:31 +02:00
Helper function for getting window item type
This commit is contained in:
parent
17021e167c
commit
f272976505
2 changed files with 28 additions and 0 deletions
|
|
@ -138,6 +138,23 @@ void window_item_set_active(WINDOW_REC *window, WI_ITEM_REC *item)
|
|||
}
|
||||
}
|
||||
|
||||
WindowType window_item_get_type(WI_ITEM_REC *item)
|
||||
{
|
||||
g_return_val_if_fail(item != NULL, WITEM_TYPE_OTHER);
|
||||
|
||||
const char *type = module_find_id_str("WINDOW ITEM TYPE", item->type);
|
||||
if (g_ascii_strcasecmp(type, "CHANNEL") == 0)
|
||||
return WITEM_TYPE_CHANNEL;
|
||||
else if (g_ascii_strcasecmp(type, "QUERY") == 0) {
|
||||
if (g_str_has_prefix("=", item->name))
|
||||
return WITEM_TYPE_QUERY | WITEM_TYPE_DCCCHAT;
|
||||
else
|
||||
return WITEM_TYPE_QUERY | WITEM_TYPE_PRIVMSG;
|
||||
}
|
||||
else
|
||||
return WITEM_TYPE_OTHER;
|
||||
}
|
||||
|
||||
/* Return TRUE if `item' is the active window item in the window.
|
||||
`item' can be NULL. */
|
||||
int window_item_is_active(WI_ITEM_REC *item)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue