Changeset faeb521 for protocols/jabber


Ignore:
Timestamp:
2015-05-28T05:26:30Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0864a52
Parents:
dd43c62
git-author:
dequis <dx@…> (08-05-15 03:26:19)
git-committer:
dequis <dx@…> (28-05-15 05:26:30)
Message:

Simplify display of gmail notifications

  • Add gmail_notifications_limit hidden setting, set to 5 by default.
  • Don't show "snippets" in email notifications. Not very useful and they make the whole thing seem too spammy
  • Show sender name instead of your own email
  • Default values for empty subject / sender
Location:
protocols/jabber
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    rdd43c62 rfaeb521  
    793793        guint64 l_time = 0;
    794794        char *tid = NULL;
     795        int max = 0;
    795796
    796797        if (!(c = xt_find_node(node->children, "mailbox")) ||
     
    802803        }
    803804
     805        max = set_getint(&ic->acc->set, "gmail_notifications_limit");
    804806        c = c->children;
    805807
    806         while ((c = xt_find_node(c, "mail-thread-info"))) {
    807                 struct xt_node *thread, *s;
    808                 char *subject = NULL;
    809                 char *snippet = NULL;
     808        while ((max-- > 0) && (c = xt_find_node(c, "mail-thread-info"))) {
     809                struct xt_node *s;
     810                char *subject = "<no subject>";
     811                char *sender = "<no sender>";
    810812                char *msg = NULL;
    811813                guint64 t_time;
     
    817819                }
    818820
    819                 thread = c->children;
    820 
    821                 if ((s = xt_find_node(thread, "subject"))) {
     821                if ((s = xt_find_node(c->children, "senders")) &&
     822                    (s = xt_find_node_by_attr(s->children, "sender", "unread", "1"))) {
     823                        sender = xt_find_attr(s, "name");
     824                }
     825
     826                if ((s = xt_find_node(c->children, "subject")) && s->text) {
    822827                        subject = s->text;
    823828                }
    824829
    825                 if ((s = xt_find_node(thread, "snippet"))) {
    826                         snippet = s->text;
    827                 }
    828 
    829                 if (subject) {
    830                         msg = g_strdup_printf("New mail for %s. Subj: %s", from, subject);
    831                 } else {
    832                         msg = g_strdup_printf("New mail for %s.", from);
    833                 }
     830                msg = g_strdup_printf("New mail from %s: %s", sender, subject);
     831
    834832                imcb_notify_email(ic, set_getstr(&ic->acc->set, "notify_handle"), msg, 0, 0);
    835 
    836                 if (snippet) {
    837                         imcb_notify_email(ic, set_getstr(&ic->acc->set, "notify_handle"), snippet, 0, 0);
    838                 }
    839833
    840834                c = c->next;
  • protocols/jabber/jabber.c

    rdd43c62 rfaeb521  
    103103        s = set_add(&acc->set, "gmail_notifications", "false", set_eval_bool, acc);
    104104        s->flags |= ACC_SET_OFFLINE_ONLY;
     105
     106        /* changing this is rarely needed so keeping it secret */
     107        s = set_add(&acc->set, "gmail_notifications_limit", "5", set_eval_int, acc);
     108        s->flags |= SET_HIDDEN_DEFAULT;
    105109
    106110        s = set_add(&acc->set, "notify_handle", NULL, NULL, acc);
Note: See TracChangeset for help on using the changeset viewer.