From libgadu-commit at lists.ziew.org Wed Jan 13 01:06:10 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:06:10 +0100 Subject: [libgadu-commit] r885 - trunk/docs Message-ID: <20100113000611.1E82D17B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:06:10 +0100 (Wed, 13 Jan 2010) New Revision: 885 Modified: trunk/docs/protocol.html Log: Poprawka obrazk?w w HTML-u (Bart?omiej Zimo?) Modified: trunk/docs/protocol.html =================================================================== --- trunk/docs/protocol.html 2009-12-30 00:34:00 UTC (rev 884) +++ trunk/docs/protocol.html 2010-01-13 00:06:10 UTC (rev 885) @@ -693,7 +693,7 @@
  • czcionka — <span style="font-family:'...' ">
  • rozmiar czcionki — <span style="font-size:...pt ">
  • nowa linia — <br>
  • -
  • obrazek — <img src="...">
  • +
  • obrazek — <img name="...">
  • @@ -709,7 +709,7 @@

    -<span style="background-color:#00ff00; color:#000000; font-family:'MS Shell Dlg 2'; font-size:9pt; "><b><i><u>Wiadomo??<br>testowa</u></i></b><img src="45fb2e46000040b8"></span> +<span style="background-color:#00ff00; color:#000000; font-family:'MS Shell Dlg 2'; font-size:9pt; "><b><i><u>Wiadomo??<br>testowa</u></i></b><img name="45fb2e46000040b8"></span>
    From libgadu-commit at lists.ziew.org Wed Jan 13 01:14:54 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:14:54 +0100 Subject: [libgadu-commit] r886 - branches/1.9/src Message-ID: <20100113001455.0956917B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:14:54 +0100 (Wed, 13 Jan 2010) New Revision: 886 Modified: branches/1.9/src/libgadu.c Log: Poprawka obrazk?w w HTML-u (Bart?omiej Zimo?) Modified: branches/1.9/src/libgadu.c =================================================================== --- branches/1.9/src/libgadu.c 2010-01-13 00:06:10 UTC (rev 885) +++ branches/1.9/src/libgadu.c 2010-01-13 00:14:54 UTC (rev 886) @@ -1312,8 +1312,8 @@ { const char span_fmt[] = ""; const int span_len = 75; - const char img_fmt[] = ""; - const int img_len = 28; + const char img_fmt[] = ""; + const int img_len = 29; int char_pos = 0; int format_idx = 3; unsigned char old_attr = 0; From libgadu-commit at lists.ziew.org Wed Jan 13 01:18:59 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:18:59 +0100 Subject: [libgadu-commit] r887 - branches/new-api Message-ID: <20100113001900.000F617B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:18:59 +0100 (Wed, 13 Jan 2010) New Revision: 887 Modified: branches/new-api/configure.ac Log: Wykrywanie libxml do test?w automatycznych. Modified: branches/new-api/configure.ac =================================================================== --- branches/new-api/configure.ac 2010-01-13 00:14:54 UTC (rev 886) +++ branches/new-api/configure.ac 2010-01-13 00:18:59 UTC (rev 887) @@ -239,6 +239,23 @@ fi dnl +dnl Sprawd?, czy mamy libxml2 do test?w automatycznych +dnl + +export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" + +PKG_PROG_PKG_CONFIG + +if test "x$PKG_CONFIG" != "x"; then + PKG_CHECK_MODULES([LIBXML2], [libxml-2.0]) + AC_SUBST([LIBXML2_CFLAGS]) + AC_SUBST([LIBXML2_LIBS]) + if test "x$LIBXML2_LIBS" != "x"; then + AC_DEFINE([HAVE_LIBXML2], [], [Defined if libxml2 is available.]) + fi +fi + +dnl dnl Sprawd?, czy mamy czym generowa? dokumentacj? dnl From libgadu-commit at lists.ziew.org Wed Jan 13 01:19:45 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:19:45 +0100 Subject: [libgadu-commit] r888 - branches/new-api/test/automatic Message-ID: <20100113001945.E55C017B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:19:45 +0100 (Wed, 13 Jan 2010) New Revision: 888 Modified: branches/new-api/test/automatic/connect.c Log: Poprawne udawanie huba. Modified: branches/new-api/test/automatic/connect.c =================================================================== --- branches/new-api/test/automatic/connect.c 2010-01-13 00:18:59 UTC (rev 887) +++ branches/new-api/test/automatic/connect.c 2010-01-13 00:19:45 UTC (rev 888) @@ -516,7 +516,7 @@ len += res; if (strstr(buf, "\r\n\r\n")) { - snprintf(buf, sizeof(buf), "HTTP/1.0 200 OK\r\n\r\n0 %s:%d %s\r\n", LOCALHOST, 8074, LOCALHOST); + snprintf(buf, sizeof(buf), "HTTP/1.0 200 OK\r\n\r\n0 0 %s:%d %s\r\n", LOCALHOST, 8074, LOCALHOST); send(cfds[0], buf, strlen(buf), 0); close(cfds[0]); cfds[0] = -1; From libgadu-commit at lists.ziew.org Wed Jan 13 01:28:59 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:28:59 +0100 Subject: [libgadu-commit] r889 - branches/new-api/include Message-ID: <20100113002859.583B617B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:28:58 +0100 (Wed, 13 Jan 2010) New Revision: 889 Modified: branches/new-api/include/message.h Log: Poprawki typ?w. Modified: branches/new-api/include/message.h =================================================================== --- branches/new-api/include/message.h 2010-01-13 00:19:45 UTC (rev 888) +++ branches/new-api/include/message.h 2010-01-13 00:28:58 UTC (rev 889) @@ -25,7 +25,7 @@ struct gg_message { uin_t *recipients; - unsigned int recipient_count; + size_t recipient_count; char *text; char *html; char *attributes; @@ -44,7 +44,7 @@ return (result); \ } -int gg_message_init(gg_message_t *gm, int msgclass, int seq, uin_t *recipients, int recipient_count, char *text, char *xhtml, char *attributes, size_t attributes_length, int auto_convert); +int gg_message_init(gg_message_t *gm, int msgclass, int seq, uin_t *recipients, size_t recipient_count, char *text, char *xhtml, char *attributes, size_t attributes_length, int auto_convert); size_t gg_message_html_to_text(char *dst, const char *html); size_t gg_message_text_to_html(char *dst, const char *utf_msg, const char *format, size_t format_len); From libgadu-commit at lists.ziew.org Wed Jan 13 01:29:16 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:29:16 +0100 Subject: [libgadu-commit] r890 - branches/new-api/src Message-ID: <20100113002916.E9BBF17B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:29:16 +0100 (Wed, 13 Jan 2010) New Revision: 890 Modified: branches/new-api/src/encoding.c Log: Formatowanie. Modified: branches/new-api/src/encoding.c =================================================================== --- branches/new-api/src/encoding.c 2010-01-13 00:28:58 UTC (rev 889) +++ branches/new-api/src/encoding.c 2010-01-13 00:29:16 UTC (rev 890) @@ -33,11 +33,12 @@ /** * \internal Tablica konwersji CP1250 na Unikod. */ -static const uint16_t table_cp1250[] = { - 0x20ac, '?', 0x201a, '?', 0x201e, 0x2026, 0x2020, 0x2021, - '?', 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, - '?', 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - '?', 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, +static const uint16_t table_cp1250[] = +{ + 0x20ac, '?', 0x201a, '?', 0x201e, 0x2026, 0x2020, 0x2021, + '?', 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, + '?', 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + '?', 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, 0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, From libgadu-commit at lists.ziew.org Wed Jan 13 01:29:53 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 01:29:53 +0100 Subject: [libgadu-commit] r891 - branches/new-api/src Message-ID: <20100113002953.6CBF917B47@toxygen.net> Author: wojtekka Date: 2010-01-13 01:29:52 +0100 (Wed, 13 Jan 2010) New Revision: 891 Modified: branches/new-api/src/events.c branches/new-api/src/handlers.c Log: Kosmetyka. Modified: branches/new-api/src/events.c =================================================================== --- branches/new-api/src/events.c 2010-01-13 00:29:16 UTC (rev 890) +++ branches/new-api/src/events.c 2010-01-13 00:29:52 UTC (rev 891) @@ -479,7 +479,7 @@ gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() %s\n", gg_debug_state(sess->state)); if (sess->resolver_index >= sess->resolver_count) { - gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() out of address to connect to\n"); + gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() out of addresses to connect to\n"); e->event.failure = GG_FAILURE_CONNECTING; goto fail; } @@ -715,12 +715,13 @@ goto fail; } - // 17591 0 91.197.13.71:8074 91.197.13.71 #ifdef GG_CONFIG_HAVE_OPENSSL if (sess->ssl != NULL) + // 0 17591 0 91.197.13.71:443 91.197.13.71 res = sscanf(body, "%*d %d %*d %32s", &reply, host); else #endif + // 17591 0 91.197.13.71:8074 91.197.13.71 res = sscanf(body, "%d %*d %32s", &reply, host); if (res != 2) { Modified: branches/new-api/src/handlers.c =================================================================== --- branches/new-api/src/handlers.c 2010-01-13 00:29:16 UTC (rev 890) +++ branches/new-api/src/handlers.c 2010-01-13 00:29:52 UTC (rev 891) @@ -1204,7 +1204,8 @@ return 0; } -static const gg_packet_handler_t handlers[] = { +static const gg_packet_handler_t handlers[] = +{ { GG_WELCOME, GG_STATE_READING_KEY, 0, gg_session_handle_welcome }, { GG_LOGIN_OK, GG_STATE_READING_REPLY, 0, gg_session_handle_login_ok }, { GG_LOGIN_OK80, GG_STATE_READING_REPLY, 0, gg_session_handle_login_ok }, From libgadu-commit at lists.ziew.org Wed Jan 13 02:24:50 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 02:24:50 +0100 Subject: [libgadu-commit] r892 - branches/new-api/test/automatic Message-ID: <20100113012450.6D27317B47@toxygen.net> Author: wojtekka Date: 2010-01-13 02:24:49 +0100 (Wed, 13 Jan 2010) New Revision: 892 Modified: branches/new-api/test/automatic/convert.c Log: Tablicowanie test?w. Modified: branches/new-api/test/automatic/convert.c =================================================================== --- branches/new-api/test/automatic/convert.c 2010-01-13 00:29:52 UTC (rev 891) +++ branches/new-api/test/automatic/convert.c 2010-01-13 01:24:49 UTC (rev 892) @@ -6,11 +6,119 @@ // - testowanie ci?cia tekst?w na wej?ciu i wyj?ciu, // - testowanie czy ci?cie nie potnie znak?w UTF-8 w ?rodku, // - ... +// TODO ograniczanie string?w + #include "encoding.h" -void test_utf8(const char *input, int src_len, int dst_len, const char *match) +struct test_data { + const char *src; + const char *dst; + ssize_t src_len; + ssize_t dst_len; +}; + +#define TEST(src,dst) { src, dst, -1, -1 } +#define TEST_SIZE(src,dst,src_len,dst_len) { src, dst, src_len, dst_len } + +const struct test_data utf8_to_cp1250[] = +{ + TEST("za???? g??l? ja??", "za\xbf\xf3\xb3\xe6 g\xea\x9cl\xb9 ja\x9f\xf1"), + + TEST("\xc0", "?"), + TEST("\xc0test", "?test"), + TEST("\xc0\x80", "?"), + TEST("\xc0\x80test", "?test"), + TEST("\xc0\x80\x80", "?"), + TEST("\xc0\x80\x80test", "?test"), + TEST("\xc0\x80\x80\x80", "?"), + TEST("\xc0\x80\x80\x80test", "?test"), + TEST("\xc0\x80\x80\x80\x80", "?"), + TEST("\xc0\x80\x80\x80\x80test", "?test"), + TEST("\xc0\x80\x80\x80\x80\x80", "?"), + TEST("\xc0\x80\x80\x80\x80\x80test", "?test"), + TEST("\xc0\x80\x80\x80\x80\x80\x80", "?"), + TEST("\xc0\x80\x80\x80\x80\x80\x80test", "?test"), + TEST("\xc0\x80\x80\x80\x80\x80\x80\x80", "?"), + TEST("\xc0\x80\x80\x80\x80\x80\x80\x80test", "?test"), + + TEST("\xc1", "?"), + TEST("\xc1test", "?test"), + TEST("\xc1\x80", "?"), + TEST("\xc1\x80test", "?test"), + + TEST("\xc0\xc1", "??"), + TEST("\xc0\xc1test", "??test"), + TEST("\xc0test\xc1test", "?test?test"), + TEST("\xc0\x80\xc1\x80test", "??test"), + TEST("\xc0\x80test\xc1\x80test", "?test?test"), + + TEST("\xe0", "?"), + TEST("\xe0test", "?test"), + TEST("\xe0\x80", "?"), + TEST("\xe0\x80test", "?test"), + TEST("\xe0\x80\x80", "?"), + TEST("\xe0\x80\x80test", "?test"), + + TEST("\xf0", "?"), + TEST("\xf0test", "?test"), + TEST("\xf0\x80", "?"), + TEST("\xf0\x80test", "?test"), + TEST("\xf0\x80\x80", "?"), + TEST("\xf0\x80\x80test", "?test"), + TEST("\xf0\x80\x80\x80", "?"), + TEST("\xf0\x80\x80\x80test", "?test"), + + TEST("\xf5", "?"), + TEST("\xf5test", "?test"), + TEST("\xf5\x80", "?"), + TEST("\xf5\x80test", "?test"), + TEST("\xf5\x80\x80", "?"), + TEST("\xf5\x80\x80test", "?test"), + TEST("\xf5\x80\x80\x80", "?"), + TEST("\xf5\x80\x80\x80test", "?test"), + + TEST("\xf8", "?"), + TEST("\xf8test", "?test"), + TEST("\xf8\x80", "?"), + TEST("\xf8\x80test", "?test"), + TEST("\xf8\x80\x80", "?"), + TEST("\xf8\x80\x80test", "?test"), + TEST("\xf8\x80\x80\x80", "?"), + TEST("\xf8\x80\x80\x80test", "?test"), + TEST("\xf8\x80\x80\x80\x80", "?"), + TEST("\xf8\x80\x80\x80\x80test", "?test"), + + TEST("\xfc", "?"), + TEST("\xfctest", "?test"), + TEST("\xfc\x80", "?"), + TEST("\xfc\x80test", "?test"), + TEST("\xfc\x80\x80", "?"), + TEST("\xfc\x80\x80test", "?test"), + TEST("\xfc\x80\x80\x80", "?"), + TEST("\xfc\x80\x80\x80test", "?test"), + TEST("\xfc\x80\x80\x80\x80", "?"), + TEST("\xfc\x80\x80\x80\x80test", "?test"), + TEST("\xfc\x80\x80\x80\x80\x80", "?"), + TEST("\xfc\x80\x80\x80\x80\x80test", "?test"), + + TEST("\xfe", "?"), + TEST("\xfetest", "?test"), + TEST("\xff", "?"), + TEST("\xfftest", "?test"), + + TEST("\xef\xbb\xbf", ""), + TEST("\xef\xbb\xbftest", "test"), +}; + +const struct test_data cp1250_to_utf8[] = +{ + TEST("za\xbf\xf3\xb3\xe6 g\xea\x9cl\xb9 ja\x9f\xf1", "za???? g??l? ja??"), +}; + +void test_utf8(const char *input, const char *match, int src_len, int dst_len) +{ char *output; output = gg_encoding_convert(input, GG_ENCODING_UTF8, GG_ENCODING_CP1250, src_len, dst_len); @@ -23,7 +131,7 @@ free(output); } -void test_cp1250(const char *input, int src_len, int dst_len, const char *match) +void test_cp1250(const char *input, const char *match, int src_len, int dst_len) { char *output; @@ -39,97 +147,14 @@ int main(void) { - test_utf8("za???? g??l? ja??", -1, -1, "za\xbf\xf3\xb3\xe6 g\xea\x9cl\xb9 ja\x9f\xf1"); + int i; - test_utf8("\xc0", -1, -1, "?"); - test_utf8("\xc0test", -1, -1, "?test"); - test_utf8("\xc0\x80", -1, -1, "?"); - test_utf8("\xc0\x80test", -1, -1, "?test"); - test_utf8("\xc0\x80\x80", -1, -1, "?"); - test_utf8("\xc0\x80\x80test", -1, -1, "?test"); - test_utf8("\xc0\x80\x80\x80", -1, -1, "?"); - test_utf8("\xc0\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xc0\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xc0\x80\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xc0\x80\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xc0\x80\x80\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xc0\x80\x80\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xc0\x80\x80\x80\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xc0\x80\x80\x80\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xc0\x80\x80\x80\x80\x80\x80\x80test", -1, -1, "?test"); + for (i = 0; i < sizeof(cp1250_to_utf8) / sizeof(cp1250_to_utf8[0]); i++) + test_cp1250(cp1250_to_utf8[i].src, cp1250_to_utf8[i].dst, cp1250_to_utf8[i].src_len, cp1250_to_utf8[i].dst_len); - test_utf8("\xc1", -1, -1, "?"); - test_utf8("\xc1test", -1, -1, "?test"); - test_utf8("\xc1\x80", -1, -1, "?"); - test_utf8("\xc1\x80test", -1, -1, "?test"); + for (i = 0; i < sizeof(utf8_to_cp1250) / sizeof(utf8_to_cp1250[0]); i++) + test_cp1250(utf8_to_cp1250[i].src, utf8_to_cp1250[i].dst, utf8_to_cp1250[i].src_len, utf8_to_cp1250[i].dst_len); - test_utf8("\xc0\xc1", -1, -1, "??"); - test_utf8("\xc0\xc1test", -1, -1, "??test"); - test_utf8("\xc0test\xc1test", -1, -1, "?test?test"); - test_utf8("\xc0\x80\xc1\x80test", -1, -1, "??test"); - test_utf8("\xc0\x80test\xc1\x80test", -1, -1, "?test?test"); - - test_utf8("\xe0", -1, -1, "?"); - test_utf8("\xe0test", -1, -1, "?test"); - test_utf8("\xe0\x80", -1, -1, "?"); - test_utf8("\xe0\x80test", -1, -1, "?test"); - test_utf8("\xe0\x80\x80", -1, -1, "?"); - test_utf8("\xe0\x80\x80test", -1, -1, "?test"); - - test_utf8("\xf0", -1, -1, "?"); - test_utf8("\xf0test", -1, -1, "?test"); - test_utf8("\xf0\x80", -1, -1, "?"); - test_utf8("\xf0\x80test", -1, -1, "?test"); - test_utf8("\xf0\x80\x80", -1, -1, "?"); - test_utf8("\xf0\x80\x80test", -1, -1, "?test"); - test_utf8("\xf0\x80\x80\x80", -1, -1, "?"); - test_utf8("\xf0\x80\x80\x80test", -1, -1, "?test"); - - test_utf8("\xf5", -1, -1, "?"); - test_utf8("\xf5test", -1, -1, "?test"); - test_utf8("\xf5\x80", -1, -1, "?"); - test_utf8("\xf5\x80test", -1, -1, "?test"); - test_utf8("\xf5\x80\x80", -1, -1, "?"); - test_utf8("\xf5\x80\x80test", -1, -1, "?test"); - test_utf8("\xf5\x80\x80\x80", -1, -1, "?"); - test_utf8("\xf5\x80\x80\x80test", -1, -1, "?test"); - - test_utf8("\xf8", -1, -1, "?"); - test_utf8("\xf8test", -1, -1, "?test"); - test_utf8("\xf8\x80", -1, -1, "?"); - test_utf8("\xf8\x80test", -1, -1, "?test"); - test_utf8("\xf8\x80\x80", -1, -1, "?"); - test_utf8("\xf8\x80\x80test", -1, -1, "?test"); - test_utf8("\xf8\x80\x80\x80", -1, -1, "?"); - test_utf8("\xf8\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xf8\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xf8\x80\x80\x80\x80test", -1, -1, "?test"); - - test_utf8("\xfc", -1, -1, "?"); - test_utf8("\xfctest", -1, -1, "?test"); - test_utf8("\xfc\x80", -1, -1, "?"); - test_utf8("\xfc\x80test", -1, -1, "?test"); - test_utf8("\xfc\x80\x80", -1, -1, "?"); - test_utf8("\xfc\x80\x80test", -1, -1, "?test"); - test_utf8("\xfc\x80\x80\x80", -1, -1, "?"); - test_utf8("\xfc\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xfc\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xfc\x80\x80\x80\x80test", -1, -1, "?test"); - test_utf8("\xfc\x80\x80\x80\x80\x80", -1, -1, "?"); - test_utf8("\xfc\x80\x80\x80\x80\x80test", -1, -1, "?test"); - - test_utf8("\xfe", -1, -1, "?"); - test_utf8("\xfetest", -1, -1, "?test"); - test_utf8("\xff", -1, -1, "?"); - test_utf8("\xfftest", -1, -1, "?test"); - - test_utf8("\xef\xbb\xbf", -1, -1, ""); - test_utf8("\xef\xbb\xbftest", -1, -1, "test"); - - test_cp1250("za\xbf\xf3\xb3\xe6 g\xea\x9cl\xb9 ja\x9f\xf1", -1, -1, "za???? g??l? ja??"); - - // TODO ograniczanie string?w - printf("okay\n"); return 0; From libgadu-commit at lists.ziew.org Wed Jan 13 02:25:39 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 02:25:39 +0100 Subject: [libgadu-commit] r893 - branches/new-api/test/automatic Message-ID: <20100113012539.577DB17B47@toxygen.net> Author: wojtekka Date: 2010-01-13 02:25:38 +0100 (Wed, 13 Jan 2010) New Revision: 893 Modified: branches/new-api/test/automatic/protocol.c Log: Usuni?cie starego kodu testowego. Modified: branches/new-api/test/automatic/protocol.c =================================================================== --- branches/new-api/test/automatic/protocol.c 2010-01-13 01:24:49 UTC (rev 892) +++ branches/new-api/test/automatic/protocol.c 2010-01-13 01:25:38 UTC (rev 893) @@ -347,7 +347,7 @@ } if ((script[state].event != -1 && ge->type != script[state].event)) { - error(state, "Invalid event %d, expected %d/%d/%d\n", ge->type, script[state].event, GG_EVENT_NOTIFY60, GG_EVENT_STATUS60); + error(state, "Invalid event %d, expected %d\n", ge->type, script[state].event); exit(1); } From libgadu-commit at lists.ziew.org Wed Jan 13 02:26:46 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 02:26:46 +0100 Subject: [libgadu-commit] r894 - branches/new-api/test/automatic/script Message-ID: <20100113012647.196F217B47@toxygen.net> Author: wojtekka Date: 2010-01-13 02:26:46 +0100 (Wed, 13 Jan 2010) New Revision: 894 Modified: branches/new-api/test/automatic/script/30-status.scr Log: Poprawna zmiana stanu. Modified: branches/new-api/test/automatic/script/30-status.scr =================================================================== --- branches/new-api/test/automatic/script/30-status.scr 2010-01-13 01:25:38 UTC (rev 893) +++ branches/new-api/test/automatic/script/30-status.scr 2010-01-13 01:26:46 UTC (rev 894) @@ -75,7 +75,7 @@ #----------------------------------------------------------------------------- call { - gg_change_status_descr_time(session, GG_STATUS_AVAIL, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0x12345678); + gg_change_status_descr_time(session, GG_STATUS_AVAIL_DESCR, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0x12345678); } expect data (38 00 00 00, 0b 01 00 00, 02 00 00 00, 01 00 80 00, ff 00 00 00, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") From libgadu-commit at lists.ziew.org Wed Jan 13 03:00:43 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 03:00:43 +0100 Subject: [libgadu-commit] r895 - branches/new-api/test/automatic Message-ID: <20100113020043.B63FE17B47@toxygen.net> Author: wojtekka Date: 2010-01-13 03:00:43 +0100 (Wed, 13 Jan 2010) New Revision: 895 Added: branches/new-api/test/automatic/message1.c branches/new-api/test/automatic/message2.c Removed: branches/new-api/test/automatic/message.c Modified: branches/new-api/test/automatic/Makefile.am Log: Dok?adniejsze testy konwersji HTML <-> czysty tekst. Modified: branches/new-api/test/automatic/Makefile.am =================================================================== --- branches/new-api/test/automatic/Makefile.am 2010-01-13 01:26:46 UTC (rev 894) +++ branches/new-api/test/automatic/Makefile.am 2010-01-13 02:00:43 UTC (rev 895) @@ -1,10 +1,13 @@ -noinst_PROGRAMS = protocol convert message $(OPTIONAL_TESTS) -EXTRA_PROGRAMS = protocol convert message connect packet resolver +noinst_PROGRAMS = protocol convert message2 message1 $(OPTIONAL_TESTS) +EXTRA_PROGRAMS = protocol convert message2 message1 connect packet resolver CFLAGS = -Wall -ggdb protocol_LDADD = $(top_builddir)/src/libgadu.la convert_LDADD = $(top_builddir)/src/libgadu.la -message_LDADD = $(top_builddir)/src/libgadu_la-message.lo +message1_SOURCES = message1.c +message2_SOURCES = message2.c $(top_builddir)/src/message.c +message2_LDADD = @LIBXML2_LIBS@ +message2_CFLAGS = @LIBXML2_CFLAGS@ connect_LDADD = $(top_builddir)/src/libgadu.la packet_LDADD = $(top_builddir)/src/libgadu.la resolver_LDADD = $(top_builddir)/src/libgadu.la Deleted: branches/new-api/test/automatic/message.c =================================================================== --- branches/new-api/test/automatic/message.c 2010-01-13 01:26:46 UTC (rev 894) +++ branches/new-api/test/automatic/message.c 2010-01-13 02:00:43 UTC (rev 895) @@ -1,68 +0,0 @@ -#include "message.h" - -void test_text_to_html(const char *input, const char *output) -{ - char *result; - size_t len; - - len = gg_message_text_to_html(NULL, input, NULL, 0); - - result = malloc(len + 1); - - if (result == NULL) { - perror("gg_message_text_to_html"); - exit(1); - } - - gg_message_text_to_html(result, input, NULL, 0); - - printf("text: \"%s\"\n", input); - printf("output: \"%s\"\n", result); - - if (strcmp(result, output) == 0) { - printf("correct\n\n"); - free(result); - } else { - printf("expected: \"%s\"\n", output); - free(result); - exit(1); - } -} - -void test_html_to_text(const char *input, const char *output) -{ - char *result; - size_t len; - - len = gg_message_html_to_text(NULL, input); - - result = malloc(len + 1); - - if (result == NULL) { - perror("gg_message_html_to_text"); - exit(1); - } - - gg_message_html_to_text(result, input); - - printf("html: \"%s\"\n", input); - printf("output: \"%s\"\n", result); - - if (strcmp(result, output) == 0) { - printf("correct\n\n"); - free(result); - } else { - printf("expected: \"%s\"\n", output); - free(result); - exit(1); - } -} - -int main(int argc, char **argv) -{ - test_text_to_html("\r\n\"ala&ma'kota\"", "<bzdura>
    "ala&ma'kota"
    "); - - test_html_to_text("<bzdura>
    "ala&ma'kota"
    ", "\r\n\"ala&ma'kota\""); - - return 0; -} Added: branches/new-api/test/automatic/message1.c =================================================================== --- branches/new-api/test/automatic/message1.c (rev 0) +++ branches/new-api/test/automatic/message1.c 2010-01-13 02:00:43 UTC (rev 895) @@ -0,0 +1,6 @@ +// Tutaj b?dziemy testowa? "metody" "klasy" gg_message_t. + +int main(void) +{ + return 0; +} Copied: branches/new-api/test/automatic/message2.c (from rev 882, branches/new-api/test/automatic/message.c) =================================================================== --- branches/new-api/test/automatic/message2.c (rev 0) +++ branches/new-api/test/automatic/message2.c 2010-01-13 02:00:43 UTC (rev 895) @@ -0,0 +1,236 @@ +#include "message.h" +#include "config.h" +#ifdef HAVE_LIBXML2 +#include +#include +#endif + +struct test_data +{ + const char *src; + const char *dst; + const char *attr; + size_t attr_len; +}; + +#define SPAN(text) "" text "" +#define SPAN_COLOR(color, text) "" text "" + +const struct test_data text_to_html[] = +{ + /* Typowa wiadomo?? */ + { "\n\"ala&ma'kota\"", SPAN("<bzdura>
    "ala&ma'kota"") }, + + /* Obrazek na pocz?tku tekstu */ + { "test", SPAN("test"), "\x00\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 }, + + /* Obrazek na ko?cu tekstu */ + { "test", SPAN("test"), "\x04\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 }, + + /* Obrazek w ?rodku tekstu */ + { "testtest", SPAN("testtest"), "\x04\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 }, + + /* Obrazek poza tekstem */ + { "test", SPAN("test"), "\x05\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 }, + + /* Atrybuty na pocz?tku, w ?rodku i na ko?cu tekstu */ + { "foobarbaz", SPAN("foo") SPAN("bar") SPAN("baz"), "\x00\x00\x01\x03\x00\x02\x06\x00\x04", 9 }, + + /* Mieszane atrybuty */ + { "foobarbaz", SPAN("foo") SPAN("bar") SPAN("baz"), "\x00\x00\x03\x03\x00\x05\x06\x00\x06", 9 }, + + /* Wszystkie atrybuty */ + { "test", SPAN("test"), "\x00\x00\x07", 3 }, + + /* Zb?dne puste atrybuty */ + { "test", SPAN("test"), "\x00\x00\x00\x02\x00\x00\x04\x00\x00", 9 }, + + /* Atrybut na ko?cu tekstu */ + { "test", SPAN("test"), "\x04\x00\x01", 3 }, + + /* Atrybut poza tekstem */ + { "test", SPAN("test"), "\x05\x00\x01", 3 }, + + /* Kolorowy tekst */ + { "test", SPAN_COLOR("123456", "test"), "\x00\x00\x08\x12\x34\x56", 6 }, + + /* Kolorowy tekst na pocz?tku */ + { "foobarbaz", SPAN_COLOR("123456", "foo") SPAN("barbaz"), "\x00\x00\x08\x12\x34\x56\x03\x00\x08\x00\x00\x00", 12 }, + + /* Kolorowy tekst w ?rodku */ + { "foobarbaz", SPAN("foo") SPAN_COLOR("123456", "bar") SPAN("baz"), "\x03\x00\x08\x12\x34\x56\x06\x00\x08\x00\x00\x00", 12 }, + + /* Kolorowy tekst na ko?cu (niezako?czony) */ + { "foobarbaz", SPAN("foobar") SPAN_COLOR("123456", "baz"), "\x06\x00\x08\x12\x34\x56", 6 }, + + /* Kolorowy tekst na ko?cu (zako?czony) */ + { "foobarbaz", SPAN("foobar") SPAN_COLOR("123456", "baz"), "\x06\x00\x08\x12\x34\x56\x09\x00\x08\x00\x00\x00", 12 }, + + /* Atrybuty mocno poza zakresem */ + { "test", SPAN("test"), "\xff\xff\xff", 3 }, + + /* Niekompletny atrybut obrazka */ + { "test", SPAN("test"), "\x04\x00\x80\x09\x01", 5 }, + + /* Niekompletny atrybut obrazka */ + { "test", SPAN("test"), "\x04\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77", 12 }, + + /* Pusty tekst */ + { "", SPAN("") }, +}; + +const struct test_data html_to_text[] = +{ + /* Typowa wiadomo?? */ + { SPAN("<bzdura>
    "ala&ma'kota""), "\n\"ala&ma'kota\"" }, + + /* Niepoprawny tag */ + { "<<>>", ">>" }, + + /* Tagi do wyci?cia */ + { "bar", "bar" }, + + /* Poprawne encje */ + { "<&"' >", "<&\"'\xc2\xa0>" }, + + /* Niepoprawne encje */ + { "test&test;test{test઼test", "test?test?test?test" }, + + /* R??ne warianty
    */ + { "a
    b
    c
    d", "a\nb\nc\nd" }, + + /* Niepoprawne tagi */ + { "", "" }, + + /* Pusty tekst */ + { "", "" }, +}; + +static void test_text_to_html(const char *input, const char *attr, size_t attr_len, const char *output) +{ + char *result; + size_t len; + char *tmp; +#ifdef HAVE_LIBXML2 + xmlParserCtxtPtr ctxt; + xmlDocPtr doc; +#endif + + len = gg_message_text_to_html(NULL, input, attr, attr_len); + + result = malloc(len + 1); + + if (result == NULL) { + perror("malloc"); + exit(1); + } + + gg_message_text_to_html(result, input, attr, attr_len); + + printf("text: \"%s\"%s\n", input, (attr != NULL) ? " + attr" : ""); + printf("output: \"%s\"\n", result); + + if (strcmp(result, output) != 0) { + printf("expected: \"%s\"\n", output); + free(result); + exit(1); + } + +#ifdef HAVE_LIBXML2 + // Doklej , ?eby mie? tag dokumentu. + + tmp = realloc(result, strlen(result) + strlen("") + 1); + + if (tmp == NULL) { + perror("realloc"); + free(result); + exit(1); + } + + result = tmp; + + memmove(result + strlen(""), result, strlen(result) + 1); + memcpy(result, "", strlen("")); + strcat(result, ""); + + // Zamie?
    na , ?eby parser si? nie wywali?. + + while ((tmp = strstr(result, "
    ")) != NULL) + memcpy(tmp, "", 4); + + // Zamie? na , ?eby parser si? nie wywali?. + + while ((tmp = strstr(result, " Author: wojtekka Date: 2010-01-13 03:01:31 +0100 (Wed, 13 Jan 2010) New Revision: 896 Modified: branches/new-api/test/automatic/script/30-status.scr Log: Poprawka testu zmiany stanu. Modified: branches/new-api/test/automatic/script/30-status.scr =================================================================== --- branches/new-api/test/automatic/script/30-status.scr 2010-01-13 02:00:43 UTC (rev 895) +++ branches/new-api/test/automatic/script/30-status.scr 2010-01-13 02:01:31 UTC (rev 896) @@ -78,5 +78,5 @@ gg_change_status_descr_time(session, GG_STATUS_AVAIL_DESCR, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0x12345678); } -expect data (38 00 00 00, 0b 01 00 00, 02 00 00 00, 01 00 80 00, ff 00 00 00, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") +expect data (38 00 00 00, 0b 01 00 00, 04 00 00 00, 01 00 80 00, ff 00 00 00, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") From libgadu-commit at lists.ziew.org Wed Jan 13 03:02:25 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 03:02:25 +0100 Subject: [libgadu-commit] r897 - branches/new-api/src Message-ID: <20100113020225.D778E17B47@toxygen.net> Author: wojtekka Date: 2010-01-13 03:02:25 +0100 (Wed, 13 Jan 2010) New Revision: 897 Modified: branches/new-api/src/message.c Log: Poprawki konwersji czystego tekstu na HTML. Poprawki typ?w parametr?w. Poprawka obrazk?w w HTML-u (Bart?omiej Zimo?). Modified: branches/new-api/src/message.c =================================================================== --- branches/new-api/src/message.c 2010-01-13 02:01:31 UTC (rev 896) +++ branches/new-api/src/message.c 2010-01-13 02:02:25 UTC (rev 897) @@ -22,7 +22,7 @@ return gm; } -int gg_message_init(gg_message_t *gm, int msgclass, int seq, uin_t *recipients, int recipient_count, char *text, char *html, char *attributes, size_t attributes_length, int auto_convert) +int gg_message_init(gg_message_t *gm, int msgclass, int seq, uin_t *recipients, size_t recipient_count, char *text, char *html, char *attributes, size_t attributes_length, int auto_convert) { GG_MESSAGE_CHECK(gm, -1); @@ -80,7 +80,7 @@ return gm->auto_convert; } -int gg_message_set_recipients(gg_message_t *gm, const uin_t *recipients, unsigned int recipient_count) +int gg_message_set_recipients(gg_message_t *gm, const uin_t *recipients, size_t recipient_count) { GG_MESSAGE_CHECK(gm, -1); @@ -115,7 +115,7 @@ return gg_message_set_recipients(gm, &recipient, 1); } -int gg_message_get_recipients(gg_message_t *gm, const uin_t **recipients, unsigned int *recipient_count) +int gg_message_get_recipients(gg_message_t *gm, const uin_t **recipients, size_t *recipient_count) { GG_MESSAGE_CHECK(gm, -1); @@ -128,7 +128,7 @@ return 0; } -uin_t gg_message_recipient(gg_message_t *gm) +uin_t gg_message_get_recipient(gg_message_t *gm) { GG_MESSAGE_CHECK(gm, (uin_t) -1); @@ -341,7 +341,7 @@ * * \param dst Bufor wynikowy (mo?e by? \c NULL) * \param utf_msg Tekst ?r?d?owy - * \param format Atrybuty tekstu ?r?d?owego + * \param format_ Atrybuty tekstu ?r?d?owego * \param format_len D?ugo?? bloku atrybut?w tekstu ?r?d?owego * * \note Wynikowy tekst nie jest idealnym kodem HTML, poniewa? ma jak @@ -351,32 +351,41 @@ * * \return D?ugo?? tekstu wynikowego bez \c \\0 (nawet je?li \c dst to \c NULL). */ -size_t gg_message_text_to_html(char *dst, const char *utf_msg, const char *format, size_t format_len) +size_t gg_message_text_to_html(char *dst, const char *utf_msg, const char *format_, size_t format_len) { const char span_fmt[] = ""; const int span_len = 75; - const char img_fmt[] = ""; - const int img_len = 28; + const char img_fmt[] = ""; + const int img_len = 29; int char_pos = 0; - int format_idx = 3; + int format_idx = 0; unsigned char old_attr = 0; const unsigned char *color = (const unsigned char*) "\x00\x00\x00"; int len, i; + const unsigned char *format = (const unsigned char*) format_; len = 0; - for (i = 0; utf_msg[i] != 0; i++) { + /* P?tla przechodzi te? przez ko?cz?ce \0, ?eby m?c doklei? obrazek + * na ko?cu tekstu. */ + + for (i = 0; ; i++) { unsigned char attr; int attr_pos; if (format_idx + 3 <= format_len) { attr_pos = format[format_idx] | (format[format_idx + 1] << 8); - attr = format[format_idx + 2]; + attr = (unsigned char) format[format_idx + 2]; } else { attr_pos = -1; attr = 0; } + /* Nie doklejaj atrybut?w na ko?cu, co najwy?ej obrazki. */ + + if (utf_msg[i] == 0) + attr &= ~(GG_FONT_BOLD | GG_FONT_ITALIC | GG_FONT_UNDERLINE | GG_FONT_COLOR); + if (attr_pos == char_pos) { format_idx += 3; @@ -464,6 +473,7 @@ gg_append(dst, &len, "
    ", 4); break; case '\r': + case 0: break; default: if (dst != NULL) @@ -475,8 +485,13 @@ if ((utf_msg[i] & 0xc0) != 0xc0) char_pos++; + + if (utf_msg[i] == 0) + break; } + /* Zamknij tagi. */ + if ((old_attr & GG_FONT_UNDERLINE) != 0) gg_append(dst, &len, "", 4); @@ -486,15 +501,6 @@ if ((old_attr & GG_FONT_BOLD) != 0) gg_append(dst, &len, "", 4); - /* Dla pustych tekst?w dodaj pusty . */ - - if (i == 0) { - if (dst != NULL) - sprintf(&dst[len], span_fmt, 0, 0, 0); - - len += span_len; - } - gg_append(dst, &len, "", 7); if (dst != NULL) @@ -560,19 +566,27 @@ in_entity = 0; if (dst != NULL) { if (strncmp(entity, "<", 4) == 0) - dst[len] = '<'; + dst[len++] = '<'; else if (strncmp(entity, ">", 4) == 0) - dst[len] = '>'; + dst[len++] = '>'; else if (strncmp(entity, """, 6) == 0) - dst[len] = '"'; + dst[len++] = '"'; else if (strncmp(entity, "'", 6) == 0) - dst[len] = '\''; + dst[len++] = '\''; else if (strncmp(entity, "&", 5) == 0) - dst[len] = '&'; + dst[len++] = '&'; + else if (strncmp(entity, " ", 6) == 0) { + dst[len++] = 0xc2; + dst[len++] = 0xa0; + } else + dst[len++] = '?'; + } else { + if (strncmp(entity, " ", 6) == 0) + len += 2; else - dst[len] = '?'; + len++; } - len++; + continue; } From libgadu-commit at lists.ziew.org Wed Jan 13 03:04:22 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Wed, 13 Jan 2010 03:04:22 +0100 Subject: [libgadu-commit] r898 - branches/1.9/test/connect Message-ID: <20100113020422.8EDAA17B47@toxygen.net> Author: wojtekka Date: 2010-01-13 03:04:22 +0100 (Wed, 13 Jan 2010) New Revision: 898 Modified: branches/1.9/test/connect/connect.c Log: Poprawka symulacji huba. Usuni?cie ostrze?e?. Modified: branches/1.9/test/connect/connect.c =================================================================== --- branches/1.9/test/connect/connect.c 2010-01-13 02:02:25 UTC (rev 897) +++ branches/1.9/test/connect/connect.c 2010-01-13 02:04:22 UTC (rev 898) @@ -516,7 +516,7 @@ len += res; if (strstr(buf, "\r\n\r\n")) { - snprintf(buf, sizeof(buf), "HTTP/1.0 200 OK\r\n\r\n0 %s:%d %s\r\n", LOCALHOST, 8074, LOCALHOST); + snprintf(buf, sizeof(buf), "HTTP/1.0 200 OK\r\n\r\n0 0 %s:%d %s\r\n", LOCALHOST, 8074, LOCALHOST); send(cfds[0], buf, strlen(buf), 0); close(cfds[0]); cfds[0] = -1; @@ -631,7 +631,7 @@ int main(int argc, char **argv) { - int i, test_from, test_to, result[TEST_MAX][2] = { { 0, } }; + int i, test_from = 0, test_to = 0, result[TEST_MAX][2] = { { 0, } }; int exit_code = 0; if (argc == 3) { From libgadu-commit at lists.ziew.org Tue Jan 19 11:48:28 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Tue, 19 Jan 2010 11:48:28 +0100 Subject: [libgadu-commit] r900 - trunk/docs Message-ID: <20100119104828.B918717B58@toxygen.net> Author: darkjames Date: 2010-01-19 11:48:28 +0100 (Tue, 19 Jan 2010) New Revision: 900 Modified: trunk/docs/protocol.html Log: Dodanie nowych pakiet?w do dokumentacji. Modified: trunk/docs/protocol.html =================================================================== --- trunk/docs/protocol.html 2010-01-19 10:48:24 UTC (rev 899) +++ trunk/docs/protocol.html 2010-01-19 10:48:28 UTC (rev 900) @@ -237,15 +237,15 @@ char hash[64]; /* skr?t has?a dope?niony \0 */ int status; /* pocz?tkowy status po??czenia */ int flags; /* pocz?tkowe flagi po??czenia */ - int features; /* opcje protoko?u (0x00000007)*/ + int features; /* opcje protoko?u (0x00000367)*/ int local_ip; /* lokalny adres po??cze? bezpo?rednich (nieu?ywany) */ short local_port; /* lokalny port po??cze? bezpo?rednich (nieu?ywany) */ int external_ip; /* zewn?trzny adres (nieu?ywany) */ short external_port; /* zewn?trzny port (nieu?ywany) */ char image_size; /* maksymalny rozmiar grafiki w KB */ char unknown2; /* 0x64 */ - int version_len; /* d?ugo?? ci?gu z wersj? (0x21) */ - char version[]; /* "Gadu-Gadu Client build 8.0.0.7669" (bez \0) */ + int version_len; /* d?ugo?? ci?gu z wersj? (0x23) */ + char version[]; /* "Gadu-Gadu Client build 10.0.0.10450" (bez \0) */ int description_size; /* rozmiar opisu */ char description[]; /* opis (nie musi wyst?pi?, bez \0) */ }; @@ -257,7 +257,7 @@ protoko??w i w obecnej wersji zawieraj? zera.

    -

    Pole opcji protoko?u zawsze zawiera warto?? 0x00000007 i jest map? bitow?:

    +

    Pole opcji protoko?u zawsze zawiera warto?? 0x00000367 i jest map? bitow?:

    @@ -1136,7 +1136,7 @@ .status = GG_STATUS_DESCR_MASK | GG_STATUS_IMAGE_MASK | docelowy_opisowy_status; /* 0x4100 | status */ .flags = 0x03; .description_size = 9; - .description = "Krol Popu" + .description = "Krol Popu"; }; @@ -1398,9 +1398,10 @@ - + +
    BitWarto??Znaczenie
    0x0028GG_NEW_STATUS80BETAZmiana stanu przed Nowym Gadu-Gadu
    0x0029GG_LOGIN80BETALogowanie przed Nowym Gadu-Gadu
    0x002dGG_SEND_MSG80Wys?anie wiadomo?ci
    0x002fGG_USERLIST_REQUEST80Zapytanie listy kontakt?w na serwerze
    0x002fGG_USERLIST_REQUEST80Zapytanie listy kontakt?w na serwerze przed Gadu-Gadu 10
    0x0031GG_LOGIN80Logowanie
    0x0038GG_NEW_STATUS80Zmiana stanu
    0x0040GG_USERLIST_REQUEST100Zapytanie listy kontakt?w na serwerze

    @@ -1436,13 +1437,15 @@ 0x0025GG_DCC7_ABORTED 0x0027GG_XML_EVENTOdebrano wiadomo?? systemow? 0x002aGG_STATUS80BETAZmiana stanu przed Nowym Gadu-Gadu -0x002bGG_NOTIFY_REPLY80BETAStan listy kontakt?w przed Nowym Gadu-Gadu +0x002bGG_NOTIFY_REPLY80BETAStan listy kontakt?w przed Nowym Gadu-Gadu 0x002cGG_XML_ACTION 0x002eGG_RECV_MSG80Przychodz?ca wiadomo?? -0x0030GG_USERLIST_REPLY80Odpowied? listy kontakt?w na serwerze +0x0030GG_USERLIST_REPLY80Odpowied? listy kontakt?w na serwerze przed Gadu-Gadu 10 0x0035GG_LOGIN_OK80Logowanie powiod?o si? 0x0036GG_STATUS80Zmiana stanu 0x0037GG_NOTIFY_REPLY80Stan listy kontakt?w +0x0041GG_USERLIST_REPLY100Odpowied? listy kontakt?w na serwerze +0x0044GG_USER_DATADodatkowe informacje o li?cie kontakt?w


    From libgadu-commit at lists.ziew.org Tue Jan 19 11:48:25 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Tue, 19 Jan 2010 11:48:25 +0100 Subject: [libgadu-commit] r899 - in trunk: include src Message-ID: <20100119104825.9EC4C17B58@toxygen.net> Author: darkjames Date: 2010-01-19 11:48:24 +0100 (Tue, 19 Jan 2010) New Revision: 899 Modified: trunk/include/libgadu.h.in trunk/include/resolver.h trunk/src/http.c trunk/src/libgadu.c trunk/src/resolver.c Log: fook. Modified: trunk/include/libgadu.h.in =================================================================== --- trunk/include/libgadu.h.in 2010-01-13 02:04:22 UTC (rev 898) +++ trunk/include/libgadu.h.in 2010-01-19 10:48:24 UTC (rev 899) @@ -317,8 +317,10 @@ #ifdef __GNUC__ #define GG_PACKED __attribute__ ((packed)) +#define GG_OBSOLETE __attribute__ ((deprecated)) #else #define GG_PACKED +#define GG_OBSOLETE #endif /** \endcond */ @@ -1191,12 +1193,12 @@ char *email; char *phone; uin_t uin; -}; +} /* GG_OBSOLETE */; struct gg_search { int count; struct gg_search_result *results; -}; +} GG_OBSOLETE; struct gg_search_result { uin_t uin; @@ -1207,35 +1209,35 @@ int gender; char *city; int active; -}; +} GG_OBSOLETE; #define GG_GENDER_NONE 0 #define GG_GENDER_FEMALE 1 #define GG_GENDER_MALE 2 -struct gg_http *gg_search(const struct gg_search_request *r, int async); -int gg_search_watch_fd(struct gg_http *f); -void gg_free_search(struct gg_http *f); +struct gg_http *gg_search(const struct gg_search_request *r, int async) GG_OBSOLETE; +int gg_search_watch_fd(struct gg_http *f) GG_OBSOLETE; +void gg_free_search(struct gg_http *f) GG_OBSOLETE; #define gg_search_free gg_free_search -const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start); -const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start); -const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start); -const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start); -void gg_search_request_free(struct gg_search_request *r); +const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start) GG_OBSOLETE; +const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start) GG_OBSOLETE; +const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start) GG_OBSOLETE; +const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start) GG_OBSOLETE; +void gg_search_request_free(struct gg_search_request *r) GG_OBSOLETE; -struct gg_http *gg_register(const char *email, const char *password, int async); -struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async); +struct gg_http *gg_register(const char *email, const char *password, int async) GG_OBSOLETE; +struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async) GG_OBSOLETE; -struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async); -struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async); +struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async) GG_OBSOLETE; +struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async) GG_OBSOLETE; -struct gg_http *gg_remind_passwd(uin_t uin, int async); -struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async); +struct gg_http *gg_remind_passwd(uin_t uin, int async) GG_OBSOLETE; +struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async) GG_OBSOLETE; -struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async); -struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async); -struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async); +struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async) GG_OBSOLETE; +struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async) GG_OBSOLETE; +struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async) GG_OBSOLETE; struct gg_change_info_request { char *first_name; @@ -1245,28 +1247,30 @@ int born; int gender; char *city; -}; +} /* GG_OBSOLETE */; -struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city); -void gg_change_info_request_free(struct gg_change_info_request *r); +struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city) GG_OBSOLETE; +void gg_change_info_request_free(struct gg_change_info_request *r) GG_OBSOLETE; -struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async); +struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async) GG_OBSOLETE; #define gg_change_pubdir_watch_fd gg_pubdir_watch_fd #define gg_change_pubdir_free gg_pubdir_free #define gg_free_change_pubdir gg_pubdir_free -struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async); -int gg_userlist_get_watch_fd(struct gg_http *f); -void gg_userlist_get_free(struct gg_http *f); +struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async) GG_OBSOLETE; +int gg_userlist_get_watch_fd(struct gg_http *f) GG_OBSOLETE; +void gg_userlist_get_free(struct gg_http *f) GG_OBSOLETE; -struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async); -int gg_userlist_put_watch_fd(struct gg_http *f); -void gg_userlist_put_free(struct gg_http *f); +struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async) GG_OBSOLETE; +int gg_userlist_put_watch_fd(struct gg_http *f) GG_OBSOLETE; +void gg_userlist_put_free(struct gg_http *f) GG_OBSOLETE; -struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async); -int gg_userlist_remove_watch_fd(struct gg_http *f); -void gg_userlist_remove_free(struct gg_http *f); +struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async) GG_OBSOLETE; +int gg_userlist_remove_watch_fd(struct gg_http *f) GG_OBSOLETE; +void gg_userlist_remove_free(struct gg_http *f) GG_OBSOLETE; +struct in_addr *gg_gethostbyname(const char *hostname) GG_OBSOLETE; + /** \endcond */ int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length); Modified: trunk/include/resolver.h =================================================================== --- trunk/include/resolver.h 2010-01-13 02:04:22 UTC (rev 898) +++ trunk/include/resolver.h 2010-01-19 10:48:24 UTC (rev 899) @@ -23,6 +23,6 @@ #include -int gg_gethostbyname(const char *hostname, struct in_addr *result, int pthread); +int gg_gethostbyname_real(const char *hostname, struct in_addr *result, int pthread); #endif /* LIBGADU_RESOLVER_H */ Modified: trunk/src/http.c =================================================================== --- trunk/src/http.c 2010-01-13 02:04:22 UTC (rev 898) +++ trunk/src/http.c 2010-01-19 10:48:24 UTC (rev 899) @@ -130,7 +130,7 @@ } else { struct in_addr addr; - if (gg_gethostbyname(hostname, &addr, 0) == -1) { + if (gg_gethostbyname_real(hostname, &addr, 0) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_http_connect() host not found\n"); gg_http_free(h); errno = ENOENT; Modified: trunk/src/libgadu.c =================================================================== --- trunk/src/libgadu.c 2010-01-13 02:04:22 UTC (rev 898) +++ trunk/src/libgadu.c 2010-01-19 10:48:24 UTC (rev 899) @@ -826,7 +826,7 @@ if (!sess->server_addr) { if ((addr.s_addr = inet_addr(hostname)) == INADDR_NONE) { - if (gg_gethostbyname(hostname, &addr, 0) == -1) { + if (gg_gethostbyname_real(hostname, &addr, 0) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_login() host \"%s\" not found\n", hostname); goto fail; } Modified: trunk/src/resolver.c =================================================================== --- trunk/src/resolver.c 2010-01-13 02:04:22 UTC (rev 898) +++ trunk/src/resolver.c 2010-01-19 10:48:24 UTC (rev 899) @@ -85,7 +85,7 @@ * * \return 0 je?li si? powiod?o, -1 w przypadku b??du */ -int gg_gethostbyname(const char *hostname, struct in_addr *addr, int pthread) +int gg_gethostbyname_real(const char *hostname, struct in_addr *addr, int pthread) { #ifdef GG_CONFIG_HAVE_GETHOSTBYNAME_R char *buf = NULL; @@ -181,6 +181,20 @@ #endif /* GG_CONFIG_HAVE_GETHOSTBYNAME_R */ } +struct in_addr *gg_gethostbyname(const char *hostname) +{ + struct in_addr *addr; + + if (!(addr = malloc(sizeof(struct in_addr)))) + return NULL; + + if (gg_gethostbyname_real(hostname, addr, 0)) { + free(addr); + return NULL; + } + return addr; +} + /** * \internal Struktura przekazywana do w?tku rozwi?zuj?cego nazw?. */ @@ -243,10 +257,10 @@ close(pipes[0]); if ((addr.s_addr = inet_addr(hostname)) == INADDR_NONE) { - /* W przypadku b??du gg_gethostbyname() zwr?ci -1 + /* W przypadku b??du gg_gethostbyname_real() zwr?ci -1 * i nie zmieni &addr. Tam jest ju? INADDR_NONE, * wi?c nie musimy robi? nic wi?cej. */ - gg_gethostbyname(hostname, &addr, 0); + gg_gethostbyname_real(hostname, &addr, 0); } if (write(pipes[1], &addr, sizeof(addr)) != sizeof(addr)) @@ -363,10 +377,10 @@ pthread_detach(pthread_self()); if ((addr.s_addr = inet_addr(data->hostname)) == INADDR_NONE) { - /* W przypadku b??du gg_gethostbyname() zwr?ci -1 + /* W przypadku b??du gg_gethostbyname_real() zwr?ci -1 * i nie zmieni &addr. Tam jest ju? INADDR_NONE, * wi?c nie musimy robi? nic wi?cej. */ - gg_gethostbyname(data->hostname, &addr, 1); + gg_gethostbyname_real(data->hostname, &addr, 1); } if (write(data->wfd, &addr, sizeof(addr)) == sizeof(addr)) From libgadu-commit at lists.ziew.org Tue Jan 19 11:50:25 2010 From: libgadu-commit at lists.ziew.org (Libgadu commit list) Date: Tue, 19 Jan 2010 11:50:25 +0100 Subject: [libgadu-commit] r901 - in trunk: include src Message-ID: <20100119105025.A946817B58@toxygen.net> Author: darkjames Date: 2010-01-19 11:50:24 +0100 (Tue, 19 Jan 2010) New Revision: 901 Modified: trunk/include/libgadu.h.in trunk/include/resolver.h trunk/src/http.c trunk/src/libgadu.c trunk/src/resolver.c Log: Tego nie mia?em commitowa?. This reverts commit 83af9236ad09a183d6f3f9df95d3c54724120b5c. Modified: trunk/include/libgadu.h.in =================================================================== --- trunk/include/libgadu.h.in 2010-01-19 10:48:28 UTC (rev 900) +++ trunk/include/libgadu.h.in 2010-01-19 10:50:24 UTC (rev 901) @@ -317,10 +317,8 @@ #ifdef __GNUC__ #define GG_PACKED __attribute__ ((packed)) -#define GG_OBSOLETE __attribute__ ((deprecated)) #else #define GG_PACKED -#define GG_OBSOLETE #endif /** \endcond */ @@ -1193,12 +1191,12 @@ char *email; char *phone; uin_t uin; -} /* GG_OBSOLETE */; +}; struct gg_search { int count; struct gg_search_result *results; -} GG_OBSOLETE; +}; struct gg_search_result { uin_t uin; @@ -1209,35 +1207,35 @@ int gender; char *city; int active; -} GG_OBSOLETE; +}; #define GG_GENDER_NONE 0 #define GG_GENDER_FEMALE 1 #define GG_GENDER_MALE 2 -struct gg_http *gg_search(const struct gg_search_request *r, int async) GG_OBSOLETE; -int gg_search_watch_fd(struct gg_http *f) GG_OBSOLETE; -void gg_free_search(struct gg_http *f) GG_OBSOLETE; +struct gg_http *gg_search(const struct gg_search_request *r, int async); +int gg_search_watch_fd(struct gg_http *f); +void gg_free_search(struct gg_http *f); #define gg_search_free gg_free_search -const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start) GG_OBSOLETE; -const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start) GG_OBSOLETE; -const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start) GG_OBSOLETE; -const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start) GG_OBSOLETE; -void gg_search_request_free(struct gg_search_request *r) GG_OBSOLETE; +const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start); +const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start); +const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start); +const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start); +void gg_search_request_free(struct gg_search_request *r); -struct gg_http *gg_register(const char *email, const char *password, int async) GG_OBSOLETE; -struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async) GG_OBSOLETE; +struct gg_http *gg_register(const char *email, const char *password, int async); +struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async); -struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async) GG_OBSOLETE; -struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async) GG_OBSOLETE; +struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async); +struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async); -struct gg_http *gg_remind_passwd(uin_t uin, int async) GG_OBSOLETE; -struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async) GG_OBSOLETE; +struct gg_http *gg_remind_passwd(uin_t uin, int async); +struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async); -struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async) GG_OBSOLETE; -struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async) GG_OBSOLETE; -struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async) GG_OBSOLETE; +struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async); +struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async); +struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async); struct gg_change_info_request { char *first_name; @@ -1247,30 +1245,28 @@ int born; int gender; char *city; -} /* GG_OBSOLETE */; +}; -struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city) GG_OBSOLETE; -void gg_change_info_request_free(struct gg_change_info_request *r) GG_OBSOLETE; +struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city); +void gg_change_info_request_free(struct gg_change_info_request *r); -struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async) GG_OBSOLETE; +struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async); #define gg_change_pubdir_watch_fd gg_pubdir_watch_fd #define gg_change_pubdir_free gg_pubdir_free #define gg_free_change_pubdir gg_pubdir_free -struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async) GG_OBSOLETE; -int gg_userlist_get_watch_fd(struct gg_http *f) GG_OBSOLETE; -void gg_userlist_get_free(struct gg_http *f) GG_OBSOLETE; +struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async); +int gg_userlist_get_watch_fd(struct gg_http *f); +void gg_userlist_get_free(struct gg_http *f); -struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async) GG_OBSOLETE; -int gg_userlist_put_watch_fd(struct gg_http *f) GG_OBSOLETE; -void gg_userlist_put_free(struct gg_http *f) GG_OBSOLETE; +struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async); +int gg_userlist_put_watch_fd(struct gg_http *f); +void gg_userlist_put_free(struct gg_http *f); -struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async) GG_OBSOLETE; -int gg_userlist_remove_watch_fd(struct gg_http *f) GG_OBSOLETE; -void gg_userlist_remove_free(struct gg_http *f) GG_OBSOLETE; +struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async); +int gg_userlist_remove_watch_fd(struct gg_http *f); +void gg_userlist_remove_free(struct gg_http *f); -struct in_addr *gg_gethostbyname(const char *hostname) GG_OBSOLETE; - /** \endcond */ int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length); Modified: trunk/include/resolver.h =================================================================== --- trunk/include/resolver.h 2010-01-19 10:48:28 UTC (rev 900) +++ trunk/include/resolver.h 2010-01-19 10:50:24 UTC (rev 901) @@ -23,6 +23,6 @@ #include -int gg_gethostbyname_real(const char *hostname, struct in_addr *result, int pthread); +int gg_gethostbyname(const char *hostname, struct in_addr *result, int pthread); #endif /* LIBGADU_RESOLVER_H */ Modified: trunk/src/http.c =================================================================== --- trunk/src/http.c 2010-01-19 10:48:28 UTC (rev 900) +++ trunk/src/http.c 2010-01-19 10:50:24 UTC (rev 901) @@ -130,7 +130,7 @@ } else { struct in_addr addr; - if (gg_gethostbyname_real(hostname, &addr, 0) == -1) { + if (gg_gethostbyname(hostname, &addr, 0) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_http_connect() host not found\n"); gg_http_free(h); errno = ENOENT; Modified: trunk/src/libgadu.c =================================================================== --- trunk/src/libgadu.c 2010-01-19 10:48:28 UTC (rev 900) +++ trunk/src/libgadu.c 2010-01-19 10:50:24 UTC (rev 901) @@ -826,7 +826,7 @@ if (!sess->server_addr) { if ((addr.s_addr = inet_addr(hostname)) == INADDR_NONE) { - if (gg_gethostbyname_real(hostname, &addr, 0) == -1) { + if (gg_gethostbyname(hostname, &addr, 0) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_login() host \"%s\" not found\n", hostname); goto fail; } Modified: trunk/src/resolver.c =================================================================== --- trunk/src/resolver.c 2010-01-19 10:48:28 UTC (rev 900) +++ trunk/src/resolver.c 2010-01-19 10:50:24 UTC (rev 901) @@ -85,7 +85,7 @@ * * \return 0 je?li si? powiod?o, -1 w przypadku b??du */ -int gg_gethostbyname_real(const char *hostname, struct in_addr *addr, int pthread) +int gg_gethostbyname(const char *hostname, struct in_addr *addr, int pthread) { #ifdef GG_CONFIG_HAVE_GETHOSTBYNAME_R char *buf = NULL; @@ -181,20 +181,6 @@ #endif /* GG_CONFIG_HAVE_GETHOSTBYNAME_R */ } -struct in_addr *gg_gethostbyname(const char *hostname) -{ - struct in_addr *addr; - - if (!(addr = malloc(sizeof(struct in_addr)))) - return NULL; - - if (gg_gethostbyname_real(hostname, addr, 0)) { - free(addr); - return NULL; - } - return addr; -} - /** * \internal Struktura przekazywana do w?tku rozwi?zuj?cego nazw?. */ @@ -257,10 +243,10 @@ close(pipes[0]); if ((addr.s_addr = inet_addr(hostname)) == INADDR_NONE) { - /* W przypadku b??du gg_gethostbyname_real() zwr?ci -1 + /* W przypadku b??du gg_gethostbyname() zwr?ci -1 * i nie zmieni &addr. Tam jest ju? INADDR_NONE, * wi?c nie musimy robi? nic wi?cej. */ - gg_gethostbyname_real(hostname, &addr, 0); + gg_gethostbyname(hostname, &addr, 0); } if (write(pipes[1], &addr, sizeof(addr)) != sizeof(addr)) @@ -377,10 +363,10 @@ pthread_detach(pthread_self()); if ((addr.s_addr = inet_addr(data->hostname)) == INADDR_NONE) { - /* W przypadku b??du gg_gethostbyname_real() zwr?ci -1 + /* W przypadku b??du gg_gethostbyname() zwr?ci -1 * i nie zmieni &addr. Tam jest ju? INADDR_NONE, * wi?c nie musimy robi? nic wi?cej. */ - gg_gethostbyname_real(data->hostname, &addr, 1); + gg_gethostbyname(data->hostname, &addr, 1); } if (write(data->wfd, &addr, sizeof(addr)) == sizeof(addr))