comparison src/protocols/jabber/jabber.c @ 4436:83260179de90

[gaim-migrate @ 4711] This will let you specify a different server to actually connect to for jabber. Screenname should still take the form user@server/resource like it always has. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 27 Jan 2003 21:11:55 +0000
parents 7ba9b56a8796
children 2f225b92a933
comparison
equal deleted inserted replaced
4435:d4bc1f817566 4436:83260179de90
92 #define DEFAULT_SERVER "jabber.org" 92 #define DEFAULT_SERVER "jabber.org"
93 #define DEFAULT_GROUPCHAT "conference.jabber.org" 93 #define DEFAULT_GROUPCHAT "conference.jabber.org"
94 #define DEFAULT_PORT 5222 94 #define DEFAULT_PORT 5222
95 95
96 #define USEROPT_PORT 0 96 #define USEROPT_PORT 0
97 #define USEROPT_CONN_SERVER 1
97 98
98 #define JABBER_TYPING_NOTIFY_INT 15 /* Delay (in seconds) between sending typing notifications */ 99 #define JABBER_TYPING_NOTIFY_INT 15 /* Delay (in seconds) between sending typing notifications */
99 100
100 /* 101 /*
101 * Note: "was_connected" may seem redundant, but it was needed and I 102 * Note: "was_connected" may seem redundant, but it was needed and I
796 797
797 static void gjab_start(gjconn gjc) 798 static void gjab_start(gjconn gjc)
798 { 799 {
799 struct aim_user *user; 800 struct aim_user *user;
800 int port, rc; 801 int port, rc;
802 char *server;
801 803
802 if (!gjc || gjc->state != JCONN_STATE_OFF) 804 if (!gjc || gjc->state != JCONN_STATE_OFF)
803 return; 805 return;
804 806
805 user = GJ_GC(gjc)->user; 807 user = GJ_GC(gjc)->user;
806 port = user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : DEFAULT_PORT; 808 port = user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : DEFAULT_PORT;
809 server = user->proto_opt[USEROPT_CONN_SERVER][0] ? user->proto_opt[USEROPT_CONN_SERVER] : gjc->user->server;
810
807 811
808 gjc->parser = XML_ParserCreate(NULL); 812 gjc->parser = XML_ParserCreate(NULL);
809 XML_SetUserData(gjc->parser, (void *)gjc); 813 XML_SetUserData(gjc->parser, (void *)gjc);
810 XML_SetElementHandler(gjc->parser, startElement, endElement); 814 XML_SetElementHandler(gjc->parser, startElement, endElement);
811 XML_SetCharacterDataHandler(gjc->parser, charData); 815 XML_SetCharacterDataHandler(gjc->parser, charData);
812 816
813 rc = proxy_connect(gjc->user->server, port, gjab_connected, GJ_GC(gjc)); 817 rc = proxy_connect(server, port, gjab_connected, GJ_GC(gjc));
814 if (!user->gc || (rc < 0)) { 818 if (!user->gc || (rc < 0)) {
815 STATE_EVT(JCONN_STATE_OFF) 819 STATE_EVT(JCONN_STATE_OFF)
816 return; 820 return;
817 } 821 }
818 } 822 }
4233 puo->label = g_strdup(_("Port:")); 4237 puo->label = g_strdup(_("Port:"));
4234 puo->def = g_strdup("5222"); 4238 puo->def = g_strdup("5222");
4235 puo->pos = USEROPT_PORT; 4239 puo->pos = USEROPT_PORT;
4236 ret->user_opts = g_list_append(ret->user_opts, puo); 4240 ret->user_opts = g_list_append(ret->user_opts, puo);
4237 4241
4242 puo = g_new0(struct proto_user_opt, 1);
4243 puo->label = g_strdup("Connect Server:");
4244 puo->def = g_strdup("");
4245 puo->pos = USEROPT_CONN_SERVER;
4246 ret->user_opts = g_list_append(ret->user_opts, puo);
4247
4238 my_protocol = ret; 4248 my_protocol = ret;
4239 } 4249 }
4240 4250
4241 #ifndef STATIC 4251 #ifndef STATIC
4242 4252