diff options
author | nicm <nicm> | 2015-06-04 23:27:51 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-06-04 23:27:51 +0000 |
commit | 6b2129696fbefe44d0adce1f2a11b4ae477cd07e (patch) | |
tree | d204c7289caf70e18ea66fe75a7e3a0e668fd844 /server-client.c | |
parent | dc0d34e13792ff14b5c02fac01af013dfe111c83 (diff) | |
download | rtmux-6b2129696fbefe44d0adce1f2a11b4ae477cd07e.tar.gz rtmux-6b2129696fbefe44d0adce1f2a11b4ae477cd07e.tar.bz2 rtmux-6b2129696fbefe44d0adce1f2a11b4ae477cd07e.zip |
Move the nested check from client to server and compare the client tty
name to all the pane pty names instead of comparing socket paths. This
means that "new -d" will work without unsetting $TMUX.
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server-client.c b/server-client.c index 36408e91..01c8b313 100644 --- a/server-client.c +++ b/server-client.c @@ -46,6 +46,27 @@ void server_client_msg_command(struct client *, struct imsg *); void server_client_msg_identify(struct client *, struct imsg *); void server_client_msg_shell(struct client *); +/* Check if this client is inside this server. */ +int +server_client_check_nested(struct client *c) +{ + struct environ_entry *envent; + struct window_pane *wp; + + if (c->tty.path == NULL) + return (0); + + envent = environ_find(&c->environ, "TMUX"); + if (envent == NULL || *envent->value == '\0') + return (0); + + RB_FOREACH(wp, window_pane_tree, &all_window_panes) { + if (strcmp(wp->tty, c->tty.path) == 0) + return (1); + } + return (0); +} + /* Set client key table. */ void server_client_key_table(struct client *c, const char *name) |