1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

ifdefs for twitter & identica

This commit is contained in:
Gabor Adam Toth 2010-02-24 00:12:30 +01:00
parent 9421149ffd
commit bc0b9dd325
3 changed files with 32 additions and 3 deletions

View file

@ -261,4 +261,13 @@
// still using rawp anywhere?
//#define rawp(TEXT) { P1(("rawp? "+TEXT)) emit(TEXT); }
#ifdef _flag_enable_module_microblogging
# if defined(TWITTER_KEY) && defined(TWITTER_SECRET)
# define TWITTER
# endif
# if defined(IDENTICA_KEY) && defined(IDENTICA_SECRET)
# define IDENTICA
# endif
#endif
#endif

View file

@ -94,11 +94,15 @@ private volatile mapping _sigs = ([
"_request_remove": ({ "_request_remove", 0, "_person" }),
"_request_priv": ({ "_request_privacy", 0, "_privacy" }),
"_request_privacy": ({ "_request_privacy", 0, "_privacy" }),
#ifdef TWITTER
"_request_tw": ({ "_request_twitter", 0, "_switch" }),
"_request_twitter": ({ "_request_twitter", 0, "_switch" }),
#endif
#ifdef IDENTICA
"_request_ica": ({ "_request_identica", 0, "_switch" }),
"_request_identica": ({ "_request_identica", 0, "_switch" }),
#endif
#endif
#ifdef EXPERIMENTAL
// stuff to play around with
"_request_pset": ({ "_request_set", 0, "_key", "_value" }),

View file

@ -16,7 +16,13 @@ volatile mixed lastTry;
volatile string owner;
volatile string channel;
volatile object twitter, identica;
#ifdef TWITTER
volatile object twitter;
#endif
#ifdef IDENTICA
volatile object identica;
#endif
load(name, keep) {
P3((">> userthreads:load(%O, %O)\n", name, keep))
@ -55,8 +61,12 @@ enter(source, mc, data, vars) {
if (p == source) {
p->sChannel(MYNICK);
#ifdef TWITTER
if (v("twitter") && !twitter) twitter = clone_object(NET_PATH "twitter/client")->load(source);
#endif
#ifdef IDENTICA
if (v("identica") && !identica) identica = clone_object(NET_PATH "identica/client")->load(source);
#endif
}
return ::enter(source, mc, data, vars);
@ -130,6 +140,7 @@ _request_privacy(source, mc, data, vars, b) {
return 1;
}
#ifdef TWITTER
_request_twitter(source, mc, data, vars, b) {
string sw = vars["_switch"];
if (sw == "on" || sw == "enabled" || sw == "1") {
@ -145,7 +156,9 @@ _request_twitter(source, mc, data, vars, b) {
sendmsg(source, "_status_twitter", "Twitter submission is [_status].", (["_status": v("twitter") ? "enabled" : "disabled"]));
return 1;
}
#endif
#ifdef IDENTICA
_request_identica(source, mc, data, vars, b) {
string sw = vars["_switch"];
if (sw == "on" || sw == "enabled" || sw == "1") {
@ -157,17 +170,20 @@ _request_identica(source, mc, data, vars, b) {
vSet("identica", 0);
save();
}
DT(else if (sw == "test") identica->home_timeline();)
sendmsg(source, "_status_identica", "Identi.ca submission is [_status].", (["_status": v("identica") ? "enabled" : "disabled"]));
return 1;
}
#endif
addEntry(text, unick, thread) {
if (::addEntry(text, unick, thread)) {
#ifdef TWITTER
if (v("twitter") && twitter) twitter->status_update(text);
#endif
#ifdef IDENTICA
if (v("identica") && identica) identica->status_update(text);
#endif
}
}