<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.darenet.org/skins/common/feed.css?12"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>ircu api - gline - Revision history</title>
		<link>http://wiki.darenet.org/index.php?title=ircu_api_-_gline&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.1</generator>
		<lastBuildDate>Wed, 20 May 2026 06:14:48 GMT</lastBuildDate>
		<item>
			<title>Secretagent:&amp;#32;New page: &lt;pre&gt;Some users can be very annoying, as any IRC operator can attest.  Some can in fact be downright abusive.  Sometimes the best way of dealing with these users is to ban them from the en...</title>
			<link>http://wiki.darenet.org/index.php?title=ircu_api_-_gline&amp;diff=2269&amp;oldid=prev</link>
			<description>&lt;p&gt;New page: &amp;lt;pre&amp;gt;Some users can be very annoying, as any IRC operator can attest.  Some can in fact be downright abusive.  Sometimes the best way of dealing with these users is to ban them from the en...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;Some users can be very annoying, as any IRC operator can attest.  Some&lt;br /&gt;
can in fact be downright abusive.  Sometimes the best way of dealing&lt;br /&gt;
with these users is to ban them from the entire network.  The G-line&lt;br /&gt;
system permits this.&lt;br /&gt;
&lt;br /&gt;
G-lines are fairly complicated.  A G-line can be active or inactive,&lt;br /&gt;
either locally or globally.  It can be a purely local G-line, or&lt;br /&gt;
global.  It could be based on IP address or on host name.  In short,&lt;br /&gt;
there are many variations on the basic G-line.  Worse, there is also&lt;br /&gt;
the concept of a &amp;quot;bad channel,&amp;quot; or BADCHAN, that has been tacked onto&lt;br /&gt;
the G-line subsystem, when it should have been a separate command in&lt;br /&gt;
the first place.&lt;br /&gt;
&lt;br /&gt;
Different types of G-lines are differentiated from each other through&lt;br /&gt;
the use of various flags.  Some of these flags are maintained solely&lt;br /&gt;
by the G-line subsystem, where as others are passed to various&lt;br /&gt;
functions in the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_MAX_EXPIRE 604800	/* max expire: 7 days */&lt;br /&gt;
&lt;br /&gt;
This macro lists the maximum expire time a G-line is permitted to&lt;br /&gt;
have.  This value is limited to 7 days to prevent abuse of the system.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_ACTIVE	0x0001&lt;br /&gt;
&lt;br /&gt;
This flag is used to indicate that a given G-line is globally active.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_IPMASK	0x0002&lt;br /&gt;
&lt;br /&gt;
This flag is used to indicate that a given G-line is an IP mask.  This&lt;br /&gt;
flag is maintained internally by the G-line subsystem.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_BADCHAN	0x0004&lt;br /&gt;
&lt;br /&gt;
This flag is used to indicate that a given G-line specifies a BADCHAN,&lt;br /&gt;
a channel that users are not permitted to join.  This flag is&lt;br /&gt;
maintained internally, but is also used in gline_find() to search for&lt;br /&gt;
a BADCHAN for a particular channel.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_LOCAL	0x0008&lt;br /&gt;
&lt;br /&gt;
This flag is used to indicate that a given G-line is a local G-line.&lt;br /&gt;
Local G-lines do not affect users on other servers.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_ANY	0x0010&lt;br /&gt;
&lt;br /&gt;
This flag is passed to gline_find() to signal that function to return&lt;br /&gt;
any G-line or BADCHAN that matches the passed mask string.  It is&lt;br /&gt;
never set on a real G-line.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_FORCE	0x0020&lt;br /&gt;
&lt;br /&gt;
This flag is passed to gline_add() to force the server to accept an&lt;br /&gt;
expire time that might be out of bounds.  It is never set on a real&lt;br /&gt;
G-line.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_EXACT	0x0040&lt;br /&gt;
&lt;br /&gt;
This flag is passed to gline_find() to signal that function to return&lt;br /&gt;
only G-lines that exactly match the passed mask string.  That is, the&lt;br /&gt;
ircd_strcmp() function is called to compare the G-line to the mask,&lt;br /&gt;
rather than the match() function.  This flag is never set on a real&lt;br /&gt;
G-line.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_LDEACT	0x0080	/* locally deactivated */&lt;br /&gt;
&lt;br /&gt;
This flag is set on global G-lines that have been locally&lt;br /&gt;
deactivated.  This flag is maintained internally by the G-line&lt;br /&gt;
subsystem.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_GLOBAL	0x0100	/* find only global glines */&lt;br /&gt;
&lt;br /&gt;
This flag is passed to gline_find() or gline_lookup() to specify that&lt;br /&gt;
the caller is only interested in global G-lines.  This flag is never&lt;br /&gt;
set on a real G-line.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define GLINE_LASTMOD	0x0200	/* find only glines with non-zero lastmod */&lt;br /&gt;
&lt;br /&gt;
This flag is passed to gline_find() or gline_lookup() to specify that&lt;br /&gt;
the caller is only interested in G-lines with a non-zero lastmod time,&lt;br /&gt;
that is, G-lines that were not set by a U-lined service.  This flag is&lt;br /&gt;
never set on a real G-line.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;struct&amp;gt;&lt;br /&gt;
struct Gline;&lt;br /&gt;
&lt;br /&gt;
The struct Gline describes everything about a given G-line.  None of&lt;br /&gt;
its fields may be directly accessed by the application; use the&lt;br /&gt;
functions and macros described below instead.&lt;br /&gt;
&amp;lt;/struct&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int GlineIsActive(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns a non-zero value if the G-line is active, or 0&lt;br /&gt;
otherwise.  If a G-line is locally deactivated, this macro will always&lt;br /&gt;
return 0.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int GlineIsRemActive(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns a non-zero value if the G-line is active, ignoring&lt;br /&gt;
whether or not it is locally deactivated.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int GlineIsIpMask(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns a non-zero value if the G-line is an IP mask.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int GlineIsBadChan(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns a non-zero value if a G-line actually represents a&lt;br /&gt;
BADCHAN.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int GlineIsLocal(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns a non-zero value if a G-line is local only.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
char* GlineUser(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns the user name associated with the G-line.  If the&lt;br /&gt;
G-line represents a BADCHAN, this will contain the channel name.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
char* GlineHost(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns the host name associated with the G-line.  If the&lt;br /&gt;
G-line represents a BADCHAN, this will be a NULL pointer.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
char* GlineReason(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
This macro returns the reason that was given when the G-line was set.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
time_t GlineLastMod(struct Gline* g);&lt;br /&gt;
&lt;br /&gt;
G-lines that were not set by a U-lined service have a modification&lt;br /&gt;
time that must be monotonically increasing.  This macro simply returns&lt;br /&gt;
that modification time.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int gline_propagate(struct Client *cptr, struct Client *sptr,&lt;br /&gt;
		    struct Gline *gline);&lt;br /&gt;
&lt;br /&gt;
When a global G-line is set or modified, all other servers must be&lt;br /&gt;
notified of the new G-line.  This function takes care of propagating&lt;br /&gt;
the G-line specified by _gline_, originated by the client _sptr_, to&lt;br /&gt;
all servers except _cptr_ (which may be a NULL pointer).&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int gline_add(struct Client *cptr, struct Client *sptr, char *userhost,&lt;br /&gt;
	      char *reason, time_t expire, time_t lastmod, unsigned int flags);&lt;br /&gt;
&lt;br /&gt;
This function simply adds a G-line, set by _sptr_ and with a&lt;br /&gt;
_userhost_, _reason_, _expire_, and _lastmod_ as specified.  The&lt;br /&gt;
_flags_ parameter is a bit mask consisting of the binary OR of&lt;br /&gt;
GLINE_FORCE, GLINE_LOCAL, or GLINE_ACTIVE, as appropriate.  The&lt;br /&gt;
gline_add() function also calls gline_propagate() to propagate the&lt;br /&gt;
G-line, and kills off any local users matching the G-line if it is&lt;br /&gt;
active.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int gline_activate(struct Client *cptr, struct Client *sptr,&lt;br /&gt;
		   struct Gline *gline, time_t lastmod, unsigned int flags);&lt;br /&gt;
&lt;br /&gt;
This function activates the G-line specified by _gline_, setting its&lt;br /&gt;
_lastmod_ time as specified.  If _flags_ is GLINE_LOCAL and if the&lt;br /&gt;
G-line is locally deactivated, this function will turn off the local&lt;br /&gt;
deactivation flag, but will not modify _lastmod_.  If the G-line is&lt;br /&gt;
globally deactivated, passing this function the GLINE_LOCAL flag will&lt;br /&gt;
have no effect.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int gline_deactivate(struct Client *cptr, struct Client *sptr,&lt;br /&gt;
		     struct Gline *gline, time_t lastmod, unsigned int flags);&lt;br /&gt;
&lt;br /&gt;
This function is similar to gline_activate() except that it&lt;br /&gt;
deactivates the G-line.  If the given G-line is local, or if it was&lt;br /&gt;
set by a U-lined service (and GLINE_LOCAL was not passed via _flags_),&lt;br /&gt;
then the G-line is deleted from memory.  In all other cases, the&lt;br /&gt;
G-line is simply deactivated, either locally (if GLINE_LOCAL was&lt;br /&gt;
passed via _flags_) or globally.  Global deactivation will update the&lt;br /&gt;
_lastmod_ time.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
struct Gline *gline_find(char *userhost, unsigned int flags);&lt;br /&gt;
&lt;br /&gt;
This function looks up a G-line matching the given _userhost_ value,&lt;br /&gt;
under control of the _flags_ parameter.  Valid _flags_ that may be&lt;br /&gt;
passed are: GLINE_BADCHAN, GLINE_ANY, GLINE_GLOBAL, GLINE_LASTMOD, or&lt;br /&gt;
GLINE_EXACT, each described above.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
struct Gline *gline_lookup(struct Client *cptr, unsigned int flags);&lt;br /&gt;
&lt;br /&gt;
This function looks up a G-line matching the given client, specified&lt;br /&gt;
by _cptr_, under the control of the _flags_.  Valid values for _flags_&lt;br /&gt;
are GLINE_GLOBAL and GLINE_LASTMOD, as described above.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void gline_free(struct Gline *gline);&lt;br /&gt;
&lt;br /&gt;
This function releases all storage associated with a given G-line.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void gline_burst(struct Client *cptr);&lt;br /&gt;
&lt;br /&gt;
This function generates a burst of all existing global G-lines and&lt;br /&gt;
BADCHANs and sends them to the server specified by _cptr_.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int gline_resend(struct Client *cptr, struct Gline *gline);&lt;br /&gt;
&lt;br /&gt;
This function resends the _gline_ to a server specified by _cptr_.&lt;br /&gt;
This may be used if, for instance, it is discovered that a server is&lt;br /&gt;
not synchronized with respect to a particular G-line.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int gline_list(struct Client *sptr, char *userhost);&lt;br /&gt;
&lt;br /&gt;
This function sends the information about a G-line matching _userhost_&lt;br /&gt;
to the client specified by _sptr_.  If _userhost_ is a NULL pointer, a&lt;br /&gt;
list of all G-lines is sent.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void gline_stats(struct Client *sptr);&lt;br /&gt;
&lt;br /&gt;
This function generates a list of all G-lines, sending them to the&lt;br /&gt;
user _sptr_ by a /STATS G response.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;authors&amp;gt;&lt;br /&gt;
Kev &amp;lt;klmitch@mit.edu&amp;gt;&lt;br /&gt;
&amp;lt;/authors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;changelog&amp;gt;&lt;br /&gt;
[2001-6-15 Kev] Initial documentation for the G-line API.&lt;br /&gt;
&amp;lt;/changelog&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:IRCu API|Gline]]&lt;/div&gt;</description>
			<pubDate>Fri, 25 Apr 2008 04:00:41 GMT</pubDate>			<dc:creator>Secretagent</dc:creator>			<comments>http://wiki.darenet.org/Talk:ircu_api_-_gline</comments>		</item>
	</channel>
</rss>