diff --git a/src/core/route.c b/src/core/route.c index 0c69c12..3fae178 100644 --- a/src/core/route.c +++ b/src/core/route.c @@ -149,6 +149,19 @@ int route_to_all(struct hub_info* hub, struct adc_message* command) /* iterate u return 0; } +int route_to_operators(struct hub_info* hub, struct adc_message* command) /* iterate users */ +{ + struct hub_user* user = (struct hub_user*) list_get_first(hub->users->list); + while (user) + { + if (user_flag_get(user, flag_opnotify)) + route_to_user(hub, user, command); + user = (struct hub_user*) list_get_next(hub->users->list); + } + return 0; +} + + int route_to_subscribers(struct hub_info* hub, struct adc_message* command) /* iterate users */ { int do_send; diff --git a/src/core/route.h b/src/core/route.h index 378c2b8..a462e4d 100644 --- a/src/core/route.h +++ b/src/core/route.h @@ -40,6 +40,14 @@ extern int route_to_user(struct hub_info* hub, struct hub_user*, struct adc_mess */ extern int route_to_all(struct hub_info* hub, struct adc_message* command); +/** + * Send a message to all operators. + * Technically it sends to all users with the flag_opnotify set + * which is intended to be set for only operators - allowing operators to opt-out + * of these messages. + */ +extern int route_to_operators(struct hub_info* hub, struct adc_message* command); + /** * Broadcast message to all users subscribing to the type of message. */ diff --git a/src/core/user.h b/src/core/user.h index 4af9382..0860659 100644 --- a/src/core/user.h +++ b/src/core/user.h @@ -47,6 +47,7 @@ enum user_flags feature_link = 0x00000100, /** LINK: Hub link (not supported) */ feature_adcs = 0x00000200, /** ADCS: ADC over TLS/SSL */ feature_bas0 = 0x00000400, /** BAS0: Obsolete pre-ADC/1.0 protocol version */ + flag_opnotify = 0x00200000, /** User should receive operation notifications. NOTE: Only operators should have this flag! */ flag_flood = 0x00400000, /** User has been notified about flooding. */ flag_muted = 0x00800000, /** User is muted (cannot chat) */ flag_ignore = 0x01000000, /** Ignore further reads */