/** * Initialize curses * It will create two windows, a chat window and an input window */ int init_interface(){ signal(SIGINT, signal_handler); //signal(SIGQUIT, quitproc); initscr(); /* Start curses mode */ raw(); nodelay(stdscr,TRUE); keypad(stdscr, TRUE); /* We get F1, F2 etc.. */ noecho(); refresh(); windows[CHAT_WIN] = create_newwin(LINES-4, COLS, 1, 0); init_chat_window(100); windows[INPUT_WIN] = create_newwin(4, COLS, LINES-4, 0); print_prompt(windows[INPUT_WIN]); printw("Press F4 to exit"); printw("\tYou are: "); printw(CONFIG->self.name); refresh(); /* Print it on to the real screen */ }
HybridChatWindow* hybrid_chat_window_create(HybridAccount *account, const gchar *id, HybridChatWindowType type) { HybridChatWindow *chat = NULL; HybridConversation *conv = NULL; HybridBuddy *buddy; HybridModule *proto; HybridIMOps *ops; g_return_val_if_fail(account != NULL, NULL); g_return_val_if_fail(id != NULL, NULL); if (type == HYBRID_CHAT_PANEL_SYSTEM) { if (!(buddy = (hybrid_blist_find_buddy(account, id)))) { hybrid_debug_error("conv", "FATAL, can't find buddy"); return NULL; } proto = account->proto; ops = proto->info->im_ops; /* we will check whether the protocol allows this buddy to be activated. */ if (ops->chat_start) { if (!ops->chat_start(account, buddy)) { return NULL; } } } if ((chat = hybrid_conv_find_chat(id))) { conv = chat->parent; goto found; } /* * Whether to show the chat dialog in a single window. */ if (hybrid_pref_get_boolean(NULL, "single_chat_window")) { if (!conv_list) { conv = hybrid_conv_create(); conv_list = g_slist_append(conv_list, conv); } else { conv = conv_list->data; } } else { conv = hybrid_conv_create(); conv_list = g_slist_append(conv_list, conv); } chat = g_new0(HybridChatWindow, 1); chat->id = g_strdup(id); chat->parent = conv; chat->account = account; chat->type = type; chat->logs = hybrid_logs_create(account, id); if (type == HYBRID_CHAT_PANEL_SYSTEM) { chat->data = buddy; } conv->chat_buddies = g_slist_append(conv->chat_buddies, chat); init_chat_window(chat); return chat; found: gtk_notebook_set_current_page(GTK_NOTEBOOK(conv->notebook), gtk_notebook_page_num(GTK_NOTEBOOK(conv->notebook), chat->vbox)); /* focus the send textview */ gtk_widget_grab_focus(chat->sendtext); gtk_window_present(GTK_WINDOW(chat->parent->window)); return chat; }