Changeset 9f03c47 for protocols


Ignore:
Timestamp:
2016-11-14T00:37:14Z (8 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
537d9b9, b4f496e
Parents:
ea90275
Message:

Improve support for protocols which don't require a password

This adds a prpl_options_t enum with flags, which mostly just brings
OPT_PROTO_{NO_PASSWORD,PASSWORD_OPTIONAL} from libpurple as
PRPL_OPT_{NO_PASSWORD,PASSWORD_OPTIONAL}

Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.h

    rea90275 r9f03c47  
    140140};
    141141
     142/* This enum takes a few things from libpurple and a few things from old OPT_ flags.
     143 * The only flag that was used before this struct was PRPL_OPT_NOOTR.
     144 *
     145 * The libpurple ones only use the same values as the PurpleProtocolOptions
     146 * enum for convenience, but there's no promise of direct compatibility with
     147 * those values. As of libpurple 2.8.0 they use up to 0x800 (1 << 11), which is
     148 * a nice coincidence.
     149 */
     150typedef enum {
     151        /* The protocol doesn't use passwords
     152         * Mirrors libpurple's OPT_PROTO_NO_PASSWORD */
     153        PRPL_OPT_NO_PASSWORD = 1 << 4,
     154
     155        /* The protocol doesn't require passwords, but may use them
     156         * Mirrors libpurple's OPT_PROTO_PASSWORD_OPTIONAL */
     157        PRPL_OPT_PASSWORD_OPTIONAL = 1 << 7,
     158
     159        /* The protocol is not suitable for OTR, see OPT_NOOTR */
     160        PRPL_OPT_NOOTR = 1 << 12,
     161} prpl_options_t;
     162
    142163struct prpl {
    143164        int options;
  • protocols/purple/purple.c

    rea90275 r9f03c47  
    17251725        for (prots = purple_plugins_get_protocols(); prots; prots = prots->next) {
    17261726                PurplePlugin *prot = prots->data;
     1727                PurplePluginProtocolInfo *pi = prot->info->extra_info;
    17271728                struct prpl *ret;
    17281729
     
    17381739                        ret->name += 5;
    17391740                }
     1741
     1742                if (pi->options & OPT_PROTO_NO_PASSWORD) {
     1743                        ret->options |= PRPL_OPT_NO_PASSWORD;
     1744                }
     1745
     1746                if (pi->options & OPT_PROTO_PASSWORD_OPTIONAL) {
     1747                        ret->options |= PRPL_OPT_PASSWORD_OPTIONAL;
     1748                }
     1749
    17401750                register_protocol(ret);
    17411751
  • protocols/twitter/twitter.c

    rea90275 r9f03c47  
    10921092        struct prpl *ret = g_new0(struct prpl, 1);
    10931093
    1094         ret->options = OPT_NOOTR;
     1094        ret->options = PRPL_OPT_NOOTR | PRPL_OPT_NO_PASSWORD;
    10951095        ret->name = "twitter";
    10961096        ret->login = twitter_login;
     
    11191119        ret = g_memdup(ret, sizeof(struct prpl));
    11201120        ret->name = "identica";
     1121        ret->options =  PRPL_OPT_NOOTR;
    11211122        register_protocol(ret);
    11221123}
Note: See TracChangeset for help on using the changeset viewer.