本文整理汇总了C++中ekiga::Form::single_choice方法的典型用法代码示例。如果您正苦于以下问题:C++ Form::single_choice方法的具体用法?C++ Form::single_choice怎么用?C++ Form::single_choice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ekiga::Form
的用法示例。
在下文中一共展示了Form::single_choice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atoi
void
OPENLDAP::Source::on_new_book_form_submitted (Ekiga::Form &result)
{
try {
std::string name = result.text ("name");
std::string hostname = result.text ("hostname");
std::string port_string = result.text ("port");
std::string base = result.text ("base");
std::string scope = result.single_choice ("scope");
std::string call_attribute = result.text ("call-attribute");
std::string password = result.private_text ("password");
int port = atoi (port_string.c_str ());
add (name, hostname, port, base, scope, call_attribute, password);
save ();
} catch (Ekiga::Form::not_found) {
std::cerr << "Invalid result form" << std::endl; // FIXME: do better
}
}
示例2: if
void
LM::HeapRoster::subscribe_from_form_submitted (bool submitted,
Ekiga::Form& result)
{
if ( !submitted)
return;
const std::string jid = result.hidden ("jid");
const std::string answer = result.single_choice ("answer");
if (answer == "grant") {
LmMessage* message = lm_message_new (NULL, LM_MESSAGE_TYPE_PRESENCE);
lm_message_node_set_attributes (lm_message_get_node (message),
"to", jid.c_str (),
"type", "subscribed",
NULL);
lm_connection_send (connection, message, NULL);
lm_message_unref (message);
LmMessage* subscribe = lm_message_new (NULL, LM_MESSAGE_TYPE_PRESENCE);
lm_message_node_set_attributes (lm_message_get_node (subscribe),
"to", jid.c_str (),
"type", "subscribe",
NULL);
lm_connection_send (connection, subscribe, NULL);
lm_message_unref (subscribe);
} else if (answer == "refuse") {
LmMessage* message = lm_message_new (NULL, LM_MESSAGE_TYPE_PRESENCE);
lm_message_node_set_attributes (lm_message_get_node (message),
"to", jid.c_str (),
"type", "unsubscribed",
NULL);
lm_connection_send (connection, message, NULL);
lm_message_unref (message);
}
}
示例3: strlen
int
OPENLDAP::BookFormInfo (Ekiga::Form &result,
struct BookInfo &bookinfo,
std::string &errmsg)
{
LDAPURLDesc *url_base = NULL, *url_host = NULL;
char *url_str;
std::string name = result.text ("name");
std::string uri = result.text ("uri");
std::string nameAttr = result.text ("nameAttr");
std::string callAttr = result.text ("callAttr");
std::string filter = result.text ("filter");
errmsg = "";
if (name.empty())
errmsg += _("Please provide a Book Name for this directory\n");
if (uri.empty())
errmsg += _("Please provide a Server URI\n");
if (nameAttr.empty())
errmsg += _("Please provide a DisplayName attribute\n");
if (callAttr.empty())
errmsg += _("Please provide a Call attribute\n");
if (ldap_url_parse (uri.c_str(), &url_host))
errmsg += _("Invalid Server URI\n");
if (!errmsg.empty()) {
return -1;
}
if (filter.empty())
filter = "(cn=$)";
bookinfo.name = name;
std::string base = result.text ("base");
std::string new_bits = "ldap:///?" +
result.text ("nameAttr") + "," +
result.text ("callAttr") + "?" +
result.single_choice ("scope") + "?" +
result.text ("filter");
bookinfo.authcID = result.text ("authcID");
bookinfo.password = result.text ("password");
bookinfo.starttls = result.boolean ("startTLS");
bookinfo.sasl = result.boolean ("sasl");
bookinfo.saslMech = result.single_choice ("saslMech");
if (bookinfo.sasl || bookinfo.starttls) {
new_bits += "?";
if (bookinfo.starttls)
new_bits += "StartTLS";
if (bookinfo.sasl) {
if (bookinfo.starttls)
new_bits += ",";
new_bits += "SASL";
if (!bookinfo.saslMech.empty())
new_bits += "=" + bookinfo.saslMech;
}
}
if (ldap_url_parse (new_bits.c_str(), &url_base))
errmsg += _("Invalid Server URI\n");
if (!errmsg.empty()) {
return -1;
}
url_host->lud_dn = ldap_strdup (base.c_str());
url_host->lud_attrs = url_base->lud_attrs;
url_host->lud_scope = url_base->lud_scope;
url_host->lud_filter = url_base->lud_filter;
if (!url_host->lud_exts) {
url_host->lud_exts = url_base->lud_exts;
url_base->lud_exts = NULL;
}
url_base->lud_attrs = NULL;
url_base->lud_filter = NULL;
ldap_free_urldesc (url_base);
bookinfo.urld = boost::shared_ptr<LDAPURLDesc> (url_host, ldap_url_desc_deleter ());
url_str = ldap_url_desc2str (url_host);
bookinfo.uri = std::string(url_str);
ldap_memfree (url_str);
{
size_t pos;
pos = bookinfo.uri.find ('/', strlen(url_host->lud_scheme) + 3);
if (pos != std::string::npos)
bookinfo.uri_host = bookinfo.uri.substr (0,pos);
else
bookinfo.uri_host = bookinfo.uri;
}
return 0;
}