libpurple/purpleprotocolroomlist.c

Fri, 12 Aug 2022 03:44:34 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 12 Aug 2022 03:44:34 -0500
branch
gtk4
changeset 41560
2579a5138f0c
parent 41028
943b2cb45314
child 41960
c8a4853205e3
permissions
-rw-r--r--

A bunch of random fixes for the the gtk4 branch

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/1581/

/*
 * Purple - Internet Messaging Library
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more dteails.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses/>.
 */

#include "purpleprotocolroomlist.h"

/******************************************************************************
 * GObject Implementation
 *****************************************************************************/
G_DEFINE_INTERFACE(PurpleProtocolRoomlist, purple_protocol_roomlist,
                   PURPLE_TYPE_PROTOCOL)

static void
purple_protocol_roomlist_default_init(PurpleProtocolRoomlistInterface *iface) {
}

/******************************************************************************
 * Public API
 *****************************************************************************/
PurpleRoomlist *
purple_protocol_roomlist_get_list(PurpleProtocolRoomlist *protocol_roomlist,
                                  PurpleConnection *gc)
{
	PurpleProtocolRoomlistInterface *iface = NULL;

	g_return_val_if_fail(PURPLE_IS_PROTOCOL_ROOMLIST(protocol_roomlist), NULL);
	g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL);

	iface = PURPLE_PROTOCOL_ROOMLIST_GET_IFACE(protocol_roomlist);
	if(iface != NULL && iface->get_list != NULL) {
		return iface->get_list(protocol_roomlist, gc);
	}

	return NULL;
}

void
purple_protocol_roomlist_cancel(PurpleProtocolRoomlist *protocol_roomlist,
                                PurpleRoomlist *list)
{
	PurpleProtocolRoomlistInterface *iface = NULL;

	g_return_if_fail(PURPLE_IS_PROTOCOL_ROOMLIST(protocol_roomlist));
	g_return_if_fail(PURPLE_IS_ROOMLIST(list));

	iface = PURPLE_PROTOCOL_ROOMLIST_GET_IFACE(protocol_roomlist);
	if(iface != NULL && iface->cancel != NULL) {
		iface->cancel(protocol_roomlist, list);
	}
}

void
purple_protocol_roomlist_expand_category(PurpleProtocolRoomlist *protocol_roomlist,
                                         PurpleRoomlist *list,
                                         PurpleRoomlistRoom *category)
{
	PurpleProtocolRoomlistInterface *iface = NULL;

	g_return_if_fail(PURPLE_IS_PROTOCOL_ROOMLIST(protocol_roomlist));
	g_return_if_fail(PURPLE_IS_ROOMLIST(list));

	iface = PURPLE_PROTOCOL_ROOMLIST_GET_IFACE(protocol_roomlist);
	if(iface != NULL && iface->expand_category != NULL) {
		iface->expand_category(protocol_roomlist, list, category);
	}
}

gchar *
purple_protocol_roomlist_room_serialize(PurpleProtocolRoomlist *protocol_roomlist,
                                        PurpleRoomlistRoom *room)
{
	PurpleProtocolRoomlistInterface *iface = NULL;

	g_return_val_if_fail(PURPLE_IS_PROTOCOL_ROOMLIST(protocol_roomlist), NULL);
	g_return_val_if_fail(room != NULL, NULL);

	iface = PURPLE_PROTOCOL_ROOMLIST_GET_IFACE(protocol_roomlist);
	if(iface != NULL && iface->room_serialize != NULL) {
		return iface->room_serialize(protocol_roomlist, room);
	}

	return NULL;
}

mercurial