Example #1
0
char *wire_start(Function *global_funcs)
{
  p_tcl_bind_list H_temp;

  global = global_funcs;

  module_register(MODULE_NAME, wire_table, 2, 0);
  if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) {
    module_undepend(MODULE_NAME);
    return "This module requires Eggdrop 1.6.0 or later.";
  }

  if (!(encryption_funcs = module_depend(MODULE_NAME, "encryption", 2, 1))) {
    module_undepend(MODULE_NAME);
    return "This module requires an encryption module.";
  }

  add_help_reference("wire.help");
  add_builtins(H_dcc, wire_dcc);
  H_temp = find_bind_table("filt");
  add_builtins(H_filt, wire_filt);
  H_temp = find_bind_table("chof");
  add_builtins(H_chof, wire_chof);
  wirelist = NULL;
  add_lang_section("wire");
  return NULL;
}
Example #2
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;
}
Example #3
0
static int tcl_bind(ClientData cd, Tcl_Interp *irp,
                    int argc, char *argv[])
{
  tcl_bind_list_t *tl;

  /* cd defines what tcl_bind is supposed do: 0 = bind, 1 = unbind. */
  if ((long int) cd == 1)
    BADARGS(5, 5, " type flags cmd/mask procname");

  else
    BADARGS(4, 5, " type flags cmd/mask ?procname?");

  tl = find_bind_table(argv[1]);
  if (!tl) {
    Tcl_AppendResult(irp, "bad type, should be one of: ", NULL);
    dump_bind_tables(irp);
    return TCL_ERROR;
  }
  if ((long int) cd == 1) {
    if (!unbind_bind_entry(tl, argv[2], argv[3], argv[4])) {
      /* Don't error if trying to re-unbind a builtin */
      if (argv[4][0] != '*' || argv[4][4] != ':' ||
          strcmp(argv[3], &argv[4][5]) || strncmp(argv[1], &argv[4][1], 3)) {
        Tcl_AppendResult(irp, "no such binding", NULL);
        return TCL_ERROR;
      }
    }
  } else {
    if (argc == 4)
      return tcl_getbinds(tl, argv[3]);
    bind_bind_entry(tl, argv[2], argv[3], argv[4]);
  }
  Tcl_AppendResult(irp, argv[3], NULL);
  return TCL_OK;
}
Example #4
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;
}
Example #5
0
static void init_server_ctcps(char *module)
{
  p_tcl_bind_list H_ctcp;

  if ((H_ctcp = find_bind_table("ctcp")))
    add_builtins(H_ctcp, myctcp);
}
Example #6
0
static int notes_server_setup(char *mod)
{
  p_tcl_bind_list H_temp;

  if ((H_temp = find_bind_table("msg")))
    add_builtins(H_temp, notes_msgs);
  return 0;
}
Example #7
0
static int notes_irc_setup(char *mod)
{
  p_tcl_bind_list H_temp;

  if ((H_temp = find_bind_table("join")))
    add_builtins(H_temp, notes_join);
  return 0;
}
Example #8
0
static int irc_seen_setup(char *mod)
{
  p_tcl_bind_list H_temp;

  if ((H_temp = find_bind_table("pub")))
    add_builtins(H_temp, seen_pub);
  return 0;
}
Example #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;
}
Example #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;
}
Example #11
0
int check_validity(char *nme, Function func)
{
  char *p;
  tcl_bind_list_t *tl;

  if (*nme != '*')
    return 0;
  p = strchr(nme + 1, ':');
  if (p == NULL)
    return 0;
  *p = 0;
  tl = find_bind_table(nme + 1);
  *p = ':';
  if (!tl)
    return 0;
  if (tl->func != func)
    return 0;
  return 1;
}
Example #12
0
void tell_binds(int idx, char *par)
{
  tcl_bind_list_t *tl, *tl_kind;
  tcl_bind_mask_t *tm;
  int fnd = 0, showall = 0, patmatc = 0;
  tcl_cmd_t *tc;
  char *name, *proc, *s, flg[100];

  if (par[0])
    name = newsplit(&par);
  else
    name = NULL;
  if (par[0])
    s = newsplit(&par);
  else
    s = NULL;

  if (name)
    tl_kind = find_bind_table(name);
  else
    tl_kind = NULL;

  if ((name && name[0] && !egg_strcasecmp(name, "all")) ||
      (s && s[0] && !egg_strcasecmp(s, "all")))
    showall = 1;
  if (tl_kind == NULL && name && name[0] && egg_strcasecmp(name, "all"))
    patmatc = 1;

  dprintf(idx, MISC_CMDBINDS);
  dprintf(idx, "  TYPE FLGS     COMMAND              HITS BINDING (TCL)\n");

  for (tl = tl_kind ? tl_kind : bind_table_list; tl;
       tl = tl_kind ? 0 : tl->next) {
    if (tl->flags & HT_DELETED)
      continue;
    for (tm = tl->first; tm; tm = tm->next) {
      if (tm->flags & TBM_DELETED)
        continue;
      for (tc = tm->first; tc; tc = tc->next) {
        if (tc->attributes & TC_DELETED)
          continue;
        proc = tc->func_name;
        build_flags(flg, &(tc->flags), NULL);
        if (showall || proc[0] != '*') {
          int ok = 0;

          if (patmatc == 1) {
            if (wild_match_per(name, tl->name) ||
                wild_match_per(name, tm->mask) ||
                wild_match_per(name, tc->func_name))
              ok = 1;
          } else
            ok = 1;

          if (ok) {
            dprintf(idx, "  %-4s %-8s %-20s %4d %s\n", tl->name, flg, tm->mask,
                    tc->hits, tc->func_name);
            fnd = 1;
          }
        }
      }
    }
  }
  if (!fnd) {
    if (patmatc)
      dprintf(idx, "No command bindings found that match %s\n", name);
    else if (tl_kind)
      dprintf(idx, "No command bindings for type: %s.\n", name);
    else
      dprintf(idx, "No command bindings exist.\n");
  }
}