예제 #1
0
파일: variable.c 프로젝트: arlynap/barnowl
int owl_variable_pseudologins_set(owl_variable *v, void *newval)
{
  if (newval) {
    if (*(int*)newval == 1) {
      owl_function_zephyr_buddy_check(0);
    }
  }
  return owl_variable_bool_set_default(v, newval);
}
예제 #2
0
파일: zephyr.c 프로젝트: aglasgall/barnowl
void owl_zephyr_finish_initialization(const owl_io_dispatch *d, void *data) {
  Code_t code;
  char *perl;
  GSource *event_source;

  owl_select_remove_io_dispatch(d);

  ZClosePort();

  if ((code = ZInitialize()) != ZERR_NONE) {
    owl_function_error("Initializing Zephyr: %s", error_message(code));
    return;
  }

  if ((code = ZOpenPort(NULL)) != ZERR_NONE) {
    owl_function_error("Initializing Zephyr: %s", error_message(code));
    return;
  }

  event_source = owl_zephyr_event_source_new(ZGetFD());
  g_source_attach(event_source, NULL);
  g_source_unref(event_source);

  owl_global_set_havezephyr(&g);

  if(g.load_initial_subs) {
    owl_zephyr_load_initial_subs();
  }
  while(deferred_subs != NULL) {
    owl_sub_list *subs = deferred_subs->data;
    owl_function_debugmsg("Loading %d deferred subs.", subs->nsubs);
    owl_zephyr_loadsubs_helper(subs->subs, subs->nsubs);
    deferred_subs = g_list_delete_link(deferred_subs, deferred_subs);
    g_free(subs);
  }

  /* zlog in if we need to */
  if (owl_global_is_startuplogin(&g)) {
    owl_function_debugmsg("startup: doing zlog in");
    owl_zephyr_zlog_in();
  }
  /* check pseudo-logins if we need to */
  if (owl_global_is_pseudologins(&g)) {
    owl_function_debugmsg("startup: checking pseudo-logins");
    owl_function_zephyr_buddy_check(0);
  }

  perl = owl_perlconfig_execute("BarnOwl::Zephyr::_zephyr_startup()");
  g_free(perl);
}
예제 #3
0
파일: variable.c 프로젝트: barnowl/barnowl
int owl_variable_pseudologins_set(owl_variable *v, bool newval)
{
  static guint timer = 0;
  if (newval) {
    owl_function_zephyr_buddy_check(0);
    if (timer == 0) {
      timer = g_timeout_add_seconds(180, owl_zephyr_buddycheck_timer, NULL);
    }
  } else {
    if (timer != 0) {
      g_source_remove(timer);
      timer = 0;
    }
  }
  return owl_variable_bool_set_default(v, newval);
}
예제 #4
0
파일: variable.c 프로젝트: alexmv/barnowl
int owl_variable_pseudologins_set(owl_variable *v, const void *newval)
{
  static owl_timer *timer = NULL;
  if (newval) {
    if (*(const int*)newval == 1) {
      owl_function_zephyr_buddy_check(0);
      if (timer == NULL) {
        timer = owl_select_add_timer(180, 180, owl_zephyr_buddycheck_timer, NULL, NULL);
      }
    } else {
      if (timer != NULL) {
        owl_select_remove_timer(timer);
        timer = NULL;
      }
    }
  }
  return owl_variable_bool_set_default(v, newval);
}