view libpurple/plugins/perl/perl-common.h @ 17576:d495103dcf88

Two questions: 1. XMPP <status> messages inside <presence> broadcasts should be plaintext and not HTML, right? 2. 'stripped = purple_markup_strip_html(str)' is basically the same as 'purple_markup_html_to_xhtml(str, NULL, &stripped)', right? This fixes a bug Emily found where setting an XMPP status message with an embedded link would drop the link completely. For example, in Pidgin you set your away message and insert a link so that the message body is <a href="http://www.example.com/">Example</a>. When we set this message for an XMPP account it just strips the HTML and sets the message to "Example". This change causes the message to be "Example (http://www.example.com/)". It's the same thing we do when displaying links in tooltips in the blist.
author Mark Doliner <mark@kingant.net>
date Sun, 10 Jun 2007 15:58:23 +0000
parents 32c366eeeb99
children b8572b937c09
line wrap: on
line source

#ifndef _PURPLE_PERL_COMMON_H_
#define _PURPLE_PERL_COMMON_H_

#include <glib.h>
#ifdef _WIN32
#undef pipe
#endif
#include <XSUB.h>
#include <EXTERN.h>
#include <perl.h>

#include "plugin.h"
#include "value.h"

#define is_hvref(o) \
	((o) && SvROK(o) && SvRV(o) && (SvTYPE(SvRV(o)) == SVt_PVHV))

#define hvref(o) \
	(is_hvref(o) ? (HV *)SvRV(o) : NULL);

#define PURPLE_PERL_BOOT_PROTO(x) \
	void boot_Purple__##x(pTHX_ CV *cv);

#define PURPLE_PERL_BOOT(x) \
	purple_perl_callXS(boot_Purple__##x, cv, mark)

typedef struct
{
	PurplePlugin *plugin;
	char *package;
	char *load_sub;
	char *unload_sub;
	char *prefs_sub;
#ifdef PURPLE_GTKPERL
	char *gtk_prefs_sub;
#endif
	char *plugin_action_sub;
} PurplePerlScript;

void purple_perl_normalize_script_name(char *name);

SV *newSVGChar(const char *str);

void purple_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark);
void purple_perl_bless_plain(const char *stash, void *object);
SV *purple_perl_bless_object(void *object, const char *stash);
gboolean purple_perl_is_ref_object(SV *o);
void *purple_perl_ref_object(SV *o);

int execute_perl(const char *function, int argc, char **args);

#if 0
gboolean purple_perl_value_from_sv(PurpleValue *value, SV *sv);
SV *purple_perl_sv_from_value(const PurpleValue *value);
#endif

void *purple_perl_data_from_sv(PurpleValue *value, SV *sv);
SV *purple_perl_sv_from_vargs(const PurpleValue *value, va_list *args,
                            void ***copy_arg);

#endif /* _PURPLE_PERL_COMMON_H_ */