|
|
@@ -161,6 +161,30 @@ int count_class(struct session *ses, struct listnode *group)
|
|
|
return cnt;
|
|
|
}
|
|
|
|
|
|
+void clear_class(struct session *ses, struct listnode *group)
|
|
|
+{
|
|
|
+ size_t type, index;
|
|
|
+
|
|
|
+ check_all_events(ses, EVENT_FLAG_CLASS, 0, 1, "CLASS CLEAR", group->arg1);
|
|
|
+ check_all_events(ses, EVENT_FLAG_CLASS, 1, 1, "CLASS CLEAR %s", group->arg1, group->arg1);
|
|
|
+
|
|
|
+ for (type = 0 ; type < LIST_MAX ; type++)
|
|
|
+ {
|
|
|
+ if (!HAS_BIT(ses->list[type]->flags, LIST_FLAG_CLASS))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (index = 0 ; index < ses->list[type]->used ; index++)
|
|
|
+ {
|
|
|
+ if (!strcmp(ses->list[type]->list[index]->group, group->arg1))
|
|
|
+ {
|
|
|
+ delete_index_list(ses->list[type], index--);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
DO_CLASS(class_assign)
|
|
|
{
|
|
|
if (node == NULL)
|
|
|
@@ -182,8 +206,6 @@ DO_CLASS(class_assign)
|
|
|
|
|
|
DO_CLASS(class_clear)
|
|
|
{
|
|
|
- int type, index;
|
|
|
-
|
|
|
if (node == NULL)
|
|
|
{
|
|
|
show_message(ses, LIST_CLASS, "#CLASS {%s} DOES NOT EXIST.", arg1);
|
|
|
@@ -191,24 +213,7 @@ DO_CLASS(class_clear)
|
|
|
return ses;
|
|
|
}
|
|
|
|
|
|
- check_all_events(ses, EVENT_FLAG_CLASS, 0, 1, "CLASS CLEAR", ses->group);
|
|
|
- check_all_events(ses, EVENT_FLAG_CLASS, 1, 1, "CLASS CLEAR %s", ses->group, ses->group);
|
|
|
-
|
|
|
- for (type = 0 ; type < LIST_MAX ; type++)
|
|
|
- {
|
|
|
- if (!HAS_BIT(ses->list[type]->flags, LIST_FLAG_CLASS))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- for (index = 0 ; index < ses->list[type]->used ; index++)
|
|
|
- {
|
|
|
- if (!strcmp(ses->list[type]->list[index]->group, arg1))
|
|
|
- {
|
|
|
- delete_index_list(ses->list[type], index--);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ clear_class(ses, node);
|
|
|
|
|
|
show_message(ses, LIST_CLASS, "#CLASS {%s} HAS BEEN CLEARED.", arg1);
|
|
|
|
|
|
@@ -304,8 +309,6 @@ DO_CLASS(class_list)
|
|
|
|
|
|
DO_CLASS(class_kill)
|
|
|
{
|
|
|
- int group;
|
|
|
-
|
|
|
if (node == NULL)
|
|
|
{
|
|
|
show_message(ses, LIST_CLASS, "#CLASS {%s} DOES NOT EXIST.", arg1);
|
|
|
@@ -313,14 +316,18 @@ DO_CLASS(class_kill)
|
|
|
return ses;
|
|
|
}
|
|
|
|
|
|
- class_clear(ses, node, arg1, arg2);
|
|
|
+// Best to handle this in delete_node so it works with #kill
|
|
|
+
|
|
|
+// class_clear(ses, node, arg1, arg2);
|
|
|
+
|
|
|
+ delete_node_list(ses, LIST_CLASS, node);
|
|
|
|
|
|
- group = search_index_list(ses->list[LIST_CLASS], arg1, NULL);
|
|
|
+// group = search_index_list(ses->list[LIST_CLASS], arg1, NULL);
|
|
|
|
|
|
- delete_index_list(ses->list[LIST_CLASS], group);
|
|
|
+// delete_index_list(ses->list[LIST_CLASS], group);
|
|
|
|
|
|
- check_all_events(ses, EVENT_FLAG_CLASS, 0, 1, "CLASS DESTROYED", arg1);
|
|
|
- check_all_events(ses, EVENT_FLAG_CLASS, 1, 1, "CLASS DESTROYED %s", arg1, arg1);
|
|
|
+// check_all_events(ses, EVENT_FLAG_CLASS, 0, 1, "CLASS DESTROYED", arg1);
|
|
|
+// check_all_events(ses, EVENT_FLAG_CLASS, 1, 1, "CLASS DESTROYED %s", arg1, arg1);
|
|
|
|
|
|
show_message(ses, LIST_CLASS, "#CLASS {%s} HAS BEEN KILLED.", arg1);
|
|
|
|