Commit 95491ab45dcea154fc0b471feb3f25ba55e49fb4
1 parent
8cb489d2
Exists in
master
and in
3 other branches
Updating popup handler replacement (required for IPC modules).
Showing
4 changed files
with
40 additions
and
20 deletions
Show diff stats
src/core/popup.c
@@ -142,3 +142,31 @@ LIB3270_POPUP * lib3270_popup_clone_printf(const LIB3270_POPUP *origin, const ch | @@ -142,3 +142,31 @@ LIB3270_POPUP * lib3270_popup_clone_printf(const LIB3270_POPUP *origin, const ch | ||
142 | return popup; | 142 | return popup; |
143 | } | 143 | } |
144 | 144 | ||
145 | +static int def_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait) | ||
146 | +{ | ||
147 | + const char * text[] = { | ||
148 | + popup->title, | ||
149 | + popup->summary, | ||
150 | + popup->body | ||
151 | + }; | ||
152 | + | ||
153 | + size_t ix; | ||
154 | + | ||
155 | + for(ix = 0; ix < (sizeof(text)/sizeof(text[0])); ix++) | ||
156 | + { | ||
157 | + lib3270_write_log(hSession,"popup","%s",text[ix]); | ||
158 | + } | ||
159 | + | ||
160 | + return ENOTSUP; | ||
161 | +} | ||
162 | + | ||
163 | + | ||
164 | +LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *hSession, int (*handler)(H3270 *, const LIB3270_POPUP *, unsigned char wait)) { | ||
165 | + | ||
166 | + if(handler) | ||
167 | + hSession->cbk.popup = handler; | ||
168 | + else | ||
169 | + hSession->cbk.popup = def_popup; | ||
170 | + | ||
171 | + | ||
172 | +} |
src/core/session.c
@@ -229,24 +229,6 @@ static void def_popup(H3270 *hSession, LIB3270_NOTIFY type, const char *title, c | @@ -229,24 +229,6 @@ static void def_popup(H3270 *hSession, LIB3270_NOTIFY type, const char *title, c | ||
229 | } | 229 | } |
230 | */ | 230 | */ |
231 | 231 | ||
232 | -static int def_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait) | ||
233 | -{ | ||
234 | - const char * text[] = { | ||
235 | - popup->title, | ||
236 | - popup->summary, | ||
237 | - popup->body | ||
238 | - }; | ||
239 | - | ||
240 | - size_t ix; | ||
241 | - | ||
242 | - for(ix = 0; ix < (sizeof(text)/sizeof(text[0])); ix++) | ||
243 | - { | ||
244 | - lib3270_write_log(hSession,"popup","%s",text[ix]); | ||
245 | - } | ||
246 | - | ||
247 | - return ENOTSUP; | ||
248 | -} | ||
249 | - | ||
250 | static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) | 232 | static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) |
251 | { | 233 | { |
252 | vfprintf(stdout,fmt,args); | 234 | vfprintf(stdout,fmt,args); |
@@ -324,7 +306,8 @@ void lib3270_reset_callbacks(H3270 *hSession) | @@ -324,7 +306,8 @@ void lib3270_reset_callbacks(H3270 *hSession) | ||
324 | hSession->cbk.set_peer_certificate = set_peer_certificate; | 306 | hSession->cbk.set_peer_certificate = set_peer_certificate; |
325 | hSession->cbk.update_luname = default_update_luname; | 307 | hSession->cbk.update_luname = default_update_luname; |
326 | hSession->cbk.update_url = default_update_url; | 308 | hSession->cbk.update_url = default_update_url; |
327 | - hSession->cbk.popup = def_popup; | 309 | + |
310 | + lib3270_set_popup_handler(hSession, NULL); | ||
328 | 311 | ||
329 | } | 312 | } |
330 | 313 |
src/core/telnet.c
@@ -652,6 +652,8 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED | @@ -652,6 +652,8 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED | ||
652 | .popup = &popup | 652 | .popup = &popup |
653 | }; | 653 | }; |
654 | 654 | ||
655 | + popup_ssl_error(hSession,0,&message); | ||
656 | + | ||
655 | /* | 657 | /* |
656 | unsigned long e; | 658 | unsigned long e; |
657 | char err_buf[120]; | 659 | char err_buf[120]; |
src/include/lib3270/popup.h
@@ -71,7 +71,13 @@ | @@ -71,7 +71,13 @@ | ||
71 | } LIB3270_POPUP; | 71 | } LIB3270_POPUP; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | - * Pop up an error dialog, based on an error number. | 74 | + * @brief Replace popup handler. |
75 | + * | ||
76 | + */ | ||
77 | + LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *hSession, int (*handler)(H3270 *, const LIB3270_POPUP *, unsigned char wait)); | ||
78 | + | ||
79 | + /** | ||
80 | + * @brief Pop up an error dialog, based on an error number. | ||
75 | * | 81 | * |
76 | * @param hSession Session handle | 82 | * @param hSession Session handle |
77 | * @param errn Error number (errno). | 83 | * @param errn Error number (errno). |
@@ -109,6 +115,7 @@ | @@ -109,6 +115,7 @@ | ||
109 | * | 115 | * |
110 | * @retval 0 User has confirmed, continue action. | 116 | * @retval 0 User has confirmed, continue action. |
111 | * @retval ECANCELED Operation was canceled. | 117 | * @retval ECANCELED Operation was canceled. |
118 | + * @retval ENOTSUP No popup handler available. | ||
112 | */ | 119 | */ |
113 | LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); | 120 | LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); |
114 | 121 |