mirror of
				https://github.com/Tha14/toxic.git
				synced 2025-10-31 18:56:51 +01:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			bumpversio
			...
			fix_typing
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d02ac24de8 | ||
|  | 66e4c590dc | ||
|  | 8176b43880 | 
| @@ -132,10 +132,10 @@ mkdir -p "$BUILD_DIR" | |||||||
| cd "$BUILD_DIR" | cd "$BUILD_DIR" | ||||||
|  |  | ||||||
| # The git hash of the c-toxcore version we're using | # The git hash of the c-toxcore version we're using | ||||||
| TOXCORE_VERSION="25a56c354937e9c8c4c50a64c3b4cfc099c34e29" | TOXCORE_VERSION="af1848ed13d2aa3a7fc218de1d0633e99814efec" | ||||||
|  |  | ||||||
| # The sha256sum of the c-toxcore tarball for TOXCORE_VERSION | # The sha256sum of the c-toxcore tarball for TOXCORE_VERSION | ||||||
| TOXCORE_HASH="8448752e6286c747130254571fde2db8e2fc073a8116f9fff489ed53af546c0a" | TOXCORE_HASH="acd1117b752583eb7d97aabc1053275ffa5f92591e166687a17c7267201a2e18" | ||||||
|  |  | ||||||
| TOXCORE_FILENAME="c-toxcore-$TOXCORE_VERSION.tar.gz" | TOXCORE_FILENAME="c-toxcore-$TOXCORE_VERSION.tar.gz" | ||||||
|  |  | ||||||
| @@ -164,8 +164,8 @@ cmake --build _build --target install | |||||||
| # location with SSL_CERT_FILE env variable. | # location with SSL_CERT_FILE env variable. | ||||||
| cd "$BUILD_DIR" | cd "$BUILD_DIR" | ||||||
|  |  | ||||||
| CURL_VERSION="7.77.0" | CURL_VERSION="7.80.0" | ||||||
| CURL_HASH="b0a3428acb60fa59044c4d0baae4e4fc09ae9af1d8a3aa84b2e3fbcd99841f77" | CURL_HASH="dab997c9b08cb4a636a03f2f7f985eaba33279c1c52692430018fae4a4878dc7" | ||||||
| CURL_FILENAME="curl-$CURL_VERSION.tar.gz" | CURL_FILENAME="curl-$CURL_VERSION.tar.gz" | ||||||
|  |  | ||||||
| wget --timeout=10 -O "$CURL_FILENAME" "https://curl.haxx.se/download/$CURL_FILENAME" | wget --timeout=10 -O "$CURL_FILENAME" "https://curl.haxx.se/download/$CURL_FILENAME" | ||||||
|   | |||||||
							
								
								
									
										58
									
								
								src/chat.c
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								src/chat.c
									
									
									
									
									
								
							| @@ -1270,9 +1270,16 @@ static void chat_onDraw(ToxWindow *self, Tox *m) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     ChatContext *ctx = self->chatwin; |     ChatContext *ctx = self->chatwin; | ||||||
|  |     StatusBar *statusbar = self->stb; | ||||||
|  |  | ||||||
|     pthread_mutex_lock(&Winthread.lock); |     pthread_mutex_lock(&Winthread.lock); | ||||||
|  |  | ||||||
|     line_info_print(self); |     line_info_print(self); | ||||||
|  |  | ||||||
|  |     Tox_Connection connection = statusbar->connection; | ||||||
|  |     Tox_User_Status status = statusbar->status; | ||||||
|  |     const bool is_typing = Friends.list[self->num].is_typing; | ||||||
|  |  | ||||||
|     pthread_mutex_unlock(&Winthread.lock); |     pthread_mutex_unlock(&Winthread.lock); | ||||||
|  |  | ||||||
|     wclear(ctx->linewin); |     wclear(ctx->linewin); | ||||||
| @@ -1283,14 +1290,6 @@ static void chat_onDraw(ToxWindow *self, Tox *m) | |||||||
|  |  | ||||||
|     curs_set(1); |     curs_set(1); | ||||||
|  |  | ||||||
|     /* Draw status bar */ |  | ||||||
|     StatusBar *statusbar = self->stb; |  | ||||||
|  |  | ||||||
|     pthread_mutex_lock(&Winthread.lock); |  | ||||||
|     Tox_Connection connection = statusbar->connection; |  | ||||||
|     Tox_User_Status status = statusbar->status; |  | ||||||
|     pthread_mutex_unlock(&Winthread.lock); |  | ||||||
|  |  | ||||||
|     wmove(statusbar->topline, 0, 0); |     wmove(statusbar->topline, 0, 0); | ||||||
|  |  | ||||||
|     wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |     wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
| @@ -1318,13 +1317,13 @@ static void chat_onDraw(ToxWindow *self, Tox *m) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |     wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
|     wprintw(statusbar->topline, "]"); |     wprintw(statusbar->topline, "] "); | ||||||
|     wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |     wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
|  |  | ||||||
|     if (status != TOX_USER_STATUS_NONE) { |     const char *status_text = "ERROR"; | ||||||
|         const char *status_text = "ERROR"; |     int colour = BAR_TEXT; | ||||||
|         int colour = MAGENTA; |  | ||||||
|  |  | ||||||
|  |     if (connection != TOX_CONNECTION_NONE) { | ||||||
|         switch (status) { |         switch (status) { | ||||||
|             case TOX_USER_STATUS_AWAY: |             case TOX_USER_STATUS_AWAY: | ||||||
|                 colour = STATUS_AWAY; |                 colour = STATUS_AWAY; | ||||||
| @@ -1339,9 +1338,11 @@ static void chat_onDraw(ToxWindow *self, Tox *m) | |||||||
|             default: |             default: | ||||||
|                 break; |                 break; | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if (colour != BAR_TEXT) { | ||||||
|         wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |         wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
|         wprintw(statusbar->topline, " ["); |         wprintw(statusbar->topline, "["); | ||||||
|         wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |         wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
|  |  | ||||||
|         wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD); |         wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD); | ||||||
| @@ -1351,30 +1352,23 @@ static void chat_onDraw(ToxWindow *self, Tox *m) | |||||||
|         wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |         wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
|         wprintw(statusbar->topline, "] "); |         wprintw(statusbar->topline, "] "); | ||||||
|         wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); |         wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|         pthread_mutex_lock(&Winthread.lock); |     if (is_typing) { | ||||||
|         const bool is_typing = Friends.list[self->num].is_typing; |         wattron(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_NOTIFY)); | ||||||
|         pthread_mutex_unlock(&Winthread.lock); |  | ||||||
|  |  | ||||||
|         if (is_typing) { |  | ||||||
|             wattron(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_NOTIFY)); |  | ||||||
|         } else { |  | ||||||
|             wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT)); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         wprintw(statusbar->topline, "%s", statusbar->nick); |  | ||||||
|  |  | ||||||
|         if (is_typing) { |  | ||||||
|             wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_NOTIFY)); |  | ||||||
|         } else { |  | ||||||
|             wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_TEXT)); |  | ||||||
|         } |  | ||||||
|     } else { |     } else { | ||||||
|         wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT)); |         wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT)); | ||||||
|         wprintw(statusbar->topline, " %s", statusbar->nick); |  | ||||||
|         wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT)); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     wprintw(statusbar->topline, "%s", statusbar->nick); | ||||||
|  |  | ||||||
|  |     if (is_typing) { | ||||||
|  |         wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_NOTIFY)); | ||||||
|  |     } else { | ||||||
|  |         wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_TEXT)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     /* Reset statusbar->statusmsg on window resize */ |     /* Reset statusbar->statusmsg on window resize */ | ||||||
|     if (x2 != self->x) { |     if (x2 != self->x) { | ||||||
|         char statusmsg[TOX_MAX_STATUS_MESSAGE_LENGTH] = {'\0'}; |         char statusmsg[TOX_MAX_STATUS_MESSAGE_LENGTH] = {'\0'}; | ||||||
|   | |||||||
| @@ -161,18 +161,12 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX | |||||||
|  |  | ||||||
|     const char *id = argv[1]; |     const char *id = argv[1]; | ||||||
|     const size_t arg_length = strlen(id); |     const size_t arg_length = strlen(id); | ||||||
|     const bool is_tox_id = arg_length >= (2 * TOX_ADDRESS_SIZE); |     const int space_idx = char_find(0, id, ' '); | ||||||
|  |  | ||||||
|     if (is_tox_id) { |     // we have to manually parse the message due to this command being a special case | ||||||
|         // we have to manually parse the message due to this command being a special case |     if (space_idx > 0 && space_idx < arg_length - 1) { | ||||||
|         int idx = char_find(0, id, ' '); |         snprintf(msg, sizeof(msg), "%s", &id[space_idx + 1]); | ||||||
|  |     } else { | ||||||
|         if (idx > 0 && idx < arg_length - 1) { |  | ||||||
|             snprintf(msg, sizeof(msg), "%s", &id[idx + 1]); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (!msg[0]) { |  | ||||||
|         char selfname[TOX_MAX_NAME_LENGTH]; |         char selfname[TOX_MAX_NAME_LENGTH]; | ||||||
|         tox_self_get_name(m, (uint8_t *) selfname); |         tox_self_get_name(m, (uint8_t *) selfname); | ||||||
|  |  | ||||||
| @@ -183,34 +177,34 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX | |||||||
|  |  | ||||||
|     char id_bin[TOX_ADDRESS_SIZE] = {0}; |     char id_bin[TOX_ADDRESS_SIZE] = {0}; | ||||||
|  |  | ||||||
|     /* try to add tox ID */ |     const bool is_tox_id = (char_find(0, id, '@') == arg_length) && (arg_length >= TOX_ADDRESS_SIZE * 2); | ||||||
|     if (is_tox_id) { |  | ||||||
|         size_t i; |  | ||||||
|         char xx[3]; |  | ||||||
|         uint32_t x; |  | ||||||
|  |  | ||||||
|         for (i = 0; i < TOX_ADDRESS_SIZE; ++i) { |     if (!is_tox_id) { | ||||||
|             xx[0] = id[2 * i]; |         name_lookup(self, m, id_bin, id, msg); | ||||||
|             xx[1] = id[2 * i + 1]; |     } | ||||||
|             xx[2] = 0; |  | ||||||
|  |  | ||||||
|             if (sscanf(xx, "%02x", &x) != 1) { |     char xx[3]; | ||||||
|                 line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Invalid Tox ID."); |     uint32_t x = 0; | ||||||
|                 return; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             id_bin[i] = x; |     for (size_t i = 0; i < TOX_ADDRESS_SIZE; ++i) { | ||||||
|         } |         xx[0] = id[2 * i]; | ||||||
|  |         xx[1] = id[2 * i + 1]; | ||||||
|  |         xx[2] = 0; | ||||||
|  |  | ||||||
|         if (friend_is_blocked(id_bin)) { |         if (sscanf(xx, "%02x", &x) != 1) { | ||||||
|             line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Friend is in your block list."); |             line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Invalid Tox ID."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         cmd_add_helper(self, m, id_bin, msg); |         id_bin[i] = x; | ||||||
|     } else {    /* assume id is a username@domain address and do http name server lookup */ |  | ||||||
|         name_lookup(self, m, id_bin, id, msg); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (friend_is_blocked(id_bin)) { | ||||||
|  |         line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Friend is in your block list."); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     cmd_add_helper(self, m, id_bin, msg); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cmd_avatar(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) | void cmd_avatar(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user