libpurple/protocols/jabber/data.h

Tue, 16 Aug 2022 00:18:33 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Tue, 16 Aug 2022 00:18:33 -0500
changeset 41501
e34ec115fc34
parent 40358
e6fe6fc1f516
child 41791
3bf884522663
permissions
-rw-r--r--

Move dialog buttons to action widgets

This will work in GTK4, but can be done now. I've skipped the widgets for which
this has already been done on the `gtk4` branch.

Testing Done:
Opened the dialogs and checked for dialog button. Mostly only just hit Close/Cancel though.

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

/*
 * purple - Handling of XEP-0231: Bits of Binary.
 *
 * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 *
 */

#ifndef PURPLE_JABBER_DATA_H
#define PURPLE_JABBER_DATA_H

#include <purple.h>

#include "jabber.h"

#include <glib.h>

#define JABBER_DATA_MAX_SIZE 8192


typedef struct {
	char *cid;
	char *type;
	gsize size;
	gpointer data;
	gboolean ephemeral;
} JabberData;

typedef void (JabberDataRequestCallback)(JabberData *data, gchar *alt,
    gpointer userdata);


/* creates a JabberData instance from raw data */
JabberData *jabber_data_create_from_data(gconstpointer data, gsize size,
	const char *type, gboolean ephemeral, JabberStream *js);

/* create a JabberData instance from an XML "data" element (as defined by
  XEP 0231 */
JabberData *jabber_data_create_from_xml(PurpleXmlNode *tag);

/* destroy a JabberData instance, NOT to be used on data that has been
	associated, since they get "owned" */
void jabber_data_destroy(JabberData *data);

const char *jabber_data_get_cid(const JabberData *data);
const char *jabber_data_get_type(const JabberData *data);

gsize jabber_data_get_size(const JabberData *data);
gpointer jabber_data_get_data(const JabberData *data);

/* returns the XML definition for the data element */
PurpleXmlNode *jabber_data_get_xml_definition(const JabberData *data);

/* returns an XHTML-IM "img" tag given a data instance */
PurpleXmlNode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt);

void jabber_data_request(JabberStream *js, const gchar *cid, const gchar *who,
    gchar *alt, gboolean ephemeral, JabberDataRequestCallback cb,
    gpointer userdata);

/* lookup functions */
const JabberData *jabber_data_find_local_by_alt(const gchar *alt);
const JabberData *jabber_data_find_local_by_cid(const gchar *cid);
const JabberData *jabber_data_find_remote_by_cid(JabberStream *js,
    const gchar *who, const gchar *cid);

/* store data objects */
void jabber_data_associate_local(JabberData *data, const gchar *alt);
void jabber_data_associate_remote(JabberStream *js, const gchar *who,
    JabberData *data);

/* handles iq requests */
void jabber_data_parse(JabberStream *js, const char *who, JabberIqType type,
                       const char *id, PurpleXmlNode *data_node);

void jabber_data_init(void);
void jabber_data_uninit(void);

#endif /* PURPLE_JABBER_DATA_H */

mercurial