palm-client: a contact's More lists what suits its type (Admin Console, Trace / Route, Ping, Reset Path, Block, Beam, Remove); main.c wires the new screens, menus, the beam launch codes and the inbox; Makefile builds the new modules
This commit is contained in:
1 parent
e47a54d189
commit
6e6adf780b
3 files changed
+95
-13
No files matched your search
@@ -11,7 +11,7 @@ APP = visormesh
|
||||
NAME = VisorMesh
|
||||
CREATOR = VMsh
|
||||
|
||||
SRCS = src/main.c src/app.c src/home_form.c src/convo_form.c src/node_form.c src/channel_form.c src/convos.c src/protocol.c src/sha256.c src/transport_srm.c src/transport_sb.c src/sb_spi.c src/session.c src/settings.c src/presets.c src/contacts.c src/contacts_form.c src/contact_form.c src/heard.c src/remote_fmt.c src/remote.c src/remote_form.c src/messages.c src/channels.c src/preview_form.c src/ui/draw.c src/ui/text.c src/ui/rowlist.c src/ui/title.c src/ui/fontmetrics.c src/ports.c src/sounds.c src/mutes.c src/scopes.c src/scope_proto.c src/map_geo.c src/map_form.c src/ui/emoji.c src/bgcheck.c src/pins.c src/shots.c src/db.c src/reaction_fmt.c src/reactions.c src/rxpath.c src/msg_menu.c src/protocol2.c src/info_fmt.c src/stats_form.c src/packets_form.c
|
||||
SRCS = src/main.c src/app.c src/home_form.c src/convo_form.c src/node_form.c src/channel_form.c src/convos.c src/protocol.c src/sha256.c src/transport_srm.c src/transport_sb.c src/sb_spi.c src/session.c src/settings.c src/presets.c src/contacts.c src/contacts_form.c src/contact_form.c src/heard.c src/remote_fmt.c src/remote.c src/remote_form.c src/messages.c src/channels.c src/preview_form.c src/ui/draw.c src/ui/text.c src/ui/rowlist.c src/ui/title.c src/ui/fontmetrics.c src/ports.c src/sounds.c src/mutes.c src/scopes.c src/scope_proto.c src/map_geo.c src/map_form.c src/ui/emoji.c src/bgcheck.c src/pins.c src/shots.c src/db.c src/reaction_fmt.c src/reactions.c src/rxpath.c src/msg_menu.c src/protocol2.c src/info_fmt.c src/stats_form.c src/packets_form.c src/trace_form.c src/blocks.c src/beam.c src/beam_rx.c src/stale.c src/convo_extra.c src/neigh.c
|
||||
OBJS = $(SRCS:src/%.c=build/%.o)
|
||||
|
||||
CC = m68k-palmos-gcc
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
* heard the node directly (its own zero-hop adverts, or relaying packets for a
|
||||
* repeater) with SNR and RSSI. Message opens the DM; for a room it logs in
|
||||
* first if needed. Login asks for the password and opens a room's posts or
|
||||
* a repeater's admin console; More has Admin Console, Reset Path and Remove.
|
||||
* a repeater's admin console. More has what suits the type: Admin Console,
|
||||
* Trace / Route, Ping, Reset Path, Block, Beam and Remove.
|
||||
*/
|
||||
#include <PalmOS.h>
|
||||
#include "resources.h"
|
||||
@@ -21,6 +22,9 @@
|
||||
#include "ui/rowlist.h"
|
||||
#include "contact_form.h"
|
||||
#include "remote.h"
|
||||
#include "trace_form.h"
|
||||
#include "blocks.h"
|
||||
#include "beam.h"
|
||||
|
||||
/* In an extra code segment (VM_SECT3): see sections.h for the rules. */
|
||||
static void *GetObject(FormType *form, UInt16 id) VM_SECT3;
|
||||
@@ -260,27 +264,76 @@ Boolean ContactRemove(const VmContact *c)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* More's actions: the ones that suit this contact's type. */
|
||||
#define MORE_CONSOLE 0
|
||||
#define MORE_TRACE 1
|
||||
#define MORE_PING 2
|
||||
#define MORE_RESET 3
|
||||
#define MORE_BLOCK 4
|
||||
#define MORE_BEAM 5
|
||||
#define MORE_REMOVE 6
|
||||
|
||||
static void More(FormType *form)
|
||||
{
|
||||
ListType *list = GetObject(form, ContactMoreList);
|
||||
Int16 pick = LstPopupList(list);
|
||||
Char *items[8];
|
||||
UInt8 acts[8];
|
||||
UInt16 n = 0;
|
||||
UInt8 t = gContact.type;
|
||||
Int16 pick;
|
||||
|
||||
if (pick == 0) { /* Admin Console */
|
||||
if (!Connected())
|
||||
return;
|
||||
if (gContact.type != VM_ADV_TYPE_ROOM && gContact.type != VM_ADV_TYPE_REPEATER) {
|
||||
Error("Only repeaters and rooms have an admin console.");
|
||||
return;
|
||||
}
|
||||
if (SessionIsLoggedIn(gContact.pubKey) || Login(form))
|
||||
if (t == VM_ADV_TYPE_ROOM || t == VM_ADV_TYPE_REPEATER) {
|
||||
items[n] = "Admin Console";
|
||||
acts[n++] = MORE_CONSOLE;
|
||||
}
|
||||
items[n] = "Trace / Route";
|
||||
acts[n++] = MORE_TRACE;
|
||||
if (t == VM_ADV_TYPE_REPEATER) {
|
||||
items[n] = "Ping";
|
||||
acts[n++] = MORE_PING;
|
||||
}
|
||||
items[n] = "Reset Path";
|
||||
acts[n++] = MORE_RESET;
|
||||
if (t == VM_ADV_TYPE_CHAT) {
|
||||
items[n] = BlocksIsContact(&gContact) ? "Unblock" : "Block";
|
||||
acts[n++] = MORE_BLOCK;
|
||||
}
|
||||
items[n] = "Beam";
|
||||
acts[n++] = MORE_BEAM;
|
||||
items[n] = "Remove";
|
||||
acts[n++] = MORE_REMOVE;
|
||||
LstSetListChoices(list, items, n);
|
||||
LstSetHeight(list, n);
|
||||
pick = LstPopupList(list);
|
||||
LstSetListChoices(list, NULL, 0);
|
||||
if (pick < 0)
|
||||
return;
|
||||
switch (acts[pick]) {
|
||||
case MORE_CONSOLE:
|
||||
if (Connected() && (SessionIsLoggedIn(gContact.pubKey) || Login(form)))
|
||||
RemoteOpen(&gContact);
|
||||
} else if (pick == 1) { /* Reset Path */
|
||||
break;
|
||||
case MORE_TRACE:
|
||||
TraceFormOpen(&gContact);
|
||||
break;
|
||||
case MORE_PING:
|
||||
TracePing(&gContact);
|
||||
break;
|
||||
case MORE_RESET:
|
||||
ContactResetPath(&gContact);
|
||||
ReloadContact();
|
||||
RowListDraw(&gList);
|
||||
} else if (pick == 2) { /* Remove */
|
||||
break;
|
||||
case MORE_BLOCK:
|
||||
BlocksToggleContact(&gContact);
|
||||
break;
|
||||
case MORE_BEAM:
|
||||
BeamContact(&gContact);
|
||||
break;
|
||||
case MORE_REMOVE:
|
||||
if (ContactRemove(&gContact))
|
||||
FrmGotoForm(ContactsForm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "shots.h"
|
||||
#include "stats_form.h"
|
||||
#include "packets_form.h"
|
||||
#include "trace_form.h"
|
||||
#include "beam.h"
|
||||
#include "blocks.h"
|
||||
#include "stale.h"
|
||||
#include "ui/draw.h"
|
||||
#include "ui/title.h"
|
||||
|
||||
@@ -58,6 +62,19 @@ static Boolean HandleMenu(UInt16 itemID)
|
||||
case MainMenuMap: FrmGotoForm(MapForm); return true;
|
||||
case MainMenuStats: FrmGotoForm(StatsForm); return true;
|
||||
case MainMenuPackets: FrmGotoForm(PacketsForm); return true;
|
||||
case MainMenuTrace: TraceFormOpen(NULL); return true;
|
||||
case MainMenuBeamSelf: BeamSelf(); return true;
|
||||
case MainMenuBlocked: BlocksManage(ContactsBlockedList); return true;
|
||||
case MainMenuStale:
|
||||
if (StaleRemove())
|
||||
FrmUpdateForm(FrmGetActiveFormID(), VM_UPDATE_DATA);
|
||||
return true;
|
||||
case MainMenuBeamChannel:
|
||||
if (FrmGetActiveFormID() == ConvoForm && gAppConv.type == VM_CONV_CHANNEL)
|
||||
BeamChannel(gAppConv.channel);
|
||||
else
|
||||
FrmCustomAlert(SettingsErrorAlert, "Open the channel you want to beam first.", "", "");
|
||||
return true;
|
||||
case MainMenuPorts: FrmGotoForm(PortsForm); return true;
|
||||
case MainMenuFontPreview: FrmGotoForm(FontPreviewForm); return true;
|
||||
case MainMenuSounds: SoundsFormOpen(FrmGetActiveFormID()); return true;
|
||||
@@ -107,6 +124,7 @@ static Boolean AppHandleEvent(EventType *event)
|
||||
case MapForm: FrmSetEventHandler(form, MapFormHandleEvent); break;
|
||||
case StatsForm: FrmSetEventHandler(form, StatsFormHandleEvent); break;
|
||||
case PacketsForm: FrmSetEventHandler(form, PacketsFormHandleEvent); break;
|
||||
case TraceForm: FrmSetEventHandler(form, TraceFormHandleEvent); break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -198,6 +216,8 @@ static Int32 EventTimeout(void)
|
||||
{
|
||||
Int32 left;
|
||||
|
||||
if (BeamInboxWaiting())
|
||||
return 1; /* a beam came: ask about it on the next nilEvent */
|
||||
if (SessionConnecting())
|
||||
return VM_STEP_TICKS;
|
||||
if (SessionIsConnected())
|
||||
@@ -264,6 +284,8 @@ static void AppEventLoop(void)
|
||||
EvtGetEvent(&event, EventTimeout());
|
||||
CheckWake();
|
||||
if (event.eType == nilEvent) {
|
||||
if (BeamInboxWaiting())
|
||||
BeamCheckInbox();
|
||||
StepReconnect();
|
||||
Poll();
|
||||
continue;
|
||||
@@ -298,13 +320,20 @@ UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
|
||||
return errNone;
|
||||
case sysAppLaunchCmdSystemReset:
|
||||
case sysAppLaunchCmdSyncNotify: /* installed, which drops the alarm */
|
||||
ExgRegisterData(VM_CREATOR, exgRegExtensionID, VM_BEAM_EXT); /* beams named *.vmsh come here */
|
||||
BgSchedule();
|
||||
return errNone;
|
||||
case sysAppLaunchCmdTimeChange:
|
||||
BgSchedule();
|
||||
return errNone;
|
||||
case sysAppLaunchCmdExgReceiveData:
|
||||
/* maybe without globals: beam_rx.c only saves it for later */
|
||||
return BeamReceive((ExgSocketPtr)cmdPBP);
|
||||
}
|
||||
if (cmd == sysAppLaunchCmdNormalLaunch) {
|
||||
BgSetAppOpen(true);
|
||||
AppLoadPrefs();
|
||||
BeamInboxNote();
|
||||
UiFontInit(SoundsLargeText());
|
||||
HeardLoad();
|
||||
FrmGotoForm(HomeForm);
|
||||
|
||||
Reference in new issue
Block a user