static void
show_notification (const char *title, const char *text)
{
	char *stripped_title, *stripped_text;

	/* Strip all colors */
	stripped_title = hexchat_strip (ph, title, -1, 7);
	stripped_text = hexchat_strip (ph, text, -1, 7);
	
	notification_backend_show (stripped_title, stripped_text);

	hexchat_free (ph, stripped_title);
	hexchat_free (ph, stripped_text);
}
Exemple #2
0
static int api_hexchat_strip(lua_State *L)
{
	size_t len;
	char const *text;
	gboolean leave_colors, leave_attrs;
	char *result;

	luaL_checktype(L, 1, LUA_TSTRING);
	text = lua_tolstring(L, 1, &len);
	leave_colors = lua_toboolean(L, 2);
	leave_attrs = lua_toboolean(L, 3);
	result = hexchat_strip(ph, text, len, (leave_colors ? 0 : 1) | (leave_attrs ? 0 : 2));
	if(result)
	{
		lua_pushstring(L, result);
		hexchat_free(ph, result);
		return 1;
	}
	return 0;
}