diff --git a/README.md b/README.md index eb9deaf..168a646 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Toxic is an ncurses based instant messaging client for [Tox](http://tox.im) whic * Generate the configure script by running the ```autoreconf -i``` command. * Execute the configure script with ```./configure``` (you may need to pass it the location of your dependency libraries, i.e.): -```./configure --prefix=/where/to/install --with-libtoxcore-headers=/path/to/ProjectTox-Core/toxcore --with-libtoxcore-libs=/path/to/ProjectTox-Core/build/toxcore --with-libsodium-headers=/path/to/libsodium/include/ --with-libsodium-libs=/path/to/sodiumtest/lib/ ``` +```./configure --prefix=/where/to/install --with-libtoxcore-headers=/path/to/ProjectTox-Core/toxcore --with-libtoxcore-libs=/path/to/ProjectTox-Core/build/.libs --with-libsodium-headers=/path/to/libsodium/include/ --with-libsodium-libs=/path/to/sodiumtest/lib/ ``` * Audio calling support requires openal installed * Compile with --disable-av to build without audio call support diff --git a/misc/DHTnodes b/misc/DHTnodes index 5cdf719..43f6fab 100644 --- a/misc/DHTnodes +++ b/misc/DHTnodes @@ -1,8 +1,8 @@ 192.254.75.98 33445 951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F -2607:5600:284::2 33445 951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F -23.226.230.47 33445 A09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074 -173.255.223.85 33445 92E0CE88651FC89D54D6A3110FD08854ECD487613E69BFB1002380D35FD4F947 +37.187.46.132 33445 A9D98212B3F972BD11DA52BEB0658C326FCCC1BFD49F347F9C2D3D8B61E1B927 144.76.60.215 33445 04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F -109.169.46.133 33445 4086B340BF2C2C3CC5412BCF673080EF10CF5E75A06AC960497BD85B9DEA2E64 -54.199.139.199 33445 7F9C31FE850E97CEFD4C4591DF93FC757C7C12549DDD55F8EEAECC34FE76C029 -66.175.223.88 33445 B24E2FB924AE66D023FE1E42A2EE3B432010206F751A2FFD3E297383ACF1572E +23.226.230.47 33445 A09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074 +37.187.20.216 33445 4FD54CFD426A338399767E56FD0F44F5E35FA8C38C8E87C8DC3FEAC0160F8E17 +54.199.139.199 33445 7F9C31FE850E97CEFD4C4591DF93FC757C7C12549DDD55F8EEAECC34FE76C029 +109.169.46.133 33445 7F31BFC93B8E4016A902144D0B110C3EA97CB7D43F1C4D21BCAE998A7C838821 +192.210.149.121 33445 F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67 diff --git a/misc/toxic.conf b/misc/toxic.conf index b480f4f..babf468 100644 --- a/misc/toxic.conf +++ b/misc/toxic.conf @@ -7,6 +7,9 @@ autolog:0; # 1 to disbale terminal alerts on messages, 0 to enable disable_alerts:0; +# maximum lines for chat window history +history_size:700; + # 1 to use native terminal colours, 0 to use toxic default colour theme colour_theme:0; @@ -15,3 +18,6 @@ audio_in_dev:0; # preferred audio output device; numbers correspond to /lsdev out audio_out_dev:0; + +# preferred path for downloads +download_path:/home/USERNAME/Downloads/; \ No newline at end of file diff --git a/src/audio_call.c b/src/audio_call.c index 50cfe57..b4e80cf 100644 --- a/src/audio_call.c +++ b/src/audio_call.c @@ -39,6 +39,14 @@ #include #include +#ifdef __APPLE__ +#include +#include +#else +#include +#include +#endif + #define _cbend pthread_exit(NULL) #define MAX_CALLS 10 @@ -403,7 +411,7 @@ void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[ if ( error != ErrorNone ) { if ( error == ErrorInvalidState ) error_str = "Cannot answer in invalid state!"; - else if ( error == ErrorNoCall ) error_str = "No incomming call!"; + else if ( error == ErrorNoCall ) error_str = "No incoming call!"; else error_str = "Internal error!"; goto on_error; @@ -434,7 +442,7 @@ void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[ if ( error != ErrorNone ) { if ( error == ErrorInvalidState ) error_str = "Cannot reject in invalid state!"; - else if ( error == ErrorNoCall ) error_str = "No incomming call!"; + else if ( error == ErrorNoCall ) error_str = "No incoming call!"; else error_str = "Internal error!"; goto on_error; @@ -725,4 +733,4 @@ void cmd_sense(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (*argv) on_error: print_err (self, error_str); -} \ No newline at end of file +} diff --git a/src/chat.c b/src/chat.c index 3b486d0..f4fe113 100644 --- a/src/chat.c +++ b/src/chat.c @@ -433,7 +433,7 @@ void chat_onInvite (ToxWindow *self, ToxAv *av, int call_index) self->call_idx = call_index; - line_info_add(self, NULL, NULL, NULL, "Incoming audio call!\nType: \"/answer\" or \"/reject\"", SYS_MSG, 0, 0); + line_info_add(self, NULL, NULL, NULL, "Incoming audio call! Type: \"/answer\" or \"/reject\"", SYS_MSG, 0, 0); alert_window(self, WINDOW_ALERT_0, true); } @@ -443,7 +443,7 @@ void chat_onRinging (ToxWindow *self, ToxAv *av, int call_index) if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0)) return; - line_info_add(self, NULL, NULL, NULL, "Ringing...\n\"cancel\" ?", SYS_MSG, 0, 0); + line_info_add(self, NULL, NULL, NULL, "Ringing...\"cancel\" ?", SYS_MSG, 0, 0); } void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index) @@ -451,7 +451,7 @@ void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index) if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0)) return; - line_info_add(self, NULL, NULL, NULL, "Call started!\nType: \"/hangup\" to end it.", SYS_MSG, 0, 0); + line_info_add(self, NULL, NULL, NULL, "Call started! Type: \"/hangup\" to end it.", SYS_MSG, 0, 0); } void chat_onEnding (ToxWindow *self, ToxAv *av, int call_index) @@ -477,7 +477,7 @@ void chat_onStart (ToxWindow *self, ToxAv *av, int call_index) if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0)) return; - line_info_add(self, NULL, NULL, NULL, "Call started!\nType: \"/hangup\" to end it.", SYS_MSG, 0, 0); + line_info_add(self, NULL, NULL, NULL, "Call started! Type: \"/hangup\" to end it.", SYS_MSG, 0, 0); } void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index) diff --git a/src/toxic_strings.c b/src/toxic_strings.c index d78af0e..c1a08b6 100644 --- a/src/toxic_strings.c +++ b/src/toxic_strings.c @@ -26,6 +26,7 @@ #include #include +#include #include "toxic.h" #include "windows.h" @@ -38,14 +39,9 @@ void add_char_to_buf(ChatContext *ctx, wint_t ch) if (ctx->pos < 0 || ctx->len >= MAX_STR_SIZE) return; - /* move all chars including null in front of pos one space forward and insert char in pos */ - int i; - - for (i = ctx->len; i >= ctx->pos && i >= 0; --i) - ctx->line[i + 1] = ctx->line[i]; - + wmemmove(&ctx->line[ctx->pos + 1], &ctx->line[ctx->pos], ctx->len - ctx->pos); ctx->line[ctx->pos++] = ch; - ++ctx->len; + ctx->line[++ctx->len] = L'\0'; } /* Deletes the character before pos */ @@ -54,14 +50,9 @@ void del_char_buf_bck(ChatContext *ctx) if (ctx->pos <= 0) return; - int i; - - /* similar to add_char_to_buf but deletes a char */ - for (i = ctx->pos - 1; i <= ctx->len; ++i) - ctx->line[i] = ctx->line[i + 1]; - + wmemmove(&ctx->line[ctx->pos - 1], &ctx->line[ctx->pos], ctx->len - ctx->pos); --ctx->pos; - --ctx->len; + ctx->line[--ctx->len] = L'\0'; } /* Deletes the character at pos */ @@ -70,12 +61,8 @@ void del_char_buf_frnt(ChatContext *ctx) if (ctx->pos < 0 || ctx->pos >= ctx->len) return; - int i; - - for (i = ctx->pos; i < ctx->len; ++i) - ctx->line[i] = ctx->line[i + 1]; - - --ctx->len; + wmemmove(&ctx->line[ctx->pos], &ctx->line[ctx->pos + 1], ctx->len - ctx->pos - 1); + ctx->line[--ctx->len] = L'\0'; } /* Deletes the line from beginning to pos */ @@ -84,15 +71,11 @@ void discard_buf(ChatContext *ctx) if (ctx->pos <= 0) return; - int i; - int c = 0; - - for (i = ctx->pos; i <= ctx->len; ++i) - ctx->line[c++] = ctx->line[i]; - + wmemmove(ctx->line, &ctx->line[ctx->pos], ctx->len - ctx->pos); + ctx->len -= ctx->pos; ctx->pos = 0; ctx->start = 0; - ctx->len = c - 1; + ctx->line[ctx->len] = L'\0'; } /* Deletes the line from pos to len */