demo_adapter.c is a real child process speaking protocol v1 (hello with a nick schema, connect opens lobby, send echoes as 'echo', /code asks for a code, answer reports it, disconnect says bye). demo.c owns the DcLoop, pumps it from a 40 ms Xt timeout, applies state/conversation/message/request/error/bye to the model and the UI, and routes sends through dtchat_ui_set_send_hook. --demo uses an empty model plus the adapter; --adapter overrides the path; --demo --smoke-test checks online, selection, a real send round trip and the echoed text. The transcript now word-wraps: XmText's XmNscrollHorizontal is a secondary resource and must be set in the creation arg list, and the text is fitted to the viewport on ConfigureNotify (the horizontal bar is unmanaged). Standalone plain and demo smoke PASS; /code answered with 4242 shows '-demo- answered: 4242'; screenshot build/mcde-shots/dtchat-t26.png. make mcde-host blocked again: build/.build.lock is held by another agent's distfiles fetch (pid 815951).
31 lines
847 B
C
31 lines
847 B
C
/*
|
|
* demo.h -- the --demo echo adapter wiring
|
|
*
|
|
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
*/
|
|
#ifndef _Dtchat_demo_h
|
|
#define _Dtchat_demo_h
|
|
|
|
#include <X11/Intrinsic.h>
|
|
|
|
#include "dc_internal.h"
|
|
#include "ui_main.h"
|
|
|
|
typedef struct DtDemo DtDemo;
|
|
|
|
/*
|
|
* Start the demo adapter process and pump its loop from an Xt timer. The
|
|
* account "demo" is created in MODEL; conversations and messages arrive
|
|
* through the adapter's events. Returns NULL on failure.
|
|
*/
|
|
DtDemo *dtchat_demo_start(Widget shell, DtChatUi *ui, DcModel *model,
|
|
const char *adapter_path);
|
|
void dtchat_demo_stop(DtDemo *demo);
|
|
|
|
/* 1 once the adapter reported "online". */
|
|
int dtchat_demo_online(const DtDemo *demo);
|
|
/* Number of sends that reached the adapter. */
|
|
int dtchat_demo_sent(const DtDemo *demo);
|
|
|
|
#endif /* _Dtchat_demo_h */
|