aboutsummaryrefslogtreecommitdiff
path: root/src/chat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chat.c')
-rw-r--r--src/chat.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/chat.c b/src/chat.c
index 4bf7972..fac192e 100644
--- a/src/chat.c
+++ b/src/chat.c
@@ -33,22 +33,19 @@ _chat_refresh(MESSENGER_Application *app)
33 app->chat.handle 33 app->chat.handle
34 ); 34 );
35 35
36 app->accounts.window = NULL; 36 application_clear(app);
37 app->chats.window = NULL;
38 app->current.members.window = NULL;
39 app->current.messages.window = NULL;
40 37
41 if (!account) 38 if (!account)
42 app->accounts.window = stdscr; 39 app->accounts.window = app->window;
43 else if (app->chat.context) 40 else if (app->chat.context)
44 { 41 {
45 if (app->chat.show_members) 42 if (app->chat.show_members)
46 app->current.members.window = stdscr; 43 app->current.members.window = app->window;
47 else 44 else
48 app->current.messages.window = stdscr; 45 app->current.messages.window = app->window;
49 } 46 }
50 else 47 else
51 app->chats.window = stdscr; 48 app->chats.window = app->window;
52 49
53 accounts_print(&(app->accounts), app); 50 accounts_print(&(app->accounts), app);
54 chats_print(&(app->chats), app); 51 chats_print(&(app->chats), app);
@@ -56,7 +53,7 @@ _chat_refresh(MESSENGER_Application *app)
56 messages_print(&(app->current.messages)); 53 messages_print(&(app->current.messages));
57} 54}
58 55
59static int 56static bool
60_chat_event(MESSENGER_Application *app, 57_chat_event(MESSENGER_Application *app,
61 int key) 58 int key)
62{ 59{
@@ -79,12 +76,12 @@ _chat_event(MESSENGER_Application *app,
79 else 76 else
80 chats_event(&(app->chats), app, key); 77 chats_event(&(app->chats), app, key);
81 78
82 if (GNUNET_YES == app->chat.quit) 79 if (app->chat.quit)
83 return 1; 80 return TRUE;
84 81
85refresh: 82refresh:
86 _chat_refresh(app); 83 _chat_refresh(app);
87 return 0; 84 return FALSE;
88} 85}
89 86
90static int 87static int
@@ -106,7 +103,10 @@ _chat_idle(void *cls)
106 MESSENGER_Application *app = cls; 103 MESSENGER_Application *app = cls;
107 app->chat.idle = NULL; 104 app->chat.idle = NULL;
108 105
109 if (0 != _chat_event(app, getch())) 106 if (app->chat.quit)
107 return;
108
109 if (_chat_event(app, wgetch(app->window)))
110 { 110 {
111 chat_stop(&(app->chat)); 111 chat_stop(&(app->chat));
112 return; 112 return;
@@ -115,7 +115,7 @@ _chat_idle(void *cls)
115 app->chat.idle = GNUNET_SCHEDULER_add_delayed_with_priority( 115 app->chat.idle = GNUNET_SCHEDULER_add_delayed_with_priority(
116 GNUNET_TIME_relative_multiply( 116 GNUNET_TIME_relative_multiply(
117 GNUNET_TIME_relative_get_millisecond_(), 117 GNUNET_TIME_relative_get_millisecond_(),
118 wgetdelay(stdscr) 118 wgetdelay(app->window)
119 ), 119 ),
120 GNUNET_SCHEDULER_PRIORITY_IDLE, 120 GNUNET_SCHEDULER_PRIORITY_IDLE,
121 &_chat_idle, 121 &_chat_idle,
@@ -141,7 +141,7 @@ chat_start(MESSENGER_Chat *chat,
141 app 141 app
142 ); 142 );
143 143
144 chat->quit = GNUNET_NO; 144 chat->quit = FALSE;
145} 145}
146 146
147void 147void
@@ -156,7 +156,7 @@ chat_stop(MESSENGER_Chat *chat)
156 GNUNET_CHAT_stop(chat->handle); 156 GNUNET_CHAT_stop(chat->handle);
157 chat->handle = NULL; 157 chat->handle = NULL;
158 158
159 chat->quit = GNUNET_YES; 159 chat->quit = TRUE;
160} 160}
161 161
162void 162void
@@ -177,7 +177,7 @@ chat_process_message(UNUSED MESSENGER_Chat *chat,
177 177
178 bool new_member = FALSE; 178 bool new_member = FALSE;
179 179
180 if (GNUNET_CHAT_KIND_LEAVE) 180 if (GNUNET_CHAT_KIND_LEAVE == kind)
181 members_remove(&(current->members), sender); 181 members_remove(&(current->members), sender);
182 else if (GNUNET_CHAT_KIND_JOIN == kind) 182 else if (GNUNET_CHAT_KIND_JOIN == kind)
183 new_member = members_add(&(current->members), sender); 183 new_member = members_add(&(current->members), sender);