comparison src/protocols/irc/irc.c @ 3030:e40c30cf7572

[gaim-migrate @ 3043] Told you I should have looked it over better. It still has issues... I'll do them later. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 11 Mar 2002 06:14:46 +0000
parents 21895719464c
children 1143524a2eaf
comparison
equal deleted inserted replaced
3029:21895719464c 3030:e40c30cf7572
1430 char *tmp = g_strdup(what); 1430 char *tmp = g_strdup(what);
1431 GString *str = encode_html(tmp); 1431 GString *str = encode_html(tmp);
1432 struct dcc_chat *dccchat = find_dcc_chat(gc, who); 1432 struct dcc_chat *dccchat = find_dcc_chat(gc, who);
1433 struct irc_data *id = gc->proto_data; 1433 struct irc_data *id = gc->proto_data;
1434 g_free(tmp); 1434 g_free(tmp);
1435 what = str->str;
1435 if (*what != '/') { 1436 if (*what != '/') {
1436 unsigned int max = 440 - strlen(who); 1437 unsigned int max = 440 - strlen(who);
1437 char t; 1438 char t;
1438 while (strlen(what) > max) { 1439 while (strlen(what) > max) {
1439 t = what[max]; 1440 t = what[max];
1440 what[max] = 0; 1441 what[max] = 0;
1441 if (dccchat) { 1442 if (dccchat) {
1442 g_snprintf(buf, sizeof(buf), "%s\r\n", str->str); 1443 g_snprintf(buf, sizeof(buf), "%s\r\n", what);
1443 irc_write(dccchat->fd, buf, strlen(buf)); 1444 irc_write(dccchat->fd, buf, strlen(buf));
1444 g_string_free(str, TRUE); 1445 g_string_free(str, TRUE);
1445 return 1; 1446 return 1;
1446 } 1447 }
1447 g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", who, str->str); 1448 g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", who, what);
1448 irc_write(id->fd, buf, strlen(buf)); 1449 irc_write(id->fd, buf, strlen(buf));
1449 what[max] = t; 1450 what[max] = t;
1450 what = what + max; 1451 what = what + max;
1451 } 1452 }
1452 if (dccchat) { 1453 if (dccchat) {
1453 g_snprintf(buf, sizeof(buf), "%s\r\n", str->str); 1454 g_snprintf(buf, sizeof(buf), "%s\r\n", what);
1454 irc_write(dccchat->fd, buf, strlen(buf)); 1455 irc_write(dccchat->fd, buf, strlen(buf));
1455 g_string_free(str, TRUE); 1456 g_string_free(str, TRUE);
1456 return 1; 1457 return 1;
1457 } 1458 }
1458 g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", who, str->str); 1459 g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", who, what);
1459 irc_write(id->fd, buf, strlen(buf)); 1460 irc_write(id->fd, buf, strlen(buf));
1460 g_string_free(str, TRUE); 1461 g_string_free(str, TRUE);
1461 return 1; 1462 return 1;
1462 } 1463 }
1463 1464
1464 what++; 1465 what++;
1465 process_data_init(pdibuf, str->str, word, word_eol, TRUE); 1466 process_data_init(pdibuf, what, word, word_eol, TRUE);
1466 g_string_free(str, TRUE); 1467 g_string_free(str, TRUE);
1467 if (!g_strcasecmp(pdibuf, "ME")) { 1468 if (!g_strcasecmp(pdibuf, "ME")) {
1468 if (dccchat) { 1469 if (dccchat) {
1469 g_snprintf(buf, sizeof(buf), "\001ACTION %s\001\r\n", word_eol[2]); 1470 g_snprintf(buf, sizeof(buf), "\001ACTION %s\001\r\n", word_eol[2]);
1470 irc_write(dccchat->fd, buf, strlen(buf)); 1471 irc_write(dccchat->fd, buf, strlen(buf));