1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-15 03:13:03 +01:00

Merge branch 'master' into new_groupchats

This commit is contained in:
Jfreegman 2015-03-21 15:15:48 -04:00
commit 88d6d907d8
14 changed files with 107 additions and 89 deletions

View File

@ -41,7 +41,6 @@ before_script:
- sudo make install - sudo make install
- cd .. - cd ..
script: script:
- cd build
- make -j2 || make || exit 1 - make -j2 || make || exit 1
notifications: notifications:
email: false email: false

View File

@ -14,6 +14,7 @@
| [Tox Core](https://github.com/irungentoo/toxcore) | BASE | *None* | | [Tox Core](https://github.com/irungentoo/toxcore) | BASE | *None* |
| [NCurses](https://www.gnu.org/software/ncurses) | BASE | libncursesw5-dev | | [NCurses](https://www.gnu.org/software/ncurses) | BASE | libncursesw5-dev |
| [LibConfig](http://www.hyperrealm.com/libconfig) | BASE | libconfig-dev | | [LibConfig](http://www.hyperrealm.com/libconfig) | BASE | libconfig-dev |
| [GNUmake](https://www.gnu.org/software/make) | BASE | make |
| [Tox Core AV](https://github.com/irungentoo/toxcore) | AUDIO | *None* | | [Tox Core AV](https://github.com/irungentoo/toxcore) | AUDIO | *None* |
| [OpenAL](http://openal.org) | AUDIO, SOUND NOTIFICATIONS | libopenal-dev | | [OpenAL](http://openal.org) | AUDIO, SOUND NOTIFICATIONS | libopenal-dev |
| [OpenALUT](http://openal.org) | SOUND NOTIFICATIONS | libalut-dev | | [OpenALUT](http://openal.org) | SOUND NOTIFICATIONS | libalut-dev |
@ -35,7 +36,6 @@ You can omit `libnotify` if you intend to build without desktop notifications en
<a name="Compiling"> <a name="Compiling">
## Compiling ## Compiling
``` ```
cd build/
make PREFIX="/where/to/install" make PREFIX="/where/to/install"
sudo make install PREFIX="/where/to/install" sudo make install PREFIX="/where/to/install"
``` ```

View File

@ -1,4 +1,4 @@
BASE_DIR = $(shell cd .. && pwd -P) BASE_DIR = $(shell pwd -P)
CFG_DIR = $(BASE_DIR)/cfg CFG_DIR = $(BASE_DIR)/cfg
-include $(CFG_DIR)/global_vars.mk -include $(CFG_DIR)/global_vars.mk
@ -19,49 +19,58 @@ OBJ += group_commands.o term_mplex.o
# Check on wich system we are running # Check on wich system we are running
UNAME_S = $(shell uname -s) UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S), Linux) ifeq ($(UNAME_S), Linux)
-include $(CFG_DIR)/systems/Linux.mk -include $(CFG_DIR)/systems/Linux.mk
endif endif
ifeq ($(UNAME_S), FreeBSD) ifeq ($(UNAME_S), FreeBSD)
-include $(CFG_DIR)/systems/FreeBSD.mk -include $(CFG_DIR)/systems/FreeBSD.mk
endif
ifeq ($(UNAME_S), OpenBSD)
-include $(CFG_DIR)/systems/FreeBSD.mk
endif endif
ifeq ($(UNAME_S), Darwin) ifeq ($(UNAME_S), Darwin)
-include $(CFG_DIR)/systems/Darwin.mk -include $(CFG_DIR)/systems/Darwin.mk
endif endif
ifeq ($(UNAME_S), Solaris) ifeq ($(UNAME_S), Solaris)
-include $(CFG_DIR)/systems/Solaris.mk -include $(CFG_DIR)/systems/Solaris.mk
endif endif
# Check on which platform we are running # Check on which platform we are running
UNAME_M = $(shell uname -m) UNAME_M = $(shell uname -m)
ifeq ($(UNAME_M), x86_64) ifeq ($(UNAME_M), x86_64)
-include $(CFG_DIR)/platforms/x86_64.mk -include $(CFG_DIR)/platforms/x86_64.mk
endif endif
ifneq ($(filter %86, $(UNAME_M)),) ifneq ($(filter %86, $(UNAME_M)),)
-include $(CFG_DIR)/platforms/x86.mk -include $(CFG_DIR)/platforms/x86.mk
endif endif
ifneq ($(filter arm%, $(UNAME_M)),) ifneq ($(filter arm%, $(UNAME_M)),)
-include $(CFG_DIR)/platforms/arm.mk -include $(CFG_DIR)/platforms/arm.mk
endif endif
# Include all needed checks # Include all needed checks
-include $(CFG_DIR)/checks/check_features.mk -include $(CFG_DIR)/checks/check_features.mk
# Fix path for object files
OBJ := $(addprefix $(BUILD_DIR)/, $(OBJ))
# Targets # Targets
all: toxic all: $(BUILD_DIR)/toxic
toxic: $(OBJ) $(BUILD_DIR)/toxic: $(OBJ)
@echo " LD $@" @echo " LD $(@:$(BUILD_DIR)/%=%)"
@$(CC) $(CFLAGS) -o toxic $(OBJ) $(LDFLAGS) @$(CC) $(CFLAGS) -o $(BUILD_DIR)/toxic $(OBJ) $(LDFLAGS)
%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@echo " CC $@" @if [ ! -e $(BUILD_DIR) ]; then \
@$(CC) $(CFLAGS) -o $*.o -c $(SRC_DIR)/$*.c mkdir -p $(BUILD_DIR) ;\
@$(CC) -MM $(CFLAGS) $(SRC_DIR)/$*.c > $*.d fi
@echo " CC $(@:$(BUILD_DIR)/%=%)"
@$(CC) $(CFLAGS) -o $(BUILD_DIR)/$*.o -c $(SRC_DIR)/$*.c
@$(CC) -MM $(CFLAGS) $(SRC_DIR)/$*.c > $(BUILD_DIR)/$*.d
clean: clean:
rm -f *.d *.o toxic rm -f $(BUILD_DIR)/*.d $(BUILD_DIR)/*.o $(BUILD_DIR)/toxic
-include $(OBJ:.o=.d) -include $(BUILD_DIR)/$(OBJ:.o=.d)
-include $(CFG_DIR)/targets/*.mk -include $(CFG_DIR)/targets/*.mk

View File

@ -2,22 +2,20 @@
AUDIO_LIBS = libtoxav openal AUDIO_LIBS = libtoxav openal
AUDIO_CFLAGS = -DAUDIO AUDIO_CFLAGS = -DAUDIO
ifneq (, $(findstring device.o, $(OBJ))) ifneq (, $(findstring device.o, $(OBJ)))
AUDIO_OBJ = audio_call.o AUDIO_OBJ = audio_call.o
else else
AUDIO_OBJ = audio_call.o device.o AUDIO_OBJ = audio_call.o device.o
endif endif
# Check if we can build audio support # Check if we can build audio support
CHECK_AUDIO_LIBS = $(shell pkg-config --exists $(AUDIO_LIBS) || echo -n "error") CHECK_AUDIO_LIBS = $(shell pkg-config --exists $(AUDIO_LIBS) || echo -n "error")
ifneq ($(CHECK_AUDIO_LIBS), error) ifneq ($(CHECK_AUDIO_LIBS), error)
LIBS += $(AUDIO_LIBS) LIBS += $(AUDIO_LIBS)
CFLAGS += $(AUDIO_CFLAGS) CFLAGS += $(AUDIO_CFLAGS)
OBJ += $(AUDIO_OBJ) OBJ += $(AUDIO_OBJ)
else else ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), clean) MISSING_AUDIO_LIBS = $(shell for lib in $(AUDIO_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
MISSING_AUDIO_LIBS = $(shell for lib in $(AUDIO_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without audio support)
$(warning WARNING -- Toxic will be compiled without audio support) $(warning WARNING -- You need these libraries for audio support)
$(warning WARNING -- You need these libraries for audio support) $(warning WARNING -- $(MISSING_AUDIO_LIBS))
$(warning WARNING -- $(MISSING_AUDIO_LIBS))
endif
endif endif

View File

@ -3,38 +3,36 @@ CHECKS_DIR = $(CFG_DIR)/checks
# Check if we want build X11 support # Check if we want build X11 support
X11 = $(shell if [ -z "$(DISABLE_X11)" ] || [ "$(DISABLE_X11)" = "0" ] ; then echo enabled ; else echo disabled ; fi) X11 = $(shell if [ -z "$(DISABLE_X11)" ] || [ "$(DISABLE_X11)" = "0" ] ; then echo enabled ; else echo disabled ; fi)
ifneq ($(X11), disabled) ifneq ($(X11), disabled)
-include $(CHECKS_DIR)/x11.mk -include $(CHECKS_DIR)/x11.mk
endif endif
# Check if we want build audio support # Check if we want build audio support
AUDIO = $(shell if [ -z "$(DISABLE_AV)" ] || [ "$(DISABLE_AV)" = "0" ] ; then echo enabled ; else echo disabled ; fi) AUDIO = $(shell if [ -z "$(DISABLE_AV)" ] || [ "$(DISABLE_AV)" = "0" ] ; then echo enabled ; else echo disabled ; fi)
ifneq ($(AUDIO), disabled) ifneq ($(AUDIO), disabled)
-include $(CHECKS_DIR)/av.mk -include $(CHECKS_DIR)/av.mk
endif endif
# Check if we want build sound notifications support # Check if we want build sound notifications support
SND_NOTIFY = $(shell if [ -z "$(DISABLE_SOUND_NOTIFY)" ] || [ "$(DISABLE_SOUND_NOTIFY)" = "0" ] ; then echo enabled ; else echo disabled ; fi) SND_NOTIFY = $(shell if [ -z "$(DISABLE_SOUND_NOTIFY)" ] || [ "$(DISABLE_SOUND_NOTIFY)" = "0" ] ; then echo enabled ; else echo disabled ; fi)
ifneq ($(SND_NOTIFY), disabled) ifneq ($(SND_NOTIFY), disabled)
-include $(CHECKS_DIR)/sound_notifications.mk -include $(CHECKS_DIR)/sound_notifications.mk
endif endif
# Check if we want build desktop notifications support # Check if we want build desktop notifications support
DESK_NOTIFY = $(shell if [ -z "$(DISABLE_DESKTOP_NOTIFY)" ] || [ "$(DISABLE_DESKTOP_NOTIFY)" = "0" ] ; then echo enabled ; else echo disabled ; fi) DESK_NOTIFY = $(shell if [ -z "$(DISABLE_DESKTOP_NOTIFY)" ] || [ "$(DISABLE_DESKTOP_NOTIFY)" = "0" ] ; then echo enabled ; else echo disabled ; fi)
ifneq ($(DESK_NOTIFY), disabled) ifneq ($(DESK_NOTIFY), disabled)
-include $(CHECKS_DIR)/desktop_notifications.mk -include $(CHECKS_DIR)/desktop_notifications.mk
endif endif
# Check if we can build Toxic # Check if we can build Toxic
CHECK_LIBS = $(shell pkg-config --exists $(LIBS) || echo -n "error") CHECK_LIBS = $(shell pkg-config --exists $(LIBS) || echo -n "error")
ifneq ($(CHECK_LIBS), error) ifneq ($(CHECK_LIBS), error)
CFLAGS += $(shell pkg-config --cflags $(LIBS)) CFLAGS += $(shell pkg-config --cflags $(LIBS))
LDFLAGS += $(shell pkg-config --libs $(LIBS)) LDFLAGS += $(shell pkg-config --libs $(LIBS))
else else ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), clean) MISSING_LIBS = $(shell for lib in $(LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
MISSING_LIBS = $(shell for lib in $(LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning ERROR -- Cannot compile Toxic)
$(warning ERROR -- Cannot compile Toxic) $(warning ERROR -- You need these libraries)
$(warning ERROR -- You need these libraries) $(warning ERROR -- $(MISSING_LIBS))
$(warning ERROR -- $(MISSING_LIBS)) $(error ERROR)
$(error ERROR)
endif
endif endif

View File

@ -5,13 +5,11 @@ DESK_NOTIFY_CFLAGS = -DBOX_NOTIFY
# Check if we can build desktop notifications support # Check if we can build desktop notifications support
CHECK_DESK_NOTIFY_LIBS = $(shell pkg-config --exists $(DESK_NOTIFY_LIBS) || echo -n "error") CHECK_DESK_NOTIFY_LIBS = $(shell pkg-config --exists $(DESK_NOTIFY_LIBS) || echo -n "error")
ifneq ($(CHECK_DESK_NOTIFY_LIBS), error) ifneq ($(CHECK_DESK_NOTIFY_LIBS), error)
LIBS += $(DESK_NOTIFY_LIBS) LIBS += $(DESK_NOTIFY_LIBS)
CFLAGS += $(DESK_NOTIFY_CFLAGS) CFLAGS += $(DESK_NOTIFY_CFLAGS)
else else ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), clean) MISSING_DESK_NOTIFY_LIBS = $(shell for lib in $(DESK_NOTIFY_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
MISSING_DESK_NOTIFY_LIBS = $(shell for lib in $(DESK_NOTIFY_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without desktop notifications support)
$(warning WARNING -- Toxic will be compiled without desktop notifications support) $(warning WARNING -- You need these libraries for desktop notifications support)
$(warning WARNING -- You need these libraries for desktop notifications support) $(warning WARNING -- $(MISSING_DESK_NOTIFY_LIBS))
$(warning WARNING -- $(MISSING_DESK_NOTIFY_LIBS))
endif
endif endif

View File

@ -2,22 +2,20 @@
SND_NOTIFY_LIBS = openal freealut SND_NOTIFY_LIBS = openal freealut
SND_NOTIFY_CFLAGS = -DSOUND_NOTIFY SND_NOTIFY_CFLAGS = -DSOUND_NOTIFY
ifneq (, $(findstring device.o, $(OBJ))) ifneq (, $(findstring device.o, $(OBJ)))
SND_NOTIFY_OBJ = SND_NOTIFY_OBJ =
else else
SND_NOTIFY_OBJ = device.o SND_NOTIFY_OBJ = device.o
endif endif
# Check if we can build sound notifications support # Check if we can build sound notifications support
CHECK_SND_NOTIFY_LIBS = $(shell pkg-config --exists $(SND_NOTIFY_LIBS) || echo -n "error") CHECK_SND_NOTIFY_LIBS = $(shell pkg-config --exists $(SND_NOTIFY_LIBS) || echo -n "error")
ifneq ($(CHECK_SND_NOTIFY_LIBS), error) ifneq ($(CHECK_SND_NOTIFY_LIBS), error)
LIBS += $(SND_NOTIFY_LIBS) LIBS += $(SND_NOTIFY_LIBS)
CFLAGS += $(SND_NOTIFY_CFLAGS) CFLAGS += $(SND_NOTIFY_CFLAGS)
OBJ += $(SND_NOTIFY_OBJ) OBJ += $(SND_NOTIFY_OBJ)
else else ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), clean) MISSING_SND_NOTIFY_LIBS = $(shell for lib in $(SND_NOTIFY_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
MISSING_SND_NOTIFY_LIBS = $(shell for lib in $(SND_NOTIFY_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without sound notifications support)
$(warning WARNING -- Toxic will be compiled without sound notifications support) $(warning WARNING -- You need these libraries for sound notifications support)
$(warning WARNING -- You need these libraries for sound notifications support) $(warning WARNING -- $(MISSING_SND_NOTIFY_LIBS))
$(warning WARNING -- $(MISSING_SND_NOTIFY_LIBS))
endif
endif endif

View File

@ -6,14 +6,12 @@ X11_OBJ = xtra.o
# Check if we can build X11 support # Check if we can build X11 support
CHECK_X11_LIBS = $(shell pkg-config --exists $(X11_LIBS) || echo -n "error") CHECK_X11_LIBS = $(shell pkg-config --exists $(X11_LIBS) || echo -n "error")
ifneq ($(CHECK_X11_LIBS), error) ifneq ($(CHECK_X11_LIBS), error)
LIBS += $(X11_LIBS) LIBS += $(X11_LIBS)
CFLAGS += $(X11_CFLAGS) CFLAGS += $(X11_CFLAGS)
OBJ += $(X11_OBJ) OBJ += $(X11_OBJ)
else else ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), clean) MISSING_X11_LIBS = $(shell for lib in $(X11_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
MISSING_X11_LIBS = $(shell for lib in $(X11_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without x11 support (needed for focus tracking and drag&drop support))
$(warning WARNING -- Toxic will be compiled without x11 support (needed for focus tracking and drag&drop support)) $(warning WARNING -- You need these libraries for x11 support)
$(warning WARNING -- You need these libraries for x11 support) $(warning WARNING -- $(MISSING_X11_LIBS))
$(warning WARNING -- $(MISSING_X11_LIBS))
endif
endif endif

View File

@ -2,12 +2,13 @@
TOXIC_VERSION = 0.5.2 TOXIC_VERSION = 0.5.2
REV = $(shell git rev-list HEAD --count 2>/dev/null || echo -n "error") REV = $(shell git rev-list HEAD --count 2>/dev/null || echo -n "error")
ifneq (, $(findstring error, $(REV))) ifneq (, $(findstring error, $(REV)))
VERSION = $(TOXIC_VERSION) VERSION = $(TOXIC_VERSION)
else else
VERSION = $(TOXIC_VERSION)_r$(REV) VERSION = $(TOXIC_VERSION)_r$(REV)
endif endif
# Project directories # Project directories
BUILD_DIR = $(BASE_DIR)/build
DOC_DIR = $(BASE_DIR)/doc DOC_DIR = $(BASE_DIR)/doc
SRC_DIR = $(BASE_DIR)/src SRC_DIR = $(BASE_DIR)/src
SND_DIR = $(BASE_DIR)/sounds SND_DIR = $(BASE_DIR)/sounds

View File

@ -1,13 +1,13 @@
# Install target # Install target
install: toxic install: $(BUILD_DIR)/toxic
@echo "Installing toxic executable" @echo "Installing toxic executable"
@mkdir -p $(abspath $(DESTDIR)/$(BINDIR)) @mkdir -p $(abspath $(DESTDIR)/$(BINDIR))
@install -m 0755 toxic $(abspath $(DESTDIR)/$(BINDIR)/toxic) @install -m 0755 $(BUILD_DIR)/toxic $(abspath $(DESTDIR)/$(BINDIR)/toxic)
@echo "Installing desktop file" @echo "Installing desktop file"
@mkdir -p $(abspath $(DESTDIR)/$(APPDIR)) @mkdir -p $(abspath $(DESTDIR)/$(APPDIR))
@install -m 0644 $(MISC_DIR)/$(DESKFILE) $(abspath $(DESTDIR)/$(APPDIR)/$(DESKFILE)) @install -m 0644 $(MISC_DIR)/$(DESKFILE) $(abspath $(DESTDIR)/$(APPDIR)/$(DESKFILE))
@echo "Installing data files" @echo "Installing data files"
@mkdir -p $(abspath $(DESTDIR)/$(DATADIR)) @mkdir -p $(abspath $(DESTDIR)/$(DATADIR))
@for f in $(DATAFILES) ; do \ @for f in $(DATAFILES) ; do \
@ -19,7 +19,7 @@ install: toxic
@for f in $(SNDFILES) ; do \ @for f in $(SNDFILES) ; do \
install -m 0644 $(SND_DIR)/$$f $(abspath $(DESTDIR)/$(DATADIR)/sounds/$$f) ;\ install -m 0644 $(SND_DIR)/$$f $(abspath $(DESTDIR)/$(DATADIR)/sounds/$$f) ;\
done done
@echo "Installing man pages" @echo "Installing man pages"
@mkdir -p $(abspath $(DESTDIR)/$(MANDIR)) @mkdir -p $(abspath $(DESTDIR)/$(MANDIR))
@for f in $(MANFILES) ; do \ @for f in $(MANFILES) ; do \

View File

@ -245,7 +245,7 @@ int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd)
const wchar_t *tmpline = &line[wcslen(cmd) + 2]; /* start after "/command \"" */ const wchar_t *tmpline = &line[wcslen(cmd) + 2]; /* start after "/command \"" */
if (wcs_to_mbs_buf(b_path, tmpline, sizeof(b_path)) == -1) if (wcs_to_mbs_buf(b_path, tmpline, sizeof(b_path)) == -1)
return -1; return -1;
if (wcs_to_mbs_buf(b_cmd, cmd, sizeof(b_cmd)) == -1) if (wcs_to_mbs_buf(b_cmd, cmd, sizeof(b_cmd)) == -1)
return -1; return -1;
@ -257,11 +257,11 @@ int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd)
if (!b_path[0]) { /* list everything in pwd */ if (!b_path[0]) { /* list everything in pwd */
b_path[0] = '.'; b_path[0] = '.';
b_path[1] = '\0'; b_path[1] = '\0';
} else if (!si && b_path[0] != '/') { /* look for matches in pwd */ } else if (!si && b_path[0] != '/') { /* look for matches in pwd */
char tmp[MAX_STR_SIZE]; char tmp[MAX_STR_SIZE];
snprintf(tmp, sizeof(tmp), ".%s", b_path); snprintf(tmp, sizeof(tmp), ".%s", b_path);
strcpy(b_path, tmp); strcpy(b_path, tmp);
} }
strcpy(b_name, &b_path[si + 1]); strcpy(b_name, &b_path[si + 1]);
@ -277,13 +277,15 @@ int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd)
int dircount = 0; int dircount = 0;
while ((entry = readdir(dp)) && dircount < MAX_DIRS) { while ((entry = readdir(dp)) && dircount < MAX_DIRS) {
if (strncmp(entry->d_name, b_name, b_name_len) == 0 if (strncmp(entry->d_name, b_name, b_name_len) == 0
&& strcmp(".", entry->d_name) && strcmp("..", entry->d_name)) { && strcmp(".", entry->d_name) && strcmp("..", entry->d_name)) {
snprintf(dirnames[dircount], sizeof(dirnames[dircount]), "%s", entry->d_name); snprintf(dirnames[dircount], sizeof(dirnames[dircount]), "%s", entry->d_name);
++dircount; ++dircount;
} }
} }
closedir(dp);
if (dircount == 0) if (dircount == 0)
return -1; return -1;

View File

@ -325,6 +325,7 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, uint8_t
int count = 1; int count = 1;
while ((filecheck = fopen(filename, "r"))) { while ((filecheck = fopen(filename, "r"))) {
fclose(filecheck);
filename[len] = '\0'; filename[len] = '\0';
char d[9]; char d[9];
sprintf(d, "(%d)", count++); sprintf(d, "(%d)", count++);
@ -849,6 +850,7 @@ static void send_action(ToxWindow *self, ChatContext *ctx, Tox *m, char *action)
static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr) static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
{ {
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
StatusBar *statusbar = self->stb; StatusBar *statusbar = self->stb;
@ -886,6 +888,13 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
diff = dir_match(self, m, ctx->line, L"/sendfile"); diff = dir_match(self, m, ctx->line, L"/sendfile");
} else if (wcsncmp(ctx->line, L"/avatar \"", wcslen(L"/avatar \"")) == 0) { } else if (wcsncmp(ctx->line, L"/avatar \"", wcslen(L"/avatar \"")) == 0) {
diff = dir_match(self, m, ctx->line, L"/avatar"); diff = dir_match(self, m, ctx->line, L"/avatar");
} else if (wcsncmp(ctx->line, L"/status ", wcslen(L"/status ")) == 0){
const char status_cmd_list[3][8] = {
{"online"},
{"away"},
{"busy"},
};
diff = complete_line(self, status_cmd_list, 3, 8);
} else { } else {
diff = complete_line(self, chat_cmd_list, AC_NUM_CHAT_COMMANDS, MAX_CMDNAME_SIZE); diff = complete_line(self, chat_cmd_list, AC_NUM_CHAT_COMMANDS, MAX_CMDNAME_SIZE);
} }

View File

@ -194,7 +194,14 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
if (wcsncmp(ctx->line, L"/avatar \"", wcslen(L"/avatar \"")) == 0) if (wcsncmp(ctx->line, L"/avatar \"", wcslen(L"/avatar \"")) == 0)
diff = dir_match(self, m, ctx->line, L"/avatar"); diff = dir_match(self, m, ctx->line, L"/avatar");
else else if (wcsncmp(ctx->line, L"/status ", wcslen(L"/status ")) == 0){
const char status_cmd_list[3][8] = {
{"online"},
{"away"},
{"busy"},
};
diff = complete_line(self, status_cmd_list, 3, 8);
} else
diff = complete_line(self, glob_cmd_list, AC_NUM_GLOB_COMMANDS, MAX_CMDNAME_SIZE); diff = complete_line(self, glob_cmd_list, AC_NUM_GLOB_COMMANDS, MAX_CMDNAME_SIZE);
if (diff != -1) { if (diff != -1) {

View File

@ -1026,6 +1026,7 @@ void DnD_callback(const char* asdv, DropType dt)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
parse_args(argc, argv); parse_args(argc, argv);
if (arg_opts.encrypt_data && arg_opts.unencrypt_data) { if (arg_opts.encrypt_data && arg_opts.unencrypt_data) {