59
58
struct Client *target_p = NULL;
60
59
struct Channel *chptr = NULL;
61
struct Membership *ms = NULL;
60
struct Membership *member = NULL;
65
const dlink_node *ptr = NULL;
64
const dlink_node *node = NULL;
67
DLINK_FOREACH(ptr, source_p->localClient->invited.head)
66
DLINK_FOREACH(node, source_p->connection->invited.head)
68
67
sendto_one_numeric(source_p, &me, RPL_INVITELIST,
69
((struct Channel *)ptr->data)->chname);
68
((struct Channel *)node->data)->name);
70
70
sendto_one_numeric(source_p, &me, RPL_ENDOFINVITELIST);
95
if ((ms = find_channel_link(source_p, chptr)) == NULL)
95
if ((member = find_channel_link(source_p, chptr)) == NULL)
97
sendto_one_numeric(source_p, &me, ERR_NOTONCHANNEL, chptr->chname);
97
sendto_one_numeric(source_p, &me, ERR_NOTONCHANNEL, chptr->name);
101
if (!has_member_flags(ms, CHFL_CHANOP))
101
if (!has_member_flags(member, CHFL_CHANOP | CHFL_HALFOP))
103
sendto_one_numeric(source_p, &me, ERR_CHANOPRIVSNEEDED, chptr->chname);
103
sendto_one_numeric(source_p, &me, ERR_CHANOPRIVSNEEDED, chptr->name);
107
107
if (IsMember(target_p, chptr))
109
sendto_one_numeric(source_p, &me, ERR_USERONCHANNEL, target_p->name, chptr->chname);
109
sendto_one_numeric(source_p, &me, ERR_USERONCHANNEL, target_p->name, chptr->name);
113
if ((source_p->localClient->invite.last_attempt + ConfigChannel.invite_client_time) < CurrentTime)
114
source_p->localClient->invite.count = 0;
113
if ((source_p->connection->invite.last_attempt + ConfigChannel.invite_client_time) < CurrentTime)
114
source_p->connection->invite.count = 0;
116
if (source_p->localClient->invite.count > ConfigChannel.invite_client_count)
116
if (source_p->connection->invite.count > ConfigChannel.invite_client_count)
118
sendto_one_numeric(source_p, &me, ERR_TOOMANYINVITE, chptr->chname, "user");
118
sendto_one_numeric(source_p, &me, ERR_TOOMANYINVITE, chptr->name, "user");
122
source_p->localClient->invite.last_attempt = CurrentTime;
123
source_p->localClient->invite.count++;
122
source_p->connection->invite.last_attempt = CurrentTime;
123
source_p->connection->invite.count++;
125
sendto_one_numeric(source_p, &me, RPL_INVITING, target_p->name, chptr->chname);
125
sendto_one_numeric(source_p, &me, RPL_INVITING, target_p->name, chptr->name);
127
127
if (target_p->away[0])
128
128
sendto_one_numeric(source_p, &me, RPL_AWAY, target_p->name, target_p->away);
132
132
sendto_one(target_p, ":%s!%s@%s INVITE %s :%s",
133
133
source_p->name, source_p->username,
135
target_p->name, chptr->chname);
135
target_p->name, chptr->name);
137
137
if (chptr->mode.mode & MODE_INVITEONLY)
139
sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP,
140
"NOTICE @%s :%s is inviting %s to %s.",
141
chptr->chname, source_p->name,
142
target_p->name, chptr->chname);
139
sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP | CHFL_HALFOP,
140
"NOTICE %%%s :%s is inviting %s to %s.",
141
chptr->name, source_p->name,
142
target_p->name, chptr->name);
144
144
/* Add the invite if channel is +i */
145
145
add_invite(chptr, target_p);
148
148
else if (target_p->from != source_p->from)
149
149
sendto_one(target_p, ":%s INVITE %s %s %lu",
150
150
source_p->id, target_p->id,
151
chptr->chname, (unsigned long)chptr->channelts);
151
chptr->name, (unsigned long)chptr->creationtime);
192
192
sendto_one(target_p, ":%s!%s@%s INVITE %s :%s",
193
193
source_p->name, source_p->username,
195
target_p->name, chptr->chname);
195
target_p->name, chptr->name);
197
197
if (chptr->mode.mode & MODE_INVITEONLY)
199
sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP,
200
"NOTICE @%s :%s is inviting %s to %s.",
201
chptr->chname, source_p->name,
202
target_p->name, chptr->chname);
199
sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP | CHFL_HALFOP,
200
"NOTICE %%%s :%s is inviting %s to %s.",
201
chptr->name, source_p->name,
202
target_p->name, chptr->name);
204
204
/* Add the invite if channel is +i */
205
205
add_invite(chptr, target_p);
208
208
else if (target_p->from != source_p->from)
209
209
sendto_one(target_p, ":%s INVITE %s %s %lu",
210
210
source_p->id, target_p->id,
211
chptr->chname, (unsigned long)chptr->channelts);
211
chptr->name, (unsigned long)chptr->creationtime);