Add partial irc-proxy feature to relay plugin
parent
5a8c35f6b0
commit
999de8bfc1
|
@ -81,6 +81,7 @@ my @ignore_options = ("aspell\\.dict\\..*",
|
|||
"jabber\\.server\\..*",
|
||||
"logger\\.level\\..*",
|
||||
"logger\\.mask\\..*",
|
||||
"relay\\.port\\..*",
|
||||
"weechat\\.proxy\\..*",
|
||||
"weechat\\.bar\\..*",
|
||||
"weechat\\.debug\\..*",
|
||||
|
|
|
@ -39,6 +39,12 @@
|
|||
|
||||
| python | python_script | list of scripts
|
||||
|
||||
| relay | relay_free_port | first free port for relay plugin
|
||||
|
||||
| relay | relay_protocol_name | all possible protocol.name for relay plugin
|
||||
|
||||
| relay | relay_relays | protocol.name of current relays for relay plugin
|
||||
|
||||
| ruby | ruby_script | list of scripts
|
||||
|
||||
| tcl | tcl_script | list of scripts
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
• *`/demo_printf`* `[text]`::
|
||||
|
||||
........................................
|
||||
print some messages on current ubffer
|
||||
print some messages on current buffer
|
||||
|
||||
text: write this text
|
||||
........................................
|
||||
|
|
|
@ -197,6 +197,10 @@
|
|||
channel: channel where user is
|
||||
nickname: nickname to kick and ban
|
||||
comment: comment for kick
|
||||
|
||||
It is possible to kick/ban with a mask, nick will be extracted from mask and replaced by "*", for example:
|
||||
/kickban toto!*@host.com
|
||||
will ban "*!*@host.com" and then kick "toto".
|
||||
........................................
|
||||
|
||||
• *`/kill`* `nickname comment`::
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
• *`/relay`* `[list | listfull]`::
|
||||
• *`/relay`* `[list | listfull | add protocol.name port | del protocol.name]`::
|
||||
|
||||
........................................
|
||||
relay control
|
||||
|
||||
list: list relay clients
|
||||
listfull: list relay clients (verbose)
|
||||
list: list relay clients (only active relays)
|
||||
listfull: list relay clients (verbose, all relays)
|
||||
listrelay: list relays (name and port)
|
||||
add: add relay for a protocol + name
|
||||
del: remove relay for a protocol + name
|
||||
protocol.name: protocol and name to relay
|
||||
for example: irc.freenode
|
||||
port: port used for relay
|
||||
|
||||
Without argument, this command opens buffer with list of relay clients.
|
||||
........................................
|
||||
|
|
|
@ -43,13 +43,8 @@
|
|||
** type: boolean
|
||||
** values: on, off (default value: on)
|
||||
|
||||
* *relay.network.enabled*
|
||||
** description: enable relay
|
||||
** type: boolean
|
||||
** values: on, off (default value: off)
|
||||
|
||||
* *relay.network.listen_port_range*
|
||||
** description: port number (or range of ports) that relay plugin listens on (syntax: a single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to use ports greater than 1024, because only root can use ports below 1024)
|
||||
** type: string
|
||||
** values: any string (default value: "22373-22400")
|
||||
* *relay.network.max_clients*
|
||||
** description: maximum number of clients connecting to a port
|
||||
** type: integer
|
||||
** values: 1 .. 1024 (default value: 5)
|
||||
|
||||
|
|
|
@ -39,6 +39,12 @@
|
|||
|
||||
| python | python_script | liste des scripts
|
||||
|
||||
| relay | relay_free_port | premier port libre pour l'extension relay
|
||||
|
||||
| relay | relay_protocol_name | tous les protocole.nom possible pour l'extension relay
|
||||
|
||||
| relay | relay_relays | protocole.nom des relais courants pour l'extension relay
|
||||
|
||||
| ruby | ruby_script | liste des scripts
|
||||
|
||||
| tcl | tcl_script | liste des scripts
|
||||
|
|
|
@ -197,6 +197,10 @@
|
|||
canal: canal où l'utilisateur se trouve
|
||||
pseudo: pseudo à éliminer et bannir
|
||||
commentaire: commentaire pour l'élimination
|
||||
|
||||
Il est possible d'émiliner/bannir avec un masque, le pseudo sera extrait du masque et remplacé par "*", par exemple :
|
||||
/kickban toto!*@host.com
|
||||
bannira "*!*@host.com" puis éliminera "toto".
|
||||
........................................
|
||||
|
||||
• *`/kill`* `pseudo commentaire`::
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
• *`/relay`* `[list | listfull]`::
|
||||
• *`/relay`* `[list | listfull | add protocole.nom port | del protocole.nom]`::
|
||||
|
||||
........................................
|
||||
contrôle du relai
|
||||
|
||||
list: liste les clients pour le relai
|
||||
listfull: liste les clients pour le relai (verbeux)
|
||||
list: liste les clients pour le relai
|
||||
listfull: liste les clients pour le relai (verbeux)
|
||||
listrelay: liste les relais (nom et port)
|
||||
add: ajoute un relai pour un protocole + nom
|
||||
del: supprime un relai pour un protocole + nom
|
||||
protocole.nom: protocole et nom à relayer
|
||||
par exemple: irc.freenode
|
||||
port: port utilisé pour le relai
|
||||
|
||||
Sans paramètre, cette commande ouvre le tampon avec la liste des clients pour le relai.
|
||||
........................................
|
||||
|
|
|
@ -43,13 +43,8 @@
|
|||
** type: booléen
|
||||
** valeurs: on, off (valeur par défaut: on)
|
||||
|
||||
* *relay.network.enabled*
|
||||
** description: activer le relai
|
||||
** type: booléen
|
||||
** valeurs: on, off (valeur par défaut: off)
|
||||
|
||||
* *relay.network.listen_port_range*
|
||||
** description: restreint les fichiers/discussions sortants à utiliser des ports dans l'intervalle donné (pratique pour le NAT) (syntaxe: un port simple, par exemple 5000, un intervalle de ports, par exemple 5000-5015, si non renseigné tout port peut être utilisé, il est recommandé d'utiliser des ports supérieurs à 1024, car seul root peut utiliser les ports en dessous de 1024)
|
||||
** type: chaîne
|
||||
** valeurs: toute chaîne (valeur par défaut: "22373-22400")
|
||||
* *relay.network.max_clients*
|
||||
** description: nombre maximum de clients qui se connectent sur un port
|
||||
** type: entier
|
||||
** valeurs: 1 .. 1024 (valeur par défaut: 5)
|
||||
|
||||
|
|
|
@ -162,13 +162,19 @@
|
|||
./src/plugins/relay/relay-client.h
|
||||
./src/plugins/relay/relay-command.c
|
||||
./src/plugins/relay/relay-command.h
|
||||
./src/plugins/relay/relay-completion.c
|
||||
./src/plugins/relay/relay-completion.h
|
||||
./src/plugins/relay/relay-config.c
|
||||
./src/plugins/relay/relay-config.h
|
||||
./src/plugins/relay/relay.h
|
||||
./src/plugins/relay/relay-info.c
|
||||
./src/plugins/relay/relay-info.h
|
||||
./src/plugins/relay/relay-network.c
|
||||
./src/plugins/relay/relay-network.h
|
||||
./src/plugins/relay/relay-protocol-irc.c
|
||||
./src/plugins/relay/relay-protocol-irc.h
|
||||
./src/plugins/relay/relay-protocol-weechat.c
|
||||
./src/plugins/relay/relay-protocol-weechat.h
|
||||
./src/plugins/relay/relay-server.c
|
||||
./src/plugins/relay/relay-server.h
|
||||
./src/plugins/relay/relay-upgrade.c
|
||||
./src/plugins/relay/relay-upgrade.h
|
||||
./src/plugins/scripts/lua/weechat-lua-api.c
|
||||
|
|
177
po/cs.po
177
po/cs.po
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: 2009-09-14 10:56+0200\n"
|
||||
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -2587,7 +2587,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"ukázkový_signál: signál: %s, typ_dat: %s, data_signál: 0x%lx (neznámý typ)"
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
#, fuzzy
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr "vypsat nějaké zprávy do aktuálního bufferu"
|
||||
|
||||
msgid "[text]"
|
||||
|
@ -4980,12 +4981,15 @@ msgstr " [P] Pročistit ukončené"
|
|||
msgid " [Q] Close this buffer"
|
||||
msgstr " [Q] Zavřít tento buffer"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr "%s%s[%s%s%s%s] %s (spuštěn: %s)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgid "ended on: "
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr "%s%-26s obdrženo: %s, posláno: %s"
|
||||
|
||||
msgid "List of clients for relay"
|
||||
|
@ -5004,54 +5008,93 @@ msgid "disconnected"
|
|||
msgstr "odpojen"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s%s: chyba při zasílání dat na klienta %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgstr "%s: nový klient @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: not enough memory for new client"
|
||||
msgstr "%s%s: nedostatek paměti pro nového klienta"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr "%s%s: selhala autentizace s klientem @ %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr "%s: odpojen od klienta @ %s"
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr "Klienti pro přenos:"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
#, fuzzy, c-format
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
"%3d. %s, spuštěn v: %s, poslední aktivita: %s, bytů: %lu přijato, %lu "
|
||||
"odebráno"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr "%3d. %s, spuštěno v: %s"
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr "Žádný klient pro přesměrování"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Listening on ports:"
|
||||
msgstr "Seznam proxy:"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr "%3d. %s, spuštěno v: %s"
|
||||
|
||||
#, fuzzy
|
||||
msgid "No server for relay"
|
||||
msgstr "Žádný klient pro přesměrování"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr "%s%s: server \"%s\" nenalezen"
|
||||
|
||||
msgid "relay control"
|
||||
msgstr "ovládání přesměrování"
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
" list: vypíše klienty pro přesměrování\n"
|
||||
"listfull: vypíše klienty pro přesměrování(s detaily)\n"
|
||||
"\n"
|
||||
"Spuštění příkazu bez parametrů otevře buffer se seznamem přenosových klientů."
|
||||
|
||||
#, fuzzy
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr "spřáva ladění pro jádro/pluginy"
|
||||
|
||||
#, fuzzy
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr "spřáva ladění pro jádro/pluginy"
|
||||
|
||||
#, fuzzy
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr "spřáva ladění pro jádro/pluginy"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr "%sChyba: filtr \"%s\" již existuje"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr "%s%s: neznámá protokol xfer \"%s\""
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr "automaticky otevřít buffer přesměrování, když připojuje nový klient"
|
||||
|
@ -5080,42 +5123,40 @@ msgstr "barva textu pro status \"autentizace selhala\""
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr "barva textu pro status \"odpojen\""
|
||||
|
||||
msgid "enable relay"
|
||||
msgstr "přesměrování povoleno"
|
||||
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr ""
|
||||
"číslo portu (nebo rozsah portů), na kterých poslouchá plugin pro "
|
||||
"přesměrování (syntaxe: jeden port, např. 5000 nebo rozsah portů, např. 5000-"
|
||||
"5015, je doporučeno používat porty větší než 1024, protože porty pod 1024 "
|
||||
"může používat pouze root)"
|
||||
|
||||
msgid "list of relay clients"
|
||||
msgstr "seznam klientů přesměrování"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s%s: chyba při zasílání dat na klienta %s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr "%s%s: proxy \"%s\" nebyla nalezena pro server \"%s\", nelze se spojit"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr "%s: roura zavřena"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr "%s%s: nemohu akceptovat klienta"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgstr "%s%s: volba \"listen_port_range\" není definována"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr "%s%s: nemohu akceptovat klienta"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgstr "%s%s: nemůžu najít dostupný port pro poslouchání"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr "%s: poslouchám na portu %d"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr "%s%s: nedostatek paměti pro nový xfer"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%s%s: unable to register script \"%s\" (another script already exists with "
|
||||
|
@ -5713,6 +5754,44 @@ msgstr "%s%s: nemohu nastavit \"neblokovaci\" volbu na soket"
|
|||
msgid "%s%s: timeout for \"%s\" with %s"
|
||||
msgstr "%s%s: vypršel časový limit \"%s\" pro %s"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: bind error on port %d"
|
||||
#~ msgstr "%s: poslouchám na portu %d"
|
||||
|
||||
#~ msgid "%s: new client @ %s"
|
||||
#~ msgstr "%s: nový klient @ %s"
|
||||
|
||||
#~ msgid "enable relay"
|
||||
#~ msgstr "přesměrování povoleno"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
#~ "single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
#~ "use ports greater than 1024, because only root can use ports below 1024)"
|
||||
#~ msgstr ""
|
||||
#~ "číslo portu (nebo rozsah portů), na kterých poslouchá plugin pro "
|
||||
#~ "přesměrování (syntaxe: jeden port, např. 5000 nebo rozsah portů, např. "
|
||||
#~ "5000-5015, je doporučeno používat porty větší než 1024, protože porty pod "
|
||||
#~ "1024 může používat pouze root)"
|
||||
|
||||
#~ msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
#~ msgstr "%s%s: volba \"listen_port_range\" není definována"
|
||||
|
||||
#~ msgid "%s%s: cannot find available port for listening"
|
||||
#~ msgstr "%s%s: nemůžu najít dostupný port pro poslouchání"
|
||||
|
||||
#~ msgid ""
|
||||
#~ " list: list relay clients\n"
|
||||
#~ "listfull: list relay clients (verbose)\n"
|
||||
#~ "\n"
|
||||
#~ "Without argument, this command opens buffer with list of relay clients."
|
||||
#~ msgstr ""
|
||||
#~ " list: vypíše klienty pro přesměrování\n"
|
||||
#~ "listfull: vypíše klienty pro přesměrování(s detaily)\n"
|
||||
#~ "\n"
|
||||
#~ "Spuštění příkazu bez parametrů otevře buffer se seznamem přenosových "
|
||||
#~ "klientů."
|
||||
|
||||
#~ msgid ""
|
||||
#~ " channel: channel where user is\n"
|
||||
#~ "nickname: nickname to kick and ban\n"
|
||||
|
|
144
po/es.po
144
po/es.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: 2009-09-06 21:25+0200\n"
|
||||
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -2386,8 +2386,9 @@ msgid ""
|
|||
"demo_signal: signal: %s, type_data: %s, signal_data: 0x%lx (unknown type)"
|
||||
msgstr ""
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
msgstr ""
|
||||
#, fuzzy
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr "nombre de canal no encontrado para el búfer"
|
||||
|
||||
#, fuzzy
|
||||
msgid "[text]"
|
||||
|
@ -4805,11 +4806,14 @@ msgid " [Q] Close this buffer"
|
|||
msgstr " [Q] Cerrar la vista DCC"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr "%s%s%s está ausente: %s\n"
|
||||
|
||||
msgid "ended on: "
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr "DCC: fichero %s%s%s"
|
||||
|
||||
msgid "List of clients for relay"
|
||||
|
@ -4831,12 +4835,8 @@ msgstr "Falló"
|
|||
msgid "disconnected"
|
||||
msgstr "conectado"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s error enviando datos al servidor IRC\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
@ -4844,37 +4844,82 @@ msgid "%s%s: not enough memory for new client"
|
|||
msgstr "%s no hay memoria suficiente para un nuevo DCC\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr "No es posible escribir un fichero de log para un búfer\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr "¡Desconectado del servidor!\n"
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
msgstr ""
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr "%sCanal %s%s%s creado en %s"
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Listening on ports:"
|
||||
msgstr "Lista de proxies:"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr "%s%s%s está ausente: %s\n"
|
||||
|
||||
#, fuzzy
|
||||
msgid "No server for relay"
|
||||
msgstr "Ningún servidor"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr "%s%s: servidor \"%s\" no encontrado"
|
||||
|
||||
msgid "relay control"
|
||||
msgstr ""
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr "Lista de alias:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr "%sError: el filtro \"%s\" ya existe"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr "%s opción desconocida para el comando \"%s\"\n"
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4910,42 +4955,42 @@ msgstr "color para el estado dcc \"fallo\""
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr "color para el estado dcc \"conectando\""
|
||||
|
||||
msgid "enable relay"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgstr ""
|
||||
"restringe el dcc de salida a utilizar únicamente los puertos del rango "
|
||||
"especificado (útil para NAT) (sintaxis: un puerto simple, e.g. 5000, o un "
|
||||
"rango de puertos, e.g. 5000-5015, un valor vacío significa cualquier puerto)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "list of relay clients"
|
||||
msgstr "Lista de alias:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s error enviando datos al servidor IRC\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr ""
|
||||
"%s%s: proxy \"%s\" no encontrado para el servidor \"%s\", no es posible "
|
||||
"conectarse"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr "La tubería FIFO está cerrada\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr "%s no ha sido posible crear el socket\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr "%s no ha sido posible crear el socket\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgstr "%s no puede encontrar un puerto disponible para el DCC\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
msgstr ""
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr "%s no hay memoria suficiente para un nuevo DCC\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
@ -5571,6 +5616,25 @@ msgstr "%s no es posible crear el servidor\n"
|
|||
msgid "%s%s: timeout for \"%s\" with %s"
|
||||
msgstr "%s falta un argumento para la opción --dir\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: bind error on port %d"
|
||||
#~ msgstr "%s no ha sido posible crear el socket\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid ""
|
||||
#~ "port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
#~ "single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
#~ "use ports greater than 1024, because only root can use ports below 1024)"
|
||||
#~ msgstr ""
|
||||
#~ "restringe el dcc de salida a utilizar únicamente los puertos del rango "
|
||||
#~ "especificado (útil para NAT) (sintaxis: un puerto simple, e.g. 5000, o un "
|
||||
#~ "rango de puertos, e.g. 5000-5015, un valor vacío significa cualquier "
|
||||
#~ "puerto)"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: cannot find available port for listening"
|
||||
#~ msgstr "%s no puede encontrar un puerto disponible para el DCC\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ " channel: channel where user is\n"
|
||||
#~ "nickname: nickname to kick and ban\n"
|
||||
|
@ -6182,10 +6246,6 @@ msgstr "%s falta un argumento para la opción --dir\n"
|
|||
#~ msgid "%s%s: disconnecting client @ %s"
|
||||
#~ msgstr "%s: Reconexión al servidor en %d segundos\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: cannot bind socket"
|
||||
#~ msgstr "%s no ha sido posible crear el socket\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid " [Q] Close client list"
|
||||
#~ msgstr " [Q] Cerrar la vista DCC"
|
||||
|
|
182
po/fr.po
182
po/fr.po
|
@ -6,8 +6,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"PO-Revision-Date: 2009-10-19 11:27+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: 2009-10-29 12:44+0100\n"
|
||||
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -2655,7 +2655,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"demo_signal: signal: %s, type_data: %s, signal_data: 0x%lx (type inconnu)"
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr "affiche des messages sur le tampon courant"
|
||||
|
||||
msgid "[text]"
|
||||
|
@ -5088,12 +5088,15 @@ msgid " [Q] Close this buffer"
|
|||
msgstr " [Q] Fermer ce tampon"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
msgstr "%s%s[%s%s%s%s] %s (démarré le: %s)"
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr "%s%s[%s%s%s%s] %s (démarré le: %s%s%s%s)"
|
||||
|
||||
msgid "ended on: "
|
||||
msgstr "terminé le: "
|
||||
|
||||
#, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgstr "%s%-26s reçu: %s, envoyé: %s"
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr "%s%-26s protocole: %s, reçu: %s, envoyé: %s"
|
||||
|
||||
msgid "List of clients for relay"
|
||||
msgstr "Liste des clients pour le relai"
|
||||
|
@ -5111,56 +5114,100 @@ msgid "disconnected"
|
|||
msgstr "déconnecté"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s%s: erreur d'envoi de données au client %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgstr "%s: nouveau client @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr "%s: nouveau client de %s%s%s sur le port %d (relai: %s.%s)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: not enough memory for new client"
|
||||
msgstr "%s%s: pas assez de mémoire pour un nouveau client"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
msgstr "%s%s: l'authentification a échoué avec le client @ %s"
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr "%s%s: l'authentification a échoué avec le client %s%s%s (%s.%s)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
msgstr "%s: déconnecté du client @ %s"
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr "%s: déconnecté du client %s%s%s (%s.%s)"
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr "Clients pour le relai:"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
"%3d. %s, démarré le: %s, dernière activité: %s, octets: %lu reçus, %lu "
|
||||
"envoyés"
|
||||
"%3d. %s%s%s (%s%s%s), démarré le: %s, dernière activité: %s, octets: %lu "
|
||||
"reçus, %lu envoyés"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
msgstr "%3d. %s, démarré le: %s"
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr "%3d. %s%s%s, démarré le: %s"
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr "Pas de client pour le relai"
|
||||
|
||||
msgid "Listening on ports:"
|
||||
msgstr "Ecoute sur les ports:"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr "%3d. port %s%d%s, relai: %s%s.%s%s, démarré le: %s"
|
||||
|
||||
msgid "No server for relay"
|
||||
msgstr "Pas de serveur pour le relai"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr "%s%s: relai \"%s\" non trouvé"
|
||||
|
||||
msgid "relay control"
|
||||
msgstr "contrôle du relai"
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr "[list | listfull | add protocole.nom port | del protocole.nom]"
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
" list: liste les clients pour le relai\n"
|
||||
"listfull: liste les clients pour le relai (verbeux)\n"
|
||||
" list: liste les clients pour le relai\n"
|
||||
" listfull: liste les clients pour le relai (verbeux)\n"
|
||||
" listrelay: liste les relais (nom et port)\n"
|
||||
" add: ajoute un relai pour un protocole + nom\n"
|
||||
" del: supprime un relai pour un protocole + nom\n"
|
||||
"protocole.nom: protocole et nom à relayer\n"
|
||||
" par exemple: irc.freenode\n"
|
||||
" port: port utilisé pour le relai\n"
|
||||
"\n"
|
||||
"Sans paramètre, cette commande ouvre le tampon avec la liste des clients "
|
||||
"pour le relai."
|
||||
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr "tous les protocole.nom possible pour l'extension relay"
|
||||
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr "protocole.nom des relais courants pour l'extension relay"
|
||||
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr "premier port libre pour l'extension relay"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr "%s%s: erreur: le port \"%d\" est déjà utilisé"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr "%s%s: erreur: protocole \"%s\" inconnu"
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr ""
|
||||
"ouvrir automatiquement le tampon des clients pour le relai lorsqu'un nouveau "
|
||||
|
@ -5190,43 +5237,39 @@ msgstr "couleur du texte pour le statut \"échec auth\""
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr "couleur du texte pour le statut \"déconnecté\""
|
||||
|
||||
msgid "enable relay"
|
||||
msgstr "activer le relai"
|
||||
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgstr ""
|
||||
"restreint les fichiers/discussions sortants à utiliser des ports dans "
|
||||
"l'intervalle donné (pratique pour le NAT) (syntaxe: un port simple, par "
|
||||
"exemple 5000, un intervalle de ports, par exemple 5000-5015, si non "
|
||||
"renseigné tout port peut être utilisé, il est recommandé d'utiliser des "
|
||||
"ports supérieurs à 1024, car seul root peut utiliser les ports en dessous de "
|
||||
"1024)"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr "nombre maximum de clients qui se connectent sur un port"
|
||||
|
||||
msgid "list of relay clients"
|
||||
msgstr "liste des clients pour le relai"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgstr "%s: socket fermée"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s%s: erreur d'envoi de données au client %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
msgstr "%s%s: impossible d'accepter le client"
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr "%s%s: tampon non trouvé pour le serveur IRC \"%s\", canal \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgstr "%s%s: l'option \"listen_port_range\" n'est pas définie"
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr "%s: socket fermée pour %s.%s (port %d)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgstr "%s%s: impossible de trouver un port disponible pour écouter"
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr "%s%s: impossible d'accepter le client sur le port %d (%s.%s)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
msgstr "%s: écoute sur le port %d"
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr "%s%s: erreur avec le \"bind\" sur le port %d (%s.%s)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr "%s: écoute sur le port %d (relai: %s.%s, max %d clients)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr "%s%s: pas assez de mémoire pour écouter sur le nouveau port"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
@ -5838,6 +5881,45 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket"
|
|||
msgid "%s%s: timeout for \"%s\" with %s"
|
||||
msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s"
|
||||
|
||||
#~ msgid "%s%s: bind error on port %d"
|
||||
#~ msgstr "%s%s: erreur de bind sur le port %d (%s.%s)"
|
||||
|
||||
#~ msgid "%s: new client @ %s"
|
||||
#~ msgstr "%s: nouveau client @ %s"
|
||||
|
||||
#~ msgid "enable relay"
|
||||
#~ msgstr "activer le relai"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
#~ "single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
#~ "use ports greater than 1024, because only root can use ports below 1024)"
|
||||
#~ msgstr ""
|
||||
#~ "restreint les fichiers/discussions sortants à utiliser des ports dans "
|
||||
#~ "l'intervalle donné (pratique pour le NAT) (syntaxe: un port simple, par "
|
||||
#~ "exemple 5000, un intervalle de ports, par exemple 5000-5015, si non "
|
||||
#~ "renseigné tout port peut être utilisé, il est recommandé d'utiliser des "
|
||||
#~ "ports supérieurs à 1024, car seul root peut utiliser les ports en dessous "
|
||||
#~ "de 1024)"
|
||||
|
||||
#~ msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
#~ msgstr "%s%s: l'option \"listen_port_range\" n'est pas définie"
|
||||
|
||||
#~ msgid "%s%s: cannot find available port for listening"
|
||||
#~ msgstr "%s%s: impossible de trouver un port disponible pour écouter"
|
||||
|
||||
#~ msgid ""
|
||||
#~ " list: list relay clients\n"
|
||||
#~ "listfull: list relay clients (verbose)\n"
|
||||
#~ "\n"
|
||||
#~ "Without argument, this command opens buffer with list of relay clients."
|
||||
#~ msgstr ""
|
||||
#~ " list: liste les clients pour le relai\n"
|
||||
#~ "listfull: liste les clients pour le relai (verbeux)\n"
|
||||
#~ "\n"
|
||||
#~ "Sans paramètre, cette commande ouvre le tampon avec la liste des clients "
|
||||
#~ "pour le relai."
|
||||
|
||||
#~ msgid ""
|
||||
#~ " channel: channel where user is\n"
|
||||
#~ "nickname: nickname to kick and ban\n"
|
||||
|
|
141
po/hu.po
141
po/hu.po
|
@ -12,7 +12,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: 2009-09-20 13:51+0200\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -2511,8 +2511,9 @@ msgid ""
|
|||
"demo_signal: signal: %s, type_data: %s, signal_data: 0x%lx (unknown type)"
|
||||
msgstr ""
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
msgstr ""
|
||||
#, fuzzy
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr "szobanév nem található a pufferhez"
|
||||
|
||||
#, fuzzy
|
||||
msgid "[text]"
|
||||
|
@ -4907,11 +4908,14 @@ msgid " [Q] Close this buffer"
|
|||
msgstr " [Q] DCC nézet bezárása"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr "%s%s%s távol: %s\n"
|
||||
|
||||
msgid "ended on: "
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr "DCC: fájl %s%s%s"
|
||||
|
||||
msgid "List of clients for relay"
|
||||
|
@ -4933,12 +4937,8 @@ msgstr "Sikertelen"
|
|||
msgid "disconnected"
|
||||
msgstr "csatlakozva"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s adatküldési hiba az IRC szerveren\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
@ -4946,37 +4946,82 @@ msgid "%s%s: not enough memory for new client"
|
|||
msgstr "%s nincs elegendő memória új DCC számára\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr "Lekapcsolódott a szerverről!\n"
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
msgstr ""
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr "Szoba létrehozva: %s"
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Listening on ports:"
|
||||
msgstr "Aliaszok listája:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr "%s%s%s távol: %s\n"
|
||||
|
||||
#, fuzzy
|
||||
msgid "No server for relay"
|
||||
msgstr "Nincs szerver.\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr "%s a \"%s\" szerver nem található\n"
|
||||
|
||||
msgid "relay control"
|
||||
msgstr ""
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr "Aliaszok listája:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr "%s az ignore már létezik\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr "%s ismeretlen billentyűparancs \"%s\"\n"
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr ""
|
||||
|
||||
|
@ -5012,42 +5057,40 @@ msgstr "\"failed\" dcc státusz színe"
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr "\"connecting\" dcc státusz színe"
|
||||
|
||||
msgid "enable relay"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgstr ""
|
||||
"korlátozza a dcc-t, hogy csak egy bizonyos tartományban lévő portokat "
|
||||
"használja (NAT esetén hasznos) (szintaxis: egyetlen port, pl. 5000 vagy egy "
|
||||
"port intervallum, pl. 5000-5015, üresen hagyva tetszőleges port)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "list of relay clients"
|
||||
msgstr "Aliaszok listája:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s adatküldési hiba az IRC szerveren\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr "%s név \"%s\" nem található a \"%s\" parancshoz\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr "FIFO cső bezárva\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr "%s nem sikerült a csatornát létrehozni\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr "%s nem sikerült a csatornát létrehozni\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgstr "%s nem sikerült elérhető portot találni a DCC-hez\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
msgstr ""
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr "%s nincs elegendő memória új DCC számára\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
@ -5657,6 +5700,24 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n"
|
|||
msgid "%s%s: timeout for \"%s\" with %s"
|
||||
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: bind error on port %d"
|
||||
#~ msgstr "%s nem sikerült a csatornát létrehozni\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid ""
|
||||
#~ "port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
#~ "single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
#~ "use ports greater than 1024, because only root can use ports below 1024)"
|
||||
#~ msgstr ""
|
||||
#~ "korlátozza a dcc-t, hogy csak egy bizonyos tartományban lévő portokat "
|
||||
#~ "használja (NAT esetén hasznos) (szintaxis: egyetlen port, pl. 5000 vagy "
|
||||
#~ "egy port intervallum, pl. 5000-5015, üresen hagyva tetszőleges port)"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: cannot find available port for listening"
|
||||
#~ msgstr "%s nem sikerült elérhető portot találni a DCC-hez\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ " channel: channel where user is\n"
|
||||
#~ "nickname: nickname to kick and ban\n"
|
||||
|
@ -6315,10 +6376,6 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
|
|||
#~ msgid "%s%s: disconnecting client @ %s"
|
||||
#~ msgstr "%s: Újracsatlakozás a szerverhez %d másodperc múlva\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: cannot bind socket"
|
||||
#~ msgstr "%s nem sikerült a csatornát létrehozni\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid " [Q] Close client list"
|
||||
#~ msgstr " [Q] DCC nézet bezárása"
|
||||
|
|
177
po/pl.po
177
po/pl.po
|
@ -9,7 +9,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: 2009-09-06 21:25+0200\n"
|
||||
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
|
||||
"Language-Team: Polish\n"
|
||||
|
@ -2621,7 +2621,8 @@ msgstr ""
|
|||
"testowy_sygnał: sygnał: %s, typ_danych: %s, dane_sygnału: 0x%lx (nieznany "
|
||||
"typ)"
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
#, fuzzy
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr "wyświetl troche wiadomości w obecnym buforze"
|
||||
|
||||
msgid "[text]"
|
||||
|
@ -5038,12 +5039,15 @@ msgstr " [P] Wyczyść skończone"
|
|||
msgid " [Q] Close this buffer"
|
||||
msgstr " [Q] Zamknij ten bufor"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr "%s%s[%s%s%s%s] %s (rozpoczęto: %s)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgid "ended on: "
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr "%s%-26s odebrano: %s, wysłano: %s"
|
||||
|
||||
msgid "List of clients for relay"
|
||||
|
@ -5062,54 +5066,93 @@ msgid "disconnected"
|
|||
msgstr "rozłączono"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s%s: błąd podczas wysyłania danych do klienta %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgstr "%s: nowy klient @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: not enough memory for new client"
|
||||
msgstr "%s%s:za mało pamięci dla nowego klienta"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr "%s%s: zutoryzacja z klientem nie powiodła się @ %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr "%s: rozłączono od klienta @ %s"
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr "Klienci do przekazania:"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
#, fuzzy, c-format
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
"%3d. %s, rozpoczęto: %s, ostatnia aktywność: %s, bajtów: %lu otrzymano, %lu "
|
||||
"wysłano"
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr "%3d. %s, rozpoczęto: %s"
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr "Brak klientów do przesłania"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Listening on ports:"
|
||||
msgstr "Lista proxy:"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr "%3d. %s, rozpoczęto: %s"
|
||||
|
||||
#, fuzzy
|
||||
msgid "No server for relay"
|
||||
msgstr "Brak klientów do przesłania"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr "%s%s: serwer \"%s\" nie został znaleziony"
|
||||
|
||||
msgid "relay control"
|
||||
msgstr "zarządzanie przesyłaniem"
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
" list: lista klientów do przekazania\n"
|
||||
"listfull: lista klientów do przekazania (szczegułowa)\n"
|
||||
"\n"
|
||||
"Bez argumentów komenda otworzy bufor z lista zdalnych klientów."
|
||||
|
||||
#, fuzzy
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr "kontrola debugu dla rdzenia/wtyczek"
|
||||
|
||||
#, fuzzy
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr "kontrola debugu dla rdzenia/wtyczek"
|
||||
|
||||
#, fuzzy
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr "kontrola debugu dla rdzenia/wtyczek"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr "%sBłąd: filtr \"%s\" już istnieje"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr "%s%s: nieznany protokół xfer \"%s\""
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr "automatycznie otwiera bufor kiedy podłącza się nowy klient"
|
||||
|
@ -5138,42 +5181,41 @@ msgstr "kolor statusu \"authentication failed\""
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr "kolor statusu \"disconnected\" "
|
||||
|
||||
msgid "enable relay"
|
||||
msgstr "włącz przekazywanie"
|
||||
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr ""
|
||||
"numer portu (albo przedział), na którym nasłuchuje wtyczka relay (składnia: "
|
||||
"pojedynczy port, np. 5000 lub przedział portó, np. 5000-5015, zaleca się "
|
||||
"stosowanie portów powyżej 1024, ponieważ tylko root może używać portów "
|
||||
"poniżej 1024)"
|
||||
|
||||
msgid "list of relay clients"
|
||||
msgstr "lista zdalnych klientów"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s%s: błąd podczas wysyłania danych do klienta %s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr ""
|
||||
"%s%s: nie znaleziono proxy \"%s\" dla serwer \"%s\", nie można połączyć"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr "%s: gniazdo zamknięte"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr "%s%s: nie można zaakceptować klienta"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgstr "%s%s: nie zdefiniowana opcja \"listen_port_range\" "
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr "%s%s: nie można zaakceptować klienta"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgstr "%s%s: nie można znaleźc dostępnego portu do nasłuchu"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr "%s: nasłuchuję na porcie %d"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr "%s%s: za mało pamięci na nowy xfer"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%s%s: unable to register script \"%s\" (another script already exists with "
|
||||
|
@ -5769,6 +5811,43 @@ msgstr "%s%s: nie można ustawić opcji \"nonblock\" dla gniazda"
|
|||
msgid "%s%s: timeout for \"%s\" with %s"
|
||||
msgstr "%s%s: przekroczono czas na \"%s\" z %s"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: bind error on port %d"
|
||||
#~ msgstr "%s: nasłuchuję na porcie %d"
|
||||
|
||||
#~ msgid "%s: new client @ %s"
|
||||
#~ msgstr "%s: nowy klient @ %s"
|
||||
|
||||
#~ msgid "enable relay"
|
||||
#~ msgstr "włącz przekazywanie"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
#~ "single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
#~ "use ports greater than 1024, because only root can use ports below 1024)"
|
||||
#~ msgstr ""
|
||||
#~ "numer portu (albo przedział), na którym nasłuchuje wtyczka relay "
|
||||
#~ "(składnia: pojedynczy port, np. 5000 lub przedział portó, np. 5000-5015, "
|
||||
#~ "zaleca się stosowanie portów powyżej 1024, ponieważ tylko root może "
|
||||
#~ "używać portów poniżej 1024)"
|
||||
|
||||
#~ msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
#~ msgstr "%s%s: nie zdefiniowana opcja \"listen_port_range\" "
|
||||
|
||||
#~ msgid "%s%s: cannot find available port for listening"
|
||||
#~ msgstr "%s%s: nie można znaleźc dostępnego portu do nasłuchu"
|
||||
|
||||
#~ msgid ""
|
||||
#~ " list: list relay clients\n"
|
||||
#~ "listfull: list relay clients (verbose)\n"
|
||||
#~ "\n"
|
||||
#~ "Without argument, this command opens buffer with list of relay clients."
|
||||
#~ msgstr ""
|
||||
#~ " list: lista klientów do przekazania\n"
|
||||
#~ "listfull: lista klientów do przekazania (szczegułowa)\n"
|
||||
#~ "\n"
|
||||
#~ "Bez argumentów komenda otworzy bufor z lista zdalnych klientów."
|
||||
|
||||
#~ msgid ""
|
||||
#~ " channel: channel where user is\n"
|
||||
#~ "nickname: nickname to kick and ban\n"
|
||||
|
|
141
po/ru.po
141
po/ru.po
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: 2009-09-20 13:50+0200\n"
|
||||
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -2523,8 +2523,9 @@ msgid ""
|
|||
"demo_signal: signal: %s, type_data: %s, signal_data: 0x%lx (unknown type)"
|
||||
msgstr ""
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
msgstr ""
|
||||
#, fuzzy
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr "не найдено имя канала для буфера"
|
||||
|
||||
#, fuzzy
|
||||
msgid "[text]"
|
||||
|
@ -4909,11 +4910,14 @@ msgid " [Q] Close this buffer"
|
|||
msgstr " [Q] Закрыть окно"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr "%s%s%s отсутствует: %s\n"
|
||||
|
||||
msgid "ended on: "
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr "DCC: файл %s%s%s"
|
||||
|
||||
msgid "List of clients for relay"
|
||||
|
@ -4935,12 +4939,8 @@ msgstr "Неудача"
|
|||
msgid "disconnected"
|
||||
msgstr "подключен"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s ошибка при отправке данных IRC серверу\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
@ -4948,37 +4948,82 @@ msgid "%s%s: not enough memory for new client"
|
|||
msgstr "%s недостаточно памяти для нового DCC\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr "Не могу записать лог-файл \"%s\"\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr "Отключен от сервера!\n"
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
msgstr ""
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr "Канал создан %s"
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Listening on ports:"
|
||||
msgstr "Список сокращений:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr "%s%s%s отсутствует: %s\n"
|
||||
|
||||
#, fuzzy
|
||||
msgid "No server for relay"
|
||||
msgstr "Нет сервера.\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr "%s сервер \"%s\" не найден\n"
|
||||
|
||||
msgid "relay control"
|
||||
msgstr ""
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr "Список сокращений:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr "%s игнорирование уже существует\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr "%s неизвестная функция клавиши \"%s\"\n"
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr ""
|
||||
|
||||
|
@ -5014,42 +5059,40 @@ msgstr "цвет \"неудачных\" в окне DCC"
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr "цвет \"соединения\" в окне DCC"
|
||||
|
||||
msgid "enable relay"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgstr ""
|
||||
"привязывает исходящие DCС соединения к определённому интервалу портов "
|
||||
"(полезно для NAT) (синтаксис: определённый порт, например 5000, или интервал "
|
||||
"портов, например 5000-5015, пустое значение означает любой порт)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "list of relay clients"
|
||||
msgstr "Список сокращений:\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr "%s ошибка при отправке данных IRC серверу\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr "%s ник \"%s\" не найден для команды \"%s\"\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr "FIFO pipe закрыт\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr "%s невозможно создать сокет\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr "%s невозможно создать сокет\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgstr "%s не могу найти свободный порт для DCC\n"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
msgstr ""
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr "%s недостаточно памяти для нового DCC\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
@ -5654,6 +5697,24 @@ msgstr "%s DCC: не могу установить неблокирующий р
|
|||
msgid "%s%s: timeout for \"%s\" with %s"
|
||||
msgstr "%s нет аргумента для параметра \"%s\"\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: bind error on port %d"
|
||||
#~ msgstr "%s невозможно создать сокет\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid ""
|
||||
#~ "port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
#~ "single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
#~ "use ports greater than 1024, because only root can use ports below 1024)"
|
||||
#~ msgstr ""
|
||||
#~ "привязывает исходящие DCС соединения к определённому интервалу портов "
|
||||
#~ "(полезно для NAT) (синтаксис: определённый порт, например 5000, или "
|
||||
#~ "интервал портов, например 5000-5015, пустое значение означает любой порт)"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: cannot find available port for listening"
|
||||
#~ msgstr "%s не могу найти свободный порт для DCC\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ " channel: channel where user is\n"
|
||||
#~ "nickname: nickname to kick and ban\n"
|
||||
|
@ -6303,10 +6364,6 @@ msgstr "%s нет аргумента для параметра \"%s\"\n"
|
|||
#~ msgid "%s%s: disconnecting client @ %s"
|
||||
#~ msgstr "%s: Повторное подключение к серверу через %d секунд\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "%s%s: cannot bind socket"
|
||||
#~ msgstr "%s невозможно создать сокет\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid " [Q] Close client list"
|
||||
#~ msgstr " [Q] Закрыть окно"
|
||||
|
|
|
@ -163,13 +163,19 @@ SET(WEECHAT_SOURCES
|
|||
./src/plugins/relay/relay-client.h
|
||||
./src/plugins/relay/relay-command.c
|
||||
./src/plugins/relay/relay-command.h
|
||||
./src/plugins/relay/relay-completion.c
|
||||
./src/plugins/relay/relay-completion.h
|
||||
./src/plugins/relay/relay-config.c
|
||||
./src/plugins/relay/relay-config.h
|
||||
./src/plugins/relay/relay.h
|
||||
./src/plugins/relay/relay-info.c
|
||||
./src/plugins/relay/relay-info.h
|
||||
./src/plugins/relay/relay-network.c
|
||||
./src/plugins/relay/relay-network.h
|
||||
./src/plugins/relay/relay-protocol-irc.c
|
||||
./src/plugins/relay/relay-protocol-irc.h
|
||||
./src/plugins/relay/relay-protocol-weechat.c
|
||||
./src/plugins/relay/relay-protocol-weechat.h
|
||||
./src/plugins/relay/relay-server.c
|
||||
./src/plugins/relay/relay-server.h
|
||||
./src/plugins/relay/relay-upgrade.c
|
||||
./src/plugins/relay/relay-upgrade.h
|
||||
./src/plugins/scripts/lua/weechat-lua-api.c
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2009-10-19 11:26+0200\n"
|
||||
"POT-Creation-Date: 2009-10-29 12:43+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -2164,7 +2164,7 @@ msgid ""
|
|||
"demo_signal: signal: %s, type_data: %s, signal_data: 0x%lx (unknown type)"
|
||||
msgstr ""
|
||||
|
||||
msgid "print some messages on current ubffer"
|
||||
msgid "print some messages on current buffer"
|
||||
msgstr ""
|
||||
|
||||
msgid "[text]"
|
||||
|
@ -4231,11 +4231,14 @@ msgid " [Q] Close this buffer"
|
|||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s)"
|
||||
msgid "%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"
|
||||
msgstr ""
|
||||
|
||||
msgid "ended on: "
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%-26s received: %s, sent: %s"
|
||||
msgid "%s%-26s protocol: %s, received: %s, sent: %s"
|
||||
msgstr ""
|
||||
|
||||
msgid "List of clients for relay"
|
||||
|
@ -4254,11 +4257,7 @@ msgid "disconnected"
|
|||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: new client @ %s"
|
||||
msgid "%s: new client from %s%s%s on port %d (relaying: %s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
|
@ -4266,37 +4265,79 @@ msgid "%s%s: not enough memory for new client"
|
|||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: authentication failed with client @ %s"
|
||||
msgid "%s%s: authentication failed with client %s%s%s (%s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: disconnected from client @ %s"
|
||||
msgid "%s: disconnected from client %s%s%s (%s.%s)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Clients for relay:"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent"
|
||||
msgid ""
|
||||
"%3d. %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %"
|
||||
"lu sent"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. %s, started on: %s"
|
||||
msgid "%3d. %s%s%s, started on: %s"
|
||||
msgstr ""
|
||||
|
||||
msgid "No client for relay"
|
||||
msgstr ""
|
||||
|
||||
msgid "Listening on ports:"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"
|
||||
msgstr ""
|
||||
|
||||
msgid "No server for relay"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: relay \"%s\" not found"
|
||||
msgstr ""
|
||||
|
||||
msgid "relay control"
|
||||
msgstr ""
|
||||
|
||||
msgid "[list | listfull | add protocol.name port | del protocol.name]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n"
|
||||
" list: list relay clients (only active relays)\n"
|
||||
" listfull: list relay clients (verbose, all relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n"
|
||||
"\n"
|
||||
"Without argument, this command opens buffer with list of relay clients."
|
||||
msgstr ""
|
||||
|
||||
msgid "all possible protocol.name for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
msgid "protocol.name of current relays for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
msgid "first free port for relay plugin"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error: port \"%d\" is already used"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: error: unknown protocol \"%s\""
|
||||
msgstr ""
|
||||
|
||||
msgid "auto open relay buffer when a new client is connecting"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4324,36 +4365,38 @@ msgstr ""
|
|||
msgid "text color for \"disconnected\" status"
|
||||
msgstr ""
|
||||
|
||||
msgid "enable relay"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"port number (or range of ports) that relay plugin listens on (syntax: a "
|
||||
"single port, ie. 5000 or a port range, ie. 5000-5015, it's recommended to "
|
||||
"use ports greater than 1024, because only root can use ports below 1024)"
|
||||
msgid "maximum number of clients connecting to a port"
|
||||
msgstr ""
|
||||
|
||||
msgid "list of relay clients"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: socket closed"
|
||||
msgid "%s%s: error sending data to client %s"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot accept client"
|
||||
msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: option \"listen_port_range\" is not defined"
|
||||
msgid "%s: socket closed for %s.%s (port %d)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: cannot find available port for listening"
|
||||
msgid "%s%s: cannot accept client on port %d (%s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d"
|
||||
msgid "%s%s: error with \"bind\" on port %d (%s.%s)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: listening on port %d (relay: %s.%s, max %d clients)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: not enough memory for listening on new port"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
|
|
|
@ -388,7 +388,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
|||
weechat_plugin = plugin;
|
||||
|
||||
weechat_hook_command ("demo_printf",
|
||||
N_("print some messages on current ubffer"),
|
||||
N_("print some messages on current buffer"),
|
||||
N_("[text]"),
|
||||
N_("text: write this text"),
|
||||
"",
|
||||
|
|
|
@ -19,9 +19,12 @@ relay.c relay.h
|
|||
relay-buffer.c relay-buffer.h
|
||||
relay-client.c relay-client.h
|
||||
relay-command.c relay-command.h
|
||||
relay-completion.c relay-completion.h
|
||||
relay-config.c relay-config.h
|
||||
relay-info.c relay-info.h
|
||||
relay-network.c relay-network.h
|
||||
relay-protocol-irc.c relay-protocol-irc.h
|
||||
relay-protocol-weechat.c relay-protocol-weechat.h
|
||||
relay-server.c relay-server.h
|
||||
relay-upgrade.c relay-upgrade.h)
|
||||
SET_TARGET_PROPERTIES(relay PROPERTIES PREFIX "")
|
||||
|
||||
|
|
|
@ -28,12 +28,18 @@ relay_la_SOURCES = relay.c \
|
|||
relay-client.h \
|
||||
relay-command.c \
|
||||
relay-command.h \
|
||||
relay-completion.c \
|
||||
relay-completion.h \
|
||||
relay-config.c \
|
||||
relay-config.h \
|
||||
relay-info.c \
|
||||
relay-info.h \
|
||||
relay-network.c \
|
||||
relay-network.h \
|
||||
relay-protocol-irc.c \
|
||||
relay-protocol-irc.h \
|
||||
relay-protocol-weechat.c \
|
||||
relay-protocol-weechat.h \
|
||||
relay-server.c \
|
||||
relay-server.h \
|
||||
relay-upgrade.c \
|
||||
relay-upgrade.h
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void
|
|||
relay_buffer_refresh (const char *hotlist)
|
||||
{
|
||||
struct t_relay_client *ptr_client, *client_selected;
|
||||
char str_color[256], status[64], date_start[128];
|
||||
char str_color[256], status[64], date_start[128], date_end[128];
|
||||
char *str_recv, *str_sent;
|
||||
int i, length, line;
|
||||
struct tm *date_tmp;
|
||||
|
@ -95,10 +95,17 @@ relay_buffer_refresh (const char *hotlist)
|
|||
date_tmp = localtime (&(ptr_client->start_time));
|
||||
strftime (date_start, sizeof (date_start),
|
||||
"%a, %d %b %Y %H:%M:%S", date_tmp);
|
||||
date_end[0] = '\0';
|
||||
if (ptr_client->end_time > 0)
|
||||
{
|
||||
date_tmp = localtime (&(ptr_client->end_time));
|
||||
strftime (date_end, sizeof (date_end),
|
||||
"%a, %d %b %Y %H:%M:%S", date_tmp);
|
||||
}
|
||||
|
||||
/* first line with status and start time */
|
||||
weechat_printf_y (relay_buffer, (line * 2) + 2,
|
||||
_("%s%s[%s%s%s%s] %s (started on: %s)"),
|
||||
_("%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"),
|
||||
weechat_color(str_color),
|
||||
(line == relay_buffer_selected_line) ?
|
||||
"*** " : " ",
|
||||
|
@ -107,15 +114,19 @@ relay_buffer_refresh (const char *hotlist)
|
|||
weechat_color ("reset"),
|
||||
weechat_color (str_color),
|
||||
ptr_client->address,
|
||||
date_start);
|
||||
date_start,
|
||||
(ptr_client->end_time > 0) ? ", " : "",
|
||||
(ptr_client->end_time > 0) ? _("ended on: ") : "",
|
||||
(ptr_client->end_time > 0) ? date_end : "");
|
||||
|
||||
/* second line with bytes recv/sent */
|
||||
/* second line with protocol and bytes recv/sent */
|
||||
str_recv = weechat_string_format_size (ptr_client->bytes_recv);
|
||||
str_sent = weechat_string_format_size (ptr_client->bytes_sent);
|
||||
weechat_printf_y (relay_buffer, (line * 2) + 3,
|
||||
_("%s%-26s received: %s, sent: %s"),
|
||||
_("%s%-26s protocol: %s, received: %s, sent: %s"),
|
||||
weechat_color(str_color),
|
||||
" ",
|
||||
relay_protocol_string[ptr_client->protocol],
|
||||
(str_recv) ? str_recv : "?",
|
||||
(str_sent) ? str_sent : "?");
|
||||
if (str_recv)
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
#include "relay-client.h"
|
||||
#include "relay-config.h"
|
||||
#include "relay-buffer.h"
|
||||
#include "relay-protocol-irc.h"
|
||||
#include "relay-protocol-weechat.h"
|
||||
#include "relay-server.h"
|
||||
|
||||
|
||||
char *relay_client_status_string[] = /* strings for status */
|
||||
|
@ -94,110 +97,6 @@ relay_client_search_by_number (int number)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_client_sendf: send formatted data to client
|
||||
*/
|
||||
|
||||
int
|
||||
relay_client_sendf (struct t_relay_client *client, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[4096];
|
||||
char str_length[8];
|
||||
int length, num_sent;
|
||||
|
||||
if (!client)
|
||||
return 0;
|
||||
|
||||
va_start (args, format);
|
||||
vsnprintf (buffer + 7, sizeof (buffer) - 7 - 1, format, args);
|
||||
va_end (args);
|
||||
|
||||
length = strlen (buffer + 7);
|
||||
snprintf (str_length, sizeof (str_length), "%07d", length);
|
||||
memcpy (buffer, str_length, 7);
|
||||
|
||||
num_sent = send (client->sock, buffer, length + 7, 0);
|
||||
|
||||
client->bytes_sent += length + 7;
|
||||
|
||||
if (num_sent < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: error sending data to client %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
strerror (errno));
|
||||
}
|
||||
|
||||
return num_sent;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_client_send_infolist: send infolist to client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_client_send_infolist (struct t_relay_client *client,
|
||||
const char *name,
|
||||
struct t_infolist *infolist)
|
||||
{
|
||||
const char *fields;
|
||||
char **argv;
|
||||
int i, argc, size;
|
||||
|
||||
relay_client_sendf (client, "name %s", name);
|
||||
|
||||
while (weechat_infolist_next (infolist))
|
||||
{
|
||||
fields = weechat_infolist_fields (infolist);
|
||||
if (fields)
|
||||
{
|
||||
argv = weechat_string_split (fields, ",", 0, 0, &argc);
|
||||
if (argv && (argc > 0))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
switch (argv[i][0])
|
||||
{
|
||||
case 'i':
|
||||
relay_client_sendf (client, "%s %c %d",
|
||||
argv[i] + 2, argv[i][0],
|
||||
weechat_infolist_integer (infolist,
|
||||
argv[i] + 2));
|
||||
break;
|
||||
case 's':
|
||||
relay_client_sendf (client, "%s %c %s",
|
||||
argv[i] + 2, argv[i][0],
|
||||
weechat_infolist_string (infolist,
|
||||
argv[i] + 2));
|
||||
break;
|
||||
case 'p':
|
||||
relay_client_sendf (client, "%s %c %lx",
|
||||
argv[i] + 2, argv[i][0],
|
||||
(long unsigned int)weechat_infolist_pointer (infolist,
|
||||
argv[i] + 2));
|
||||
break;
|
||||
case 'b':
|
||||
relay_client_sendf (client, "%s %c %lx",
|
||||
argv[i] + 2, argv[i][0],
|
||||
(long unsigned int)weechat_infolist_buffer (infolist,
|
||||
argv[i] + 2,
|
||||
&size));
|
||||
break;
|
||||
case 't':
|
||||
relay_client_sendf (client, "%s %c %ld",
|
||||
argv[i] + 2, argv[i][0],
|
||||
weechat_infolist_time (infolist, argv[i] + 2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_client_recv_cb: read data from a client
|
||||
*/
|
||||
|
@ -207,7 +106,6 @@ relay_client_recv_cb (void *arg_client, int fd)
|
|||
{
|
||||
struct t_relay_client *client;
|
||||
static char buffer[4096 + 2];
|
||||
struct t_infolist *infolist;
|
||||
int num_read;
|
||||
|
||||
/* make C compiler happy */
|
||||
|
@ -220,25 +118,16 @@ relay_client_recv_cb (void *arg_client, int fd)
|
|||
{
|
||||
client->bytes_recv += num_read;
|
||||
buffer[num_read] = '\0';
|
||||
if (buffer[num_read - 1] == '\n')
|
||||
buffer[--num_read] = '\0';
|
||||
if (buffer[num_read - 1] == '\r')
|
||||
buffer[--num_read] = '\0';
|
||||
if (weechat_relay_plugin->debug)
|
||||
switch (client->protocol)
|
||||
{
|
||||
weechat_printf (NULL, "%s: data received from %s: \"%s\"",
|
||||
RELAY_PLUGIN_NAME, client->address, buffer);
|
||||
}
|
||||
if (weechat_strcasecmp (buffer, "quit") == 0)
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
else
|
||||
{
|
||||
infolist = weechat_infolist_get (buffer, NULL, NULL);
|
||||
if (infolist)
|
||||
{
|
||||
relay_client_send_infolist (client, buffer, infolist);
|
||||
weechat_infolist_free (infolist);
|
||||
}
|
||||
case RELAY_PROTOCOL_WEECHAT:
|
||||
relay_protocol_weechat_recv (client, buffer);
|
||||
break;
|
||||
case RELAY_PROTOCOL_IRC:
|
||||
relay_protocol_irc_recv (client, buffer);
|
||||
break;
|
||||
case RELAY_NUM_PROTOCOLS:
|
||||
break;
|
||||
}
|
||||
relay_buffer_refresh (NULL);
|
||||
}
|
||||
|
@ -255,7 +144,7 @@ relay_client_recv_cb (void *arg_client, int fd)
|
|||
*/
|
||||
|
||||
struct t_relay_client *
|
||||
relay_client_new (int sock, char *address)
|
||||
relay_client_new (int sock, char *address, struct t_relay_server *server)
|
||||
{
|
||||
struct t_relay_client *new_client;
|
||||
|
||||
|
@ -265,13 +154,30 @@ relay_client_new (int sock, char *address)
|
|||
new_client->sock = sock;
|
||||
new_client->address = strdup ((address) ? address : "?");
|
||||
new_client->status = RELAY_STATUS_CONNECTED;
|
||||
new_client->protocol = server->protocol;
|
||||
new_client->protocol_string = strdup (server->protocol_string);
|
||||
new_client->listen_start_time = server->start_time;
|
||||
new_client->start_time = time (NULL);
|
||||
new_client->end_time = 0;
|
||||
new_client->hook_fd = NULL;
|
||||
new_client->hook_timer = NULL;
|
||||
new_client->last_activity = new_client->start_time;
|
||||
new_client->bytes_recv = 0;
|
||||
new_client->bytes_sent = 0;
|
||||
|
||||
new_client->protocol_data = NULL;
|
||||
switch (new_client->protocol)
|
||||
{
|
||||
case RELAY_PROTOCOL_WEECHAT:
|
||||
relay_protocol_weechat_alloc (new_client);
|
||||
break;
|
||||
case RELAY_PROTOCOL_IRC:
|
||||
relay_protocol_irc_alloc (new_client);
|
||||
break;
|
||||
case RELAY_NUM_PROTOCOLS:
|
||||
break;
|
||||
}
|
||||
|
||||
new_client->prev_client = NULL;
|
||||
new_client->next_client = relay_clients;
|
||||
if (relay_clients)
|
||||
|
@ -281,10 +187,15 @@ relay_client_new (int sock, char *address)
|
|||
relay_clients = new_client;
|
||||
|
||||
weechat_printf (NULL,
|
||||
_("%s: new client @ %s"),
|
||||
_("%s: new client from %s%s%s on port %d (relaying: %s.%s)"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
new_client->address);
|
||||
|
||||
RELAY_COLOR_CHAT_HOST,
|
||||
new_client->address,
|
||||
RELAY_COLOR_CHAT,
|
||||
server->port,
|
||||
relay_protocol_string[new_client->protocol],
|
||||
new_client->protocol_string);
|
||||
|
||||
new_client->hook_fd = weechat_hook_fd (new_client->sock,
|
||||
1, 0, 0,
|
||||
&relay_client_recv_cb,
|
||||
|
@ -322,6 +233,8 @@ relay_client_set_status (struct t_relay_client *client,
|
|||
|
||||
if (RELAY_CLIENT_HAS_ENDED(client->status))
|
||||
{
|
||||
client->end_time = time (NULL);
|
||||
|
||||
if (client->hook_fd)
|
||||
{
|
||||
weechat_unhook (client->hook_fd);
|
||||
|
@ -336,14 +249,24 @@ relay_client_set_status (struct t_relay_client *client,
|
|||
{
|
||||
case RELAY_STATUS_AUTH_FAILED:
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: authentication failed with client @ %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
client->address);
|
||||
_("%s%s: authentication failed with client %s%s%s (%s.%s)"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_HOST,
|
||||
client->address,
|
||||
RELAY_COLOR_CHAT,
|
||||
relay_protocol_string[client->protocol],
|
||||
client->protocol_string);
|
||||
break;
|
||||
case RELAY_STATUS_DISCONNECTED:
|
||||
weechat_printf (NULL,
|
||||
_("%s: disconnected from client @ %s"),
|
||||
RELAY_PLUGIN_NAME, client->address);
|
||||
_("%s: disconnected from client %s%s%s (%s.%s)"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_HOST,
|
||||
client->address,
|
||||
RELAY_COLOR_CHAT,
|
||||
relay_protocol_string[client->protocol],
|
||||
client->protocol_string);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -387,10 +310,26 @@ relay_client_free (struct t_relay_client *client)
|
|||
/* free data */
|
||||
if (client->address)
|
||||
free (client->address);
|
||||
if (client->protocol_string)
|
||||
free (client->protocol_string);
|
||||
if (client->hook_fd)
|
||||
weechat_unhook (client->hook_fd);
|
||||
if (client->hook_timer)
|
||||
weechat_unhook (client->hook_timer);
|
||||
if (client->protocol_data)
|
||||
{
|
||||
switch (client->protocol)
|
||||
{
|
||||
case RELAY_PROTOCOL_WEECHAT:
|
||||
relay_protocol_weechat_free (client);
|
||||
break;
|
||||
case RELAY_PROTOCOL_IRC:
|
||||
relay_protocol_irc_free (client);
|
||||
break;
|
||||
case RELAY_NUM_PROTOCOLS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free (client);
|
||||
|
||||
|
@ -404,6 +343,19 @@ relay_client_free (struct t_relay_client *client)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_client_free_all: remove all clients
|
||||
*/
|
||||
|
||||
void
|
||||
relay_client_free_all ()
|
||||
{
|
||||
while (relay_clients)
|
||||
{
|
||||
relay_client_free (relay_clients);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_client_disconnect: disconnect one client
|
||||
*/
|
||||
|
@ -497,12 +449,30 @@ relay_client_print_log ()
|
|||
weechat_log_printf (" status. . . . . . . : %d (%s)",
|
||||
ptr_client->status,
|
||||
relay_client_status_string[ptr_client->status]);
|
||||
weechat_log_printf (" protocol. . . . . . : %d (%s)",
|
||||
ptr_client->protocol,
|
||||
relay_protocol_string[ptr_client->protocol]);
|
||||
weechat_log_printf (" protocol_string . . : '%s'", ptr_client->protocol_string);
|
||||
weechat_log_printf (" listen_start_time . : %ld", ptr_client->listen_start_time);
|
||||
weechat_log_printf (" start_time. . . . . : %ld", ptr_client->start_time);
|
||||
weechat_log_printf (" end_time. . . . . . : %ld", ptr_client->end_time);
|
||||
weechat_log_printf (" hook_fd . . . . . . : 0x%lx", ptr_client->hook_fd);
|
||||
weechat_log_printf (" hook_timer. . . . . : 0x%lx", ptr_client->hook_timer);
|
||||
weechat_log_printf (" last_activity . . . : %ld", ptr_client->last_activity);
|
||||
weechat_log_printf (" bytes_recv. . . . . : %lu", ptr_client->bytes_recv);
|
||||
weechat_log_printf (" bytes_sent. . . . . : %lu", ptr_client->bytes_sent);
|
||||
weechat_log_printf (" protocol_data . . . : 0x%lx", ptr_client->protocol_data);
|
||||
switch (ptr_client->protocol)
|
||||
{
|
||||
case RELAY_PROTOCOL_WEECHAT:
|
||||
relay_protocol_weechat_print_log (ptr_client);
|
||||
break;
|
||||
case RELAY_PROTOCOL_IRC:
|
||||
relay_protocol_irc_print_log (ptr_client);
|
||||
break;
|
||||
case RELAY_NUM_PROTOCOLS:
|
||||
break;
|
||||
}
|
||||
weechat_log_printf (" prev_client . . . . : 0x%lx", ptr_client->prev_client);
|
||||
weechat_log_printf (" next_client . . . . : 0x%lx", ptr_client->next_client);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef __WEECHAT_RELAY_CLIENT_H
|
||||
#define __WEECHAT_RELAY_CLIENT_H 1
|
||||
|
||||
struct t_relay_server;
|
||||
|
||||
/* relay status */
|
||||
|
||||
enum t_relay_status
|
||||
|
@ -45,12 +47,18 @@ struct t_relay_client
|
|||
int sock; /* socket for connection */
|
||||
char *address; /* string with IP address */
|
||||
enum t_relay_status status; /* status (connecting, active,..) */
|
||||
enum t_relay_protocol protocol; /* protocol (irc,..) */
|
||||
char *protocol_string; /* string used for protocol */
|
||||
/* example: server for irc protocol */
|
||||
time_t listen_start_time; /* when listening started */
|
||||
time_t start_time; /* time of client connection */
|
||||
time_t end_time; /* time of client disconnection */
|
||||
struct t_hook *hook_fd; /* hook for socket or child pipe */
|
||||
struct t_hook *hook_timer; /* timeout for recever accept */
|
||||
time_t last_activity; /* time of last byte received/sent */
|
||||
unsigned long bytes_recv; /* bytes received from client */
|
||||
unsigned long bytes_sent; /* bytes sent to client */
|
||||
void *protocol_data; /* data depending on protocol used */
|
||||
struct t_relay_client *prev_client;/* link to previous client */
|
||||
struct t_relay_client *next_client;/* link to next client */
|
||||
};
|
||||
|
@ -62,10 +70,12 @@ extern int relay_client_count;
|
|||
|
||||
extern int relay_client_valid (struct t_relay_client *client);
|
||||
extern struct t_relay_client *relay_client_search_by_number (int number);
|
||||
extern struct t_relay_client *relay_client_new (int sock, char *address);
|
||||
extern struct t_relay_client *relay_client_new (int sock, char *address,
|
||||
struct t_relay_server *server);
|
||||
extern void relay_client_set_status (struct t_relay_client *client,
|
||||
enum t_relay_status status);
|
||||
extern void relay_client_free (struct t_relay_client *client);
|
||||
extern void relay_client_free_all ();
|
||||
extern void relay_client_disconnect (struct t_relay_client *client);
|
||||
extern void relay_client_disconnect_all ();
|
||||
extern int relay_client_add_to_infolist (struct t_infolist *infolist,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "relay-buffer.h"
|
||||
#include "relay-client.h"
|
||||
#include "relay-config.h"
|
||||
#include "relay-server.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -61,10 +62,15 @@ relay_command_client_list (int full)
|
|||
if (full)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%3d. %s, started on: %s, last activity: %s, "
|
||||
"bytes: %lu recv, %lu sent"),
|
||||
_("%3d. %s%s%s (%s%s%s), started on: %s, last "
|
||||
"activity: %s, bytes: %lu recv, %lu sent"),
|
||||
i,
|
||||
RELAY_COLOR_CHAT_HOST,
|
||||
ptr_client->address,
|
||||
RELAY_COLOR_CHAT,
|
||||
RELAY_COLOR_CHAT_BUFFER,
|
||||
relay_client_status_string[ptr_client->status],
|
||||
RELAY_COLOR_CHAT,
|
||||
date_start,
|
||||
date_activity,
|
||||
ptr_client->bytes_recv,
|
||||
|
@ -72,10 +78,16 @@ relay_command_client_list (int full)
|
|||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%3d. %s, started on: %s"),
|
||||
i,
|
||||
ptr_client->address);
|
||||
if (!RELAY_CLIENT_HAS_ENDED(ptr_client->status))
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%3d. %s%s%s, started on: %s"),
|
||||
i,
|
||||
RELAY_COLOR_CHAT_HOST,
|
||||
ptr_client->address,
|
||||
RELAY_COLOR_CHAT,
|
||||
date_start);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -84,6 +96,49 @@ relay_command_client_list (int full)
|
|||
weechat_printf (NULL, _("No client for relay"));
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_command_server_list: list servers (list of port on which we are
|
||||
* listening)
|
||||
*/
|
||||
|
||||
void
|
||||
relay_command_server_list ()
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
int i;
|
||||
char date_start[128];
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (relay_servers)
|
||||
{
|
||||
weechat_printf (NULL, "");
|
||||
weechat_printf (NULL, _("Listening on ports:"));
|
||||
i = 1;
|
||||
for (ptr_server = relay_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
date_tmp = localtime (&(ptr_server->start_time));
|
||||
strftime (date_start, sizeof (date_start),
|
||||
"%a, %d %b %Y %H:%M:%S", date_tmp);
|
||||
|
||||
weechat_printf (NULL,
|
||||
_("%3d. port %s%d%s, relay: %s%s.%s%s, started on: %s"),
|
||||
i,
|
||||
RELAY_COLOR_CHAT_BUFFER,
|
||||
ptr_server->port,
|
||||
RELAY_COLOR_CHAT,
|
||||
RELAY_COLOR_CHAT_BUFFER,
|
||||
relay_protocol_string[ptr_server->protocol],
|
||||
ptr_server->protocol_string,
|
||||
RELAY_COLOR_CHAT,
|
||||
date_start);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
weechat_printf (NULL, _("No server for relay"));
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_command_relay: command /relay
|
||||
*/
|
||||
|
@ -92,21 +147,80 @@ int
|
|||
relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
char **argv, char **argv_eol)
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) buffer;
|
||||
(void) argv_eol;
|
||||
|
||||
if ((argc > 1) && (weechat_strcasecmp (argv[1], "list") == 0))
|
||||
if (argc > 1)
|
||||
{
|
||||
relay_command_client_list (0);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if ((argc > 1) && (weechat_strcasecmp (argv[1], "listfull") == 0))
|
||||
{
|
||||
relay_command_client_list (1);
|
||||
return WEECHAT_RC_OK;
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
relay_command_client_list (0);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
relay_command_client_list (1);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if (weechat_strcasecmp (argv[1], "listrelay") == 0)
|
||||
{
|
||||
relay_command_server_list ();
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
if (weechat_strcasecmp (argv[1], "add") == 0)
|
||||
{
|
||||
if (argc >= 4)
|
||||
{
|
||||
relay_config_create_option_port (NULL,
|
||||
relay_config_file,
|
||||
relay_config_section_port,
|
||||
argv[2],
|
||||
argv_eol[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: missing arguments for \"%s\" "
|
||||
"command"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
"relay add");
|
||||
}
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
if (weechat_strcasecmp (argv[1], "del") == 0)
|
||||
{
|
||||
if (argc >= 3)
|
||||
{
|
||||
ptr_server = relay_server_search (argv_eol[2]);
|
||||
if (ptr_server)
|
||||
{
|
||||
relay_server_free (ptr_server);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: relay \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
argv_eol[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: missing arguments for \"%s\" "
|
||||
"command"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
"relay add");
|
||||
}
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!relay_buffer)
|
||||
|
@ -145,10 +259,24 @@ relay_command_init ()
|
|||
{
|
||||
weechat_hook_command ("relay",
|
||||
N_("relay control"),
|
||||
"[list | listfull]",
|
||||
N_(" list: list relay clients\n"
|
||||
"listfull: list relay clients (verbose)\n\n"
|
||||
N_("[list | listfull | add protocol.name port | "
|
||||
"del protocol.name]"),
|
||||
N_(" list: list relay clients (only active "
|
||||
"relays)\n"
|
||||
" listfull: list relay clients (verbose, all "
|
||||
"relays)\n"
|
||||
" listrelay: list relays (name and port)\n"
|
||||
" add: add relay for a protocol + name\n"
|
||||
" del: remove relay for a protocol + name\n"
|
||||
"protocol.name: protocol and name to relay\n"
|
||||
" for example: irc.freenode\n"
|
||||
" port: port used for relay\n\n"
|
||||
"Without argument, this command opens buffer "
|
||||
"with list of relay clients."),
|
||||
"list|listfull", &relay_command_relay, NULL);
|
||||
"list %(relay_relays)"
|
||||
" || listfull %(relay_relays)"
|
||||
" || listrelay"
|
||||
" || add %(relay_protocol_name) %(relay_free_port)"
|
||||
" || del %(relay_relays)",
|
||||
&relay_command_relay, NULL);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* relay-completion.c: completion for relay command */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-server.h"
|
||||
|
||||
|
||||
/*
|
||||
* relay_completion_protocol_name_cb: callback for completion with protocol and
|
||||
* name
|
||||
*/
|
||||
|
||||
int
|
||||
relay_completion_protocol_name_cb (void *data, const char *completion_item,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion)
|
||||
{
|
||||
struct t_infolist *infolist;
|
||||
char protocol_name[256];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) buffer;
|
||||
(void) completion_item;
|
||||
|
||||
infolist = weechat_infolist_get("irc_server", NULL, NULL);
|
||||
if (infolist)
|
||||
{
|
||||
while (weechat_infolist_next (infolist))
|
||||
{
|
||||
snprintf (protocol_name, sizeof (protocol_name), "irc.%s",
|
||||
weechat_infolist_string (infolist, "name"));
|
||||
weechat_hook_completion_list_add (completion, protocol_name,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
weechat_infolist_free (infolist);
|
||||
}
|
||||
|
||||
weechat_hook_completion_list_add (completion, "weechat",
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_completion_relays_cb: callback for completion with protocol and name
|
||||
* of current relays
|
||||
*/
|
||||
|
||||
int
|
||||
relay_completion_relays_cb (void *data, const char *completion_item,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion)
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
char protocol_name[256];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) buffer;
|
||||
(void) completion_item;
|
||||
|
||||
for (ptr_server = relay_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
snprintf (protocol_name, sizeof (protocol_name), "%s.%s",
|
||||
relay_protocol_string[ptr_server->protocol],
|
||||
ptr_server->protocol_string);
|
||||
weechat_hook_completion_list_add (completion, protocol_name,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_completion_free_port_cb: callback for completion with a free port
|
||||
*/
|
||||
|
||||
int
|
||||
relay_completion_free_port_cb (void *data, const char *completion_item,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion)
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
char str_port[16];
|
||||
int port_max;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) buffer;
|
||||
(void) completion_item;
|
||||
|
||||
/* default port is 8000 */
|
||||
port_max = 8000 - 1;
|
||||
|
||||
if (ptr_server)
|
||||
{
|
||||
port_max = -1;
|
||||
for (ptr_server = relay_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->port > port_max)
|
||||
port_max = ptr_server->port;
|
||||
}
|
||||
if (port_max < 0)
|
||||
port_max = 8000 - 1;
|
||||
}
|
||||
|
||||
snprintf (str_port, sizeof (str_port), "%d", port_max + 1);
|
||||
weechat_hook_completion_list_add (completion, str_port,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_completion_init: init completion for relay plugin
|
||||
*/
|
||||
|
||||
void
|
||||
relay_completion_init ()
|
||||
{
|
||||
weechat_hook_completion ("relay_protocol_name",
|
||||
N_("all possible protocol.name for relay plugin"),
|
||||
&relay_completion_protocol_name_cb, NULL);
|
||||
weechat_hook_completion ("relay_relays",
|
||||
N_("protocol.name of current relays for relay "
|
||||
"plugin"),
|
||||
&relay_completion_relays_cb, NULL);
|
||||
weechat_hook_completion ("relay_free_port",
|
||||
N_("first free port for relay plugin"),
|
||||
&relay_completion_free_port_cb, NULL);
|
||||
}
|
|
@ -17,12 +17,9 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_NETWORK_H
|
||||
#define __WEECHAT_RELAY_NETWORK_H 1
|
||||
#ifndef __WEECHAT_RELAY_COMPLETION_H
|
||||
#define __WEECHAT_RELAY_COMPLETION_H 1
|
||||
|
||||
extern int relay_network_sock;
|
||||
extern void relay_completion_init ();
|
||||
|
||||
extern int relay_network_init ();
|
||||
extern void relay_network_end ();
|
||||
|
||||
#endif /* relay-network.h */
|
||||
#endif /* relay-completion.h */
|
|
@ -27,10 +27,11 @@
|
|||
#include "relay-config.h"
|
||||
#include "relay-client.h"
|
||||
#include "relay-buffer.h"
|
||||
#include "relay-network.h"
|
||||
#include "relay-server.h"
|
||||
|
||||
|
||||
struct t_config_file *relay_config_file = NULL;
|
||||
struct t_config_section *relay_config_section_port = NULL;
|
||||
|
||||
/* relay config, look section */
|
||||
|
||||
|
@ -45,8 +46,7 @@ struct t_config_option *relay_config_color_status[RELAY_NUM_STATUS];
|
|||
|
||||
/* relay config, network section */
|
||||
|
||||
struct t_config_option *relay_config_network_enabled;
|
||||
struct t_config_option *relay_config_network_listen_port_range;
|
||||
struct t_config_option *relay_config_network_max_clients;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -66,23 +66,149 @@ relay_config_refresh_cb (void *data, struct t_config_option *option)
|
|||
}
|
||||
|
||||
/*
|
||||
* relay_config_change_network_enabled_cb: callback called when user
|
||||
* enables/disables relay
|
||||
* relay_config_change_port_cb: callback called when relay port option is
|
||||
* modified
|
||||
*/
|
||||
|
||||
void
|
||||
relay_config_change_network_enabled_cb (void *data,
|
||||
struct t_config_option *option)
|
||||
int
|
||||
relay_config_check_port_cb (void *data, struct t_config_option *option,
|
||||
const char *value)
|
||||
{
|
||||
char *error;
|
||||
long port;
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if ((weechat_config_boolean(relay_config_network_enabled) && relay_network_sock < 0)
|
||||
|| (!weechat_config_boolean(relay_config_network_enabled) && relay_network_sock >= 0))
|
||||
error = NULL;
|
||||
port = strtol (value, &error, 10);
|
||||
ptr_server = relay_server_search_port ((int)port);
|
||||
if (ptr_server)
|
||||
{
|
||||
relay_network_init ();
|
||||
weechat_printf (NULL, _("%s%s: error: port \"%d\" is already used"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME, (int)port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_config_change_port_cb: callback called when relay port option is
|
||||
* modified
|
||||
*/
|
||||
|
||||
void
|
||||
relay_config_change_port_cb (void *data, struct t_config_option *option)
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
ptr_server = relay_server_search (weechat_config_option_get_pointer (option, "name"));
|
||||
if (ptr_server)
|
||||
{
|
||||
relay_server_update_port (ptr_server,
|
||||
*((int *)weechat_config_option_get_pointer (option, "value")));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_config_delete_port_cb: callback called when relay port option is
|
||||
* deleted
|
||||
*/
|
||||
|
||||
void
|
||||
relay_config_delete_port_cb (void *data, struct t_config_option *option)
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
ptr_server = relay_server_search (weechat_config_option_get_pointer (option, "name"));
|
||||
if (ptr_server)
|
||||
relay_server_free (ptr_server);
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_config_create_option_port: create a relay for a port
|
||||
*/
|
||||
|
||||
int
|
||||
relay_config_create_option_port (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value)
|
||||
{
|
||||
int rc, protocol_number;
|
||||
char *error, *protocol, *protocol_string;
|
||||
long port;
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
|
||||
relay_server_get_protocol_string (option_name,
|
||||
&protocol, &protocol_string);
|
||||
|
||||
protocol_number = -1;
|
||||
port = -1;
|
||||
|
||||
if (protocol && protocol_string)
|
||||
protocol_number = relay_protocol_search (protocol);
|
||||
|
||||
if (protocol_number < 0)
|
||||
{
|
||||
weechat_printf (NULL, _("%s%s: error: unknown protocol \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME, protocol);
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
|
||||
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
{
|
||||
error = NULL;
|
||||
port = strtol (value, &error, 10);
|
||||
ptr_server = relay_server_search_port ((int)port);
|
||||
if (ptr_server)
|
||||
{
|
||||
weechat_printf (NULL, _("%s%s: error: port \"%d\" is already used"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME, (int)port);
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
{
|
||||
/* create config option */
|
||||
weechat_config_new_option (
|
||||
config_file, section,
|
||||
option_name, "integer", NULL,
|
||||
NULL, 0, 65535, "", value, 0,
|
||||
&relay_config_check_port_cb, NULL,
|
||||
&relay_config_change_port_cb, NULL,
|
||||
&relay_config_delete_port_cb, NULL);
|
||||
|
||||
relay_server_new (protocol_number, protocol_string, port);
|
||||
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
}
|
||||
|
||||
if (protocol)
|
||||
free (protocol);
|
||||
if (protocol_string)
|
||||
free (protocol_string);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -201,20 +327,27 @@ relay_config_init ()
|
|||
return 0;
|
||||
}
|
||||
|
||||
relay_config_network_enabled = weechat_config_new_option (
|
||||
relay_config_network_max_clients = weechat_config_new_option (
|
||||
relay_config_file, ptr_section,
|
||||
"enabled", "boolean",
|
||||
N_("enable relay"),
|
||||
NULL, 0, 0, "off", NULL, 0, NULL, NULL,
|
||||
&relay_config_change_network_enabled_cb, NULL, NULL, NULL);
|
||||
relay_config_network_listen_port_range = weechat_config_new_option (
|
||||
relay_config_file, ptr_section,
|
||||
"listen_port_range", "string",
|
||||
N_("port number (or range of ports) that relay plugin listens on "
|
||||
"(syntax: a single port, ie. 5000 or a port "
|
||||
"range, ie. 5000-5015, it's recommended to use ports greater than "
|
||||
"1024, because only root can use ports below 1024)"),
|
||||
NULL, 0, 0, "22373-22400", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
"max_clients", "integer",
|
||||
N_("maximum number of clients connecting to a port"),
|
||||
NULL, 1, 1024, "5", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
ptr_section = weechat_config_new_section (relay_config_file, "port",
|
||||
1, 1,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
&relay_config_create_option_port, NULL,
|
||||
NULL, NULL);
|
||||
if (!ptr_section)
|
||||
{
|
||||
weechat_config_free (relay_config_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
relay_config_section_port = ptr_section;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
#define RELAY_CONFIG_NAME "relay"
|
||||
|
||||
extern struct t_config_file *relay_config;
|
||||
extern struct t_config_file *relay_config_file;
|
||||
extern struct t_config_section *relay_config_section_port;
|
||||
|
||||
extern struct t_config_option *relay_config_look_auto_open_buffer;
|
||||
|
||||
|
@ -31,9 +32,13 @@ extern struct t_config_option *relay_config_color_text_bg;
|
|||
extern struct t_config_option *relay_config_color_text_selected;
|
||||
extern struct t_config_option *relay_config_color_status[];
|
||||
|
||||
extern struct t_config_option *relay_config_network_enabled;
|
||||
extern struct t_config_option *relay_config_network_listen_port_range;
|
||||
extern struct t_config_option *relay_config_network_max_clients;
|
||||
|
||||
extern int relay_config_create_option_port (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value);
|
||||
extern int relay_config_init ();
|
||||
extern int relay_config_read ();
|
||||
extern int relay_config_write ();
|
||||
|
|
|
@ -1,234 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* relay-network.c: network functions for relay plugin */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-buffer.h"
|
||||
#include "relay-client.h"
|
||||
#include "relay-config.h"
|
||||
|
||||
|
||||
int relay_network_sock = -1; /* socket used for listening and */
|
||||
/* waiting for clients */
|
||||
struct t_hook *relay_network_hook_fd = NULL;
|
||||
int relay_network_listen_port = -1; /* listening port */
|
||||
|
||||
|
||||
/*
|
||||
* relay_network_close_socket: close socket
|
||||
*/
|
||||
|
||||
void
|
||||
relay_network_close_socket ()
|
||||
{
|
||||
if (relay_network_hook_fd)
|
||||
{
|
||||
weechat_unhook (relay_network_hook_fd);
|
||||
relay_network_hook_fd = NULL;
|
||||
}
|
||||
if (relay_network_sock >= 0)
|
||||
{
|
||||
close (relay_network_sock);
|
||||
relay_network_sock = -1;
|
||||
weechat_printf (NULL,
|
||||
_("%s: socket closed"),
|
||||
RELAY_PLUGIN_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_network_sock_cb: read data from a client which is connecting on socket
|
||||
*/
|
||||
|
||||
int
|
||||
relay_network_sock_cb (void *data, int fd)
|
||||
{
|
||||
struct sockaddr_in client_addr;
|
||||
unsigned int client_length;
|
||||
int client_fd;
|
||||
char ipv4_address[INET_ADDRSTRLEN + 1], *ptr_address;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) fd;
|
||||
|
||||
client_length = sizeof (client_addr);
|
||||
memset (&client_addr, 0, client_length);
|
||||
|
||||
client_fd = accept (relay_network_sock, (struct sockaddr *) &client_addr,
|
||||
&client_length);
|
||||
if (client_fd < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot accept client"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
ptr_address = NULL;
|
||||
if (inet_ntop (AF_INET,
|
||||
&(client_addr.sin_addr),
|
||||
ipv4_address,
|
||||
INET_ADDRSTRLEN))
|
||||
{
|
||||
ptr_address = ipv4_address;
|
||||
}
|
||||
|
||||
relay_client_new (client_fd, ptr_address);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_network_init: init socket and listen on port
|
||||
* return 1 if ok, 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
relay_network_init ()
|
||||
{
|
||||
int set, args, port, port_start, port_end;
|
||||
struct sockaddr_in server_addr;
|
||||
const char *port_range;
|
||||
|
||||
relay_network_close_socket ();
|
||||
|
||||
if (!weechat_config_boolean (relay_config_network_enabled))
|
||||
return 1;
|
||||
|
||||
port_range = weechat_config_string (relay_config_network_listen_port_range);
|
||||
if (!port_range || !port_range[0])
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: option \"listen_port_range\" is not defined"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
relay_network_sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (relay_network_sock < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot create socket"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
set = 1;
|
||||
if (setsockopt (relay_network_sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *) &set, sizeof (set)) < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot set socket option "
|
||||
"\"SO_REUSEADDR\""),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
close (relay_network_sock);
|
||||
relay_network_sock = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
set = 1;
|
||||
if (setsockopt (relay_network_sock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *) &set, sizeof (set)) < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot set socket option "
|
||||
"\"SO_KEEPALIVE\""),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
close (relay_network_sock);
|
||||
relay_network_sock = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&server_addr, 0, sizeof(struct sockaddr_in));
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
port = -1;
|
||||
|
||||
/* find a free port in the specified range */
|
||||
args = sscanf (weechat_config_string (relay_config_network_listen_port_range),
|
||||
"%d-%d", &port_start, &port_end);
|
||||
if (args > 0)
|
||||
{
|
||||
port = port_start;
|
||||
if (args == 1)
|
||||
port_end = port_start;
|
||||
|
||||
/* loop through the entire allowed port range */
|
||||
while (port <= port_end)
|
||||
{
|
||||
/* attempt to bind to the free port */
|
||||
server_addr.sin_port = htons (port);
|
||||
if (bind (relay_network_sock, (struct sockaddr *) &server_addr,
|
||||
sizeof (server_addr)) == 0)
|
||||
break;
|
||||
port++;
|
||||
}
|
||||
|
||||
if (port > port_end)
|
||||
port = -1;
|
||||
}
|
||||
|
||||
if (port < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot find available port for listening"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
close (relay_network_sock);
|
||||
relay_network_sock = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
relay_network_listen_port = port;
|
||||
|
||||
listen (relay_network_sock, 5);
|
||||
|
||||
weechat_printf (NULL,
|
||||
_("%s: listening on port %d"),
|
||||
RELAY_PLUGIN_NAME, relay_network_listen_port);
|
||||
|
||||
relay_network_hook_fd = weechat_hook_fd (relay_network_sock,
|
||||
1, 0, 0,
|
||||
&relay_network_sock_cb,
|
||||
NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_network_end: close main socket
|
||||
*/
|
||||
|
||||
void
|
||||
relay_network_end ()
|
||||
{
|
||||
relay_network_close_socket ();
|
||||
}
|
|
@ -0,0 +1,545 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* relay-protocol-irc.c: IRC protocol for client
|
||||
(relay acting as an IRC proxy/bouncer) */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-protocol-irc.h"
|
||||
#include "relay-client.h"
|
||||
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_search_buffer: search IRC buffer with server and channel
|
||||
* name
|
||||
*/
|
||||
|
||||
struct t_gui_buffer *
|
||||
relay_protocol_irc_search_buffer (const char *server, const char *channel)
|
||||
{
|
||||
char string[256];
|
||||
long unsigned int value;
|
||||
const char *str_ptr_buffer;
|
||||
|
||||
snprintf (string, sizeof (string), "%s,%s", server, channel);
|
||||
str_ptr_buffer = weechat_info_get ("irc_buffer", string);
|
||||
if (str_ptr_buffer && str_ptr_buffer[0])
|
||||
{
|
||||
sscanf (str_ptr_buffer, "%lx", &value);
|
||||
return (struct t_gui_buffer *)value;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_sendf: send formatted data to client
|
||||
*/
|
||||
|
||||
int
|
||||
relay_protocol_irc_sendf (struct t_relay_client *client, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[4096];
|
||||
int length, num_sent;
|
||||
|
||||
if (!client)
|
||||
return 0;
|
||||
|
||||
va_start (args, format);
|
||||
vsnprintf (buffer, sizeof (buffer) - 3, format, args);
|
||||
va_end (args);
|
||||
|
||||
if (weechat_relay_plugin->debug)
|
||||
{
|
||||
weechat_printf (NULL, "relay: send: %s", buffer);
|
||||
}
|
||||
|
||||
length = strlen (buffer);
|
||||
|
||||
buffer[length] = '\r';
|
||||
buffer[length + 1] = '\n';
|
||||
buffer[length + 2] = '\0';
|
||||
length += 2;
|
||||
|
||||
num_sent = send (client->sock, buffer, length, 0);
|
||||
|
||||
if (num_sent >= 0)
|
||||
client->bytes_sent += num_sent;
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: error sending data to client %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
strerror (errno));
|
||||
}
|
||||
|
||||
return num_sent;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_signal_irc_in2_cb: callback for "irc_in2" IRC signal
|
||||
*/
|
||||
|
||||
int
|
||||
relay_protocol_irc_signal_irc_in2_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
struct t_relay_client *client;
|
||||
const char *ptr_msg;
|
||||
char *host, *pos, *pos_end_nick;
|
||||
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
|
||||
client = (struct t_relay_client *)data;
|
||||
ptr_msg = (const char *)signal_data;
|
||||
|
||||
if (weechat_relay_plugin->debug)
|
||||
{
|
||||
weechat_printf (NULL, "relay: irc_in2: client: %s, data: %s",
|
||||
client->protocol_string,
|
||||
ptr_msg);
|
||||
}
|
||||
|
||||
if (ptr_msg[0] == ':')
|
||||
{
|
||||
pos = strchr (ptr_msg, ' ');
|
||||
if (pos)
|
||||
{
|
||||
host = weechat_strndup (ptr_msg + 1, pos - ptr_msg);
|
||||
if (host)
|
||||
{
|
||||
pos_end_nick = strchr (host, '!');
|
||||
if (pos_end_nick)
|
||||
pos_end_nick[0] = '\0';
|
||||
else
|
||||
host[0] = '\0';
|
||||
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
|
||||
relay_protocol_irc_sendf (client, ":%s%s%s %s",
|
||||
(host[0]) ? host : "",
|
||||
(host[0]) ? "!" : "",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
pos);
|
||||
free (host);
|
||||
}
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
}
|
||||
|
||||
relay_protocol_irc_sendf (client, "%s", ptr_msg);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_signal_irc_out_cb: callback for "irc_out" IRC signal
|
||||
*/
|
||||
|
||||
int
|
||||
relay_protocol_irc_signal_irc_out_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
struct t_relay_client *client;
|
||||
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
|
||||
client = (struct t_relay_client *)data;
|
||||
|
||||
if (weechat_relay_plugin->debug)
|
||||
{
|
||||
weechat_printf (NULL, "relay: irc_out: client: %s, data: %s",
|
||||
client->protocol_string,
|
||||
(char *)signal_data);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_send_join: send join for a channel to client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_send_join (struct t_relay_client *client,
|
||||
const char *channel)
|
||||
{
|
||||
char *infolist_name, *nicks;
|
||||
const char *nick;
|
||||
int length, length_nicks;
|
||||
struct t_infolist *infolist_nicks;
|
||||
|
||||
length = strlen (client->protocol_string) + 1 + strlen (channel) + 1;
|
||||
infolist_name = malloc (length);
|
||||
if (infolist_name)
|
||||
{
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s!%s@proxy JOIN %s",
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
"weechat",
|
||||
channel);
|
||||
snprintf (infolist_name, length, "%s,%s",
|
||||
client->protocol_string,
|
||||
channel);
|
||||
infolist_nicks = weechat_infolist_get ("irc_nick", NULL, infolist_name);
|
||||
if (infolist_nicks)
|
||||
{
|
||||
length_nicks = 0;
|
||||
nicks = NULL;
|
||||
while (weechat_infolist_next (infolist_nicks))
|
||||
{
|
||||
nick = weechat_infolist_string (infolist_nicks, "name");
|
||||
if (nick && nick[0])
|
||||
{
|
||||
if (length_nicks == 0)
|
||||
{
|
||||
length_nicks = strlen (nick) + 1;
|
||||
nicks = malloc (length_nicks);
|
||||
strcpy (nicks, nick);
|
||||
}
|
||||
else
|
||||
{
|
||||
length_nicks += strlen (nick) + 1;
|
||||
nicks = realloc (nicks, length_nicks);
|
||||
strcat (nicks, " ");
|
||||
strcat (nicks, nick);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nicks)
|
||||
{
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 353 %s = %s :%s",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
channel, nicks);
|
||||
free (nicks);
|
||||
}
|
||||
weechat_infolist_free (infolist_nicks);
|
||||
}
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 366 %s %s :End of /NAMES list.",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
channel);
|
||||
free (infolist_name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_send_join_channels: send join for all channels of server
|
||||
* to client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_send_join_channels (struct t_relay_client *client)
|
||||
{
|
||||
struct t_infolist *infolist_channels;
|
||||
const char *channel;
|
||||
|
||||
infolist_channels = weechat_infolist_get ("irc_channel", NULL,
|
||||
client->protocol_string);
|
||||
if (infolist_channels)
|
||||
{
|
||||
while (weechat_infolist_next (infolist_channels))
|
||||
{
|
||||
channel = weechat_infolist_string (infolist_channels, "name");
|
||||
relay_protocol_irc_send_join (client, channel);
|
||||
}
|
||||
weechat_infolist_free (infolist_channels);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_recv_one_msg: read one message from client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_recv_one_msg (struct t_relay_client *client, char *data)
|
||||
{
|
||||
char *pos, str_time[128], **argv, **argv_eol, str_signal_name[128];
|
||||
char *command;
|
||||
int argc, length;
|
||||
const char *nick;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
pos = strchr (data, '\r');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
|
||||
if (weechat_relay_plugin->debug)
|
||||
{
|
||||
weechat_printf (NULL, "relay: recv from client: \"%s\"", data);
|
||||
}
|
||||
|
||||
argv = weechat_string_split (data, " ", 0, 0, &argc);
|
||||
argv_eol = weechat_string_split (data, " ", 1, 0, &argc);
|
||||
|
||||
if (!RELAY_IRC_DATA(client, connected))
|
||||
{
|
||||
if (weechat_strncasecmp (data, "nick ", 5) == 0)
|
||||
{
|
||||
if (data[5])
|
||||
{
|
||||
if (RELAY_IRC_DATA(client, nick))
|
||||
free (RELAY_IRC_DATA(client, nick));
|
||||
RELAY_IRC_DATA(client, nick) = strdup (data + 5);
|
||||
}
|
||||
}
|
||||
if (weechat_strncasecmp (data, "user ", 5) == 0)
|
||||
{
|
||||
if (data[5])
|
||||
{
|
||||
RELAY_IRC_DATA(client, user_received) = 1;
|
||||
}
|
||||
}
|
||||
if (RELAY_IRC_DATA(client, nick) && RELAY_IRC_DATA(client, user_received))
|
||||
{
|
||||
RELAY_IRC_DATA(client, connected) = 1;
|
||||
|
||||
/* send nick to client if server nick is different of nick asked
|
||||
by client with command NICK */
|
||||
nick = weechat_info_get ("irc_nick", client->protocol_string);
|
||||
if (nick && (strcmp (nick, RELAY_IRC_DATA(client, nick)) != 0))
|
||||
{
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s!proxy NICK :%s",
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
nick);
|
||||
free (RELAY_IRC_DATA(client, nick));
|
||||
RELAY_IRC_DATA(client, nick) = strdup (nick);
|
||||
}
|
||||
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 001 %s :Welcome to the Internet "
|
||||
"Relay Network %s!%s@proxy",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
"weechat");
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 002 %s :Your host is "
|
||||
"weechat-relay-irc, running version %s",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
weechat_info_get("version", NULL));
|
||||
snprintf (str_time, sizeof (str_time), "%s",
|
||||
ctime (&client->listen_start_time));
|
||||
if (str_time[0])
|
||||
str_time[strlen (str_time) - 1] = '\0';
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 003 %s :This server was created "
|
||||
"on %s",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
str_time);
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 004 %s %s %s oirw abiklmnopqstv",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
RELAY_IRC_DATA(client, address),
|
||||
weechat_info_get("version", NULL));
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 251 %s :There are %d users and 0 "
|
||||
"invisible on 1 servers",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
relay_client_count);
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 255 %s :I have %d clients, 0 "
|
||||
"services and 0 servers",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick),
|
||||
relay_client_count);
|
||||
relay_protocol_irc_sendf (client,
|
||||
":%s 422 %s :MOTD File is missing",
|
||||
RELAY_IRC_DATA(client, address),
|
||||
RELAY_IRC_DATA(client, nick));
|
||||
|
||||
/* hook signal "xxx,irc_in2_*" to catch IRC data received from
|
||||
this server */
|
||||
snprintf (str_signal_name, sizeof (str_signal_name),
|
||||
"%s,irc_in2_*",
|
||||
client->protocol_string);
|
||||
RELAY_IRC_DATA(client, hook_signal_irc_in2) =
|
||||
weechat_hook_signal (str_signal_name,
|
||||
&relay_protocol_irc_signal_irc_in2_cb,
|
||||
client);
|
||||
|
||||
/* hook signal "xxx,irc_out_*" to catch IRC data sent to
|
||||
this server */
|
||||
snprintf (str_signal_name, sizeof (str_signal_name),
|
||||
"%s,irc_out_*",
|
||||
client->protocol_string);
|
||||
RELAY_IRC_DATA(client, hook_signal_irc_out) =
|
||||
weechat_hook_signal (str_signal_name,
|
||||
&relay_protocol_irc_signal_irc_out_cb,
|
||||
client);
|
||||
|
||||
/* send JOIN for all channels on server to client */
|
||||
relay_protocol_irc_send_join_channels (client);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argc > 0)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[0], "privmsg") == 0)
|
||||
{
|
||||
ptr_buffer = relay_protocol_irc_search_buffer (client->protocol_string,
|
||||
argv[1]);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
"relay: send string \"%s\" on channel %s",
|
||||
(argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2],
|
||||
argv[1]);
|
||||
weechat_command (ptr_buffer,
|
||||
(argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: buffer not found for IRC server "
|
||||
"\"%s\", channel \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
client->protocol_string,
|
||||
argv[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
length = 32 + strlen (client->protocol_string) + strlen (data);
|
||||
command = malloc (length + 1);
|
||||
if (command)
|
||||
{
|
||||
snprintf (command, length, "/quote -server %s %s",
|
||||
client->protocol_string,
|
||||
data);
|
||||
weechat_command (NULL, command);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
weechat_string_free_split (argv_eol);
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_recv: read data from client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_recv (struct t_relay_client *client, const char *data)
|
||||
{
|
||||
char **items;
|
||||
int items_count, i;
|
||||
|
||||
items = weechat_string_split (data, "\n", 0, 0, &items_count);
|
||||
for (i = 0; i < items_count; i++)
|
||||
{
|
||||
relay_protocol_irc_recv_one_msg (client, items[i]);
|
||||
}
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_alloc: init relay data specific to IRC protocol
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_alloc (struct t_relay_client *client)
|
||||
{
|
||||
struct t_relay_protocol_irc_data *irc_data;
|
||||
|
||||
client->protocol_data = malloc (sizeof (*irc_data));
|
||||
if (client->protocol_data)
|
||||
{
|
||||
RELAY_IRC_DATA(client, address) = strdup ("weechat.relay.irc");
|
||||
RELAY_IRC_DATA(client, nick) = NULL;
|
||||
RELAY_IRC_DATA(client, user_received) = 0;
|
||||
RELAY_IRC_DATA(client, connected) = 0;
|
||||
RELAY_IRC_DATA(client, hook_signal_irc_in2) = NULL;
|
||||
RELAY_IRC_DATA(client, hook_signal_irc_out) = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_free: free relay data specific to IRC protocol
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_free (struct t_relay_client *client)
|
||||
{
|
||||
if (client->protocol_data)
|
||||
{
|
||||
if (RELAY_IRC_DATA(client, address))
|
||||
free (RELAY_IRC_DATA(client, address));
|
||||
if (RELAY_IRC_DATA(client, nick))
|
||||
free (RELAY_IRC_DATA(client, nick));
|
||||
if (RELAY_IRC_DATA(client, hook_signal_irc_in2))
|
||||
weechat_unhook (RELAY_IRC_DATA(client, hook_signal_irc_in2));
|
||||
if (RELAY_IRC_DATA(client, hook_signal_irc_out))
|
||||
weechat_unhook (RELAY_IRC_DATA(client, hook_signal_irc_out));
|
||||
|
||||
free (client->protocol_data);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_irc_print_log: print IRC client infos in log (usually for
|
||||
* crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_irc_print_log (struct t_relay_client *client)
|
||||
{
|
||||
if (client->protocol_data)
|
||||
{
|
||||
weechat_log_printf (" address. . . . . . : '%s'", RELAY_IRC_DATA(client, address));
|
||||
weechat_log_printf (" nick . . . . . . . : '%s'", RELAY_IRC_DATA(client, nick));
|
||||
weechat_log_printf (" user_received. . . : %d", RELAY_IRC_DATA(client, user_received));
|
||||
weechat_log_printf (" connected. . . . . : %d", RELAY_IRC_DATA(client, connected));
|
||||
weechat_log_printf (" hook_signal_irc_in2: 0x%lx", RELAY_IRC_DATA(client, hook_signal_irc_in2));
|
||||
weechat_log_printf (" hook_signal_irc_out: 0x%lx", RELAY_IRC_DATA(client, hook_signal_irc_out));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_PROTOCOL_IRC_H
|
||||
#define __WEECHAT_RELAY_PROTOCOL_IRC_H 1
|
||||
|
||||
struct t_relay_client;
|
||||
|
||||
#define RELAY_IRC_DATA(client, var) \
|
||||
(((struct t_relay_protocol_irc_data *)client->protocol_data)->var)
|
||||
|
||||
struct t_relay_protocol_irc_data
|
||||
{
|
||||
char *address; /* client address (used when sending */
|
||||
/* data to client) */
|
||||
char *nick; /* nick for client */
|
||||
int user_received; /* command "USER" received */
|
||||
int connected; /* 1 if client is connected as IRC */
|
||||
/* client */
|
||||
struct t_hook *hook_signal_irc_in2;/* hook signal "irc_in2" */
|
||||
struct t_hook *hook_signal_irc_out;/* hook signal "irc_out" */
|
||||
};
|
||||
|
||||
extern void relay_protocol_irc_recv (struct t_relay_client *client,
|
||||
const char *data);
|
||||
extern void relay_protocol_irc_alloc (struct t_relay_client *client);
|
||||
extern void relay_protocol_irc_free (struct t_relay_client *client);
|
||||
extern void relay_protocol_irc_print_log (struct t_relay_client *client);
|
||||
|
||||
#endif /* relay-protocol-irc.h */
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* relay-protocol-weechat.c: WeeChat protocol for client */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-protocol-weechat.h"
|
||||
#include "relay-client.h"
|
||||
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_sendf: send formatted data to client
|
||||
*/
|
||||
|
||||
int
|
||||
relay_protocol_weechat_sendf (struct t_relay_client *client,
|
||||
const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[4096];
|
||||
char str_length[8];
|
||||
int length, num_sent;
|
||||
|
||||
if (!client)
|
||||
return 0;
|
||||
|
||||
va_start (args, format);
|
||||
vsnprintf (buffer + 7, sizeof (buffer) - 7 - 1, format, args);
|
||||
va_end (args);
|
||||
|
||||
length = strlen (buffer + 7);
|
||||
snprintf (str_length, sizeof (str_length), "%07d", length);
|
||||
memcpy (buffer, str_length, 7);
|
||||
|
||||
num_sent = send (client->sock, buffer, length + 7, 0);
|
||||
|
||||
client->bytes_sent += length + 7;
|
||||
|
||||
if (num_sent < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: error sending data to client %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
strerror (errno));
|
||||
}
|
||||
|
||||
return num_sent;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_send_infolist: send infolist to client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_weechat_send_infolist (struct t_relay_client *client,
|
||||
const char *name,
|
||||
struct t_infolist *infolist)
|
||||
{
|
||||
const char *fields;
|
||||
char **argv;
|
||||
int i, argc, size;
|
||||
|
||||
relay_protocol_weechat_sendf (client, "name %s", name);
|
||||
|
||||
while (weechat_infolist_next (infolist))
|
||||
{
|
||||
fields = weechat_infolist_fields (infolist);
|
||||
if (fields)
|
||||
{
|
||||
argv = weechat_string_split (fields, ",", 0, 0, &argc);
|
||||
if (argv && (argc > 0))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
switch (argv[i][0])
|
||||
{
|
||||
case 'i':
|
||||
relay_protocol_weechat_sendf (client, "%s %c %d",
|
||||
argv[i] + 2, argv[i][0],
|
||||
weechat_infolist_integer (infolist,
|
||||
argv[i] + 2));
|
||||
break;
|
||||
case 's':
|
||||
relay_protocol_weechat_sendf (client, "%s %c %s",
|
||||
argv[i] + 2, argv[i][0],
|
||||
weechat_infolist_string (infolist,
|
||||
argv[i] + 2));
|
||||
break;
|
||||
case 'p':
|
||||
relay_protocol_weechat_sendf (client, "%s %c %lx",
|
||||
argv[i] + 2, argv[i][0],
|
||||
(long unsigned int)weechat_infolist_pointer (infolist,
|
||||
argv[i] + 2));
|
||||
break;
|
||||
case 'b':
|
||||
relay_protocol_weechat_sendf (client, "%s %c %lx",
|
||||
argv[i] + 2, argv[i][0],
|
||||
(long unsigned int)weechat_infolist_buffer (infolist,
|
||||
argv[i] + 2,
|
||||
&size));
|
||||
break;
|
||||
case 't':
|
||||
relay_protocol_weechat_sendf (client, "%s %c %ld",
|
||||
argv[i] + 2, argv[i][0],
|
||||
weechat_infolist_time (infolist, argv[i] + 2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_recv_one_msg: read one message from client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_weechat_recv_one_msg (struct t_relay_client *client, char *data)
|
||||
{
|
||||
char *pos;
|
||||
struct t_infolist *infolist;
|
||||
|
||||
pos = strchr (data, '\r');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
|
||||
if (weechat_relay_plugin->debug)
|
||||
{
|
||||
weechat_printf (NULL, "relay: weechat: \"%s\"", data);
|
||||
}
|
||||
|
||||
if (weechat_strcasecmp (data, "quit") == 0)
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
else
|
||||
{
|
||||
infolist = weechat_infolist_get (data, NULL, NULL);
|
||||
if (infolist)
|
||||
{
|
||||
relay_protocol_weechat_send_infolist (client, data, infolist);
|
||||
weechat_infolist_free (infolist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_recv: read data from client
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_weechat_recv (struct t_relay_client *client, const char *data)
|
||||
{
|
||||
char **items;
|
||||
int items_count, i;
|
||||
|
||||
items = weechat_string_split (data, "\n", 0, 0, &items_count);
|
||||
for (i = 0; i < items_count; i++)
|
||||
{
|
||||
relay_protocol_weechat_recv_one_msg (client, items[i]);
|
||||
}
|
||||
if (items)
|
||||
weechat_string_free_split (items);
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_alloc: init relay data specific to weechat protocol
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_weechat_alloc (struct t_relay_client *client)
|
||||
{
|
||||
struct t_relay_protocol_weechat_data *weechat_data;
|
||||
|
||||
client->protocol_data = malloc (sizeof (*weechat_data));
|
||||
if (client->protocol_data)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_free: free relay data specific to weechat protocol
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_weechat_free (struct t_relay_client *client)
|
||||
{
|
||||
if (client->protocol_data)
|
||||
free (client->protocol_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_protocol_weechat_print_log: print weechat client infos in log (usually
|
||||
* for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
relay_protocol_weechat_print_log (struct t_relay_client *client)
|
||||
{
|
||||
if (client->protocol_data)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_PROTOCOL_WEECHAT_H
|
||||
#define __WEECHAT_RELAY_PROTOCOL_WEECHAT_H 1
|
||||
|
||||
struct t_relay_client;
|
||||
|
||||
#define RELAY_WEECHAT_DATA(client, var) \
|
||||
(((struct t_relay_protocol_weechat_data *)client->protocol_data)->var)
|
||||
|
||||
struct t_relay_protocol_weechat_data
|
||||
{
|
||||
char *address; /* client address (used when sending */
|
||||
/* data to client) */
|
||||
char *nick; /* nick for client */
|
||||
int user_received; /* command "USER" received */
|
||||
int connected; /* 1 if client is connected as IRC */
|
||||
/* client */
|
||||
};
|
||||
|
||||
extern void relay_protocol_weechat_recv (struct t_relay_client *client,
|
||||
const char *data);
|
||||
extern void relay_protocol_weechat_alloc (struct t_relay_client *client);
|
||||
extern void relay_protocol_weechat_free (struct t_relay_client *client);
|
||||
extern void relay_protocol_weechat_print_log (struct t_relay_client *client);
|
||||
|
||||
#endif /* relay-protocol-weechat.h */
|
|
@ -0,0 +1,426 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* relay-server.c: server functions for relay plugin */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-server.h"
|
||||
#include "relay-buffer.h"
|
||||
#include "relay-client.h"
|
||||
#include "relay-config.h"
|
||||
|
||||
|
||||
struct t_relay_server *relay_servers = NULL;
|
||||
struct t_relay_server *last_relay_server = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* relay_server_get_protocol_string: get protocol and string from a string with
|
||||
* format "protocol.string"
|
||||
* Note: *protocol and *string must be freed
|
||||
* after use
|
||||
*/
|
||||
|
||||
void
|
||||
relay_server_get_protocol_string (const char *protocol_and_string,
|
||||
char **protocol, char **protocol_string)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
pos = strchr (protocol_and_string, '.');
|
||||
if (pos)
|
||||
{
|
||||
*protocol = weechat_strndup (protocol_and_string,
|
||||
pos - protocol_and_string);
|
||||
*protocol_string = strdup (pos + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*protocol = strdup (protocol_and_string);
|
||||
*protocol_string = strdup ("*");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_search: search server by protocol.string
|
||||
*/
|
||||
|
||||
struct t_relay_server *
|
||||
relay_server_search (const char *protocol_and_string)
|
||||
{
|
||||
char *protocol, *protocol_string;
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
relay_server_get_protocol_string (protocol_and_string,
|
||||
&protocol, &protocol_string);
|
||||
|
||||
ptr_server = NULL;
|
||||
|
||||
if (protocol && protocol_string)
|
||||
{
|
||||
for (ptr_server = relay_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if ((strcmp (protocol, relay_protocol_string[ptr_server->protocol]) == 0)
|
||||
&& (strcmp (protocol_string, ptr_server->protocol_string) == 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (protocol)
|
||||
free (protocol);
|
||||
if (protocol_string)
|
||||
free (protocol_string);
|
||||
|
||||
return ptr_server;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_search_port: search server by port
|
||||
*/
|
||||
|
||||
struct t_relay_server *
|
||||
relay_server_search_port (int port)
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
for (ptr_server = relay_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->port == port)
|
||||
return ptr_server;
|
||||
}
|
||||
|
||||
/* server not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_close_socket: close socket for a relay server
|
||||
*/
|
||||
|
||||
void
|
||||
relay_server_close_socket (struct t_relay_server *server)
|
||||
{
|
||||
if (server->hook_fd)
|
||||
{
|
||||
weechat_unhook (server->hook_fd);
|
||||
server->hook_fd = NULL;
|
||||
}
|
||||
if (server->sock >= 0)
|
||||
{
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
|
||||
weechat_printf (NULL,
|
||||
_("%s: socket closed for %s.%s (port %d)"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
relay_protocol_string[server->protocol],
|
||||
server->protocol_string,
|
||||
server->port);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_sock_cb: read data from a client which is connecting on socket
|
||||
*/
|
||||
|
||||
int
|
||||
relay_server_sock_cb (void *data, int fd)
|
||||
{
|
||||
struct t_relay_server *server;
|
||||
struct sockaddr_in client_addr;
|
||||
unsigned int client_length;
|
||||
int client_fd;
|
||||
char ipv4_address[INET_ADDRSTRLEN + 1], *ptr_address;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) fd;
|
||||
|
||||
server = (struct t_relay_server *)data;
|
||||
|
||||
client_length = sizeof (client_addr);
|
||||
memset (&client_addr, 0, client_length);
|
||||
|
||||
client_fd = accept (server->sock, (struct sockaddr *) &client_addr,
|
||||
&client_length);
|
||||
if (client_fd < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot accept client on port %d (%s.%s)"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
server->port,
|
||||
relay_protocol_string[server->protocol],
|
||||
server->protocol_string);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
ptr_address = NULL;
|
||||
if (inet_ntop (AF_INET,
|
||||
&(client_addr.sin_addr),
|
||||
ipv4_address,
|
||||
INET_ADDRSTRLEN))
|
||||
{
|
||||
ptr_address = ipv4_address;
|
||||
}
|
||||
|
||||
relay_client_new (client_fd, ptr_address, server);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_create_socket: create socket and server on port
|
||||
*/
|
||||
|
||||
int
|
||||
relay_server_create_socket (struct t_relay_server *server)
|
||||
{
|
||||
int set, max_clients;
|
||||
struct sockaddr_in server_addr;
|
||||
|
||||
server->sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (server->sock < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot create socket"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
set = 1;
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *) &set, sizeof (set)) < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot set socket option "
|
||||
"\"SO_REUSEADDR\""),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
set = 1;
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *) &set, sizeof (set)) < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: cannot set socket option "
|
||||
"\"SO_KEEPALIVE\""),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&server_addr, 0, sizeof(struct sockaddr_in));
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
server_addr.sin_port = htons (server->port);
|
||||
|
||||
if (bind (server->sock, (struct sockaddr *) &server_addr,
|
||||
sizeof (server_addr)) < 0)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: error with \"bind\" on port %d (%s.%s)"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
server->port,
|
||||
relay_protocol_string[server->protocol],
|
||||
server->protocol_string);
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
max_clients = weechat_config_integer (relay_config_network_max_clients);
|
||||
|
||||
listen (server->sock, max_clients);
|
||||
|
||||
weechat_printf (NULL,
|
||||
_("%s: listening on port %d (relay: %s.%s, max %d clients)"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
server->port,
|
||||
relay_protocol_string[server->protocol],
|
||||
server->protocol_string,
|
||||
max_clients);
|
||||
|
||||
server->hook_fd = weechat_hook_fd (server->sock,
|
||||
1, 0, 0,
|
||||
&relay_server_sock_cb,
|
||||
server);
|
||||
|
||||
server->start_time = time (NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_new: add a socket relaying on a port
|
||||
*/
|
||||
|
||||
struct t_relay_server *
|
||||
relay_server_new (enum t_relay_protocol protocol,
|
||||
const char *protocol_string,
|
||||
int port)
|
||||
{
|
||||
struct t_relay_server *new_server;
|
||||
|
||||
if (relay_server_search_port (port))
|
||||
{
|
||||
weechat_printf (NULL, _("%s%s: error: port \"%d\" is already used"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME, port);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_server = malloc (sizeof (*new_server));
|
||||
if (new_server)
|
||||
{
|
||||
new_server->protocol = protocol;
|
||||
new_server->protocol_string =
|
||||
(protocol_string) ? strdup (protocol_string) : strdup ("*");
|
||||
new_server->port = port;
|
||||
new_server->sock = -1;
|
||||
new_server->hook_fd = NULL;
|
||||
new_server->start_time = 0;
|
||||
|
||||
new_server->prev_server = NULL;
|
||||
new_server->next_server = relay_servers;
|
||||
if (relay_servers)
|
||||
relay_servers->prev_server = new_server;
|
||||
else
|
||||
last_relay_server = new_server;
|
||||
relay_servers = new_server;
|
||||
|
||||
relay_server_create_socket (new_server);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: not enough memory for listening on new port"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
}
|
||||
|
||||
return new_server;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_update_port: update port in a server
|
||||
*/
|
||||
|
||||
void
|
||||
relay_server_update_port (struct t_relay_server *server, int port)
|
||||
{
|
||||
if (port != server->port)
|
||||
{
|
||||
relay_server_close_socket (server);
|
||||
server->port = port;
|
||||
relay_server_create_socket (server);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_free: remove a server
|
||||
*/
|
||||
|
||||
void
|
||||
relay_server_free (struct t_relay_server *server)
|
||||
{
|
||||
struct t_relay_server *new_relay_servers;
|
||||
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
/* remove server from list */
|
||||
if (last_relay_server == server)
|
||||
last_relay_server = server->prev_server;
|
||||
if (server->prev_server)
|
||||
{
|
||||
(server->prev_server)->next_server = server->next_server;
|
||||
new_relay_servers = relay_servers;
|
||||
}
|
||||
else
|
||||
new_relay_servers = server->next_server;
|
||||
if (server->next_server)
|
||||
(server->next_server)->prev_server = server->prev_server;
|
||||
|
||||
/* free data */
|
||||
relay_server_close_socket (server);
|
||||
if (server->protocol_string)
|
||||
free (server->protocol_string);
|
||||
|
||||
free (server);
|
||||
|
||||
relay_servers = new_relay_servers;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_free_all: remove all servers
|
||||
*/
|
||||
|
||||
void
|
||||
relay_server_free_all ()
|
||||
{
|
||||
while (relay_servers)
|
||||
{
|
||||
relay_server_free (relay_servers);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_server_print_log: print server infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
relay_server_print_log ()
|
||||
{
|
||||
struct t_relay_server *ptr_server;
|
||||
|
||||
for (ptr_server = relay_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weechat_log_printf ("");
|
||||
weechat_log_printf ("[relay server (addr:0x%lx)]", ptr_server);
|
||||
weechat_log_printf (" protocol. . . . . . : %d (%s)",
|
||||
ptr_server->protocol,
|
||||
relay_protocol_string[ptr_server->protocol]);
|
||||
weechat_log_printf (" protocol_string . . : '%s'", ptr_server->protocol_string);
|
||||
weechat_log_printf (" port. . . . . . . . : %d", ptr_server->port);
|
||||
weechat_log_printf (" sock. . . . . . . . : %d", ptr_server->sock);
|
||||
weechat_log_printf (" hook_fd . . . . . . : 0x%lx", ptr_server->hook_fd);
|
||||
weechat_log_printf (" start_time. . . . . : %ld", ptr_server->start_time);
|
||||
weechat_log_printf (" prev_server . . . . : 0x%lx", ptr_server->prev_server);
|
||||
weechat_log_printf (" next_server . . . . : 0x%lx", ptr_server->next_server);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_SERVER_H
|
||||
#define __WEECHAT_RELAY_SERVER_H 1
|
||||
|
||||
struct t_relay_server
|
||||
{
|
||||
enum t_relay_protocol protocol; /* protocol (irc,..) */
|
||||
char *protocol_string; /* string used for protocol */
|
||||
/* example: server for irc protocol */
|
||||
int port; /* listening on this port */
|
||||
int sock; /* socket for connection */
|
||||
struct t_hook *hook_fd; /* hook for socket */
|
||||
time_t start_time; /* start time */
|
||||
struct t_relay_server *prev_server;/* link to previous server */
|
||||
struct t_relay_server *next_server;/* link to next server */
|
||||
};
|
||||
|
||||
extern struct t_relay_server *relay_servers;
|
||||
extern struct t_relay_server *last_relay_server;
|
||||
|
||||
extern void relay_server_get_protocol_string (const char *protocol_and_string,
|
||||
char **protocol,
|
||||
char **protocol_string);
|
||||
extern struct t_relay_server *relay_server_search (const char *protocol_and_string);
|
||||
extern struct t_relay_server *relay_server_search_port (int port);
|
||||
extern struct t_relay_server *relay_server_new (enum t_relay_protocol protocol,
|
||||
const char *protocol_string,
|
||||
int port);
|
||||
extern void relay_server_update_port (struct t_relay_server *server, int port);
|
||||
extern void relay_server_free (struct t_relay_server *server);
|
||||
extern void relay_server_free_all ();
|
||||
extern void relay_server_print_log ();
|
||||
|
||||
#endif /* relay-server.h */
|
|
@ -23,11 +23,13 @@
|
|||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-buffer.h"
|
||||
#include "relay-client.h"
|
||||
#include "relay-command.h"
|
||||
#include "relay-completion.h"
|
||||
#include "relay-config.h"
|
||||
#include "relay-info.h"
|
||||
#include "relay-network.h"
|
||||
#include "relay-server.h"
|
||||
#include "relay-upgrade.h"
|
||||
|
||||
|
||||
|
@ -42,6 +44,30 @@ struct t_weechat_plugin *weechat_relay_plugin = NULL;
|
|||
|
||||
int relay_signal_upgrade_received = 0; /* signal "upgrade" received ? */
|
||||
|
||||
char *relay_protocol_string[] = /* strings for protocols */
|
||||
{ "weechat", "irc" };
|
||||
|
||||
|
||||
/*
|
||||
* relay_protocol_search: search a protocol by name
|
||||
*/
|
||||
|
||||
int
|
||||
relay_protocol_search (const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RELAY_NUM_PROTOCOLS; i++)
|
||||
{
|
||||
if (weechat_strcasecmp (relay_protocol_string[i], name) == 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/* protocol not found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_signal_upgrade_cb: callback for "upgrade" signal
|
||||
|
@ -80,6 +106,7 @@ relay_debug_dump_cb (void *data, const char *signal, const char *type_data,
|
|||
weechat_log_printf ("***** \"%s\" plugin dump *****",
|
||||
weechat_plugin->name);
|
||||
|
||||
relay_server_print_log ();
|
||||
relay_client_print_log ();
|
||||
|
||||
weechat_log_printf ("");
|
||||
|
@ -110,13 +137,14 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
|||
|
||||
relay_command_init ();
|
||||
|
||||
/* hook completions */
|
||||
relay_completion_init ();
|
||||
|
||||
weechat_hook_signal ("upgrade", &relay_signal_upgrade_cb, NULL);
|
||||
weechat_hook_signal ("debug_dump", &relay_debug_dump_cb, NULL);
|
||||
|
||||
relay_info_init ();
|
||||
|
||||
relay_network_init ();
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
|
@ -132,12 +160,19 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
|||
|
||||
relay_config_write ();
|
||||
|
||||
relay_network_end ();
|
||||
|
||||
if (relay_signal_upgrade_received)
|
||||
relay_upgrade_save ();
|
||||
else
|
||||
{
|
||||
/* remove all servers */
|
||||
relay_server_free_all ();
|
||||
|
||||
/* remove all clients */
|
||||
relay_client_disconnect_all ();
|
||||
if (relay_buffer)
|
||||
weechat_buffer_close (relay_buffer);
|
||||
relay_client_free_all ();
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
|
|
@ -25,4 +25,22 @@
|
|||
|
||||
extern struct t_weechat_plugin *weechat_relay_plugin;
|
||||
|
||||
/* relay protocol */
|
||||
|
||||
enum t_relay_protocol
|
||||
{
|
||||
RELAY_PROTOCOL_WEECHAT = 0, /* WeeChat protocol */
|
||||
RELAY_PROTOCOL_IRC, /* IRC protocol (IRC proxy) */
|
||||
/* number of relay protocols */
|
||||
RELAY_NUM_PROTOCOLS,
|
||||
};
|
||||
|
||||
#define RELAY_COLOR_CHAT weechat_color("chat")
|
||||
#define RELAY_COLOR_CHAT_HOST weechat_color("chat_host")
|
||||
#define RELAY_COLOR_CHAT_BUFFER weechat_color("chat_buffer")
|
||||
|
||||
extern char *relay_protocol_string[];
|
||||
|
||||
extern int relay_protocol_search (const char *name);
|
||||
|
||||
#endif /* relay.h */
|
||||
|
|
Loading…
Reference in New Issue