pidgin register test problem
jimmy_yuhai
jimmy_yuhai at 163.com
Wed May 28 09:27:33 EDT 2008
dear friends,
i modify the nullclient.c to test the register procedure in pidgin;
the nullclient.c modified is showed bellow
i also modify the /libpurple/protocols/jabber/jabbber.c :
void jabber_register_account(PurpleAccount *account)
{// the following line is added by me: for i dont know which code line to add the jabber server ip.
connect_server="172.16.1.82";
....
}
why i can not register the new user:alice at chsiyuhai/gaim ??
//---------------------------
the nullclient.c file is mainly :
....
..
int main(int argc, char *argv[])
{
GList *iter;
int i, num;
GList *names = NULL;
const char *prpl;
char name[128];
char *password;
//
GMainLoop *loop = g_main_loop_new(NULL, FALSE);
PurpleAccount *account;
PurpleSavedStatus *status;
char *res;
/* libpurple's built-in DNS resolution forks processes to perform
* blocking lookups without blocking the main process. It does not
* handle SIGCHLD itself, so if the UI does not you quickly get an army
* of zombie subprocesses marching around.
*/
signal(SIGCHLD, SIG_IGN);
printf("--this is first\n");
init_libpurple();
printf("libpurple initialized.\n");
iter = purple_plugins_get_protocols();
for (i = 0; iter; iter = iter->next) {
PurplePlugin *plugin = iter->data;
PurplePluginInfo *info = plugin->info;
if (info && info->name) {
//print out the protocols can be used;
printf("\t%d: %s\n", i++, info->name);
/**
* Detailed information about a plugin.
*
* This is used in the version 2.0 API and up.
*/
names = g_list_append(names, info->id);
}
}
//can i stop here and comes out a select dialog?
printf("Select the protocol [0-%d]: ", i-1);
res = fgets(name, sizeof(name), stdin);
if (!res) {
fprintf(stderr, "Failed to gets protocol selection.");
abort();
}
/*
sscanf(name, "%d", &num);
prpl = g_list_nth_data(names, num);
printf("Username: ");
res = fgets(name, sizeof(name), stdin);
if (!res) {
fprintf(stderr, "Failed to read user name.");
abort();
}
*/
// name[strlen(name) - 1] = 0; /* strip the \n at the end */
/* Create the account */
account = purple_account_new(name, prpl);
/* Get the password for the account */
//password = getpass("Password: ");
purple_account_set_username(account, "alice at chsiyuhai/gaim");
password = "2924534";
purple_account_set_password(account, password);
printf("\n jid:user at domain/resource:%s\n",ss);
/* It's necessary to enable the account first. */
purple_account_set_enabled(account, UI_ID, TRUE);
/* Now, to connect the account(s), create a status and activate it. */
status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE);
purple_savedstatus_activate(status);
purple_account_register(account);
connect_to_signals_for_demonstration_purposes_only();
g_main_loop_run(loop);
return 0;
}
any advice is a great help, thanks!
jimmy_yuhai
2008-05-28
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20080528/f5c7ba20/attachment.html>
More information about the Devel
mailing list