comparison plugins/jabber/jabber.c @ 1696:c6390c52caca

[gaim-migrate @ 1706] fun stuff. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 11 Apr 2001 04:33:52 +0000
parents 85d8c64e969d
children 644056e095f1
comparison
equal deleted inserted replaced
1695:c0ab844d4790 1696:c6390c52caca
543 if (!find_chat_buddy(b, p->from->resource)) 543 if (!find_chat_buddy(b, p->from->resource))
544 add_chat_buddy(b, p->from->resource); 544 add_chat_buddy(b, p->from->resource);
545 else if ((y = xmlnode_get_tag(p->x, "status"))) { 545 else if ((y = xmlnode_get_tag(p->x, "status"))) {
546 char buf[8192]; 546 char buf[8192];
547 msg = xmlnode_get_data(y); 547 msg = xmlnode_get_data(y);
548 g_snprintf(buf, sizeof(buf), "%s now has status: %s", 548 g_snprintf(buf, sizeof(buf), "<B>%s now has status: %s</B>",
549 p->from->resource, msg); 549 p->from->resource, msg);
550 write_to_conv(b, buf, WFLAG_SYSTEM, NULL); 550 write_to_conv(b, buf, WFLAG_SYSTEM, NULL);
551 } 551 }
552 } else if (msg) { 552 } else if (msg) {
553 char buf[8192]; 553 char buf[8192];
682 if (!find_chat_buddy(cnv, who->resource)) 682 if (!find_chat_buddy(cnv, who->resource))
683 add_chat_buddy(cnv, who->resource); 683 add_chat_buddy(cnv, who->resource);
684 else if ((y = xmlnode_get_tag(p->x, "status"))) { 684 else if ((y = xmlnode_get_tag(p->x, "status"))) {
685 char buf[8192]; 685 char buf[8192];
686 char *msg = xmlnode_get_data(y); 686 char *msg = xmlnode_get_data(y);
687 g_snprintf(buf, sizeof(buf), "%s now has status: %s", 687 g_snprintf(buf, sizeof(buf), "<B>%s now has status: %s</B>",
688 p->from->resource, msg); 688 p->from->resource, msg);
689 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL); 689 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL);
690 } 690 }
691 } 691 }
692 } 692 }
1209 static void regstate(jconn j, int state) 1209 static void regstate(jconn j, int state)
1210 { 1210 {
1211 static int catch = 0; 1211 static int catch = 0;
1212 switch (state) { 1212 switch (state) {
1213 case JCONN_STATE_OFF: 1213 case JCONN_STATE_OFF:
1214 gdk_input_remove(reginpa);
1215 reginpa = 0;
1216 jab_delete(j);
1214 break; 1217 break;
1215 case JCONN_STATE_CONNECTED: 1218 case JCONN_STATE_CONNECTED:
1216 break; 1219 break;
1217 case JCONN_STATE_ON: 1220 case JCONN_STATE_ON:
1218 if (catch) 1221 if (catch)
1229 } 1232 }
1230 1233
1231 static void regpacket(jconn j, jpacket p) 1234 static void regpacket(jconn j, jpacket p)
1232 { 1235 {
1233 static int here = 0; 1236 static int here = 0;
1237 g_print("here\n");
1234 switch (p->type) { 1238 switch (p->type) {
1235 case JPACKET_MESSAGE: 1239 case JPACKET_MESSAGE:
1236 break; 1240 break;
1237 case JPACKET_PRESENCE: 1241 case JPACKET_PRESENCE:
1238 break; 1242 break;
1243 1247
1244 if (here == 2) { 1248 if (here == 2) {
1245 struct aim_user *u; 1249 struct aim_user *u;
1246 user = g_strdup(jid_full(j->user)); 1250 user = g_strdup(jid_full(j->user));
1247 regjconn = NULL; 1251 regjconn = NULL;
1248 gdk_input_remove(reginpa);
1249 reginpa = 0;
1250 here = 0; 1252 here = 0;
1251 u = new_user(user, PROTO_JABBER, OPT_USR_REM_PASS); 1253 u = new_user(user, PROTO_JABBER, OPT_USR_REM_PASS);
1252 g_free(user); 1254 g_free(user);
1253 g_snprintf(u->password, sizeof(u->password), "%s", j->pass); 1255 g_snprintf(u->password, sizeof(u->password), "%s", j->pass);
1254 save_prefs(); 1256 save_prefs();
1255 xmlnode_free(p->x); 1257 xmlnode_free(p->x);
1256 jab_delete(j);
1257 do_error_dialog("Registration successful! Your account has been" 1258 do_error_dialog("Registration successful! Your account has been"
1258 " added to the Account Editor.", "Jabber " 1259 " added to the Account Editor.", "Jabber "
1259 "Registration"); 1260 "Registration");
1260 gtk_entry_set_text(GTK_ENTRY(newname), ""); 1261 gtk_entry_set_text(GTK_ENTRY(newname), "");
1261 gtk_entry_set_text(GTK_ENTRY(newpass1), ""); 1262 gtk_entry_set_text(GTK_ENTRY(newpass1), "");
1262 gtk_entry_set_text(GTK_ENTRY(newpass2), ""); 1263 gtk_entry_set_text(GTK_ENTRY(newpass2), "");
1264 g_print("reg\n");
1263 return; 1265 return;
1264 } else if (here == 1) { 1266 } else if (here == 1) {
1265 x = jutil_iqnew(JPACKET__SET, NS_AUTH); 1267 x = jutil_iqnew(JPACKET__SET, NS_AUTH);
1266 here = 2; 1268 here = 2;
1267 } else if (here == 0) { 1269 } else if (here == 0) {
1299 do_error_dialog(buf, "Jabber Registration"); 1301 do_error_dialog(buf, "Jabber Registration");
1300 } else { 1302 } else {
1301 do_error_dialog("Registration failed", "Jabber Registration"); 1303 do_error_dialog("Registration failed", "Jabber Registration");
1302 } 1304 }
1303 regjconn = NULL; 1305 regjconn = NULL;
1304 gdk_input_remove(reginpa);
1305 xmlnode_free(p->x); 1306 xmlnode_free(p->x);
1306 jab_delete(j);
1307 reginpa = 0;
1308 here = 0; 1307 here = 0;
1309 return; 1308 return;
1310 } 1309 }
1311 break; 1310 break;
1312 case JPACKET_S10N: 1311 case JPACKET_S10N:
1318 xmlnode_free(p->x); 1317 xmlnode_free(p->x);
1319 } 1318 }
1320 1319
1321 static void regjcall(gpointer data, gint source, GdkInputCondition cond) 1320 static void regjcall(gpointer data, gint source, GdkInputCondition cond)
1322 { 1321 {
1323 jab_recv(regjconn); 1322 gjab_recv((gjconn)regjconn);
1324 } 1323 }
1325 1324
1326 static void jabber_do_new_user() 1325 static void jabber_do_new_user()
1327 { 1326 {
1328 char *name, *pass1, *pass2, *serv; 1327 char *name, *pass1, *pass2, *serv;