Index: global.c
===================================================================
--- global.c	(revision dc1edbded39e57c67e8049c2960f0c235cd5afb5)
+++ global.c	(revision 074bdaa6d33d340b3da12b08994f54e70986e9d5)
@@ -106,5 +106,4 @@
   owl_message_init_fmtext_cache();
   owl_list_create(&(g->io_dispatch_list));
-  g->timerlist = NULL;
   g->kill_buffer = NULL;
 
@@ -844,9 +843,4 @@
 {
   return &(g->io_dispatch_list);
-}
-
-GList **owl_global_get_timerlist(owl_global *g)
-{
-  return &(g->timerlist);
 }
 
Index: owl.h
===================================================================
--- owl.h	(revision 6b0b4f45d70ff57070fe617e46583f01ca1d8f78)
+++ owl.h	(revision 074bdaa6d33d340b3da12b08994f54e70986e9d5)
@@ -516,13 +516,4 @@
   owl_list zusers;
 } owl_zbuddylist;
-
-typedef struct _owl_timer {
-  time_t time;
-  int interval;
-  void (*callback)(struct _owl_timer *, void *);
-  void (*destroy)(struct _owl_timer *);
-  void *data;
-  char *name;
-} owl_timer;
 
 typedef struct _owl_errqueue {
@@ -617,5 +608,4 @@
   struct termios startup_tio;
   owl_list io_dispatch_list;
-  GList *timerlist;
   guint aim_nop_timer;
   int load_initial_subs;
Index: perl/lib/BarnOwl/Timer.pm
===================================================================
--- perl/lib/BarnOwl/Timer.pm	(revision c6adf1779fe578bd628ad351bc8d99f756ea8e93)
+++ perl/lib/BarnOwl/Timer.pm	(revision 074bdaa6d33d340b3da12b08994f54e70986e9d5)
@@ -3,4 +3,6 @@
 
 package BarnOwl::Timer;
+
+use AnyEvent;
 
 sub new {
@@ -13,13 +15,7 @@
     my $self = {cb => $cb};
 
-    my $name = $args->{name};
-    $name = "(unnamed)" unless defined $name;
-
     bless($self, $class);
 
-    $self->{timer} = BarnOwl::Internal::add_timer($args->{after} || 0,
-                                                  $args->{interval} || 0,
-                                                  $self,
-                                                  $name);
+    $self->{timer} = AnyEvent->timer(%$args);
     return $self;
 }
@@ -27,8 +23,5 @@
 sub stop {
     my $self = shift;
-    if(defined($self->{timer})) {
-        BarnOwl::Internal::remove_timer($self->{timer});
-        undef $self->{timer};
-    }
+    undef $self->{timer};
 }
 
Index: perlconfig.c
===================================================================
--- perlconfig.c	(revision 937a00e96102f86412b6844575901e57be238546)
+++ perlconfig.c	(revision 074bdaa6d33d340b3da12b08994f54e70986e9d5)
@@ -612,39 +612,2 @@
   LEAVE;
 }
-
-void owl_perlconfig_perl_timer(owl_timer *t, void *data)
-{
-  dSP;
-  SV *obj = data;
-
-  if(!SvROK(obj)) {
-    return;
-  }
-
-  ENTER;
-  SAVETMPS;
-
-  PUSHMARK(SP);
-  XPUSHs(obj);
-  PUTBACK;
-
-  call_method("do_callback", G_DISCARD|G_EVAL);
-
-  SPAGAIN;
-
-  if (SvTRUE(ERRSV)) {
-    owl_function_error("Error in callback: '%s'", SvPV_nolen(ERRSV));
-    sv_setsv (ERRSV, &PL_sv_undef);
-  }
-
-  PUTBACK;
-  FREETMPS;
-  LEAVE;
-}
-
-void owl_perlconfig_perl_timer_destroy(owl_timer *t)
-{
-  if(SvOK((SV*)t->data)) {
-    SvREFCNT_dec((SV*)t->data);
-  }
-}
Index: perlglue.xs
===================================================================
--- perlglue.xs	(revision 3b8a563ae4e07b1064fe005714793565ac720dc4)
+++ perlglue.xs	(revision 074bdaa6d33d340b3da12b08994f54e70986e9d5)
@@ -515,36 +515,4 @@
 	owl_select_add_perl_io_dispatch(fd, mode, newSVsv(cb));
 
-IV
-add_timer(after, interval, cb, name = NULL)
-	int after
-	int interval
-	SV *cb
-	const char *name
-	PREINIT:
-		SV *ref;
-		owl_timer *t;
-	CODE:
-		ref = sv_rvweaken(newSVsv(cb));
-		t = owl_select_add_timer(name,
-					 after,
-					 interval,
-					 owl_perlconfig_perl_timer,
-					 owl_perlconfig_perl_timer_destroy,
-					 ref);
-		owl_function_debugmsg("Created timer %s: %p", t->name ? t->name : "(unnamed)", t);
-	RETVAL = (IV)t;
-	OUTPUT:
-		RETVAL
-
-void
-remove_timer(timer)
-	IV timer
-	PREINIT:
-		owl_timer *t;
-	CODE:
-		t = (owl_timer*)timer;
-		owl_function_debugmsg("Freeing timer %s: %p", t->name ? t->name : "(unnamed)", t);
-		owl_select_remove_timer(t);
-
 MODULE = BarnOwl		PACKAGE = BarnOwl::Editwin
 
Index: select.c
===================================================================
--- select.c	(revision f0781ba39249518a5e78dc0ec433738ef80f581a)
+++ select.c	(revision 074bdaa6d33d340b3da12b08994f54e70986e9d5)
@@ -5,123 +5,5 @@
 static int dispatch_active = 0;
 
-static GSource *owl_timer_source;
 static GSource *owl_io_dispatch_source;
-
-static int _owl_select_timer_cmp(const owl_timer *t1, const owl_timer *t2) {
-  return t1->time - t2->time;
-}
-
-owl_timer *owl_select_add_timer(const char* name, int after, int interval, void (*cb)(owl_timer *, void *), void (*destroy)(owl_timer*), void *data)
-{
-  owl_timer *t = g_new(owl_timer, 1);
-  GList **timers = owl_global_get_timerlist(&g);
-
-  t->time = time(NULL) + after;
-  t->interval = interval;
-  t->callback = cb;
-  t->destroy = destroy;
-  t->data = data;
-  t->name = name ? g_strdup(name) : NULL;
-
-  *timers = g_list_insert_sorted(*timers, t,
-                                 (GCompareFunc)_owl_select_timer_cmp);
-  return t;
-}
-
-void owl_select_remove_timer(owl_timer *t)
-{
-  GList **timers = owl_global_get_timerlist(&g);
-  if (t && g_list_find(*timers, t)) {
-    *timers = g_list_remove(*timers, t);
-    if(t->destroy) {
-      t->destroy(t);
-    }
-    g_free(t->name);
-    g_free(t);
-  }
-}
-
-static gboolean owl_timer_prepare(GSource *source, int *timeout) {
-  GList **timers = owl_global_get_timerlist(&g);
-  GTimeVal now;
-
-  /* TODO: In the far /far/ future, g_source_get_time is what the cool
-   * kids use to get system monotonic time. */
-  g_source_get_current_time(source, &now);
-
-  /* FIXME: bother with millisecond accuracy now that we can? */
-  if (*timers) {
-    owl_timer *t = (*timers)->data;
-    *timeout = t->time - now.tv_sec;
-    if (*timeout <= 0) {
-      *timeout = 0;
-      return TRUE;
-    }
-    if (*timeout > 60 * 1000)
-      *timeout = 60 * 1000;
-  } else {
-    *timeout = 60 * 1000;
-  }
-  return FALSE;
-}
-
-static gboolean owl_timer_check(GSource *source) {
-  GList **timers = owl_global_get_timerlist(&g);
-  GTimeVal now;
-
-  /* TODO: In the far /far/ future, g_source_get_time is what the cool
-   * kids use to get system monotonic time. */
-  g_source_get_current_time(source, &now);
-
-  /* FIXME: bother with millisecond accuracy now that we can? */
-  if (*timers) {
-    owl_timer *t = (*timers)->data;
-    return t->time >= now.tv_sec;
-  }
-  return FALSE;
-}
-
-
-static gboolean owl_timer_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) {
-  GList **timers = owl_global_get_timerlist(&g);
-  GTimeVal now;
-
-  /* TODO: In the far /far/ future, g_source_get_time is what the cool
-   * kids use to get system monotonic time. */
-  g_source_get_current_time(source, &now);
-
-  /* FIXME: bother with millisecond accuracy now that we can? */
-  while(*timers) {
-    owl_timer *t = (*timers)->data;
-    int remove = 0;
-
-    if(t->time > now.tv_sec)
-      break;
-
-    /* Reschedule if appropriate */
-    if(t->interval > 0) {
-      t->time = now.tv_sec + t->interval;
-      *timers = g_list_remove(*timers, t);
-      *timers = g_list_insert_sorted(*timers, t,
-                                     (GCompareFunc)_owl_select_timer_cmp);
-    } else {
-      remove = 1;
-    }
-
-    /* Do the callback */
-    t->callback(t, t->data);
-    if(remove) {
-      owl_select_remove_timer(t);
-    }
-  }
-  return TRUE;
-}
-
-static GSourceFuncs owl_timer_funcs = {
-  owl_timer_prepare,
-  owl_timer_check,
-  owl_timer_dispatch,
-  NULL
-};
 
 /* Returns the valid owl_io_dispatch for a given file descriptor. */
@@ -335,7 +217,4 @@
 void owl_select_init(void)
 {
-  owl_timer_source = g_source_new(&owl_timer_funcs, sizeof(GSource));
-  g_source_attach(owl_timer_source, NULL);
-
   owl_io_dispatch_source = g_source_new(&owl_io_dispatch_funcs, sizeof(GSource));
   g_source_attach(owl_io_dispatch_source, NULL);
