Hamster-Skripte: functions (server)

Ham version

Transmitted the version number of the hamster.

Return value: character string (e.g. " 1/3/17/0").

Print (" hamster version " + Ham version)

HamPath, HamHscPath, HamHsmPath, HamLogsPath, HamServerPath, HamGroupsPath, HamMailPath, HamNewsOutPath and HamMailsOutPath

Supplies internal hamster's paths back. Specifically it is about the main catalogue, the searching path for Skripte, the searching path for modules, the protocol catalogue, the server catalogue, the news group catalogue, the mail catalogue, the catalogue for going out Postings and the catalogue for going out mails.

Rückgabewert:Zeichenkette with the entire(complete) path name and the following Backslash.

If (FileExists (HamPath + "Hamster.exe"))

*

Endif

Hamm legend (< message >, < parameter >)

Hamm legend (< message >)

Releases different events in the hamster who are taxable alternatively also by menu.

Ignores Ignores

Msg

Param

Effect

1

Hamsters finish

2

0=Zähler+Log 1=Zähler

2=Log 3=Fehlerliste

If numerator and log-announcement puts back

3

0=stop, 1=start

Start / stop of local NNTP-servers

4

0=stop, 1=start

Start / stop local POP3-Server

5

0=stop, 1=start

Start / stop of local SMTP-servers

6

0=Verst., 1=Anz.

Indicate / hide of the main window

7

0=Verst., 1=Anz.

Indicate / hide of the Tray-icon

8

Menu: On-line / all orders finish

9

0=Test, 1=Laden

Configuration again load

Note to Msg=9

The parameter '1' leads only to the shop of the configuration if all configuration windows are concluded(closed) (return value of the function: 1 / True) .Andernfalls is implemented nothing (return value: 0 / False). With the parameter '0' (tests) nothing is implemented fundamentally, but is determined only the corresponding return values. Can be tested whether the shop is possible if necessary (i.e. the configuration is concluded(closed)).

Return values (out of with parameter 9):

0

OK; order implemented.

1

Error; order incorrectly.

2

Unknown parameter

3

GPF, floating point mistake

Hamm legend (2, 0) * reset counters

HamGetStatus (< status >, < parameter >)

Supplies information about the momentary condition of the hamster.

HamGetStatus (1, n) announces whether local server is started

For n is considered(applies):

1Lokaler NNTP-server

2=Lokaler POP3-Server

3Lokaler SMTP-server

Return value: 1 if the server is active, otherwise 0

HamGetStatus (2, n) announces the number of the connections open in the local server

For n is considered(applies):

1Lokaler NNTP-server

2=Lokaler POP3-Server

3Lokaler SMTP-server

Return value: 1 if the server is active, otherwise 0

HamGetStatus (3, n) gives information about arrived / waiting news and mails

For n is considered(applies):

1Neue articles,

2Geladene articles,

3=Bekannte (History-filtered) articles,

4Gelöschte articles,

5=zu dispatching articles,

6Neue E-mails,

7=zu dispatching E-mails

Return value: Honorable

Warning (HamGetStaus (3,1))

HamThreadCount

If the number of the tasks/orders active for a moment supplies back.

Note: connections of (mail-/News-) Clients to the local server do not belong as an active Tasks.

Return value: Honorable

Print (HamThreadCount)

HamIsIdle

If returns TRUE (Truely) (1), if for a moment no active processes(lawsuits) run like pure gene, news call, mail dispatch etc.

Note: connections of (mail-/News-) Clients to the local server do not belong as an active Tasks

Return value: Honorable

If (HamIsIdle)

*.

Endif

HamWaitIdle (< time-out >)

HamWaitIdle

The function HamWaitIdle waits, since the time-out is reached, or no more orders are active in the hamster. If HAM_WAITIDLE_INFINITE,-1 or no parameter is applied for the time-out, the function returns only if no more orders are active. The orders / tasks for the local servers are not considered, in this connection.

Return value: 0=OK, 1=Timeout, 2=Interrupted (interrupted)

HamWaitIdle

HamFlush

Schreibcache empty - e.g., History) stores all still unsecured data (on the non removable disk. This is to be recommended particularly after the import of article.

Return value: 0

HamFlush

HamPurge (< option >, < group >)

HamPurge (< option >)

HamPurge

Const HAM_PURGEOPT_DOALL = 0xFF

Const HAM_PURGEOPT_DONEWS = 0x01

Const HAM_PURGEOPT_DOHISTORY = 0x02

Const HAM_PURGEOPT_DOKILLS = 0x04

Const HAM_PURGEOPT_DOMHISTORY = 0x08

Starts an order to the rangement of hamster's data. The first parameter fixes what should be cleared. He is oriented to bit and can by logical AND are formed. (Bit0=1=Artikel, Bit1=2=History-Einträge, Bit2=4=Killfile-Log, Bit3=8=Mail-History-Einträge). With the second parameter one can limit the rangement to a separate group.

Return value: 0=OK / started, < > 0=nicht started

HamWaitIdle

HamPurge (4)

HamPurge (1, "hamster.de.newuser")

HamWaitIdle

HamRebuildGlobalLists

If producing the global lists starts. The parameter is not used at the moment, should be covered in view of possible extensions, however, with zero.

Return value: 0=OK / started, < > 0=nicht started

HamWaitIdle

HamRebuildGlobalLists

HamWaitIdle

HamRebuildHistory

If producing the History starts file (".\Groups\History.dat") on the basis of the current article existence. This function should only be used if the hamster 'Idle' is. (See function HamWaitIdle)

Return value: 0=OK / started, < > 0=nicht started

HamWaitIdle

HamRebuildHistory

HamWaitIdle

HamSetLogin (< identifier >, < username >, < password >)

Sets temporarly the name and the password for a network-connection DFÜ. The <Identifier> must agree(correspond) accurately (incl. big / use of small letters) with the name on the DFÜ-network. If the question mark is applied for the password, the hamster questions on the password only when required. Besides, the variables defined in the password-menu can also be applied for user's name and password.

Return value: 0=OK, < > 0=Fehler

HamSetLogin ("MyProvider", "MyUsername", "MyPassword")

HamSetLogin ("MyProvider", "MyUsername", "?")

HamSetLogin ("MyProvider", " 42 $ ", " ")

HamNewsPull (< server-craft >)

HamNewsPull

The call of new articles of the news server is begun with it. If becomes the "server-craft" übergangen or remains they(she) empty (" "), all NNTP-servers are applied which are defined in the hamster. Otherwise the transfer is limited to the registered news servers. To apply there several news servers, they must be separated simply by Semikoli of each other. The server names have the same format like in " attitudes(settings) / news (groups) Port configure " i.e. server name + "," +. Example: " news.aaa.com, nntp; news.bbb.com, nntp "

Return value: 0=OK / started, < > 0=nicht started

HamNewsPull

HamNewsPull (" one.newsserv.er, nntp; two.newsserv.er, nntp ")

Ham news post (< server-craft >)

Ham news post

If the new article (if existing(exist)) postet starts an order. If becomes the <server-craft> übergangen or remains they(she) empty (" "), all NNTP-servers are applied which are defined in the hamster. Otherwise the transfer is limited to the registered news servers. To apply there several news servers, they must be separated simply by Semikoli of each other. The server names have the same format like in " attitudes(settings) / news (groups) Port configure " i.e. server name + "," +. Example: " news.aaa.com, nntp; news.bbb.com, nntp "

Return value: 0=OK / started, < > 0=nicht started

Ham news post

Ham news post (" one.newsserv.er, nntp; two.newsserv.er, nntp ")

HamNewsJobsClear

If the job list deletes.

Return value: 0

HamNewsJobsClear

HamNewsJobsPullDef (< server-craft >)

HamNewsJobsPullDef

Adds the loading orders for article automatically to the job list which can be implemented with the servers given(indicated) in the server list. If the server list is empty, all available servers are applied, apart from that the servers must as usual in the form " server name, Port; server name, Port;... " Are given(indicated).

Return value: < 0:Fehler >, =0: number of the added news jobs

HamNewsJobsPullDef

HamNewsJobsPullDef (" one.newsserv.er, nntp; two.newsserv.er, nntp ")

HamNewsJobsPostDef (< server-craft >)

HamNewsJobsPostDef

If the Sendeaufträge adds for the articles in News.out automatically to the job list which can be implemented with the servers given(indicated) in the server list. If the server list is empty, all available servers are applied, apart from that the servers must as usual in the form " server name, Port; server name, Port;... " Are given(indicated).

Return value: < 0:Fehler >, =0: number of the added news jobs

HamNewsJobsPostDef

HamNewsJobsPostDef (" one.newsserv.er, nntp; two.newsserv.er, nntp ")

HamNewsJobsPull (< server >, < group-select >)

HamNewsJobsPull (< server >)

Adds separate loading orders for article of the job list which are practicable with the server <server> and the group selection to given(indicated) groups. If the group selection is empty, all available groups are applied, other If only such fit to the Regular expression in <group-select>.

Return value: < 0:Fehler >, =0: number of the added news jobs

HamNewsJobsPull ("one.newsserv.er")

HamNewsJobsPull ("two.newsserv.er", "^alt\".)

Ham news job post (< server >, < group-select >, < header-select >)

Ham news job post (< server >, < group-select >)

Ham news job post (< server >)

If separate Sendeaufträge adds for article of the job list which are practicable with in the server list and the group selection to given(indicated) servers and groups. If the group selection is empty, all available groups are applied. The regular expression <header-select> can be used for the extended choice - only to the condition fitting articles are dispatched.

Indication: the hamster sends only article server which also have loading orders (Newspulls) for the corresponding group in which the article should be sent.

Return value: < 0:Fehler >, =0: number of the added news jobs

Ham news job post ("one.newsserv.er", ". * ", " ^X-Post-To: one.newsserv.er ")

Ham news job post ("two.newsserv.er", "^alt\".)

Ham news job post ("one.newsserv.er")

Ham news job start (< server-craft >)

Ham news job start

If the processing of the job list starts for the servers given(indicated) in the server list or for all servers if the server list is empty.

Return value: < 0:Fehler >, =0: number of the started orders

* Replacement for Ham news post and HamNewsPull:

HamNewsJobsClear

HamNewsJobsPostDef

HamNewsJobsPullDef

Ham news job start

HamMailExchange (< server-craft >)

HamMailExchange

With this function new mails are recalled first by the mail server and afterwards mails (if existing(exist)) dispatches. If the "server-craft" übergangen or empty is let (" "), all SMTP-servers POP3-and defined in the hamster are applied. Otherwise the transfer is limited to the registered servers. By use the <server-craft> from one must by Semikoli separated (";") list of server name exist(consist). The server names have the same format like under " attitudes(settings) / mail (server) configure " i.e. server name + "," + port.

Note: the use of "HamFetchMail" and "HamSendMail" was more meaningful so far, because with these orders also the Mailaccounts and mail filter can be included by hamster. However, in case of from "HamMailExchange" it is accessed now the attitudes(settings) the POP3-Server, so that the order is sufficient in the majority of the cases.

Return value: 0=OK / started, < > 0=nicht started

HamMailAll

HamMailAll (" one.mailserv.er, pop3; two.mailserv.er, smtp ")

HamFetchMail (< server >, < port >, < user >, < fit >, < destuser >, < filter >, < LeaveOnServer >)

...

HamFetchMail (< server >)

Starts an order to fetch of the E-mails with a POP3-Server. For "user" and "password" a variable defined in the password menu can be applied. For <destuser> a local user can be given(indicated) who should get the E-mails. If not, is applied in the menu "attitudes("settings") configured users. In addition to local user a section can be given(indicated) with <filter> also in the mail-filter-file Mailfilt.hst, if not, is also accessed here again the menu "attitudes("settings"). If LeaveOnServer = "1", will leave the mails on the server, if LeaveOnServer = "0", are deleted them(her) by the server, with every other value the attitudes(settings) of the server or the default attitude(setting) are considered(apply).

Return value: 0=OK / started, < > 0=nicht started

HamFetchMail ("pop3.serv.er", "pop3", """ ",", "," ")

HamFetchMail ("pop3.serv.er", """, john.doe "," secret "," John "," ")

HamFetchMail ("pop3.serv.er", "10110", " 7 $ ", """, Jane "," ")

HamFetchMail ("pop3.serv.er", """, 42 $ "," " ", admin "," myfilters ")

HamSendMail (< server >, < port >, < from-select >)

...

HamSendMail (< server >)

Starts an order in order to send the E-mails to a SMTP-server. If the parameter from-select is not empty, become only E-mails dispatches whose "Envelope-From" corresponds to the regular expression in this parameter.

Return value: 0=OK / started, < > 0=nicht started

HamSendMail ("smtp1.serv.er", "smtp", "john\.doe@serv\.er")

HamSendMail ("smtp2.serv.er")

HamSendMailAuth (< server >, < port >, < user >, < fit >, < from-select >)

...

HamSendMailAuth (< server >)

Starts an order in order to send the E-mails to a SMTP-server under use of the SMTP-Auth-Verfahrens. If the parameter from-select is not empty, become only E-mails dispatches whose Envelope-From corresponds to the regular expression in this parameter.

Return value: 0=OK / started, < > 0=nicht started

HamSendMailAuth ("smtp3.serv.er", "smtp", " 42 $ ", """, @smtp3\.serv\.er ")

HamRasDial (< name >, < user >, < fit >)

...

HamRasDial (< name >)

Function, which the DFÜ-connection called with <name>, from the telephone directory of the net-work DFÜ for which Einwahl applies and the registration in the server with user's name <user> and password <fits> tried (if existing(exist)). If <user> (users) and / or <fit> (password) übergangen become or are empty (" "), the information opposed by "HamSetLogin" is used or is accessed the values stored in the hamster to the construction of the connection. Also this function can fall back on one of the passwords "generally accepted" to avoid a clear text information in the script (< user > "=" $ (number), < fit > = " "). See the also menu moreover to password and the order RasDial

INDICATION: If "HamRasDial" is applied, the connection should be finished with "HamRasHangup".

Return value: 0=OK / connection constructed; > 0=Fehler-Code;-1=DFÜ-Netzwerk does not install

$try = 1

While (HamRasDial ("MyProvider", " 42 $ ")! = 0)

If ($try > = 3)

Error (" Dialing failed! ")

Endif

Inc ($try)

Sleep (10000)

Endwhile

HamRasHangup

If concludes(closes) the current, with HamRasDial opened, network-connection DFÜ.

Return value: 0=OK / connection constructed; > 0=Fehler-Code;-1=DFÜ-Netzwerk not installed HamRasHangup

HamGroupCount

If the number of the news groups available in the hamster (incl. local groups) supplies back.

Return value: > =0: ok/number of the groups; < 0: mistake

* See example of HamGroupName

HamGroupName (< index >)

Supplies the name of a news group to your(their) Index. Attention, the counting of the indications begins with zero and goes to HamGroupCount-1!

Return value: character string

Var ($grpidx)

$grpidx = 0

While ($grpidx < HamGroupCount)

Print (HamGroupName ($grpidx))

Inc ($grpidx)

Endwhile

HamGroupIndex (< grpname >)

Supplies the Index of a news group or-1 for an unknown news group.

Return value: > =0: OK/INDEX-NUMBER;-1: unknown group

Print (HamGroupIndex ("internal.misc"))

HamGroupOpen (< grpname >)

If opens a news group and supplies one trades back which is demanded for the other accesses. If a mistake appeared while opening the news group, becomes a negative value zurückgeliefert.

Return value: > =0: OK/Gruppen-Handle; < 0: mistake

$grphdl = HamGroupOpen ("internal.misc")

HamGroupClose (< grphdl >)

If a news group concludes(closes). Respect: news groups must be concluded(closed) in the script always explicitly, an end of the script or the fastenings(closing) of the hamster's object does not conclude(close) the trades automatically!

Return value: 0

HamGroupClose ($grphdl)

HamArtCount (< grphdl >)

If the number of the articles supplies in a group.

Return value: > =0: ok/number of the articles, < 0: mistake

* See example Ham sort text

HamArtNoMin (< grphdl >)

If the smallest existing article number supplies in the respective group back.

Return value: > =0: OK/Artikelnummer, < 0: mistake

* See example Ham sort text

HamArtNoMax (< grphdl >)

If the biggest existing article number supplies in the respective group back.

Return value: > =0: OK/Artikelnummer, < 0: mistake

* Sea(lake) example at Ham sort text

Ham sort text (< grphdl >, < artno >)

Supplies the article text including Header to the called article number back. If the return value is empty, the article does not exist.

Return value: character string (article text or " ")

Var ($grpnam, $grphdl, $artmin, $artmax, $artno, $arttxt)

$grpnam = "internal.misc"

$grphdl = HamGroupOpen ($grpnam)

If ($grphdl > = 0)

Print ("Group", $grpnam, ":", HamArtCount ($grphdl), "articles")

$artmin = HamArtNoMin ($grphdl)

$artmax = HamArtNoMax ($grphdl)

$artno = $artmin

While ($artno < = $artmax)

$arttxt = Ham sort text ($grphdl, $artno)

If ($arttxt < > " ")

Print ("Article", $artno, ":", len ($arttxt), "byte")

Endif

Inc ($artno)

Endwhile

HamGroupClose ($grphdl)

Endif

Ham sort text export (< grphdl >, < artno >)

Supplies the article text including Header to the called article number in the export format back. This differs essentially only by an addition line in the Mbox-format before the real Posting. Is empty the return-String, the article does not exist.

Return value: character string (article text or " ")

$arttxt = Ham sort text export ($grphdl, $artno)

Ham sort import (< article >, < goverride >, < ignorehist >, < marknoarch >)

...

Ham sort import (< article >)

Imports the article in the hamster, and supplies in the success case TRUE back. The article text must contain all Header, the Body and all Separatoren. The parameter OverrideGroups allows the warehouses of the article in a group undependent on Newsgroups-Header. If the group is unknown, the article is stored in the corresponding internal group. If is the parameter IgnoreHistory TRUE, the article is still accepted also then if he is already known in the History. If is the parameter MarkNoArchive TRUE, the article is marked in the Header X-Hamster-Info with "NoArchive=1".

Return value: True / 1: OK, False / 0: mistake

Ham sort import ($article_text, "internal.misc")

HamArtDeleteMid (< message-id >)

Deletes the article with given(indicated) Message-ID. Supplies with successful deleting 0 back.

Return value: =0: deleted, < > 0: Message-ID not found / not geköscht

HamArtDeleteMid (" < 12345.67890@abd.def.ghi > ")

HamArtLocateMid (< message-id >, < grpname >, < artno >)

HamArtLocateMid (< message-id >)

Supplies 0 back if an article with the given(indicated) Message-ID exists in the History. And writes the group name and the article number within the group in the variables Groupname and ArtNo.

Return value: =0: ok/found, < > 0: Message-ID not found

If (HamArtLocateMid (" <12345.67890@abd.def.ghi> ", $groupname, $artno))

*.

Endif

Ham score craft (< grpname >)

If the score list supplies for a group back.

Return value: character string

Craft set text ($ScoreList, Ham score craft ("gruppen.name"))

Ham score test (< grpname >, < article >, < matchlog >)

Ham score test (< grpname >, < article >)

Supplies the score value of an article back which the article would get in the called group And the variable contains match log afterwards all relevant score lines.

Return value: Honorable (score-value)

$ScoreValue = Ham score test ("group.name", $Article, $MatchLog)

Unable to open file