Exemplo n.º 1
0
static char *filesys_close()
{
  int i;
  p_tcl_bind_list H_ctcp;

  Context;
  putlog(LOG_MISC, "*", "Unloading filesystem, killing all filesystem connections..");
  for (i = 0; i < dcc_total; i++)
    if (dcc[i].type == &DCC_FILES) {
      dprintf(i, DCC_BOOTED1);
      dprintf(i,
	 "You have been booted from the filesystem, module unloaded.\n");
      killsock(dcc[i].sock);
      lostdcc(i);
    } else if (dcc[i].type == &DCC_FILES_PASS) {
      killsock(dcc[i].sock);
      lostdcc(i);
    }
  rem_tcl_commands(mytcls);
  rem_tcl_strings(mystrings);
  rem_tcl_ints(myints);
  rem_builtins(H_dcc, mydcc);
  rem_builtins(H_load, myload);
  rem_builtins(H_fil, myfiles);
  rem_help_reference("filesys.help");
  if ((H_ctcp = find_bind_table("ctcp")))
    rem_builtins(H_ctcp, myctcp);
  del_bind_table(H_fil);
  del_entry_type(&USERENTRY_DCCDIR);
  del_lang_section("filesys");
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 2
0
static char *channels_close()
{
  write_channels();
  free_udef(udef);
  if (lastdeletedmask)
    nfree(lastdeletedmask);
  rem_builtins(H_chon, my_chon);
  rem_builtins(H_dcc, C_dcc_irc);
  rem_tcl_commands(channels_cmds);
  rem_tcl_strings(my_tcl_strings);
  rem_tcl_ints(my_tcl_ints);
  rem_tcl_coups(mychan_tcl_coups);
  del_hook(HOOK_USERFILE, (Function) channels_writeuserfile);
  del_hook(HOOK_BACKUP, (Function) backup_chanfile);
  del_hook(HOOK_REHASH, (Function) channels_rehash);
  del_hook(HOOK_PRE_REHASH, (Function) channels_prerehash);
  del_hook(HOOK_MINUTELY, (Function) check_expired_bans);
  del_hook(HOOK_MINUTELY, (Function) check_expired_exempts);
  del_hook(HOOK_MINUTELY, (Function) check_expired_invites);
  Tcl_UntraceVar(interp, "global-chanset",
                 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
                 traced_globchanset, NULL);
  rem_help_reference("channels.help");
  rem_help_reference("chaninfo.help");
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 3
0
static char *assoc_close()
{
  kill_all_assoc();
  rem_builtins(H_dcc, mydcc);
  rem_builtins(H_bot, mybot);
  rem_builtins(H_link, mylink);
  rem_tcl_commands(mytcl);
  rem_help_reference("assoc.help");
  del_lang_section("assoc");
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 4
0
static char *seen_close()
{
  p_tcl_bind_list H_temp;

  rem_builtins(H_load, seen_load);
  rem_builtins(H_dcc, seen_dcc);
  rem_help_reference("seen.help");
  if ((H_temp = find_bind_table("pub")))
    rem_builtins(H_temp, seen_pub);
  if ((H_temp = find_bind_table("msg")))
    rem_builtins(H_temp, seen_msg);
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 5
0
/* This function is called when the module is unloaded. */
static char *sample_close()
{
  /* Remove the partyline commands we added when the module is unloaded. */
  rem_builtins(H_dcc, mydcc);

  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 6
0
void kill_bind(void)
{
  tcl_bind_list_t *tl, *tl_next;

  rem_builtins(H_dcc, C_dcc);
  rem_builtins(H_dcc, traffic_dcc);
  rem_builtins(H_dcc, help_dcc);
  rem_builtins(H_dcc, logfile_dcc);
  for (tl = bind_table_list; tl; tl = tl_next) {
    tl_next = tl->next;

    if (!(tl->flags |= HT_DELETED))
      putlog(LOG_DEBUG, "*", "De-Allocated bind table %s.", tl->name);
    tcl_bind_list_delete(tl);
  }
  bind_table_list = NULL;
}
Exemplo n.º 7
0
static char *ctcp_close()
{
  rem_tcl_strings(mystrings);
  rem_tcl_ints(myints);
  rem_builtins(H_ctcp, myctcp);
  rem_help_reference("ctcp.help");
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 8
0
static char *irc_close()
{
    struct chanset_t *chan;

    /* Force bot to part all channels */
    dprintf(DP_MODE, "JOIN 0\n");

    for (chan = chanset; chan; chan = chan->next)
        clear_channel(chan, 1);
    del_bind_table(H_topc);
    del_bind_table(H_splt);
    del_bind_table(H_sign);
    del_bind_table(H_rejn);
    del_bind_table(H_part);
    del_bind_table(H_nick);
    del_bind_table(H_mode);
    del_bind_table(H_kick);
    del_bind_table(H_join);
    del_bind_table(H_pubm);
    del_bind_table(H_pub);
    del_bind_table(H_need);
    rem_tcl_strings(mystrings);
    rem_tcl_ints(myints);
    rem_builtins(H_dcc, irc_dcc);
    rem_builtins(H_msg, C_msg);
    rem_builtins(H_raw, irc_raw);
    rem_tcl_commands(tclchan_cmds);
    rem_help_reference("irc.help");
    del_hook(HOOK_MINUTELY, (Function) check_expired_chanstuff);
    del_hook(HOOK_5MINUTELY, (Function) status_log);
    del_hook(HOOK_ADD_MODE, (Function) real_add_mode);
    del_hook(HOOK_IDLE, (Function) flush_modes);
    Tcl_UntraceVar(interp, "rfc-compliant",
                   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
                   traced_rfccompliant, NULL);
    Tcl_UntraceVar(interp, "net-type",
                   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
                   traced_nettype, NULL);
    module_undepend(MODULE_NAME);
    return NULL;
}
Exemplo n.º 9
0
static char *wire_close()
{
  wire_list *w = wirelist;
  char wiretmp[512];
  char *enctmp;
  p_tcl_bind_list H_temp;

  /* Remove any current wire encrypt bindings for now, don't worry
   * about duplicate unbinds.
   */
  while (w) {
    enctmp = encrypt_string(w->key, "wire");
    sprintf(wiretmp, "!wire%s", enctmp);
    nfree(enctmp);
    wire_bot[0].name = wiretmp;
    wire_bot[0].flags = "";
    wire_bot[0].func = (IntFunc) wire_filter;
    rem_builtins(H_bot, wire_bot);
    w = w->next;
  }
  w = wirelist;
  while (w && w->sock) {
    dprintf(findanyidx(w->sock), "----- %s\n", WIRE_UNLOAD);
    dprintf(findanyidx(w->sock), "----- %s\n", WIRE_NOLONGERWIRED);
    wire_leave(w->sock);
    w = wirelist;
  }
  rem_help_reference("wire.help");
  rem_builtins(H_dcc, wire_dcc);
  H_temp = find_bind_table("filt");
  rem_builtins(H_temp, wire_filt);
  H_temp = find_bind_table("chof");
  rem_builtins(H_temp, wire_chof);
  del_lang_section("wire");
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 10
0
static char *notes_close()
{
  p_tcl_bind_list H_temp;

  rem_tcl_ints(notes_ints);
  rem_tcl_strings(notes_strings);
  rem_tcl_commands(notes_tcls);
  if ((H_temp = find_bind_table("msg")))
    rem_builtins(H_temp, notes_msgs);
  if ((H_temp = find_bind_table("join")))
    rem_builtins(H_temp, notes_join);
  rem_builtins(H_dcc, notes_cmds);
  rem_builtins(H_chon, notes_chon);
  rem_builtins(H_away, notes_away);
  rem_builtins(H_nkch, notes_nkch);
  rem_builtins(H_load, notes_load);
  rem_help_reference("notes.help");
  del_hook(HOOK_MATCH_NOTEREJ, (Function) match_note_ignore);
  del_hook(HOOK_HOURLY, (Function) notes_hourly);
  del_entry_type(&USERENTRY_FWD);
  del_lang_section("notes");
  module_undepend(MODULE_NAME);
  return NULL;
}
Exemplo n.º 11
0
static void wire_leave(int sock)
{
  char wirecmd[513];
  char wiremsg[513];
  char wiretmp[513];
  char *enctmp;
  wire_list *w = wirelist;
  wire_list *w2 = wirelist;
  wire_list *wlast = wirelist;

  while (w) {
    if (w->sock == sock)
      break;
    w = w->next;
  }
  if (!w)
    return;
  enctmp = encrypt_string(w->key, "wire");
  strcpy(wirecmd, enctmp);
  nfree(enctmp);
  sprintf(wiretmp, "%s left the wire.", dcc[findanyidx(w->sock)].nick);
  enctmp = encrypt_string(w->key, wiretmp);
  strcpy(wiremsg, enctmp);
  nfree(enctmp);
  {
    char x[1024];

    simple_sprintf(x, "!wire%s %s", wirecmd, botnetnick);
    botnet_send_zapf_broad(-1, botnetnick, x, wiremsg);
  }
  w2 = wirelist;
  while (w2) {
    if (w2->sock != sock && !strcmp(w2->key, w->key)) {
      dprintf(findanyidx(w2->sock), "----- %s %s\n",
              dcc[findanyidx(w->sock)].nick, WIRE_LEFT);
    }
    w2 = w2->next;
  }
  /* Check to see if someone else is using this wire key.
   * If so, then don't remove the wire filter binding.
   */
  w2 = wirelist;
  while (w2) {
    if (w2 != w && !strcmp(w2->key, w->key))
      break;
    w2 = w2->next;
  }
  if (!w2) {                    /* Someone else is NOT using this key */
    wire_bot[0].name = wirecmd;
    wire_bot[0].flags = "";
    wire_bot[0].func = (IntFunc) wire_filter;
    rem_builtins(H_bot, wire_bot);
  }
  w2 = wirelist;
  wlast = 0;
  while (w2) {
    if (w2 == w)
      break;
    wlast = w2;
    w2 = w2->next;
  }
  if (wlast) {
    if (w->next)
      wlast->next = w->next;
    else
      wlast->next = 0;
  } else if (!w->next)
    wirelist = 0;
  else
    wirelist = w->next;
  nfree(w->crypt);
  nfree(w->key);
  nfree(w);
}