MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "module.h"
#include "chat-protocols.h"
#include "servers.h"
+#include "channels.h"
#include "queries.h"
#include "module-formats.h"
if (name == NULL || tag == NULL)
return;
- if (g_strcasecmp(type, "CHANNEL") == 0) {
+ if (g_ascii_strcasecmp(type, "CHANNEL") == 0) {
/* bind channel to window */
WINDOW_BIND_REC *rec = window_bind_add(window, tag, name);
rec->sticky = TRUE;
- } else if (g_strcasecmp(type, "QUERY") == 0 && chat_type != NULL) {
+ } else if (g_ascii_strcasecmp(type, "QUERY") == 0 && chat_type != NULL) {
CHAT_PROTOCOL_REC *protocol;
/* create query immediately */
signal_add("query created",
window->immortal = config_node_get_bool(node, "immortal", FALSE);
window_set_name(window, config_node_get_str(node, "name", NULL));
window_set_history(window, config_node_get_str(node, "history_name", NULL));
- window_set_level(window, level2bits(config_node_get_str(node, "level", "")));
+ window_set_level(window, level2bits(config_node_get_str(node, "level", ""), NULL));
window->servertag = g_strdup(config_node_get_str(node, "servertag", NULL));
window->theme_name = g_strdup(config_node_get_str(node, "theme", NULL));
CONFIG_NODE *subnode;
CHAT_PROTOCOL_REC *proto;
const char *type;
+ WINDOW_BIND_REC *rec;
type = module_find_id_str("WINDOW ITEM TYPE", item->type);
if (type == NULL)
iconfig_node_set_str(subnode, "chat_type", proto->name);
iconfig_node_set_str(subnode, "name", item->visible_name);
- if (item->server != NULL)
+ if (item->server != NULL) {
iconfig_node_set_str(subnode, "tag", item->server->tag);
- else if (IS_QUERY(item)) {
+ if (IS_CHANNEL(item)) {
+ rec = window_bind_add(window, item->server->tag, item->visible_name);
+ if (rec != NULL)
+ rec->sticky = TRUE;
+ }
+ } else if (IS_QUERY(item)) {
iconfig_node_set_str(subnode, "tag", QUERY(item)->server_tag);
}
}
if (window->theme_name != NULL)
iconfig_node_set_str(node, "theme", window->theme_name);
+ while (window->bound_items != NULL)
+ window_bind_destroy(window, window->bound_items->data);
if (window->items != NULL)
window_save_items(window, node);
void windows_layout_save(void)
{
CONFIG_NODE *node;
+ GSList *sorted;
iconfig_set_str(NULL, "windows", NULL);
node = iconfig_node_traverse("windows", TRUE);
- g_slist_foreach(windows, (GFunc) window_save, node);
+ sorted = windows_get_sorted();
+ g_slist_foreach(sorted, (GFunc) window_save, node);
+ g_slist_free(sorted);
signal_emit("layout save", 0);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
void windows_layout_reset(void)
{
+ GSList *tmp;
+
+ for (tmp = windows; tmp != NULL; tmp = tmp->next) {
+ WINDOW_REC *window = tmp->data;
+ while (window->bound_items != NULL)
+ window_bind_destroy(window, window->bound_items->data);
+ }
+
iconfig_set_str(NULL, "windows", NULL);
signal_emit("layout reset", 0);