本文整理汇总了C++中prefs_get_boolean函数的典型用法代码示例。如果您正苦于以下问题:C++ prefs_get_boolean函数的具体用法?C++ prefs_get_boolean怎么用?C++ prefs_get_boolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prefs_get_boolean函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: prefs_do_room_notify_mention
gboolean
prefs_do_room_notify_mention(const char *const roomjid, int unread, gboolean mention, gboolean trigger)
{
gboolean notify_room = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify", NULL)) {
notify_room = g_key_file_get_boolean(prefs, roomjid, "notify", NULL);
} else {
notify_room = prefs_get_boolean(PREF_NOTIFY_ROOM);
}
if (notify_room && unread > 0) {
return TRUE;
}
gboolean notify_mention = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify.mention", NULL)) {
notify_mention = g_key_file_get_boolean(prefs, roomjid, "notify.mention", NULL);
} else {
notify_mention = prefs_get_boolean(PREF_NOTIFY_ROOM_MENTION);
}
if (notify_mention && mention) {
return TRUE;
}
gboolean notify_trigger = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify.trigger", NULL)) {
notify_trigger = g_key_file_get_boolean(prefs, roomjid, "notify.trigger", NULL);
} else {
notify_trigger = prefs_get_boolean(PREF_NOTIFY_ROOM_TRIGGER);
}
if (notify_trigger && trigger) {
return TRUE;
}
return FALSE;
}
开发者ID:0xPoly,项目名称:profanity,代码行数:35,代码来源:preferences.c
示例2: cons_notify_setting
void
cons_notify_setting(void)
{
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON");
else
cons_show("Messages (/notify message) : OFF");
if (prefs_get_boolean(PREF_NOTIFY_TYPING))
cons_show("Composing (/notify typing) : ON");
else
cons_show("Composing (/notify typing) : OFF");
if (prefs_get_boolean(PREF_NOTIFY_INVITE))
cons_show("Room invites (/notify invite) : ON");
else
cons_show("Room invites (/notify invite) : OFF");
if (prefs_get_boolean(PREF_NOTIFY_SUB))
cons_show("Subscription requests (/notify sub) : ON");
else
cons_show("Subscription requests (/notify sub) : OFF");
gint remind_period = prefs_get_notify_remind();
if (remind_period == 0) {
cons_show("Reminder period (/notify remind) : OFF");
} else if (remind_period == 1) {
cons_show("Reminder period (/notify remind) : 1 second");
} else {
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
}
}
开发者ID:cjopcjop,项目名称:profanity,代码行数:32,代码来源:console.c
示例3: _shutdown
static void
_shutdown(void)
{
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
ui_goodbye_title();
} else {
ui_clear_win_title();
}
}
ui_close_all_wins();
jabber_disconnect();
jabber_shutdown();
roster_free();
muc_close();
caps_close();
ui_close();
#ifdef HAVE_LIBOTR
otr_shutdown();
#endif
#ifdef HAVE_LIBGPGME
p_gpg_close();
#endif
chat_log_close();
theme_close();
accounts_close();
tlscerts_close();
cmd_uninit();
log_stderr_close();
log_close();
prefs_close();
if (saved_status) {
free(saved_status);
}
}
开发者ID:chosegood,项目名称:profanity,代码行数:35,代码来源:profanity.c
示例4: caps_init
void
caps_init(void)
{
log_info("Loading capabilities cache");
cache_loc = files_get_data_path(FILE_CAPSCACHE);
if (g_file_test(cache_loc, G_FILE_TEST_EXISTS)) {
g_chmod(cache_loc, S_IRUSR | S_IWUSR);
}
cache = g_key_file_new();
g_key_file_load_from_file(cache, cache_loc, G_KEY_FILE_KEEP_COMMENTS, NULL);
jid_to_ver = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
jid_to_caps = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)caps_destroy);
prof_features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
g_hash_table_add(prof_features, strdup(STANZA_NS_CAPS));
g_hash_table_add(prof_features, strdup(XMPP_NS_DISCO_INFO));
g_hash_table_add(prof_features, strdup(XMPP_NS_DISCO_ITEMS));
g_hash_table_add(prof_features, strdup(STANZA_NS_MUC));
g_hash_table_add(prof_features, strdup(STANZA_NS_CONFERENCE));
g_hash_table_add(prof_features, strdup(STANZA_NS_VERSION));
g_hash_table_add(prof_features, strdup(STANZA_NS_CHATSTATES));
g_hash_table_add(prof_features, strdup(STANZA_NS_PING));
if (prefs_get_boolean(PREF_RECEIPTS_SEND)) {
g_hash_table_add(prof_features, strdup(STANZA_NS_RECEIPTS));
}
if (prefs_get_boolean(PREF_LASTACTIVITY)) {
g_hash_table_add(prof_features, strdup(STANZA_NS_LASTACTIVITY));
}
my_sha1 = NULL;
}
开发者ID:sizeofvoid,项目名称:profanity,代码行数:33,代码来源:capabilities.c
示例5: message_send
void
message_send(const char * const msg, const char * const recipient)
{
const char * jid = NULL;
if (roster_barejid_from_name(recipient) != NULL) {
jid = roster_barejid_from_name(recipient);
} else {
jid = recipient;
}
if (prefs_get_boolean(PREF_STATES)) {
if (!chat_session_exists(jid)) {
chat_session_start(jid, TRUE);
}
}
xmpp_stanza_t *message;
xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx();
if (prefs_get_boolean(PREF_STATES) && chat_session_get_recipient_supports(jid)) {
chat_session_set_active(jid);
message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT,
msg, STANZA_NAME_ACTIVE, NULL);
} else {
message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT,
msg, NULL, NULL);
}
xmpp_send(conn, message);
xmpp_stanza_release(message);
}
开发者ID:Aktrisa,项目名称:profanity,代码行数:32,代码来源:message.c
示例6: sv_ev_roster_received
void
sv_ev_roster_received(void)
{
if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster();
}
char *account_name = session_get_account_name();
#ifdef HAVE_LIBGPGME
// check pgp key valid if specified
ProfAccount *account = accounts_get_account(account_name);
if (account && account->pgp_keyid) {
char *err_str = NULL;
if (!p_gpg_valid_key(account->pgp_keyid, &err_str)) {
cons_show_error("Invalid PGP key ID specified: %s, %s", account->pgp_keyid, err_str);
}
free(err_str);
}
account_free(account);
#endif
// send initial presence
resource_presence_t conn_presence = accounts_get_login_presence(account_name);
char *last_activity_str = accounts_get_last_activity(account_name);
if (last_activity_str) {
GDateTime *nowdt = g_date_time_new_now_utc();
GTimeVal lasttv;
gboolean res = g_time_val_from_iso8601(last_activity_str, &lasttv);
if (res) {
GDateTime *lastdt = g_date_time_new_from_timeval_utc(&lasttv);
GTimeSpan diff_micros = g_date_time_difference(nowdt, lastdt);
int diff_secs = (diff_micros / 1000) / 1000;
if (prefs_get_boolean(PREF_LASTACTIVITY)) {
cl_ev_presence_send(conn_presence, NULL, diff_secs);
} else {
cl_ev_presence_send(conn_presence, NULL, 0);
}
g_date_time_unref(lastdt);
} else {
cl_ev_presence_send(conn_presence, NULL, 0);
}
free(last_activity_str);
g_date_time_unref(nowdt);
} else {
cl_ev_presence_send(conn_presence, NULL, 0);
}
const char *fulljid = connection_get_fulljid();
plugins_on_connect(account_name, fulljid);
}
开发者ID:fisle,项目名称:profanity,代码行数:53,代码来源:server_events.c
示例7: prefs_do_chat_notify
gboolean
prefs_do_chat_notify(gboolean current_win)
{
if (prefs_get_boolean(PREF_NOTIFY_CHAT) == FALSE) {
return FALSE;
} else {
if ((current_win == FALSE) || ((current_win == TRUE) && prefs_get_boolean(PREF_NOTIFY_CHAT_CURRENT))) {
return TRUE;
} else {
return FALSE;
}
}
}
开发者ID:0xPoly,项目名称:profanity,代码行数:13,代码来源:preferences.c
示例8: handle_incoming_message
void
handle_incoming_message(char *from, char *message, gboolean priv)
{
#ifdef HAVE_LIBOTR
gboolean was_decrypted = FALSE;
char *newmessage;
if (!priv) {
newmessage = otr_decrypt_message(from, message, &was_decrypted);
// internal OTR message
if (newmessage == NULL) {
return;
}
} else {
newmessage = message;
}
ui_incoming_msg(from, newmessage, NULL, priv);
ui_current_page_off();
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
Jid *from_jid = jid_create(from);
const char *jid = jabber_get_fulljid();
Jid *jidp = jid_create(jid);
if (!was_decrypted || (strcmp(prefs_get_string(PREF_OTR_LOG), "on") == 0)) {
chat_log_chat(jidp->barejid, from_jid->barejid, newmessage, PROF_IN_LOG, NULL);
} else if (strcmp(prefs_get_string(PREF_OTR_LOG), "redact") == 0) {
chat_log_chat(jidp->barejid, from_jid->barejid, "[redacted]", PROF_IN_LOG, NULL);
}
jid_destroy(jidp);
jid_destroy(from_jid);
}
if (!priv)
otr_free_message(newmessage);
#else
ui_incoming_msg(from, message, NULL, priv);
ui_current_page_off();
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
Jid *from_jid = jid_create(from);
const char *jid = jabber_get_fulljid();
Jid *jidp = jid_create(jid);
chat_log_chat(jidp->barejid, from_jid->barejid, message, PROF_IN_LOG, NULL);
jid_destroy(jidp);
jid_destroy(from_jid);
}
#endif
}
开发者ID:louiecaulfield,项目名称:profanity,代码行数:51,代码来源:server_events.c
示例9: ui_outgoing_msg
void
ui_outgoing_msg(const char * const from, const char * const to,
const char * const message)
{
PContact contact = roster_get_contact(to);
ProfWin *window = wins_get_by_recipient(to);
int num = 0;
// create new window
if (window == NULL) {
Jid *jid = jid_create(to);
if (muc_room_is_active(jid)) {
window = wins_new(to, WIN_PRIVATE);
} else {
window = wins_new(to, WIN_CHAT);
}
jid_destroy(jid);
num = wins_get_num(window);
if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
_win_show_history(window->win, num, to);
}
if (contact != NULL) {
if (strcmp(p_contact_presence(contact), "offline") == 0) {
const char const *show = p_contact_presence(contact);
const char const *status = p_contact_status(contact);
_show_status_string(window, to, show, status, NULL, "--", "offline");
}
}
// use existing window
} else {
num = wins_get_num(window);
}
win_print_time(window, '-');
if (strncmp(message, "/me ", 4) == 0) {
wattron(window->win, COLOUR_ME);
wprintw(window->win, "*%s ", from);
wprintw(window->win, "%s", message + 4);
wprintw(window->win, "\n");
wattroff(window->win, COLOUR_ME);
} else {
_win_show_user(window->win, from, 0);
_win_show_message(window->win, message);
}
ui_switch_win(num);
}
开发者ID:jesseadams,项目名称:profanity,代码行数:51,代码来源:core.c
示例10: prefs_do_room_notify
gboolean
prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char *const mynick,
const char *const theirnick, const char *const message, gboolean mention, gboolean trigger_found)
{
if (g_strcmp0(mynick, theirnick) == 0) {
return FALSE;
}
gboolean notify_current = prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT);
gboolean notify_window = FALSE;
if (!current_win || (current_win && notify_current) ) {
notify_window = TRUE;
}
if (!notify_window) {
return FALSE;
}
gboolean notify_room = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify", NULL)) {
notify_room = g_key_file_get_boolean(prefs, roomjid, "notify", NULL);
} else {
notify_room = prefs_get_boolean(PREF_NOTIFY_ROOM);
}
if (notify_room) {
return TRUE;
}
gboolean notify_mention = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify.mention", NULL)) {
notify_mention = g_key_file_get_boolean(prefs, roomjid, "notify.mention", NULL);
} else {
notify_mention = prefs_get_boolean(PREF_NOTIFY_ROOM_MENTION);
}
if (notify_mention && mention) {
return TRUE;
}
gboolean notify_trigger = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify.trigger", NULL)) {
notify_trigger = g_key_file_get_boolean(prefs, roomjid, "notify.trigger", NULL);
} else {
notify_trigger = prefs_get_boolean(PREF_NOTIFY_ROOM_TRIGGER);
}
if (notify_trigger && trigger_found) {
return TRUE;
}
return FALSE;
}
开发者ID:0xPoly,项目名称:profanity,代码行数:49,代码来源:preferences.c
示例11: ui_init
void
ui_init(void)
{
log_info("Initialising UI");
initscr();
raw();
keypad(stdscr, TRUE);
if (prefs_get_boolean(PREF_MOUSE)) {
mousemask(ALL_MOUSE_EVENTS, NULL);
mouseinterval(5);
}
ui_load_colours();
refresh();
create_title_bar();
create_status_bar();
status_bar_active(1);
create_input_window();
wins_init();
cons_about();
notifier_init();
#ifdef HAVE_LIBXSS
display = XOpenDisplay(0);
#endif
ui_idle_time = g_timer_new();
wins_refresh_current();
}
开发者ID:jesseadams,项目名称:profanity,代码行数:26,代码来源:core.c
示例12: ui_idle
void
ui_idle(void)
{
GSList *recipients = wins_get_chat_recipients();
GSList *curr = recipients;
while (curr != NULL) {
char *recipient = curr->data;
chat_session_no_activity(recipient);
if (chat_session_is_gone(recipient) &&
!chat_session_get_sent(recipient)) {
message_send_gone(recipient);
} else if (chat_session_is_inactive(recipient) &&
!chat_session_get_sent(recipient)) {
message_send_inactive(recipient);
} else if (prefs_get_boolean(PREF_OUTTYPE) &&
chat_session_is_paused(recipient) &&
!chat_session_get_sent(recipient)) {
message_send_paused(recipient);
}
curr = g_slist_next(curr);
}
if (recipients != NULL) {
g_slist_free(recipients);
}
}
开发者ID:jesseadams,项目名称:profanity,代码行数:28,代码来源:core.c
示例13: inp_nonblocking
void
inp_nonblocking(gboolean reset)
{
if (! prefs_get_boolean(PREF_INPBLOCK_DYNAMIC)) {
inp_timeout = prefs_get_inpblock();
return;
}
if (reset) {
inp_timeout = 0;
no_input_count = 0;
}
if (inp_timeout < prefs_get_inpblock()) {
no_input_count++;
if (no_input_count % 10 == 0) {
inp_timeout += no_input_count;
if (inp_timeout > prefs_get_inpblock()) {
inp_timeout = prefs_get_inpblock();
}
}
}
}
开发者ID:diagprov,项目名称:profanity,代码行数:25,代码来源:inputwin.c
示例14: _tray_change_icon
/*
* Callback for the timer
*
* This is the callback that the timer is calling in order to check if messages are there.
*
*/
gboolean
_tray_change_icon(gpointer data)
{
if (shutting_down) {
return FALSE;
}
unread_messages = wins_get_total_unread();
if (unread_messages) {
if (!prof_tray) {
prof_tray = gtk_status_icon_new_from_file(icon_msg_filename->str);
} else {
gtk_status_icon_set_from_file(prof_tray, icon_msg_filename->str);
}
} else {
if (prefs_get_boolean(PREF_TRAY_READ)) {
if (!prof_tray) {
prof_tray = gtk_status_icon_new_from_file(icon_filename->str);
} else {
gtk_status_icon_set_from_file(prof_tray, icon_filename->str);
}
} else {
g_clear_object(&prof_tray);
prof_tray = NULL;
}
}
return TRUE;
}
开发者ID:fisle,项目名称:profanity,代码行数:36,代码来源:tray.c
示例15: sv_ev_subscription
void
sv_ev_subscription(const char *barejid, jabber_subscr_t type)
{
switch (type) {
case PRESENCE_SUBSCRIBE:
/* TODO: auto-subscribe if needed */
cons_show("Received authorization request from %s", barejid);
log_info("Received authorization request from %s", barejid);
ui_print_system_msg_from_recipient(barejid, "Authorization request, type '/sub allow' to accept or '/sub deny' to reject");
if (prefs_get_boolean(PREF_NOTIFY_SUB)) {
notify_subscription(barejid);
}
break;
case PRESENCE_SUBSCRIBED:
cons_show("Subscription received from %s", barejid);
log_info("Subscription received from %s", barejid);
ui_print_system_msg_from_recipient(barejid, "Subscribed");
break;
case PRESENCE_UNSUBSCRIBED:
cons_show("%s deleted subscription", barejid);
log_info("%s deleted subscription", barejid);
ui_print_system_msg_from_recipient(barejid, "Unsubscribed");
break;
default:
/* unknown type */
break;
}
}
开发者ID:fisle,项目名称:profanity,代码行数:28,代码来源:server_events.c
示例16: handle_login_account_success
void
handle_login_account_success(char *account_name)
{
ProfAccount *account = accounts_get_account(account_name);
#ifdef HAVE_LIBOTR
otr_on_connect(account);
#endif
ui_handle_login_account_success(account);
// attempt to rejoin rooms with passwords
GList *curr = muc_rooms();
while (curr != NULL) {
char *password = muc_password(curr->data);
if (password != NULL) {
char *nick = muc_nick(curr->data);
presence_join_room(curr->data, nick, password);
}
curr = g_list_next(curr);
}
g_list_free(curr);
log_info("%s logged in successfully", account->jid);
account_free(account);
if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster();
}
}
开发者ID:fabianfreyer,项目名称:profanity,代码行数:30,代码来源:server_events.c
示例17: sv_ev_roster_received
void
sv_ev_roster_received(void)
{
if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster();
}
}
开发者ID:PMaynard,项目名称:profanity,代码行数:7,代码来源:server_events.c
示例18: prof_handle_idle
void
prof_handle_idle(void)
{
jabber_conn_status_t status = jabber_get_connection_status();
if (status == JABBER_CONNECTED) {
GSList *recipients = ui_get_recipients();
GSList *curr = recipients;
while (curr != NULL) {
char *recipient = curr->data;
if (chat_session_get_recipient_supports(recipient)) {
chat_session_no_activity(recipient);
if (chat_session_is_gone(recipient) &&
!chat_session_get_sent(recipient)) {
message_send_gone(recipient);
} else if (chat_session_is_inactive(recipient) &&
!chat_session_get_sent(recipient)) {
message_send_inactive(recipient);
} else if (prefs_get_boolean(PREF_OUTTYPE) &&
chat_session_is_paused(recipient) &&
!chat_session_get_sent(recipient)) {
message_send_paused(recipient);
}
}
curr = g_slist_next(curr);
}
if (recipients != NULL) {
g_slist_free(recipients);
}
}
}
开发者ID:Liangwz,项目名称:profanity,代码行数:34,代码来源:profanity.c
示例19: roster_get_msg_display_name
char*
roster_get_msg_display_name(const char *const barejid, const char *const resource)
{
assert(roster != NULL);
GString *result = g_string_new("");
PContact contact = roster_get_contact(barejid);
if (contact) {
if (p_contact_name(contact)) {
g_string_append(result, p_contact_name(contact));
} else {
g_string_append(result, barejid);
}
} else {
g_string_append(result, barejid);
}
if (resource && prefs_get_boolean(PREF_RESOURCE_MESSAGE)) {
g_string_append(result, "/");
g_string_append(result, resource);
}
char *result_str = result->str;
g_string_free(result, FALSE);
return result_str;
}
开发者ID:0xPoly,项目名称:profanity,代码行数:28,代码来源:roster_list.c
示例20: _receipt_request_handler
void
_receipt_request_handler(xmpp_stanza_t *const stanza)
{
if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) {
return;
}
char *id = xmpp_stanza_get_id(stanza);
if (!id) {
return;
}
xmpp_stanza_t *receipts = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS);
if (!receipts) {
return;
}
char *receipts_name = xmpp_stanza_get_name(receipts);
if (g_strcmp0(receipts_name, "request") != 0) {
return;
}
gchar *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
Jid *jid = jid_create(from);
_message_send_receipt(jid->fulljid, id);
jid_destroy(jid);
}
开发者ID:KThand1,项目名称:profanity,代码行数:27,代码来源:message.c
注:本文中的prefs_get_boolean函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论