Wed, 12 Nov 2008 05:14:03 +0000
merge of '77693555855fe9cd3215414f79964dba346cc5fa'
and '19a87e98e5857ad0289f2c760d460f7f1dbbb42d'
|
14253
b63ebf84c42b
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
12218
diff
changeset
|
1 | /* $Id: libgadu.h 16856 2006-08-19 01:13:25Z evands $ */ |
| 11360 | 2 | |
| 3 | /* | |
| 4 | * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl> | |
| 5 | * Robert J. Woźny <speedy@ziew.org> | |
| 6 | * Arkadiusz Miśkiewicz <arekm@pld-linux.org> | |
| 7 | * Tomasz Chiliński <chilek@chilan.com> | |
| 8 | * Piotr Wysocki <wysek@linux.bydg.org> | |
| 9 | * Dawid Jarosz <dawjar@poczta.onet.pl> | |
| 10 | * | |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU Lesser General Public License Version | |
| 13 | * 2.1 as published by the Free Software Foundation. | |
| 14 | * | |
| 15 | * This program is distributed in the hope that it will be useful, | |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | * GNU Lesser General Public License for more details. | |
| 19 | * | |
| 20 | * You should have received a copy of the GNU Lesser General Public | |
| 21 | * License along with this program; if not, write to the Free Software | |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, | |
| 23 | * USA. | |
| 24 | */ | |
| 25 | ||
| 26 | #ifndef __GG_LIBGADU_H | |
| 27 | #define __GG_LIBGADU_H | |
| 28 | ||
| 29 | #ifdef __cplusplus | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
30 | #ifdef _MSC_VER |
| 11360 | 31 | #pragma pack(push, 1) |
| 32 | #endif | |
| 33 | extern "C" { | |
| 34 | #endif | |
| 35 | ||
| 36 | #include <libgadu-config.h> | |
| 37 | #include <sys/types.h> | |
| 38 | #include <stdio.h> | |
| 39 | #include <stdarg.h> | |
| 40 | ||
| 41 | #ifdef __GG_LIBGADU_HAVE_OPENSSL | |
| 42 | #include <openssl/ssl.h> | |
| 43 | #endif | |
| 44 | ||
| 45 | /* | |
| 46 | * typedef uin_t | |
| 47 | * | |
| 48 | * typ reprezentujący numer osoby. | |
| 49 | */ | |
| 50 | typedef uint32_t uin_t; | |
| 51 | ||
| 52 | /* | |
| 53 | * ogólna struktura opisująca różne sesje. przydatna w klientach. | |
| 54 | */ | |
| 55 | #define gg_common_head(x) \ | |
| 56 | int fd; /* podglądany deskryptor */ \ | |
| 57 | int check; /* sprawdzamy zapis czy odczyt */ \ | |
| 58 | int state; /* aktualny stan maszynki */ \ | |
| 59 | int error; /* kod błędu dla GG_STATE_ERROR */ \ | |
| 60 | int type; /* rodzaj sesji */ \ | |
| 61 | int id; /* identyfikator */ \ | |
| 62 | int timeout; /* sugerowany timeout w sekundach */ \ | |
| 63 | int (*callback)(x*); /* callback przy zmianach */ \ | |
| 64 | void (*destroy)(x*); /* funkcja niszczenia */ | |
| 65 | ||
| 66 | struct gg_common { | |
| 67 | gg_common_head(struct gg_common) | |
| 68 | }; | |
| 69 | ||
| 70 | struct gg_image_queue; | |
| 71 | ||
| 72 | /* | |
| 73 | * struct gg_session | |
| 74 | * | |
| 75 | * struktura opisująca daną sesję. tworzona przez gg_login(), zwalniana | |
| 76 | * przez gg_free_session(). | |
| 77 | */ | |
| 78 | struct gg_session { | |
| 79 | gg_common_head(struct gg_session) | |
| 80 | ||
| 81 | int async; /* czy połączenie jest asynchroniczne */ | |
| 82 | int pid; /* pid procesu resolvera */ | |
| 83 | int port; /* port, z którym się łączymy */ | |
| 84 | int seq; /* numer sekwencyjny ostatniej wiadomości */ | |
| 85 | int last_pong; /* czas otrzymania ostatniego ping/pong */ | |
| 86 | int last_event; /* czas otrzymania ostatniego pakietu */ | |
| 87 | ||
| 88 | struct gg_event *event; /* zdarzenie po ->callback() */ | |
| 89 | ||
| 90 | uint32_t proxy_addr; /* adres proxy, keszowany */ | |
| 91 | uint16_t proxy_port; /* port proxy */ | |
| 92 | ||
| 93 | uint32_t hub_addr; /* adres huba po resolvnięciu */ | |
| 94 | uint32_t server_addr; /* adres serwera, od huba */ | |
| 95 | ||
| 96 | uint32_t client_addr; /* adres klienta */ | |
| 97 | uint16_t client_port; /* port, na którym klient słucha */ | |
| 98 | ||
| 99 | uint32_t external_addr; /* adres zewnetrzny klienta */ | |
| 100 | uint16_t external_port; /* port zewnetrzny klienta */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
101 | |
| 11360 | 102 | uin_t uin; /* numerek klienta */ |
| 103 | char *password; /* i jego hasło. zwalniane automagicznie */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
104 | |
| 11360 | 105 | int initial_status; /* początkowy stan klienta */ |
| 106 | int status; /* aktualny stan klienta */ | |
| 107 | ||
| 108 | char *recv_buf; /* bufor na otrzymywane pakiety */ | |
| 109 | int recv_done; /* ile już wczytano do bufora */ | |
| 110 | int recv_left; /* i ile jeszcze trzeba wczytać */ | |
| 111 | ||
| 112 | int protocol_version; /* wersja używanego protokołu */ | |
| 113 | char *client_version; /* wersja używanego klienta */ | |
| 114 | int last_sysmsg; /* ostatnia wiadomość systemowa */ | |
| 115 | ||
| 116 | char *initial_descr; /* początkowy opis stanu klienta */ | |
| 117 | ||
| 118 | void *resolver; /* wskaźnik na informacje resolvera */ | |
| 119 | ||
| 120 | char *header_buf; /* bufor na początek nagłówka */ | |
| 121 | unsigned int header_done;/* ile już mamy */ | |
| 122 | ||
| 123 | #ifdef __GG_LIBGADU_HAVE_OPENSSL | |
| 124 | SSL *ssl; /* sesja TLS */ | |
| 125 | SSL_CTX *ssl_ctx; /* kontekst sesji? */ | |
| 126 | #else | |
| 127 | void *ssl; /* zachowujemy ABI */ | |
| 128 | void *ssl_ctx; | |
| 129 | #endif | |
| 130 | ||
| 131 | int image_size; /* maksymalny rozmiar obrazków w KiB */ | |
| 132 | ||
| 133 | char *userlist_reply; /* fragment odpowiedzi listy kontaktów */ | |
| 134 | ||
| 135 | int userlist_blocks; /* na ile kawałków podzielono listę kontaktów */ | |
| 136 | ||
| 137 | struct gg_image_queue *images; /* aktualnie wczytywane obrazki */ | |
| 138 | }; | |
| 139 | ||
| 140 | /* | |
| 141 | * struct gg_http | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
142 | * |
| 11360 | 143 | * ogólna struktura opisująca stan wszystkich operacji HTTP. tworzona |
| 144 | * przez gg_http_connect(), zwalniana przez gg_http_free(). | |
| 145 | */ | |
| 146 | struct gg_http { | |
| 147 | gg_common_head(struct gg_http) | |
| 148 | ||
| 149 | int async; /* czy połączenie asynchroniczne */ | |
| 150 | int pid; /* pid procesu resolvera */ | |
| 151 | int port; /* port, z którym się łączymy */ | |
| 152 | ||
| 153 | char *query; /* bufor zapytania http */ | |
| 154 | char *header; /* bufor nagłówka */ | |
| 155 | int header_size; /* rozmiar wczytanego nagłówka */ | |
| 156 | char *body; /* bufor otrzymanych informacji */ | |
| 157 | unsigned int body_size; /* oczekiwana ilość informacji */ | |
| 158 | ||
| 159 | void *data; /* dane danej operacji http */ | |
| 160 | ||
| 161 | char *user_data; /* dane użytkownika, nie są zwalniane przez gg_http_free() */ | |
| 162 | ||
| 163 | void *resolver; /* wskaźnik na informacje resolvera */ | |
| 164 | ||
| 165 | unsigned int body_done; /* ile już treści odebrano? */ | |
| 166 | }; | |
| 167 | ||
| 168 | #ifdef __GNUC__ | |
| 169 | #define GG_PACKED __attribute__ ((packed)) | |
| 170 | #else | |
| 171 | #define GG_PACKED | |
| 172 | #endif | |
| 173 | ||
| 174 | #define GG_MAX_PATH 276 | |
| 175 | ||
| 176 | /* | |
| 177 | * struct gg_file_info | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
178 | * |
| 11360 | 179 | * odpowiednik windowsowej struktury WIN32_FIND_DATA niezbędnej przy |
| 180 | * wysyłaniu plików. | |
| 181 | */ | |
| 182 | struct gg_file_info { | |
| 183 | uint32_t mode; /* dwFileAttributes */ | |
| 184 | uint32_t ctime[2]; /* ftCreationTime */ | |
| 185 | uint32_t atime[2]; /* ftLastAccessTime */ | |
| 186 | uint32_t mtime[2]; /* ftLastWriteTime */ | |
| 187 | uint32_t size_hi; /* nFileSizeHigh */ | |
| 188 | uint32_t size; /* nFileSizeLow */ | |
| 189 | uint32_t reserved0; /* dwReserved0 */ | |
| 190 | uint32_t reserved1; /* dwReserved1 */ | |
| 191 | unsigned char filename[GG_MAX_PATH - 14]; /* cFileName */ | |
| 192 | unsigned char short_filename[14]; /* cAlternateFileName */ | |
| 193 | } GG_PACKED; | |
| 194 | ||
| 195 | /* | |
| 196 | * struct gg_dcc | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
197 | * |
| 11360 | 198 | * struktura opisująca nasłuchujące gniazdo połączeń między klientami. |
| 199 | * tworzona przez gg_dcc_socket_create(), zwalniana przez gg_dcc_free(). | |
| 200 | */ | |
| 201 | struct gg_dcc { | |
| 202 | gg_common_head(struct gg_dcc) | |
| 203 | ||
| 204 | struct gg_event *event; /* opis zdarzenia */ | |
| 205 | ||
| 206 | int active; /* czy to my się łączymy? */ | |
| 207 | int port; /* port, na którym siedzi */ | |
| 208 | uin_t uin; /* uin klienta */ | |
| 209 | uin_t peer_uin; /* uin drugiej strony */ | |
| 210 | int file_fd; /* deskryptor pliku */ | |
| 211 | unsigned int offset; /* offset w pliku */ | |
| 212 | unsigned int chunk_size;/* rozmiar kawałka */ | |
| 213 | unsigned int chunk_offset;/* offset w aktualnym kawałku */ | |
| 214 | struct gg_file_info file_info; | |
| 215 | /* informacje o pliku */ | |
| 216 | int established; /* połączenie ustanowione */ | |
|
12218
e65f13592888
[gaim-migrate @ 14520]
Richard Laager <rlaager@pidgin.im>
parents:
12007
diff
changeset
|
217 | uint8_t *voice_buf; /* bufor na pakiet połączenia głosowego */ |
| 11360 | 218 | int incoming; /* połączenie przychodzące */ |
| 219 | char *chunk_buf; /* bufor na kawałek danych */ | |
| 220 | uint32_t remote_addr; /* adres drugiej strony */ | |
| 221 | uint16_t remote_port; /* port drugiej strony */ | |
| 222 | }; | |
| 223 | ||
| 224 | /* | |
| 225 | * enum gg_session_t | |
| 226 | * | |
| 227 | * rodzaje sesji. | |
| 228 | */ | |
| 229 | enum gg_session_t { | |
| 230 | GG_SESSION_GG = 1, /* połączenie z serwerem gg */ | |
| 231 | GG_SESSION_HTTP, /* ogólna sesja http */ | |
| 232 | GG_SESSION_SEARCH, /* szukanie */ | |
| 233 | GG_SESSION_REGISTER, /* rejestrowanie */ | |
| 234 | GG_SESSION_REMIND, /* przypominanie hasła */ | |
| 235 | GG_SESSION_PASSWD, /* zmiana hasła */ | |
| 236 | GG_SESSION_CHANGE, /* zmiana informacji o sobie */ | |
| 237 | GG_SESSION_DCC, /* ogólne połączenie DCC */ | |
| 238 | GG_SESSION_DCC_SOCKET, /* nasłuchujący socket */ | |
| 239 | GG_SESSION_DCC_SEND, /* wysyłanie pliku */ | |
| 240 | GG_SESSION_DCC_GET, /* odbieranie pliku */ | |
| 241 | GG_SESSION_DCC_VOICE, /* rozmowa głosowa */ | |
| 242 | GG_SESSION_USERLIST_GET, /* pobieranie userlisty */ | |
| 243 | GG_SESSION_USERLIST_PUT, /* wysyłanie userlisty */ | |
| 244 | GG_SESSION_UNREGISTER, /* usuwanie konta */ | |
| 245 | GG_SESSION_USERLIST_REMOVE, /* usuwanie userlisty */ | |
| 246 | GG_SESSION_TOKEN, /* pobieranie tokenu */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
247 | |
| 11360 | 248 | GG_SESSION_USER0 = 256, /* zdefiniowana dla użytkownika */ |
| 249 | GG_SESSION_USER1, /* j.w. */ | |
| 250 | GG_SESSION_USER2, /* j.w. */ | |
| 251 | GG_SESSION_USER3, /* j.w. */ | |
| 252 | GG_SESSION_USER4, /* j.w. */ | |
| 253 | GG_SESSION_USER5, /* j.w. */ | |
| 254 | GG_SESSION_USER6, /* j.w. */ | |
| 255 | GG_SESSION_USER7 /* j.w. */ | |
| 256 | }; | |
| 257 | ||
| 258 | /* | |
| 259 | * enum gg_state_t | |
| 260 | * | |
| 261 | * opisuje stan asynchronicznej maszyny. | |
| 262 | */ | |
| 263 | enum gg_state_t { | |
| 264 | /* wspólne */ | |
| 265 | GG_STATE_IDLE = 0, /* nie powinno wystąpić. */ | |
| 266 | GG_STATE_RESOLVING, /* wywołał gethostbyname() */ | |
| 267 | GG_STATE_CONNECTING, /* wywołał connect() */ | |
| 268 | GG_STATE_READING_DATA, /* czeka na dane http */ | |
| 269 | GG_STATE_ERROR, /* wystąpił błąd. kod w x->error */ | |
| 270 | ||
| 271 | /* gg_session */ | |
| 272 | GG_STATE_CONNECTING_HUB, /* wywołał connect() na huba */ | |
| 273 | GG_STATE_CONNECTING_GG, /* wywołał connect() na serwer */ | |
| 274 | GG_STATE_READING_KEY, /* czeka na klucz */ | |
| 275 | GG_STATE_READING_REPLY, /* czeka na odpowiedź */ | |
| 276 | GG_STATE_CONNECTED, /* połączył się */ | |
| 277 | ||
| 278 | /* gg_http */ | |
| 279 | GG_STATE_SENDING_QUERY, /* wysyła zapytanie http */ | |
| 280 | GG_STATE_READING_HEADER, /* czeka na nagłówek http */ | |
| 281 | GG_STATE_PARSING, /* przetwarza dane */ | |
| 282 | GG_STATE_DONE, /* skończył */ | |
| 283 | ||
| 284 | /* gg_dcc */ | |
| 285 | GG_STATE_LISTENING, /* czeka na połączenia */ | |
| 286 | GG_STATE_READING_UIN_1, /* czeka na uin peera */ | |
| 287 | GG_STATE_READING_UIN_2, /* czeka na swój uin */ | |
| 288 | GG_STATE_SENDING_ACK, /* wysyła potwierdzenie dcc */ | |
| 289 | GG_STATE_READING_ACK, /* czeka na potwierdzenie dcc */ | |
| 290 | GG_STATE_READING_REQUEST, /* czeka na komendę */ | |
| 291 | GG_STATE_SENDING_REQUEST, /* wysyła komendę */ | |
| 292 | GG_STATE_SENDING_FILE_INFO, /* wysyła informacje o pliku */ | |
| 293 | GG_STATE_READING_PRE_FILE_INFO, /* czeka na pakiet przed file_info */ | |
| 294 | GG_STATE_READING_FILE_INFO, /* czeka na informacje o pliku */ | |
| 295 | GG_STATE_SENDING_FILE_ACK, /* wysyła potwierdzenie pliku */ | |
| 296 | GG_STATE_READING_FILE_ACK, /* czeka na potwierdzenie pliku */ | |
| 297 | GG_STATE_SENDING_FILE_HEADER, /* wysyła nagłówek pliku */ | |
| 298 | GG_STATE_READING_FILE_HEADER, /* czeka na nagłówek */ | |
| 299 | GG_STATE_GETTING_FILE, /* odbiera plik */ | |
| 300 | GG_STATE_SENDING_FILE, /* wysyła plik */ | |
| 301 | GG_STATE_READING_VOICE_ACK, /* czeka na potwierdzenie voip */ | |
| 302 | GG_STATE_READING_VOICE_HEADER, /* czeka na rodzaj bloku voip */ | |
| 303 | GG_STATE_READING_VOICE_SIZE, /* czeka na rozmiar bloku voip */ | |
| 304 | GG_STATE_READING_VOICE_DATA, /* czeka na dane voip */ | |
| 305 | GG_STATE_SENDING_VOICE_ACK, /* wysyła potwierdzenie voip */ | |
| 306 | GG_STATE_SENDING_VOICE_REQUEST, /* wysyła żądanie voip */ | |
| 307 | GG_STATE_READING_TYPE, /* czeka na typ połączenia */ | |
| 308 | ||
| 309 | /* nowe. bez sensu jest to API. */ | |
| 310 | GG_STATE_TLS_NEGOTIATION /* negocjuje połączenie TLS */ | |
| 311 | }; | |
| 312 | ||
| 313 | /* | |
| 314 | * enum gg_check_t | |
| 315 | * | |
| 316 | * informuje, co proces klienta powinien sprawdzić na deskryptorze danego | |
| 317 | * połączenia. | |
| 318 | */ | |
| 319 | enum gg_check_t { | |
| 320 | GG_CHECK_NONE = 0, /* nic. nie powinno wystąpić */ | |
| 321 | GG_CHECK_WRITE = 1, /* sprawdzamy możliwość zapisu */ | |
| 322 | GG_CHECK_READ = 2 /* sprawdzamy możliwość odczytu */ | |
| 323 | }; | |
| 324 | ||
| 325 | /* | |
| 326 | * struct gg_login_params | |
| 327 | * | |
| 328 | * parametry gg_login(). przeniesiono do struktury, żeby uniknąć problemów | |
| 329 | * z ciągłymi zmianami API, gdy dodano coś nowego do protokołu. | |
| 330 | */ | |
| 331 | struct gg_login_params { | |
| 332 | uin_t uin; /* numerek */ | |
| 333 | char *password; /* hasło */ | |
| 334 | int async; /* asynchroniczne sockety? */ | |
| 335 | int status; /* początkowy status klienta */ | |
| 336 | char *status_descr; /* opis statusu */ | |
| 337 | uint32_t server_addr; /* adres serwera gg */ | |
| 338 | uint16_t server_port; /* port serwera gg */ | |
| 339 | uint32_t client_addr; /* adres dcc klienta */ | |
| 340 | uint16_t client_port; /* port dcc klienta */ | |
| 341 | int protocol_version; /* wersja protokołu */ | |
| 342 | char *client_version; /* wersja klienta */ | |
| 343 | int has_audio; /* czy ma dźwięk? */ | |
| 344 | int last_sysmsg; /* ostatnia wiadomość systemowa */ | |
| 345 | uint32_t external_addr; /* adres widziany na zewnatrz */ | |
| 346 | uint16_t external_port; /* port widziany na zewnatrz */ | |
| 347 | int tls; /* czy łączymy po TLS? */ | |
| 348 | int image_size; /* maksymalny rozmiar obrazka w KiB */ | |
| 349 | int era_omnix; /* czy udawać klienta era omnix? */ | |
| 350 | ||
| 351 | char dummy[6 * sizeof(int)]; /* miejsce na kolejnych 6 zmiennych, | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
352 | * żeby z dodaniem parametru nie |
| 11360 | 353 | * zmieniał się rozmiar struktury */ |
| 354 | }; | |
| 355 | ||
| 356 | struct gg_session *gg_login(const struct gg_login_params *p); | |
| 357 | void gg_free_session(struct gg_session *sess); | |
| 358 | void gg_logoff(struct gg_session *sess); | |
| 359 | int gg_change_status(struct gg_session *sess, int status); | |
| 360 | int gg_change_status_descr(struct gg_session *sess, int status, const char *descr); | |
| 361 | int gg_change_status_descr_time(struct gg_session *sess, int status, const char *descr, int time); | |
| 362 | int gg_send_message(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message); | |
| 363 | int gg_send_message_richtext(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, const unsigned char *format, int formatlen); | |
| 364 | int gg_send_message_confer(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message); | |
| 365 | int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message, const unsigned char *format, int formatlen); | |
| 366 | int gg_send_message_ctcp(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, int message_len); | |
| 367 | int gg_ping(struct gg_session *sess); | |
| 368 | int gg_userlist_request(struct gg_session *sess, char type, const char *request); | |
| 369 | int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_t crc32); | |
|
12218
e65f13592888
[gaim-migrate @ 14520]
Richard Laager <rlaager@pidgin.im>
parents:
12007
diff
changeset
|
370 | int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size); |
| 11360 | 371 | |
| 372 | uint32_t gg_crc32(uint32_t crc, const unsigned char *buf, int len); | |
| 373 | ||
| 374 | struct gg_image_queue { | |
| 375 | uin_t sender; /* nadawca obrazka */ | |
| 376 | uint32_t size; /* rozmiar */ | |
| 377 | uint32_t crc32; /* suma kontrolna */ | |
| 378 | char *filename; /* nazwa pliku */ | |
| 379 | char *image; /* bufor z obrazem */ | |
| 380 | uint32_t done; /* ile już wczytano */ | |
| 381 | ||
| 382 | struct gg_image_queue *next; /* następny na liście */ | |
| 383 | }; | |
| 384 | ||
| 385 | /* | |
| 386 | * enum gg_event_t | |
| 387 | * | |
| 388 | * rodzaje zdarzeń. | |
| 389 | */ | |
| 390 | enum gg_event_t { | |
| 391 | GG_EVENT_NONE = 0, /* nic się nie wydarzyło */ | |
| 392 | GG_EVENT_MSG, /* otrzymano wiadomość */ | |
| 393 | GG_EVENT_NOTIFY, /* ktoś się pojawił */ | |
| 394 | GG_EVENT_NOTIFY_DESCR, /* ktoś się pojawił z opisem */ | |
| 395 | GG_EVENT_STATUS, /* ktoś zmienił stan */ | |
| 396 | GG_EVENT_ACK, /* potwierdzenie wysłania wiadomości */ | |
| 397 | GG_EVENT_PONG, /* pakiet pong */ | |
| 398 | GG_EVENT_CONN_FAILED, /* połączenie się nie udało */ | |
| 399 | GG_EVENT_CONN_SUCCESS, /* połączenie się powiodło */ | |
| 400 | GG_EVENT_DISCONNECT, /* serwer zrywa połączenie */ | |
| 401 | ||
| 402 | GG_EVENT_DCC_NEW, /* nowe połączenie między klientami */ | |
| 403 | GG_EVENT_DCC_ERROR, /* błąd połączenia między klientami */ | |
| 404 | GG_EVENT_DCC_DONE, /* zakończono połączenie */ | |
| 405 | GG_EVENT_DCC_CLIENT_ACCEPT, /* moment akceptacji klienta */ | |
| 406 | GG_EVENT_DCC_CALLBACK, /* klient się połączył na żądanie */ | |
| 407 | GG_EVENT_DCC_NEED_FILE_INFO, /* należy wypełnić file_info */ | |
| 408 | GG_EVENT_DCC_NEED_FILE_ACK, /* czeka na potwierdzenie pliku */ | |
| 409 | GG_EVENT_DCC_NEED_VOICE_ACK, /* czeka na potwierdzenie rozmowy */ | |
| 410 | GG_EVENT_DCC_VOICE_DATA, /* ramka danych rozmowy głosowej */ | |
| 411 | ||
| 412 | GG_EVENT_PUBDIR50_SEARCH_REPLY, /* odpowiedz wyszukiwania */ | |
| 413 | GG_EVENT_PUBDIR50_READ, /* odczytano własne dane z katalogu */ | |
| 414 | GG_EVENT_PUBDIR50_WRITE, /* wpisano własne dane do katalogu */ | |
| 415 | ||
| 416 | GG_EVENT_STATUS60, /* ktoś zmienił stan w GG 6.0 */ | |
| 417 | GG_EVENT_NOTIFY60, /* ktoś się pojawił w GG 6.0 */ | |
| 418 | GG_EVENT_USERLIST, /* odpowiedź listy kontaktów w GG 6.0 */ | |
| 419 | GG_EVENT_IMAGE_REQUEST, /* prośba o wysłanie obrazka GG 6.0 */ | |
| 420 | GG_EVENT_IMAGE_REPLY, /* podesłany obrazek GG 6.0 */ | |
| 421 | GG_EVENT_DCC_ACK /* potwierdzenie transmisji */ | |
| 422 | }; | |
| 423 | ||
| 424 | #define GG_EVENT_SEARCH50_REPLY GG_EVENT_PUBDIR50_SEARCH_REPLY | |
| 425 | ||
| 426 | /* | |
| 427 | * enum gg_failure_t | |
| 428 | * | |
| 429 | * określa powód nieudanego połączenia. | |
| 430 | */ | |
| 431 | enum gg_failure_t { | |
| 432 | GG_FAILURE_RESOLVING = 1, /* nie znaleziono serwera */ | |
| 433 | GG_FAILURE_CONNECTING, /* nie można się połączyć */ | |
| 434 | GG_FAILURE_INVALID, /* serwer zwrócił nieprawidłowe dane */ | |
| 435 | GG_FAILURE_READING, /* zerwano połączenie podczas odczytu */ | |
| 436 | GG_FAILURE_WRITING, /* zerwano połączenie podczas zapisu */ | |
| 437 | GG_FAILURE_PASSWORD, /* nieprawidłowe hasło */ | |
| 438 | GG_FAILURE_404, /* XXX nieużywane */ | |
| 439 | GG_FAILURE_TLS, /* błąd negocjacji TLS */ | |
| 440 | GG_FAILURE_NEED_EMAIL /* serwer rozłączył nas z prośbą o zmianę emaila */ | |
| 441 | }; | |
| 442 | ||
| 443 | /* | |
| 444 | * enum gg_error_t | |
| 445 | * | |
| 446 | * określa rodzaj błędu wywołanego przez daną operację. nie zawiera | |
| 447 | * przesadnie szczegółowych informacji o powodzie błędu, by nie komplikować | |
| 448 | * obsługi błędów. jeśli wymagana jest większa dokładność, należy sprawdzić | |
| 449 | * zawartość zmiennej errno. | |
| 450 | */ | |
| 451 | enum gg_error_t { | |
| 452 | GG_ERROR_RESOLVING = 1, /* błąd znajdowania hosta */ | |
| 453 | GG_ERROR_CONNECTING, /* błąd łaczenia się */ | |
| 454 | GG_ERROR_READING, /* błąd odczytu */ | |
| 455 | GG_ERROR_WRITING, /* błąd wysyłania */ | |
| 456 | ||
| 457 | GG_ERROR_DCC_HANDSHAKE, /* błąd negocjacji */ | |
| 458 | GG_ERROR_DCC_FILE, /* błąd odczytu/zapisu pliku */ | |
| 459 | GG_ERROR_DCC_EOF, /* plik się skończył? */ | |
| 460 | GG_ERROR_DCC_NET, /* błąd wysyłania/odbierania */ | |
| 461 | GG_ERROR_DCC_REFUSED /* połączenie odrzucone przez usera */ | |
| 462 | }; | |
| 463 | ||
| 464 | /* | |
| 465 | * struktury dotyczące wyszukiwania w GG 5.0. NIE NALEŻY SIĘ DO NICH | |
| 466 | * ODWOŁYWAĆ BEZPOŚREDNIO! do dostępu do nich służą funkcje gg_pubdir50_*() | |
| 467 | */ | |
| 468 | struct gg_pubdir50_entry { | |
| 469 | int num; | |
| 470 | char *field; | |
| 471 | char *value; | |
| 472 | }; | |
| 473 | ||
| 474 | struct gg_pubdir50_s { | |
| 475 | int count; | |
| 476 | uin_t next; | |
| 477 | int type; | |
| 478 | uint32_t seq; | |
| 479 | struct gg_pubdir50_entry *entries; | |
| 480 | int entries_count; | |
| 481 | }; | |
| 482 | ||
| 483 | /* | |
| 484 | * typedef gg_pubdir_50_t | |
| 485 | * | |
| 486 | * typ opisujący zapytanie lub wynik zapytania katalogu publicznego | |
| 487 | * z protokołu GG 5.0. nie należy się odwoływać bezpośrednio do jego | |
| 488 | * pól -- służą do tego funkcje gg_pubdir50_*() | |
| 489 | */ | |
| 490 | typedef struct gg_pubdir50_s *gg_pubdir50_t; | |
| 491 | ||
| 492 | /* | |
| 493 | * struct gg_event | |
| 494 | * | |
| 495 | * struktura opisująca rodzaj zdarzenia. wychodzi z gg_watch_fd() lub | |
| 496 | * z gg_dcc_watch_fd() | |
| 497 | */ | |
| 498 | struct gg_event { | |
| 499 | int type; /* rodzaj zdarzenia -- gg_event_t */ | |
| 500 | union { /* @event */ | |
| 501 | struct gg_notify_reply *notify; /* informacje o liście kontaktów -- GG_EVENT_NOTIFY */ | |
| 502 | ||
| 503 | enum gg_failure_t failure; /* błąd połączenia -- GG_EVENT_FAILURE */ | |
| 504 | ||
| 505 | struct gg_dcc *dcc_new; /* nowe połączenie bezpośrednie -- GG_EVENT_DCC_NEW */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
506 | |
| 11360 | 507 | int dcc_error; /* błąd połączenia bezpośredniego -- GG_EVENT_DCC_ERROR */ |
| 508 | ||
| 509 | gg_pubdir50_t pubdir50; /* wynik operacji związanej z katalogiem publicznym -- GG_EVENT_PUBDIR50_* */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
510 | |
| 11360 | 511 | struct { /* @msg odebrano wiadomość -- GG_EVENT_MSG */ |
| 512 | uin_t sender; /* numer nadawcy */ | |
| 513 | int msgclass; /* klasa wiadomości */ | |
| 514 | time_t time; /* czas nadania */ | |
| 515 | unsigned char *message; /* treść wiadomości */ | |
| 516 | ||
| 517 | int recipients_count; /* ilość odbiorców konferencji */ | |
| 518 | uin_t *recipients; /* odbiorcy konferencji */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
519 | |
| 11360 | 520 | int formats_length; /* długość informacji o formatowaniu tekstu */ |
| 521 | void *formats; /* informacje o formatowaniu tekstu */ | |
| 522 | } msg; | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
523 | |
| 11360 | 524 | struct { /* @notify_descr informacje o liście kontaktów z opisami stanu -- GG_EVENT_NOTIFY_DESCR */ |
| 525 | struct gg_notify_reply *notify; /* informacje o liście kontaktów */ | |
| 526 | char *descr; /* opis stanu */ | |
| 527 | } notify_descr; | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
528 | |
| 11360 | 529 | struct { /* @status zmiana stanu -- GG_EVENT_STATUS */ |
| 530 | uin_t uin; /* numer */ | |
| 531 | uint32_t status; /* nowy stan */ | |
| 532 | char *descr; /* opis stanu */ | |
| 533 | } status; | |
| 534 | ||
| 535 | struct { /* @status60 zmiana stanu -- GG_EVENT_STATUS60 */ | |
| 536 | uin_t uin; /* numer */ | |
| 537 | int status; /* nowy stan */ | |
| 538 | uint32_t remote_ip; /* adres ip */ | |
| 539 | uint16_t remote_port; /* port */ | |
| 540 | int version; /* wersja klienta */ | |
| 541 | int image_size; /* maksymalny rozmiar grafiki w KiB */ | |
| 542 | char *descr; /* opis stanu */ | |
| 543 | time_t time; /* czas powrotu */ | |
| 544 | } status60; | |
| 545 | ||
| 546 | struct { /* @notify60 informacja o liście kontaktów -- GG_EVENT_NOTIFY60 */ | |
| 547 | uin_t uin; /* numer */ | |
| 548 | int status; /* stan */ | |
| 549 | uint32_t remote_ip; /* adres ip */ | |
| 550 | uint16_t remote_port; /* port */ | |
| 551 | int version; /* wersja klienta */ | |
| 552 | int image_size; /* maksymalny rozmiar grafiki w KiB */ | |
| 553 | char *descr; /* opis stanu */ | |
| 554 | time_t time; /* czas powrotu */ | |
| 555 | } *notify60; | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
556 | |
| 11360 | 557 | struct { /* @ack potwierdzenie wiadomości -- GG_EVENT_ACK */ |
| 558 | uin_t recipient; /* numer odbiorcy */ | |
| 559 | int status; /* stan doręczenia wiadomości */ | |
| 560 | int seq; /* numer sekwencyjny wiadomości */ | |
| 561 | } ack; | |
| 562 | ||
| 563 | struct { /* @dcc_voice_data otrzymano dane dźwiękowe -- GG_EVENT_DCC_VOICE_DATA */ | |
| 564 | uint8_t *data; /* dane dźwiękowe */ | |
| 565 | int length; /* ilość danych dźwiękowych */ | |
| 566 | } dcc_voice_data; | |
| 567 | ||
| 568 | struct { /* @userlist odpowiedź listy kontaktów serwera */ | |
| 569 | char type; /* rodzaj odpowiedzi */ | |
| 570 | char *reply; /* treść odpowiedzi */ | |
| 571 | } userlist; | |
| 572 | ||
| 573 | struct { /* @image_request prośba o obrazek */ | |
| 574 | uin_t sender; /* nadawca prośby */ | |
| 575 | uint32_t size; /* rozmiar obrazka */ | |
| 576 | uint32_t crc32; /* suma kontrolna */ | |
| 577 | } image_request; | |
| 578 | ||
| 579 | struct { /* @image_reply odpowiedź z obrazkiem */ | |
| 580 | uin_t sender; /* nadawca odpowiedzi */ | |
| 581 | uint32_t size; /* rozmiar obrazka */ | |
| 582 | uint32_t crc32; /* suma kontrolna */ | |
| 583 | char *filename; /* nazwa pliku */ | |
| 584 | char *image; /* bufor z obrazkiem */ | |
| 585 | } image_reply; | |
| 586 | } event; | |
| 587 | }; | |
| 588 | ||
| 589 | struct gg_event *gg_watch_fd(struct gg_session *sess); | |
| 590 | void gg_event_free(struct gg_event *e); | |
| 591 | #define gg_free_event gg_event_free | |
| 592 | ||
| 593 | /* | |
| 594 | * funkcje obsługi listy kontaktów. | |
| 595 | */ | |
| 596 | int gg_notify_ex(struct gg_session *sess, uin_t *userlist, char *types, int count); | |
| 597 | int gg_notify(struct gg_session *sess, uin_t *userlist, int count); | |
| 598 | int gg_add_notify_ex(struct gg_session *sess, uin_t uin, char type); | |
| 599 | int gg_add_notify(struct gg_session *sess, uin_t uin); | |
| 600 | int gg_remove_notify_ex(struct gg_session *sess, uin_t uin, char type); | |
| 601 | int gg_remove_notify(struct gg_session *sess, uin_t uin); | |
| 602 | ||
| 603 | /* | |
| 604 | * funkcje obsługi http. | |
| 605 | */ | |
| 606 | struct gg_http *gg_http_connect(const char *hostname, int port, int async, const char *method, const char *path, const char *header); | |
| 607 | int gg_http_watch_fd(struct gg_http *h); | |
| 608 | void gg_http_stop(struct gg_http *h); | |
| 609 | void gg_http_free(struct gg_http *h); | |
| 610 | void gg_http_free_fields(struct gg_http *h); | |
| 611 | #define gg_free_http gg_http_free | |
| 612 | ||
| 613 | /* | |
| 614 | * struktury opisująca kryteria wyszukiwania dla gg_search(). nieaktualne, | |
| 615 | * zastąpione przez gg_pubdir50_t. pozostawiono je dla zachowania ABI. | |
| 616 | */ | |
| 617 | struct gg_search_request { | |
| 618 | int active; | |
| 619 | unsigned int start; | |
| 620 | char *nickname; | |
| 621 | char *first_name; | |
| 622 | char *last_name; | |
| 623 | char *city; | |
| 624 | int gender; | |
| 625 | int min_birth; | |
| 626 | int max_birth; | |
| 627 | char *email; | |
| 628 | char *phone; | |
| 629 | uin_t uin; | |
| 630 | }; | |
| 631 | ||
| 632 | struct gg_search { | |
| 633 | int count; | |
| 634 | struct gg_search_result *results; | |
| 635 | }; | |
| 636 | ||
| 637 | struct gg_search_result { | |
| 638 | uin_t uin; | |
| 639 | char *first_name; | |
| 640 | char *last_name; | |
| 641 | char *nickname; | |
| 642 | int born; | |
| 643 | int gender; | |
| 644 | char *city; | |
| 645 | int active; | |
| 646 | }; | |
| 647 | ||
| 648 | #define GG_GENDER_NONE 0 | |
| 649 | #define GG_GENDER_FEMALE 1 | |
| 650 | #define GG_GENDER_MALE 2 | |
| 651 | ||
| 652 | /* | |
| 653 | * funkcje wyszukiwania. | |
| 654 | */ | |
| 655 | struct gg_http *gg_search(const struct gg_search_request *r, int async); | |
| 656 | int gg_search_watch_fd(struct gg_http *f); | |
| 657 | void gg_free_search(struct gg_http *f); | |
| 658 | #define gg_search_free gg_free_search | |
| 659 | ||
| 660 | 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); | |
| 661 | const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start); | |
| 662 | const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start); | |
| 663 | const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start); | |
| 664 | void gg_search_request_free(struct gg_search_request *r); | |
| 665 | ||
| 666 | /* | |
| 667 | * funkcje obsługi katalogu publicznego zgodne z GG 5.0. tym razem funkcje | |
| 668 | * zachowują pewien poziom abstrakcji, żeby uniknąć zmian ABI przy zmianach | |
| 669 | * w protokole. | |
| 670 | * | |
| 671 | * NIE NALEŻY SIĘ ODWOŁYWAĆ DO PÓL gg_pubdir50_t BEZPOŚREDNIO! | |
| 672 | */ | |
| 673 | uint32_t gg_pubdir50(struct gg_session *sess, gg_pubdir50_t req); | |
| 674 | gg_pubdir50_t gg_pubdir50_new(int type); | |
| 675 | int gg_pubdir50_add(gg_pubdir50_t req, const char *field, const char *value); | |
| 676 | int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq); | |
| 677 | const char *gg_pubdir50_get(gg_pubdir50_t res, int num, const char *field); | |
| 678 | int gg_pubdir50_type(gg_pubdir50_t res); | |
| 679 | int gg_pubdir50_count(gg_pubdir50_t res); | |
| 680 | uin_t gg_pubdir50_next(gg_pubdir50_t res); | |
| 681 | uint32_t gg_pubdir50_seq(gg_pubdir50_t res); | |
| 682 | void gg_pubdir50_free(gg_pubdir50_t res); | |
| 683 | ||
| 684 | #define GG_PUBDIR50_UIN "FmNumber" | |
| 685 | #define GG_PUBDIR50_STATUS "FmStatus" | |
| 686 | #define GG_PUBDIR50_FIRSTNAME "firstname" | |
| 687 | #define GG_PUBDIR50_LASTNAME "lastname" | |
| 688 | #define GG_PUBDIR50_NICKNAME "nickname" | |
| 689 | #define GG_PUBDIR50_BIRTHYEAR "birthyear" | |
| 690 | #define GG_PUBDIR50_CITY "city" | |
| 691 | #define GG_PUBDIR50_GENDER "gender" | |
| 692 | #define GG_PUBDIR50_GENDER_FEMALE "1" | |
| 693 | #define GG_PUBDIR50_GENDER_MALE "2" | |
| 694 | #define GG_PUBDIR50_GENDER_SET_FEMALE "2" | |
| 695 | #define GG_PUBDIR50_GENDER_SET_MALE "1" | |
| 696 | #define GG_PUBDIR50_ACTIVE "ActiveOnly" | |
| 697 | #define GG_PUBDIR50_ACTIVE_TRUE "1" | |
| 698 | #define GG_PUBDIR50_START "fmstart" | |
| 699 | #define GG_PUBDIR50_FAMILYNAME "familyname" | |
| 700 | #define GG_PUBDIR50_FAMILYCITY "familycity" | |
| 701 | ||
| 702 | int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length); | |
| 703 | ||
| 704 | /* | |
| 705 | * struct gg_pubdir | |
| 706 | * | |
| 707 | * operacje na katalogu publicznym. | |
| 708 | */ | |
| 709 | struct gg_pubdir { | |
| 710 | int success; /* czy się udało */ | |
| 711 | uin_t uin; /* otrzymany numerek. 0 jeśli błąd */ | |
| 712 | }; | |
| 713 | ||
| 714 | /* ogólne funkcje, nie powinny być używane */ | |
| 715 | int gg_pubdir_watch_fd(struct gg_http *f); | |
| 716 | void gg_pubdir_free(struct gg_http *f); | |
| 717 | #define gg_free_pubdir gg_pubdir_free | |
| 718 | ||
| 719 | struct gg_token { | |
| 720 | int width; /* szerokość obrazka */ | |
| 721 | int height; /* wysokość obrazka */ | |
| 722 | int length; /* ilość znaków w tokenie */ | |
| 723 | char *tokenid; /* id tokenu */ | |
| 724 | }; | |
| 725 | ||
| 726 | /* funkcje dotyczące tokenów */ | |
| 727 | struct gg_http *gg_token(int async); | |
| 728 | int gg_token_watch_fd(struct gg_http *h); | |
| 729 | void gg_token_free(struct gg_http *h); | |
| 730 | ||
| 731 | /* rejestracja nowego numerka */ | |
| 732 | struct gg_http *gg_register(const char *email, const char *password, int async); | |
| 733 | struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async); | |
| 734 | struct gg_http *gg_register3(const char *email, const char *password, const char *tokenid, const char *tokenval, int async); | |
| 735 | #define gg_register_watch_fd gg_pubdir_watch_fd | |
| 736 | #define gg_register_free gg_pubdir_free | |
| 737 | #define gg_free_register gg_pubdir_free | |
| 738 | ||
| 739 | struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async); | |
| 740 | struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async); | |
| 741 | struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *tokenid, const char *tokenval, int async); | |
| 742 | #define gg_unregister_watch_fd gg_pubdir_watch_fd | |
| 743 | #define gg_unregister_free gg_pubdir_free | |
| 744 | ||
| 745 | /* przypomnienie hasła e-mailem */ | |
| 746 | struct gg_http *gg_remind_passwd(uin_t uin, int async); | |
| 747 | struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async); | |
| 748 | struct gg_http *gg_remind_passwd3(uin_t uin, const char *email, const char *tokenid, const char *tokenval, int async); | |
| 749 | #define gg_remind_passwd_watch_fd gg_pubdir_watch_fd | |
| 750 | #define gg_remind_passwd_free gg_pubdir_free | |
| 751 | #define gg_free_remind_passwd gg_pubdir_free | |
| 752 | ||
| 753 | /* zmiana hasła */ | |
| 754 | struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async); | |
| 755 | struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async); | |
| 756 | struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async); | |
| 757 | struct gg_http *gg_change_passwd4(uin_t uin, const char *email, const char *passwd, const char *newpasswd, const char *tokenid, const char *tokenval, int async); | |
| 758 | #define gg_change_passwd_free gg_pubdir_free | |
| 759 | #define gg_free_change_passwd gg_pubdir_free | |
| 760 | ||
| 761 | /* | |
| 762 | * struct gg_change_info_request | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
763 | * |
| 11360 | 764 | * opis żądania zmiany informacji w katalogu publicznym. |
| 765 | */ | |
| 766 | struct gg_change_info_request { | |
| 767 | char *first_name; /* imię */ | |
| 768 | char *last_name; /* nazwisko */ | |
| 769 | char *nickname; /* pseudonim */ | |
| 770 | char *email; /* email */ | |
| 771 | int born; /* rok urodzenia */ | |
| 772 | int gender; /* płeć */ | |
| 773 | char *city; /* miasto */ | |
| 774 | }; | |
| 775 | ||
| 776 | 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); | |
| 777 | void gg_change_info_request_free(struct gg_change_info_request *r); | |
| 778 | ||
| 779 | struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async); | |
| 780 | #define gg_change_pubdir_watch_fd gg_pubdir_watch_fd | |
| 781 | #define gg_change_pubdir_free gg_pubdir_free | |
| 782 | #define gg_free_change_pubdir gg_pubdir_free | |
| 783 | ||
| 784 | /* | |
| 785 | * funkcje dotyczące listy kontaktów na serwerze. | |
| 786 | */ | |
| 787 | struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async); | |
| 788 | int gg_userlist_get_watch_fd(struct gg_http *f); | |
| 789 | void gg_userlist_get_free(struct gg_http *f); | |
| 790 | ||
| 791 | struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async); | |
| 792 | int gg_userlist_put_watch_fd(struct gg_http *f); | |
| 793 | void gg_userlist_put_free(struct gg_http *f); | |
| 794 | ||
| 795 | struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async); | |
| 796 | int gg_userlist_remove_watch_fd(struct gg_http *f); | |
| 797 | void gg_userlist_remove_free(struct gg_http *f); | |
| 798 | ||
| 799 | ||
| 800 | ||
| 801 | /* | |
| 802 | * funkcje dotyczące komunikacji między klientami. | |
| 803 | */ | |
| 804 | extern int gg_dcc_port; /* port, na którym nasłuchuje klient */ | |
| 805 | extern unsigned long gg_dcc_ip; /* adres, na którym nasłuchuje klient */ | |
| 806 | ||
| 807 | int gg_dcc_request(struct gg_session *sess, uin_t uin); | |
| 808 | ||
| 809 | struct gg_dcc *gg_dcc_send_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); | |
| 810 | struct gg_dcc *gg_dcc_get_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); | |
| 811 | struct gg_dcc *gg_dcc_voice_chat(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); | |
| 812 | void gg_dcc_set_type(struct gg_dcc *d, int type); | |
| 813 | int gg_dcc_fill_file_info(struct gg_dcc *d, const char *filename); | |
| 814 | int gg_dcc_fill_file_info2(struct gg_dcc *d, const char *filename, const char *local_filename); | |
| 815 | int gg_dcc_voice_send(struct gg_dcc *d, char *buf, int length); | |
| 816 | ||
| 817 | #define GG_DCC_VOICE_FRAME_LENGTH 195 | |
| 818 | #define GG_DCC_VOICE_FRAME_LENGTH_505 326 | |
| 819 | ||
| 820 | struct gg_dcc *gg_dcc_socket_create(uin_t uin, uint16_t port); | |
| 821 | #define gg_dcc_socket_free gg_free_dcc | |
| 822 | #define gg_dcc_socket_watch_fd gg_dcc_watch_fd | |
| 823 | ||
| 824 | struct gg_event *gg_dcc_watch_fd(struct gg_dcc *d); | |
| 825 | ||
| 826 | void gg_dcc_free(struct gg_dcc *c); | |
| 827 | #define gg_free_dcc gg_dcc_free | |
| 828 | ||
| 829 | /* | |
| 830 | * jeśli chcemy sobie podebugować, wystarczy ustawić `gg_debug_level'. | |
| 831 | * niestety w miarę przybywania wpisów `gg_debug(...)' nie chciało mi | |
| 832 | * się ustawiać odpowiednich leveli, więc większość szła do _MISC. | |
| 833 | */ | |
| 834 | extern int gg_debug_level; /* poziom debugowania. mapa bitowa stałych GG_DEBUG_* */ | |
| 835 | ||
| 836 | /* | |
| 837 | * można podać wskaźnik do funkcji obsługującej wywołania gg_debug(). | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
838 | * nieoficjalne, nieudokumentowane, może się zmienić. jeśli ktoś jest |
| 11360 | 839 | * zainteresowany, niech da znać na ekg-devel. |
| 840 | */ | |
| 841 | extern void (*gg_debug_handler)(int level, const char *format, va_list ap); | |
| 842 | ||
| 843 | /* | |
| 844 | * można podać plik, do którego będą zapisywane teksty z gg_debug(). | |
| 845 | */ | |
| 846 | extern FILE *gg_debug_file; | |
| 847 | ||
| 848 | #define GG_DEBUG_NET 1 | |
| 849 | #define GG_DEBUG_TRAFFIC 2 | |
| 850 | #define GG_DEBUG_DUMP 4 | |
| 851 | #define GG_DEBUG_FUNCTION 8 | |
| 852 | #define GG_DEBUG_MISC 16 | |
| 853 | ||
| 854 | #ifdef GG_DEBUG_DISABLE | |
| 855 | #define gg_debug(x, y...) do { } while(0) | |
| 856 | #else | |
| 857 | void gg_debug(int level, const char *format, ...); | |
| 858 | #endif | |
| 859 | ||
| 860 | const char *gg_libgadu_version(void); | |
| 861 | ||
| 862 | /* | |
| 863 | * konfiguracja http proxy. | |
| 864 | */ | |
| 865 | extern int gg_proxy_enabled; /* włącza obsługę proxy */ | |
| 866 | extern char *gg_proxy_host; /* określa adres serwera proxy */ | |
| 867 | extern int gg_proxy_port; /* określa port serwera proxy */ | |
| 868 | extern char *gg_proxy_username; /* określa nazwę użytkownika przy autoryzacji serwera proxy */ | |
| 869 | extern char *gg_proxy_password; /* określa hasło użytkownika przy autoryzacji serwera proxy */ | |
| 870 | extern int gg_proxy_http_only; /* włącza obsługę proxy wyłącznie dla usług HTTP */ | |
| 871 | ||
| 872 | ||
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
873 | /* |
| 11360 | 874 | * adres, z którego ślemy pakiety (np łączymy się z serwerem) |
| 875 | * używany przy gg_connect() | |
| 876 | */ | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
877 | extern unsigned long gg_local_ip; |
| 11360 | 878 | /* |
| 879 | * ------------------------------------------------------------------------- | |
| 880 | * poniżej znajdują się wewnętrzne sprawy biblioteki. zwykły klient nie | |
| 881 | * powinien ich w ogóle ruszać, bo i nie ma po co. wszystko można załatwić | |
| 882 | * procedurami wyższego poziomu, których definicje znajdują się na początku | |
| 883 | * tego pliku. | |
| 884 | * ------------------------------------------------------------------------- | |
| 885 | */ | |
| 886 | ||
| 887 | #ifdef __GG_LIBGADU_HAVE_PTHREAD | |
| 888 | int gg_resolve_pthread(int *fd, void **resolver, const char *hostname); | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
889 | #elif defined _WIN32 |
|
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
890 | int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname); |
| 11360 | 891 | #endif |
| 892 | ||
| 893 | #ifdef _WIN32 | |
| 894 | int gg_thread_socket(int thread_id, int socket); | |
| 895 | #endif | |
| 896 | ||
| 897 | int gg_resolve(int *fd, int *pid, const char *hostname); | |
| 898 | ||
| 12007 | 899 | #if defined __GNUC__ && !defined _WIN32 |
| 11360 | 900 | char *gg_saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
| 901 | #else | |
| 902 | char *gg_saprintf(const char *format, ...); | |
| 903 | #endif | |
| 904 | ||
| 905 | char *gg_vsaprintf(const char *format, va_list ap); | |
| 906 | ||
| 907 | #define gg_alloc_sprintf gg_saprintf | |
| 908 | ||
| 909 | char *gg_get_line(char **ptr); | |
| 910 | ||
| 911 | int gg_connect(void *addr, int port, int async); | |
| 912 | struct in_addr *gg_gethostbyname(const char *hostname); | |
| 913 | char *gg_read_line(int sock, char *buf, int length); | |
| 914 | void gg_chomp(char *line); | |
| 915 | char *gg_urlencode(const char *str); | |
| 916 | int gg_http_hash(const char *format, ...); | |
| 917 | int gg_read(struct gg_session *sess, char *buf, int length); | |
| 918 | int gg_write(struct gg_session *sess, const char *buf, int length); | |
| 919 | void *gg_recv_packet(struct gg_session *sess); | |
| 920 | int gg_send_packet(struct gg_session *sess, int type, ...); | |
| 921 | unsigned int gg_login_hash(const unsigned char *password, unsigned int seed); | |
| 922 | uint32_t gg_fix32(uint32_t x); | |
| 923 | uint16_t gg_fix16(uint16_t x); | |
| 924 | #define fix16 gg_fix16 | |
| 925 | #define fix32 gg_fix32 | |
| 926 | char *gg_proxy_auth(void); | |
| 927 | char *gg_base64_encode(const char *buf); | |
| 928 | char *gg_base64_decode(const char *buf); | |
| 929 | int gg_image_queue_remove(struct gg_session *s, struct gg_image_queue *q, int freeq); | |
| 930 | ||
| 931 | #define GG_APPMSG_HOST "appmsg.gadu-gadu.pl" | |
| 932 | #define GG_APPMSG_PORT 80 | |
| 933 | #define GG_PUBDIR_HOST "pubdir.gadu-gadu.pl" | |
| 934 | #define GG_PUBDIR_PORT 80 | |
| 935 | #define GG_REGISTER_HOST "register.gadu-gadu.pl" | |
| 936 | #define GG_REGISTER_PORT 80 | |
| 937 | #define GG_REMIND_HOST "retr.gadu-gadu.pl" | |
| 938 | #define GG_REMIND_PORT 80 | |
| 939 | ||
| 940 | #define GG_DEFAULT_PORT 8074 | |
| 941 | #define GG_HTTPS_PORT 443 | |
| 942 | #define GG_HTTP_USERAGENT "Mozilla/4.7 [en] (Win98; I)" | |
| 943 | ||
| 944 | #define GG_DEFAULT_CLIENT_VERSION "6, 1, 0, 158" | |
| 945 | #define GG_DEFAULT_PROTOCOL_VERSION 0x24 | |
| 946 | #define GG_DEFAULT_TIMEOUT 30 | |
| 947 | #define GG_HAS_AUDIO_MASK 0x40000000 | |
| 948 | #define GG_ERA_OMNIX_MASK 0x04000000 | |
| 949 | #define GG_LIBGADU_VERSION "1.5.20050718" | |
| 950 | ||
| 951 | #define GG_DEFAULT_DCC_PORT 1550 | |
| 952 | ||
| 953 | struct gg_header { | |
| 954 | uint32_t type; /* typ pakietu */ | |
| 955 | uint32_t length; /* długość reszty pakietu */ | |
| 956 | } GG_PACKED; | |
| 957 | ||
| 958 | #define GG_WELCOME 0x0001 | |
| 959 | #define GG_NEED_EMAIL 0x0014 | |
| 960 | ||
| 961 | struct gg_welcome { | |
| 962 | uint32_t key; /* klucz szyfrowania hasła */ | |
| 963 | } GG_PACKED; | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
964 | |
| 11360 | 965 | #define GG_LOGIN 0x000c |
| 966 | ||
| 967 | struct gg_login { | |
| 968 | uint32_t uin; /* mój numerek */ | |
| 969 | uint32_t hash; /* hash hasła */ | |
| 970 | uint32_t status; /* status na dzień dobry */ | |
| 971 | uint32_t version; /* moja wersja klienta */ | |
| 972 | uint32_t local_ip; /* mój adres ip */ | |
| 973 | uint16_t local_port; /* port, na którym słucham */ | |
| 974 | } GG_PACKED; | |
| 975 | ||
| 976 | #define GG_LOGIN_EXT 0x0013 | |
| 977 | ||
| 978 | struct gg_login_ext { | |
| 979 | uint32_t uin; /* mój numerek */ | |
| 980 | uint32_t hash; /* hash hasła */ | |
| 981 | uint32_t status; /* status na dzień dobry */ | |
| 982 | uint32_t version; /* moja wersja klienta */ | |
| 983 | uint32_t local_ip; /* mój adres ip */ | |
| 984 | uint16_t local_port; /* port, na którym słucham */ | |
| 985 | uint32_t external_ip; /* zewnętrzny adres ip */ | |
| 986 | uint16_t external_port; /* zewnętrzny port */ | |
| 987 | } GG_PACKED; | |
| 988 | ||
| 989 | #define GG_LOGIN60 0x0015 | |
| 990 | ||
| 991 | struct gg_login60 { | |
| 992 | uint32_t uin; /* mój numerek */ | |
| 993 | uint32_t hash; /* hash hasła */ | |
| 994 | uint32_t status; /* status na dzień dobry */ | |
| 995 | uint32_t version; /* moja wersja klienta */ | |
| 996 | uint8_t dunno1; /* 0x00 */ | |
| 997 | uint32_t local_ip; /* mój adres ip */ | |
| 998 | uint16_t local_port; /* port, na którym słucham */ | |
| 999 | uint32_t external_ip; /* zewnętrzny adres ip */ | |
| 1000 | uint16_t external_port; /* zewnętrzny port */ | |
| 1001 | uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ | |
| 1002 | uint8_t dunno2; /* 0xbe */ | |
| 1003 | } GG_PACKED; | |
| 1004 | ||
| 1005 | #define GG_LOGIN_OK 0x0003 | |
| 1006 | ||
| 1007 | #define GG_LOGIN_FAILED 0x0009 | |
| 1008 | ||
| 1009 | #define GG_PUBDIR50_REQUEST 0x0014 | |
| 1010 | ||
| 1011 | #define GG_PUBDIR50_WRITE 0x01 | |
| 1012 | #define GG_PUBDIR50_READ 0x02 | |
| 1013 | #define GG_PUBDIR50_SEARCH 0x03 | |
| 1014 | #define GG_PUBDIR50_SEARCH_REQUEST GG_PUBDIR50_SEARCH | |
| 1015 | #define GG_PUBDIR50_SEARCH_REPLY 0x05 | |
| 1016 | ||
| 1017 | struct gg_pubdir50_request { | |
| 1018 | uint8_t type; /* GG_PUBDIR50_* */ | |
| 1019 | uint32_t seq; /* czas wysłania zapytania */ | |
| 1020 | } GG_PACKED; | |
| 1021 | ||
| 1022 | #define GG_PUBDIR50_REPLY 0x000e | |
| 1023 | ||
| 1024 | struct gg_pubdir50_reply { | |
| 1025 | uint8_t type; /* GG_PUBDIR50_* */ | |
| 1026 | uint32_t seq; /* czas wysłania zapytania */ | |
| 1027 | } GG_PACKED; | |
| 1028 | ||
| 1029 | #define GG_NEW_STATUS 0x0002 | |
| 1030 | ||
| 1031 | #define GG_STATUS_NOT_AVAIL 0x0001 /* niedostępny */ | |
| 1032 | #define GG_STATUS_NOT_AVAIL_DESCR 0x0015 /* niedostępny z opisem (4.8) */ | |
| 1033 | #define GG_STATUS_AVAIL 0x0002 /* dostępny */ | |
| 1034 | #define GG_STATUS_AVAIL_DESCR 0x0004 /* dostępny z opisem (4.9) */ | |
| 1035 | #define GG_STATUS_BUSY 0x0003 /* zajęty */ | |
| 1036 | #define GG_STATUS_BUSY_DESCR 0x0005 /* zajęty z opisem (4.8) */ | |
| 1037 | #define GG_STATUS_INVISIBLE 0x0014 /* niewidoczny (4.6) */ | |
| 1038 | #define GG_STATUS_INVISIBLE_DESCR 0x0016 /* niewidoczny z opisem (4.9) */ | |
| 1039 | #define GG_STATUS_BLOCKED 0x0006 /* zablokowany */ | |
| 1040 | ||
| 1041 | #define GG_STATUS_FRIENDS_MASK 0x8000 /* tylko dla znajomych (4.6) */ | |
| 1042 | ||
| 1043 | #define GG_STATUS_DESCR_MAXSIZE 70 | |
| 1044 | ||
| 1045 | /* | |
| 1046 | * makra do łatwego i szybkiego sprawdzania stanu. | |
| 1047 | */ | |
| 1048 | ||
| 1049 | /* GG_S_F() tryb tylko dla znajomych */ | |
| 1050 | #define GG_S_F(x) (((x) & GG_STATUS_FRIENDS_MASK) != 0) | |
| 1051 | ||
| 1052 | /* GG_S() stan bez uwzględnienia trybu tylko dla znajomych */ | |
| 1053 | #define GG_S(x) ((x) & ~GG_STATUS_FRIENDS_MASK) | |
| 1054 | ||
| 1055 | /* GG_S_A() dostępny */ | |
| 1056 | #define GG_S_A(x) (GG_S(x) == GG_STATUS_AVAIL || GG_S(x) == GG_STATUS_AVAIL_DESCR) | |
| 1057 | ||
| 1058 | /* GG_S_NA() niedostępny */ | |
| 1059 | #define GG_S_NA(x) (GG_S(x) == GG_STATUS_NOT_AVAIL || GG_S(x) == GG_STATUS_NOT_AVAIL_DESCR) | |
| 1060 | ||
| 1061 | /* GG_S_B() zajęty */ | |
| 1062 | #define GG_S_B(x) (GG_S(x) == GG_STATUS_BUSY || GG_S(x) == GG_STATUS_BUSY_DESCR) | |
| 1063 | ||
| 1064 | /* GG_S_I() niewidoczny */ | |
| 1065 | #define GG_S_I(x) (GG_S(x) == GG_STATUS_INVISIBLE || GG_S(x) == GG_STATUS_INVISIBLE_DESCR) | |
| 1066 | ||
| 1067 | /* GG_S_D() stan opisowy */ | |
| 1068 | #define GG_S_D(x) (GG_S(x) == GG_STATUS_NOT_AVAIL_DESCR || GG_S(x) == GG_STATUS_AVAIL_DESCR || GG_S(x) == GG_STATUS_BUSY_DESCR || GG_S(x) == GG_STATUS_INVISIBLE_DESCR) | |
| 1069 | ||
| 1070 | /* GG_S_BL() blokowany lub blokujący */ | |
| 1071 | #define GG_S_BL(x) (GG_S(x) == GG_STATUS_BLOCKED) | |
| 1072 | ||
| 1073 | struct gg_new_status { | |
| 1074 | uint32_t status; /* na jaki zmienić? */ | |
| 1075 | } GG_PACKED; | |
| 1076 | ||
| 1077 | #define GG_NOTIFY_FIRST 0x000f | |
| 1078 | #define GG_NOTIFY_LAST 0x0010 | |
| 1079 | ||
| 1080 | #define GG_NOTIFY 0x0010 | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1081 | |
| 11360 | 1082 | struct gg_notify { |
| 1083 | uint32_t uin; /* numerek danej osoby */ | |
| 1084 | uint8_t dunno1; /* rodzaj wpisu w liście */ | |
| 1085 | } GG_PACKED; | |
| 1086 | ||
| 1087 | #define GG_USER_OFFLINE 0x01 /* będziemy niewidoczni dla użytkownika */ | |
| 1088 | #define GG_USER_NORMAL 0x03 /* zwykły użytkownik */ | |
| 1089 | #define GG_USER_BLOCKED 0x04 /* zablokowany użytkownik */ | |
| 1090 | ||
| 1091 | #define GG_LIST_EMPTY 0x0012 | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1092 | |
| 11360 | 1093 | #define GG_NOTIFY_REPLY 0x000c /* tak, to samo co GG_LOGIN */ |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1094 | |
| 11360 | 1095 | struct gg_notify_reply { |
| 1096 | uint32_t uin; /* numerek */ | |
| 1097 | uint32_t status; /* status danej osoby */ | |
| 1098 | uint32_t remote_ip; /* adres ip delikwenta */ | |
| 1099 | uint16_t remote_port; /* port, na którym słucha klient */ | |
| 1100 | uint32_t version; /* wersja klienta */ | |
| 1101 | uint16_t dunno2; /* znowu port? */ | |
| 1102 | } GG_PACKED; | |
| 1103 | ||
| 1104 | #define GG_NOTIFY_REPLY60 0x0011 | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1105 | |
| 11360 | 1106 | struct gg_notify_reply60 { |
| 1107 | uint32_t uin; /* numerek plus flagi w MSB */ | |
| 1108 | uint8_t status; /* status danej osoby */ | |
| 1109 | uint32_t remote_ip; /* adres ip delikwenta */ | |
| 1110 | uint16_t remote_port; /* port, na którym słucha klient */ | |
| 1111 | uint8_t version; /* wersja klienta */ | |
| 1112 | uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ | |
| 1113 | uint8_t dunno1; /* 0x00 */ | |
| 1114 | } GG_PACKED; | |
| 1115 | ||
| 1116 | #define GG_STATUS60 0x000f | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1117 | |
| 11360 | 1118 | struct gg_status60 { |
| 1119 | uint32_t uin; /* numerek plus flagi w MSB */ | |
| 1120 | uint8_t status; /* status danej osoby */ | |
| 1121 | uint32_t remote_ip; /* adres ip delikwenta */ | |
| 1122 | uint16_t remote_port; /* port, na którym słucha klient */ | |
| 1123 | uint8_t version; /* wersja klienta */ | |
| 1124 | uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ | |
| 1125 | uint8_t dunno1; /* 0x00 */ | |
| 1126 | } GG_PACKED; | |
| 1127 | ||
| 1128 | #define GG_ADD_NOTIFY 0x000d | |
| 1129 | #define GG_REMOVE_NOTIFY 0x000e | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1130 | |
| 11360 | 1131 | struct gg_add_remove { |
| 1132 | uint32_t uin; /* numerek */ | |
| 1133 | uint8_t dunno1; /* bitmapa */ | |
| 1134 | } GG_PACKED; | |
| 1135 | ||
| 1136 | #define GG_STATUS 0x0002 | |
| 1137 | ||
| 1138 | struct gg_status { | |
| 1139 | uint32_t uin; /* numerek */ | |
| 1140 | uint32_t status; /* nowy stan */ | |
| 1141 | } GG_PACKED; | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1142 | |
| 11360 | 1143 | #define GG_SEND_MSG 0x000b |
| 1144 | ||
| 1145 | #define GG_CLASS_QUEUED 0x0001 | |
| 1146 | #define GG_CLASS_OFFLINE GG_CLASS_QUEUED | |
| 1147 | #define GG_CLASS_MSG 0x0004 | |
| 1148 | #define GG_CLASS_CHAT 0x0008 | |
| 1149 | #define GG_CLASS_CTCP 0x0010 | |
| 1150 | #define GG_CLASS_ACK 0x0020 | |
| 1151 | #define GG_CLASS_EXT GG_CLASS_ACK /* kompatybilność wstecz */ | |
| 1152 | ||
| 1153 | #define GG_MSG_MAXSIZE 2000 | |
| 1154 | ||
| 1155 | struct gg_send_msg { | |
| 1156 | uint32_t recipient; | |
| 1157 | uint32_t seq; | |
| 1158 | uint32_t msgclass; | |
| 1159 | } GG_PACKED; | |
| 1160 | ||
| 1161 | struct gg_msg_richtext { | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1162 | uint8_t flag; |
|
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1163 | uint16_t length; |
| 11360 | 1164 | } GG_PACKED; |
| 1165 | ||
| 1166 | struct gg_msg_richtext_format { | |
| 1167 | uint16_t position; | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1168 | uint8_t font; |
| 11360 | 1169 | } GG_PACKED; |
| 1170 | ||
| 1171 | struct gg_msg_richtext_image { | |
| 1172 | uint16_t unknown1; | |
| 1173 | uint32_t size; | |
| 1174 | uint32_t crc32; | |
| 1175 | } GG_PACKED; | |
| 1176 | ||
| 1177 | #define GG_FONT_BOLD 0x01 | |
| 1178 | #define GG_FONT_ITALIC 0x02 | |
| 1179 | #define GG_FONT_UNDERLINE 0x04 | |
| 1180 | #define GG_FONT_COLOR 0x08 | |
| 1181 | #define GG_FONT_IMAGE 0x80 | |
| 1182 | ||
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1183 | struct gg_msg_richtext_color { |
| 11360 | 1184 | uint8_t red; |
| 1185 | uint8_t green; | |
| 1186 | uint8_t blue; | |
| 1187 | } GG_PACKED; | |
| 1188 | ||
| 1189 | struct gg_msg_recipients { | |
| 1190 | uint8_t flag; | |
| 1191 | uint32_t count; | |
| 1192 | } GG_PACKED; | |
| 1193 | ||
| 1194 | struct gg_msg_image_request { | |
| 1195 | uint8_t flag; | |
| 1196 | uint32_t size; | |
| 1197 | uint32_t crc32; | |
| 1198 | } GG_PACKED; | |
| 1199 | ||
| 1200 | struct gg_msg_image_reply { | |
| 1201 | uint8_t flag; | |
| 1202 | uint32_t size; | |
| 1203 | uint32_t crc32; | |
| 1204 | /* char filename[]; */ | |
| 1205 | /* char image[]; */ | |
| 1206 | } GG_PACKED; | |
| 1207 | ||
| 1208 | #define GG_SEND_MSG_ACK 0x0005 | |
| 1209 | ||
| 1210 | #define GG_ACK_BLOCKED 0x0001 | |
| 1211 | #define GG_ACK_DELIVERED 0x0002 | |
| 1212 | #define GG_ACK_QUEUED 0x0003 | |
| 1213 | #define GG_ACK_MBOXFULL 0x0004 | |
| 1214 | #define GG_ACK_NOT_DELIVERED 0x0006 | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1215 | |
| 11360 | 1216 | struct gg_send_msg_ack { |
| 1217 | uint32_t status; | |
| 1218 | uint32_t recipient; | |
| 1219 | uint32_t seq; | |
| 1220 | } GG_PACKED; | |
| 1221 | ||
| 1222 | #define GG_RECV_MSG 0x000a | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1223 | |
| 11360 | 1224 | struct gg_recv_msg { |
| 1225 | uint32_t sender; | |
| 1226 | uint32_t seq; | |
| 1227 | uint32_t time; | |
| 1228 | uint32_t msgclass; | |
| 1229 | } GG_PACKED; | |
| 1230 | ||
| 1231 | #define GG_PING 0x0008 | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1232 | |
| 11360 | 1233 | #define GG_PONG 0x0007 |
| 1234 | ||
| 1235 | #define GG_DISCONNECTING 0x000b | |
| 1236 | ||
| 1237 | #define GG_USERLIST_REQUEST 0x0016 | |
| 1238 | ||
| 1239 | #define GG_USERLIST_PUT 0x00 | |
| 1240 | #define GG_USERLIST_PUT_MORE 0x01 | |
| 1241 | #define GG_USERLIST_GET 0x02 | |
| 1242 | ||
| 1243 | struct gg_userlist_request { | |
| 1244 | uint8_t type; | |
| 1245 | } GG_PACKED; | |
| 1246 | ||
| 1247 | #define GG_USERLIST_REPLY 0x0010 | |
| 1248 | ||
| 1249 | #define GG_USERLIST_PUT_REPLY 0x00 | |
| 1250 | #define GG_USERLIST_PUT_MORE_REPLY 0x02 | |
| 1251 | #define GG_USERLIST_GET_REPLY 0x06 | |
| 1252 | #define GG_USERLIST_GET_MORE_REPLY 0x04 | |
| 1253 | ||
| 1254 | struct gg_userlist_reply { | |
| 1255 | uint8_t type; | |
| 1256 | } GG_PACKED; | |
| 1257 | ||
| 1258 | /* | |
| 1259 | * pakiety, stałe, struktury dla DCC | |
| 1260 | */ | |
| 1261 | ||
| 1262 | struct gg_dcc_tiny_packet { | |
| 1263 | uint8_t type; /* rodzaj pakietu */ | |
| 1264 | } GG_PACKED; | |
| 1265 | ||
| 1266 | struct gg_dcc_small_packet { | |
| 1267 | uint32_t type; /* rodzaj pakietu */ | |
| 1268 | } GG_PACKED; | |
| 1269 | ||
| 1270 | struct gg_dcc_big_packet { | |
| 1271 | uint32_t type; /* rodzaj pakietu */ | |
| 1272 | uint32_t dunno1; /* niewiadoma */ | |
| 1273 | uint32_t dunno2; /* niewiadoma */ | |
| 1274 | } GG_PACKED; | |
| 1275 | ||
| 1276 | /* | |
| 1277 | * póki co, nie znamy dokładnie protokołu. nie wiemy, co czemu odpowiada. | |
| 1278 | * nazwy są niepoważne i tymczasowe. | |
| 1279 | */ | |
| 1280 | #define GG_DCC_WANT_FILE 0x0003 /* peer chce plik */ | |
| 1281 | #define GG_DCC_HAVE_FILE 0x0001 /* więc mu damy */ | |
| 1282 | #define GG_DCC_HAVE_FILEINFO 0x0003 /* niech ma informacje o pliku */ | |
| 1283 | #define GG_DCC_GIMME_FILE 0x0006 /* peer jest pewny */ | |
| 1284 | #define GG_DCC_CATCH_FILE 0x0002 /* wysyłamy plik */ | |
| 1285 | ||
| 1286 | #define GG_DCC_FILEATTR_READONLY 0x0020 | |
| 1287 | ||
| 1288 | #define GG_DCC_TIMEOUT_SEND 1800 /* 30 minut */ | |
| 1289 | #define GG_DCC_TIMEOUT_GET 1800 /* 30 minut */ | |
| 1290 | #define GG_DCC_TIMEOUT_FILE_ACK 300 /* 5 minut */ | |
| 1291 | #define GG_DCC_TIMEOUT_VOICE_ACK 300 /* 5 minut */ | |
| 1292 | ||
| 1293 | #ifdef __cplusplus | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1294 | #ifdef _MSC_VER |
| 11360 | 1295 | #pragma pack(pop) |
| 1296 | #endif | |
|
11546
acb5676e57bb
[gaim-migrate @ 13801]
Daniel Atallah <datallah@pidgin.im>
parents:
11360
diff
changeset
|
1297 | } |
| 11360 | 1298 | #endif |
| 1299 | ||
| 1300 | #endif /* __GG_LIBGADU_H */ | |
| 1301 | ||
| 1302 | /* | |
| 1303 | * Local variables: | |
| 1304 | * c-indentation-style: k&r | |
| 1305 | * c-basic-offset: 8 | |
| 1306 | * indent-tabs-mode: notnil | |
| 1307 | * End: | |
| 1308 | * | |
| 1309 | * vim: shiftwidth=8: | |
| 1310 | */ |