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

Merged upstream and other fixes

This commit is contained in:
mannol 2014-06-22 21:07:11 +02:00
commit 48361a003e
17 changed files with 36 additions and 10 deletions

View File

@ -64,7 +64,8 @@ toxic_SOURCES += $(top_srcdir)/src/audio_call.c \
$(top_srcdir)/src/device.h
toxic_CFLAGS += $(LIBTOXAV_CFLAGS) \
$(OPENAL_CFLAGS)
$(OPENAL_CFLAGS) \
-Wimplicit-function-declaration
toxic_LDADD += $(LIBTOXAV_LIBS) \
$(OPENAL_LIBS)

View File

@ -43,7 +43,6 @@ void terminate_audio();
int start_transmission(ToxWindow *self);
int stop_transmission(int call_index);
int device_set(ToxWindow* self, DeviceType type, long int selection);
#endif /* _audio_h */

View File

@ -20,6 +20,8 @@
*
*/
#define _GNU_SOURCE /* needed for strcasestr() and wcwidth() */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -27,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include "toxic.h"
#include "windows.h"
@ -43,7 +46,6 @@
#endif /* _SUPPORT_AUDIO */
extern char *DATA_FILE;
extern int store_data(Tox *m, char *path);
extern FileSender file_senders[MAX_FILES];
extern ToxicFriend friends[MAX_FRIENDS_NUM];

View File

@ -33,6 +33,7 @@
#include "friendlist.h"
#include "execute.h"
#include "line_info.h"
#include "groupchat.h"
extern ToxWindow *prompt;

View File

@ -323,16 +323,17 @@ inline__ DeviceError write_out(uint32_t device_idx, int16_t* data, uint32_t leng
alSourceUnqueueBuffers(device->source, 1, &buffer);
alBufferData(buffer, AL_FORMAT_MONO16, data, lenght * 2 * 1 /*channels*/, sample_rate); // TODO: Frequency must be set dynamically
if (alGetError() != AL_NO_ERROR) {
fprintf(stderr, "Error setting buffer %d\n");
int rc = alGetError();
if (rc != AL_NO_ERROR) {
fprintf(stderr, "Error setting buffer %d\n", rc);
return de_BufferError;
}
alSourceQueueBuffers(device->source, 1, &buffer);
rc = alGetError();
if (alGetError() != AL_NO_ERROR) {
fprintf(stderr, "Error: could not buffer audio\n");
fprintf(stderr, "Error: could not buffer audio: %d\n", rc);
return de_BufferError;
}

View File

@ -34,6 +34,7 @@
#include "chat_commands.h"
#include "global_commands.h"
#include "line_info.h"
#include "misc_tools.h"
struct cmd_func {
const char *name;

View File

@ -32,6 +32,7 @@
#include "windows.h"
#include "file_senders.h"
#include "line_info.h"
#include "misc_tools.h"
FileSender file_senders[MAX_FILES];
uint8_t max_file_senders_index;

View File

@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include "toxic.h"
#include "windows.h"
@ -34,6 +35,8 @@
#include "log.h"
#include "line_info.h"
#include "dns.h"
#include "groupchat.h"
#include "prompt.h"
extern char *DATA_FILE;
extern ToxWindow *prompt;

View File

@ -20,6 +20,8 @@
*
*/
#define _GNU_SOURCE /* needed for strcasestr() and wcwidth() */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -27,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include "windows.h"
#include "toxic.h"
@ -40,7 +43,6 @@
#include "settings.h"
extern char *DATA_FILE;
extern int store_data(Tox *m, char *path);
static GroupChat groupchats[MAX_GROUPCHAT_NUM];
static int max_groupchat_index = 0;

View File

@ -25,6 +25,7 @@
#endif
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <limits.h>

View File

@ -58,6 +58,9 @@ int char_to_wcs_buf(wchar_t *buf, const uint8_t *string, size_t n);
Same thing as wcs_to_mbs() but caller must provide its own buffer */
int wcs_to_mbs_buf(uint8_t *buf, const wchar_t *string, size_t n);
/* convert a multibyte string to a wide character string (must provide buffer) */
int mbs_to_wcs_buf(wchar_t *buf, const uint8_t *string, size_t n);
/* convert wide characters to multibyte string: string returned must be free'd */
uint8_t *wcs_to_mbs(wchar_t *string);

View File

@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "toxic.h"
#include "windows.h"

View File

@ -57,6 +57,7 @@
#include "file_senders.h"
#include "line_info.h"
#include "settings.h"
#include "log.h"
#ifdef _SUPPORT_AUDIO
#include "audio_call.h"

View File

@ -78,6 +78,8 @@ typedef enum _FATAL_ERRS {
void exit_toxic_success(Tox *m);
void exit_toxic_err(const char *errmsg, int errcode);
int store_data(Tox *m, char *path);
void on_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata);
void on_connectionchange(Tox *m, int32_t friendnumber, uint8_t status, void *userdata);
void on_message(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata);

View File

@ -47,7 +47,7 @@ void add_char_to_buf(ChatContext *ctx, wint_t ch)
/* Deletes the character before pos */
void del_char_buf_bck(ChatContext *ctx)
{
if (ctx->pos <= 0)
if (ctx->pos == 0)
return;
wmemmove(&ctx->line[ctx->pos - 1], &ctx->line[ctx->pos], ctx->len - ctx->pos);
@ -58,7 +58,7 @@ void del_char_buf_bck(ChatContext *ctx)
/* Deletes the character at pos */
void del_char_buf_frnt(ChatContext *ctx)
{
if (ctx->pos < 0 || ctx->pos >= ctx->len)
if (ctx->pos >= ctx->len)
return;
wmemmove(&ctx->line[ctx->pos], &ctx->line[ctx->pos + 1], ctx->len - ctx->pos - 1);

View File

@ -27,12 +27,15 @@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <ctype.h>
#include "friendlist.h"
#include "prompt.h"
#include "toxic.h"
#include "windows.h"
#include "groupchat.h"
#include "chat.h"
#include "line_info.h"
extern char *DATA_FILE;
extern struct _Winthread Winthread;

View File

@ -180,4 +180,8 @@ int get_num_active_windows(void);
void kill_all_windows(void); /* should only be called on shutdown */
void on_window_resize(int sig);
/* refresh inactive windows to prevent scrolling bugs.
call at least once per second */
void refresh_inactive_windows(void);
#endif /* #define _windows_h */