[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.54,1.55
From: |
Philip S Tellis <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.54,1.55 |
Date: |
Mon, 24 Mar 2003 05:56:38 -0500 |
Update of /cvsroot/ayttm/ayttm/modules/yahoo2
In directory subversions:/tmp/cvs-serv15824/modules/yahoo2
Modified Files:
yahoo.c
Log Message:
async connect for yahoo login
Index: yahoo.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/yahoo2/yahoo.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- yahoo.c 24 Mar 2003 08:40:41 -0000 1.54
+++ yahoo.c 24 Mar 2003 10:56:36 -0000 1.55
@@ -65,6 +65,7 @@
#include "file_select.h"
#include "smileys.h"
#include "add_contact_window.h"
+#include "tcp_util.h"
#include "yahoo2.h"
#include "yahoo2_callbacks.h"
@@ -1553,19 +1554,20 @@
/*ylad->timeout_tag = activity_window_new(buff);*/
ela->connecting = 1;
+ ylad->id = yahoo_init(ela->handle, ylad->password);
LOG(("eb_yahoo_login_with_state"));
yahoo_set_log_level(do_yahoo_debug?YAHOO_LOG_DEBUG:YAHOO_LOG_NONE);
ela->connected = 0;
- ylad->id = yahoo_login(ela->handle, ylad->password, login_mode);
ylad->status = YAHOO_STATUS_OFFLINE;
+ yahoo_login(ylad->id, login_mode);
- if (ylad->id <= 0) {
+/* if (ylad->id <= 0) {
do_message_dialog(_("Could not connect to Yahoo server. Please
verify that you are connected to the net and the pager host and port are
correctly entered."), _("Yahoo Connect Failed"), 0);
return;
}
-
+*/
ref_count++;
}
@@ -1577,6 +1579,7 @@
ela->connecting = 0;
+ /*progress_window_close(ylad->timeout_tag);*/
if(succ == YAHOO_LOGIN_OK) {
ela->connected = 1;
ylad->status = yahoo_current_status(id);
@@ -1586,7 +1589,6 @@
eb_set_active_menu_status(ela->status_menu,
yahoo_to_eb_state_translation(ylad->status));
is_setting_state = 0;
- /*progress_window_close(ylad->timeout_tag);*/
ylad->timeout_tag = eb_timeout_add(600 * 1000,
(void *) eb_yahoo_ping_timeout_callback, ylad);
@@ -2299,64 +2301,27 @@
*/
}
-static int ext_yahoo_connect(char *host, int port)
+static void _yahoo_connected(int fd, int error, void * data)
{
- struct sockaddr_in serv_addr;
- static struct hostent *server;
- static char last_host[256];
- int servfd;
- char **p;
-
- if(last_host[0] || strcasecmp(last_host, host)!=0) {
- if(!(server = gethostbyname(host))) {
- WARNING(("failed to look up server (%s:%d)\n%d: %s",
- host, port,
- h_errno, strerror(h_errno)));
- return -1;
- }
- strncpy(last_host, host, 255);
- }
-
- if((servfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- WARNING(("Socket create error (%d): %s", errno,
strerror(errno)));
- return -1;
- }
-
- LOG(("connecting to %s:%d\n", host, port));
+ eb_local_account * ela = data;
+ eb_yahoo_local_account_data *ylad = ela->protocol_local_account_data;
- for (p = server->h_addr_list; *p; p++)
- {
- memset(&serv_addr, 0, sizeof(serv_addr));
- serv_addr.sin_family = AF_INET;
- memcpy(&serv_addr.sin_addr.s_addr, *p, server->h_length);
- serv_addr.sin_port = htons(port);
-
- LOG(("trying %s", *p));
- if(connect(servfd, (struct sockaddr *) &serv_addr,
- sizeof(serv_addr)) == -1) {
-#ifdef __MINGW32__
- int err = WSAGetLastError();
- if(err!=WSAENETUNREACH && err != WSAECONNREFUSED &&
- err != WSAETIMEDOUT)
-#else
- if(errno!=ECONNREFUSED && errno!=ETIMEDOUT &&
- errno!=ENETUNREACH)
-#endif
- {
- break;
- }
- } else {
- LOG(("connected"));
- return servfd;
- }
- }
+ yahoo_connected(ylad->id, fd, error);
+}
- WARNING(("Could not connect to %s:%d\n%d:%s", host, port, errno,
- strerror(errno)));
- close(servfd);
+static int ext_yahoo_connect(int id, char *host, int port)
+{
+ eb_local_account * ela = yahoo_find_local_account_by_id(id);
+ ay_socket_new_async(host, port, _yahoo_connected, ela);
+ errno = EINPROGRESS;
return -1;
}
+static int ext_yahoo_connect_sync(char *host, int port)
+{
+ return ay_socket_new(host, port);
+}
+
/*************************************
* Callback handling code starts here
*/
@@ -2694,6 +2659,7 @@
yc.ext_yahoo_add_handler = ext_yahoo_add_handler;
yc.ext_yahoo_remove_handler = ext_yahoo_remove_handler;
yc.ext_yahoo_connect = ext_yahoo_connect;
+ yc.ext_yahoo_connect_sync = ext_yahoo_connect_sync;
yahoo_register_callbacks(&yc);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.54,1.55,
Philip S Tellis <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.399,1.400 configure.in,1.395,1.396
- Next by Date:
[Ayttm-commits] CVS: ayttm/modules/yahoo2/libyahoo2 libyahoo2.c,1.16,1.17 yahoo2.h,1.8,1.9 yahoo2_callbacks.h,1.3,1.4
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.399,1.400 configure.in,1.395,1.396
- Next by thread:
[Ayttm-commits] CVS: ayttm/modules/yahoo2/libyahoo2 libyahoo2.c,1.16,1.17 yahoo2.h,1.8,1.9 yahoo2_callbacks.h,1.3,1.4
- Index(es):