static void
am_prepare_cb (GObject *source,
    GAsyncResult *result,
    gpointer user_data)
{
  EmpathyConnectionAggregator *self = EMPATHY_CONNECTION_AGGREGATOR (user_data);
  GError *error = NULL;
  GList *accounts, *l;

  if (!tp_proxy_prepare_finish (source, result, &error))
    {
      DEBUG ("Failed to prepare account manager: %s", error->message);
      g_error_free (error);
      goto out;
    }

  accounts = tp_account_manager_get_valid_accounts (self->priv->mgr);
  for (l = accounts; l != NULL; l = g_list_next (l))
    {
      TpAccount *account = l->data;

      add_account (self, account);
    }

  tp_g_signal_connect_object (self->priv->mgr, "account-validity-changed",
      G_CALLBACK (account_validity_changed_cb), self, 0);

  g_list_free (accounts);

out:
  g_object_unref (self);
}
예제 #2
0
파일: opal-bank.cpp 프로젝트: Seksa/ekiga
void Opal::Bank::add (Account::Type acc_type,
                      std::string name,
                      std::string host,
                      std::string user,
                      std::string auth_user,
                      std::string password,
                      bool enabled,
                      unsigned timeout)
{
  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
  if ( !pcore)
    return;
  AccountPtr account
    = AccountPtr(new Opal::Account (sip_endpoint,
				    pcore,
				    notification_core,
				    personal_details,
				    audiooutput_core,
				    opal_component, acc_type, name,
				    host, user, auth_user,
				    password, enabled,
				    timeout));
  add_account (account);
  Ekiga::BankImpl<Account>::add_connection (account, account->trigger_saving.connect (boost::bind (&Opal::Bank::save, this)));
  Ekiga::BankImpl<Account>::add_connection (account, account->presence_received.connect (boost::ref (presence_received)));
  Ekiga::BankImpl<Account>::add_connection (account, account->status_received.connect (boost::ref (status_received)));
}
static void
on_add_button_clicked (GtkButton *button,
                       gpointer   user_data)
{
  GoaPanel *panel = GOA_PANEL (user_data);
  add_account (panel);
}
static void
on_account_added (GoaClient   *client,
                  GoaObject   *object,
                  gpointer     user_data)
{
  GoaPanelAccountsModel *model = GOA_PANEL_ACCOUNTS_MODEL (user_data);
  add_account (model, object);
}
static void
account_validity_changed_cb (TpAccountManager *manager,
    TpAccount *account,
    gboolean valid,
    EmpathyConnectionAggregator *self)
{
  if (valid)
    add_account (self, account);
}
static gboolean
idle_cb (gpointer data)
{
    add_account ("/apps/evolution/addressbook/sources", arg_hostname, arg_username, arg_password);
//	add_account ("/apps/evolution/tasks/sources", arg_hostname, arg_username, arg_password);

    g_main_loop_quit (main_loop);

    return FALSE;
}
예제 #7
0
void Opal::Bank::add (Account::Type t,
                      std::string name, 
                      std::string host,
                      std::string user,
                      std::string auth_user,
                      std::string password,
                      bool enabled,
                      unsigned timeout)
{
  Opal::Account *account = new Opal::Account (core, t, name, host, user, auth_user, password, enabled, timeout);
  add_account (*account);
}
static void
init_model (GoaPanelAccountsModel *model)
{
  GList *accounts;
  GList *l;

  accounts = goa_client_get_accounts (model->client);
  for (l = accounts; l != NULL; l = l->next)
    {
      GoaObject *object = GOA_OBJECT (l->data);
      add_account (model, object);
    }
  g_list_foreach (accounts, (GFunc) g_object_unref, NULL);
  g_list_free (accounts);
}
예제 #9
0
파일: opal-bank.cpp 프로젝트: Seksa/ekiga
Opal::Bank::Bank (Ekiga::ServiceCore& core):
  sip_endpoint(core.get<Opal::Sip::EndPoint> ("opal-sip-endpoint")),
  presence_core(core.get<Ekiga::PresenceCore> ("presence-core")),
  notification_core(core.get<Ekiga::NotificationCore> ("notification-core")),
  personal_details(core.get<Ekiga::PersonalDetails> ("personal-details")),
  audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core")),
  opal_component(core.get<CallManager> ("opal-component"))
{
  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
  if ( !pcore)
    return;

  GSList *accounts = gm_conf_get_string_list (PROTOCOLS_KEY "accounts_list");
  GSList *accounts_iter = accounts;

  while (accounts_iter) {

    boost::shared_ptr<Account> account
      = boost::shared_ptr<Account> (new Account (sip_endpoint,
						 pcore,
						 notification_core,
						 personal_details,
						 audiooutput_core,
						 opal_component,
						 (char *)accounts_iter->data));

    add_account (account);
    Ekiga::BankImpl<Account>::add_connection (account, account->trigger_saving.connect (boost::bind (&Opal::Bank::save, this)));
    Ekiga::BankImpl<Account>::add_connection (account, account->presence_received.connect (boost::ref (presence_received)));
    Ekiga::BankImpl<Account>::add_connection (account, account->status_received.connect (boost::ref (status_received)));
    accounts_iter = g_slist_next (accounts_iter);
  }

  g_slist_foreach (accounts, (GFunc) g_free, NULL);
  g_slist_free (accounts);

  sip_endpoint->registration_event.connect (boost::bind(&Opal::Bank::on_registration_event, this, _1, _2, _3));
  sip_endpoint->mwi_event.connect (boost::bind(&Opal::Bank::on_mwi_event, this, _1, _2));

  account_added.connect (boost::bind (&Opal::Bank::update_sip_endpoint_aor_map, this));
  account_updated.connect (boost::bind (&Opal::Bank::update_sip_endpoint_aor_map, this));
  account_removed.connect (boost::bind (&Opal::Bank::update_sip_endpoint_aor_map, this));
  update_sip_endpoint_aor_map ();
}
예제 #10
0
void
LM::Bank::add (boost::shared_ptr<Account> account)
{
  account->trigger_saving.connect (boost::bind (&LM::Bank::save, this));
  add_account (account);
}
예제 #11
0
int main(int argc, char *argv[]){
	char *command;
	int i, num;
	char **list;
	int layer, right;
	char *mount_path, *share;
	int result;

	if((command = rindex(argv[0], '/')) != NULL)
		++command;
	else
		command = argv[0];

	if(!strcmp(command, "get_account_list")){
		if(get_account_list(&num, &list) <= 0)
			usb_dbg("Can't get account list.\n");
		else{
			for(i = 0; i < num; ++i)
				usb_dbg("%dth account: %s.\n", i+1, list[i]);

			free_2_dimension_list(&num, &list);
		}
	}
	else if(!strcmp(command, "get_folder_list")){
		if(argc != 2)
			usb_dbg("Usage: get_folder_list mount_path\n");
		else if(get_folder_list(argv[1], &num, &list) < 0)
			usb_dbg("Can't get folder list.\n");
		else{
			for(i = 0; i < num; ++i)
				usb_dbg("%dth folder: %s.\n", i+1, list[i]);

			free_2_dimension_list(&num, &list);
		}
	}
	else if(!strcmp(command, "get_all_folder")){
		if(argc != 2)
			usb_dbg("Usage: get_all_folder mount_path\n");
		else if(get_all_folder(argv[1], &num, &list) < 0)
			usb_dbg("Can't get all folder.\n");
		else{
			for(i = 0; i < num; ++i)
				usb_dbg("%dth folder: %s.\n", i+1, list[i]);

			free_2_dimension_list(&num, &list);
		}
	}
	else if(!strcmp(command, "get_var_file_name")){
		char *file_name;

		if(argc != 3)
			usb_dbg("Usage: get_var_file_name account mount_path\n");
		else if(get_var_file_name(argv[1], argv[2], &file_name))
			usb_dbg("Can't get the var file name with %s in %s.\n", argv[1], argv[2]);
		else{
			usb_dbg("done: %s.\n", file_name);
			free(file_name);
		}
	}
	else if(!strcmp(command, "initial_folder_list")){
		if(argc != 2)
			usb_dbg("Usage: initial_folder_list mount_path\n");
		else if(initial_folder_list(argv[1]) < 0)
			usb_dbg("Can't initial folder list in %s.\n", argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "initial_var_file")){
		char *target_acc = NULL;

		if(argc != 3){
			usb_dbg("Usage: initial_var_file account mount_path\n");
			return -1;
		}

		if(strcmp(argv[1], "NULL"))
			target_acc = argv[1];

		if(initial_var_file(target_acc, argv[2]) < 0){
			if(target_acc == NULL)
				usb_dbg("Can't initial share's var file in %s.\n", argv[2]);
			else
				usb_dbg("Can't initial %s's var file in %s.\n", target_acc, argv[2]);
		}
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "initial_all_var_file")){
		if(argc != 2)
			usb_dbg("Usage: initial_all_var_file mount_path\n");
		else if(initial_all_var_file(argv[1]) < 0)
			usb_dbg("Can't initial all var file in %s.\n", argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "test_of_var_files")){
		if(argc != 2)
			usb_dbg("Usage: test_of_var_files mount_path\n");
		else if(test_of_var_files(argv[1]) < 0)
			usb_dbg("Can't test_of_var_files in %s.\n", argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "create_if_no_var_files")){
		if(argc != 2)
			usb_dbg("Usage: create_if_no_var_files mount_path\n");
		else if(create_if_no_var_files(argv[1]) < 0)
			usb_dbg("Can't create var files in %s.\n", argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "modify_if_exist_new_folder")){
		if(argc != 3)
			usb_dbg("Usage: modify_if_exist_new_folder account mount_path\n");
		else if(modify_if_exist_new_folder(argv[1], argv[2]) < 0)
			usb_dbg("Can't fix %s's var files in %s.\n", argv[1], argv[2]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "get_permission")){
		if(argc != 5)
			usb_dbg("Usage: get_permission account mount_path folder [cifs|ftp|dms]\n");
		else if((right = get_permission(argv[1], argv[2], argv[3], argv[4])) < 0)
			usb_dbg("%s can't get %s's %s permission in %s.\n", argv[1], argv[3], argv[4], argv[2]);
		else
			usb_dbg("done: %d.\n", right);
	}
	else if(!strcmp(command, "set_permission")){
		if(argc != 6)
			usb_dbg("Usage: set_permission account mount_path folder [cifs|ftp|dms] [0~3]\n");
		else if(set_permission(argv[1], argv[2], argv[3], argv[4], atoi(argv[5])) < 0)
			usb_dbg("%s can't set %s's %s permission to be %s in %s.\n", argv[1], argv[3], argv[4], argv[5], argv[2]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "add_account")){
		if(argc != 3)
			usb_dbg("Usage: add_account account password\n");
		else if(add_account(argv[1], argv[2]) < 0)
			usb_dbg("Can't add account(%s:%s).\n", argv[1], argv[2]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "del_account")){
		if(argc != 2)
			usb_dbg("Usage: del_account account\n");
		else if(del_account(argv[1]) < 0)
			usb_dbg("Can't del account(%s).\n", argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "mod_account")){
		if(argc != 4)
			usb_dbg("Usage: mod_account account new_account new_password\n");
		else if(mod_account(argv[1], argv[2], argv[3]) < 0)
			usb_dbg("Can't mod account(%s) to (%s:%s).\n", argv[1], argv[2], argv[3]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "test_if_exist_account")){
		if(argc != 2)
			usb_dbg("Usage: test_if_exist_account account\n");
		else if(test_if_exist_account(argv[1]) < 0)
			usb_dbg("Can't test if %s is existed.\n", argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "add_folder")){
		if(argc != 4){
			usb_dbg("Usage: add_folder account mount_path folder\n");
			return 0;
		}
		
		if(!strcmp(argv[1], "NULL"))
			result = add_folder(NULL, argv[2], argv[3]);
		else
			result = add_folder(argv[1], argv[2], argv[3]);
		if(result < 0)
			usb_dbg("Can't add folder(%s) in %s.\n", argv[3], argv[2]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "del_folder")){
		if(argc != 3)
			usb_dbg("Usage: del_folder mount_path folder\n");
		else if(del_folder(argv[1], argv[2]) < 0)
			usb_dbg("Can't del folder(%s) in %s.\n", argv[2], argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "mod_folder")){
		if(argc != 4)
			usb_dbg("Usage: mod_folder mount_path folder new_folder\n");
		else if(mod_folder(argv[1], argv[2], argv[3]) < 0)
			usb_dbg("Can't mod folder(%s) to (%s) in %s.\n", argv[2], argv[3], argv[1]);
		else
			usb_dbg("done.\n");
	}
	else if(!strcmp(command, "test_if_exist_share")){
		if(argc != 3)
			usb_dbg("Usage: test_if_exist_share mount_path folder\n");
		else if(test_if_exist_share(argv[1], argv[2]))
			usb_dbg("%s is existed in %s.\n", argv[2], argv[1]);
		else
			usb_dbg("%s is NOT existed in %s.\n", argv[2], argv[1]);
	}
	else if(!strcmp(command, "how_many_layer")){
		if(argc != 2)
			usb_dbg("Usage: how_many_layer path\n");
		else if((layer = how_many_layer(argv[1], &mount_path, &share)) < 0)
			usb_dbg("Can't count the layer with %s.\n", argv[1]);
		else
			usb_dbg("done: %d layers, share=%s, mount_path=%s.\n", layer, share, mount_path);
	}
	else
		usb_dbg("test_share(ver. %d): Need to link the command name from test_share first.\n", VERSION);

	return 0;
}