Commit 8cb489d25f5c7a276f2882b146c972f64b18bf63
1 parent
69b58857
Exists in
master
and in
3 other branches
Removing unnecessary callbacks from table.
Showing
8 changed files
with
33 additions
and
52 deletions
Show diff stats
src/core/connect.c
... | ... | @@ -90,7 +90,7 @@ |
90 | 90 | .label = _("Try again") |
91 | 91 | }; |
92 | 92 | |
93 | - if(hSession->cbk.popup_show(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0) | |
93 | + if(hSession->cbk.popup(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0) | |
94 | 94 | lib3270_activate_auto_reconnect(hSession,1000); |
95 | 95 | |
96 | 96 | } | ... | ... |
src/core/popup.c
... | ... | @@ -41,8 +41,8 @@ |
41 | 41 | |
42 | 42 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
43 | 43 | |
44 | -LIB3270_EXPORT int lib3270_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait) { | |
45 | - return hSession->cbk.popup_show(hSession,popup,wait); | |
44 | +LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait) { | |
45 | + return hSession->cbk.popup(hSession,popup,wait); | |
46 | 46 | } |
47 | 47 | |
48 | 48 | /// @brief Pop up an error dialog. |
... | ... | @@ -64,7 +64,7 @@ void popup_an_error(H3270 *hSession, const char *fmt, ...) |
64 | 64 | .summary = summary |
65 | 65 | }; |
66 | 66 | |
67 | - hSession->cbk.popup_show(hSession,&popup,0); | |
67 | + hSession->cbk.popup(hSession,&popup,0); | |
68 | 68 | |
69 | 69 | } |
70 | 70 | |
... | ... | @@ -88,7 +88,7 @@ void popup_system_error(H3270 *hSession, const char *title, const char *summary, |
88 | 88 | .body = body |
89 | 89 | }; |
90 | 90 | |
91 | - hSession->cbk.popup_show(hSession,&popup,0); | |
91 | + hSession->cbk.popup(hSession,&popup,0); | |
92 | 92 | |
93 | 93 | } |
94 | 94 | |
... | ... | @@ -117,7 +117,7 @@ LIB3270_EXPORT void lib3270_popup_va(H3270 *hSession, LIB3270_NOTIFY id , const |
117 | 117 | .body = body |
118 | 118 | }; |
119 | 119 | |
120 | - hSession->cbk.popup_show(hSession,&popup,0); | |
120 | + hSession->cbk.popup(hSession,&popup,0); | |
121 | 121 | |
122 | 122 | } |
123 | 123 | ... | ... |
src/core/session.c
... | ... | @@ -207,7 +207,8 @@ static int load(H3270 *session, const char GNUC_UNUSED(*filename)) |
207 | 207 | return errno = ENOTSUP; |
208 | 208 | } |
209 | 209 | |
210 | -static void message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char *title, const char *msg, const char *text) | |
210 | +/* | |
211 | +static void def_message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char *title, const char *msg, const char *text) | |
211 | 212 | { |
212 | 213 | #ifdef ANDROID |
213 | 214 | __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title); |
... | ... | @@ -219,13 +220,16 @@ static void message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char * |
219 | 220 | lib3270_write_log(session,"lib3270","%s",text); |
220 | 221 | #endif // ANDROID |
221 | 222 | } |
223 | +*/ | |
222 | 224 | |
225 | +/* | |
223 | 226 | static void def_popup(H3270 *hSession, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) |
224 | 227 | { |
225 | 228 | lib3270_popup_va(hSession,type,title,msg,fmt,args); |
226 | 229 | } |
230 | +*/ | |
227 | 231 | |
228 | -static int def_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait) | |
232 | +static int def_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait) | |
229 | 233 | { |
230 | 234 | const char * text[] = { |
231 | 235 | popup->title, |
... | ... | @@ -243,24 +247,6 @@ static int def_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned |
243 | 247 | return ENOTSUP; |
244 | 248 | } |
245 | 249 | |
246 | -static int def_popup_ssl_error(H3270 *hSession, int GNUC_UNUSED(rc), const char *title, const char *summary, const char *body) | |
247 | -{ | |
248 | - LIB3270_POPUP popup = { | |
249 | - .type = LIB3270_NOTIFY_SECURE, | |
250 | - .title = title, | |
251 | - .summary = summary, | |
252 | - .body = body, | |
253 | - .label = _("Continue") | |
254 | - }; | |
255 | - | |
256 | - return hSession->cbk.popup_show(hSession,&popup,1); | |
257 | - | |
258 | - /* | |
259 | - lib3270_popup_dialog(session, LIB3270_NOTIFY_ERROR, title, summary, "%s", body); | |
260 | - return -1; | |
261 | - */ | |
262 | -} | |
263 | - | |
264 | 250 | static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) |
265 | 251 | { |
266 | 252 | vfprintf(stdout,fmt,args); |
... | ... | @@ -326,7 +312,6 @@ void lib3270_reset_callbacks(H3270 *hSession) |
326 | 312 | hSession->cbk.update_oia = update_oia; |
327 | 313 | hSession->cbk.update_selection = update_selection; |
328 | 314 | hSession->cbk.cursor = set_cursor; |
329 | - hSession->cbk.message = message; | |
330 | 315 | hSession->cbk.update_ssl = update_ssl; |
331 | 316 | hSession->cbk.display = screen_disp; |
332 | 317 | hSession->cbk.set_width = nop_int; |
... | ... | @@ -339,10 +324,7 @@ void lib3270_reset_callbacks(H3270 *hSession) |
339 | 324 | hSession->cbk.set_peer_certificate = set_peer_certificate; |
340 | 325 | hSession->cbk.update_luname = default_update_luname; |
341 | 326 | hSession->cbk.update_url = default_update_url; |
342 | - | |
343 | 327 | hSession->cbk.popup = def_popup; |
344 | - hSession->cbk.popup_ssl_error = def_popup_ssl_error; | |
345 | - hSession->cbk.popup_show = def_popup_show; | |
346 | 328 | |
347 | 329 | } |
348 | 330 | |
... | ... | @@ -467,10 +449,6 @@ LIB3270_EXPORT void lib3270_get_trace_handler(H3270 *hSession, LIB3270_TRACE_HAN |
467 | 449 | |
468 | 450 | } |
469 | 451 | |
470 | -LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)) { | |
471 | - session->cbk.popup = handler ? handler : def_popup; | |
472 | -} | |
473 | - | |
474 | 452 | H3270 * lib3270_session_new(const char *model) |
475 | 453 | { |
476 | 454 | H3270 * hSession; | ... | ... |
src/core/telnet.c
... | ... | @@ -642,6 +642,17 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED |
642 | 642 | #if defined(HAVE_LIBSSL) /*[*/ |
643 | 643 | if(hSession->ssl.con != NULL) |
644 | 644 | { |
645 | + static const LIB3270_POPUP popup = { | |
646 | + .type = LIB3270_NOTIFY_ERROR, | |
647 | + .summary = N_( "SSL Read error" ) | |
648 | + }; | |
649 | + | |
650 | + SSL_ERROR_MESSAGE message = { | |
651 | + .code = ERR_get_error(), | |
652 | + .popup = &popup | |
653 | + }; | |
654 | + | |
655 | + /* | |
645 | 656 | unsigned long e; |
646 | 657 | char err_buf[120]; |
647 | 658 | |
... | ... | @@ -651,11 +662,13 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED |
651 | 662 | (void) ERR_error_string(e, err_buf); |
652 | 663 | trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e,err_buf); |
653 | 664 | hSession->cbk.message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); |
665 | + ssl_popup_message(hSession,msg); | |
654 | 666 | } |
655 | 667 | else |
656 | 668 | { |
657 | 669 | trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e, "unknown"); |
658 | 670 | } |
671 | + */ | |
659 | 672 | |
660 | 673 | host_disconnect(hSession,True); |
661 | 674 | return; | ... | ... |
src/include/lib3270/popup.h
... | ... | @@ -70,8 +70,6 @@ |
70 | 70 | LIB3270_POPUP_HEAD |
71 | 71 | } LIB3270_POPUP; |
72 | 72 | |
73 | - LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); | |
74 | - | |
75 | 73 | /** |
76 | 74 | * Pop up an error dialog, based on an error number. |
77 | 75 | * |
... | ... | @@ -110,9 +108,9 @@ |
110 | 108 | * @return User action. |
111 | 109 | * |
112 | 110 | * @retval 0 User has confirmed, continue action. |
113 | - * @retval ECANCELED Operation was cancelled. | |
111 | + * @retval ECANCELED Operation was canceled. | |
114 | 112 | */ |
115 | - LIB3270_EXPORT int lib3270_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); | |
113 | + LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); | |
116 | 114 | |
117 | 115 | /** |
118 | 116 | * @brief Auto cleanup method (for use with lib3270_autoptr). | ... | ... |
src/include/lib3270/session.h
... | ... | @@ -81,11 +81,7 @@ |
81 | 81 | int (*save)(H3270 *session, LIB3270_CONTENT_OPTION mode, const char *filename); |
82 | 82 | int (*load)(H3270 *hSession, const char *filename); |
83 | 83 | |
84 | - void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); | |
85 | - | |
86 | - void (*popup)(H3270 *session, LIB3270_NOTIFY id, const char *title, const char *msg, const char *fmt, va_list); | |
87 | - int (*popup_ssl_error)(H3270 *session, int rc, const char *title, const char *summary, const char *body); | |
88 | - int (*popup_show)(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); | |
84 | + int (*popup)(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); | |
89 | 85 | |
90 | 86 | #ifdef HAVE_LIBSSL |
91 | 87 | void (*set_peer_certificate)(const X509 *cert); | ... | ... |
src/ssl/notify.c
... | ... | @@ -144,6 +144,8 @@ static LIB3270_POPUP * translate_ssl_error_message(const SSL_ERROR_MESSAGE *msg, |
144 | 144 | |
145 | 145 | popup->summary = dgettext(GETTEXT_PACKAGE,msg->popup->summary); |
146 | 146 | |
147 | + debug("%s: names[\"%s\",\"%s\"]",__FUNCTION__,popup->name, msg->popup->name); | |
148 | + | |
147 | 149 | if(popup->title) |
148 | 150 | popup->title = dgettext(GETTEXT_PACKAGE,popup->title); |
149 | 151 | else |
... | ... | @@ -191,14 +193,7 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG |
191 | 193 | |
192 | 194 | #ifdef SSL_ENABLE_NOTIFICATION_WHEN_FAILED |
193 | 195 | |
194 | - response = hSession->cbk.popup_ssl_error( | |
195 | - hSession, | |
196 | - rc, | |
197 | - popup->title, | |
198 | - popup->summary, | |
199 | - popup->body | |
200 | - ); | |
201 | - | |
196 | + response = hSession->cbk.popup(hSession,popup,1); | |
202 | 197 | |
203 | 198 | #endif // SSL_ENABLE_NOTIFICATION_WHEN_FAILED |
204 | 199 | |
... | ... | @@ -210,7 +205,7 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG |
210 | 205 | void ssl_popup_message(H3270 *hSession, const SSL_ERROR_MESSAGE *msg) { |
211 | 206 | |
212 | 207 | LIB3270_POPUP * popup = translate_ssl_error_message(msg,0); |
213 | - hSession->cbk.popup_show(hSession,popup,0); | |
208 | + hSession->cbk.popup(hSession,popup,0); | |
214 | 209 | lib3270_free(popup); |
215 | 210 | |
216 | 211 | } | ... | ... |
src/ssl/state.c
... | ... | @@ -104,6 +104,7 @@ static const struct ssl_status_msg status_msg[] = |
104 | 104 | |
105 | 105 | { |
106 | 106 | .id = X509_V_ERR_UNABLE_TO_GET_CRL, |
107 | + .name = "X509_V_ERR_UNABLE_TO_GET_CRL", | |
107 | 108 | .type = LIB3270_NOTIFY_ERROR, |
108 | 109 | .iconName = "dialog-error", |
109 | 110 | .summary = N_( "Unable to get certificate CRL." ), | ... | ... |