Indy 9
TIdGopher
Hierarchy, Properties, Methods, Events, See Also, Unit: IdGopher
Implements a Gopher client.
TIdGopher = class(TIdTCPClient)
Unit
IdGopher
Description
The TIdGopher is a client implementation of the Internet Gopher protocol (RFC 1436) as described in the Internet Standards document:

  • RFC 1436- The Internet Gopher Protocol (http://www.rfc-editor.org/rfc/rfc1436.txt)

TIdGopher also implements partial support for the Gopher+ protocol as described in the document:

  • Gopher+, Upward-Compatible Enhancements to the Internet Gopher protocol (http://boombox.micro.umn.edu/pub/gopher/gopher_protocol/Gopher+/Gopher+.txt)

Gopher is a distributed document system developed at the University of Minnesota as an attempt to make locating information resources intuitive for users through a series of structured menus leading to documents or pointers to other protocols such as Telnet and TN3270. While this has been succeeded by the World Wide Web, this is still useful for accessing legacy systems and has a low overhead due to its simplicity and structure.


TIdGopher.Port
TIdGopher, See Also
Port number for the connection to the Gopher server.
property Port: integer;
Description
Port is an Integer property that identifies the port number used for connecting to a Gopher server. TIdGopher overrides the definition of the Port property to assign the default value to IdPORT_GOPHER, as required in the Gopher protocol specification.

TIdGopher.Create
TIdGopher, See Also
Instantiates a TIdGopher instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create constructs a properly initialized instance of TIdGopher using the inherited Create constructor, and initializes Port to the constant value IdPORT_GOPHER (Decimal 70) as required by the Gopher Protocol.

TIdGopher.GetExtendedMenu
TIdGopher
Gets the Gopher+ extended menu.
function GetExtendedMenu(ASelector: String; AView: String = ''): TIdGopherMenu;
Parameters
ASelector: String
the selector used to retrieve the gopher menu AView - alternative views listed for the item you are retrieving for a Gopher + server.
Return Value
TIdGopherMenu - Gopher+ extended menu or standard menu.
Description
GetExtendedMenu is a TIdGopherMenu function that gets an extended Gopher+ menu including additional Gopher+ information. GetExtendedMenu will also retrieve the standard Gopher menu if the server does not support Gopher+.

We do not recommend that you use this procedure unless you are sure the server supports Gopher+ because a constant used in the Gopher+ Protocol greeting will conflict with the menu item type constant IdGopherItem_Redundant which could appear in the menu as a first item. To determine if a Gopher Server supports Gopher+, use the TIdGopherMenuItem.GopherPlusItem property from the gopher menu which is referring to the item you want.

The application is responsible for freeing the TIdGopherMenu returned by this function.


TIdGopher.GetFile
TIdGopher, See Also
Retrieve a Gopher Binary File.
procedure GetFile(ASelector: String; ADestStream: TStream; IsGopherPlus: Boolean = False; AView: String = '');
Parameters
ASelector: String
the selector used to retrieve the file.
ADestStream: TStream
DEstination for the retrieved file.
IsGopherPlus: Boolean = False
Server supports Gopher+. Default value is False.
AView: String = ''
Alternate view listed. Default value is ''.
Description
GetFile is a procedure used to retrieve a binary Gopher File and store its content in ADestStream. ISGopherPlus should be set to True for Gopher+ servers, or False for non-Gopher+ servers where a file name can start with "+". AView is an alternative view listed for the file you are retrieving with Gopher+.

If you are retrieving a text file, use the GetTextFile method because GetFile will include the "." end of text file marker.


TIdGopher.GetMenu
TIdGopher
Retrieves the Gopher menu.
function GetMenu(ASelector: String; IsGopherPlus: Boolean = False; AView: String = ''): TIdGopherMenu;
Parameters
ASelector: String
the selector for the Gopher item or an empty string to get the root item. IsGopherPlus - Server supports Gopher+. Default value is False.
AView: String = ''
Alternative view listed. Default value is ''.
Return Value
TIdGopherMenu - The standard Gopher menu.
Description
GetMenu is a TIdGopherMenu function used to retrieve a Gopher Menu. ISGopherPlus should be set to true for Gopher+ servers or false for non-gopher plus servers in case a menu starts with a "+". AView is an alternative view listed for the menu you are retrieving with Gopher+.

The application is responsible for freeing the TIdGopherMenu returned by this function.


TIdGopher.GetTextFile
TIdGopher, See Also
Retrieve a Gopher text File.
procedure GetTextFile(ASelector: String; ADestStream: TStream; IsGopherPlus: Boolean = False; AView: String = '');
Parameters
ASelector: String
the selector used to retrieve the file.
ADestStream: TStream
DEstination for the retrieved file.
IsGopherPlus: Boolean = False
Server supports Gopher+. Default value is False.
AView: String = ''
Alternate view listed. Default value is ''.
Description
GetTextFile is a procedure used to retrieve a Gopher Text File and store its content in ADestStream. ISGopherPlus should be set to True for Gopher+ servers, or False for non-Gopher+ servers where a file name can start with "+". AView is an alternative view listed for the file you are retrieving with Gopher+.

If you are retrieving a text file, use the GetFile method because GetTextFile will stop reading if it encounters the "." end of text file marker.


TIdGopher.Search
TIdGopher
Perform a Gopher search using a query.
function Search(ASelector: String; AQuery: String): TIdGopherMenu;
Parameters
ASelector: String
the selector for the gopher item AQuery - the Gopher query string.
Return Value
TIdGopherMenu - The Gopher menu returned for the query.
Description
Search is a TIdGopherMenu function used to perform a Gopher search with the query specified by AQuery, and returns a Gopher Menu resulting from the search. Gopher+ syntax is not supported in AQuery.

The application is responsible for freeing the TIdGopherMenu returned by this function.


TIdGopher.OnMenuItem
TIdGopher
Event handler for retrieved Gopher menu items.
property OnMenuItem: TIdGopherMenuEvent;
Parameters
MenuItem
The menu item retrieved from the server.
Sender
Gopher menu that own the menu item.
Description
OnMenuItem is a TIdGopherMenuEvent event handler that is triggered for each menu item retrieved with the GetMenu, Search, and GetExtendedMenu methods. OnMenuItem is used to display gopher menu items while the complete menu is downloaded.

An application must assign a procedure to the event handler in order to respond to the event notification.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.