Changeset bab1c86 for protocols/purple


Ignore:
Timestamp:
2010-03-08T01:21:08Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
fdba6bc
Parents:
52cae01
Message:

Mail notifications, partially from http://irc.nfx.cz/patches/notify.patch
written by sd@ircnet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r52cae01 rbab1c86  
    44*  libpurple module - Main file                                             *
    55*                                                                           *
    6 *  Copyright 2010 Wilmer van der Gaast <wilmer@gaast.net>                   *
     6*  Copyright 2009-2010 Wilmer van der Gaast <wilmer@gaast.net>              *
    77*                                                                           *
    88*  This program is free software; you can redistribute it and/or modify     *
     
    5959        PurpleAccount *pa;
    6060        GList *i, *st;
     61        set_t *s;
    6162       
    6263        /* Convert all protocol_options into per-account setting variables. */
     
    6768                char *def = NULL;
    6869                set_eval eval = NULL;
    69                 set_t *s;
    7070               
    7171                name = purple_account_option_get_setting( o );
     
    103103        }
    104104       
     105        if( pi->options & OPT_PROTO_MAIL_CHECK )
     106        {
     107                s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc );
     108                s->flags |= ACC_SET_OFFLINE_ONLY;
     109        }
     110       
    105111        /* Go through all away states to figure out if away/status messages
    106112           are possible. */
     
    159165                }
    160166        }
     167       
     168        if( pi->options & OPT_PROTO_MAIL_CHECK )
     169                purple_account_set_check_mail( pa, set_getbool( &acc->set, "mail_notifications" ) );
    161170}
    162171
     
    238247               
    239248                if( state_txt == NULL &&
    240                     purple_status_type_get_primitive( st->data ) == PURPLE_STATUS_AVAILABLE )
     249                    purple_status_type_get_primitive( pst ) == PURPLE_STATUS_AVAILABLE )
    241250                        break;
    242251
     
    246255        }
    247256       
    248         if( message && purple_status_type_get_attr( st, "message" ) )
     257        if( message && purple_status_type_get_attr( pst, "message" ) )
    249258        {
    250259                args = g_list_append( args, "message" );
     
    589598};
    590599
     600static void *prplcb_notify_email( PurpleConnection *gc, const char *subject, const char *from,
     601                                  const char *to, const char *url )
     602{
     603        struct im_connection *ic = purple_ic_by_gc( gc );
     604       
     605        imcb_log( ic, "Received e-mail from %s for %s: %s <%s>", from, to, subject, url );
     606       
     607        return NULL;
     608}
     609
     610static  PurpleNotifyUiOps bee_notify_uiops =
     611{
     612        NULL,
     613        prplcb_notify_email,
     614};
     615
    591616static void purple_ui_init()
    592617{
     
    595620        purple_conversations_set_ui_ops( &bee_conv_uiops );
    596621        purple_request_set_ui_ops( &bee_request_uiops );
     622        purple_notify_set_ui_ops(&bee_notify_uiops);
    597623        //purple_debug_set_ui_ops( &bee_debug_uiops );
    598624}
     
    644670        help = g_string_new("BitlBee libpurple module supports the following IM protocols:\n");
    645671       
     672        /* Add a protocol entry to BitlBee's structures for every protocol
     673           supported by this libpurple instance. */     
    646674        for( prots = purple_plugins_get_protocols(); prots; prots = prots->next )
    647675        {
     
    657685                g_string_append_printf( help, "\n* %s (%s)", ret->name, prot->info->name );
    658686               
     687                /* libpurple doesn't define a protocol called OSCAR, but we
     688                   need it to be compatible with normal BitlBee. */
    659689                if( g_strcasecmp( prot->info->id, "prpl-aim" ) == 0 )
    660690                {
     
    666696        }
    667697       
     698        /* Add a simple dynamically-generated help item listing all
     699           the supported protocols. */
    668700        help_add_mem( &global.help, "purple", help->str );
    669701        g_string_free( help, TRUE );
Note: See TracChangeset for help on using the changeset viewer.