ekg2
|
00001 /* $Id: windows.h 4412 2008-08-17 12:28:15Z peres $ */ 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 <time.h> 00027 00028 #ifdef HAVE_REGEX_H 00029 #include <sys/types.h> 00030 #include <regex.h> 00031 #endif 00032 00033 #include "sessions.h" 00034 #include "themes.h" 00035 00036 typedef struct { 00037 void *w; /* window, if NULL it means current */ 00038 int casense : 2; /* 0 - ignore case; 1 - don't ignore case, -1 - use global variable */ 00039 unsigned int lock : 1; /* if 0, don't update */ 00040 unsigned int isregex : 1; /* 1 - in target regexp */ 00041 #ifdef HAVE_REGEX_H 00042 regex_t reg; /* regexp compilated expression */ 00043 #endif 00044 char *expression; /* expression */ 00045 } window_lastlog_t; 00046 00047 typedef struct window { 00048 struct window *next; 00049 00050 unsigned short id; /* ekg2-remote: OK */ 00051 char *target; /* ekg2-remote: OK */ 00052 char *alias; /* ekg2-remote: OK */ 00053 session_t *session; /* ekg2-remote: OK */ 00054 00055 unsigned short left, top; /* pozycja (x, y) względem początku ekranu */ 00056 unsigned short width, height; /* wymiary okna */ 00057 00058 unsigned int act : 2; /* activity: 1 - status/junk; 2 - msg ; 3 - msg to us */ 00059 unsigned int in_typing : 1; /* user is composing a message to us */ 00060 unsigned int in_active : 1; /* user has sent some kind of message, 00061 so we can start sending composing to him/her */ 00062 unsigned int out_active : 1; /* we 'started' sending messages to user (considered 00063 ourselves active), so we shall say goodbye when done */ 00064 unsigned int more : 1; /* pojawiło się coś poza ekranem */ 00065 unsigned int floating : 1; /* czy pływające? */ 00066 unsigned int doodle : 1; /* czy do gryzmolenia? [we don't set it anywhere] */ 00067 00068 unsigned int frames : 4; /* informacje o ramkach */ 00069 unsigned int edge : 4; /* okienko brzegowe */ 00070 00071 unsigned int nowrap : 1; /* nie zawijamy linii */ 00072 unsigned int hide : 1; /* ukrywamy, bo jest zbyt duże */ 00073 00074 time_t last_update; /* czas ostatniego uaktualnienia */ 00075 unsigned short lock; /* ekg2-remote, always: 0, shoulnd't hurt (only CPU a little) */ /* sometimes... */ 00076 00077 struct userlist *userlist; /* sometimes window may require separate userlist */ 00078 00079 window_lastlog_t *lastlog; /* prywatne informacje lastloga */ 00080 void *private; /* prywatne informacje ui */ 00081 00082 /* ekg2-remote ABI */ 00083 char *irctopic; 00084 char *irctopicby; 00085 char *ircmode; 00086 } window_t; 00087 00088 typedef enum { 00089 EKG_WINACT_NONE = 0, /* No activity in window */ 00090 EKG_WINACT_JUNK, /* Junks: status change, irc join/part, etc. */ 00091 EKG_WINACT_MSG, /* Message, but not to us */ 00092 EKG_WINACT_IMPORTANT /* important message */ 00093 } winact_t; 00094 00095 extern window_t *windows; 00096 extern window_t *window_debug; 00097 extern window_t *window_status; 00098 extern window_t *window_current; 00099 00100 extern window_lastlog_t *lastlog_current; 00101 00102 window_t *window_find(const char *target); 00103 window_t *window_find_sa(session_t *session, const char *target, int session_null_means_no_session); 00104 00105 #define window_find_s(s, target) window_find_sa(s, target, 1) /* XXX, need checking */ 00106 window_t *window_find_ptr(window_t *w); 00107 window_t *window_new(const char *target, session_t *session, int new_id); 00108 window_t *remote_window_new(int id, const char *target); 00109 void window_kill(window_t *w); 00110 void remote_window_kill(int id); 00111 void window_switch(int id); 00112 void remote_window_switch(int id); 00113 window_t *window_exist(int id); 00114 void print_window_w(window_t *w, int activity, const char *theme, ...); /* themes.c */ 00115 void remote_print_window(int id, time_t ts, char *data); 00116 char *window_target(window_t *window); 00117 00118 void window_session_set(window_t *w, session_t *new_session); 00119 int window_session_cycle(window_t *w); 00120 00121 void windows_destroy(void); 00122 00123 void windows_lock_all(); 00124 void windows_unlock_all(); 00125 00126 #endif /* __EKG_WINDOW_H */ 00127 00128 /* 00129 * Local Variables: 00130 * mode: c 00131 * c-file-style: "k&r" 00132 * c-basic-offset: 8 00133 * indent-tabs-mode: t 00134 * End: 00135 */