Changeset f26d9a3e


Ignore:
Timestamp:
2012-11-24T14:10:34Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
5f2f728
Parents:
c751e51
Message:

Add help info for "stream" setting. Also, disable it for non-Twitter accounts.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/user-guide/commands.xml

    rc751e51 rf26d9a3e  
    10231023
    10241024        </bitlbee-setting>
     1025
     1026        <bitlbee-setting name="stream" type="boolean" scope="account">
     1027                <default>true</default>
     1028
     1029                <description>
     1030                        <para>
     1031                                For Twitter accounts, this setting enables use of the Streaming API. This automatically gives you incoming DMs as well.
     1032                        </para>
     1033                       
     1034                        <para>
     1035                                For other Twitter-like services, this setting is not supported.
     1036                        </para>
     1037                </description>
     1038
     1039        </bitlbee-setting>
    10251040       
    10261041        <bitlbee-setting name="target_url_length" type="integer" scope="account">
  • protocols/twitter/twitter.c

    rc751e51 rf26d9a3e  
    6565        imcb_log(ic, "Getting initial statuses");
    6666
    67         // Run this once. After this queue the main loop function.
     67        // Run this once. After this queue the main loop function (or open the
     68        // stream if available).
    6869        twitter_main_loop(ic, -1, 0);
    6970       
     
    7273                   us the rest. \o/ */
    7374                twitter_open_stream(ic);
     75               
     76                /* Stream sends keepalives (empty lines) or actual data at
     77                   least twice a minute. Disconnect if this stops. */
    7478                ic->flags |= OPT_PONGS;
    7579        } else {
     
    96100                imcb_log(ic, "Getting contact list");
    97101                twitter_get_friends_ids(ic, -1);
    98                 //twitter_get_statuses_friends(ic, -1);
    99102        } else
    100103                twitter_main_loop_start(ic);
     
    289292        s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc);
    290293       
    291         s = set_add(&acc->set, "stream", "true", set_eval_bool, acc);
    292         s->flags |= ACC_SET_OFFLINE_ONLY;
     294        if (strcmp(acc->prpl->name, "twitter") == 0) {
     295                s = set_add(&acc->set, "stream", "true", set_eval_bool, acc);
     296                s->flags |= ACC_SET_OFFLINE_ONLY;
     297        }
    293298}
    294299
    295300/**
    296  * Login method. Since the twitter API works with seperate HTTP request we
     301 * Login method. Since the twitter API works with separate HTTP request we
    297302 * only save the user and pass to the twitter_data object.
    298303 */
     
    310315                imc_logout(ic, FALSE);
    311316                return;
     317        }
     318
     319        if (!strstr(url.host, "twitter.com") &&
     320            set_getbool(&ic->acc->set, "stream")) {
     321                imcb_error(ic, "Warning: The streaming API is only supported by Twitter, "
     322                               "and you seem to be connecting to a different service.");
    312323        }
    313324
Note: See TracChangeset for help on using the changeset viewer.