Mercurial > pidgin.yaz
comparison src/protocols/oscar/conn.c @ 7285:a50eea7628cb
[gaim-migrate @ 7866]
-Renamed some old functions to aim_buddylist_bleh to fit in with
some of the other stuff.
-Removed AIM_SESS_FLAGS_bleh and replaced sess->flags with sess->nonblocking
-Made the oscar.c libfaim printf handler use a dynamic buffer instead
of static
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 16 Oct 2003 22:21:55 +0000 |
parents | b8fcbff88438 |
children | fa0324675ed9 |
comparison
equal
deleted
inserted
replaced
7284:9152f58ab5ee | 7285:a50eea7628cb |
---|---|
530 memcpy(&sa.sin_addr, hp->h_addr, hp->h_length); | 530 memcpy(&sa.sin_addr, hp->h_addr, hp->h_length); |
531 sa.sin_family = hp->h_addrtype; | 531 sa.sin_family = hp->h_addrtype; |
532 | 532 |
533 fd = socket(hp->h_addrtype, SOCK_STREAM, 0); | 533 fd = socket(hp->h_addrtype, SOCK_STREAM, 0); |
534 | 534 |
535 if (sess->flags & AIM_SESS_FLAGS_NONBLOCKCONNECT) | 535 if (sess->nonblocking) |
536 fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX save flags */ | 536 fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX save flags */ |
537 | 537 |
538 if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { | 538 if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { |
539 if (sess->flags & AIM_SESS_FLAGS_NONBLOCKCONNECT) { | 539 if (sess->nonblocking) { |
540 if ((errno == EINPROGRESS) || (errno == EINTR)) { | 540 if ((errno == EINPROGRESS) || (errno == EINTR)) { |
541 if (statusret) | 541 if (statusret) |
542 *statusret |= AIM_CONN_STATUS_INPROGRESS; | 542 *statusret |= AIM_CONN_STATUS_INPROGRESS; |
543 return fd; | 543 return fd; |
544 } | 544 } |
854 /** | 854 /** |
855 * Initializes a session structure by setting the initial values | 855 * Initializes a session structure by setting the initial values |
856 * stuff in the aim_session_t struct. | 856 * stuff in the aim_session_t struct. |
857 * | 857 * |
858 * @param sess Session to initialize. | 858 * @param sess Session to initialize. |
859 * @param flags Flags to use. nAny of %AIM_SESS_FLAGS %OR'd together. | 859 * @param nonblocking Set to true if you want connections to be non-blocking. |
860 * @param debuglevel Level of debugging output (zero is least). | 860 * @param debuglevel Level of debugging output (zero is least). |
861 */ | 861 */ |
862 faim_export void aim_session_init(aim_session_t *sess, fu32_t flags, int debuglevel) | 862 faim_export void aim_session_init(aim_session_t *sess, bool nonblocking, int debuglevel) |
863 { | 863 { |
864 | 864 |
865 if (!sess) | 865 if (!sess) |
866 return; | 866 return; |
867 | 867 |
877 sess->locate.userinfo = NULL; | 877 sess->locate.userinfo = NULL; |
878 sess->locate.request_queue = NULL; | 878 sess->locate.request_queue = NULL; |
879 sess->locate.waiting_for_response = FALSE; | 879 sess->locate.waiting_for_response = FALSE; |
880 sess->snacid_next = 0x00000001; | 880 sess->snacid_next = 0x00000001; |
881 | 881 |
882 sess->flags = 0; | 882 sess->nonblocking = nonblocking; |
883 sess->debug = debuglevel; | 883 sess->debug = debuglevel; |
884 sess->debugcb = defaultdebugcb; | 884 sess->debugcb = defaultdebugcb; |
885 | 885 |
886 sess->modlistv = NULL; | 886 sess->modlistv = NULL; |
887 | 887 |
892 sess->ssi.pending = NULL; | 892 sess->ssi.pending = NULL; |
893 sess->ssi.timestamp = (time_t)0; | 893 sess->ssi.timestamp = (time_t)0; |
894 sess->ssi.waiting_for_ack = 0; | 894 sess->ssi.waiting_for_ack = 0; |
895 | 895 |
896 sess->authinfo = NULL; | 896 sess->authinfo = NULL; |
897 | |
898 sess->flags |= flags; | |
899 | 897 |
900 /* | 898 /* |
901 * This must always be set. Default to the queue-based | 899 * This must always be set. Default to the queue-based |
902 * version for back-compatibility. | 900 * version for back-compatibility. |
903 */ | 901 */ |