audio_setup(&(ivac.audio));
/* display */
- ivac_display(&(ivac.display));
+#ifdef XXX_GUI
+ /* "constant" graphics */
+ ivac_display_head(&ivac);
+ ivac_display_box(&ivac);
+ ivac_display_console(&ivac);
+#endif
+ ivac_display(&ivac);
/* start event system - callbacks used: ivac_event_cb + ivac_regular_cb */
event_start(&(ivac.event),(void *)&ivac,ivac_event_cb,ivac_regular_cb);
event_math(ivac->net.connection[channel].fd,event,READ,ADD);
ivac_send_info(channel,ivac);
}
- ivac_display_content(ivac);
+ ivac_display(ivac);
}
/* wait for user info */
sprintf(c_str,"channel %02d: broken pipe - disconnected",channel);
ivac_add_to_monitor(ivac,c_str);
}
- ivac_display_content(ivac);
+ ivac_display(ivac);
}
}
}
data=input->content;
valid=0;
- /* refresh prompt content only! */
+ /* refresh prompt content only */
ivac_display_prompt_content(ivac);
/* parse command routines */
ivac_add_to_monitor(ivac,c_str);
/* refresh whole display content */
- ivac_display_content(ivac);
+ ivac_display(ivac);
/* delete content buffer + reset counter */
memset(input->content,0,input->c_count-1);
return SUCCESS;
}
-int ivac_display_head(t_display *display) {
+int ivac_display_head(t_ivac *ivac) {
- puts("#########################################################");
+#ifndef XXX_GUI
+ display_term_line(&(ivac->display),'#');
puts("##### ivac - - Copyright (C) 2004 Frank Zirkelbach #####");
puts("#########################################################");
+#endif
return SUCCESS;
}
-int ivac_display_box(t_display *display) {
+int ivac_display_box(t_ivac *ivac) {
+
+#ifndef XXX_GUI
+ puts("---------------------------------------------------------------------");
+ printf("username: %s, capabilities: %02x|%04x\n",ivac->username,ivac->g_cap,
+ ivac->av_cap);
+ puts("---------------------------------------------------------------------");
+ puts("connections:");
+#endif
return SUCCESS;
}
if(ivac->challenger[channel].name[0]==0)
strcpy(ivac->challenger[channel].name,"<empty>");
+#ifndef XXX_GUI
+ for(channel=0;channel<MAX_CONNECTIONS;channel++) {
+ if(ivac->net.connection[channel].status&C_INFO_A)
+ printf("channel %02d: %s:%d, status: %02x, name: %s\n",channel,
+ ivac->net.connection[channel].ip,
+ ivac->net.connection[channel].port,
+ ivac->net.connection[channel].status,
+ ivac->challenger[channel].name);
+ }
+#endif
+
return SUCCESS;
}
-int ivac_display_console(t_display *display) {
+int ivac_display_console(t_ivac *ivac) {
+
+#ifndef XXX_GUI
+ puts("---------------------------------------------------------------------");
+ puts("console messages:");
+#endif
return SUCCESS;
}
int i;
+#ifndef XXX_GUI
for(i=0;i<IVAC_CONSOLE_LEN;i++)
- printf("[ivac] console line %d: %s\n",i,ivac->console[i]);
+ printf("| %s\n",ivac->console[i]);
+#endif
return SUCCESS;
}
-int ivac_display_prompt(t_display *display) {
+int ivac_display_prompt(t_ivac *ivac) {
+
+#ifndef XXX_GUI
+ puts("---------------------------------------------------------------------");
+ printf("prompt: ");
+#endif
return SUCCESS;
}
int ivac_display_prompt_content(t_ivac *ivac) {
+#ifndef XXX_GUI
printf("%c",ivac->input.content[ivac->input.c_count-1]);
fflush(NULL);
+#endif
return SUCCESS;
}
-int ivac_display(t_display *display) {
+int ivac_display(t_ivac *ivac) {
int x,y;
+#ifndef XXX_GUI
/* display head */
- ivac_display_head(display);
+ ivac_display_head(ivac);
/* display box */
- ivac_display_box(display);
-
- /* display console */
- ivac_display_console(display);
-
- /* display command prompt */
- ivac_display_prompt(display);
-
- return SUCCESS;
-}
-
-int ivac_display_content(t_ivac *ivac) {
-
- /* display box content */
+ ivac_display_box(ivac);
+#endif
ivac_display_box_content(ivac);
- /* display console content */
+#ifndef XXX_GUI
+ /* display console */
+ ivac_display_console(ivac);
+#endif
ivac_display_console_content(ivac);
- /* display prompt content */
- ivac_display_prompt_content(ivac);
+#ifndef XXX_GUI
+ /* display command prompt */
+ ivac_display_prompt(ivac);
+#endif
+ fflush(NULL);
return SUCCESS;
}
int ivac_event_cb(t_event *event,void *ptr);
int ivac_regular_cb(t_event *event,void *ptr);
int ivac_parse_command(t_input *input,void *ptr);
-int ivac_display_head(t_display *display);
-int ivac_display_box(t_display *display);
+int ivac_display_head(t_ivac *ivac);
+int ivac_display_box(t_ivac *ivac);
int ivac_display_box_content(t_ivac *ivac);
-int ivac_display_console(t_display *display);
+int ivac_display_console(t_ivac *ivac);
int ivac_display_console_content(t_ivac *ivac);
-int ivac_display_prompt(t_display *display);
+int ivac_display_prompt(t_ivac *ivac);
int ivac_display_prompt_content(t_ivac *ivac);
-int ivac_display(t_display *display);
-int ivac_display_content(t_ivac *ivac);
+int ivac_display(t_ivac *ivac);
int ivac_add_to_monitor(t_ivac *ivac,char *msg);
#endif