src/hash.c (DelChannel): Fix type of 'reason' arg to DelChannelUser().
(DelChannelUser): Only send part message if user is local.
src/proto-bahamut.c (DelUser): Unswap arguments to DelChannelUser().
(cmd_part): Move to proto-common.c.
src/proto-common.c (part_desc): New structure type.
(part_helper): Use it to capture user and reason.
(cmd_part): New common function.
src/proto-p10.c (cmd_part): Move to proto-common.c.
(DelUser): Unswap arguments to DelChannelUser().
git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-29
# arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
#
+2006-09-03 15:21:10 GMT Michael Poole <mdpoole@troilus.org> patch-29
+
+ Summary:
+ DelChannelUser call and semantic fixups
+ Revision:
+ srvx--devo--1.3--patch-29
+
+ src/hash.c (DelChannel): Fix type of 'reason' arg to DelChannelUser().
+ (DelChannelUser): Only send part message if user is local.
+
+ src/proto-bahamut.c (DelUser): Unswap arguments to DelChannelUser().
+ (cmd_part): Move to proto-common.c.
+
+ src/proto-common.c (part_desc): New structure type.
+ (part_helper): Use it to capture user and reason.
+ (cmd_part): New common function.
+
+ src/proto-p10.c (cmd_part): Move to proto-common.c.
+ (DelUser): Unswap arguments to DelChannelUser().
+
+ modified files:
+ ChangeLog src/hash.c src/proto-bahamut.c src/proto-common.c
+ src/proto-p10.c
+
+
2006-09-03 15:17:05 GMT Michael Poole <mdpoole@troilus.org> patch-28
Summary:
/* go through all channel members and delete them from the channel */
for (n=channel->members.used; n>0; )
- DelChannelUser(channel->members.list[--n]->user, channel, false, 1);
+ DelChannelUser(channel->members.list[--n]->user, channel, NULL, 1);
/* delete all channel bans */
for (n=channel->banlist.used; n>0; )
struct modeNode* mNode;
unsigned int n;
- if (reason)
+ if (IsLocal(user) && reason)
irc_part(user, channel, reason);
mNode = GetUserMode(channel, user);
unsigned int nn;
for (nn=user->channels.used; nn>0;) {
- DelChannelUser(user, user->channels.list[--nn]->channel, false, 0);
+ DelChannelUser(user, user->channels.list[--nn]->channel, NULL, false);
}
for (nn=duf_used; nn>0; ) duf_list[--nn](user, killer, why);
user->uplink->clients--;
return 1;
}
-static CMD_FUNC(cmd_part) {
- if (argc < 2) return 0;
- parse_foreach(argv[1], part_helper, NULL, NULL, NULL, GetUserH(origin));
- return 1;
-}
-
static CMD_FUNC(cmd_away) {
struct userNode *un;
irc_numeric(pd->user, ERR_NOSUCHNICK, "%s@%s :No such nick", name, self->name);
}
+struct part_desc {
+ struct userNode *user;
+ const char *text;
+};
+
static void
part_helper(struct chanNode *cn, void *data)
{
- DelChannelUser(data, cn, false, 0);
+ struct part_desc *desc = data;
+ DelChannelUser(desc->user, cn, desc->text, false);
+}
+
+static CMD_FUNC(cmd_part)
+{
+ struct part_desc desc;
+
+ if (argc < 2)
+ return 0;
+ desc.user = GetUserH(origin);
+ if (!desc.user)
+ return 0;
+ desc.text = (argc > 2) ? argv[argc - 1] : NULL;
+ parse_foreach(argv[1], part_helper, NULL, NULL, NULL, &desc);
+ return 1;
}
void
return 1;
}
-static CMD_FUNC(cmd_part)
-{
- struct userNode *user;
-
- if (argc < 2)
- return 0;
- user = GetUserH(origin);
- if (!user)
- return 0;
- parse_foreach(argv[1], part_helper, NULL, NULL, NULL, user);
- return 1;
-}
-
static CMD_FUNC(cmd_kick)
{
if (argc < 3)
/* remove user from all channels */
while (user->channels.used > 0)
- DelChannelUser(user, user->channels.list[user->channels.used-1]->channel, false, 0);
+ DelChannelUser(user, user->channels.list[user->channels.used-1]->channel, NULL, false);
/* Call these in reverse order so ChanServ can update presence
information before NickServ nukes the handle_info. */