Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 32815:cb486df263ef
Introduce purple_account_register_completed() to handle the invoking of any
registration callback.
author | andrew.victor@mxit.com |
---|---|
date | Sun, 06 Nov 2011 19:46:57 +0000 |
parents | 3e7a7e14af62 |
children | ec6371d4cae8 |
comparison
equal
deleted
inserted
replaced
32814:c94e2bfae121 | 32815:cb486df263ef |
---|---|
1142 | 1142 |
1143 if (type == JABBER_IQ_RESULT) { | 1143 if (type == JABBER_IQ_RESULT) { |
1144 if(js->registration) { | 1144 if(js->registration) { |
1145 buf = g_strdup_printf(_("Registration of %s@%s successful"), | 1145 buf = g_strdup_printf(_("Registration of %s@%s successful"), |
1146 js->user->node, js->user->domain); | 1146 js->user->node, js->user->domain); |
1147 if(account->registration_cb) | 1147 purple_account_register_completed(account, TRUE); |
1148 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); | |
1149 } else { | 1148 } else { |
1150 g_return_if_fail(to != NULL); | 1149 g_return_if_fail(to != NULL); |
1151 buf = g_strdup_printf(_("Registration to %s successful"), | 1150 buf = g_strdup_printf(_("Registration to %s successful"), |
1152 to); | 1151 to); |
1153 } | 1152 } |
1161 msg = g_strdup(_("Unknown Error")); | 1160 msg = g_strdup(_("Unknown Error")); |
1162 | 1161 |
1163 purple_notify_error(NULL, _("Registration Failed"), | 1162 purple_notify_error(NULL, _("Registration Failed"), |
1164 _("Registration Failed"), msg); | 1163 _("Registration Failed"), msg); |
1165 g_free(msg); | 1164 g_free(msg); |
1166 if(account->registration_cb) | 1165 purple_account_register_completed(account, FALSE); |
1167 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | |
1168 } | 1166 } |
1169 g_free(to); | 1167 g_free(to); |
1170 if(js->registration) | 1168 if(js->registration) |
1171 jabber_connection_schedule_close(js); | 1169 jabber_connection_schedule_close(js); |
1172 } | 1170 } |
1286 static void | 1284 static void |
1287 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) | 1285 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
1288 { | 1286 { |
1289 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); | 1287 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); |
1290 if(account && cbdata->js->registration) { | 1288 if(account && cbdata->js->registration) { |
1291 if(account->registration_cb) | 1289 purple_account_register_completed(account, FALSE); |
1292 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | |
1293 jabber_connection_schedule_close(cbdata->js); | 1290 jabber_connection_schedule_close(cbdata->js); |
1294 } | 1291 } |
1295 g_free(cbdata->who); | 1292 g_free(cbdata->who); |
1296 g_free(cbdata); | 1293 g_free(cbdata); |
1297 } | 1294 } |
1356 registered = TRUE; | 1353 registered = TRUE; |
1357 | 1354 |
1358 if(js->registration) { | 1355 if(js->registration) { |
1359 purple_notify_error(NULL, _("Already Registered"), | 1356 purple_notify_error(NULL, _("Already Registered"), |
1360 _("Already Registered"), NULL); | 1357 _("Already Registered"), NULL); |
1361 if(account->registration_cb) | 1358 purple_account_register_completed(account, FALSE); |
1362 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | |
1363 jabber_connection_schedule_close(js); | 1359 jabber_connection_schedule_close(js); |
1364 return; | 1360 return; |
1365 } | 1361 } |
1366 } | 1362 } |
1367 | 1363 |
1378 purple_notify_uri(NULL, href); | 1374 purple_notify_uri(NULL, href); |
1379 g_free(href); | 1375 g_free(href); |
1380 | 1376 |
1381 if(js->registration) { | 1377 if(js->registration) { |
1382 js->gc->wants_to_die = TRUE; | 1378 js->gc->wants_to_die = TRUE; |
1383 if(account->registration_cb) /* succeeded, but we have no login info */ | 1379 /* succeeded, but we have no login info */ |
1384 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); | 1380 purple_account_register_completed(account, TRUE); |
1385 jabber_connection_schedule_close(js); | 1381 jabber_connection_schedule_close(js); |
1386 } | 1382 } |
1387 return; | 1383 return; |
1388 } | 1384 } |
1389 } | 1385 } |