Module: IRC::Server::Modules::Base::Utils::Channel

Defined in:
lib/failirc/server/modules/Base.rb

Defined Under Namespace

Classes: Ban, Invitation

Class Method Summary collapse

Class Method Details

.banned?(channel, client) ⇒ Boolean

Returns:

  • (Boolean)


408
409
410
411
412
413
414
415
416
# File 'lib/failirc/server/modules/Base.rb', line 408

def self.banned? (channel, client)
    channel.modes[:bans].each {|ban|
        if ban.match(client.mask)
            return true
        end
    }

    return false
end

.exception?(channel, client) ⇒ Boolean

Returns:

  • (Boolean)


418
419
420
421
422
423
424
425
426
# File 'lib/failirc/server/modules/Base.rb', line 418

def self.exception? (channel, client)
    channel.modes[:exceptions].each {|exception|
        if exception.match(client.mask)
            return true
        end
    }

    return false
end

.invited?(channel, client, shallow = false) ⇒ Boolean

Returns:

  • (Boolean)


390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/failirc/server/modules/Base.rb', line 390

def self.invited? (channel, client, shallow=false)
    if shallow && !channel.modes[:invite_only]
        return true
    end

    if channel.modes[:invited].has_value?(client.nick)
        return true
    end

    channel.modes[:invites].each {|invite|
        if invite.match(client.mask)
            return true
        end
    }

    return false
end

.isValid(string) ⇒ Object



386
387
388
# File 'lib/failirc/server/modules/Base.rb', line 386

def self.isValid (string)
    string.match(/^[&#+!][^ ,:\a]{0,50}$/) ? true : false
end

.type(string) ⇒ Object



382
383
384
# File 'lib/failirc/server/modules/Base.rb', line 382

def self.type (string)
    string.match(/^([&#+!])/)
end