ekg2  GIT master
windows.h
Idź do dokumentacji tego pliku.
1 /* $Id: windows.h 4412 2008-08-17 12:28:15Z peres $ */
2 
3 /*
4  * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  * 2004 Piotr Kupisiewicz <deli@rzepaknet.us>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License Version 2 as
9  * published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 #ifndef __EKG_WINDOWS_H
22 #define __EKG_WINDOWS_H
23 
24 #include "ekg2-config.h"
25 
26 #include <time.h>
27 
28 #ifdef HAVE_REGEX_H
29 #include <sys/types.h>
30 #include <regex.h>
31 #endif
32 
33 #include "sessions.h"
34 #include "themes.h"
35 
36 typedef struct {
37  void *w; /* window, if NULL it means current */
38  int casense : 2; /* 0 - ignore case; 1 - don't ignore case, -1 - use global variable */
39  unsigned int lock : 1; /* if 0, don't update */
40  unsigned int isregex : 1; /* 1 - in target regexp */
41 #ifdef HAVE_REGEX_H
42  regex_t reg; /* regexp compilated expression */
43 #endif
44  char *expression; /* expression */
46 
47 typedef struct window {
48  struct window *next;
49 
50  unsigned short id; /* ekg2-remote: OK */
51  char *target; /* ekg2-remote: OK */
52  char *alias; /* ekg2-remote: OK */
53  session_t *session; /* ekg2-remote: OK */
54 
55  unsigned short left, top; /* pozycja (x, y) względem początku ekranu */
56  unsigned short width, height; /* wymiary okna */
57 
58  unsigned int act : 2; /* activity: 1 - status/junk; 2 - msg ; 3 - msg to us */
59  unsigned int in_typing : 1; /* user is composing a message to us */
60  unsigned int in_active : 1; /* user has sent some kind of message,
61  so we can start sending composing to him/her */
62  unsigned int out_active : 1; /* we 'started' sending messages to user (considered
63  ourselves active), so we shall say goodbye when done */
64  unsigned int more : 1; /* pojawiło się coś poza ekranem */
65  unsigned int floating : 1; /* czy pływające? */
66  unsigned int doodle : 1; /* czy do gryzmolenia? [we don't set it anywhere] */
67 
68  unsigned int frames : 4; /* informacje o ramkach */
69  unsigned int edge : 4; /* okienko brzegowe */
70 
71  unsigned int nowrap : 1; /* nie zawijamy linii */
72  unsigned int hide : 1; /* ukrywamy, bo jest zbyt duże */
73 
74  time_t last_update; /* czas ostatniego uaktualnienia */
75  unsigned short lock; /* ekg2-remote, always: 0, shoulnd't hurt (only CPU a little) */ /* sometimes... */
76 
77  struct userlist *userlist; /* sometimes window may require separate userlist */
78 
79  window_lastlog_t *lastlog; /* prywatne informacje lastloga */
80  void *private; /* prywatne informacje ui */
81 
82 /* ekg2-remote ABI */
83  char *irctopic;
84  char *irctopicby;
85  char *ircmode;
86 } window_t;
87 
88 typedef enum {
89  EKG_WINACT_NONE = 0, /* No activity in window */
90  EKG_WINACT_JUNK, /* Junks: status change, irc join/part, etc. */
91  EKG_WINACT_MSG, /* Message, but not to us */
92  EKG_WINACT_IMPORTANT /* important message */
93 } winact_t;
94 
95 extern window_t *windows;
96 extern window_t *window_debug;
97 extern window_t *window_status;
98 extern window_t *window_current;
99 
101 
102 window_t *window_find(const char *target);
103 window_t *window_find_sa(session_t *session, const char *target, int session_null_means_no_session);
104 
105 #define window_find_s(s, target) window_find_sa(s, target, 1) /* XXX, need checking */
107 window_t *window_new(const char *target, session_t *session, int new_id);
108 window_t *remote_window_new(int id, const char *target);
109 void window_kill(window_t *w);
110 void remote_window_kill(int id);
111 void window_switch(int id);
112 void remote_window_switch(int id);
113 window_t *window_exist(int id);
114 void print_window_w(window_t *w, int activity, const char *theme, ...); /* themes.c */
115 void remote_print_window(int id, time_t ts, char *data);
117 
118 void window_session_set(window_t *w, session_t *new_session);
120 
121 void windows_destroy(void);
122 
123 void windows_lock_all();
124 void windows_unlock_all();
125 
126 #endif /* __EKG_WINDOW_H */
127 
128 /*
129  * Local Variables:
130  * mode: c
131  * c-file-style: "k&r"
132  * c-basic-offset: 8
133  * indent-tabs-mode: t
134  * End:
135  */
unsigned int doodle
Definition: windows.h:82
unsigned int act
Definition: windows.h:78
window_t * remote_window_new(int id, const char *target)
void windows_lock_all()
window_t * window_find(const char *target)
Definition: windows.c:164
void remote_window_switch(int id)
Definition: sessions.h:127
unsigned short top
Definition: windows.h:75
Definition: windows.h:64
Definition: windows.h:62
window_t * window_new(const char *target, session_t *session, int new_id)
Definition: windows.c:243
int window_session_cycle(window_t *w)
Definition: windows.c:808
unsigned int in_active
Definition: windows.h:60
unsigned int nowrap
Definition: windows.h:87
unsigned int floating
Definition: windows.h:81
time_t last_update
Definition: windows.h:91
void window_switch(int id)
Definition: windows.c:175
char * target
Definition: windows.h:71
winact_t
Definition: windows.h:60
unsigned int frames
Definition: windows.h:84
Definition: windows.h:61
window_t * window_find_ptr(window_t *w)
Definition: windows.c:66
char * ircmode
Definition: windows.h:85
Definition: windows.h:63
unsigned int in_typing
Definition: windows.h:79
char * irctopicby
Definition: windows.h:84
void window_session_set(window_t *w, session_t *newsession)
Definition: windows.c:756
window_t * window_current
Definition: windows.c:45
unsigned short width
Definition: windows.h:76
void windows_destroy(void)
Definition: windows.c:41
window_lastlog_t * lastlog_current
Definition: lastlog.c:31
void remote_print_window(int id, time_t ts, char *data)
unsigned short lock
Definition: windows.h:92
void remote_window_kill(int id)
window_t * windows
Definition: windows.c:33
window_t * window_debug
Definition: windows.c:47
session_t * session
Definition: windows.h:73
void windows_unlock_all()
unsigned short left
Definition: windows.h:75
struct userlist * next
Definition: userlist.h:55
char * window_target(window_t *window)
Definition: windows.c:556
window_t * window_status
Definition: windows.c:46
Definition: userlist.h:54
void print_window_w(window_t *w, int activity, const char *theme,...)
Definition: themes.c:1092
Definition: windows.h:51
unsigned int edge
Definition: windows.h:85
Definition: windows.h:67
unsigned short height
Definition: windows.h:76
unsigned int hide
Definition: windows.h:88
window_t * window_find_sa(session_t *session, const char *target, int session_null_means_no_session)
Definition: windows.c:94
window_t * window_exist(int id)
Definition: windows.c:471
char * alias
Definition: windows.h:72
unsigned short id
Definition: windows.h:70
char * irctopic
Definition: windows.h:83
struct window window_t
unsigned int more
Definition: windows.h:80
unsigned int out_active
Definition: windows.h:62
void window_kill(window_t *w)
Definition: windows.c:410