Skip to content
Permalink
Browse files

purple-events: Initial commit

  • Loading branch information...
sardemff7 committed Jun 4, 2012
0 parents commit cda6c78aa3bf03b6bd1883473c818ef4d391c2cb
@@ -0,0 +1,2 @@
/data/purple-events.pc
/include/config.h*
@@ -0,0 +1,99 @@
AM_DISTCHECK_CONFIGURE_FLAGS = \
--disable-debug \
--with-purple-plugindir="$$dc_install_base/$(plugindir)"

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_MAKEFLAGS = --no-print-directory

#SUBDIRS = po

LIBPURPLE_EVENTS_CURRENT=0
LIBPURPLE_EVENTS_REVISION=0
LIBPURPLE_EVENTS_AGE=0

pkgconfigdir = $(libdir)/pkgconfig

AM_CFLAGS += \
-DLOCALEDIR=\"$(localedir)\" \
-I $(srcdir)/include

# Helper library
pkgconfig_DATA = \
data/purple-events.pc

pkginclude_HEADERS = \
include/purple-events.h

lib_LTLIBRARIES = \
libpurple-events.la

libpurple_events_la_SOURCES = \
include/purple-events-context.h \
include/purple-events.h \
src/lib/utils.c \
src/lib/context.c

libpurple_events_la_CFLAGS = \
$(AM_CFLAGS) \
$(PURPLE_CFLAGS) \
$(GLIB_CFLAGS)

libpurple_events_la_LDFLAGS = \
-no-undefined \
-version-info $(LIBPURPLE_EVENTS_CURRENT):$(LIBPURPLE_EVENTS_REVISION):$(LIBPURPLE_EVENTS_AGE) \
-export-dynamic

libpurple_events_la_LIBADD = \
$(PURPLE_LIBS) \
$(GLIB_LIBS)

# Plugin
plugin_LTLIBRARIES = \
purple-events.la

purple_events_la_SOURCES = \
include/config.h \
include/purple-events-context.h \
include/purple-events.h \
src/plugin/utils.h \
src/plugin/utils.c \
src/plugin/ui.h \
src/plugin/ui.c \
src/plugin/callbacks.h \
src/plugin/callbacks.c \
src/plugin/events.h \
src/plugin/events.c

purple_events_la_CFLAGS = \
$(AM_CFLAGS) \
$(PURPLE_CFLAGS) \
$(GLIB_CFLAGS)

purple_events_la_LDFLAGS = \
-no-undefined \
-avoid-version -module \
-export-symbols-regex 'purple_init_(purple_events_)?plugin'

purple_events_la_LIBADD = \
$(PURPLE_LIBS) \
$(GLIB_LIBS)


#
# Hooks
#

install-data-hook: la-files-install-hook
uninstall-hook: la-files-uninstall-hook

# *.la files cleanup
la-files-install-hook:
cd $(DESTDIR)$(plugindir) && \
rm $(plugin_LTLIBRARIES)

# Remove shared object files at uninstall since
# we remove *.la files at install
la-files-uninstall-hook:
cd $(DESTDIR)$(plugindir) && \
rm $(plugin_LTLIBRARIES:.la=$(shrext_cmds))
-rmdir $(DESTDIR)$(plugindir)
@@ -0,0 +1,62 @@
AC_PREREQ([2.65])
AC_INIT([purple-events], [0.1])

AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR([src/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([.aux])

AM_INIT_AUTOMAKE([1.11 subdir-objects dist-xz no-dist-gzip tar-ustar foreign])

AM_SILENT_RULES([yes])

AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_DISABLE_STATIC
LT_INIT
PKG_PROG_PKG_CONFIG

GETTEXT_PACKAGE=$PACKAGE_NAME
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
AC_SUBST(GETTEXT_PACKAGE)
dnl IT_PROG_INTLTOOL([0.40.0])

AC_PROG_INSTALL

AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter"
AM_LDFLAGS=""

#
# Check for glib
#
PKG_CHECK_MODULES(GLIB, glib-2.0)

#
# Check for libpurple
#
AC_ARG_WITH(purple-plugindir, AS_HELP_STRING([--with-purple-plugindir=DIR], [Directory for libpurple plugin]), [], with_purple_plugindir=yes)
case "$with_purple_plugindir" in
no|"") AC_MSG_ERROR([*** You must define purple-plugindir]) ;;
yes) plugindir="`$PKG_CONFIG --variable=plugindir purple`" ;;
*) plugindir="$with_purple_plugindir" ;;
esac
PKG_CHECK_MODULES(PURPLE, purple >= 2.6.0)
AC_DEFINE_UNQUOTED([PURPLE_DATADIR], ["`$PKG_CONFIG --variable=datadir purple`"], [libpurple data directory])
AC_SUBST(plugindir)


AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug]), [], enable_debug=no)
if test x$enable_debug = xyes; then
AM_VALAFLAGS="${AM_VALAFLAGS} --debug"
fi
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_LDFLAGS)

AC_SUBST(shrext_cmds)

AC_CONFIG_FILES([
data/purple-events.pc
Makefile
])
AC_OUTPUT
@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
pkgincludedir=@includedir@/@PACKAGE@

Name: libpurple-events
Description: libpurple events handling plugin and library
Version: @VERSION@
Requires: purple glib-2.0
Libs: -L${libdir} -lpurple-events
Cflags: -I${pkgincludedir}
@@ -0,0 +1,40 @@
/*
* purple-events - libpurple events handling plugin and library
*
* Copyright © 2011-2012 Quentin "Sardem FF7" Glidic
*
* This file is part of purple-events.
*
* purple-events 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 3 of the License, or
* (at your option) any later version.
*
* purple-events 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 purple-events. If not, see <http://www.gnu.org/licenses/>.
*
*/

#ifndef __PURPLE_EVENTS_CONTEXT_H__
#define __PURPLE_EVENTS_CONTEXT_H__

#include <purple-events.h>

G_BEGIN_DECLS


struct _PurpleEventsContext {
PurplePlugin *plugin;
GList *just_signed_on_accounts;
GList *handlers;
};


G_END_DECLS

#endif /* __PURPLE_EVENTS_CONTEXT_H__ */
@@ -0,0 +1,95 @@
/*
* purple-events - libpurple events handling plugin and library
*
* Copyright © 2011-2012 Quentin "Sardem FF7" Glidic
*
* This file is part of purple-events.
*
* purple-events 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 3 of the License, or
* (at your option) any later version.
*
* purple-events 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 purple-events. If not, see <http://www.gnu.org/licenses/>.
*
*/


#ifndef __PURPLE_EVENTS_H__
#define __PURPLE_EVENTS_H__

G_BEGIN_DECLS


typedef enum
{
PURPLE_EVENTS_EVENT_SPECIAL_TYPE_NONE,
PURPLE_EVENTS_EVENT_SPECIAL_TYPE_TUNE,
} PurpleEventsEventSpecialType;

typedef enum
{
PURPLE_EVENTS_UTILS_ICON_FORMAT_SVG,
PURPLE_EVENTS_UTILS_ICON_FORMAT_PNG,
} PurpleEventsUtilsIconFormat;


typedef void (*PurpleEventsSignedOnFunc)(PurplePlugin *plugin, PurpleBuddy *buddy);
typedef void (*PurpleEventsSignedOffFunc)(PurplePlugin *plugin, PurpleBuddy *buddy);

typedef void (*PurpleEventsAwayFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);
typedef void (*PurpleEventsBackFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);

typedef void (*PurpleEventsStatusFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);
typedef void (*PurpleEventsSpecialFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, PurpleEventsEventSpecialType type, ...);

typedef void (*PurpleEventsIdleFunc)(PurplePlugin *plugin, PurpleBuddy *buddy);
typedef void (*PurpleEventsIdleBackFunc)(PurplePlugin *plugin, PurpleBuddy *buddy);

typedef void (*PurpleEventsImMessageFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);
typedef void (*PurpleEventsImActionFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);

typedef void (*PurpleEventsChatMessageFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);
typedef void (*PurpleEventsChatActionFunc)(PurplePlugin *plugin, PurpleBuddy *buddy, const gchar *message);


typedef struct _PurpleEventsContext PurpleEventsContext;
typedef struct {
PurplePlugin *plugin;

PurpleEventsSignedOnFunc signed_on;
PurpleEventsSignedOffFunc signed_off;

PurpleEventsAwayFunc away;
PurpleEventsBackFunc back;

PurpleEventsStatusFunc status;
PurpleEventsSpecialFunc special;

PurpleEventsIdleFunc idle;
PurpleEventsIdleBackFunc idle_back;

PurpleEventsImMessageFunc im_message;
PurpleEventsImActionFunc im_action;

PurpleEventsChatMessageFunc chat_message;
PurpleEventsChatActionFunc chat_action;
} PurpleEventsHandler;


void purple_events_context_connect_handler(PurpleEventsContext *context, PurpleEventsHandler *handler);
void purple_events_context_disconnect_handler(PurpleEventsContext *context, PurpleEventsHandler *handler);

const gchar *purple_events_utils_buddy_get_best_name(PurpleBuddy *buddy);
const gchar *purple_events_utils_buddy_get_protocol(PurpleBuddy *buddy);
gchar *purple_events_utils_protocol_get_icon_uri(const gchar *protocol_name, PurpleEventsUtilsIconFormat format);

G_END_DECLS

#endif /* __PURPLE_EVENTS_H__ */
@@ -0,0 +1,38 @@
/*
* purple-events - libpurple events handling plugin and library
*
* Copyright © 2011-2012 Quentin "Sardem FF7" Glidic
*
* This file is part of purple-events.
*
* purple-events 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 3 of the License, or
* (at your option) any later version.
*
* purple-events 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 purple-events. If not, see <http://www.gnu.org/licenses/>.
*
*/

#include <glib.h>
#include <purple.h>

#include <purple-events-context.h>

void
purple_events_context_connect_handler(PurpleEventsContext *context, PurpleEventsHandler *handler)
{
context->handlers = g_list_prepend(context->handlers, handler);
}

void
purple_events_context_disconnect_handler(PurpleEventsContext *context, PurpleEventsHandler *handler)
{
context->handlers = g_list_remove(context->handlers, handler);
}
Oops, something went wrong.

0 comments on commit cda6c78

Please sign in to comment.
You can’t perform that action at this time.