pidgin: 4a34c6f3: Another Perl patch from Zsombor Welker t...
datallah at pidgin.im
datallah at pidgin.im
Thu Aug 7 00:16:13 EDT 2008
-----------------------------------------------------------------
Revision: 4a34c6f3d82579eb81cd2bad3becb53b15f91156
Ancestor: f530f6e0e82a6a0e7b2a19dd0715a4e492dfd177
Author: datallah at pidgin.im
Date: 2008-08-07T04:03:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4a34c6f3d82579eb81cd2bad3becb53b15f91156
Added files:
libpurple/plugins/perl/common/Certificate.xs
libpurple/plugins/perl/common/Idle.xs
libpurple/plugins/perl/common/Whiteboard.xs
Modified files:
libpurple/plugins/perl/common/Makefile.mingw
libpurple/plugins/perl/common/Purple.xs
libpurple/plugins/perl/common/module.h
libpurple/plugins/perl/common/typemap
ChangeLog:
Another Perl patch from Zsombor Welker to add more functions.
Fixes #5957
-------------- next part --------------
============================================================
--- libpurple/plugins/perl/common/Certificate.xs 6c0a72f190cb8b169ce41e6de313a9fe53e9782a
+++ libpurple/plugins/perl/common/Certificate.xs 6c0a72f190cb8b169ce41e6de313a9fe53e9782a
@@ -0,0 +1,302 @@
+#include "module.h"
+
+struct cb_data {
+ SV *cb;
+ SV *user_data;
+};
+
+static void cb_cert_verify(PurpleCertificateVerificationStatus st, struct cb_data *d) {
+ dSP;
+
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK(SP);
+
+ XPUSHs(sv_2mortal(newSViv(st)));
+ XPUSHs(d->user_data);
+
+ PUTBACK;
+
+ call_sv(d->cb, G_VOID | G_EVAL);
+
+ if(SvTRUE(ERRSV)) {
+ STRLEN l_a;
+ purple_debug_warning("perl", "Failed to run 'certificate verify' callback: %s\n", SvPV(ERRSV, l_a));
+ }
+
+ FREETMPS;
+ LEAVE;
+
+ SvREFCNT_dec(d->cb);
+ SvREFCNT_dec(d->user_data);
+
+ g_free(d);
+}
+
+MODULE = Purple::Certificate PACKAGE = Purple::Certificate PREFIX = purple_certificate_
+PROTOTYPES: ENABLE
+
+BOOT:
+{
+ HV *stash = gv_stashpv("Purple::Certificate", 1);
+
+ static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_CERTIFICATE_##name}
+ const_iv(INVALID),
+ const_iv(VALID),
+ };
+
+ for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+ newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
+void
+purple_certificate_add_ca_search_path(path)
+ const char* path
+
+gboolean
+purple_certificate_check_subject_name(crt, name)
+ Purple::Certificate crt
+ const gchar* name
+
+Purple::Certificate
+purple_certificate_copy(crt)
+ Purple::Certificate crt
+
+void
+purple_certificate_destroy(crt)
+ Purple::Certificate crt
+
+void
+purple_certificate_display_x509(crt)
+ Purple::Certificate crt
+
+## changed order of arguments, so that $cert->export($file) could be used
+gboolean
+purple_certificate_export(crt, filename)
+ const gchar* filename
+ Purple::Certificate crt
+ C_ARGS:
+ filename, crt
+
+Purple::Certificate::Pool
+purple_certificate_find_pool(scheme_name, pool_name)
+ const gchar* scheme_name
+ const gchar* pool_name
+
+Purple::Certificate::Scheme
+purple_certificate_find_scheme(name)
+ const gchar* name
+
+Purple::Certificate::Verifier
+purple_certificate_find_verifier(scheme_name, ver_name)
+ const gchar* scheme_name
+ const gchar* ver_name
+
+Purple::Handle
+purple_certificate_get_handle()
+
+gchar_own*
+purple_certificate_get_issuer_unique_id(crt)
+ Purple::Certificate crt
+
+gchar_own*
+purple_certificate_get_subject_name(crt)
+ Purple::Certificate crt
+
+gchar_own*
+purple_certificate_get_unique_id(crt)
+ Purple::Certificate crt
+
+Purple::Certificate
+purple_certificate_import(scheme, filename)
+ Purple::Certificate::Scheme scheme
+ const gchar* filename
+
+gboolean
+purple_certificate_register_pool(pool)
+ Purple::Certificate::Pool pool
+
+gboolean
+purple_certificate_register_scheme(scheme)
+ Purple::Certificate::Scheme scheme
+
+gboolean
+purple_certificate_register_verifier(vr)
+ Purple::Certificate::Verifier vr
+
+gboolean
+purple_certificate_signed_by(crt, issuer)
+ Purple::Certificate crt
+ Purple::Certificate issuer
+
+gboolean
+purple_certificate_unregister_pool(pool)
+ Purple::Certificate::Pool pool
+
+gboolean
+purple_certificate_unregister_scheme(scheme)
+ Purple::Certificate::Scheme scheme
+
+gboolean
+purple_certificate_unregister_verifier(vr)
+ Purple::Certificate::Verifier vr
+
+void
+purple_certificate_verify_complete(vrq, st)
+ Purple::Certificate::VerificationRequest vrq
+ Purple::Certificate::VerificationStatus st
+
+gboolean
+purple_certificate_get_times(crt, OUTLIST time_t activation, OUTLIST time_t expiration)
+ Purple::Certificate crt
+ PROTOTYPE: $
+
+void
+purple_certificate_destroy_list(...)
+ PREINIT:
+ GList* l = NULL;
+ int i = 0;
+ CODE:
+ for(i = 0; i < items; i++) { /* PurpleCertificate */
+ l = g_list_prepend(l, purple_perl_ref_object(ST(i)));
+ }
+ purple_certificate_destroy_list(l);
+
+void
+purple_certificate_get_pools()
+ PREINIT:
+ GList *l;
+ PPCODE:
+ for(l = purple_certificate_get_pools(); l; l = l->next) {
+ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Pool")));
+ }
+
+void
+purple_certificate_get_schemes()
+ PREINIT:
+ GList *l;
+ PPCODE:
+ for(l = purple_certificate_get_schemes(); l; l = l->next) {
+ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Scheme")));
+ }
+
+void
+purple_certificate_get_verifiers()
+ PREINIT:
+ GList *l;
+ PPCODE:
+ for(l = purple_certificate_get_verifiers(); l; l = l->next) {
+ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Verifier")));
+ }
+
+void
+purple_certificate_check_signature_chain(...)
+ PREINIT:
+ GList *l = NULL;
+ gboolean ret;
+ int i;
+ PPCODE:
+ for(i = 0; i < items; i++) { /* PurpleCertificate */
+ l = g_list_prepend(l, purple_perl_ref_object(ST(i)));
+ }
+ l = g_list_reverse(l);
+ ret = purple_certificate_check_signature_chain(l);
+ g_list_free(l);
+ if(ret) XSRETURN_YES;
+ XSRETURN_NO;
+
+SV*
+purple_certificate_get_fingerprint_sha1(crt)
+ Purple::Certificate crt
+ PREINIT:
+ GByteArray *gba = NULL;
+ CODE:
+ gba = purple_certificate_get_fingerprint_sha1(crt);
+ RETVAL = newSVpv(gba->data, gba->len);
+ g_byte_array_free(gba, TRUE);
+ OUTPUT:
+ RETVAL
+
+void
+purple_certificate_verify(verifier, subject_name, cert_chain, cb, cb_data)
+ Purple::Certificate::Verifier verifier
+ const gchar* subject_name
+ AV* cert_chain
+ CV *cb
+ SV *cb_data
+ PREINIT:
+ GList *l = NULL;
+ int len = 0, i = 0;
+ struct cb_data *d = NULL;
+ PPCODE:
+ len = av_len(cert_chain) + 1;
+ for(i = 0; i < len; i++) {
+ SV **sv = av_fetch(cert_chain, i, 0);
+ if(!sv || !purple_perl_is_ref_object(*sv)) {
+ g_list_free(l);
+ warn("Purple::Certificate::verify: cert_chain: non-purple object in array...");
+ XSRETURN_UNDEF;
+ }
+ l = g_list_prepend(l, purple_perl_ref_object(*sv));
+ }
+ l = g_list_reverse(l);
+
+ d = g_new0(struct cb_data, 1);
+ d->cb = newSVsv(ST(3));
+ d->user_data = newSVsv(cb_data);
+
+ purple_certificate_verify(verifier, subject_name, l, (PurpleCertificateVerifiedCallback) cb_cert_verify, d);
+
+ g_list_free(l);
+
+MODULE = Purple::Certificate PACKAGE = Purple::Certificate::Pool PREFIX = purple_certificate_pool_
+PROTOTYPES: ENABLE
+
+void
+purple_certificate_pool_get_idlist(pool)
+ Purple::Certificate::Pool pool
+ PREINIT:
+ GList *l, *b;
+ PPCODE:
+ b = purple_certificate_pool_get_idlist(pool);
+ for(l = b; l; l = l->next) {
+ XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
+ }
+ purple_certificate_pool_destroy_idlist(b);
+
+gboolean
+purple_certificate_pool_contains(pool, id)
+ Purple::Certificate::Pool pool
+ const gchar* id
+
+gboolean
+purple_certificate_pool_delete(pool, id)
+ Purple::Certificate::Pool pool
+ const gchar* id
+
+Purple::Certificate::Scheme
+purple_certificate_pool_get_scheme(pool)
+ Purple::Certificate::Pool pool
+
+gchar_own*
+purple_certificate_pool_mkpath(pool, id)
+ Purple::Certificate::Pool pool
+ const gchar* id
+
+Purple::Certificate
+purple_certificate_pool_retrieve(pool, id)
+ Purple::Certificate::Pool pool
+ const gchar* id
+
+gboolean
+purple_certificate_pool_store(pool, id, crt)
+ Purple::Certificate::Pool pool
+ const gchar* id
+ Purple::Certificate crt
+
+gboolean
+purple_certificate_pool_usable(pool)
+ Purple::Certificate::Pool pool
+
============================================================
--- libpurple/plugins/perl/common/Idle.xs ccab1d21fbe5f32b2173a50af52493d6a40fbf21
+++ libpurple/plugins/perl/common/Idle.xs ccab1d21fbe5f32b2173a50af52493d6a40fbf21
@@ -0,0 +1,12 @@
+#include "module.h"
+
+MODULE = Purple::Idle PACKAGE = Purple::Idle PREFIX = purple_idle_
+PROTOTYPES: ENABLE
+
+void
+purple_idle_touch()
+
+void
+purple_idle_set(time)
+ time_t time
+
============================================================
--- libpurple/plugins/perl/common/Whiteboard.xs 4f6251b770a843da6faf3c52b8ee01a16446241d
+++ libpurple/plugins/perl/common/Whiteboard.xs 4f6251b770a843da6faf3c52b8ee01a16446241d
@@ -0,0 +1,78 @@
+#include "module.h"
+
+MODULE = Purple::Whiteboard PACKAGE = Purple::Whiteboard PREFIX = purple_whiteboard_
+PROTOTYPES: ENABLE
+
+void
+purple_whiteboard_clear(wb)
+ Purple::Whiteboard wb
+
+Purple::Whiteboard
+purple_whiteboard_create(account, who, state)
+ Purple::Account account
+ const char* who
+ int state
+
+void
+purple_whiteboard_destroy(wb)
+ Purple::Whiteboard wb
+
+void
+purple_whiteboard_draw_line(wb, x1, y1, x2, y2, color, size)
+ Purple::Whiteboard wb
+ int x1
+ int y1
+ int x2
+ int y2
+ int color
+ int size
+
+void
+purple_whiteboard_draw_point(wb, x, y, color, size)
+ Purple::Whiteboard wb
+ int x
+ int y
+ int color
+ int size
+
+Purple::Whiteboard
+purple_whiteboard_get_session(account, who)
+ Purple::Account account
+ const char* who
+
+void
+purple_whiteboard_send_brush(wb, size, color)
+ Purple::Whiteboard wb
+ int size
+ int color
+
+void
+purple_whiteboard_send_clear(wb)
+ Purple::Whiteboard wb
+
+void
+purple_whiteboard_set_brush(wb, size, color)
+ Purple::Whiteboard wb
+ int size
+ int color
+
+void
+purple_whiteboard_set_dimensions(wb, width, height)
+ Purple::Whiteboard wb
+ int width
+ int height
+
+gboolean
+purple_whiteboard_get_brush(wb, OUTLIST int size, OUTLIST int color)
+ Purple::Whiteboard wb
+ PROTOTYPE: $
+
+gboolean
+purple_whiteboard_get_dimensions(wb, OUTLIST int width, OUTLIST int height)
+ Purple::Whiteboard wb
+ PROTOTYPE: $
+
+void
+purple_whiteboard_start(wb)
+ Purple::Whiteboard wb
+
============================================================
--- libpurple/plugins/perl/common/Makefile.mingw c9cf82c7b34294215269cc67ce46719fcc6e1650
+++ libpurple/plugins/perl/common/Makefile.mingw 551d0edd96bc45007307ca28564dbf722f28951a
@@ -39,11 +39,13 @@ XS_FILES = Account.xs \
BuddyList.xs \
Cipher.xs \
Cmds.xs \
+ Certificate.xs \
Connection.xs \
Conversation.xs \
Core.xs \
Debug.xs \
FT.xs \
+ Idle.xs \
Purple.xs \
ImgStore.xs \
Log.xs \
@@ -67,6 +69,7 @@ XS_FILES = Account.xs \
Status.xs \
Stringref.xs \
Util.xs \
+ Whiteboard.xs \
XMLNode.xs
#FALLBACKS = const-c.inc const-xs.inc
============================================================
--- libpurple/plugins/perl/common/Purple.xs ce3849342be8f7337ca94c9b31378f0ef076f00c
+++ libpurple/plugins/perl/common/Purple.xs c84a43e56a0c7f4c0d60e5c87d4a44b081558a71
@@ -6,6 +6,7 @@ PURPLE_PERL_BOOT_PROTO(BuddyList);
PURPLE_PERL_BOOT_PROTO(Account__Option);
PURPLE_PERL_BOOT_PROTO(Buddy__Icon);
PURPLE_PERL_BOOT_PROTO(BuddyList);
+PURPLE_PERL_BOOT_PROTO(Certificate);
PURPLE_PERL_BOOT_PROTO(Cipher);
PURPLE_PERL_BOOT_PROTO(Cmd);
PURPLE_PERL_BOOT_PROTO(Connection);
@@ -13,6 +14,7 @@ PURPLE_PERL_BOOT_PROTO(Xfer);
PURPLE_PERL_BOOT_PROTO(Core);
PURPLE_PERL_BOOT_PROTO(Debug);
PURPLE_PERL_BOOT_PROTO(Xfer);
+PURPLE_PERL_BOOT_PROTO(Idle);
PURPLE_PERL_BOOT_PROTO(ImgStore);
PURPLE_PERL_BOOT_PROTO(Log);
PURPLE_PERL_BOOT_PROTO(Network);
@@ -35,6 +37,7 @@ PURPLE_PERL_BOOT_PROTO(Util);
PURPLE_PERL_BOOT_PROTO(Status);
PURPLE_PERL_BOOT_PROTO(Stringref);
PURPLE_PERL_BOOT_PROTO(Util);
+PURPLE_PERL_BOOT_PROTO(Whiteboard);
PURPLE_PERL_BOOT_PROTO(XMLNode);
MODULE = Purple PACKAGE = Purple PREFIX = purple_
@@ -45,6 +48,7 @@ BOOT:
PURPLE_PERL_BOOT(Account__Option);
PURPLE_PERL_BOOT(Buddy__Icon);
PURPLE_PERL_BOOT(BuddyList);
+ PURPLE_PERL_BOOT(Certificate);
PURPLE_PERL_BOOT(Cipher);
PURPLE_PERL_BOOT(Cmd);
PURPLE_PERL_BOOT(Connection);
@@ -52,6 +56,7 @@ BOOT:
PURPLE_PERL_BOOT(Core);
PURPLE_PERL_BOOT(Debug);
PURPLE_PERL_BOOT(Xfer);
+ PURPLE_PERL_BOOT(Idle);
PURPLE_PERL_BOOT(ImgStore);
PURPLE_PERL_BOOT(Log);
PURPLE_PERL_BOOT(Network);
@@ -74,6 +79,7 @@ BOOT:
PURPLE_PERL_BOOT(Status);
PURPLE_PERL_BOOT(Stringref);
PURPLE_PERL_BOOT(Util);
+ PURPLE_PERL_BOOT(Whiteboard);
PURPLE_PERL_BOOT(XMLNode);
guint
============================================================
--- libpurple/plugins/perl/common/module.h 654a77ceb4de296fd604becb4801ebe3cc8733b0
+++ libpurple/plugins/perl/common/module.h 1ae55283b1b5454f7066fac0471be235c77448f8
@@ -20,6 +20,7 @@ typedef struct group *Purple__Group;
#include "accountopt.h"
#include "blist.h"
#include "buddyicon.h"
+#include "certificate.h"
#include "cipher.h"
#include "cmds.h"
#include "connection.h"
@@ -36,6 +37,7 @@ typedef struct group *Purple__Group;
#include "gtkconv.h"
#include "gtkutils.h"
#endif
+#include "idle.h"
#include "imgstore.h"
#include "network.h"
#include "notify.h"
@@ -59,6 +61,7 @@ typedef struct group *Purple__Group;
/* Ewww. perl has it's own util.h which is in the include path :( */
#include "libpurple/util.h"
#include "value.h"
+#include "whiteboard.h"
#include "xmlnode.h"
/* account.h */
@@ -81,6 +84,14 @@ typedef PurpleBuddyIcon * Purple__Budd
/* buddyicon.h */
typedef PurpleBuddyIcon * Purple__Buddy__Icon;
+/* certificate.h */
+typedef PurpleCertificate * Purple__Certificate;
+typedef PurpleCertificatePool * Purple__Certificate__Pool;
+typedef PurpleCertificateScheme * Purple__Certificate__Scheme;
+typedef PurpleCertificateVerifier * Purple__Certificate__Verifier;
+typedef PurpleCertificateVerificationRequest * Purple__Certificate__VerificationRequest;
+typedef PurpleCertificateVerificationStatus Purple__Certificate__VerificationStatus;
+
/* cipher.h */
typedef PurpleCipher * Purple__Cipher;
typedef PurpleCipherCaps Purple__CipherCaps;
@@ -274,6 +285,9 @@ typedef PurpleValue * Purple__Value;
/* value.h */
typedef PurpleValue * Purple__Value;
+/* whiteboard.h */
+typedef PurpleWhiteboard * Purple__Whiteboard;
+
/* xmlnode.h */
typedef xmlnode * Purple__XMLNode;
typedef XMLNodeType XMLNode__Type;
@@ -287,3 +301,4 @@ typedef struct _constiv {
const char *name;
IV iv;
} constiv;
+
============================================================
--- libpurple/plugins/perl/common/typemap 509cbd514a3b0f4ec2f12e61f8c6ca1ed786d99f
+++ libpurple/plugins/perl/common/typemap c64164df22ac4a0fca496c39439338315daec6ea
@@ -175,6 +175,14 @@ XMLNode::Type T_IV
/* enums */
+/* certificate.h */
+Purple::Certificate T_PurpleObj
+Purple::Certificate::Pool T_PurpleObj
+Purple::Certificate::Scheme T_PurpleObj
+Purple::Certificate::Verifier T_PurpleObj
+Purple::Certificate::VerificationRequest T_PurpleObj
+Purple::Certificate::VerificationStatus T_IV
+
/* cipher.h */
Purple::Cipher::BatchMode T_IV
@@ -186,7 +194,7 @@ Purple::ConvUpdateType T_IV
/* conversation.h */
Purple::ConvChatBuddyFlags T_IV
Purple::ConvUpdateType T_IV
-Purple::ConversationType T_IV
+Purple::ConversationType T_IV
Purple::MessageFlags T_IV
Purple::TypingState T_IV
Purple::UnseenState T_IV
@@ -195,6 +203,9 @@ Purple::ConnectionState T_IV
Purple::ConnectionFlags T_IV
Purple::ConnectionState T_IV
+/* whiteboard.h */
+Purple::Whiteboard T_PurpleObj
+
INPUT
T_PurpleObj
More information about the Commits
mailing list