Index: global.c
===================================================================
--- global.c	(revision dc1edbded39e57c67e8049c2960f0c235cd5afb5)
+++ global.c	(revision 7b4f3bea704ed82f2c36ba19fcf354d7442a5bb7)
@@ -16,7 +16,4 @@
 
   g_type_init();
-  g_thread_init(NULL);
-
-  owl_select_init();
 
   g->lines=LINES;
@@ -54,8 +51,4 @@
   g->direction=OWL_DIRECTION_DOWNWARDS;
   g->zaway=0;
-  if (has_colors()) {
-    g->hascolors=1;
-  }
-  g->colorpairs=COLOR_PAIRS;
   owl_fmtext_init_colorpair_mgr(&(g->cpmgr));
   g->debug=OWL_DEBUG;
@@ -102,4 +95,5 @@
 
   owl_errqueue_init(&(g->errqueue));
+  g->got_err_signal=0;
 
   owl_zbuddylist_create(&(g->zbuddies));
@@ -110,9 +104,8 @@
   owl_message_init_fmtext_cache();
   owl_list_create(&(g->io_dispatch_list));
+  owl_list_create(&(g->psa_list));
   g->timerlist = NULL;
+  g->interrupted = FALSE;
   g->kill_buffer = NULL;
-
-  g->interrupt_count = 0;
-  g->interrupt_lock = g_mutex_new();
 }
 
@@ -351,5 +344,5 @@
 
 void owl_global_set_resize_pending(owl_global *g) {
-  g->resizepending = true;
+  g->resizepending=1;
 }
 
@@ -451,5 +444,5 @@
   /* resize the screen.  If lines or cols is 0 use the terminal size */
   if (!g->resizepending) return;
-  g->resizepending = false;
+  g->resizepending = 0;
 
   owl_global_get_terminal_size(&g->lines, &g->cols);
@@ -577,17 +570,4 @@
 owl_view *owl_global_get_current_view(owl_global *g) {
   return(&(g->current_view));
-}
-
-/* has colors */
-
-int owl_global_get_hascolors(const owl_global *g) {
-  if (g->hascolors) return(1);
-  return(0);
-}
-
-/* color pairs */
-
-int owl_global_get_colorpairs(const owl_global *g) {
-  return(g->colorpairs);
 }
 
@@ -696,24 +676,18 @@
 }
 
-bool owl_global_is_doaimevents(const owl_global *g)
-{
-  return g->aim_event_source != NULL;
+int owl_global_is_doaimevents(const owl_global *g)
+{
+  if (g->aim_doprocessing) return(1);
+  return(0);
 }
 
 void owl_global_set_doaimevents(owl_global *g)
 {
-  if (g->aim_event_source)
-    return;
-  g->aim_event_source = owl_aim_event_source_new(owl_global_get_aimsess(g));
-  g_source_attach(g->aim_event_source, NULL);
+  g->aim_doprocessing=1;
 }
 
 void owl_global_set_no_doaimevents(owl_global *g)
 {
-  if (!g->aim_event_source)
-    return;
-  g_source_destroy(g->aim_event_source);
-  g_source_unref(g->aim_event_source);
-  g->aim_event_source = NULL;
+  g->aim_doprocessing=0;
 }
 
@@ -833,4 +807,28 @@
 }
 
+void owl_global_set_errsignal(owl_global *g, int signum, siginfo_t *siginfo)
+{
+  g->got_err_signal = signum;
+  if (siginfo) {
+    g->err_signal_info = *siginfo;
+  } else {
+    siginfo_t si;
+    memset(&si, 0, sizeof(si));
+    g->err_signal_info = si;
+  }
+}
+
+int owl_global_get_errsignal_and_clear(owl_global *g, siginfo_t *siginfo)
+{
+  int signum;
+  if (siginfo && g->got_err_signal) {
+    *siginfo = g->err_signal_info;
+  } 
+  signum = g->got_err_signal;
+  g->got_err_signal = 0;
+  return signum;
+}
+
+
 owl_zbuddylist *owl_global_get_zephyr_buddylist(owl_global *g)
 {
@@ -863,7 +861,24 @@
 }
 
+owl_list *owl_global_get_psa_list(owl_global *g)
+{
+  return &(g->psa_list);
+}
+
 GList **owl_global_get_timerlist(owl_global *g)
 {
   return &(g->timerlist);
+}
+
+int owl_global_is_interrupted(const owl_global *g) {
+  return g->interrupted;
+}
+
+void owl_global_set_interrupted(owl_global *g) {
+  g->interrupted = 1;
+}
+
+void owl_global_unset_interrupted(owl_global *g) {
+  g->interrupted = 0;
 }
 
@@ -933,21 +948,2 @@
   g->kill_buffer = g_strndup(kill, len);
 }
-
-void owl_global_add_interrupt(owl_global *g) {
-  /* TODO: This can almost certainly be done with atomic
-   * operations. Whatever. */
-  g_mutex_lock(g->interrupt_lock);
-  g->interrupt_count++;
-  g_mutex_unlock(g->interrupt_lock);
-}
-
-bool owl_global_take_interrupt(owl_global *g) {
-  bool ans = false;
-  g_mutex_lock(g->interrupt_lock);
-  if (g->interrupt_count > 0) {
-    ans = true;
-    g->interrupt_count--;
-  }
-  g_mutex_unlock(g->interrupt_lock);
-  return ans;
-}
