int main(int argc, char *argv[]) { if(argc < 4) { printf("Usage: %s [Gtalk username] [password] [recipient address] [message]\n", argv[0]); return 1; } input_address = argv[3]; input_message = argv[4]; GMainLoop *loop = g_main_loop_new(NULL, FALSE); /* 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); init_libpurple(); connect_to_signals(); PurpleAccount *account = purple_account_new(argv[1], "prpl-jabber"); purple_account_set_password(account, argv[2]); purple_accounts_add(account); purple_account_set_enabled(account, UI_ID, TRUE); g_main_loop_run(loop); return 0; }
int main(int argc, char *argv[]) { GMainLoop *loop = g_main_loop_new(NULL, FALSE); /* 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); init_libpurple(); printf("libpurple initialized. Running version %s.\n", purple_core_get_version()); //I like to see the version number connect_to_signals(); PurpleAccount *account = purple_account_new(PACCOUNT_NAME, "prpl-aim"); //this could be prpl-aim, prpl-yahoo, prpl-msn, prpl-icq, etc. purple_account_set_password(account, PACCOUNT_PASS); purple_accounts_add(account); purple_account_set_enabled(account, UI_ID, TRUE); g_main_loop_run(loop); return 0; }
PurpleAccount *mimoc_account_new(char *name, char *protocoll, _Bool enabled) { PurpleAccount *account = purple_account_new(name, protocoll); purple_accounts_add(account); purple_account_set_enabled(account, UI_ID, enabled); return account; }
static VALUE login(VALUE self, VALUE protocol, VALUE username, VALUE password) { PurpleAccount* account = purple_account_new(RSTRING_PTR(username), RSTRING_PTR(protocol)); if (NULL == account || NULL == account->presence) { rb_raise(rb_eRuntimeError, "No able to create account: %s", RSTRING_PTR(protocol)); } purple_account_set_password(account, RSTRING_PTR(password)); purple_account_set_remember_password(account, TRUE); purple_account_set_enabled(account, UI_ID, TRUE); PurpleSavedStatus *status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); purple_savedstatus_activate(status); purple_accounts_add(account); return Data_Wrap_Struct(cAccount, NULL, NULL, account); }
/* {{{ Methods */ static int account_new(LuaState *L)/*{{{*/ { luaL_checktype(L, 1, LUA_TTABLE); const char *username = luaL_checkstring(L, 2); const char *proto_id = luaL_checkstring(L, 3); PurpleAccount **account = ms_lua_newclass(L, "purple.account", sizeof(PurpleAccount *)); *account = purple_account_new(username, proto_id); lua_pushlightuserdata(L, *account); lua_pushvalue(L, -2); lua_settable(L, LUA_REGISTRYINDEX); purple_accounts_add(*account); return 1; }/*}}}*/
void AccountWindow::addAccount(CppConsUI::Button& /*activator*/) { GList *i = purple_plugins_get_protocols(); PurpleAccount *account = purple_account_new(_("Username"), purple_plugin_get_id(reinterpret_cast<PurplePlugin*>(i->data))); /* Stop here if libpurple returned an already created account. This happens * when user pressed Add button twice in a row. In that case there is * already one "empty" account that user can edit. */ if (account_entries.find(account) == account_entries.end()) { purple_accounts_add(account); populateAccount(account); } account_entries[account].parent->grabFocus(); }
PurpleAccount *client_find_account(extern_account_t *account) { PurpleAccount *r; char* plugin; char username[255]; memset(username, 0, 255); if (strcmp(account->protocol, "gtalk") == 0) { sprintf(username, "%s%s", account->username, "/sip"); plugin = "prpl-jabber"; } else { sprintf(username, "%s", account->username); plugin = account->protocol; } LM_DBG("searching purple account for %s with plugin %s \n", username, plugin); r = purple_accounts_find(username, plugin); if (r) { LM_DBG("account %s found\n", username); return r; } LM_DBG("account %s not found, creating.\n", username); r = purple_account_new(username, plugin); purple_account_set_password(r, account->password); purple_account_set_remember_password(r, TRUE); if (proxy != NULL) purple_account_set_proxy_info(r, proxy); if (strcmp(account->protocol, "gtalk") == 0) purple_account_set_string(r, "connect_server", "talk.google.com"); purple_accounts_add(r); return r; }
*/JNIEXPORT void JNICALL Java_im_pidgin_jpurple_account_PurpleAccountManager_addAccount_1native( JNIEnv *env, jobject obj, jlong account) { purple_accounts_add((PurpleAccount*) longToP(account)); }