static int do_cmd(MENU *mptr,XO *xo,int x,int y) { usint mode; void *p; int (*func) (); if(mptr->umode < 0) { p = DL_get(mptr->func); if(!p) return 0; mptr->func = p; mptr->umode = - (mptr->umode); } switch (mptr->umode) { case POPUP_SO : p = DL_get(mptr->func); if(!p) return 0; mptr->func = p; mptr->umode = POPUP_FUN; func = p; mode = (*func) (); return -1; case POPUP_MENU : // sprintf(t,"【%s】",mptr->desc); vs_restore(sl); return do_menu((MENU *)mptr->func,xo,x,y); case POPUP_XO : func = mptr->func; mode = (*func) (xo); return -1; case POPUP_FUN : func = mptr->func; mode = (*func) (); return -1; } return -1; }
static void talk_request() { #ifdef LINUX /* * Linux 下連續 page 對方兩次就可以把對方踢出去: 這是由於某些系統一 * nal 進來就會將 signal handler 設定為內定的 handler, 不幸的是 * default 是將程 erminate. 解決方法是每次 signal 進來就重設 signal * handler */ signal(SIGUSR1, talk_request); #endif bell(); if (currutmp->msgcount) { char buf [200]; time_t now = time(0); sprintf(buf, "[1m[33;41m[%s][34;47m [%s] %s [0m", (currutmp->destuip)->userid, my_ctime(&now), (currutmp->sig == 2) ? "重要消息廣播!(請Ctrl-U,l查看熱訊記錄)" : "呼叫、呼叫,聽到請回答"); move(0, 0); clrtoeol(); outs(buf); refresh(); } else { uschar mode0 = currutmp->mode; char c0 = currutmp->chatid[0]; screenline *screen = (screenline *) calloc(t_lines, sizeof(screenline)); currutmp->mode = 0; currutmp->chatid[0] = 1; vs_save(screen); talkreply(); vs_restore(screen); currutmp->mode = mode0; currutmp->chatid[0] = c0; } }
int igetch() { register int ch; while(ch = dogetch()) { switch (ch) { case Ctrl('L'): redoscr(); continue; case Ctrl('I'): if(currutmp != NULL && currutmp->mode == MMENU) { screenline* screen = (screenline *)calloc(t_lines, sizeof(screenline)); vs_save(screen); t_idle(); vs_restore(screen); continue; } else return(ch); case Ctrl('Q'): /* wildcat : 快速離站 :p */ if(currutmp->mode && currutmp->mode != READING) { if(answer("\033[0;30;47m 確定要離站?? (y/N) \033[m") != 'y') return(ch); update_data(); u_exit("ABORT"); pressanykey("謝謝光臨, 記得常來喔 !"); exit(0); } else return (ch); case Ctrl('U'): resetutmpent(); if(currutmp != NULL && currutmp->mode != EDITING && currutmp->mode != LUSERS && currutmp->mode) { int mode0 = currutmp->mode; int stat0 = currstat; screenline* screen = (screenline *)calloc(t_lines, sizeof(screenline)); vs_save(screen); t_users(); vs_restore(screen); currutmp->mode = mode0; currstat = stat0; continue; } else return (ch); case Ctrl('R'): { if(currutmp == NULL) return (ch); else if(watermode > 0) { watermode = (watermode + oldmsg_count)% oldmsg_count + 1; t_display_new(0); continue; } else if (!currutmp->mode && (currutmp->chatid[0] == 2 || currutmp->chatid[0] == 3) && oldmsg_count && !watermode) { watermode=1; t_display_new(1); continue; } else if (currutmp->msgs[0].last_pid && currutmp->mode) { screenline* screen = (screenline *)calloc(t_lines, sizeof(screenline)); vs_save(screen); watermode=1; t_display_new(1); my_write(currutmp->msgs[0].last_pid, "水球丟回去:"); vs_restore(screen); continue; } else return (ch); } case '\n': /* Ptt把 \n拿掉 */ continue; case Ctrl('T'): if(watermode > 0 ) { watermode = (watermode + oldmsg_count - 2 )% oldmsg_count + 1; t_display_new(0); continue; } default: return (ch); } } }