Exemple #1
0
// using [class] id (id ...) (renaming id->id id->id) (hiding id ... id)
environment using_cmd(parser & p) {
    environment env = p.env();
    while (true) {
        name cls = parse_class(p);
        bool decls = cls.is_anonymous() || cls == g_decls || cls == g_declarations;
        auto pos   = p.pos();
        name ns    = p.check_id_next("invalid 'using' command, identifier expected");
        optional<name> real_ns = to_valid_namespace_name(env, ns);
        if (!real_ns)
            throw parser_error(sstream() << "invalid namespace name '" << ns << "'", pos);
        ns = *real_ns;
        env = using_namespace(env, p.ios(), ns, cls);
        if (decls) {
            // Remark: we currently to not allow renaming and hiding of universe levels
            buffer<name> exceptions;
            bool found_explicit = false;
            while (p.curr_is_token(g_lparen)) {
                p.next();
                if (p.curr_is_token_or_id(g_renaming)) {
                    p.next();
                    while (p.curr_is_identifier()) {
                        name from_id = p.get_name_val();
                        p.next();
                        p.check_token_next(g_arrow, "invalid 'using' command renaming, '->' expected");
                        name to_id = p.check_id_next("invalid 'using' command renaming, identifier expected");
                        check_identifier(p, env, ns, from_id);
                        exceptions.push_back(from_id);
                        env = add_expr_alias(env, to_id, ns+from_id);
                    }
                } else if (p.curr_is_token_or_id(g_hiding)) {
                    p.next();
                    while (p.curr_is_identifier()) {
                        name id = p.get_name_val();
                        p.next();
                        check_identifier(p, env, ns, id);
                        exceptions.push_back(id);
                    }
                } else if (p.curr_is_identifier()) {
                    found_explicit = true;
                    while (p.curr_is_identifier()) {
                        name id = p.get_name_val();
                        p.next();
                        check_identifier(p, env, ns, id);
                        env = add_expr_alias(env, id, ns+id);
                    }
                } else {
                    throw parser_error("invalid 'using' command option, identifier, 'hiding' or 'renaming' expected", p.pos());
                }
                if (found_explicit && !exceptions.empty())
                    throw parser_error("invalid 'using' command option, mixing explicit and implicit 'using' options", p.pos());
                p.check_token_next(g_rparen, "invalid 'using' command option, ')' expected");
            }
            if (!found_explicit)
                env = add_aliases(env, ns, name(), exceptions.size(), exceptions.data());
        }
        if (!p.curr_is_token(g_lbracket) && !p.curr_is_identifier())
            break;
    }
    return env;
}
Exemple #2
0
SayCommand::SayCommand()
{
	set_name("say");
	add_aliases({"sa"});

	set_access_level(RANK_PLAYER);
	add_status({ standing, sitting, resting });
}
Exemple #3
0
static int
do_mod_entry(krb5_principal principal, void *data)
{
    krb5_error_code ret;
    kadm5_principal_ent_rec princ;
    int mask = 0;
    struct modify_options *e = data;

    memset (&princ, 0, sizeof(princ));
    ret = kadm5_get_principal(kadm_handle, principal, &princ,
			      KADM5_PRINCIPAL | KADM5_ATTRIBUTES |
			      KADM5_MAX_LIFE | KADM5_MAX_RLIFE |
			      KADM5_PRINC_EXPIRE_TIME |
			      KADM5_PW_EXPIRATION);
    if(ret)
	return ret;

    if(e->max_ticket_life_string ||
       e->max_renewable_life_string ||
       e->expiration_time_string ||
       e->pw_expiration_time_string ||
       e->attributes_string ||
       e->policy_string ||
       e->kvno_integer != -1 ||
       e->constrained_delegation_strings.num_strings ||
       e->alias_strings.num_strings ||
       e->pkinit_acl_strings.num_strings ||
       e->hist_kvno_diff_clnt_integer != -1 ||
       e->hist_kvno_diff_svc_integer != -1) {
	ret = set_entry(context, &princ, &mask,
			e->max_ticket_life_string,
			e->max_renewable_life_string,
			e->expiration_time_string,
			e->pw_expiration_time_string,
			e->attributes_string,
			e->policy_string);
	if(e->kvno_integer != -1) {
	    princ.kvno = e->kvno_integer;
	    mask |= KADM5_KVNO;
	}
	if (e->constrained_delegation_strings.num_strings) {
	    add_constrained_delegation(context, &princ,
				       &e->constrained_delegation_strings);
	    mask |= KADM5_TL_DATA;
	}
	if (e->alias_strings.num_strings) {
	    add_aliases(context, &princ, &e->alias_strings);
	    mask |= KADM5_TL_DATA;
	}
	if (e->pkinit_acl_strings.num_strings) {
	    add_pkinit_acl(context, &princ, &e->pkinit_acl_strings);
	    mask |= KADM5_TL_DATA;
	}
	if (e->hist_kvno_diff_clnt_integer != -1) {
	    add_kvno_diff(context, &princ, 0, e->hist_kvno_diff_clnt_integer);
	    mask |= KADM5_TL_DATA;
	}
	if (e->hist_kvno_diff_svc_integer != -1) {
	    add_kvno_diff(context, &princ, 1, e->hist_kvno_diff_clnt_integer);
	    mask |= KADM5_TL_DATA;
	}
    } else
	ret = edit_entry(&princ, &mask, NULL, 0);
    if(ret == 0) {
	ret = kadm5_modify_principal(kadm_handle, &princ, mask);
	if(ret)
	    krb5_warn(context, ret, "kadm5_modify_principal");
    }

    kadm5_free_principal_ent(kadm_handle, &princ);
    return ret;
}
Exemple #4
0
address_book_aliases::address_book_aliases (const QString email,
						QWidget *parent) :
  QWidget(parent)
{
  m_email = email;
  Q3BoxLayout* top_layout = new Q3VBoxLayout (this);
  top_layout->setMargin (4);
  top_layout->setSpacing (3);
  Q3HBox* hb = new Q3HBox (this);
  top_layout->addWidget (hb);

  Q3VBox* box_left = new Q3VBox (hb);
  Q3VBox* box_middle = new Q3VBox (hb);
  Q3VBox* box_right = new Q3VBox (hb);

  // left pane: search criteria and results
  Q3GroupBox* search_box = new Q3GroupBox (3, Qt::Horizontal, tr("Search"), box_left);
  Q3VBox* labels_box = new Q3VBox(search_box);
  Q3VBox* fields_box = new Q3VBox(search_box);
  m_email_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Address"), labels_box);

  m_name_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Name"), labels_box);

  m_nick_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Nickname"), labels_box);

  QPushButton* button_search = new QPushButton (tr("Search"), search_box);
  connect (button_search, SIGNAL(clicked()), this, SLOT(search()));

  Q3GroupBox* result_box = new Q3GroupBox (1, Qt::Vertical, tr("Results"), box_left);
  m_result_list_w = new Q3ListView (result_box);
  m_result_list_w->addColumn (tr("Email address"));
  m_result_list_w->addColumn (tr("# msgs"), 50);
  m_result_list_w->setMultiSelection (true);

  // middle pane: the "Add" and "Remove" buttons
  QPushButton* b_add = new QPushButton (tr("Add ->"), box_middle);
  connect (b_add, SIGNAL(clicked()), this, SLOT(add_aliases()));

  QPushButton* b_remove = new QPushButton (tr("Remove"), box_middle);
  connect (b_remove, SIGNAL(clicked()), this, SLOT(remove_alias()));

  // right pane: aliases
  Q3GroupBox* aliases_box = new Q3GroupBox (1, Qt::Vertical, tr("Aliases"), box_right);
  m_aliases_list_w = new Q3ListView (aliases_box);
  m_aliases_list_w->addColumn(tr("Email address"));
  init_aliases_list ();

  // buttons at the bottom of the window
  Q3HBox* buttons_box = new Q3HBox (this);
  buttons_box->setSpacing (4);
  top_layout->addWidget (buttons_box);

  new Q3HBox (buttons_box);	// takes the left space
  QPushButton* b2 = new QPushButton (tr("Reset"), buttons_box);
  QPushButton* b3 = new QPushButton (tr("OK"), buttons_box);
  connect (b3, SIGNAL(clicked()), this, SLOT(OK()));
  QPushButton* b4 = new QPushButton (tr("Cancel"), buttons_box);
  connect (b4, SIGNAL(clicked()), this, SLOT(close()));

  QString title = tr("Other email addresses for ");
  title += email;
  setWindowTitle (title);
}