ekg2
|
00001 /* $Id$ */ 00002 00003 /* 00004 * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl> 00005 * 2004 Piotr Kupisiewicz <deli@rzepaknet.us> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License Version 2 as 00009 * published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __EKG_WINDOWS_H 00022 #define __EKG_WINDOWS_H 00023 00024 #include "ekg2-config.h" 00025 00026 #include "commands.h" 00027 #include "dynstuff.h" 00028 #include "sessions.h" 00029 #include "themes.h" 00030 00031 #ifdef HAVE_REGEX_H 00032 #include <sys/types.h> 00033 #include <regex.h> 00034 #endif 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 typedef struct { 00041 void *w; /* window, if NULL it means current */ 00042 int casense : 2; /* 0 - ignore case; 1 - don't ignore case, -1 - use global variable */ 00043 unsigned int lock : 1; /* if 0, don't update */ 00044 unsigned int isregex : 1; /* 1 - in target regexp */ 00045 #ifdef HAVE_REGEX_H 00046 regex_t reg; /* regexp compilated expression */ 00047 #endif 00048 char *expression; /* expression */ 00049 } window_lastlog_t; 00050 00051 typedef enum { 00052 EKG_WINACT_NONE = 0, /* No activity in window */ 00053 EKG_WINACT_JUNK, /* Junks: status change, irc join/part, etc. */ 00054 EKG_WINACT_MSG, /* Message, but not to us */ 00055 EKG_WINACT_IMPORTANT /* important message */ 00056 } winact_t; 00057 00058 typedef struct window { 00059 struct window *next; 00060 00061 unsigned short id; /* numer okna */ 00062 char *target; /* nick query albo inna nazwa albo NULL */ 00063 char *alias; /* name for display */ 00064 session_t *session; /* której sesji dotyczy okno */ 00065 00066 unsigned short left, top; /* pozycja (x, y) względem początku ekranu */ 00067 unsigned short width, height; /* wymiary okna */ 00068 00069 unsigned int act : EKG_WINACT_MSG; /* activity: 1 - status/junk; 2 - msg ; 3 - msg to us */ 00070 unsigned int in_typing : 1; /* user is composing a message to us */ 00071 unsigned int in_active : 1; /* user has sent some kind of message, 00072 so we can start sending composing to him/her */ 00073 unsigned int out_active : 1; /* we 'started' sending messages to user (considered 00074 ourselves active), so we shall say goodbye when done */ 00075 unsigned int more : 1; /* pojawiło się coś poza ekranem */ 00076 unsigned int floating : 1; /* czy pływające? */ 00077 unsigned int doodle : 1; /* czy do gryzmolenia? [we don't set it anywhere] */ 00078 00079 unsigned int frames : 4; /* informacje o ramkach */ 00080 unsigned int edge : 4; /* okienko brzegowe */ 00081 00082 unsigned int nowrap : 1; /* nie zawijamy linii */ 00083 unsigned int hide : 1; /* ukrywamy, bo jest zbyt duże */ 00084 00085 time_t last_update; /* czas ostatniego uaktualnienia */ 00086 unsigned short lock; /* blokowanie zmian w obrębie komendy */ 00087 00088 struct userlist *userlist; /* sometimes window may require separate userlist */ 00089 00090 window_lastlog_t *lastlog; /* prywatne informacje lastloga */ 00091 void *priv_data; /* prywatne informacje ui */ 00092 } window_t; 00093 00094 #ifndef EKG2_WIN32_NOFUNCTION 00095 00096 extern window_t *windows; 00097 extern window_t *window_debug; 00098 extern window_t *window_status; 00099 extern window_t *window_current; 00100 00101 extern window_lastlog_t *lastlog_current; 00102 00103 window_t *window_find(const char *target); 00104 window_t *window_find_sa(session_t *session, const char *target, int session_null_means_no_session); 00105 00106 #define window_find_s(s, target) window_find_sa(s, target, 1) /* XXX, need checking */ 00107 window_t *window_find_ptr(window_t *w); 00108 window_t *window_new(const char *target, session_t *session, int new_id); 00109 void window_kill(window_t *w); 00110 void window_switch(int id); 00111 window_t *window_exist(int id); 00112 void window_print(window_t *w, fstring_t *line); 00113 void print_window_w(window_t *w, int activity, const char *theme, ...); /* themes.c */ 00114 char *window_target(window_t *window); 00115 00116 void window_session_set(window_t *w, session_t *newsession); 00117 int window_session_cycle(window_t *w); 00118 00119 int window_lock_inc(window_t *w); 00120 int window_lock_dec(window_t *w); 00121 00122 void windows_destroy(void); 00123 #endif 00124 00125 COMMAND(cmd_window); 00126 00127 #ifdef __cplusplus 00128 } 00129 #endif 00130 00131 #endif /* __EKG_WINDOW_H */ 00132 00133 /* 00134 * Local Variables: 00135 * mode: c 00136 * c-file-style: "k&r" 00137 * c-basic-offset: 8 00138 * indent-tabs-mode: t 00139 * End: 00140 */