Конфиг:mcabber: различия между версиями

Материал из Linux Wiki
Перейти к навигацииПерейти к поиску
 
(не показана 1 промежуточная версия этого же участника)
Строка 515: Строка 515:
         (list-ref (command-line) n)))
         (list-ref (command-line) n)))


(define DISPLAY "DISPLAY=:0.0 ")
(define NOTIFY "notify-send -i /usr/share/icons/nuovext/32x32/actions/info.png -c 'im.received'")
(define NOTIFY "notify-send")
(define MSG_INC "Пришло сообщение от")  
(define MSG_INC "Пришло сообщение от")  
(define MSG_MUC "Пришло сообщение в ")  
(define MSG_MUC "Пришло сообщение в ")  
Строка 527: Строка 526:


(define (notify header text)
(define (notify header text)
     (define p (open-input-pipe (string-append DISPLAY NOTIFY " '" header "' '" text "'")))
     (define p (open-input-pipe (string-append NOTIFY " '" header "' '" text " '")))
     (close-pipe p))
     (close-pipe p))


Строка 539: Строка 538:
      
      
(define (process-msg msg-type buddy filename)
(define (process-msg msg-type buddy filename)
   (cond ((string=? msg-type "IN") (notify (string-append MSG_INC " " buddy) (file-contents filename)))
   (cond ((string=? msg-type "IN") (notify (string-append MSG_INC " " buddy) (file-contents filename))))
        ((string=? msg-type "MUC") (notify (string-append MSG_MUC " " buddy) (file-contents filename)))))
  (delete-file filename))
;        ((string=? msg-type "MUC") (notify (string-append MSG_MUC " " buddy) (string-append (file-contents filename) "test")))))


(define (process-status status buddy)
(define (process-status status buddy)
Строка 547: Строка 547:
(cond ((string=? event "MSG") (process-msg arg1 arg2 filename))
(cond ((string=? event "MSG") (process-msg arg1 arg2 filename))
       ((string=? event "STATUS") (process-status arg1 arg2)))
       ((string=? event "STATUS") (process-status arg1 arg2)))
</source>
</source>




[[Category:Конфиг-файл]]
[[Category:Конфиг-файл]]

Текущая версия на 09:51, 31 августа 2009

собственно сам

файл конфигурации

~/.mcabber/mcabberrc
# Пример файла ~/.mcabber/mcabberrc

# Особенности синтаксиса этого файла:
# - Пробелы в начале и середине строки игнорируются.
# - Пустые линии и линии, начинающиеся с '#' игнорируются.

# Jabber ID будет такой: username@server
# Если доменное имя в Вашем JID отличается от названия сервера,
# Вы можете указать Ваш полный JID в параметре username.
#
# Если пароль не указан, он будет запрошен интерактивно.
# Если не указан порт, будет использоваться порт по умолчанию.
#
# Предупреждение для пользователей Google Talk! Читайте FAQ:
# <http://wiki.mcabber.com/index.php/Frequently_Asked_Questions>

set username = vasya_pupkin@jabber.ru
# Замечание: если пароль содержит пробелы, то 
# заключите его в кавычки: set password = " example password "
set password = SECRET
#set server = allports.jabber.ru
set server = jabber.ru
#set port = 443
set port = 5222
# Если не знаете, что такое "ресурс" - не задавайте его.
#set resource = mcabber
set priority = 10
set priority_away = 5

# Установите 'ignore_self_presence' равным 1, если Вы не хотите видеть собственный
# статус в ростере (по умолчанию: 0).
set ignore_self_presence = 1

# Параметры SSL:
# Установите "ssl" не равным 0 для использования SSL
# (также это устанавливает значение port по умолчанию равным 5223).
# * Имейте в виду, что проверка сертификата НЕ поддерживается, если
#   mcabber был собран с GnuTLS (работает только с OpenSSL).
#   Используйте "mcabber -V" для проверки.
# Установите ssl_verify равным 0 для отключения проверки сертификата, или не равным нулю
# для задания желаемой максимальной глубины проверки CA. Используйте -1 для задания
# неограниченной глубины проверки.
# Укажите в ssl_cafile путь к файлу CA сертификата (он может содержать несколько CA-сертификатов)
# Укажите в ssl_capath путь к каталогу CA сертификатов (используйте c_rehash для создания хэшей).
# Задайте в ssl_ciphers список желаемых алгоритмов шифрования в SSL (выполните "openssl ciphers"
# для просмотра доступных вариантов).
set ssl = 0
#set ssl_verify = -1
#set ssl_cafile = /usr/share/ssl/certs/ca-bundle.crt
#set ssl_capath =
#set ssl_ciphers =

# Поддержка PGP
# Задайте pgp равным 1 для включения OpenPGP.
# Для подписывания исходящих сообщений укажите идентификатор Вашего закрытого ключа
# в параметре pgp_private_key. Вы не можете менять это значение во время работы mcabber.
# Вы можете получить идентификатор ключа, используя gpg: "gpg --list-keys --keyid-format long"
#set pgp = 0
#set pgp_private_key = "C9940A9BB0B92210"
#
# Вы можете указать тут свой пароль для PGP, но это НЕ рекомендуется.
#set pgp_passphrase = "PGPpassword"
#
# Если Вас не устраивает количество попыток ввода пароля PGP по умолчанию (2), Вы
# можете изменить этот параметр здесь. Если число меньше 0, mcabber будет спрашивать пароль
# до тех пор, пока не будет введен правильный.
#pgp_passphrase_retries = 2

# Ник в конференции
# Этот ник используется при входе в конференцию, если он не был указан 
# во время подключения пользователем. Учтите, что если параметр не задан,
# то в качестве ника используется значение переменно username
#set nickname = Abitbol

# Прокси
# mcabber может использовать прокси, если тот поддерживает метод CONNECT
# Параметры proxy_user/proxy_pass не обязательны.
#set proxy_host = "127.0.0.1"
#set proxy_port = 3128
#set proxy_user = "username"
#set proxy_pass = "password"

# Keepalive
# Если Вам нужен ping/keepalive для поддержания Вашего сетевого соединения,
# используйте pinginterval. Установка этого параметра равным 0 отключает ping.
# Значение по умолчанию равно 40 секунд.
#set pinginterval = 40

# Язык
# Файлы справки были переведены на разные языки.
# Вы можете указать в lang одно из следующих значений: en (по умолчанию),
# de, fr, it, nl, pl, ru, uk.
set lang = ru

# Проверка орфографии
# Если Ваш mcabber был собран с поддержкой Aspell, Вы можете включить проверку
# орфографии следующими параметрами (Вы не можете менять параметры во время работы
# mcabber).
set aspell_enable = 1
set aspell_lang = ru_RU
#set aspell_encoding = iso8859-1
set aspell_encoding = UTF-8

# История команд
# Количество строк для запоминания истории ввода команд
# (по умолчанию: 0, не ограничено).
set cmdhistory_lines = 250

# Вы можете указать маску для сортировки собеседников в ростере в зависимости
# от их статуса. Маска должна содержать специальные символы, ссылающиеся на
# необходимые статусы ([o]nline, [f]ree_for_chat, [d]o_not_disturb,
# [n]ot_available, [a]way, [_]offline).
# Например, для отображения всех пользователей маска должна содержать "ofdna_" (значение по умолчанию).
# Для отображения подключенных собеседников укажите "ofdna".
# Имейте в виду, что этот параметр используется только при подключении (после запуска mcabber
# используйте "/roster display").
#set roster_display_filter = ofdna_

# Уведомления о печати, состояния чата, события (JEP-22/85)
# Установите disable_chatstates равным 1 если Вы не хотите использовать уведомления о печати.
# Замечание: изменение опции во время работы mcabber не дает эффекта.
#set disable_chatstates = 0

# История сообщений
# Для сохранения истории переписки установите set logging = 1
# Установите 'logging_ignore_status' равным 1, если Вы не хотите сохранять изменения статуса
# (а также статусные сообщения) в истории переписки (по умолчанию: 0).
# Для загрузки истории переписки задайте set load_logs = 1
# Параметр load_logs по умолчанию равен 0 (отключен)
# Если Вы включили load_logs, то можете использовать параметр 'max_history_age'.
# Каталог для сохранения истории (параметр logging_dir) по умолчанию $HOME/.mcabber/histo/
# Замечание: если Вы включили сохранение истории переписки, каталог должен существовать, mcabber
#       не создает его.
# Замечание: все параметры, кроме 'max_history_age' и 'max_history_blocks',
# читаются только при запуске.
set logging = 1
set load_logs = 1
set logging_dir = ~/.mcabber/histo/
set logging_ignore_status = 1

# Задайте log_muc_conf равным 1 для включения сохранения переписки в MUC (конференциях) (по умолчанию = 0)
#set log_muc_conf = 1
# Set load_muc_logs to 1 to read MUC chatrooms logs (default = 0).  These
# logs will be displayed in the buffer window _before_ any history received
# from the server.
#set load_muc_logs = 0

# When load_logs (or load_muc_logs) is enabled, you can specify a maximum
# number of history days to load into memory with max_history_age.
# Default = 0 (disabled -- everything is loaded)
# Note: this option is only used when reading history files, not later.
#set max_history_age = 0

# mcabber can store the list of unread messages in a state file,
# so that the message flags are set back at next startup.
# Note that 'logging' must be enabled for this feature to work.
set statefile = ~/.mcabber/mcabber.state

# You can specify a maximum number of data blocks per buffer (1 block contains
# about 8kB).  The default is 0 (unlimited).  If set, this value must be > 2.
#set max_history_blocks = 8

# IQ settings
# Set iq_version_hide_os to 1 if you do not want to allow people to retrieve
# your OS version.
#set iq_version_hide_os = 0
#
# Set iq_last_disable to 1 if you want to disable response to jabber:iq:last
# queries (XEP-0012).  Set iq_last_disable_when_notavail to 1 if you want
# to disable Last Activity reports only when the not-available status is set.
# (Default is 0 for both options)
#set iq_last_disable = 0
#set iq_last_disable_when_notavail = 1

# Beep
# Set beep_on_message to 1 if you want mcabber to beep when receiving
# a new message (except in chatrooms).  If you want a more sophisticated
# system (e.g. play a sound), have a look at 'events_command' below.
#set beep_on_message = 0

# External command for events
# You can specify a script or process to be launched when an event occurs.
# Set 'events_ignore_active_window' to 1 if you don't want the script to
# be run for a message to the current active window (default: 0).
#
# If 'event_log_files' is set, a file is created and contains the body of
# the message (incoming messages only); the file name is the last parameter.
# If you enable this, you can specify the directory mcabber will use to
# create these messages with the 'event_log_dir' variable (default is the
# system temp dir, or MCABBERTMPDIR environment variable).  Please note
# that mcabber won't delete these files, it's your script's job.
#
# The command is called the following way:
#   $events_command MSG IN jabber@id [file] (when receiving a message)
#   $events_command MSG OUT jabber@id       (when sending a message)
#   $events_command MSG MUC room_id [file]  (when receiving a MUC message)
#   $events_command STATUS X jabber@id      (new buddy status is X)
#   $events_command UNREAD N                (number of unread buddy buffers)
# See sample script in contrib/ directory.
set events_command = ~/.mcabber/eventcmd
#
#set events_ignore_active_window = 0
#
set event_log_files = 1
set event_log_dir = ~/.mcabber/event_files

# If you set 'eventcmd_use_nickname' to 1, mcabber will pass the nickname
# (if it is defined) to the event script instead of the JID (default: 0).
#set eventcmd_use_nickname = 0

# External command status check
# You can request mcabber to inspect exit status value after each
# events_command.  If this option is set, mcabber will beep if the
# exit value is 2.
#set eventcmd_checkstatus = 0

# Internal hooks
# You can ask mcabber to execute an internal command when a special event
# occurs (for example when it connects to the server).
#
# 'hook-post-connect' is executed when mcabber has connected to the server
# and the roster has been received.
#set hook-post-connect = status dnd
#
# 'hook-pre-disconnect' is executed just before mcabber disconnects from
# the server.
#set hook-pre-disconnect = say_to foo@bar Goodbye!

# FIFO
# mcabber can create a FIFO named pipe and listen to this pipe for commands.
# (The FIFO support has to be compiled in.)  Default: disabled.
# Set fifo_hide_commands to 1 if you don't want to see the FIFO commands
# in the log window (they will still be written to the tracelog file).
#set fifo_name = ~/.mcabber/mcabber.fifo
#set fifo_hide_commands = 0

# Traces logging
# If you want advanced traces, please specify a file and a level here.
# There are currently 2 traceloglog levels:
#  lvl 1: most events of the log window are written to the file
#  lvl 2: debug logging (XML, etc.)
# Default is level 0, no trace logging
#set tracelog_level = 1
#set tracelog_file = ~/.mcabber/mcabber.log

# Set the auto-away timeout, in seconds.  If set to a value >0,
# mcabber will change your status to away if no real activity is detected
# (command, message, move in the buddylist...).  Note: auto-away only changes
# the status when it is "available" (online) or "free_for_chat".
# See 'message_autoaway' below.
#set autoaway = 0

# Message blocking
# Set 'block_unsubscribed' to 1 if you want to block (drop) incoming
# messages from people you haven't authorized. (default: 0)
#set block_unsubscribed = 0
#
# Set 'delete_on_reject' to 1 if you want to delete buddies from your
# roster when you reject their subscription request. (default: 0)
# (See documentation for /event)
# The buddy is actually deleted only if there is no other subscription,
# so for example if you are subscribed to this buddy's presence updates it
# won't be deleted.
#set delete_on_reject = 0

# MUC
# Set 'muc_flag_joins' to 1 if you want the MUC rooms to be flagged in
# the roster when somebody joins a room.  Set it to 2 if you want a flag
# for leaves too.
#set muc_flag_joins = 0
# Set 'muc_print_status' to see status changes in MUC rooms:
# 1: (none)       do not display joining/leaving members
# 2: (in_and_out) display joining/leaving members
# 3: (all)        display joining/leaving members and member status changes
# (default: in_and_out)
#set muc_print_status = 2
# Set 'muc_auto_whois' to 1 if you want to call /room whois each time
# somebody joins a room. (default: 0)
#set muc_auto_whois = 0
#
# Set 'muc_disable_nick_hl' to 1 if you don't want mcabber to color lines
# containing your nickname in a MUC room.
#set muc_disable_nick_hl = 0

# Status messages
# The "message" value will override all others, take care!
#set message = Unique message status
#set message_avail     = I'm available
#set message_free      = I'm free for chat
#set message_dnd       = Please do not disturb
#set message_notavail  = I'm not available
#set message_away      = I'm away
#
# The auto-away message is only used when 'autoaway' is set.  The previous
# message will be restored when leaving auto-away status.  If this message
# isn't defined, the status message will stay unchanged.
set message_autoaway = Я куда-то отошёл...

# Escape timeout delay (ESCDELAY)
# The ESCDELAY variable specifies the time, in milliseconds, for which
# the ncurses interface will await a character sequence.
# The default is 1000 (1 second).
# If you want mcabber to react faster after hitting Escape, you can lower
# this value by setting the ESCDELAY environment variable or setting the
# 'escdelay' option.
set escdelay = 50

# Colors
# Colors are: black, red, green, yellow, blue, magenta, cyan, white
# For text colors (i.e. not background and bg* colors) you can also use
# the "bright" prefix to get a bright/bold color.  Example: brightblue
# You can use the "default" color, too (i.e. for transparent background).
# If your terminal supports 256 colors, you can use the color number
# directly (16-255).
#
# Have a look at the contrib/themes/ directory to see some sample
# color settings.
#
# background: background color of the chat window and the log window
# general:    text color in the chat window and the log window
# info:       text color in the chat window for info messages
# msgin:      text color in the chat window for incoming messages
# msgout:     text color in the chat window for outgoing messages
# msghl:      text color in the chat window for highlighted messages (MUC)
# bgstatus:   background color of the status lines
# status:     text color of the status lines
# roster:     text color of the roster (buddylist) normal items
# bgrostersel: background color of the selected roster item
# rostersel:   text color of the selected roster item
# rosterselmsg:text color of the selected roster item, if there is a new msg
# rosternewmsg: text color of items with unread messages
#
set color_background   = default
#set color_general      = white
#set color_info         = white
set color_msgin        = white
set color_msgout       = green
set color_msghl        = green
set color_bgstatus     = white
set color_status       = black
#set color_roster       = green
set color_bgrostersel  = blue
set color_rostersel    = white
#set color_rosterselmsg = red
#set color_rosternewmsg = red

#You can color roster items by their status and JID. For example, to have all
#roster items white, just all contacts from jabber.org that are away, not
#available or do not disturb yellow, you do this:
#
color roster * * white
color roster of * brightwhite
color roster * *@conference* brightwhite
color roster an * yellow
color roster d * brightred

#You can let mcabber color nicks in MUC.
#These colors will by used automatically:
set nick_colors = green brightred magenta brightgreen brightyellow yellow brightgreen
#This turns coloring of all mucs on
color muc * on
#
#If you want someone's nick to be the same all the time:
#color mucnick my_friend yellow

# Style
# Note: the "log_win_height" and "roster_width" values below can be set
# in real time when mcabber is running.  Refresh the screen (Ctrl-l) to
# use the new values.
#
# Log window height (minimum 1, default 5)
#set log_win_height = 5
# Buddylist window width (minimum 2, default 24)
#set roster_width=24
#
# The options "log_win_on_top" and "roster_win_on_right" can change the
# position of the log window (top/bottom) and the position of the roster
# (left/right).
#set log_win_on_top = 0
#set roster_win_on_right = 0
#
# By default, the displayed name of a contact in the roster window will
# be the jid if no name has been specified.  You can use the following
# option if you only want to see the username part.
#set roster_hide_domain = 0
#
# Buddy name format (in status window):
# - 0: (default) "<jid/resource>"
# - 1: "name <jid/resource>" (name is omitted if same as the jid)
# - 2: "name/resource" (if the name is the same as the jid, use <jid/res>)
# - 3: "name" (if the name is the same as the jid, use <jid/res>)
#set buddy_format = 2
#
# Time format:
# - 0: (default) Date and time
# - 1: Time only
# - 2: None
set time_prefix = 1
#
# When a contacts sends "/me ", mcabber displays "*user ", where user
# is the local part of the contact's jid.
# If you want mcabber to display the complete bare jid (user@server.com),
# set "buddy_me_fulljid" to 1 (default: 0)
#set buddy_me_fulljid = 1
#
# Display the status changes in the log window (default: 0, never)
# Set 'log_display_presence' to 1 to enable.
#set log_display_presence = 0
#
# Display the status changes in the chat buffers (default: 0, never)
# Values:  0: never  1: only connect/disconnect  2: all
#set show_status_in_buffer = 1
#
# Set "log_display_sender" to 1 to display the message sender's jid in the
# log window (default: 0, no)
#set log_display_sender = 0

# Contacts PGP information
# You can provide a PGP key to be used for a given Jabber user, or
# disable PGP on a per-account basis.
# If you provide a KeyId for a contact, it will be compared to the key the
# contact uses to sign their presence/messages and it will be used for
# all outgoing encrypted messages (that is, the contact signature key will
# be ignored).
# Please note that the key must match exactly the id seen with /info.
#pgp disable foo@bar.org
#pgp setkey bar@foo.net C9940A9BB0B92210

# OTR (Off-The-Record messaging) support
# (Only available if mcabber is built with OTR support)
# Set otr to 1 to enable OTR support.
# You cannot change this option once mcabber is running.
#set otr = 0
#
# OTR directory
# You can specify the OTR directory with the otr_dir option
# (default = ~/.mcabber/otr/).
set otr_dir = "~/.mcabber/otr/"

# Aliases
alias me = say /me
alias online   = status online
alias away     = status away
alias dnd      = status dnd
alias notavail = status notavail
alias names = room names
alias join = room join
alias topic = room topic
alias rs = roster search

# Key bindings
# Ctlr-q (17) bound to /roster unread_next
bind 17 = roster unread_next
bind 10 = room join
# Ctlr-x (24) bound to /roster alternate
bind 24 = roster alternate
# F5 (269) bound to /roster toggle_offline  (centericq-like, IIRC)
bind 269 = roster toggle_offline
# F12 (276) bound to /roster toggle
bind 276 = roster toggle
# Ctrl-Up/Ctrl-Down bound to /buffer up/down  (like Ctrl-p/Ctrl-n)
bind 521 = buffer up
bind 514 = buffer down
bind MU1081 = roster alternate
bind M113 = roster alternate
#rebind ctrl-p/n 
bind 16 = roster up
bind 14 = roster down
#bind alt-p/n prev/next group)
bind MU1079 = roster group_prev
bind M112 = roster group_prev
bind MU1090 = roster group_next
bind M110 = roster group_next
#ctrl/meta-v to scroll screens
bind MU1084 = buffer up
bind M118 = buffer up
bind 22 = buffer down
#ctrl-b/f
bind 2 = iline bchar
bind 6 = iline fchar
#meta-b/f ru
bind MU1080 = iline bword
bind MU1072 = iline fword

и

скрипт обработки событий

~/.mcabber/eventcmd


требуются notification-daemon, libnotify-bin, guile

не забываем создать директории ~/.mcabber/event_files и ~/.mcabber/histo


#!/usr/bin/guile -s
!#

(use-modules (ice-9 popen))
(use-modules (ice-9 rw))

(define argc
    (length (command-line)))
(define (argv n)
    (if (>= n argc)
        ""
        (list-ref (command-line) n)))

(define NOTIFY "notify-send -i /usr/share/icons/nuovext/32x32/actions/info.png -c 'im.received'")
(define MSG_INC "Пришло сообщение от") 
(define MSG_MUC "Пришло сообщение в ") 
(define MSG_STATUS "сменил статус на") 

(define event (argv 1))
(define arg1 (argv 2))
(define arg2 (argv 3))
(define filename (argv 4))

(define (notify header text)
    (define p (open-input-pipe (string-append NOTIFY " '" header "'  '" text " '")))
    (close-pipe p))

(define (file-contents file)
  (call-with-input-file file
    (lambda (p)
      (let* ((size (stat:size (stat p)))
             (buf (make-string size)))
        (read-string!/partial buf p)
        buf))))
    
(define (process-msg msg-type buddy filename)
  (cond ((string=? msg-type "IN") (notify (string-append MSG_INC " " buddy) (file-contents filename))))
  (delete-file filename))
;        ((string=? msg-type "MUC") (notify (string-append MSG_MUC " " buddy) (string-append (file-contents filename) "test")))))

(define (process-status status buddy)
    (notify (string-append buddy " " MSG_STATUS  " " status) ""))

(cond ((string=? event "MSG") (process-msg arg1 arg2 filename))
      ((string=? event "STATUS") (process-status arg1 arg2)))