Mercurial > pidgin.yaz
comparison plugins/jabber/jabber.c @ 1315:7f7e3bfb1af7
[gaim-migrate @ 1325]
small changes.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 19 Dec 2000 14:31:15 +0000 |
parents | 9089f72972ee |
children | d5069ad0b6b1 |
comparison
equal
deleted
inserted
replaced
1314:5ad8344b6e50 | 1315:7f7e3bfb1af7 |
---|---|
89 | 89 |
90 static gjconn gjab_new(char *user, char *pass, void *priv); | 90 static gjconn gjab_new(char *user, char *pass, void *priv); |
91 static void gjab_delete(gjconn j); | 91 static void gjab_delete(gjconn j); |
92 static void gjab_state_handler(gjconn j, gjconn_state_h h); | 92 static void gjab_state_handler(gjconn j, gjconn_state_h h); |
93 static void gjab_packet_handler(gjconn j, gjconn_packet_h h); | 93 static void gjab_packet_handler(gjconn j, gjconn_packet_h h); |
94 static void gjab_start(gjconn j); | 94 static void gjab_start(gjconn j, int port); |
95 static void gjab_stop(gjconn j); | 95 static void gjab_stop(gjconn j); |
96 static int gjab_getfd(gjconn j); | 96 static int gjab_getfd(gjconn j); |
97 static jid gjab_getjid(gjconn j); | 97 static jid gjab_getjid(gjconn j); |
98 static char *gjab_getsid(gjconn j); | 98 static char *gjab_getsid(gjconn j); |
99 static char *gjab_getid(gjconn j); | 99 static char *gjab_getid(gjconn j); |
362 | 362 |
363 if (j->current) | 363 if (j->current) |
364 xmlnode_insert_cdata(j->current, s, slen); | 364 xmlnode_insert_cdata(j->current, s, slen); |
365 } | 365 } |
366 | 366 |
367 static void gjab_start(gjconn j) | 367 static void gjab_start(gjconn j, int port) |
368 { | 368 { |
369 xmlnode x; | 369 xmlnode x; |
370 char *t,*t2; | 370 char *t,*t2; |
371 | 371 |
372 if(!j || j->state != JCONN_STATE_OFF) | 372 if(!j || j->state != JCONN_STATE_OFF) |
375 j->parser = XML_ParserCreate(NULL); | 375 j->parser = XML_ParserCreate(NULL); |
376 XML_SetUserData(j->parser, (void *)j); | 376 XML_SetUserData(j->parser, (void *)j); |
377 XML_SetElementHandler(j->parser, startElement, endElement); | 377 XML_SetElementHandler(j->parser, startElement, endElement); |
378 XML_SetCharacterDataHandler(j->parser, charData); | 378 XML_SetCharacterDataHandler(j->parser, charData); |
379 | 379 |
380 j->fd = make_netsocket(5222, j->user->server, NETSOCKET_CLIENT); | 380 j->fd = make_netsocket(port, j->user->server, NETSOCKET_CLIENT); |
381 if(j->fd < 0) { | 381 if(j->fd < 0) { |
382 STATE_EVT(JCONN_STATE_OFF) | 382 STATE_EVT(JCONN_STATE_OFF) |
383 return; | 383 return; |
384 } | 384 } |
385 j->state = JCONN_STATE_CONNECTED; | 385 j->state = JCONN_STATE_CONNECTED; |
595 | 595 |
596 static void jabber_login(struct aim_user *user) { | 596 static void jabber_login(struct aim_user *user) { |
597 struct gaim_connection *gc = new_gaim_conn(user); | 597 struct gaim_connection *gc = new_gaim_conn(user); |
598 struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1); | 598 struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1); |
599 char *tmp; | 599 char *tmp; |
600 int port; | |
600 | 601 |
601 set_login_progress(gc, 1, "Connecting"); | 602 set_login_progress(gc, 1, "Connecting"); |
602 while (gtk_events_pending()) | 603 while (gtk_events_pending()) |
603 gtk_main_iteration(); | 604 gtk_main_iteration(); |
604 | 605 |
618 } | 619 } |
619 g_free(tmp); | 620 g_free(tmp); |
620 | 621 |
621 gjab_state_handler(jd->jc, jabber_handlestate); | 622 gjab_state_handler(jd->jc, jabber_handlestate); |
622 gjab_packet_handler(jd->jc, jabber_handlepacket); | 623 gjab_packet_handler(jd->jc, jabber_handlepacket); |
623 gjab_start(jd->jc); | 624 port = user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 5222; |
625 gjab_start(jd->jc, port); | |
624 | 626 |
625 | 627 |
626 gc->inpa = gdk_input_add(jd->jc->fd, | 628 gc->inpa = gdk_input_add(jd->jc->fd, |
627 GDK_INPUT_READ | GDK_INPUT_EXCEPTION, | 629 GDK_INPUT_READ | GDK_INPUT_EXCEPTION, |
628 jabber_callback, gc); | 630 jabber_callback, gc); |