# Module: Telegard

# Telegard (Telegard)

Telegard is the main Telegard library responsible for initialization of sub libraries.

# Public Class Methods

### goodbye ()

Defines normal goodbye

Show source...

         # File bbs/lib/telegard.rb, line 178
    178: def Telegard.goodbye
    179:   # TODO: Add askny question, and add any other items here.
    180:   Tgtemplate.display('logout_prompt_goodbye.ftl')
    181:   askuser = Tgio::Input.inputyn
    182:   if askuser == true
    183:     self.goodbye_fast
    184:   end
    185: end

### goodbye_fast ()

Defines fast goodbye

Show source...

         # File bbs/lib/telegard.rb, line 188
    188: def Telegard.goodbye_fast
    189:   puts "Goodbye!"
    190:   # If we have reached this point, the main controller has exited.
    191:   # Terminate the session
    192:   $callerid.time_logout = Time.now
    193:   $callerid.save
    194:   $session.destroy if $session
    195:   $session = nil if $session
    196:   exit 0
    197: end

### init ()

Load the entire stack in the correct order. Use this method for anything that requires full init

Show source...

         # File bbs/lib/telegard.rb, line 165
    165: def Telegard.init
    166:   self.loadlib_tgconstants
    167:   self.loadlib_tgio
    168:   self.loadlib_tgconfig
    169:   self.load_tgconfig
    170:   self.loadlib_tgdatabase
    171:   self.load_databaseconn
    172:   self.loadlib_tgdatabasemodels
    173:   self.loadlib_tgtemplate
    174:   self.loadlib_tgcontroller
    175: end

### load_databaseconn ()

Connect to the user specified DB engine & load the Sequel models

Show source...

         # File bbs/lib/telegard.rb, line 112
    112: def Telegard.load_databaseconn
    113:   begin
    114:     Tgio.printstart "Initializing database connection"
    115:     $db = Tgdatabase.connect($cfg['database'])
    116:     Tgio.printreturn(0)
    117:   rescue Exception => e
    118:     Tgio.printreturn(1)
    119:     puts e
    120:     exit 1
    121:   end
    122: end

### load_tgconfig ()

Loads configuration into a global $cfg variable

Show source...

        # File bbs/lib/telegard.rb, line 89
    89: def Telegard.load_tgconfig
    90:   begin
    91:     Tgio.printstart "Loading Telegard configuration"
    92:     $cfg = Tgconfig.load
    93:     Tgio.printreturn(0)
    94:   rescue Exception => e
    95:     Tgio.printreturn(1)
    96:     puts e
    97:     exit 1
    98:   end
    99: end

### loadlib_tgconfig ()

Load Library: Tgconfig

Show source...

        # File bbs/lib/telegard.rb, line 79
    79: def Telegard.loadlib_tgconfig
    80:   begin
    81:     require 'lib/tgconfig'
    82:   rescue LoadError
    83:     "FATAL: cannot load library 'tgconfig'."
    84:     exit 1
    85:   end
    86: end

### loadlib_tgconstants ()

Load the constants definition

Show source...

        # File bbs/lib/telegard.rb, line 58
    58: def Telegard.loadlib_tgconstants
    59:   begin
    60:     require 'lib/tgconstants'
    61:   rescue LoadError
    62:     "FATAL: cannot load library 'tgconstants'."
    63:     exit 1
    64:   end
    65: end

### loadlib_tgcontroller ()

Load Library: Tgcontroller

Show source...

         # File bbs/lib/telegard.rb, line 151
    151: def Telegard.loadlib_tgcontroller
    152:   begin
    153:     Tgio.printstart "Loading Master Controller"
    154:     require 'lib/tgcontroller'
    155:     Tgio.printreturn(0)
    156:   rescue LoadError
    157:     "FATAL: cannot load library 'tgcontroller'."
    158:     Tgio.printreturn(1)
    159:     exit 1
    160:   end
    161: end

### loadlib_tgdatabase ()

Load Library: Tgdatabase

Show source...

         # File bbs/lib/telegard.rb, line 102
    102: def Telegard.loadlib_tgdatabase
    103:   begin
    104:     require 'lib/tgdatabase'
    105:   rescue LoadError
    106:     "FATAL: cannot load library 'tgdatabase'."
    107:     exit 1
    108:   end
    109: end

### loadlib_tgdatabasemodels ()

Load Library: Tgdatabase_models

Show source...

         # File bbs/lib/telegard.rb, line 125
    125: def Telegard.loadlib_tgdatabasemodels
    126:   begin
    127:     require 'lib/tgdatabase_models'
    128:   rescue LoadError
    129:     "FATAL: cannot load library 'tgdatabase_models'."
    130:     exit 1
    131:   rescue Sequel::DatabaseConnectionError => e
    132:     puts "Unable to connect to database: #{e}"
    133:     exit 1
    134:   end
    135: end

### loadlib_tgio ()

Load Library: Tgio

Show source...

        # File bbs/lib/telegard.rb, line 68
    68: def Telegard.loadlib_tgio
    69:   begin
    70:     require 'lib/tgio'
    71:     Tgio.mainbanner
    72:   rescue LoadError
    73:     "FATAL: cannot load library 'tgio'."
    74:     exit 1
    75:   end
    76: end

### loadlib_tgtemplate ()

Load Library: Tgtemplate

Show source...

         # File bbs/lib/telegard.rb, line 138
    138: def Telegard.loadlib_tgtemplate
    139:   begin
    140:     Tgio.printstart "Loading FreeMarker+TG template engine"
    141:     require 'lib/tgtemplate'
    142:     Tgio.printreturn(0)
    143:   rescue LoadError
    144:     "FATAL: cannot load library 'tgtemplate'."
    145:     Tgio.printreturn(1)
    146:     exit 1
    147:   end
    148: end

### unimplemented ()

Prints a message when a feature is currently not implemented

Show source...

         # File bbs/lib/telegard.rb, line 200
    200: def Telegard.unimplemented
    201:  puts "En: Sorry! Feature not implemented / De: Element nicht geschrieben"
    202: end