comparison src/protocols/gg/lib/events.c @ 12218:9cbc5967fbfd

[gaim-migrate @ 14520] Crush some warnings. I ran this by Bartosz Oler and made some corrections at his suggestion. I'll be submitting this upstream and merging any changes they suggest/make-when-accepting. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 25 Nov 2005 00:32:45 +0000
parents 3c536224f0d0
children
comparison
equal deleted inserted replaced
12217:029802981b81 12218:9cbc5967fbfd
1 /* $Id: events.c 13801 2005-09-14 19:10:39Z datallah $ */ 1 /* $Id: events.c 14520 2005-11-25 00:32:45Z rlaager $ */
2 2
3 /* 3 /*
4 * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl> 4 * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
5 * Robert J. Woźny <speedy@ziew.org> 5 * Robert J. Woźny <speedy@ziew.org>
6 * Arkadiusz Miśkiewicz <arekm@pld-linux.org> 6 * Arkadiusz Miśkiewicz <arekm@pld-linux.org>
192 gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() unknown image from %d, size=%d, crc32=%.8x\n", sender, i->size, i->crc32); 192 gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() unknown image from %d, size=%d, crc32=%.8x\n", sender, i->size, i->crc32);
193 return; 193 return;
194 } 194 }
195 195
196 if (p[0] == 0x05) { 196 if (p[0] == 0x05) {
197 int i, ok = 0; 197 unsigned int i, ok = 0;
198 198
199 q->done = 0; 199 q->done = 0;
200 200
201 len -= sizeof(struct gg_msg_image_reply); 201 len -= sizeof(struct gg_msg_image_reply);
202 p += sizeof(struct gg_msg_image_reply); 202 p += sizeof(struct gg_msg_image_reply);
418 418
419 e->type = GG_EVENT_MSG; 419 e->type = GG_EVENT_MSG;
420 e->event.msg.msgclass = gg_fix32(r->msgclass); 420 e->event.msg.msgclass = gg_fix32(r->msgclass);
421 e->event.msg.sender = gg_fix32(r->sender); 421 e->event.msg.sender = gg_fix32(r->sender);
422 e->event.msg.time = gg_fix32(r->time); 422 e->event.msg.time = gg_fix32(r->time);
423 e->event.msg.message = strdup((char*) r + sizeof(*r)); 423 e->event.msg.message = (unsigned char *)strdup((char*) r + sizeof(*r));
424 424
425 return 0; 425 return 0;
426 426
427 malformed: 427 malformed:
428 e->type = GG_EVENT_NONE; 428 e->type = GG_EVENT_NONE;
893 } 893 }
894 894
895 case GG_STATE_CONNECTING_HUB: 895 case GG_STATE_CONNECTING_HUB:
896 { 896 {
897 char buf[1024], *client, *auth; 897 char buf[1024], *client, *auth;
898 int res = 0, res_size = sizeof(res); 898 int res = 0;
899 socklen_t res_size = sizeof(res);
899 const char *host, *appmsg; 900 const char *host, *appmsg;
900 901
901 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n"); 902 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n");
902 903
903 /* jeśli asynchroniczne, sprawdzamy, czy nie wystąpił 904 /* jeśli asynchroniczne, sprawdzamy, czy nie wystąpił
1077 } 1078 }
1078 1079
1079 e->type = GG_EVENT_MSG; 1080 e->type = GG_EVENT_MSG;
1080 e->event.msg.msgclass = atoi(buf); 1081 e->event.msg.msgclass = atoi(buf);
1081 e->event.msg.sender = 0; 1082 e->event.msg.sender = 0;
1082 e->event.msg.message = sysmsg_buf; 1083 e->event.msg.message = (unsigned char *)sysmsg_buf;
1083 } 1084 }
1084 1085
1085 close(sess->fd); 1086 close(sess->fd);
1086 1087
1087 gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() received http data (%s)\n", buf); 1088 gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() received http data (%s)\n", buf);
1144 break; 1145 break;
1145 } 1146 }
1146 1147
1147 case GG_STATE_CONNECTING_GG: 1148 case GG_STATE_CONNECTING_GG:
1148 { 1149 {
1149 int res = 0, res_size = sizeof(res); 1150 int res = 0;
1151 socklen_t res_size = sizeof(res);
1150 1152
1151 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n"); 1153 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n");
1152 1154
1153 /* jeśli wystąpił błąd podczas łączenia się... */ 1155 /* jeśli wystąpił błąd podczas łączenia się... */
1154 if (sess->async && (sess->timeout == 0 || getsockopt(sess->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { 1156 if (sess->async && (sess->timeout == 0 || getsockopt(sess->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) {
1335 { 1337 {
1336 struct gg_header *h; 1338 struct gg_header *h;
1337 struct gg_welcome *w; 1339 struct gg_welcome *w;
1338 struct gg_login60 l; 1340 struct gg_login60 l;
1339 unsigned int hash; 1341 unsigned int hash;
1340 unsigned char *password = sess->password; 1342 char *password = sess->password;
1341 int ret; 1343 int ret;
1342 1344
1343 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_KEY\n"); 1345 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_KEY\n");
1344 1346
1345 memset(&l, 0, sizeof(l)); 1347 memset(&l, 0, sizeof(l));
1396 } 1398 }
1397 1399
1398 w = (struct gg_welcome*) ((char*) h + sizeof(struct gg_header)); 1400 w = (struct gg_welcome*) ((char*) h + sizeof(struct gg_header));
1399 w->key = gg_fix32(w->key); 1401 w->key = gg_fix32(w->key);
1400 1402
1401 hash = gg_login_hash(password, w->key); 1403 hash = gg_login_hash((unsigned char *)password, w->key);
1402 1404
1403 gg_debug(GG_DEBUG_DUMP, "// gg_watch_fd() challenge %.4x --> hash %.8x\n", w->key, hash); 1405 gg_debug(GG_DEBUG_DUMP, "// gg_watch_fd() challenge %.4x --> hash %.8x\n", w->key, hash);
1404 1406
1405 free(h); 1407 free(h);
1406 1408
1413 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() gg_dcc_ip = %s\n", inet_ntoa(dcc_ip)); 1415 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() gg_dcc_ip = %s\n", inet_ntoa(dcc_ip));
1414 } 1416 }
1415 1417
1416 if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) { 1418 if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) {
1417 struct sockaddr_in sin; 1419 struct sockaddr_in sin;
1418 int sin_len = sizeof(sin); 1420 socklen_t sin_len = sizeof(sin);
1419 1421
1420 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n"); 1422 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n");
1421 1423
1422 if (!getsockname(sess->fd, (struct sockaddr*) &sin, &sin_len)) { 1424 if (!getsockname(sess->fd, (struct sockaddr*) &sin, &sin_len)) {
1423 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detected address to %s\n", inet_ntoa(sin.sin_addr)); 1425 gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detected address to %s\n", inet_ntoa(sin.sin_addr));