- TTY *t;
- Log *l;
- t= ptty_open (NULL, NULL);
- //t = serial_open ("/dev/cellmodem", 0);
-l=file_log_new ("log");
+static int
+msg_from_server (ANSI *a,IPC_Msg * m, Context * c)
+{
+ switch (m->hdr.type)
+ {
+
+ case IPC_MSG_TYPE_NOOP:
+ break;
+ case IPC_MSG_TYPE_DEBUG:
+// fprintf (stderr,"%p [%d] %s\n", m, m->hdr.size , m->debug.msg );
+ break;
+ case IPC_MSG_TYPE_HISTORY:
+ history_add (c->h, m->history.history.line);
+ break;
+ case IPC_MSG_TYPE_VT102:
+ if (sizeof (VT102) != m->vt102.len)
+ abort ();
+
+ *(c->v) = m->vt102.vt102;
+
+ if (a->one_shot) {
+ a->one_shot(a,&c->v->crt);
+ return 1;
+ }
+ //FIXME HTML hook
+ break;
+ case IPC_MSG_TYPE_TERM:
+ vt102_parse (c, m->term.term, m->term.len);
+ break;
+ case IPC_MSG_TYPE_STATUS:
+ cmd_new_status (c->d, c, m->status.status);
+ break;
+ default:
+ fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
+ }
+return 0;
+}