Changeset eb4ad8d
- Timestamp:
- 2015-01-17T20:13:19Z (10 years ago)
- Branches:
- master
- Children:
- e26aa72
- Parents:
- 1065dd4 (diff), 664bac3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r1065dd4 reb4ad8d 56 56 57 57 echo BitlBee configure 58 59 # Cygwin and Darwin don't support PIC/PIE 60 case "$arch" in 61 CYGWIN* ) 62 pie=0;; 63 Darwin ) 64 pie=0;; 65 esac 58 66 59 67 while [ -n "$1" ]; do -
ipc.c
r1065dd4 reb4ad8d 463 463 { 464 464 GSList *l; 465 irc_t *old ;465 irc_t *old = NULL; 466 466 char *to_init[] = { "TAKEOVER", "INIT", NULL }; 467 467 … … 477 477 break; 478 478 } 479 if( l == NULL || 479 if( l == NULL || old == NULL || 480 480 !set_getbool( &irc->b->set, "allow_takeover" ) || 481 481 !set_getbool( &old->b->set, "allow_takeover" ) ) … … 524 524 { 525 525 /* There is no typo in this line: */ 526 for( j = 1; cmd[j]; j ++ ); j --; 526 for( j = 1; cmd[j]; j ++ ) 527 ; 528 j--; 527 529 528 530 if( j < commands[i].required_parameters ) -
irc_channel.c
r1065dd4 reb4ad8d 432 432 char *acc_s; 433 433 434 if( !aj && !( ic->flags & IRC_CHANNEL_JOINED ) )434 if( !aj || ( ic->flags & IRC_CHANNEL_JOINED ) ) 435 435 /* Only continue if this one's marked as auto_join 436 436 or if we're in it already. (Possible if the -
irc_commands.c
r1065dd4 reb4ad8d 770 770 { 771 771 /* There should be no typo in the next line: */ 772 for( n_arg = 0; cmd[n_arg]; n_arg ++ ); n_arg --; 772 for( n_arg = 0; cmd[n_arg]; n_arg ++ ) 773 ; 774 n_arg--; 773 775 774 776 if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status & USTATUS_LOGGED_IN ) -
irc_im.c
r1065dd4 reb4ad8d 911 911 c->ic->acc->prpl->chat_leave( c ); 912 912 913 /* Remove references in both directions now. We don't need each otheranymore. */913 /* Remove the reference. We don't need it anymore. */ 914 914 ic->data = NULL; 915 if( c )916 c->ui_data = NULL;917 915 918 916 return TRUE; -
lib/misc.c
r1065dd4 reb4ad8d 780 780 return NULL; 781 781 } 782 783 /* Takes a string, truncates it where it's safe, returns the new length */ 784 int truncate_utf8( char *string, int maxlen ) 785 { 786 char *end; 787 g_utf8_validate( (const gchar *) string, maxlen, (const gchar **) &end ); 788 *end = '\0'; 789 return end - string; 790 } -
lib/misc.h
r1065dd4 reb4ad8d 150 150 G_MODULE_EXPORT char **split_command_parts( char *command, int limit ); 151 151 G_MODULE_EXPORT char *get_rfc822_header( const char *text, const char *header, int len ); 152 G_MODULE_EXPORT int truncate_utf8( char *string, int maxlen ); 152 153 153 154 #endif -
lib/ns_parse.c
r1065dd4 reb4ad8d 19 19 20 20 #ifndef lint 21 static const char rcsid[] = "$Id: ns_parse.c,v 1.10 2009/01/23 19:59:16 each Exp $";21 //static const char rcsid[] = "$Id: ns_parse.c,v 1.10 2009/01/23 19:59:16 each Exp $"; 22 22 #endif 23 23 -
lib/proxy.c
r1065dd4 reb4ad8d 66 66 { 67 67 struct PHB *phb = data; 68 unsigned int len;68 socklen_t len; 69 69 int error = ETIMEDOUT; 70 70 len = sizeof(error); … … 86 86 closesocket(source); 87 87 b_event_remove(phb->inpa); 88 phb->inpa = 0; 88 89 if( phb->proxy_func ) 89 90 phb->proxy_func(phb->proxy_data, -1, B_EV_IO_READ); … … 97 98 sock_make_blocking(source); 98 99 b_event_remove(phb->inpa); 100 phb->inpa = 0; 99 101 if( phb->proxy_func ) 100 102 phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ); … … 174 176 /* Connecting to HTTP proxies */ 175 177 176 #define HTTP_GOODSTRING "HTTP/1.0 200 Connection established"177 #define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established"178 #define HTTP_GOODSTRING "HTTP/1.0 200" 179 #define HTTP_GOODSTRING2 "HTTP/1.1 200" 178 180 179 181 static gboolean http_canread(gpointer data, gint source, b_input_condition cond) … … 214 216 char cmd[384]; 215 217 struct PHB *phb = data; 216 unsigned int len;218 socklen_t len; 217 219 int error = ETIMEDOUT; 218 220 if (phb->inpa > 0) … … 309 311 struct hostent *hp; 310 312 struct PHB *phb = data; 311 unsigned int len;313 socklen_t len; 312 314 int error = ETIMEDOUT; 313 315 if (phb->inpa > 0) … … 501 503 int i; 502 504 struct PHB *phb = data; 503 unsigned int len;505 socklen_t len; 504 506 int error = ETIMEDOUT; 505 507 if (phb->inpa > 0) -
nick.c
r1065dd4 reb4ad8d 227 227 { 228 228 nick_strip( irc, rets ); 229 rets[MAX_NICK_LENGTH] = '\0';229 truncate_utf8( rets, MAX_NICK_LENGTH ); 230 230 return rets; 231 231 } … … 252 252 else 253 253 { 254 nick[0] ++; 254 /* We've got no more space for underscores, 255 so truncate it and replace the last three 256 chars with a random "_XX" suffix */ 257 int len = truncate_utf8( nick, MAX_NICK_LENGTH - 3 ); 258 nick[len] = '_'; 259 g_snprintf(nick + len + 1, 3, "%2x", rand() ); 255 260 } 256 261 … … 400 405 if( strlen( down ) > strlen( nick ) ) 401 406 { 402 /* Well crap. Corrupt it if we have to. */ 403 down[strlen(nick)] = '\0'; 407 truncate_utf8( down, strlen( nick ) ); 404 408 } 405 409 strcpy( nick, down ); -
otr.c
r1065dd4 reb4ad8d 1117 1117 void cmd_otr_keygen(irc_t *irc, char **args) 1118 1118 { 1119 int i, n;1120 1119 account_t *a; 1121 1120 1122 n = atoi(args[1]); 1123 if(n<0 || (!n && strcmp(args[1], "0"))) { 1124 irc_rootmsg(irc, "%s: invalid account number", args[1]); 1121 if ((a = account_get(irc->b, args[1])) == NULL) { 1122 irc_rootmsg(irc, "Could not find account `%s'.", args[1]); 1125 1123 return; 1126 1124 } 1127 1125 1128 a = irc->b->accounts; 1129 for(i=0; i<n && a; i++, a=a->next); 1130 if(!a) { 1131 irc_rootmsg(irc, "%s: no such account", args[1]); 1126 if(keygen_in_progress(irc, a->user, a->prpl->name)) { 1127 irc_rootmsg(irc, "keygen for account `%s' already in progress", a->tag); 1132 1128 return; 1133 1129 } 1134 1130 1135 if(keygen_in_progress(irc, a->user, a->prpl->name)) {1136 irc_rootmsg(irc, "keygen for account %d already in progress", n);1137 return;1138 }1139 1140 1131 if(otrl_privkey_find(irc->otr->us, a->user, a->prpl->name)) { 1141 char *s = g_strdup_printf("account %d already has a key, replace it?", n);1132 char *s = g_strdup_printf("account `%s' already has a key, replace it?", a->tag); 1142 1133 query_add(irc, NULL, s, yes_keygen, NULL, NULL, a); 1143 1134 g_free(s); -
protocols/bee_chat.c
r1065dd4 reb4ad8d 85 85 bee_t *bee = ic->bee; 86 86 bee_user_t *bu; 87 gboolean temp; 87 88 char *s; 88 89 … … 92 93 93 94 bu = bee_user_by_handle( bee, ic, who ); 95 temp = ( bu == NULL ); 96 97 if( temp ) 98 bu = bee_user_new( bee, ic, who, BEE_USER_ONLINE ); 94 99 95 100 s = set_getstr( &ic->bee->set, "strip_html" ); … … 98 103 strip_html( msg ); 99 104 100 if( b u && bee->ui->chat_msg )105 if( bee->ui->chat_msg ) 101 106 bee->ui->chat_msg( bee, c, bu, msg, sent_at ); 102 else 103 imcb_chat_log( c, "Message from unknown participant %s: %s", who, msg ); 107 108 if( temp ) 109 bee_user_free( bee, bu ); 104 110 } 105 111 -
protocols/jabber/jabber_util.c
r1065dd4 reb4ad8d 330 330 } 331 331 332 /* Returns a new string. Don't leak it! */ 332 /* The /resource part is case sensitive. This stops once we see a slash. 333 Returns a new string. Don't leak it! */ 333 334 char *jabber_normalize( const char *orig ) 334 335 { 335 int len, i; 336 char *new; 337 338 len = strlen( orig ); 339 new = g_new( char, len + 1 ); 340 341 /* So it turns out the /resource part is case sensitive. Yeah, and 342 it's Unicode but feck Unicode. :-P So stop once we see a slash. */ 343 for( i = 0; i < len && orig[i] != '/' ; i ++ ) 344 new[i] = g_ascii_tolower( orig[i] ); 345 for( ; orig[i]; i ++ ) 346 new[i] = orig[i]; 347 348 new[i] = 0; 336 char *lower, *new, *s; 337 338 if ( ! ( s = strchr( orig, '/' ) ) ) 339 return g_utf8_strdown( orig, -1 ); 340 341 lower = g_utf8_strdown( orig, (s - orig) ); /* stop in s */ 342 new = g_strconcat( lower, s, NULL ); 343 g_free( lower ); 344 return new; 345 } 346 347 /* Similar to jabber_normalize, but works with addresses in the form 348 * resource=chatroom@example.com */ 349 char *jabber_normalize_ext( const char *orig ) 350 { 351 char *lower, *new, *s; 352 353 if ( ! ( s = strchr( orig, '=' ) ) ) 354 return g_utf8_strdown( orig, -1 ); 355 356 lower = g_utf8_strdown( s, -1 ); /* start in s */ 357 358 *s = 0; 359 new = g_strconcat( orig, lower, NULL ); 360 *s = '='; 361 362 g_free( lower ); 349 363 return new; 350 364 } … … 556 570 char *s, *jid; 557 571 558 jid = jabber_normalize ( jid_ );572 jid = jabber_normalize_ext( jid_ ); 559 573 560 574 if( ( s = strchr( jid, '=' ) ) == NULL ) -
protocols/msn/ns.c
r1065dd4 reb4ad8d 881 881 struct msn_buddy_data *bd = bu->data; 882 882 struct msn_data *md = bu->ic->proto_data; 883 char handle[strlen(bu->handle) ];883 char handle[strlen(bu->handle) + 1]; 884 884 char *domain; 885 885 char l[4]; -
protocols/oscar/conn.c
r1065dd4 reb4ad8d 571 571 572 572 if (FD_ISSET(conn->fd, &fds) || FD_ISSET(conn->fd, &wfds)) { 573 unsigned int len = sizeof(error);573 socklen_t len = sizeof(error); 574 574 575 575 if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) -
protocols/twitter/twitter.c
r1065dd4 reb4ad8d 51 51 struct twitter_data *td = ic->proto_data; 52 52 53 char *last_tweet = set_getstr(&ic->acc->set, "_last_tweet"); 54 if (last_tweet) 55 td->timeline_id = g_ascii_strtoull(last_tweet, NULL, 0); 56 53 57 /* Create the room now that we "logged in". */ 54 58 if (td->flags & TWITTER_MODE_CHAT) … … 327 331 s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc); 328 332 333 s = set_add(&acc->set, "_last_tweet", "0", NULL, acc); 334 s->flags |= SET_HIDDEN | SET_NOSAVE; 335 329 336 if (strcmp(acc->prpl->name, "twitter") == 0) { 330 337 s = set_add(&acc->set, "stream", "true", set_eval_bool, acc); -
protocols/twitter/twitter_lib.c
r1065dd4 reb4ad8d 234 234 void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor) 235 235 { 236 // Primitive, but hey! It works... 236 // Primitive, but hey! It works... 237 237 char *args[2]; 238 238 args[0] = "cursor"; 239 args[1] = g_strdup_printf("% lld", (long long)next_cursor);239 args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); 240 240 twitter_http(ic, TWITTER_FRIENDS_IDS_URL, twitter_http_get_friends_ids, ic, 0, args, 2); 241 241 … … 721 721 { 722 722 struct twitter_data *td = ic->proto_data; 723 char *last_id_str; 723 724 724 725 if (status->user == NULL || status->text == NULL) … … 738 739 // we won't pick up the updates already in the list. 739 740 td->timeline_id = MAX(td->timeline_id, status->rt_id); 741 742 last_id_str = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); 743 set_setstr(&ic->acc->set, "last_tweet", last_id_str); 744 g_free(last_id_str); 740 745 } 741 746 … … 997 1002 char *args[6]; 998 1003 args[0] = "cursor"; 999 args[1] = g_strdup_printf("% lld", (long long)next_cursor);1004 args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); 1000 1005 args[2] = "include_entities"; 1001 1006 args[3] = "true"; 1002 1007 if (td->timeline_id) { 1003 1008 args[4] = "since_id"; 1004 args[5] = g_strdup_printf("% llu", (long long unsigned int)td->timeline_id);1009 args[5] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); 1005 1010 } 1006 1011 … … 1033 1038 char *args[6]; 1034 1039 args[0] = "cursor"; 1035 args[1] = g_strdup_printf("% lld", (long long)next_cursor);1040 args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); 1036 1041 args[2] = "include_entities"; 1037 1042 args[3] = "true"; 1038 1043 if (td->timeline_id) { 1039 1044 args[4] = "since_id"; 1040 args[5] = g_strdup_printf("% llu", (long long unsigned int)td->timeline_id);1045 args[5] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); 1041 1046 } else { 1042 1047 args[4] = "count"; … … 1167 1172 "status", msg, 1168 1173 "in_reply_to_status_id", 1169 g_strdup_printf("% llu", (unsigned long long)in_reply_to)1174 g_strdup_printf("%" G_GUINT64_FORMAT, in_reply_to) 1170 1175 }; 1171 1176 twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, … … 1201 1206 { 1202 1207 char *url; 1203 url = g_strdup_printf("%s% llu%s", TWITTER_STATUS_DESTROY_URL,1204 (unsigned long long)id, ".json");1208 url = g_strdup_printf("%s%" G_GUINT64_FORMAT "%s", 1209 TWITTER_STATUS_DESTROY_URL, id, ".json"); 1205 1210 twitter_http_f(ic, url, twitter_http_post, ic, 1, NULL, 0, 1206 1211 TWITTER_HTTP_USER_ACK); … … 1211 1216 { 1212 1217 char *url; 1213 url = g_strdup_printf("%s% llu%s", TWITTER_STATUS_RETWEET_URL,1214 (unsigned long long)id, ".json");1218 url = g_strdup_printf("%s%" G_GUINT64_FORMAT "%s", 1219 TWITTER_STATUS_RETWEET_URL, id, ".json"); 1215 1220 twitter_http_f(ic, url, twitter_http_post, ic, 1, NULL, 0, 1216 1221 TWITTER_HTTP_USER_ACK); … … 1241 1246 NULL, 1242 1247 }; 1243 args[1] = g_strdup_printf("% llu", (unsigned long long)id);1248 args[1] = g_strdup_printf("%" G_GUINT64_FORMAT, id); 1244 1249 twitter_http_f(ic, TWITTER_FAVORITE_CREATE_URL, twitter_http_post, 1245 1250 ic, 1, args, 2, TWITTER_HTTP_USER_ACK); -
protocols/yahoo/libyahoo2.c
r1065dd4 reb4ad8d 974 974 msg = pair->value; 975 975 976 if (pair->key == 13) ; 976 if (pair->key == 13) 977 ; 977 978 if (pair->key == 16) /* error */ 978 979 msg = pair->value; … … 1795 1796 switch (code) 1796 1797 { 1797 case 1212: return YAHOO_LOGIN_PASSWD;1798 case 1213: return YAHOO_LOGIN_LOCK;1799 case 1235: return YAHOO_LOGIN_UNAME;1798 case 1212: return (enum yahoo_status) YAHOO_LOGIN_PASSWD; 1799 case 1213: return (enum yahoo_status) YAHOO_LOGIN_LOCK; 1800 case 1235: return (enum yahoo_status) YAHOO_LOGIN_UNAME; 1800 1801 default: return (enum yahoo_status) code; 1801 1802 } … … 3610 3611 yd = yid->yd; 3611 3612 3612 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE,3613 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, (enum ypacket_status) YAHOO_STATUS_OFFLINE, 3613 3614 yd->session_id); 3614 3615 … … 3677 3678 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { 3678 3679 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, 3679 YAHOO_STATUS_AVAILABLE, 0);3680 (enum ypacket_status) YAHOO_STATUS_AVAILABLE, 0); 3680 3681 yahoo_packet_hash(pkt, 13, "2"); 3681 3682 yahoo_send_packet(yid, pkt, 0); … … 3696 3697 if (old_status == YAHOO_STATUS_INVISIBLE) { 3697 3698 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, 3698 YAHOO_STATUS_AVAILABLE, 0);3699 (enum ypacket_status) YAHOO_STATUS_AVAILABLE, 0); 3699 3700 yahoo_packet_hash(pkt, 13, "1"); 3700 3701 yahoo_send_packet(yid, pkt, 0); -
protocols/yahoo/yahoo_util.h
r1065dd4 reb4ad8d 48 48 49 49 # define snprintf g_snprintf 50 #ifdef vsnprintf 51 #undef vsnprintf 52 #endif 50 53 # define vsnprintf g_vsnprintf 51 54 -
set.c
r1065dd4 reb4ad8d 175 175 int set_setint( set_t **head, const char *key, int value ) 176 176 { 177 char s[24]; /* Not quite 128-bit clean eh? ;-) */178 179 g_ snprintf( s, sizeof( s ), "%d", value);180 return set_setstr( head, key, s );177 char *s = g_strdup_printf( "%d", value ); 178 int retval = set_setstr( head, key, s ); 179 g_free( s ); 180 return retval; 181 181 } 182 182 -
tests/check_arc.c
r1065dd4 reb4ad8d 88 88 &decrypted, password ); 89 89 90 fail_if( len == -1, 91 "`%s' didn't decrypt properly", decrypt_tests[i].decrypted ); 90 92 fail_if( strcmp( decrypt_tests[i].decrypted, decrypted ) != 0, 91 93 "`%s' didn't decrypt properly", decrypt_tests[i].decrypted ); -
tests/check_irc.c
r1065dd4 reb4ad8d 28 28 GIOChannel *ch1, *ch2; 29 29 irc_t *irc; 30 GError *error = NULL;31 30 char *raw; 32 31 fail_unless(g_io_channel_pair(&ch1, &ch2)); -
tests/check_jabber_sasl.c
r1065dd4 reb4ad8d 87 87 tcase_fn_start( get_part_tests[i].key, __FILE__, i ); 88 88 char *res; 89 int len;90 89 91 90 res = sasl_get_part( get_part_tests[i].challenge,
Note: See TracChangeset
for help on using the changeset viewer.