FinchTool Algorithms — new, paraphrased
Current assumption, subject to change as we develop the notion of multiple calls: Only one call is allowed, by Lark, to reach interesting states (>=failed, +notified). We can select any call that does go beyond an interesting state, to indicate the "current" call; all actions that deal with ongoing call will refer to that one. We will not, for the moment, allow any manual selection of conversation-log entries. When there isn't an entry, it's OK to place calls without hanging up first. So Lark and FinchTool/Directory know about the one-call philosophy; FinchSmarts does not, at present.
PhoneProc:
DoPhone[primarySelection, F[mouse button]];
CalledPartyProc:
DoPhone[contents of called party field, F[mouse button]];
CallingPartyProc:
DoPhone[contents of calling party field, F[mouse button]];
PhoneCmd:
DoPhone[rest of command line, FALSE];
RedialCmd:
DoPhone[contents of called party field, FALSE];
DoPhone[calledPartyText, wantResidence (T/F)]:
Return silently if Finch can't be made running or calledPartyText is NIL
[callee, newCalledPartyText, wantResidence] ← ParseCallee[calledPartyText, wantResidence]
Type "Placing call to <newCalledPartyText>.
Update calledParty field in viewer with newCalledPartyText
HangItUp[F, T] if already talking and pause the indicated number of milliseconds
FinchTool.CallByDescription[callee, residence] -- in FinchDirectory
DirectoryInstance:
REF
RECORD [rName, name, number, homeNumber, remarks, office/home ];
In other words, everything extracted from the directory, or a simulation of same
DirectoryButtonNotifier: select entry and schedule DirectoryButton[selected button].
DirectoryButton[button]: CallNumber[FillDirInst[button], instance.where]
CallByDescription[description, residence(home/office)]:
This is the route in for non-directory-originated calls.
(If it's alphabetic, rName, else number) ← description;
if rName, search any open directories via FindNamedInstance for first match on rName.
if instance found, CallNumber[instance, residence], complaining if residence and not found
else FinchSmarts.PlaceCall[rName, FeepValue[number]]
CallNumber[instance, home/office]:
Call based on instance, filled-in from caller information or extracted from directory
name ← instance.rName else instance.name.
number ← instance.(homeNumber or number), depending on instance.where.
Complain about insufficient information (home and no home number)
Type "Placing call to <name> (<number>)"
set finch tool called party text to <name>[||" at home"]
FinchSmarts.PlaceCall[name, FeepValue[number], useNumber: where=home]
FinchSmarts should accept directory instances, filling them in with additional information. For incoming calls, instance would be constructed from information about the call. FinchTool should call on directory package for directory instances, as a straight client of a package that might have Loganberry under it or might have the current TDIR. But the interfaces will have to be extended to match Doug's needs. (Worried about formatting hit of using Loganberry, and also performance/convenience)
For now, will retain above fractured logic and adapt to FinchSmarts as needed.
ReportConversationState[nb, cDesc, remark ]:
Type remark and quit if nb#$success, quit (with a complaint) if there's no cDesc.
If (buttonsc.clientData)=
NIL
THEN button ← AddConvDesc[cDesc].
Builds a button and assigns the cDesc to it.
IF ~cDesc.originatorRecorded
THEN
-- find out who originated and make the best party description possible
If Finch originated, called-party is already set, and is better than we can get otherwise. Otherwise extract up the calling party for incoming calls, or called-party for calls initiated from the telset. originatorRecorded is FALSE until set TRUE by FinchSmarts Connect code or SetContents below.
SetContents[cDesc, finchToolHandle.(
SELECT cDesc.whoOriginated
FROM
unknown => don't do it,
us => calledPartyText,
them => callingPartyText)]
Deal with twiddling of icon.
If not reserved or parsing, build a "Call to/from x at time t" call status line.
If idle
OR failed
THEN
-- Elaborate.
Add to status line "<whether the call completed><why it ended>, duration = <duration>".
else add to status line a a human-sensible version of the current state.
Add " (<cDesc event's comment>) " and " [<remark>] ", if they're non-nil
Put the status line in the current button, unless cDesc.reportComplete
IF failed OR idle THEN cDesc.reportComplete←TRUE;
SelectEntryInConversations[button, state >= reallyInConv, but not notified];
SetContents[viewer, cDesc]:
cDesc.otherPartyDesc can be of the form "xxx.pa (nnnn)", which confuses Phone commands.
Set viewer to RepairIntelnet[cDesc.otherPartyDesc], with any trailing (...) stripped.
cDesc.originatorRecorded ← TRUE;
RepairIntelnet[num]
RETURNS[number]:
cDesc.otherPartyDesc can contain Intelnet pause characters and authentication code.
Intelnet pause characters are all characters < '\040
Translate pause => "*" remove auth-code.
FinchTool Algorithms — old style, paraphrased
PhoneProc:
DoPhone[primarySelection, F[mouse button]];
CalledPartyProc:
DoPhone[contents of called party field, F[mouse button]];
CallingPartyProc:
DoPhone[contents of calling party field, F[mouse button]];
PhoneCmd:
DoPhone[rest of command line, FALSE];
RedialCmd:
DoPhone[contents of called party field, FALSE];
DoPhone[calledPartyText, wantResidence (T/F)]:
Return silently if Finch not running or calledPartyText is NIL
[callee, newCalledPartyText, residence (T/F)] ← ParseCallee[calledPartyText]
newCalledPartyText ← newCalledPartyText||" at home" if still need to indicate residence.
Type "Placing call to <newCalledPartyText>.
Update calledParty field in viewer with newCalledPartyText
HangItUp[F, T] if already talking and pause the indicated number of milliseconds
FinchTool.CallByDescription[callee, residence] -- in FinchDirectory
DirectoryInstance:
REF
RECORD [rName, name, number, homeNumber, remarks, office/home ];
In other words, everything extracted from the directory, or a simulation of same
DirectoryButtonNotifier: select entry and schedule DirectoryButton[selected button].
DirectoryButton[button]: CallNumber[FillDirInst[button], instance.where]
CallByDescription[description, residence(home/office)]:
This is the route in for non-directory-originated calls.
(If it's alphabetic, rName, else number) ← description;
if rName, search any open directories via FindNamedInstance for first match on rName.
if instance found, CallNumber[instance, residence], complaining if residence and not found
else FinchSmarts.PlaceCall[rName, FeepValue[number]]
CallNumber[instance, home/office]:
Call based on instance, filled-in from caller information or extracted from directory
name ← instance.rName else instance.name.
number ← instance.(homeNumber or number), depending on instance.where.
Complain about insufficient information (home and no home number)
Type "Placing call to <name> (<number>)"
set finch tool called party text to <name>[||" at home"]
FinchSmarts.PlaceCall[name, FeepValue[number], useNumber: where=home]
FinchSmarts should accept directory instances, filling them in with additional information. For incoming calls, instance would be constructed from information about the call. FinchTool should call on directory package for directory instances, as a straight client of a package that might have Loganberry under it or might have the current TDIR. But the interfaces will have to be extended to match Doug's needs. (Worried about formatting hit of using Loganberry, and also performance/convenience)
For now, will retain above fractured logic and adapt to FinchSmarts as needed.
ReportConversationState[nb, cDesc, remark ]:
Type remark and quit if nb#$success, quit quietly if there's no cDesc.
If (buttonsc.clientData)=NIL THEN AddConvDesc[cDesc].
Builds a button and assigns the cDesc to it.
SELECT state
FROM ENDCASE => cDesc.failed←
FALSE.
reserved, parsing =>
cDesc.whoOriginated ← us;
cDesc.conference ← FALSE;
SELECT cDesc.cState.reason FROM busy, error, noCircuits => difficulty←TRUE;
IF ~cDesc.weOriginated
THEN
-- find out who originated and make the best party description possible
If Finch originated, called-party is already set, and is better than we can get otherwise. Otherwise extract up the calling party for incoming calls, or called-party for calls initiated from the telset. weOriginated is assumed FALSE, set TRUE by FinchSmarts when initiating, and in SetContents below.
SetContents[cDesc, finchToolHandle.(
SELECT state
FROM
ENDCASE => don't do it,
initiating, maybe => calledPartyText,
pending, ringing, active => callingPartyText)]
Deal with twiddling of icon.
If not reserved or parsing, or if difficulty, build a "Call to/from x at time t" call status line.
If idle
OR failed
THEN
-- Elaborate.
Add to status line "<whether the call completed><why it ended>, duration = <duration>".
else add to status line a a human-sensible version of the current state.
Add " (<cDesc event's comment>) " and " [<remark>] ", if they're non-nil
Put the status line in the current button, unless cDesc.reportComplete
IF failed OR idle THEN cDesc.reportComplete←TRUE;
SelectEntryInConversations[button, state#idle];
SetContents[viewer, cDesc]:
cDesc.otherPartyDesc can be of the form "xxx.pa (nnnn)", which confuses Phone commands.
Set viewer to RepairIntelnet[cDesc.otherPartyDesc], with any trailing (...) stripped.
cDesc.weOriginated ← TRUE;
RepairIntelnet[num]
RETURNS[number]:
cDesc.otherPartyDesc can contain Intelnet pause characters and authentication code.
Intelnet pause characters are all characters < '\040
Translate pause => "*" remove auth-code.