Skip to content

Commit

Permalink
Unbreak contrib.
Browse files Browse the repository at this point in the history
  • Loading branch information
William Pitcock committed Aug 26, 2010
1 parent fcaabaf commit 4f38480
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 150 deletions.
1 change: 0 additions & 1 deletion contrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ SRCS = \
os_akillnicklist.c \
os_kill.c \
os_klinechan.c \
os_logstream.c \
os_pingspam.c \
os_savechanmodes.c \
os_tabletest.c \
Expand Down
8 changes: 4 additions & 4 deletions contrib/cs_userinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ static void cs_cmd_userinfo(sourceinfo_t *si, int parc, char *parv[])
LIST_FOREACH(n, mc->chanacs.head)
{
ca = n->data;
if (ca->myuser == NULL)
if (ca->entity == NULL)
continue;
md = metadata_find(ca, "userinfo");
if (md == NULL)
continue;
command_success_nodata(si, "%-19s %s", entity(ca->myuser)->name, md->value);
command_success_nodata(si, "%-19s %s", ca->entity->name, md->value);
}

command_success_nodata(si, "------------------- ---------------");
Expand All @@ -111,7 +111,7 @@ static void cs_cmd_userinfo(sourceinfo_t *si, int parc, char *parv[])
command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), parv[1]);
return;
}
ca = chanacs_find(mc, mu, 0);
ca = chanacs_find(mc, entity(mu), 0);
if (ca == NULL || ca->level & CA_AKICK)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 has no access to \2%s\2."), entity(mu)->name, mc->name);
Expand Down Expand Up @@ -155,7 +155,7 @@ static void userinfo_check_join(hook_channel_joinpart_t *hdata)
mc = mychan_find(cu->chan->name);
if (mu == NULL || mc == NULL)
return;
ca = chanacs_find(mc, mu, 0);
ca = chanacs_find(mc, entity(mu), 0);
if (ca == NULL || ca->level & CA_AKICK)
return;
if (!(md = metadata_find(ca, "userinfo")))
Expand Down
2 changes: 1 addition & 1 deletion contrib/graphtastical.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void write_channels_dot_file(void *arg)
if (ca->level & CA_AKICK)
continue;

fprintf(f, "\"%s\" -- \"%s\" [fontname=\"Verdana\" fontsize=8]\n", ca->myuser ? entity(ca->myuser)->name : ca->host, mc->name);
fprintf(f, "\"%s\" -- \"%s\" [fontname=\"Verdana\" fontsize=8]\n", ca->entity ? ca->entity->name : ca->host, mc->name);
}
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/os_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ static void os_cmd_kill(sourceinfo_t *si, int parc, char *parv[])

if(!parv[0] || !parv[1])
{
notice(opersvs.nick, si->su->nick, "Usage: \2KILL\2 <target> <reason>");
command_fail(si, fault_badparams, "Usage: \2KILL\2 <target> <reason>");
return;
}

if(!(target = user_find_named(parv[0])))
{
notice(opersvs.nick, si->su->nick, "\2%s\2 is not on the network", parv[0]);
command_fail(si, fault_nosuch_target, "\2%s\2 is not on the network", parv[0]);
return;
}

Expand Down
7 changes: 6 additions & 1 deletion contrib/os_klinechan.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ static void klinechan_check_join(hook_channel_joinpart_t *hdata)
{
mychan_t *mc;
chanuser_t *cu = hdata->cu;
service_t *svs;
char reason[256];

svs = service_find("operserv");
if (svs == NULL)
return;

if (cu == NULL || is_internal_client(cu->user))
return;

Expand All @@ -68,7 +73,7 @@ static void klinechan_check_join(hook_channel_joinpart_t *hdata)
if (metadata_find(mc, "private:klinechan:closer"))
{
if (has_priv_user(cu->user, PRIV_JOIN_STAFFONLY))
notice(opersvs.nick, cu->user->nick,
notice(svs->me->nick, cu->user->nick,
"Warning: %s klines normal users",
cu->chan->name);
else if (is_autokline_exempt(cu->user))
Expand Down
128 changes: 0 additions & 128 deletions contrib/os_logstream.c

This file was deleted.

17 changes: 9 additions & 8 deletions contrib/os_pingspam.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ static void os_cmd_pingspam(sourceinfo_t *si, int parc, char *parv[])

if(!target)
{
notice(opersvs.nick, si->su->nick, "Usage: \2PINGSPAM\2 <target>");
command_fail(si, fault_badparams, "Usage: \2PINGSPAM\2 <target>");
return;
}

if(!(u = user_find_named(target)))
{
notice(opersvs.nick, si->su->nick, "\2%s\2 is not on the network", target);
command_fail(si, fault_nosuch_target, "\2%s\2 is not on the network", target);
return;
}

pingspam(u);
notice(opersvs.nick, si->su->nick, "\2%s\2 has been pwned.", target);
command_success_nodata(si, "\2%s\2 has been pwned.", target);
logcommand(si, CMDLOG_ADMIN, "PINGSPAM: \2%s\2", target);
}

Expand All @@ -123,17 +123,17 @@ static void os_cmd_autopingspam(sourceinfo_t *si, int parc, char *parv[])

if(!mode)
{
notice(opersvs.nick, si->su->nick, "Auto-pingspam is currently \2%s\2", spamming ? "ON" : "OFF");
command_success_nodata(si, "Auto-pingspam is currently \2%s\2", spamming ? "ON" : "OFF");
return;
}

if(strcasecmp(mode, "on") == 0 || atoi(mode))
{
spamming = 1;
notice(opersvs.nick, si->su->nick, "Auto-pingspam is now \2ON\2");
command_success_nodata(si, "Auto-pingspam is now \2ON\2");
}else{
spamming = 0;
notice(opersvs.nick, si->su->nick, "Auto-pingspam is now \2OFF\2");
command_success_nodata(si, "Auto-pingspam is now \2OFF\2");
}
}

Expand All @@ -142,10 +142,11 @@ void pingspam(user_t *u)
user_t *sptr;
node_t *n;
int i;
service_t *svs;

if(*globsvs.nick)
if((svs = service_find("global")) != NULL)
for(i = 0;i < 6;i++)
notice(globsvs.nick, u->nick, "%s", notices[rand() % sizeof(notices) / sizeof(char*)]);
notice(svs->me->nick, u->nick, "%s", notices[rand() % sizeof(notices) / sizeof(char*)]);

LIST_FOREACH(n, me.me->userlist.head)
{
Expand Down
11 changes: 8 additions & 3 deletions contrib/os_savechanmodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ static channel_t *restore_channel(char *name, char *modes)
channel_t *c;
int modeparc;
char *modeparv[256];
service_t *svs;

svs = service_find("operserv");
if (svs == NULL)
svs = chansvs.me;

join(name, chansvs.nick);
c = channel_find(name);
if (c != NULL)
{
modeparc = sjtoken(modes, ' ', modeparv);
channel_mode(opersvs.me->me, c, modeparc, modeparv);
channel_mode(svs->me, c, modeparc, modeparv);
}
return c;
}
Expand Down Expand Up @@ -153,7 +158,7 @@ static void os_cmd_loadchanmodes(sourceinfo_t *si, int parc, char *parv[])
prevtopicts = c->topicts;
ts = strtoul(tsstr, NULL, 10);
handle_topic(c, setter, ts, topic);
topic_sts(c, opersvs.me->me, setter, ts, prevtopicts, topic);
topic_sts(c, chansvs.me->me, setter, ts, prevtopicts, topic);
}
else if (!strcmp(item, "ban"))
{
Expand All @@ -165,7 +170,7 @@ static void os_cmd_loadchanmodes(sourceinfo_t *si, int parc, char *parv[])

if (type == NULL || mask == NULL)
continue;
modestack_mode_param(opersvs.nick, c, MTYPE_ADD, type[0], mask);
modestack_mode_param(chansvs.nick, c, MTYPE_ADD, type[0], mask);
chanban_add(c, mask, type[0]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/os_testproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void testproc_recvqhandler(connection_t *cptr)
buf[count] = '\0';
u = user_find(procdata.dest);
if (u != NULL)
notice(opersvs.nick, u->nick, "%s", buf);
notice(service_find("operserv")->me->nick, u->nick, "%s", buf);
}

static void testproc_closehandler(connection_t *cptr)
Expand Down
5 changes: 4 additions & 1 deletion contrib/os_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ static trace_action_t *trace_kill_prepare(sourceinfo_t *si, char **args)

static void trace_kill_exec(user_t *u, trace_action_t *act)
{
service_t *svs;
trace_action_kill_t *a = (trace_action_kill_t *) act;

return_if_fail(u != NULL);
Expand All @@ -527,9 +528,11 @@ static void trace_kill_exec(user_t *u, trace_action_t *act)
return;
if (u->myuser && is_soper(u->myuser))
return;
if ((svs = service_find("operserv")) != NULL)
return;

act->matched = true;
kill_user(opersvs.me->me, u, "%s", a->reason);
kill_user(svs->me, u, "%s", a->reason);
command_success_nodata(act->si, _("\2%s\2 has been killed."), u->nick);
}

Expand Down

0 comments on commit 4f38480

Please sign in to comment.