@@ -50,20 +50,16 @@ CMD_FUNC(REPORT);
50
50
51
51
ModuleHeader MOD_HEADER = {
52
52
"third/helpop" , // Module name
53
- "1.3 " , // Module Version
53
+ "1.4 " , // Module Version
54
54
"HelpOp - Provides usermode h (HelpOp) and swhois line, channelmode g (HelpOp-only room), and command /HELPOPS" , // Description
55
55
"Valware" , // Author
56
56
"unrealircd-6" , // Unreal Version
57
57
};
58
58
59
59
int helpop_whois (Client * requester , Client * acptr , NameValuePrioList * * list );
60
60
int helponly_check (Client * client , Channel * channel , const char * key , char * * errmsg );
61
+ int helpchan_join_op_presence_check (Client * client , Channel * channel , MessageTag * mtags );
61
62
62
- typedef struct {
63
- // Change this or add more variables, whatever suits you fam
64
- char flag ;
65
- int p ;
66
- } aModeX ;
67
63
68
64
// Initialisation routine (register hooks, commands and modes or create structs etc)
69
65
MOD_INIT () {
@@ -80,6 +76,8 @@ MOD_INIT() {
80
76
CheckAPIError ("CommandAdd(MSG_MYCMD)" , CommandAdd (modinfo -> handle , MSG_MYCMD , HELPOPS , 1 , CMD_SERVER | CMD_USER ));
81
77
82
78
HookAdd (modinfo -> handle , HOOKTYPE_WHOIS , 0 , helpop_whois );
79
+ HookAdd (modinfo -> handle , HOOKTYPE_LOCAL_JOIN , 0 , helpchan_join_op_presence_check );
80
+ HookAdd (modinfo -> handle , HOOKTYPE_REMOTE_JOIN , 0 , helpchan_join_op_presence_check );
83
81
84
82
MARK_AS_GLOBAL_MODULE (modinfo );
85
83
return MOD_SUCCESS ;
@@ -162,3 +160,41 @@ CMD_FUNC(HELPOPS) {
162
160
sendto_umode_global (extumode_helpop ,"(HelpOps) from %s: %s" ,client -> name ,parv [1 ]);
163
161
164
162
}
163
+
164
+ int helpchan_join_op_presence_check (Client * client , Channel * channel , MessageTag * mtags )
165
+ {
166
+ if (strcasecmp (channel -> name ,HELP_CHANNEL ))
167
+ return 0 ;
168
+
169
+ Member * member ;
170
+ int found = 0 ;
171
+ for (member = channel -> members ; member ; member = member -> next )
172
+ {
173
+ Membership * mb = find_membership_link (member -> client -> user -> channel , channel );
174
+
175
+ if (IsHelpop (member -> client ) && client == member -> client && client -> local )
176
+ {
177
+ MessageTag * mtags = NULL ;
178
+
179
+ new_message (member -> client , NULL , & mtags );
180
+ sendto_channel (channel , & me , NULL , 0 , 0 , SEND_LOCAL , mtags ,
181
+ ":%s MODE %s %s %s" ,
182
+ me .name , channel -> name , "+o" , client -> name );
183
+ sendto_server (NULL , 0 , 0 , mtags , ":%s MODE %s %s %s%s" , me .id , channel -> name , "+o" , client -> name , IsServer (member -> client )?" 0" :"" );
184
+ free_message_tags (mtags );
185
+ add_member_mode_fast (member , mb , 'o' );
186
+ found = 1 ;
187
+ }
188
+ if (check_channel_access (member -> client , channel , "hoaq" ))
189
+ {
190
+
191
+ if (!IsULine (member -> client ))
192
+ found = 1 ;
193
+ }
194
+ }
195
+ if (!found ) // found no op so let them helpops know
196
+ {
197
+ sendto_umode (extumode_helpop ,"[%s] %s has joined the help channel and there are no ops on that channel." , HELP_CHANNEL , client -> name );
198
+ }
199
+ return 0 ;
200
+ }
0 commit comments