Commit 037c5e5cbee06519d47dc62a19cc5cdc2f94adb0
1 parent
01ba74fa
Exists in
master
and in
2 other branches
Allowing extended actions.
Showing
5 changed files
with
13 additions
and
21 deletions
Show diff stats
src/core/actions/actions.c
| ... | ... | @@ -87,22 +87,19 @@ LIB3270_EXPORT int lib3270_action_activate(const LIB3270_ACTION *action, H3270 * |
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -LIB3270_EXPORT int lib3270_action_activate_by_name(const char *name, H3270 *hSession) | |
| 90 | +LIB3270_EXPORT int lib3270_activate_by_name(H3270 *hSession, const char *name) | |
| 91 | 91 | { |
| 92 | 92 | const LIB3270_ACTION *action = lib3270_action_get_by_name(name); |
| 93 | 93 | |
| 94 | - if(!action) | |
| 95 | - { | |
| 96 | - lib3270_write_event_trace(hSession,"Can't find action \"%s\"\n",name); | |
| 97 | - return errno; | |
| 98 | - } | |
| 94 | + if(action) | |
| 95 | + return lib3270_action_activate(action, hSession); | |
| 99 | 96 | |
| 100 | - return lib3270_action_activate(action, hSession); | |
| 97 | + return hSession->cbk.action(hSession,name); | |
| 101 | 98 | } |
| 102 | 99 | |
| 103 | 100 | LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) |
| 104 | 101 | { |
| 105 | - return lib3270_action_activate_by_name(name,hSession); | |
| 102 | + return lib3270_activate_by_name(name,hSession); | |
| 106 | 103 | } |
| 107 | 104 | |
| 108 | 105 | LIB3270_EXPORT void lib3270_action_group_notify(H3270 *hSession, LIB3270_ACTION_GROUP group) | ... | ... |
src/core/session.c
| ... | ... | @@ -257,6 +257,9 @@ static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUS |
| 257 | 257 | { |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | +static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(*name)) { | |
| 261 | + return ENOENT; | |
| 262 | +} | |
| 260 | 263 | |
| 261 | 264 | void lib3270_reset_callbacks(H3270 *hSession) |
| 262 | 265 | { |
| ... | ... | @@ -286,6 +289,7 @@ void lib3270_reset_callbacks(H3270 *hSession) |
| 286 | 289 | hSession->cbk.load = load; |
| 287 | 290 | hSession->cbk.update_luname = default_update_luname; |
| 288 | 291 | hSession->cbk.update_url = default_update_url; |
| 292 | + hSession->cbk.action = default_action; | |
| 289 | 293 | |
| 290 | 294 | lib3270_set_popup_handler(hSession, NULL); |
| 291 | 295 | ... | ... |
src/include/internals.h
| ... | ... | @@ -478,18 +478,6 @@ struct _h3270 |
| 478 | 478 | int backslashed; |
| 479 | 479 | char plu_name[LIB3270_BIND_PLU_NAME_MAX+1]; |
| 480 | 480 | |
| 481 | - /* | |
| 482 | - /// @brief Proxy | |
| 483 | - struct | |
| 484 | - { | |
| 485 | - char * proxy; ///< Proxy server (type:host[:port]) | |
| 486 | - int type; | |
| 487 | - char * host; | |
| 488 | - char * portname; | |
| 489 | - unsigned short port; | |
| 490 | - } proxy; | |
| 491 | - */ | |
| 492 | - | |
| 493 | 481 | /// @brief LU |
| 494 | 482 | struct |
| 495 | 483 | { | ... | ... |
src/include/lib3270/actions.h
| ... | ... | @@ -118,11 +118,12 @@ |
| 118 | 118 | * |
| 119 | 119 | * @return The action return code. |
| 120 | 120 | * |
| 121 | + * @retval ENOENT Can't find action with the supplied name. | |
| 121 | 122 | * @retval EPERM Action is disabled. |
| 122 | 123 | * @retval ENOTSUP Action name is invalid. |
| 123 | 124 | * |
| 124 | 125 | */ |
| 125 | - LIB3270_EXPORT int lib3270_action_activate_by_name(const char *name, H3270 *hSession); | |
| 126 | + LIB3270_EXPORT int lib3270_activate_by_name(H3270 *hSession, const char *name); | |
| 126 | 127 | |
| 127 | 128 | /** |
| 128 | 129 | * @brief activate an action. | ... | ... |