1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-15 05:33:01 +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
@ -24,6 +24,9 @@ endif
ifeq ($(UNAME_S), FreeBSD) ifeq ($(UNAME_S), FreeBSD)
-include $(CFG_DIR)/systems/FreeBSD.mk -include $(CFG_DIR)/systems/FreeBSD.mk
endif endif
ifeq ($(UNAME_S), OpenBSD)
-include $(CFG_DIR)/systems/FreeBSD.mk
endif
ifeq ($(UNAME_S), Darwin) ifeq ($(UNAME_S), Darwin)
-include $(CFG_DIR)/systems/Darwin.mk -include $(CFG_DIR)/systems/Darwin.mk
endif endif
@ -46,22 +49,28 @@ 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

@ -13,11 +13,9 @@ 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

@ -29,12 +29,10 @@ 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

@ -7,11 +7,9 @@ CHECK_DESK_NOTIFY_LIBS = $(shell pkg-config --exists $(DESK_NOTIFY_LIBS) || echo
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

@ -13,11 +13,9 @@ 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

@ -9,11 +9,9 @@ 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

@ -8,6 +8,7 @@ else
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,8 +1,8 @@
# 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))

View File

@ -284,6 +284,8 @@ int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd)
} }
} }
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) {