On 25. bře 13 17:56, tmp wrote:
> I installed from homebrew, here is the info:
> 
> $ brew info libpurple
> libpurple: stable 2.10.7
> http://pidgin.im/
> Depends on: pkg-config, intltool, gettext, glib, libidn, gnutls, libgcrypt
> /usr/local/Cellar/libpurple/2.10.7 (220 files, 28M) *
> Built from source
> https://github.com/mxcl/homebrew/commits/master/Library/Formula/libpurple.rb
> 
> 
> I installed libpurple right before trying to use CenterIM.
> 

I am attaching a small test program. It should tell you if you can
compile on your computer any program which uses libpurple. The
program just prints all available protocol plugins. You should be
able to compile it using the following command:
cc `pkg-config --cflags --libs purple` main.c

Best regards,
Petr Pavlu

#include <locale.h>
#include <stdio.h>

#include <libpurple/purple.h>
/*
#include <libpurple/account.h>
#include <libpurple/core.h>
#include <libpurple/eventloop.h>
#include <libpurple/plugin.h>
*/

#define FINCH_READ_COND  (G_IO_IN | G_IO_HUP | G_IO_ERR)
#define FINCH_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)

typedef struct _PurpleGntIOClosure {
  PurpleInputFunction function;
  guint result;
  gpointer data;
} PurpleGntIOClosure;

static void purple_gnt_io_destroy(gpointer data)
{
  g_free(data);
}

static gboolean purple_gnt_io_invoke(GIOChannel *source,
    GIOCondition condition, gpointer data)
{
  PurpleGntIOClosure *closure = data;
  PurpleInputCondition purple_cond = 0;

  if (condition & FINCH_READ_COND)
    purple_cond |= PURPLE_INPUT_READ;
  if (condition & FINCH_WRITE_COND)
    purple_cond |= PURPLE_INPUT_WRITE;

  closure->function(closure->data, g_io_channel_unix_get_fd(source),
      purple_cond);

  return TRUE;
}

static guint gnt_input_add(gint fd, PurpleInputCondition condition,
    PurpleInputFunction function, gpointer data)
{
  PurpleGntIOClosure *closure = g_new0(PurpleGntIOClosure, 1);
  GIOChannel *channel;
  GIOCondition cond = 0;

  closure->function = function;
  closure->data = data;

  if (condition & PURPLE_INPUT_READ)
    cond |= FINCH_READ_COND;
  if (condition & PURPLE_INPUT_WRITE)
    cond |= FINCH_WRITE_COND;

  channel = g_io_channel_unix_new(fd);
  closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
      purple_gnt_io_invoke, closure, purple_gnt_io_destroy);

  g_io_channel_unref(channel);
  return closure->result;
}

int main(void)
{
  PurpleEventLoopUiOps eventloop_ui_ops = {
    g_timeout_add,
    g_source_remove,
    gnt_input_add,
    g_source_remove,
  };
  GList *i, *j;

  setlocale(LC_ALL, "");

  purple_eventloop_set_ui_ops(&eventloop_ui_ops);

  if (!purple_core_init("purpletest")) {
    fprintf(stderr, "purple_core_init() error\n");
    return 1;
  }

  i = purple_plugins_get_protocols();
  puts("protocol plugins:");
  for (j = i; j; j = j->next)
    printf("  %s\n", purple_plugin_get_id(j->data));

  return 0;
}

-- 
_______________________________________________
Centerim-users mailing list
Centerim-users@centerim.org
http://centerim.org/mailman/listinfo/centerim-users
http://www.centerim.org/

Reply via email to