2 * m_cycle.c: server-side CYCLE
4 * Copyright (c) 2010 The ShadowIRCd team
23 extern struct module **modlist
;
25 static int m_cycle(struct Client
*, struct Client
*, int, const char **);
27 struct Message cycle_msgtab
= {
28 "CYCLE", 0, 0, 0, MFLG_SLOW
,
29 {mg_unreg
, {m_cycle
, 2}, {m_cycle
, 2}, mg_ignore
, mg_ignore
, {m_cycle
, 2}}
31 mapi_clist_av1 cycle_clist
[] = { &cycle_msgtab
, NULL
};
33 DECLARE_MODULE_AV1(cycle
, NULL
, NULL
, cycle_clist
, NULL
, NULL
, "$Revision$");
36 m_cycle(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
39 char *s
= LOCAL_COPY(parv
[1]);
40 struct Channel
*chptr
;
41 struct membership
*msptr
;
43 name
= rb_strtok_r(s
, ",", &p
);
45 /* Finish the flood grace period... */
46 if(MyClient(source_p
) && !IsFloodDone(source_p
))
47 flood_endgrace(source_p
);
51 if((chptr
= find_channel(name
)) == NULL
)
53 sendto_one_numeric(source_p
, ERR_NOSUCHCHANNEL
, form_str(ERR_NOSUCHCHANNEL
), name
);
57 msptr
= find_channel_membership(chptr
, source_p
);
60 sendto_one_numeric(source_p
, ERR_NOTONCHANNEL
, form_str(ERR_NOTONCHANNEL
), name
);
64 if(MyConnect(source_p
) && !IsOper(source_p
) && !IsExemptSpambot(source_p
))
65 check_spambot_warning(source_p
, NULL
);
67 if((is_any_op(msptr
) || !MyConnect(source_p
) ||
68 ((can_send(chptr
, source_p
, msptr
) > 0 &&
69 (source_p
->localClient
->firsttime
+
70 ConfigFileEntry
.anti_spam_exit_message_time
) < rb_current_time()))))
72 sendto_server(client_p
, chptr
, CAP_TS6
, NOCAPS
,
73 ":%s PART %s :Cycling", use_id(source_p
), chptr
->chname
);
74 sendto_channel_local(ALL_MEMBERS
, chptr
, ":%s!%s@%s PART %s :Cycling",
75 source_p
->name
, source_p
->username
,
76 source_p
->host
, chptr
->chname
);
80 sendto_server(client_p
, chptr
, CAP_TS6
, NOCAPS
,
81 ":%s PART %s", use_id(source_p
), chptr
->chname
);
82 sendto_channel_local(ALL_MEMBERS
, chptr
, ":%s!%s@%s PART %s",
83 source_p
->name
, source_p
->username
,
84 source_p
->host
, chptr
->chname
);
87 remove_user_from_channel(msptr
);
92 name
= rb_strtok_r(NULL
, ",", &p
);
95 user_join(client_p
, source_p
, parv
[1], parc
> 2 ? parv
[2] : NULL
);