-proc twitter_pub_publish_to_account {account nick text} {
- set who [whois $nick]
- if {$who == ""} {
- append text " – via IRC."
- } {
- append text " – $who, via IRC."
- }
- twitterpublish $account $nick $text
-}
-
-#!ideert
-proc pub:ideert {nick uhost handle chan text} {
- set status ""
- if {[twitter_try_extract_status $text status]} {
- twitter_retweet ideedarticles $status
- return 1
- } {
- return 0
- }
-}
-
#!identica
proc pub:identica {nick uhost handle chan text} {
putquick "NOTICE $nick :!identica is currently disabled. Is identi.ca still usable since pump.io migration? If so, please request the command."
}
-#!pub or !twit or !tweet
-#The account is channel dependant
-proc pub:twitter {nick uhost handle chan text} {
- set account [registry get twitter.channels.$chan.account]
- set is_protected [registry get twitter.channels.$chan.protected]
-
- if {$account == ""} {
- putquick "NOTICE $nick :!pub isn't n'est pas activé sur le canal $chan / !pub isn't enabled on channel $chan"
- return
- }
-
- if {$is_protected == "1"} {
- set who [whois $nick]
- if {$who == ""} {
- putquick "NOTICE $nick :Pour utiliser !pub sur $chan, vous devez disposer d'un cloak projet ou unaffiliated, être connecté depuis un host sans chiffre ou encore avoir votre user@host reconnu par mes soins."
- return 0
- } {
- append text " — $who"
- }
- }
-
- twitterpublish $account $nick $text
-}
-
-proc twitter_message_len {} { return 140 }
-
-proc twitterpublish {account nick text} {
- if {$text == ""} {
- putquick "NOTICE $nick :Syntaxe : !pub <texte à publier sur identi.ca et Twitter>"
- return
- }
- set len [twitter_compute_len $text]
- if {$len > [twitter_message_len]} {
- putquick "NOTICE $nick :[twitter_message_len] caractères max, là il y en a $len ([twitter_get_short_url_length] par lien)."
- return
- }
- if [twitterpost $account $text] {
- putquick "NOTICE $nick :Publié sur Twitter"
- return 1
- } {
- putquick "NOTICE $nick :Non publié, une erreur a eu lieu."
- }
-}
-
-# Extracts the id of the status from an URL or directly from this ID
-#
-# @param text The text containing the status ID
-# @param If successful, will be set to the id of the status to retweet
-# @return 1 if successful; otherwise, 0
-proc twitter_try_extract_status {text status} {
- upvar 1 $status value
-
- # Trivial case: value is already the status identifier
- if {[isnumber $text]} {
- set value $text
- return 1
- }
-
- regexp "twitter\.com/.*/status/(\[0-9\]+)" $text matches value
-}
-
-# Retweets a status
-#
-# @param account The retweeting account username
-# @param status The id of the status to retweet
-# @return The API reply, as a dictionary
-proc twitter_retweet {account status} {
- set url https://api.twitter.com/1.1/statuses/retweet/$status.json
- twitter_query $url $account "" POST
-}
-
-# @param param The parameter to fetch in the API reply
-# return The value from configuration the JSON document, or a dict if it contains several parameters
- twitter_compute_len "Je vais sur http://www.perdu.com pour y lire https://fr.wikipedia.org/w/index.php?title=Les_B%C3%A2tards_du_Nord&type=revision&diff=133589772&oldid=133589631"
-} -result 71
-
-###
-### Cleanup
-###
-
-cleanupTests
diff --git a/vendor/oauth.tcl b/vendor/oauth.tcl
deleted file mode 100644
--- a/vendor/oauth.tcl
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# 0.2 - ???
-# - create base_url correctly for signing (remove ?params=...)
-# - improve error msg if http timeout occurs
-# - remove need to hardcode consumer key/secret by providing them as arguments
-# to the various functions
-#
-# 0.1 - May 18 2010
-# - Initial release
-#
-# by horgh (www.summercat.com)
-#
-# OAuth (1.0/1.0a) library for Twitter
-#
-# Requirements:
-# - Tcl 8.5+ and "recent" tcllib (developed with tcllib 1.12)
-#
-# Setup for users:
-# - Register for consumer key/secret at http://twitter.com/oauth_clients
-#
-# Library usage:
-# - You can store oauth_token/oauth_token_secret from get_access_token[] and
-# use it indefinitely (unless twitter starts expiring the tokens). Thus the
-# setup (below) need only be done once by storing and reusing these.
-# - the $key:value_http_query is such that you would pass to http::formatQuery
-# e.g. status {this is a tweet}
-# - example call: puts [oauth::query_api http://api.twitter.com/1/statuses/update.json <key> <secret> POST $oauth_token_done $oauth_token_secret_done [list status "does it work"]]