mirror of
https://github.com/weechat/weechat.git
synced 2026-06-15 15:44:47 +02:00
Compare commits
400 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f46617b11 | |||
| 68ec2acbb3 | |||
| e7041a467b | |||
| ee2121b917 | |||
| bff5f95056 | |||
| 2b178c73fa | |||
| 13d8a4f093 | |||
| b935a02ceb | |||
| e7c899014c | |||
| f88b75b241 | |||
| c8ad30020b | |||
| c6fc8bd147 | |||
| eda55fbdb4 | |||
| dca4064502 | |||
| 8a3d30b03a | |||
| 40d02fdffd | |||
| 7cc2635652 | |||
| df2f164ffc | |||
| eb0b722ee5 | |||
| 04d6257224 | |||
| 73c69d2d71 | |||
| 2f9f37bed6 | |||
| d90587c443 | |||
| 992632857f | |||
| 5ebab583f6 | |||
| ca117dbb24 | |||
| 40c348df7a | |||
| 0b781f96f7 | |||
| 5090689a76 | |||
| a92ca4961b | |||
| ae8a4633ef | |||
| 38505d02dd | |||
| 20dcc4f56e | |||
| 36b2e10497 | |||
| cec88e0047 | |||
| 3198879ff2 | |||
| 88a6fc7f16 | |||
| fbcd5b3673 | |||
| 7fe5afe3cb | |||
| 212ca071c6 | |||
| f5074da156 | |||
| a23af790df | |||
| 6d1d1a7b90 | |||
| 0b78294f1a | |||
| 2580406aa7 | |||
| bbd4011020 | |||
| 1524432007 | |||
| 09242c3ba6 | |||
| bba97304a0 | |||
| 32851b7758 | |||
| 4322501ebd | |||
| 39d14185a1 | |||
| c3f5e88286 | |||
| 89c311646f | |||
| bcd4623a6d | |||
| 8270b50548 | |||
| 6e253245fe | |||
| 47d03e7dee | |||
| 9fbd33faaf | |||
| 5301c75021 | |||
| 7f165b4c7c | |||
| 9526e4a79d | |||
| 2b79d0fe5c | |||
| de43c7984a | |||
| f78eb88e5a | |||
| 4b5b5354da | |||
| ac446e9c1f | |||
| 951ec2e7be | |||
| bce7a0e961 | |||
| 7433015842 | |||
| 57daa68be5 | |||
| d310a8e960 | |||
| 4281d09a95 | |||
| 7dedba18bf | |||
| 90e4e34f8c | |||
| 12026ef17e | |||
| 46234f0504 | |||
| 4d4d697b17 | |||
| 3686d92cb5 | |||
| 64c33a8295 | |||
| 7596736ae9 | |||
| 8f55d297e6 | |||
| 5238dba084 | |||
| 81e700ea43 | |||
| a13f301d49 | |||
| 575565371b | |||
| 24d0c49ae4 | |||
| 559b651669 | |||
| 6199f9b629 | |||
| 6e60c95056 | |||
| 73f6606771 | |||
| e3088336ab | |||
| 3e81666752 | |||
| 6d0be7db4b | |||
| 5cdcfdebb7 | |||
| ca50f2c8fc | |||
| 84f84823c9 | |||
| 0d21ca207d | |||
| 235d96d728 | |||
| 58417dddc6 | |||
| b3d66118b4 | |||
| 0473d2c8db | |||
| 34ce958df9 | |||
| dfc1c0370d | |||
| 89d9fb641e | |||
| a55da76244 | |||
| e90e206b35 | |||
| 8ede80b2b6 | |||
| 1af0359046 | |||
| 9c67fdf3ea | |||
| 0c695733b3 | |||
| df4ed3eeba | |||
| 85bd530a88 | |||
| 8921e45815 | |||
| 74b83e5294 | |||
| 4fa9edeb56 | |||
| 4d3e76eb3e | |||
| c48ee3cd73 | |||
| 9a7b7af41c | |||
| 7debba0eca | |||
| a0255a0a3a | |||
| 159fa3d806 | |||
| 07686bf69b | |||
| f877e8be51 | |||
| 757d00ab48 | |||
| ecb6ed6707 | |||
| 9d0b6fad72 | |||
| 63d6ee1007 | |||
| 6a1230de54 | |||
| 684f43298e | |||
| 26af7b49fd | |||
| 1ee8e1edb2 | |||
| a5bbd513b7 | |||
| 88930e50dd | |||
| 555999534e | |||
| 64601fc662 | |||
| d8360af103 | |||
| 55c042d604 | |||
| 6d3c24361d | |||
| 2f5c9a8fd4 | |||
| 96fc2c9aec | |||
| aca19813ad | |||
| 7dbaec1abf | |||
| 3b05b6bafe | |||
| 82265b629b | |||
| a3e3113e4e | |||
| b2c5317e17 | |||
| 9adb547b36 | |||
| 14e833c257 | |||
| de5af8a3b1 | |||
| 37a2f80fae | |||
| 0f95a48854 | |||
| 39b5f07d6f | |||
| f4f2ec3668 | |||
| 486e55be02 | |||
| c35f841b58 | |||
| 209fe89d27 | |||
| fca4840c4a | |||
| 97ef63e2e6 | |||
| 17b409afe8 | |||
| bf4bcd3b8c | |||
| 5233063825 | |||
| 9eeece2ccb | |||
| 9e8f42c141 | |||
| 996343fc1d | |||
| ecafff21ce | |||
| cf9d394e3a | |||
| 0955167b6b | |||
| 2b96cacd51 | |||
| 45f7cdda18 | |||
| dcf0119264 | |||
| c98365803d | |||
| ebcf17c78d | |||
| 022bf4d070 | |||
| d37ec4791c | |||
| e5038b4119 | |||
| 482d327562 | |||
| cb5269404c | |||
| 76c4d4d427 | |||
| 34c6051ffc | |||
| e69afa1401 | |||
| 2a227141c4 | |||
| 7ef14b95b6 | |||
| 4e5f1698ba | |||
| 0a6945b6ed | |||
| 046452b7e0 | |||
| d79dc3233a | |||
| ce7f24ecc1 | |||
| 0f718bf2c0 | |||
| a9e05f57ee | |||
| 24508e733c | |||
| 9f5c71ca98 | |||
| 491dff4238 | |||
| 7b84ab4b71 | |||
| c656661812 | |||
| 6753591f86 | |||
| 4e8ed66a1e | |||
| 0e47caf091 | |||
| 6100af949b | |||
| 4b3d25175f | |||
| b3fd00fc23 | |||
| 1484e17ce1 | |||
| 9759d72d3d | |||
| 92eb995917 | |||
| 1425ee40f4 | |||
| c8eae742b9 | |||
| 441dd2313f | |||
| aea603b6ed | |||
| 9c6f2fcb8c | |||
| 74ee53c102 | |||
| 649fd216ed | |||
| 9278198964 | |||
| 2ff30b15f2 | |||
| c94e1204aa | |||
| 2d438492d7 | |||
| 8959ba9759 | |||
| b9e5c94032 | |||
| 4c660ad565 | |||
| ab393805fb | |||
| dea586e5f1 | |||
| e1afa31563 | |||
| 750a5cbc6d | |||
| 77fab4ae29 | |||
| 622a18fb3f | |||
| 97b34b36fc | |||
| fb21a1c7f9 | |||
| f02ba717a0 | |||
| 9e6938bdf7 | |||
| b9a40bbe21 | |||
| 062e5ea1ae | |||
| 66ff97166f | |||
| 095f296529 | |||
| 340176d635 | |||
| fed6c36d19 | |||
| 3f84a8456a | |||
| fc95f86528 | |||
| d7287a71e5 | |||
| b861403369 | |||
| d8a790e8eb | |||
| 9211a67fb4 | |||
| d0babb2896 | |||
| ad345c0bce | |||
| 3b7b459522 | |||
| a99e6f3d95 | |||
| 35d6c43f85 | |||
| db235b23fa | |||
| a4ed5069c1 | |||
| 0bd38072f2 | |||
| 81da0f41d7 | |||
| 070e1b6ec7 | |||
| 4e86ff9682 | |||
| 867b881bac | |||
| 2c31a11aeb | |||
| 1d2a83b055 | |||
| 915ea408f0 | |||
| c9a469f51b | |||
| 69cb87251e | |||
| 8bcbc3dcae | |||
| dcb3b6fc7e | |||
| 16717f8322 | |||
| dc38b59849 | |||
| 7d91cdcbb3 | |||
| 885fe7434f | |||
| 84677f2835 | |||
| c20a3fdfa4 | |||
| f97a5555ca | |||
| 59bd0b825d | |||
| 38bf163c17 | |||
| 09a36a5d8e | |||
| 10f0236ea9 | |||
| 6d7afb96c1 | |||
| 48941e3646 | |||
| 72cb070ee4 | |||
| 390a097718 | |||
| f4733b970a | |||
| b80086cfac | |||
| 984eaaf826 | |||
| 0dddf86ab7 | |||
| c057937c7b | |||
| 938cc50f5e | |||
| aac1a0a08c | |||
| b77e441dc4 | |||
| f9279df092 | |||
| d84b1fa58f | |||
| 12941227d7 | |||
| 25f79c7bba | |||
| ac3f6dfa7b | |||
| 65704c6fea | |||
| 85c32048cf | |||
| ffbc4c0b0c | |||
| 4e138f3dca | |||
| df66856a28 | |||
| 6950745079 | |||
| 3b6bf81ad6 | |||
| fd3e94070a | |||
| 0708f1a571 | |||
| 3ea696bbc0 | |||
| 57e00428ca | |||
| 555a4191d4 | |||
| a1f09df80f | |||
| c8c5ff3d68 | |||
| e2e384df49 | |||
| 507a5c17c0 | |||
| 4f23a3c621 | |||
| ba618d3276 | |||
| 2f1af3b53e | |||
| 10a170bf7d | |||
| 7a3ee901a4 | |||
| e469f0ef48 | |||
| ba65f5ec30 | |||
| 7779b2f78e | |||
| edcc01bcf0 | |||
| fe4ca01615 | |||
| 62fabde373 | |||
| 8758555b19 | |||
| d4ec2e46aa | |||
| fd9512bbbc | |||
| 176198fdc6 | |||
| 97d5c9bd0e | |||
| 13949e2ace | |||
| 1e1f2ca5b8 | |||
| 8676230eef | |||
| bde34ecd57 | |||
| f245ec3759 | |||
| 5839cc6bfd | |||
| 476054fb4f | |||
| be8b44a2d7 | |||
| 8d33ef0168 | |||
| 2b16f8c0d5 | |||
| 273f4860fe | |||
| 6af18b3dbc | |||
| c488066e33 | |||
| 9746520a24 | |||
| fb7a6efb5a | |||
| dc8368815e | |||
| a81f58f3f1 | |||
| 338e460be9 | |||
| 324077c333 | |||
| 1ba27c760b | |||
| c60a693f42 | |||
| 65c9a79603 | |||
| cafd93dcdd | |||
| 6d6eafa82a | |||
| d2d14ffb8f | |||
| f966b6a829 | |||
| b837017ba6 | |||
| ee3bb0d14f | |||
| 13716a5228 | |||
| ecd92ae24d | |||
| 836d7a139a | |||
| c67cfeaa87 | |||
| d92955a533 | |||
| b12527cf90 | |||
| 509c5738ff | |||
| 7a8edd3cea | |||
| 737b422552 | |||
| 67428a1aaf | |||
| 384b8780b0 | |||
| c6a53ea8ee | |||
| d3fc2646a7 | |||
| 2b305f378f | |||
| 64acebf3b5 | |||
| f0ddea9313 | |||
| 954f1b98bf | |||
| 641e5cd05a | |||
| 6668e362c1 | |||
| 627e0a24eb | |||
| ab6ca9a0b4 | |||
| 7e069ec3e2 | |||
| ddd798a65a | |||
| 4fde90e418 | |||
| 65c146e9c6 | |||
| d6454184e4 | |||
| 53efa7d6af | |||
| 073b1d0bd4 | |||
| 2968e61d97 | |||
| ede76f7b44 | |||
| db5ee98418 | |||
| a148073391 | |||
| 2db87e36b8 | |||
| e0fb9723a7 | |||
| 3782ef828a | |||
| cec899898a | |||
| 106bdb1d4a | |||
| ef4e6b93e0 | |||
| d0bb1e0c2a | |||
| 77e0d01d7a | |||
| b4ff775f03 | |||
| 9f1fd921f7 | |||
| 13c7cb9dd4 | |||
| a5ae266ee4 | |||
| a353a6d228 | |||
| 4ad98ebc52 | |||
| c32bc12d8e | |||
| 70cd53af86 | |||
| ac42b65177 | |||
| c3bb49501c | |||
| 625480e448 | |||
| ab6921ff85 | |||
| a7091f895d |
@@ -0,0 +1,986 @@
|
||||
1 Notes on the Free Translation Project
|
||||
***************************************
|
||||
|
||||
Free software is going international! The Free Translation Project is
|
||||
a way to get maintainers of free software, translators, and users all
|
||||
together, so that free software will gradually become able to speak many
|
||||
languages. A few packages already provide translations for their
|
||||
messages.
|
||||
|
||||
If you found this `ABOUT-NLS' file inside a distribution, you may
|
||||
assume that the distributed package does use GNU `gettext' internally,
|
||||
itself available at your nearest GNU archive site. But you do _not_
|
||||
need to install GNU `gettext' prior to configuring, installing or using
|
||||
this package with messages translated.
|
||||
|
||||
Installers will find here some useful hints. These notes also
|
||||
explain how users should proceed for getting the programs to use the
|
||||
available translations. They tell how people wanting to contribute and
|
||||
work on translations can contact the appropriate team.
|
||||
|
||||
When reporting bugs in the `intl/' directory or bugs which may be
|
||||
related to internationalization, you should tell about the version of
|
||||
`gettext' which is used. The information can be found in the
|
||||
`intl/VERSION' file, in internationalized packages.
|
||||
|
||||
1.1 Quick configuration advice
|
||||
==============================
|
||||
|
||||
If you want to exploit the full power of internationalization, you
|
||||
should configure it using
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to force usage of internationalizing routines provided within this
|
||||
package, despite the existence of internationalizing capabilities in the
|
||||
operating system where this package is being installed. So far, only
|
||||
the `gettext' implementation in the GNU C library version 2 provides as
|
||||
many features (such as locale alias, message inheritance, automatic
|
||||
charset conversion or plural form handling) as the implementation here.
|
||||
It is also not possible to offer this additional functionality on top
|
||||
of a `catgets' implementation. Future versions of GNU `gettext' will
|
||||
very likely convey even more functionality. So it might be a good idea
|
||||
to change to GNU `gettext' as soon as possible.
|
||||
|
||||
So you need _not_ provide this option if you are using GNU libc 2 or
|
||||
you have installed a recent copy of the GNU gettext package with the
|
||||
included `libintl'.
|
||||
|
||||
1.2 INSTALL Matters
|
||||
===================
|
||||
|
||||
Some packages are "localizable" when properly installed; the programs
|
||||
they contain can be made to speak your own native language. Most such
|
||||
packages use GNU `gettext'. Other packages have their own ways to
|
||||
internationalization, predating GNU `gettext'.
|
||||
|
||||
By default, this package will be installed to allow translation of
|
||||
messages. It will automatically detect whether the system already
|
||||
provides the GNU `gettext' functions. If not, the included GNU
|
||||
`gettext' library will be used. This library is wholly contained
|
||||
within this package, usually in the `intl/' subdirectory, so prior
|
||||
installation of the GNU `gettext' package is _not_ required.
|
||||
Installers may use special options at configuration time for changing
|
||||
the default behaviour. The commands:
|
||||
|
||||
./configure --with-included-gettext
|
||||
./configure --disable-nls
|
||||
|
||||
will, respectively, bypass any pre-existing `gettext' to use the
|
||||
internationalizing routines provided within this package, or else,
|
||||
_totally_ disable translation of messages.
|
||||
|
||||
When you already have GNU `gettext' installed on your system and run
|
||||
configure without an option for your new package, `configure' will
|
||||
probably detect the previously built and installed `libintl.a' file and
|
||||
will decide to use this. This might not be desirable. You should use
|
||||
the more recent version of the GNU `gettext' library. I.e. if the file
|
||||
`intl/VERSION' shows that the library which comes with this package is
|
||||
more recent, you should use
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to prevent auto-detection.
|
||||
|
||||
The configuration process will not test for the `catgets' function
|
||||
and therefore it will not be used. The reason is that even an
|
||||
emulation of `gettext' on top of `catgets' could not provide all the
|
||||
extensions of the GNU `gettext' library.
|
||||
|
||||
Internationalized packages usually have many `po/LL.po' files, where
|
||||
LL gives an ISO 639 two-letter code identifying the language. Unless
|
||||
translations have been forbidden at `configure' time by using the
|
||||
`--disable-nls' switch, all available translations are installed
|
||||
together with the package. However, the environment variable `LINGUAS'
|
||||
may be set, prior to configuration, to limit the installed set.
|
||||
`LINGUAS' should then contain a space separated list of two-letter
|
||||
codes, stating which languages are allowed.
|
||||
|
||||
1.3 Using This Package
|
||||
======================
|
||||
|
||||
As a user, if your language has been installed for this package, you
|
||||
only have to set the `LANG' environment variable to the appropriate
|
||||
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
|
||||
and `CC' is an ISO 3166 two-letter country code. For example, let's
|
||||
suppose that you speak German and live in Germany. At the shell
|
||||
prompt, merely execute `setenv LANG de_DE' (in `csh'),
|
||||
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
|
||||
This can be done from your `.login' or `.profile' file, once and for
|
||||
all.
|
||||
|
||||
You might think that the country code specification is redundant.
|
||||
But in fact, some languages have dialects in different countries. For
|
||||
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
|
||||
country code serves to distinguish the dialects.
|
||||
|
||||
The locale naming convention of `LL_CC', with `LL' denoting the
|
||||
language and `CC' denoting the country, is the one use on systems based
|
||||
on GNU libc. On other systems, some variations of this scheme are
|
||||
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
|
||||
locales supported by your system for your country by running the command
|
||||
`locale -a | grep '^LL''.
|
||||
|
||||
Not all programs have translations for all languages. By default, an
|
||||
English message is shown in place of a nonexistent translation. If you
|
||||
understand other languages, you can set up a priority list of languages.
|
||||
This is done through a different environment variable, called
|
||||
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
|
||||
for the purpose of message handling, but you still need to have `LANG'
|
||||
set to the primary language; this is required by other parts of the
|
||||
system libraries. For example, some Swedish users who would rather
|
||||
read translations in German than English for when Swedish is not
|
||||
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
|
||||
|
||||
Special advice for Norwegian users: The language code for Norwegian
|
||||
bokma*l changed from `no' to `nb' recently (in 2003). During the
|
||||
transition period, while some message catalogs for this language are
|
||||
installed under `nb' and some older ones under `no', it's recommended
|
||||
for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
|
||||
older translations are used.
|
||||
|
||||
In the `LANGUAGE' environment variable, but not in the `LANG'
|
||||
environment variable, `LL_CC' combinations can be abbreviated as `LL'
|
||||
to denote the language's main dialect. For example, `de' is equivalent
|
||||
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
|
||||
(Portuguese as spoken in Portugal) in this context.
|
||||
|
||||
1.4 Translating Teams
|
||||
=====================
|
||||
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list. The up-to-date list of
|
||||
teams can be found at the Free Translation Project's homepage,
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
|
||||
area.
|
||||
|
||||
If you'd like to volunteer to _work_ at translating messages, you
|
||||
should become a member of the translating team for your own language.
|
||||
The subscribing address is _not_ the same as the list itself, it has
|
||||
`-request' appended. For example, speakers of Swedish can send a
|
||||
message to `sv-request@li.org', having this message body:
|
||||
|
||||
subscribe
|
||||
|
||||
Keep in mind that team members are expected to participate
|
||||
_actively_ in translations, or at solving translational difficulties,
|
||||
rather than merely lurking around. If your team does not exist yet and
|
||||
you want to start one, or if you are unsure about what to do or how to
|
||||
get started, please write to `translation@iro.umontreal.ca' to reach the
|
||||
coordinator for all translator teams.
|
||||
|
||||
The English team is special. It works at improving and uniformizing
|
||||
the terminology in use. Proven linguistic skill are praised more than
|
||||
programming skill, here.
|
||||
|
||||
1.5 Available Packages
|
||||
======================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of April
|
||||
2005. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination, with a
|
||||
translation percentage of at least 50%.
|
||||
|
||||
Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB
|
||||
+-------------------------------------------------+
|
||||
GNUnet | |
|
||||
a2ps | [] [] [] [] [] |
|
||||
aegis | () |
|
||||
ant-phone | () |
|
||||
anubis | [] |
|
||||
ap-utils | |
|
||||
aspell | [] [] [] [] |
|
||||
bash | [] [] |
|
||||
batchelor | [] |
|
||||
bfd | |
|
||||
bibshelf | [] |
|
||||
binutils | [] |
|
||||
bison | [] [] |
|
||||
bluez-pin | [] [] [] [] |
|
||||
clisp | [] [] |
|
||||
console-tools | [] [] |
|
||||
coreutils | [] [] [] [] |
|
||||
cpio | |
|
||||
cpplib | [] [] [] |
|
||||
darkstat | [] () [] |
|
||||
dialog | [] [] [] [] [] [] |
|
||||
diffutils | [] [] [] [] [] |
|
||||
doodle | [] |
|
||||
e2fsprogs | [] [] |
|
||||
enscript | [] [] [] [] |
|
||||
error | [] [] [] [] |
|
||||
fetchmail | [] () [] [] [] |
|
||||
fileutils | [] [] |
|
||||
findutils | [] [] [] |
|
||||
flex | [] [] [] |
|
||||
fslint | [] |
|
||||
gas | |
|
||||
gawk | [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | [] |
|
||||
gettext-examples | [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] |
|
||||
gettext-tools | [] [] |
|
||||
gimp-print | [] [] [] [] |
|
||||
gip | |
|
||||
gliv | [] |
|
||||
glunarclock | |
|
||||
gmult | [] [] |
|
||||
gnubiff | () |
|
||||
gnucash | [] () () [] |
|
||||
gnucash-glossary | [] () |
|
||||
gpe-aerial | [] [] |
|
||||
gpe-beam | [] [] |
|
||||
gpe-calendar | [] [] |
|
||||
gpe-clock | [] [] |
|
||||
gpe-conf | [] [] |
|
||||
gpe-contacts | |
|
||||
gpe-edit | [] |
|
||||
gpe-go | [] |
|
||||
gpe-login | [] [] |
|
||||
gpe-ownerinfo | [] [] |
|
||||
gpe-sketchbook | [] [] |
|
||||
gpe-su | [] [] |
|
||||
gpe-taskmanager | [] [] |
|
||||
gpe-timesheet | [] |
|
||||
gpe-today | [] [] |
|
||||
gpe-todo | [] [] |
|
||||
gphoto2 | [] [] [] [] |
|
||||
gprof | [] [] |
|
||||
gpsdrive | () () |
|
||||
gramadoir | [] [] |
|
||||
grep | [] [] [] [] [] [] |
|
||||
gretl | |
|
||||
gsasl | [] |
|
||||
gss | |
|
||||
gst-plugins | [] [] [] [] [] [] |
|
||||
gstreamer | [] [] [] [] [] |
|
||||
gtick | [] () |
|
||||
gtkspell | [] [] [] |
|
||||
hello | [] [] [] [] |
|
||||
id-utils | [] [] |
|
||||
impost | |
|
||||
indent | [] [] |
|
||||
iso_3166 | |
|
||||
iso_3166_1 | [] [] [] [] [] |
|
||||
iso_3166_2 | |
|
||||
iso_3166_3 | [] |
|
||||
iso_4217 | |
|
||||
iso_639 | |
|
||||
jpilot | [] |
|
||||
jtag | |
|
||||
jwhois | |
|
||||
kbd | [] [] [] [] |
|
||||
latrine | () |
|
||||
ld | [] |
|
||||
libc | [] [] [] [] [] |
|
||||
libextractor | |
|
||||
libgpewidget | [] [] [] |
|
||||
libgsasl | |
|
||||
libiconv | [] [] [] [] [] |
|
||||
libidn | |
|
||||
lifelines | [] () |
|
||||
lilypond | [] |
|
||||
lingoteach | |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | [] |
|
||||
make | [] [] |
|
||||
man-db | [] () [] [] |
|
||||
minicom | [] [] |
|
||||
mysecretdiary | [] [] |
|
||||
nano | [] () [] |
|
||||
nano_1_0 | [] () [] [] |
|
||||
opcodes | [] |
|
||||
parted | [] [] [] [] |
|
||||
psmisc | |
|
||||
ptx | [] [] [] |
|
||||
pwdutils | |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] [] [] |
|
||||
rpm | [] [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] [] [] [] [] [] |
|
||||
sed | [] [] |
|
||||
sh-utils | [] [] |
|
||||
shared-mime-info | [] [] |
|
||||
sharutils | [] [] [] [] [] |
|
||||
silky | |
|
||||
skencil | [] () |
|
||||
sketch | [] () |
|
||||
solfege | [] |
|
||||
soundtracker | [] [] |
|
||||
sp | [] |
|
||||
stardict | [] |
|
||||
tar | |
|
||||
texinfo | [] [] |
|
||||
textutils | [] [] [] |
|
||||
tin | () () |
|
||||
tp-robot | [] |
|
||||
tuxpaint | [] [] [] [] [] [] [] |
|
||||
unicode-han-tra... | |
|
||||
unicode-transla... | |
|
||||
util-linux | [] [] [] [] |
|
||||
vorbis-tools | [] [] [] [] |
|
||||
wastesedge | () |
|
||||
wdiff | [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] |
|
||||
xchat | [] [] [] [] |
|
||||
xkeyboard-config | |
|
||||
xpad | |
|
||||
+-------------------------------------------------+
|
||||
af am ar az be bg bs ca cs cy da de el en en_GB
|
||||
10 0 0 2 7 4 0 41 43 3 52 90 20 1 15
|
||||
|
||||
eo es et eu fa fi fr ga gl he hr hu id is it
|
||||
+-----------------------------------------------+
|
||||
GNUnet | |
|
||||
a2ps | [] [] [] () |
|
||||
aegis | |
|
||||
ant-phone | [] |
|
||||
anubis | [] |
|
||||
ap-utils | [] |
|
||||
aspell | [] [] |
|
||||
bash | [] [] [] [] |
|
||||
batchelor | [] [] |
|
||||
bfd | [] |
|
||||
bibshelf | [] [] [] |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] [] [] [] |
|
||||
bluez-pin | [] [] [] [] [] [] |
|
||||
clisp | [] [] |
|
||||
console-tools | |
|
||||
coreutils | [] [] [] [] [] |
|
||||
cpio | [] [] |
|
||||
cpplib | [] [] |
|
||||
darkstat | [] () [] [] [] |
|
||||
dialog | [] [] [] [] [] [] [] [] |
|
||||
diffutils | [] [] [] [] [] [] [] [] [] [] |
|
||||
doodle | [] [] |
|
||||
e2fsprogs | [] [] [] |
|
||||
enscript | [] [] |
|
||||
error | [] [] [] [] [] |
|
||||
fetchmail | [] |
|
||||
fileutils | [] [] [] [] [] [] |
|
||||
findutils | [] [] [] [] [] |
|
||||
flex | [] [] [] |
|
||||
fslint | [] |
|
||||
gas | [] [] |
|
||||
gawk | [] [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] [] |
|
||||
gcc | [] |
|
||||
gettext-examples | [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] [] |
|
||||
gettext-tools | [] [] [] |
|
||||
gimp-print | [] [] |
|
||||
gip | [] [] [] |
|
||||
gliv | () |
|
||||
glunarclock | [] [] [] |
|
||||
gmult | [] [] [] |
|
||||
gnubiff | () () |
|
||||
gnucash | [] () [] |
|
||||
gnucash-glossary | [] [] |
|
||||
gpe-aerial | [] [] |
|
||||
gpe-beam | [] [] |
|
||||
gpe-calendar | [] [] [] [] |
|
||||
gpe-clock | [] [] [] |
|
||||
gpe-conf | [] |
|
||||
gpe-contacts | [] |
|
||||
gpe-edit | [] [] |
|
||||
gpe-go | [] [] |
|
||||
gpe-login | [] [] [] |
|
||||
gpe-ownerinfo | [] [] [] [] [] |
|
||||
gpe-sketchbook | [] [] |
|
||||
gpe-su | [] [] [] |
|
||||
gpe-taskmanager | [] [] [] |
|
||||
gpe-timesheet | [] [] [] [] |
|
||||
gpe-today | [] [] [] [] |
|
||||
gpe-todo | [] [] [] |
|
||||
gphoto2 | [] [] [] [] [] |
|
||||
gprof | [] [] [] |
|
||||
gpsdrive | () () [] () |
|
||||
gramadoir | [] [] |
|
||||
grep | [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||
gretl | [] [] [] |
|
||||
gsasl | [] [] [] |
|
||||
gss | [] |
|
||||
gst-plugins | [] [] [] |
|
||||
gstreamer | [] |
|
||||
gtick | [] [] [] [] [] |
|
||||
gtkspell | [] [] [] [] [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] [] |
|
||||
impost | [] [] |
|
||||
indent | [] [] [] [] [] [] [] [] [] [] [] |
|
||||
iso_3166 | [] [] [] |
|
||||
iso_3166_1 | [] [] [] [] [] [] [] |
|
||||
iso_3166_2 | [] |
|
||||
iso_3166_3 | [] |
|
||||
iso_4217 | [] [] [] |
|
||||
iso_639 | [] [] [] [] |
|
||||
jpilot | [] [] |
|
||||
jtag | [] |
|
||||
jwhois | [] [] [] [] [] |
|
||||
kbd | [] [] |
|
||||
latrine | [] [] [] |
|
||||
ld | [] [] |
|
||||
libc | [] [] [] [] [] |
|
||||
libextractor | |
|
||||
libgpewidget | [] [] [] [] [] |
|
||||
libgsasl | [] [] |
|
||||
libiconv | [] [] [] [] [] [] [] [] [] [] [] |
|
||||
libidn | [] [] |
|
||||
lifelines | () |
|
||||
lilypond | [] |
|
||||
lingoteach | [] [] [] |
|
||||
lynx | [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | [] [] |
|
||||
make | [] [] [] [] [] [] [] |
|
||||
man-db | () |
|
||||
minicom | [] [] [] [] |
|
||||
mysecretdiary | [] [] [] |
|
||||
nano | [] [] () [] [] |
|
||||
nano_1_0 | [] [] [] [] [] |
|
||||
opcodes | [] [] |
|
||||
parted | [] [] [] [] |
|
||||
psmisc | [] [] |
|
||||
ptx | [] [] [] [] [] [] [] [] [] |
|
||||
pwdutils | |
|
||||
python | |
|
||||
radius | [] [] |
|
||||
recode | [] [] [] [] [] [] [] [] |
|
||||
rpm | [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] |
|
||||
sed | [] [] [] [] [] |
|
||||
sh-utils | [] [] [] [] [] [] [] |
|
||||
shared-mime-info | [] [] [] [] [] [] |
|
||||
sharutils | [] [] [] [] [] [] [] |
|
||||
silky | [] |
|
||||
skencil | [] [] |
|
||||
sketch | [] [] |
|
||||
solfege | [] |
|
||||
soundtracker | [] [] [] |
|
||||
sp | [] |
|
||||
stardict | [] |
|
||||
tar | [] [] [] [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] [] [] |
|
||||
tin | [] () |
|
||||
tp-robot | [] [] |
|
||||
tuxpaint | [] [] [] [] [] [] [] [] [] |
|
||||
unicode-han-tra... | |
|
||||
unicode-transla... | [] [] |
|
||||
util-linux | [] [] [] [] [] [] |
|
||||
vorbis-tools | [] [] |
|
||||
wastesedge | () |
|
||||
wdiff | [] [] [] [] [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] [] [] [] [] |
|
||||
xchat | [] [] [] [] [] |
|
||||
xkeyboard-config | |
|
||||
xpad | [] [] [] |
|
||||
+-----------------------------------------------+
|
||||
eo es et eu fa fi fr ga gl he hr hu id is it
|
||||
13 85 21 15 2 35 115 45 17 8 6 40 27 1 45
|
||||
|
||||
ja ko ku lg lt lv mk mn ms mt nb nl nn no nso
|
||||
+-----------------------------------------------+
|
||||
GNUnet | |
|
||||
a2ps | () [] [] () |
|
||||
aegis | () |
|
||||
ant-phone | [] |
|
||||
anubis | [] [] [] |
|
||||
ap-utils | |
|
||||
aspell | [] [] |
|
||||
bash | [] |
|
||||
batchelor | [] |
|
||||
bfd | |
|
||||
bibshelf | |
|
||||
binutils | |
|
||||
bison | [] [] [] |
|
||||
bluez-pin | [] |
|
||||
clisp | [] |
|
||||
console-tools | |
|
||||
coreutils | [] [] |
|
||||
cpio | |
|
||||
cpplib | |
|
||||
darkstat | [] [] |
|
||||
dialog | [] |
|
||||
diffutils | [] [] [] |
|
||||
doodle | |
|
||||
e2fsprogs | |
|
||||
enscript | [] |
|
||||
error | [] |
|
||||
fetchmail | [] [] |
|
||||
fileutils | [] [] |
|
||||
findutils | [] |
|
||||
flex | [] [] |
|
||||
fslint | [] |
|
||||
gas | |
|
||||
gawk | [] [] |
|
||||
gbiff | [] |
|
||||
gcal | |
|
||||
gcc | |
|
||||
gettext-examples | [] [] |
|
||||
gettext-runtime | [] [] [] |
|
||||
gettext-tools | [] [] |
|
||||
gimp-print | [] [] |
|
||||
gip | [] |
|
||||
gliv | [] |
|
||||
glunarclock | [] [] |
|
||||
gmult | [] |
|
||||
gnubiff | |
|
||||
gnucash | () () [] |
|
||||
gnucash-glossary | [] |
|
||||
gpe-aerial | [] |
|
||||
gpe-beam | [] |
|
||||
gpe-calendar | [] |
|
||||
gpe-clock | [] |
|
||||
gpe-conf | [] |
|
||||
gpe-contacts | |
|
||||
gpe-edit | [] |
|
||||
gpe-go | [] |
|
||||
gpe-login | [] |
|
||||
gpe-ownerinfo | [] |
|
||||
gpe-sketchbook | [] |
|
||||
gpe-su | [] |
|
||||
gpe-taskmanager | [] [] |
|
||||
gpe-timesheet | [] |
|
||||
gpe-today | [] |
|
||||
gpe-todo | [] |
|
||||
gphoto2 | [] [] |
|
||||
gprof | |
|
||||
gpsdrive | () () () |
|
||||
gramadoir | () |
|
||||
grep | [] [] [] |
|
||||
gretl | |
|
||||
gsasl | [] |
|
||||
gss | |
|
||||
gst-plugins | [] |
|
||||
gstreamer | [] |
|
||||
gtick | [] |
|
||||
gtkspell | [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] |
|
||||
impost | |
|
||||
indent | [] [] |
|
||||
iso_3166 | [] |
|
||||
iso_3166_1 | [] [] |
|
||||
iso_3166_2 | [] |
|
||||
iso_3166_3 | [] |
|
||||
iso_4217 | [] [] [] |
|
||||
iso_639 | [] [] [] |
|
||||
jpilot | () () () |
|
||||
jtag | |
|
||||
jwhois | [] |
|
||||
kbd | [] |
|
||||
latrine | [] |
|
||||
ld | |
|
||||
libc | [] [] [] [] [] |
|
||||
libextractor | |
|
||||
libgpewidget | [] |
|
||||
libgsasl | [] |
|
||||
libiconv | [] |
|
||||
libidn | |
|
||||
lifelines | [] |
|
||||
lilypond | [] |
|
||||
lingoteach | [] |
|
||||
lynx | [] [] |
|
||||
m4 | [] [] |
|
||||
mailutils | |
|
||||
make | [] [] [] |
|
||||
man-db | () |
|
||||
minicom | [] |
|
||||
mysecretdiary | [] |
|
||||
nano | [] [] |
|
||||
nano_1_0 | [] [] [] |
|
||||
opcodes | [] |
|
||||
parted | [] [] |
|
||||
psmisc | [] [] |
|
||||
ptx | [] [] [] |
|
||||
pwdutils | |
|
||||
python | |
|
||||
radius | |
|
||||
recode | [] |
|
||||
rpm | [] [] |
|
||||
screem | [] |
|
||||
scrollkeeper | [] [] [] |
|
||||
sed | [] [] |
|
||||
sh-utils | [] [] |
|
||||
shared-mime-info | [] [] [] [] |
|
||||
sharutils | [] [] |
|
||||
silky | [] |
|
||||
skencil | |
|
||||
sketch | |
|
||||
solfege | [] [] |
|
||||
soundtracker | |
|
||||
sp | () |
|
||||
stardict | [] [] |
|
||||
tar | [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] |
|
||||
tin | |
|
||||
tp-robot | [] |
|
||||
tuxpaint | [] [] [] [] [] [] |
|
||||
unicode-han-tra... | |
|
||||
unicode-transla... | |
|
||||
util-linux | [] [] |
|
||||
vorbis-tools | [] |
|
||||
wastesedge | [] |
|
||||
wdiff | [] [] |
|
||||
wget | [] [] |
|
||||
xchat | [] [] [] [] |
|
||||
xkeyboard-config | [] |
|
||||
xpad | [] |
|
||||
+-----------------------------------------------+
|
||||
ja ko ku lg lt lv mk mn ms mt nb nl nn no nso
|
||||
33 11 1 1 1 2 2 3 11 0 15 96 7 5 0
|
||||
|
||||
or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
|
||||
+-------------------------------------------------+
|
||||
GNUnet | |
|
||||
a2ps | () [] [] [] [] [] [] |
|
||||
aegis | () () |
|
||||
ant-phone | [] |
|
||||
anubis | [] [] [] |
|
||||
ap-utils | () |
|
||||
aspell | [] [] |
|
||||
bash | [] [] [] |
|
||||
batchelor | [] |
|
||||
bfd | |
|
||||
bibshelf | |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] [] [] |
|
||||
bluez-pin | [] [] [] [] [] [] [] [] |
|
||||
clisp | [] |
|
||||
console-tools | [] |
|
||||
coreutils | [] [] [] [] |
|
||||
cpio | [] [] |
|
||||
cpplib | |
|
||||
darkstat | [] [] [] [] [] [] |
|
||||
dialog | [] [] [] [] [] [] [] |
|
||||
diffutils | [] [] [] [] [] [] |
|
||||
doodle | [] |
|
||||
e2fsprogs | [] [] |
|
||||
enscript | [] [] [] [] |
|
||||
error | [] [] [] |
|
||||
fetchmail | [] () [] [] [] |
|
||||
fileutils | [] [] [] [] [] |
|
||||
findutils | [] [] [] [] [] [] |
|
||||
flex | [] [] [] [] [] |
|
||||
fslint | [] [] [] |
|
||||
gas | |
|
||||
gawk | [] [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | |
|
||||
gettext-examples | [] [] [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] [] [] |
|
||||
gettext-tools | [] [] [] [] [] [] [] |
|
||||
gimp-print | [] [] |
|
||||
gip | [] [] [] |
|
||||
gliv | [] [] [] |
|
||||
glunarclock | [] [] [] [] [] [] |
|
||||
gmult | [] [] [] [] |
|
||||
gnubiff | () [] |
|
||||
gnucash | () [] [] [] [] |
|
||||
gnucash-glossary | [] [] [] |
|
||||
gpe-aerial | [] [] [] [] [] [] |
|
||||
gpe-beam | [] [] [] [] [] [] |
|
||||
gpe-calendar | [] [] [] [] [] [] [] |
|
||||
gpe-clock | [] [] [] [] [] [] [] |
|
||||
gpe-conf | [] [] [] [] [] [] |
|
||||
gpe-contacts | [] [] [] |
|
||||
gpe-edit | [] [] [] [] [] [] [] |
|
||||
gpe-go | [] [] [] [] [] |
|
||||
gpe-login | [] [] [] [] [] [] [] |
|
||||
gpe-ownerinfo | [] [] [] [] [] [] [] |
|
||||
gpe-sketchbook | [] [] [] [] [] [] [] |
|
||||
gpe-su | [] [] [] [] [] [] [] |
|
||||
gpe-taskmanager | [] [] [] [] [] [] [] |
|
||||
gpe-timesheet | [] [] [] [] [] [] [] |
|
||||
gpe-today | [] [] [] [] [] [] [] |
|
||||
gpe-todo | [] [] [] [] [] [] [] |
|
||||
gphoto2 | [] [] [] [] |
|
||||
gprof | [] [] [] |
|
||||
gpsdrive | [] |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] [] [] [] |
|
||||
gretl | [] |
|
||||
gsasl | [] [] [] [] [] |
|
||||
gss | [] [] [] |
|
||||
gst-plugins | [] [] [] [] |
|
||||
gstreamer | [] [] [] [] |
|
||||
gtick | [] [] [] |
|
||||
gtkspell | [] [] [] [] [] [] |
|
||||
hello | [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] [] |
|
||||
impost | |
|
||||
indent | [] [] [] [] [] [] |
|
||||
iso_3166 | [] [] [] [] [] |
|
||||
iso_3166_1 | [] [] [] [] |
|
||||
iso_3166_2 | |
|
||||
iso_3166_3 | [] [] [] |
|
||||
iso_4217 | [] [] |
|
||||
iso_639 | [] [] [] |
|
||||
jpilot | |
|
||||
jtag | [] |
|
||||
jwhois | [] [] [] () () |
|
||||
kbd | [] [] [] |
|
||||
latrine | [] [] |
|
||||
ld | [] |
|
||||
libc | [] [] [] [] [] |
|
||||
libextractor | [] |
|
||||
libgpewidget | [] [] [] [] [] [] |
|
||||
libgsasl | [] [] [] |
|
||||
libiconv | [] [] [] [] [] [] [] [] [] [] |
|
||||
libidn | [] () |
|
||||
lifelines | [] [] |
|
||||
lilypond | [] |
|
||||
lingoteach | [] |
|
||||
lynx | [] [] [] |
|
||||
m4 | [] [] [] [] [] |
|
||||
mailutils | [] [] [] |
|
||||
make | [] [] [] [] |
|
||||
man-db | [] [] |
|
||||
minicom | [] [] [] [] |
|
||||
mysecretdiary | [] [] [] [] |
|
||||
nano | [] [] [] |
|
||||
nano_1_0 | [] [] [] [] |
|
||||
opcodes | [] [] |
|
||||
parted | [] [] [] [] |
|
||||
psmisc | [] [] |
|
||||
ptx | [] [] [] [] [] [] |
|
||||
pwdutils | [] |
|
||||
python | |
|
||||
radius | [] [] |
|
||||
recode | [] [] [] [] [] [] |
|
||||
rpm | [] [] [] [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] [] [] [] [] |
|
||||
sed | [] [] [] [] [] [] [] [] |
|
||||
sh-utils | [] [] [] |
|
||||
shared-mime-info | [] [] [] [] [] |
|
||||
sharutils | [] [] [] |
|
||||
silky | [] |
|
||||
skencil | [] [] [] |
|
||||
sketch | [] [] [] |
|
||||
solfege | |
|
||||
soundtracker | [] [] |
|
||||
sp | |
|
||||
stardict | [] [] |
|
||||
tar | [] [] [] [] |
|
||||
texinfo | [] [] [] [] |
|
||||
textutils | [] [] [] |
|
||||
tin | |
|
||||
tp-robot | [] |
|
||||
tuxpaint | [] [] [] [] [] [] [] [] |
|
||||
unicode-han-tra... | |
|
||||
unicode-transla... | |
|
||||
util-linux | [] [] [] |
|
||||
vorbis-tools | [] [] |
|
||||
wastesedge | |
|
||||
wdiff | [] [] [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] [] [] [] |
|
||||
xchat | [] [] [] [] [] [] |
|
||||
xkeyboard-config | |
|
||||
xpad | |
|
||||
+-------------------------------------------------+
|
||||
or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
|
||||
1 0 48 30 58 6 79 71 5 45 13 12 50 86 0
|
||||
|
||||
tg th tk tr uk ven vi wa xh zh_CN zh_TW zu
|
||||
+--------------------------------------------+
|
||||
GNUnet | | 0
|
||||
a2ps | [] [] [] | 19
|
||||
aegis | | 0
|
||||
ant-phone | [] | 4
|
||||
anubis | [] | 9
|
||||
ap-utils | () | 1
|
||||
aspell | [] [] [] | 13
|
||||
bash | | 10
|
||||
batchelor | [] [] | 7
|
||||
bfd | | 1
|
||||
bibshelf | [] | 5
|
||||
binutils | [] | 6
|
||||
bison | [] | 17
|
||||
bluez-pin | [] [] [] [] [] | 24
|
||||
clisp | | 7
|
||||
console-tools | [] | 4
|
||||
coreutils | [] | 16
|
||||
cpio | [] [] | 6
|
||||
cpplib | [] [] | 7
|
||||
darkstat | [] () () | 15
|
||||
dialog | [] [] [] | 25
|
||||
diffutils | [] [] [] [] | 28
|
||||
doodle | [] | 5
|
||||
e2fsprogs | [] | 8
|
||||
enscript | [] | 12
|
||||
error | [] [] [] | 16
|
||||
fetchmail | [] | 12
|
||||
fileutils | [] [] [] | 18
|
||||
findutils | [] [] | 17
|
||||
flex | [] [] | 15
|
||||
fslint | [] | 7
|
||||
gas | [] | 3
|
||||
gawk | [] | 14
|
||||
gbiff | | 4
|
||||
gcal | [] | 5
|
||||
gcc | [] | 3
|
||||
gettext-examples | [] [] [] [] | 20
|
||||
gettext-runtime | [] [] [] [] [] | 25
|
||||
gettext-tools | [] [] [] | 17
|
||||
gimp-print | [] | 11
|
||||
gip | [] | 8
|
||||
gliv | [] | 6
|
||||
glunarclock | [] [] | 13
|
||||
gmult | [] [] [] | 13
|
||||
gnubiff | [] | 3
|
||||
gnucash | () [] | 10
|
||||
gnucash-glossary | [] | 8
|
||||
gpe-aerial | [] [] | 13
|
||||
gpe-beam | [] [] | 13
|
||||
gpe-calendar | [] [] [] [] | 18
|
||||
gpe-clock | [] [] [] [] | 17
|
||||
gpe-conf | [] [] | 12
|
||||
gpe-contacts | [] [] | 6
|
||||
gpe-edit | [] [] [] [] | 15
|
||||
gpe-go | [] [] | 11
|
||||
gpe-login | [] [] [] [] [] | 18
|
||||
gpe-ownerinfo | [] [] [] [] | 19
|
||||
gpe-sketchbook | [] [] | 14
|
||||
gpe-su | [] [] [] | 16
|
||||
gpe-taskmanager | [] [] [] | 17
|
||||
gpe-timesheet | [] [] [] [] | 17
|
||||
gpe-today | [] [] [] [] [] | 19
|
||||
gpe-todo | [] [] [] | 16
|
||||
gphoto2 | [] [] | 17
|
||||
gprof | [] [] | 10
|
||||
gpsdrive | | 2
|
||||
gramadoir | [] | 6
|
||||
grep | [] [] [] [] | 32
|
||||
gretl | | 4
|
||||
gsasl | [] [] | 12
|
||||
gss | [] | 5
|
||||
gst-plugins | [] [] | 16
|
||||
gstreamer | [] [] [] | 14
|
||||
gtick | [] | 11
|
||||
gtkspell | [] [] [] | 20
|
||||
hello | [] [] [] [] | 37
|
||||
id-utils | [] [] | 13
|
||||
impost | [] | 3
|
||||
indent | [] [] [] | 24
|
||||
iso_3166 | [] [] [] | 12
|
||||
iso_3166_1 | [] [] | 20
|
||||
iso_3166_2 | | 2
|
||||
iso_3166_3 | [] [] | 8
|
||||
iso_4217 | [] [] | 10
|
||||
iso_639 | [] [] | 12
|
||||
jpilot | [] [] [] | 6
|
||||
jtag | | 2
|
||||
jwhois | [] [] [] | 12
|
||||
kbd | [] [] | 12
|
||||
latrine | [] [] | 8
|
||||
ld | [] | 5
|
||||
libc | [] [] | 22
|
||||
libextractor | | 1
|
||||
libgpewidget | [] [] | 17
|
||||
libgsasl | [] | 7
|
||||
libiconv | [] [] [] [] [] | 32
|
||||
libidn | [] [] | 5
|
||||
lifelines | | 4
|
||||
lilypond | [] | 5
|
||||
lingoteach | | 5
|
||||
lynx | [] [] | 14
|
||||
m4 | [] [] | 17
|
||||
mailutils | [] | 7
|
||||
make | [] [] | 18
|
||||
man-db | | 5
|
||||
minicom | | 11
|
||||
mysecretdiary | [] [] | 12
|
||||
nano | | 11
|
||||
nano_1_0 | [] [] | 17
|
||||
opcodes | [] | 7
|
||||
parted | [] [] [] | 17
|
||||
psmisc | [] | 7
|
||||
ptx | [] [] | 23
|
||||
pwdutils | | 1
|
||||
python | | 0
|
||||
radius | [] | 6
|
||||
recode | [] [] | 22
|
||||
rpm | [] [] | 11
|
||||
screem | | 1
|
||||
scrollkeeper | [] [] | 23
|
||||
sed | [] [] | 19
|
||||
sh-utils | [] | 15
|
||||
shared-mime-info | [] [] | 19
|
||||
sharutils | [] [] [] | 20
|
||||
silky | | 3
|
||||
skencil | | 6
|
||||
sketch | | 6
|
||||
solfege | | 4
|
||||
soundtracker | [] | 8
|
||||
sp | [] | 3
|
||||
stardict | [] [] [] [] | 10
|
||||
tar | [] [] | 13
|
||||
texinfo | [] [] | 14
|
||||
textutils | [] [] [] | 17
|
||||
tin | | 1
|
||||
tp-robot | [] [] | 7
|
||||
tuxpaint | [] [] [] [] | 34
|
||||
unicode-han-tra... | | 0
|
||||
unicode-transla... | | 2
|
||||
util-linux | [] [] | 17
|
||||
vorbis-tools | [] | 10
|
||||
wastesedge | | 1
|
||||
wdiff | [] [] | 22
|
||||
wget | [] [] [] [] | 31
|
||||
xchat | [] [] [] | 22
|
||||
xkeyboard-config | | 1
|
||||
xpad | [] | 5
|
||||
+--------------------------------------------+
|
||||
72 teams tg th tk tr uk ven vi wa xh zh_CN zh_TW zu
|
||||
147 domains 0 0 1 78 29 0 71 16 0 41 20 0 1711
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
used for implementing regional variants of languages, or language
|
||||
dialects.
|
||||
|
||||
For a PO file in the matrix above to be effective, the package to
|
||||
which it applies should also have been internationalized and
|
||||
distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If April 2005 seems to be old, you may fetch a more recent copy of
|
||||
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
|
||||
matrix with full percentage details can be found at
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||
|
||||
1.6 Using `gettext' in new packages
|
||||
===================================
|
||||
|
||||
If you are writing a freely available program and want to
|
||||
internationalize it you are welcome to use GNU `gettext' in your
|
||||
package. Of course you have to respect the GNU Library General Public
|
||||
License which covers the use of the GNU `gettext' library. This means
|
||||
in particular that even non-free programs can use `libintl' as a shared
|
||||
library, whereas only free software can use `libintl' as a static
|
||||
library or use modified versions of `libintl'.
|
||||
|
||||
Once the sources are changed appropriately and the setup can handle
|
||||
the use of `gettext' the only thing missing are the translations. The
|
||||
Free Translation Project is also available for packages which are not
|
||||
developed inside the GNU project. Therefore the information given above
|
||||
applies also for every other Free Software Project. Contact
|
||||
`translation@iro.umontreal.ca' to make the `.pot' files available to
|
||||
the translation teams.
|
||||
|
||||
@@ -1,29 +1,35 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
Developers:
|
||||
----------
|
||||
|
||||
All developers are connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
Developer:
|
||||
---------
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://www.flashtux.org
|
||||
IRC : nick is "FlashCode"
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
Testers:
|
||||
-------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga"
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@tuxisland.org>
|
||||
Web : http://www.tuxisland.org
|
||||
IRC : nick is "xahlexx"
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
|
||||
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2003-09-27
|
||||
WeeChat known bugs, 2005-05-21
|
||||
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(irc protocol is under dev!)
|
||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
||||
problem)
|
||||
- alias/unalias commands doesn't work
|
||||
- config is not saved (to ~/.weechat/weechatrc)
|
||||
- intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!)
|
||||
- program is stopped when bad option in config file (it should not, only display
|
||||
warning)
|
||||
- too much opened channel => display bug
|
||||
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- when quitting WeeChat term title is not restored (if look_set_title is ON)
|
||||
- command name for /server can not contain spaces
|
||||
- wrong alias is not created and not saved when quitting WeeChat
|
||||
- when many WeeChat are launched, log file is not properly written (cleared by
|
||||
each WeeChat at startup)
|
||||
- display problems with old Konsole versions (Kde terminal) (???)
|
||||
|
||||
@@ -1,88 +1,186 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2003-09-27
|
||||
ChangeLog - 2005-05-21
|
||||
|
||||
* 2003-09-27:
|
||||
- WeeChat 0.0.1 released!
|
||||
|
||||
* 2003-09-26:
|
||||
- added completor prefix (in config: look_nick_completor)
|
||||
- fixef log_printf command (bug with year & month)
|
||||
- added "/kill" command
|
||||
- fixed /version and /ctcp commands (missing ":" before message)
|
||||
Version 0.1.2 (2005-05-21):
|
||||
* added Python plugin support, improved Perl interface (and now Perl/Python
|
||||
libraries are checked by configure script)
|
||||
* added nicklist scroll keys (Alt+{home/end/pgup/pgdn} or F11/F12)
|
||||
* added transfer rate for DCC files
|
||||
* added "-all" option for /nick command
|
||||
* buffers timestamp can now be changed (new option in config file)
|
||||
* WeeChat now ok under *BSD and Mac OS X
|
||||
* fixed nicklist sort
|
||||
* fixed crash when purging old DCC
|
||||
* fixed crash with 64-bits arch (like AMD64) when converting UTF-8
|
||||
* added missing IRC commands (307, 341, 485, 671)
|
||||
|
||||
* 2003-09-25:
|
||||
- added "/kick" command
|
||||
- added IRC errors 402 to 407
|
||||
- added "/invite" command
|
||||
Version 0.1.1 (2005-03-20):
|
||||
* added nicks count for channel buffers
|
||||
* added FIFO pipe for remote control
|
||||
* added crash dump when WeeChat receives SIGSEGV (Segmentation fault)
|
||||
* added new display engine: doesn't cut words at end of lines
|
||||
* added DCC send and DCC chat
|
||||
* added /halfop & /dehalfop commands, fixed halfop display bug in nicklist
|
||||
* added /ban, /unban and /kickban commands
|
||||
* added spanish translation
|
||||
* added --irc-commands and --weechat-commands command line options
|
||||
* connection to IRC server is now made by child process (non blocking)
|
||||
* added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)
|
||||
* new key for window switch (now: F5/F6=switch buffer, F7/F8=switch window)
|
||||
* on server buffer, only server messages are logged
|
||||
* improved /help command output
|
||||
* plugins messages are logged with new config option (log_plugin_msg)
|
||||
* fixed /kick command
|
||||
* fixed /invite command (and now invite requests are displayed)
|
||||
* fixed /buffer close command (now ok when disconnected from server)
|
||||
* fixed display bugs when many windows are opened
|
||||
|
||||
* 2003-09-24:
|
||||
- "ctcp version" received is now correctly displayed
|
||||
- "/version" command is ok
|
||||
Version 0.1.0 (2005-02-12):
|
||||
* improved /window command: now split and merge are ok
|
||||
* away nicks are now displayed with another color (new option: "irc_away_check")
|
||||
* added away indicator in status bar
|
||||
* added lag indicator (and auto-disconnect after a delay if important lag)
|
||||
* improved completion: now completes commands arguments (IRC and internal),
|
||||
when only one completion matches, completion mechanism is stoped (to
|
||||
complete command arg for example)
|
||||
* improved /set command: empty strings are allowed, new colors, server
|
||||
options can be changed while WeeChat is running
|
||||
* added default away/part/quit messages in config file
|
||||
* new [irc] section in config file, option "look_display_away" moved to
|
||||
"irc_display_away"
|
||||
* server messages & errors are all prefixed (by 3 chars, like '-@-')
|
||||
* added new options for charset (UTF-8 support): look_charset_decode,
|
||||
look_charset_encode and look_charset_internal
|
||||
* fixed many memory leaks
|
||||
* fixed colors bug: removed "gray" color (replaced by "default"), colors are
|
||||
ok when terminal has white (or light) background
|
||||
* fixed crash when resizing terminal to small size
|
||||
* fixed crash when multiple servers and big messages received from server
|
||||
* fixed crash when closing some private buffers
|
||||
* fixed crash when unknown section with option(s) in config file
|
||||
* fixed /op, /deop, /voice, /devoice (now ok with many nicks)
|
||||
* fixed /me command (now ok without parameter)
|
||||
* fixed /away command (now ok if not away)
|
||||
* logs are now disabled by default (server/channel/private)
|
||||
|
||||
* 2003-09-23:
|
||||
- log file (~/.weechat/weechat.log)
|
||||
- renamed config file (~/.weechat/weechatrc to ~/.weechat/weechat.rc)
|
||||
Version 0.0.9 (2005-01-01):
|
||||
* auto-reconnection to server (new options: server_autoreconnect (on/off),
|
||||
server_autoreconnect_delay (in seconds))
|
||||
* major bug fixed when socket is closed by server (100% CPU usage fixed),
|
||||
and disconnections are now ok (all channels are "closed", history is still
|
||||
visible, and buffer will be used again if reconnection to server)
|
||||
* option "look_remove_colors_from_msgs" is now working
|
||||
* fixed display of nick mode changes
|
||||
* new command "/buffer close" (close any server/channel/private buffer)
|
||||
* /notice command fixed (and display when received from server)
|
||||
* new keys: Ctrl+A (=home), Ctrl+E (=end), Ctrl+W (=Ctrl+Backspace),
|
||||
Alt-S (switch to server buffer), Alt-X (switch to first channel of next
|
||||
server)
|
||||
* added new config option: "server_command_delay" (delay in seconds after
|
||||
startup command for each server)
|
||||
|
||||
* 2003-09-21:
|
||||
- "demi-highlight": 2 types of windows highlight: lightred for windows with
|
||||
unread messages (from other users), lightmagenta for windows with other
|
||||
unread data (join, part, quit, away, ...)
|
||||
- "320" IRC message management
|
||||
- "/clear" command
|
||||
Version 0.0.8 (2004-10-30):
|
||||
* /kick command fixed: now ok with many words as reason
|
||||
* nickserv passwords hidden (new config option: log_hide_nickserv_pwd on/off)
|
||||
* auto-rejoin channels when kicked (new config option: server_autorejoin on/off)
|
||||
* added IRC::command function for Perl scripts
|
||||
* fixed bug when adding alias with same name as other
|
||||
* /buffer command developed (buffers list, move and notify)
|
||||
* logging buffers to disk (server/channel/private according to user prefs)
|
||||
* Away now announced in channels, and config option "look_display_away" added
|
||||
to enable/disable this feature
|
||||
* Fixed crash when resizing terminal to very small size
|
||||
* "-MORE-" message is now erased when switching to another buffer
|
||||
* DCC file receive ok (Alt-D for DCC view)
|
||||
* /query command now reopens private buffer if already opened
|
||||
* added key for redrawing terminal (Ctrl-L)
|
||||
* added key for clearing hotlist (Alt-R)
|
||||
|
||||
* 2003-09-19:
|
||||
- préparation des sources pour l'internationalisation avec gettext
|
||||
- "301" IRC command (away message)
|
||||
- functions renamed in rc-commands.c, irc-server.c,
|
||||
command.c and config.c (all functions are beginning with a prefix:
|
||||
irc_cmd_recv_xxx, irc_cmd_send_xxx, server_xxx, weechat_cmd_xxx and
|
||||
config_xxx). Moreover, all commands (sent and received) return a value
|
||||
(success or not)
|
||||
- "/quote" command
|
||||
- "/whois" command (and colored display of /whois result in server window)
|
||||
Version 0.0.7 (2004-08-08):
|
||||
* new "col_status_delimiters" config option
|
||||
* /buffer command added, buffers ordered by number, auto-jump to active
|
||||
buffers (alt-a), jump to buffers by number (alt-number)
|
||||
* /window command added, split terminal horizontally/vertically
|
||||
* unique color for each nick (based on nickname)
|
||||
* action messages are now considered as messages, not crappy joins/parts
|
||||
* fixed display bug when nicklist is displayed at bottom of screen
|
||||
* added history limit (text buffer & commands)
|
||||
* replaced --enable-debug with --with-debug option for ./configure, which is
|
||||
now integer: 1 = compiler debug flag, 2 = same 1 with verbose debug messages
|
||||
in WeeChat (default: 0 = no debug)
|
||||
|
||||
* 2003-09-18:
|
||||
- use of alternate nickname (and 2nd alternate) if nick is already used
|
||||
on server (changed/added in config file: options "nick1", "nick2", "nick3"
|
||||
for a server, all are mandatory)
|
||||
- "433" IRC error management (nickname already in use)
|
||||
- "mode" command received correctly for "channel flags" and
|
||||
op/deop/voice/devoice actions for a nick
|
||||
- "401" IRC error management (no such nick/channel)
|
||||
- private windows management (when received and opened, with /privmsg),
|
||||
"/privmsg" completed consequently
|
||||
Version 0.0.6 (2004-06-05):
|
||||
* improved channel highlight (priority to message vs join/part)
|
||||
* fixed bug when opened private win and remote user changes his nick
|
||||
* /query command added (starts private conversation)
|
||||
* IRC messages 476, 477 added
|
||||
* /mode command is now ok and channel flags are displayed in status bar
|
||||
* fixed display bug (text was blinking when scrolling)
|
||||
* CTCP Version reply is now in english only and doesn't show host (security reason)
|
||||
|
||||
* 2003-09-17:
|
||||
- nickmode display ((half)op/voice) before nicks (as option, look at config
|
||||
options beginning with "look_nickmode")
|
||||
- windows history is now ok (pgup/pgdn on any window type)
|
||||
- "/me" command (and OK when received)
|
||||
- display nicks count when joining channel or with "/names" command
|
||||
(total, ops, halfops, voices et normaux)
|
||||
Version 0.0.5 (2004-02-07):
|
||||
* /set command to modify config options when WeeChat is running
|
||||
* fixed look_nicklist config option, now enables/disables nicklist
|
||||
* secured code to prevent buffer overflows and memory leaks
|
||||
* fixed QUIT IRC command: now sent to all connected servers (not only current)
|
||||
* URL command line parameter to connect to server(s)
|
||||
* new Perl script function to display message in info bar ("IRC::print_infobar")
|
||||
* info bar highlight notifications
|
||||
* info bar timestamp is added to config ("look_infobar_timestamp")
|
||||
* added info bar (optional, "look_infobar" to enable it, "on" by default)
|
||||
* fixed crash with /oper command
|
||||
* for default config file, nick is now based on un*x username (thanks to Witukind)
|
||||
* fixed crash when config file cannot be written
|
||||
* -c (or --config) command line parameter added to see config file options
|
||||
* highlight action messages
|
||||
|
||||
* 2003-09-16:
|
||||
- added and normalized chat window colors
|
||||
(new colors in config file)
|
||||
- "/topic" command
|
||||
- nicklist can be moved on top, bottom, left or right of window
|
||||
Version 0.0.4 (2004-01-01):
|
||||
* Perl plugin, with auto-load
|
||||
* when private window is created (another user is talking), WeeChat does not
|
||||
switch to this window
|
||||
* highlight when our nick is written in a channel/private window
|
||||
* ctrl-C now intercepted (ignored)
|
||||
* debug messages can be enabled via ./configure --enbale-debug option
|
||||
|
||||
* 2003-09-15:
|
||||
- auto-resize of nicklist, according to nick max length
|
||||
- IRC multi-servers is OK
|
||||
Version 0.0.3 (2003-11-03):
|
||||
* ./configure script to build WeeChat
|
||||
* nicks are now correctly sorted (op, halfop, voice, other)
|
||||
* fixed problem with '353' IRC message (nicklist)
|
||||
* fixed problem when nick is truncated by server
|
||||
* fixed crash when entering text without any server connection
|
||||
* fixed crash when /set command is executed
|
||||
* fixed display bug (text was blinking when scrolling)
|
||||
* french translation
|
||||
* new IRC command: /stats, /service, /squit, /motd, /lusers, /links, /time,
|
||||
/trace, /admin, /info, /servlist, /squery, /who, /whowas, /die, /summon,
|
||||
/users, /wallops, /userhost, /ison, /ctcp ping
|
||||
* code cleanup
|
||||
|
||||
* 2003-09-14:
|
||||
- no hangup if "/part" command is executed on server window
|
||||
- continue if no server is declared in config file
|
||||
(empty window will be opened for executing WeeChat commands)
|
||||
- string array for strings in config file
|
||||
example: cfg_look_nicklist_position can take values "left", "right",
|
||||
"top", "bottom", which are converted to int (from 0 for "left" to 3 for
|
||||
"bottom")
|
||||
- messages are aligned under time (server window) or under time + nick
|
||||
(channel window)
|
||||
Version 0.0.2 (2003-10-05):
|
||||
* added commands /rehash and /restart
|
||||
* command & auto-join channels when connected to server
|
||||
* new commands for alias: /alias, /unalias (new section in config file)
|
||||
* config is now saved automatically when quitting WeeChat, /save command added
|
||||
* new commands for servers: /server, /connect, /disconnect
|
||||
* added autoconnect flag for each server in config file
|
||||
* added "look_set_title" option in config file
|
||||
* term window title is modified with WeeChat name and version
|
||||
* fixed nicklist display bug
|
||||
* fixed crash when sending command which can only be received
|
||||
* CTCP version returns more info (about OS)
|
||||
|
||||
* 2003-09-13:
|
||||
- sources exploded in many directories: ./irc, ./gui/curses, ./gui/gtk,
|
||||
./gui/qt and ./gui/text
|
||||
Version 0.0.1 (2003-09-27):
|
||||
* ncurses GUI with color output
|
||||
* multi-servers
|
||||
* channel windows, with nicklist (position: top, bottom, left or right)
|
||||
* private windows
|
||||
* IRC commands: away, ctcp, deop, devoice, invite, join, kick, kill, list,
|
||||
me, mode, msg, names, nick, notice, op, oper, part, ping, pong, quit,
|
||||
quote, topic, version, voice, whois
|
||||
* WeeChat commands: clear, help, set (partial)
|
||||
* many config options
|
||||
* log file (~/.weechat/weechat.log)
|
||||
* nicklist can be moved on top, bottom, left or right of window
|
||||
|
||||
@@ -1,6 +1,193 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
WeeChat FAQ, 2005-05-21
|
||||
=======================
|
||||
|
||||
WeeChat FAQ, 2003-09-19
|
||||
Intended audience:
|
||||
All WeeChat users.
|
||||
|
||||
<<< TO DO ! >>>
|
||||
Before reading the following:
|
||||
the following Q/A list is *not* exhaustive.
|
||||
It is also possible that you won't find any Q/A that matches your problem.
|
||||
Please read them anyway, they may provide you help in fixing your problem
|
||||
anyway.
|
||||
And even if your problem is listed below, it is possible that the answers don't
|
||||
help you anymore to solve it. Then, please contact us, we will try to help you
|
||||
finding a solution.
|
||||
|
||||
1 - Compiling
|
||||
2 - Using WeeChat
|
||||
3 - Development
|
||||
|
||||
1.1
|
||||
================================================================================
|
||||
Q: I heard about many GUI for WeeChat. How can I compile/use them?
|
||||
|
||||
A: Curses GUI is built by default.
|
||||
To build Gtk, wxWidgets or Qt GUI you've to specify extra options to
|
||||
./configure script:
|
||||
--enable-gtk to enable Gtk GUI
|
||||
--enable-wxwidgets to enable wxWidgets GUI
|
||||
--enable-qt to enable Qt QUI
|
||||
Type ./configure --help to see available options.
|
||||
WARNING: only Curses GUI is ok today. Other GUI are under development!
|
||||
|
||||
|
||||
1.2
|
||||
================================================================================
|
||||
Q: I can't compile WeeChat CVS.
|
||||
|
||||
A: Check that you have latest version of autoconf and automake.
|
||||
WeeChat has been developed with autoconf version 2.59 and automake
|
||||
version 1.9.5.
|
||||
You should have at least these versions in order to compile WeeChat CVS.
|
||||
If you can't or don't want to install these versions, you can download and
|
||||
install "devel package", a package built almost every day, based on CVS.
|
||||
Note that this package may not correspond exactly to CVS base.
|
||||
|
||||
|
||||
2.1
|
||||
================================================================================
|
||||
Q: Why using WeeChat ? X-Chat and Irssi are so good...
|
||||
|
||||
A: Because WeeChat is very light and has new features.
|
||||
Some new features:
|
||||
* many GUI (Curses, Gtk, wxWidgets, Qt),
|
||||
* extensible with scripts (Perl, Python, Ruby),
|
||||
* developed from scratch (not based on any other IRC client)
|
||||
* multi-platform
|
||||
* 100% GPL and free
|
||||
This is the "geekest" IRC client ;)
|
||||
|
||||
More info on this page: http://weechat.flashtux.org/features.php
|
||||
|
||||
|
||||
2.2
|
||||
================================================================================
|
||||
Q: I've launched WeeChat, but I'm lost, what can I do?
|
||||
|
||||
A: For help you can type /help. For help about a command, type /help command.
|
||||
Keys and commands are listed in documentation.
|
||||
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
A: You have to setup charset used for decoding, encoding, and internal WeeChat
|
||||
charset.
|
||||
Change value of option "look_charset_decode" to "UTF-8".
|
||||
Option "look_charset_internal" should not be changed (default is
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
|
||||
A: Today you can't do that. This is planed for a future version.
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
A: You can use /perl command to load scripts (default path is
|
||||
~/.weechat/perl).
|
||||
Note that scripts in ~/.weechat/perl/autoload are automatically loaded
|
||||
when WeeChat is starting up.
|
||||
WeeChat Perl scripts are 80% compatible with X-Chat, but not with Irssi.
|
||||
|
||||
|
||||
2.6
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
Are Python scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
A: You can use /python command to load scripts (default path is
|
||||
~/.weechat/python).
|
||||
Note that scripts in ~/.weechat/python/autoload are automatically loaded
|
||||
when WeeChat is starting up.
|
||||
WeeChat Python scripts are 80% compatible with X-Chat, but not with Irssi.
|
||||
|
||||
|
||||
2.7
|
||||
================================================================================
|
||||
Q: How can I load Ruby scripts?
|
||||
|
||||
A: Today Ruby interface is not developed, so you can't load any Ruby script.
|
||||
|
||||
|
||||
3.1
|
||||
================================================================================
|
||||
Q: How should I report bugs?
|
||||
|
||||
A: There is 3 ways to report bugs:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #weechat
|
||||
2. you can submit your bug at this url:
|
||||
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
|
||||
3. you can mail your problem, look at support page for developer's mails:
|
||||
http://weechat.flashtux.org/support.php
|
||||
(you can subscribe and send to "support" mailing list)
|
||||
|
||||
|
||||
3.2
|
||||
================================================================================
|
||||
Q: How should I submit patches?
|
||||
|
||||
A: There is 3 ways to submit patches:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #weechat
|
||||
2. you can submit your patch at this url:
|
||||
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
|
||||
3. you can mail your patch, look at support page for developer's mails:
|
||||
http://weechat.flashtux.org/support.php
|
||||
(you can subscribe and send to "support" mailing list)
|
||||
|
||||
|
||||
3.3
|
||||
================================================================================
|
||||
Q: How should I submit new feature request?
|
||||
|
||||
A: There is 2 ways to submit your feature request:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #weechat
|
||||
2. you can mail your feature request, look at support page for developer's
|
||||
mails:
|
||||
http://weechat.flashtux.org/support.php
|
||||
(you can subscribe and send to "support" mailing list)
|
||||
|
||||
|
||||
3.4
|
||||
================================================================================
|
||||
Q: What is the list of supported platforms for WeeChat?
|
||||
|
||||
A: Today WeeChat was succesfully tested on these platforms:
|
||||
- GNU/Linux (any distribution / i386, AMD64, Sparc)
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- Mac OS X
|
||||
- Microsoft Windows (with Cygwin and some code changes)
|
||||
|
||||
|
||||
3.5
|
||||
================================================================================
|
||||
Q: Will WeeChat be ported to QNX or other operating systems?
|
||||
|
||||
A: Yes. Future versions will be available for these OS.
|
||||
We need help for such systems, any help is welcome :)
|
||||
|
||||
|
||||
3.6
|
||||
================================================================================
|
||||
Q: I want to help WeeChat developers. What can I do?
|
||||
|
||||
A: There's many tasks to do (code, documentation, ...)
|
||||
Please contact us with IRC or mail, look at support page:
|
||||
http://weechat.flashtux.org/support.php
|
||||
|
||||
|
||||
3.7
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
A: Beer is welcome :)
|
||||
Otherwise Paypal account is: flashcode@free.fr (no limit for gifts :)
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
WeeChat FAQ, 2005-05-21
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
Tous les utilisateurs de WeeChat.
|
||||
|
||||
Avant de lire la suite ceci :
|
||||
la liste suivante de questions/réponses n'est *pas* exhaustive.
|
||||
Il est donc possible que vous ne trouviez pas de question/réponse correspondant
|
||||
à votre problème.
|
||||
Lisez les quand même SVP, elles peuvent vous aider à corriger votre problème.
|
||||
Et même si votre problème est mentionné ci-dessous, il est possible que la
|
||||
réponse ne vous aide pas à corriger le problème. Dans ce cas, contactez-nous,
|
||||
nous essaierons de vous aider Ă trouver une solution.
|
||||
|
||||
1 - Compilation
|
||||
2 - Utilisation de WeeChat
|
||||
3 - Développement
|
||||
|
||||
1.1
|
||||
================================================================================
|
||||
Q: J'ai entendu parler de plusieurs interfaces pour WeeChat.
|
||||
Comment puis-je les compiler/utiliser ?
|
||||
|
||||
R: L'interface Curses est construite par défaut.
|
||||
Pour construire l'interface Gtk, wxWidgets ou Qt, vous devez spécifier des
|
||||
options pour le script ./configure :
|
||||
--enable-gtk pour activer l'interface Gtk
|
||||
--enable-wxwidgets pour activer l'interface wxWidgets
|
||||
--enable-qt pour activer l'interface Qt
|
||||
Tapez ./configure --help pour voir les options disponibles.
|
||||
ATTENTION : seule l'interface Curses est ok aujourd'hui.
|
||||
Les autres interfaces sont en développement.
|
||||
|
||||
|
||||
1.2
|
||||
================================================================================
|
||||
Q: Je ne peux pas compiler le CVS WeeChat.
|
||||
|
||||
R: Vérifiez que vous avez bien la dernière version d'autoconf et automake.
|
||||
WeeChat a été développé avec autoconf version 2.59 et automake
|
||||
version 1.9.5.
|
||||
Vous devez avoir au moins ces versions pour compiler le CVS WeeChat.
|
||||
Si vous n'avez pas ou ne souhaitez pas installer ces versions, vous
|
||||
pouvez télécharger et installer le paquet "devel", un paquet construit
|
||||
quasiment tous les jours, basé sur le CVS.
|
||||
Notez que ce paquet peut ne pas correspondre exactement Ă la base CVS.
|
||||
|
||||
|
||||
2.1
|
||||
================================================================================
|
||||
Q: Pourquoi utiliser WeeChat ? X-Chat et Irssi sont si bien...
|
||||
|
||||
R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités.
|
||||
Quelques nouvelles fonctionnalités :
|
||||
* plusieurs interfaces (Curses, Gtk, wxWidgets, Qt),
|
||||
* extensible par des scripts (Perl, Python, Ruby),
|
||||
* développé à partir de zéro (non basé sur un quelconque client IRC)
|
||||
* multi-platformes
|
||||
* 100% GPL et libre
|
||||
C'est le client IRC le plus "geek" ;)
|
||||
|
||||
Plus d'infos sur cette page: http://weechat.flashtux.org/features.php
|
||||
|
||||
|
||||
2.2
|
||||
================================================================================
|
||||
Q: J'ai lancé WeeChat, mais je suis perdu, que puis-je faire ?
|
||||
|
||||
R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
|
||||
tapez /help commande.
|
||||
Les touches et commandes sont listées dans la documentation.
|
||||
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que
|
||||
le charset interne Ă WeeChat.
|
||||
Modifiez la valeur de l'option "look_charset_decode" en "UTF-8".
|
||||
L'option "look_charset_internal" ne devrait pas être modifiée (par défaut
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: Comment puis-je configurer les raccourcis clavier ?
|
||||
|
||||
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
|
||||
version future.
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Perl ?
|
||||
Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ?
|
||||
|
||||
R: La commande /perl permet de charger les scripts Perl (le chemin par défaut
|
||||
est ~/.weechat/perl).
|
||||
Notez que les scripts dans ~/.weechat/perl/autoload sont automatiquement
|
||||
chargés par WeeChat lorsqu'il démarre.
|
||||
Les scripts Perl WeeChat sont 80% compatibles avec X-Chat, mais pas Irssi.
|
||||
|
||||
|
||||
2.6
|
||||
================================================================================
|
||||
Q: Comment puis-je charger les scripts Python ?
|
||||
Les scripts Python sont-ils compatibles avec X-chat et/ou Irssi ?
|
||||
|
||||
R: La commande /python permet de charger les scripts Python (le chemin par
|
||||
défaut est ~/.weechat/python).
|
||||
Notez que les scripts dans ~/.weechat/python/autoload sont automatiquement
|
||||
chargés par WeeChat lorsqu'il démarre.
|
||||
Les scripts Python WeeChat sont 80% compatibles avec X-Chat, mais pas Irssi.
|
||||
|
||||
|
||||
2.7
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Ruby ?
|
||||
|
||||
R: Aujourd'hui l'interface Ruby n'est pas développée.
|
||||
Vous ne pouvez donc charger aucun script Ruby.
|
||||
|
||||
|
||||
3.1
|
||||
================================================================================
|
||||
Q: Comment dois-je reporter les bugs ?
|
||||
|
||||
R: Il y a 3 manières de reporter les bugs :
|
||||
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
|
||||
2. vous pouvez soumettre votre bug Ă cette adresse :
|
||||
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
|
||||
3. vous pouvez envoyer votre problem par mail, consultez la page
|
||||
support pour les mails des développeurs :
|
||||
http://weechat.flashtux.org/support.php
|
||||
(vous pouvez souscrire et envoyer Ă la liste de diffusion
|
||||
"support")
|
||||
|
||||
|
||||
3.2
|
||||
================================================================================
|
||||
Q: Comment dois-je soumettre les patches ?
|
||||
|
||||
R: Il y a 3 manières de soumettre les patches :
|
||||
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
|
||||
2. vous pouvez soumettre votre patch Ă cette adresse :
|
||||
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
|
||||
3. vous pouvez envoyer votre patch par mail, consultez la page
|
||||
support pour les mails des développeurs :
|
||||
http://weechat.flashtux.org/support.php
|
||||
(vous pouvez souscrire et envoyer Ă la liste de diffusion
|
||||
"support")
|
||||
|
||||
|
||||
3.3
|
||||
================================================================================
|
||||
Q: Comment dois-je soumettre les demandes de nouvelles fonctionnalités ?
|
||||
|
||||
R: Il y a 2 manières :
|
||||
1. vous pouvez nous joindre sur IRC: irc.freenode.net, channel #weechat
|
||||
2. vous pouvez envoyer un mail, consultez la page support pour les
|
||||
mails des développeurs :
|
||||
http://weechat.flashtux.org/support.php
|
||||
(vous pouvez souscrire et envoyer Ă la liste de diffusion
|
||||
"support")
|
||||
|
||||
|
||||
3.4
|
||||
================================================================================
|
||||
Q: Quelle est la liste des plate-formes supportées par WeeChat ?
|
||||
|
||||
R: Aujourd'hui WeeChat a été testé avec succès sur ces plate-formes :
|
||||
- GNU/Linux (toute distribution / i386, AMD64, Sparc)
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- Mac OS X
|
||||
- Microsoft Windows (avec Cygwin et quelques modifications de code)
|
||||
|
||||
|
||||
3.5
|
||||
================================================================================
|
||||
Q: WeeChat sera-t-il porté sur QNX ou d'autres systèmes d'exploitation ?
|
||||
|
||||
R: Oui. Les futures versions seront disponibles pour ces OS.
|
||||
Nous avons besoin d'aide pour ces systèmes, toute aide est la bienvenue :)
|
||||
|
||||
|
||||
3.6
|
||||
================================================================================
|
||||
Q: Je souhaiterai aider les développeurs WeeChat. Que puis-je faire ?
|
||||
|
||||
R: Il y a plusieurs choses Ă faire (code, documentation, ...)
|
||||
Merci de prendre contact avec nous par IRC ou mail, consultez la page
|
||||
support :
|
||||
http://weechat.flashtux.org/support.php
|
||||
|
||||
|
||||
3.7
|
||||
================================================================================
|
||||
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
|
||||
|
||||
R: La bière est la bienvenue :)
|
||||
Sinon le compte Paypal est: flashcode@free.fr (il n'y a pas de limite pour
|
||||
les dons :)
|
||||
@@ -1,10 +1,17 @@
|
||||
WeeChat - Installation instructions
|
||||
===================================
|
||||
|
||||
1) Run 'make'
|
||||
1) Run './configure'
|
||||
options: --enable-perl : enable Perl scripts
|
||||
--disable-curses : do not build Curses interface
|
||||
--enable-gtk : build Gtk+ interface (under development!)
|
||||
--enable-qt : build Qt interface (not developed!)
|
||||
--with-debug=X : X=1 for debug compilation, 2 for debug messages
|
||||
|
||||
2) As root, run 'make install'
|
||||
2) Run 'make'
|
||||
|
||||
3) Enjoy ! :-)
|
||||
3) As root, run 'make install'
|
||||
|
||||
See AUTHORS for any support, feel free to contact us for any problem ;)
|
||||
4) Enjoy ! :-)
|
||||
|
||||
See AUTHORS for support, feel free to contact us for any problem ;)
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
SUBDIRS = po intl src
|
||||
|
||||
EXTRA_DIST = config.rpath weechat-curses.1 BUGS FAQ FAQ.fr \
|
||||
debian/changelog debian/control \
|
||||
debian/copyright \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install debian/weechat-gtk.dirs \
|
||||
debian/weechat-gtk.install
|
||||
|
||||
man_MANS = weechat-curses.1
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
@@ -1,6 +1,50 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
FlashCode, 2003-09-27
|
||||
* FlashCode, 2005-05-21
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
WeeChat 0.1.2 released.
|
||||
|
||||
* FlashCode, 2005-03-20
|
||||
|
||||
WeeChat 0.1.1 released.
|
||||
|
||||
* FlashCode, 2005-02-12
|
||||
|
||||
WeeChat 0.1.0 released.
|
||||
|
||||
* FlashCode, 2005-01-01
|
||||
|
||||
WeeChat 0.0.9 released.
|
||||
|
||||
* FlashCode, 2004-10-30
|
||||
|
||||
WeeChat 0.0.8 released.
|
||||
|
||||
* FlashCode, 2004-08-08
|
||||
|
||||
WeeChat 0.0.7 released.
|
||||
|
||||
* FlashCode, 2004-06-05
|
||||
|
||||
WeeChat 0.0.6 released.
|
||||
|
||||
* FlashCode, 2004-02-07
|
||||
|
||||
WeeChat 0.0.5 released.
|
||||
|
||||
* FlashCode, 2004-01-01
|
||||
|
||||
WeeChat 0.0.4 released.
|
||||
|
||||
* FlashCode, 2003-11-03
|
||||
|
||||
WeeChat 0.0.3 released.
|
||||
|
||||
* FlashCode, 2003-10-05
|
||||
|
||||
WeeChat 0.0.2 released.
|
||||
|
||||
* FlashCode, 2003-09-27
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
|
||||
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
|
||||
Features
|
||||
--------
|
||||
* IRC chat client with multi-server connection
|
||||
* many GUI (curses, text, Gtk, QT) (1)
|
||||
* many GUI (curses, Gtk, Qt) (1)
|
||||
* small, fast and very light
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* compliant with RFC 1459,2810,2811,2812,2813
|
||||
* developed from scratch (not based on any other IRC client, except for look ;)
|
||||
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
||||
* 100% GPL & free
|
||||
|
||||
@@ -21,10 +22,7 @@ Features
|
||||
Copyright
|
||||
---------
|
||||
|
||||
WeeChat (c) Copyright 2003
|
||||
by: FlashCode <flashcode@flashtux.org>
|
||||
Xahlexx <xahlex@tuxisland.org>
|
||||
Bounga <bounga@altern.org>
|
||||
WeeChat (c) Copyright 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
(see AUTHORS file if you want to contact authors)
|
||||
|
||||
WeeChat is distributed under GPL licence (see COPYING file for complete license):
|
||||
@@ -45,6 +43,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
---
|
||||
(1) only curses & text interfaces are available today
|
||||
(2) plugin interfaces are not yet developed
|
||||
(1) only Curses interface is available today
|
||||
(2) only Perl interface is available today
|
||||
(3) only GNU/Linux version is available today
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2003-09-27
|
||||
TODO - 2005-05-21
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,121 +10,69 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.1:
|
||||
v0.1.2:
|
||||
------
|
||||
|
||||
* General:
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
# *BSD version
|
||||
# Mac OS X version
|
||||
|
||||
* IRC protocol:
|
||||
# "/quote" command: send a raw string to the server without parsing it
|
||||
# "/me" command (for user actions description)
|
||||
# "/away" command (to toggle the away status)
|
||||
# "/op", "/deop", "/voice", "/devoice" commands
|
||||
# "/invite" command
|
||||
# "/kick", "/ban", "/unban" commands
|
||||
# "/kill" command
|
||||
# "/list" command: list of channels
|
||||
# "/names" command: view who is on a given channel without being
|
||||
on it (for example /names #weechat gives all the nicks present on
|
||||
#weechat, except those who have the +i flag (server side))
|
||||
# "/oper" command: become operator on the irc network
|
||||
# "/topic" command: change the topic of a channel
|
||||
# "/version" command: give the irc client version (CTCP VERSION)
|
||||
of a given nick/channel (without parameter: gives WeeChat version)
|
||||
# "/whois" command
|
||||
- customizable CTCP version reply
|
||||
|
||||
* WeeChat commands:
|
||||
# "/clear": to clear window content
|
||||
|
||||
* Interface:
|
||||
# "demi-highlight" when joins/quits etc
|
||||
# log messages/warning/errors to ~/.weechat/log file
|
||||
# improve editing zone (left arrow <> backspace)
|
||||
# sort nick list
|
||||
# choose nick list position (top, left, right (default), bottom)
|
||||
# auto-resize nicklist (when nick too long)
|
||||
# do pretty cutting of long lines (align on the nick or after hour for server)
|
||||
# keep history of commands and call them again with up/down arrow
|
||||
# text GUI
|
||||
# ncurses GUI:
|
||||
# one window for each channel
|
||||
# color display
|
||||
# private windows
|
||||
# redraw window when term size is modified
|
||||
# chat history (pgup/pgdn for displaying history)
|
||||
# switch to other channel window
|
||||
# nicklist scroll keys
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* TCP/IP communication:
|
||||
# IPv4 protocol implementation
|
||||
- SSL support
|
||||
|
||||
* Configuration:
|
||||
# write default config file
|
||||
- add key bindings to config file
|
||||
|
||||
* Plugins:
|
||||
# Python plugin
|
||||
# "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* IRC protocol:
|
||||
- implement RFC 2812
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- manage "halfop" status
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/connect" and "/disconnect" commands (for multiservers use)
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
nick/host
|
||||
- when we're away, WeeChat should log all the lines begenning by our nick.
|
||||
When we come back from our away it should print it to the current window
|
||||
- "/rehash" command: tell the server to reload its config file
|
||||
- "/restart" command: tell the server to restart itself
|
||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||
nick/host connect to the given irc network
|
||||
- "/wallops" command: write the same string to all the
|
||||
persons with the flag +w enable
|
||||
|
||||
* WeeChat commands:
|
||||
- "/reload" command: reload the WeeChat's config file
|
||||
- "/highlight" command: highlight a given word when it appears on
|
||||
channels/privates
|
||||
- "/completion" command: do shortcuts (for example when we type "u"
|
||||
in the text bar it send it to the server as "you")
|
||||
- "/exec" command: execute a command as if we was in shell
|
||||
and show us the output on the current window. An option to exec
|
||||
like -o could send the output to the server, on the current
|
||||
channel/private
|
||||
- "/reload" command: reload the WeeChat's config file
|
||||
- "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colours, time
|
||||
format, etc)
|
||||
- "/highlight" command: highlight a given word when it appears on
|
||||
channels/privates
|
||||
- "/last": command to look for text in previous messages
|
||||
|
||||
* Interface:
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret ^B in messages (this means bold text)
|
||||
- internationalization (traduce WeeChat in many languages)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- log chats to file
|
||||
- forget some old lines that were displayed long time ago (now all is saved,
|
||||
if WeeChat is running for long time, a lot of memory is used!)
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- add clock (in status bar?)
|
||||
- Gtk GUI
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- proxy support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
- add missing options for config file
|
||||
- write config file
|
||||
- add an option for each server in order to run commands on join
|
||||
(example: /msg nickserv identify password)
|
||||
- channel list for auto-join (for each server)
|
||||
- do not stop program if problem with options in config file
|
||||
- load config file after GUI (so init values by default (colors, ...) before
|
||||
loading config)
|
||||
|
||||
* Plugins:
|
||||
- add Perl plugin
|
||||
- add Python plugin
|
||||
- add Ruby plugin
|
||||
- "/load" and "/unload" commands to (un)load extension scripts
|
||||
(perl, python, ruby, ...)
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# gettextize updates Makefile.am, configure.in
|
||||
cp configure.in configure.in.old
|
||||
cp Makefile.am Makefile.am.old
|
||||
gettextize --copy --force --intl --no-changelog &&
|
||||
mv Makefile.am.old Makefile.am
|
||||
mv configure.in.old configure.in
|
||||
aclocal &&
|
||||
# autoheader creates config.h.in needed by autoconf
|
||||
autoheader &&
|
||||
# autoconf creates configure
|
||||
autoconf &&
|
||||
# automake creates Makefile.in
|
||||
automake --add-missing --copy --gnu
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.1.2, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.2])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr es"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([ncurses], [initscr], LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
|
||||
AM_OPTIONS_WXCONFIG
|
||||
AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
AC_MSG_CHECKING([for socklen_t])
|
||||
AC_CACHE_VAL(ac_cv_type_socklen_t,
|
||||
[AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[socklen_t t;],
|
||||
ac_cv_type_socklen_t=yes,
|
||||
ac_cv_type_socklen_t=no,
|
||||
)])
|
||||
if test $ac_cv_type_socklen_t = no; then
|
||||
AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.)
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_type_socklen_t)
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=auto)],,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets,[ --enable-wxwidgets Turn on WxWidgets interface (default=no)],enable_wxwidgets=yes,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||
AC_ARG_ENABLE(python, [ --enable-python Turn on Python plugins (default=no)],enable_python=yes,enable_python=no)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
enable_plugins="no"
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([
|
||||
*** ncurses library not found!
|
||||
*** Please install ncurses library or run ./configure with --disable-ncurses parameter.])
|
||||
fi
|
||||
NCURSES_LIBS="-lncurses"
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
if test "x$enable_wxwidgets" = "xyes" ; then
|
||||
if test "$wxWin" != 1; then
|
||||
AC_MSG_ERROR([
|
||||
*** wxWindows must be installed on your system
|
||||
*** but wx-config script couldn't be found.
|
||||
|
||||
*** Please check that wx-config is in path, the directory
|
||||
*** where wxWindows libraries are installed (returned by
|
||||
*** 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
*** equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
])
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
|
||||
WXWIDGETS_CFLAGS=""
|
||||
WXWIDGETS_LIBS=""
|
||||
fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
|
||||
#fi
|
||||
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
|
||||
GTK_LIBS=`pkg-config --libs gtk+-2.0`
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
fi
|
||||
|
||||
PLUGINS_LIBS=
|
||||
|
||||
if test "x$enable_perl" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
|
||||
AC_PATH_PROG(PERL, perl)
|
||||
if test -z $PERL ; then
|
||||
AC_MSG_ERROR([
|
||||
*** Perl must be installed on your system
|
||||
*** but perl interpreter couldn't be found in path.
|
||||
|
||||
Please check that perl is in path, or install
|
||||
it with your software package manager.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for Perl library)
|
||||
PERL_LIB=`$PERL -e 'use Config; print "$Config{installprefix}/lib/$Config{libperl}"'`
|
||||
|
||||
if test -r "$PERL_LIB"; then
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `perl -MExtUtils::Embed -e ldopts`"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Perl library couldn't be found in your system.
|
||||
*** Try to install it with your software package manager.])
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
|
||||
AC_SUBST(PERL_CFLAGS)
|
||||
AC_DEFINE(PLUGIN_PERL)
|
||||
fi
|
||||
|
||||
if test "x$enable_python" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
|
||||
AC_PATH_PROG(PYTHON, python)
|
||||
if test -z $PYTHON ; then
|
||||
AC_MSG_ERROR([
|
||||
*** Python must be installed on your system
|
||||
*** but python interpreter couldn't be found in path.
|
||||
|
||||
*** Please check that python is in path, or install
|
||||
*** it with your software package manager.])
|
||||
fi
|
||||
|
||||
PYTHON_INCLUDE=`$PYTHON -c 'import sys ; print "%s/include/python%s" % (sys.prefix, sys.version[[:3]])'`
|
||||
|
||||
AC_MSG_CHECKING(for Python header files)
|
||||
if test -r "$PYTHON_INCLUDE/Python.h"; then
|
||||
PYTHON_CFLAGS=`$PYTHON -c "import distutils.sysconfig,string; print ' -I' + distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Python header files couldn't be found in your system.
|
||||
*** Try to install them with your software package manager.])
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PYTHON_LIB=`$PYTHON -c 'import sys; print "%s/lib/python%s/config" % (sys.prefix, sys.version[[:3]])'`
|
||||
PYTHON_VERSION=`$PYTHON -c 'import sys ; print sys.version[[0:3]]'`
|
||||
|
||||
AC_MSG_CHECKING(for Python library)
|
||||
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so" -a -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
|
||||
PYTHON_LFLAGS=`$PYTHON -c "import distutils.sysconfig,string; print string.join(distutils.sysconfig.get_config_vars('LINKFORSHARED', 'BLDLIBRARY', 'SHLIBS'))"`
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Python library couldn't be found in your system.
|
||||
*** Try to install it with your software package manager.])
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/python/lib_weechat_python.a $PYTHON_LFLAGS"
|
||||
AC_SUBST(PYTHON_CFLAGS)
|
||||
AC_DEFINE(PLUGIN_PYTHON)
|
||||
fi
|
||||
|
||||
if test "x$enable_plugins" = "xyes" ; then
|
||||
AC_DEFINE(PLUGINS)
|
||||
fi
|
||||
|
||||
AC_SUBST(PLUGINS_LIBS)
|
||||
|
||||
CFLAGS=`echo $CFLAGS | sed s/-g//g`
|
||||
if test "x$CFLAGS" = "x" ; then
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
|
||||
CFLAGS="-Wall -W $CFLAGS -pipe -g"
|
||||
else
|
||||
CFLAGS="-Wall -W $CFLAGS -pipe"
|
||||
fi
|
||||
|
||||
if test "x$debug" = "x2" ; then
|
||||
AC_DEFINE(DEBUG)
|
||||
fi
|
||||
|
||||
dnl For FreeBSD
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
src/plugins/Makefile
|
||||
src/plugins/perl/Makefile
|
||||
src/plugins/python/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
src/gui/wxwidgets/Makefile
|
||||
src/gui/gtk/Makefile
|
||||
src/gui/qt/Makefile
|
||||
intl/Makefile
|
||||
po/Makefile.in])
|
||||
|
||||
echo
|
||||
echo $PACKAGE $VERSION
|
||||
|
||||
listgui=
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
listgui="$listgui ncurses"
|
||||
fi
|
||||
if test "x$enable_wxwidgets" = "xyes"; then
|
||||
listgui="$listgui WxWidgets"
|
||||
fi
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
listgui="$listgui Gtk+"
|
||||
fi
|
||||
if test "x$enable_qt" = "xyes" ; then
|
||||
listgui="$listgui Qt"
|
||||
fi
|
||||
|
||||
if test "x$listgui" = "x" ; then
|
||||
AC_MSG_ERROR([
|
||||
*** No interface specified...
|
||||
*** Please specify at least ncurses, WxWidgets, Gtk or Qt.])
|
||||
fi
|
||||
|
||||
msg_debug_compiler="no"
|
||||
msg_debug_verbose="no"
|
||||
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
|
||||
msg_debug_compiler="yes"
|
||||
fi
|
||||
if test "x$debug" = "x2" ; then
|
||||
msg_debug_verbose="yes"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Interfaces.................... :$listgui
|
||||
echo
|
||||
echo Build with Plugin support..... : $enable_plugins
|
||||
echo Build with Perl support....... : $enable_perl
|
||||
echo Build with Python support..... : $enable_python
|
||||
echo Build with Ruby support....... : $enable_ruby
|
||||
echo
|
||||
echo Compile with debug info....... : $msg_debug_compiler
|
||||
echo Print debugging messages...... : $msg_debug_verbose
|
||||
echo
|
||||
eval eval echo WeeChat will be installed in $bindir.
|
||||
echo
|
||||
echo configure complete, now type \'make\' to build WeeChat
|
||||
echo
|
||||
Vendored
+75
-1
@@ -1,5 +1,79 @@
|
||||
weechat (0.1.2-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.2, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 21 May 2005 08:00:00 +0200
|
||||
|
||||
weechat (0.1.1-2) unstable; urgency=low
|
||||
|
||||
* debian/control:
|
||||
- Add myself to uploaders.
|
||||
- Remove unecessary dependency on weechat-gtk (Closes: #308287).
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Tue, 10 May 2005 22:38:52 +0200
|
||||
|
||||
weechat (0.1.1-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.1, see ChangeLog for detail (closes: #306492)
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 20 Mar 2005 08:00:00 +0200
|
||||
|
||||
weechat (0.1.0-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.0, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 12 Feb 2005 12:00:00 +0200
|
||||
|
||||
weechat (0.0.9-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.9, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 01 Jan 2005 13:00:00 +0200
|
||||
|
||||
weechat (0.0.8-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.8, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 30 Oct 2004 11:40:00 +0200
|
||||
|
||||
weechat (0.0.7-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.7, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 08 Aug 2004 21:00:00 +0200
|
||||
|
||||
weechat (0.0.6-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.6, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 05 Jun 2004 11:30:00 +0200
|
||||
|
||||
weechat (0.0.5-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.5, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 07 Feb 2004 20:30:00 +0200
|
||||
|
||||
weechat (0.0.4-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.4, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Thu, 01 Jan 2004 13:00:00 +0200
|
||||
|
||||
weechat (0.0.3-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.3, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Mon, 03 Nov 2003 23:15:00 +0200
|
||||
|
||||
weechat (0.0.2-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.2, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sun, 05 Oct 2003 12:00:00 +0200
|
||||
|
||||
weechat (0.0.1-1) unstable; urgency=low
|
||||
|
||||
* First version.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 27 Jun 2003 12:00:00 +0200
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 27 Sep 2003 12:00:00 +0200
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
4
|
||||
Vendored
+22
-5
@@ -1,14 +1,31 @@
|
||||
Source: weechat
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0)
|
||||
Standards-Version: 3.5.8
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Uploaders: Julien Louis <ptitlouis@sysif.net>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev, python2.3 (>= 2.3), python-dev
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: weechat
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Architecture: all
|
||||
Depends: weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-curses
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
Recommends: weechat-curses | weechat-gtk
|
||||
Description: Common files for WeeChat
|
||||
Documentation, examples, and locale files for WeeChat - fast, light and
|
||||
extensible IRC client. It is useless without weechat-curses or weechat-gtk.
|
||||
|
||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 27 Sep 2003 10:00:00 +0200.
|
||||
Sat, 21 May 2005 08:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
Upstream Author(s): FlashCode <flashcode@flashtux.org>
|
||||
Upstream Author: FlashCode <flashcode@flashtux.org>
|
||||
|
||||
Copyright:
|
||||
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
weechat_0.0.1-1_i386.deb net optional
|
||||
Vendored
+33
-49
@@ -1,15 +1,7 @@
|
||||
#!/usr/bin/make -f
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
@@ -22,8 +14,8 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--enable-perl --enable-python
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -31,21 +23,14 @@ build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE)
|
||||
#/usr/bin/docbook-to-man debian/weechat.sgml > weechat.1
|
||||
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
|
||||
-$(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -53,45 +38,44 @@ install: build
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/weechat.
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
||||
dh_install --sourcedir=debian/weechat
|
||||
install -o root -g root -m 755 src/gui/curses/weechat-curses $(CURDIR)/debian/weechat-curses/usr/bin
|
||||
# install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
dh_testdir -pweechat-common -pweechat
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installexamples -pweechat-common
|
||||
dh_compress -pweechat-common -pweechat
|
||||
dh_link -pweechat usr/share/doc/weechat-common usr/share/doc/weechat
|
||||
dh_fixperms -pweechat-common -pweechat
|
||||
dh_installdeb -pweechat-common -pweechat
|
||||
dh_shlibdeps -pweechat-common -pweechat
|
||||
dh_gencontrol -pweechat-common -pweechat
|
||||
dh_md5sums -pweechat-common -pweechat
|
||||
dh_builddeb -pweechat-common -pweechat
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
dh_installman weechat.1
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
# dh_perl
|
||||
# dh_python
|
||||
# dh_makeshlibs
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
# dh_installchangelogs -a
|
||||
# dh_installdocs -a
|
||||
dh_installman weechat-curses.1 -pweechat-curses
|
||||
dh_link -a usr/share/doc/weechat-common usr/share/doc/weechat-curses
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
dh_installdeb -a
|
||||
dh_shlibdeps -a
|
||||
dh_gencontrol -a
|
||||
dh_md5sums -a
|
||||
dh_builddeb -a
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
|
||||
+1
-3
@@ -1,9 +1,7 @@
|
||||
AUTHORS
|
||||
BUGS
|
||||
ChangeLog
|
||||
COPYING
|
||||
FAQ
|
||||
INSTALL
|
||||
FAQ.fr
|
||||
NEWS
|
||||
README
|
||||
TODO
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/share/locale
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/bin/weechat-curses
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/bin/weechat-gtk
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
shlibs:Depends=libc6 (>= 2.3.2-1), libncurses5 (>= 5.3.20030510-1)
|
||||
@@ -0,0 +1,36 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi weechat_doc_es.texi
|
||||
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
|
||||
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
|
||||
export LANG=es_ES && makeinfo --html --no-split --number-sections weechat_doc_es.texi
|
||||
export LANG=es_ES && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_es.texi >weechat_doc_es.txt
|
||||
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
|
||||
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
|
||||
export LANG=en_EN && texi2pdf weechat_doc_en.texi
|
||||
export LANG=es_ES && texi2pdf weechat_doc_es.texi
|
||||
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
|
||||
|
||||
clean:
|
||||
rm -rf weechat_doc_*.aux weechat_doc_*.cp weechat_doc_*.fn \
|
||||
weechat_doc_*.html weechat_doc_*.ky weechat_doc_*.log \
|
||||
weechat_doc_*.pdf weechat_doc_*.pg weechat_doc_*.toc \
|
||||
weechat_doc_*.tp weechat_doc_*.txt weechat_doc_*.vr
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,791 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename weechat_doc_pt.info
|
||||
@settitle WeeChat - Um cliente de IRC rapido, leve e extencivel
|
||||
@c %**end of header
|
||||
|
||||
@c WeeChat documentation (vers@~ao partuguesa)
|
||||
@c
|
||||
@c Copyright (c) 2005 by FlashCode <flashcode@flashtux.org>
|
||||
@c
|
||||
@c This manual is free software; you can redistribute it and/or modify
|
||||
@c it under the terms of the GNU General Public License as published by
|
||||
@c the Free Software Foundation; either version 2 of the License, or
|
||||
@c (at your option) any later version.
|
||||
@c
|
||||
@c This manual is distributed in the hope that it will be useful,
|
||||
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@c GNU General Public License for more details.
|
||||
@c
|
||||
@c You should have received a copy of the GNU General Public License
|
||||
@c along with this program; if not, write to the Free Software
|
||||
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@c pdf : texi2pdf weechat_doc_pt.texi
|
||||
@c html: makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||
|
||||
@c tex
|
||||
@c \overfullrule=0pt
|
||||
@c end tex
|
||||
|
||||
@documentlanguage pt
|
||||
|
||||
@titlepage
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.2 - 21 de Maio de 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@page
|
||||
|
||||
Este manual documenta o cliente de IRC WeeChat, ele faz parte do WeeChat.@*
|
||||
@*
|
||||
A ultima versĂŁo deste documento pode ser descarregada de :@*
|
||||
@uref{http://weechat.flashtux.org/doc.php}@*
|
||||
@*
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@*
|
||||
Este documento pode ser utilizado sobre os termos da Licen@,{c}a P@'ublica geral GNU (GNU General Public
|
||||
License) vers@~ao 2 ou superior.
|
||||
|
||||
@end titlepage
|
||||
|
||||
@everyheading @thischapter @| @|
|
||||
@everyfooting @thistitle @| @| Pagina @thispage
|
||||
|
||||
@contents
|
||||
|
||||
@node Top, Introducao, (dir), (dir)
|
||||
@menu
|
||||
* Introducao:: Descri@,{c}@~ao do WeeChat
|
||||
* Instalacao:: Instala@,{c}@~ao do WeeChat
|
||||
* Utilizacao:: Utiliza@,{c}@~ao do WeeChat
|
||||
* Extencoes:: Exten@,{c}@~oes do Weechat
|
||||
* Autores/Suporte:: Contactar os autores e obter suporte
|
||||
@end menu
|
||||
|
||||
|
||||
@c ******************************* Introducao *******************************
|
||||
|
||||
@node Introducao, Instalacao, Top, Top
|
||||
@chapter Introdu@,{c}@~ao
|
||||
@menu
|
||||
* Descricao::
|
||||
* Pre-requisitos::
|
||||
@end menu
|
||||
|
||||
@node Descricao, Pre-requisitos, Introducao, Introducao
|
||||
@section Descri@,{c}@~ao
|
||||
|
||||
O WeeChat (Wee Enhanced Environment for Chat) @'e um cliente de IRC livre, r@'apido e leve,
|
||||
concebido para funcionar em diversos sistemas operativos.@*
|
||||
@*
|
||||
As suas caracter@'isticas prinicpais s@~ao as seguintes :
|
||||
@itemize @minus
|
||||
@item
|
||||
liga@,{c}@~ao a m@'ultiplos servidores
|
||||
@item
|
||||
v@'arias interfaces : Curses, Gtk e Qt
|
||||
@item
|
||||
pequeno r@'apido e leve
|
||||
@item
|
||||
configuravel e extenc@'ivel com scripts
|
||||
@item
|
||||
compat@'ivel com RFCs 1459, 2810, 2811, 2812, e 2813
|
||||
@item
|
||||
multiplataforma (Gnu/Linux, *BSD, Windows e outros)
|
||||
@item
|
||||
100% GPL, Software Livre
|
||||
@end itemize
|
||||
|
||||
@*
|
||||
A p@'agina Web do Weechat @'e aqui :@*
|
||||
@uref{http://weechat.flashtux.org}@*
|
||||
|
||||
@node Pre-requisitos, ,Descricao, Introducao
|
||||
@section Pr@'e-requisitos
|
||||
|
||||
Para instalar o Weechat, vais @b{precisar} de ter :@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Um sistema Gnu/Linux (com um compilador e outros utilit@'arios associados aos pacotes de c@'odigo fonte)
|
||||
@item
|
||||
Direitos de "root" (para instalar)
|
||||
@item
|
||||
Consoante a interface escolhida, uma das seguintes bibliotecas :
|
||||
@itemize @minus
|
||||
@item
|
||||
Curses: a biblioteca ncurses,
|
||||
@item
|
||||
Gtk: *** interface n@~ao desenvolvida ***,
|
||||
@item
|
||||
Qt: *** interface n@~ao desenvolvida ***,
|
||||
@end itemize
|
||||
@end itemize
|
||||
|
||||
|
||||
@c ******************************* Instalacao *******************************
|
||||
|
||||
@node Instalacao, Utilizacao, Introducao, Top
|
||||
@chapter Instala@,{c}@~ao
|
||||
@menu
|
||||
* Binarios::
|
||||
* Codigo Fonte::
|
||||
* Codigo Fonte via CVS::
|
||||
@end menu
|
||||
|
||||
@node Binarios, Codigo Fonte, Instalacao, Instalacao
|
||||
@section Bin@'arios
|
||||
|
||||
Os pacotes bin@'arios est@'ao dispon@'iveis para as seguintes distribui@,{c}@~oes :
|
||||
@itemize @bullet
|
||||
@item
|
||||
Debian (ou compat@'ivel)@*
|
||||
Instala@,{c}@~ao : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
|
||||
@item
|
||||
Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
|
||||
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Instala@,{c}@~ao : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
Slackware (n@~ao dispon@'ivel !)
|
||||
@item
|
||||
Windows (n@~ao dispon@'ivel !)
|
||||
@end itemize
|
||||
|
||||
Onde x.y.z @'e a vers@~ao (por exemplo 0.0.1)
|
||||
@*
|
||||
|
||||
@node Codigo Fonte, Codigo Fonte via CVS, Binarios, Instalacao
|
||||
@section C@'odigo Fonte
|
||||
|
||||
Escreve simplesmente numa consola ou num terminal :@*
|
||||
@kbd{./configure}@*
|
||||
@kbd{make}@*
|
||||
Nota: Para compilar certas interfaces, podes passar par@^ametros
|
||||
ao ./configure, escreve @kbd{./configure --help} para veres as op@,{c}@~oes.@*
|
||||
|
||||
Obter os direitos do root e instalar o Weechat :@*
|
||||
@kbd{su}@*
|
||||
(escreve aqui a palavra-passe do superutilizador)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@node Codigo Fonte via CVS, , Codigo Fonte, Instalacao
|
||||
@section C@'odigo Fonte via CVS
|
||||
|
||||
Aten@,{c}@~ao: o c@'odigo fonte CVS est@'a reservado aos utilizadores avan@,{c}ados : o WeeChat pode n@~ao compilar ou ficar inst@'avel.@*
|
||||
Considera-te avisado !@*
|
||||
|
||||
Para sacares o c@'odigo fonte via CVS, escreve estes comandos :@*
|
||||
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||
(quando te pedirem a palavra-passe, primen simplesmente Enter)@*
|
||||
|
||||
Executa o script :@*
|
||||
@kbd{./autogen.sh}@*
|
||||
|
||||
Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fonte}.
|
||||
|
||||
|
||||
@c ******************************* Utilizacao ********************************
|
||||
|
||||
@node Utilizacao, Extencoes, Instalacao, Top
|
||||
@chapter Utiliza@,{c}@~ao
|
||||
|
||||
@menu
|
||||
* Invocar o WeeChat::
|
||||
* Recursos de teclado::
|
||||
* Comandos do WeeChat::
|
||||
* FIFO pipe::
|
||||
@end menu
|
||||
|
||||
@node Invocar o WeeChat, Recursos de teclado, Utilizacao, Utilizacao
|
||||
@section Invocar o WeeChat
|
||||
|
||||
@subsection Par@^ametros de linha de comandos
|
||||
|
||||
@table @code
|
||||
@item -c, --config
|
||||
Mostrar da lima dos config da exposi@,{c}@~ao (lista das op@,{c}@~oes)
|
||||
@item -h, --help
|
||||
Mostrar a ajuda@*
|
||||
@item -l, --license
|
||||
Mostrar a licen@,{c}a do WeeChat@*
|
||||
@item -v, --version
|
||||
Mostrar a vers@~ao do WeeChat@*
|
||||
@end table
|
||||
|
||||
@subsection Invocar o WeeChat
|
||||
|
||||
Escreve simplesmente este comando para invoceres o WeeChat :@*
|
||||
@kbd{weechat-curses} (para a interface em Curses)@*
|
||||
ou @kbd{weechat-gtk} (para a interface em Gtk)@*
|
||||
ou @kbd{weechat-qt} (para a interface em Qt)@*
|
||||
|
||||
Logo que lan@,{c}ares o WeeChat pela primeira vez, um ficheiro de configura@,{c}@~ao
|
||||
por defeito @'e criado, com as configura@,{c}@~oes por defeito.@*
|
||||
O ficheiro de configura@,{c}@~ao por defeito @'e : ~/.weechat/weechat.rc@*
|
||||
|
||||
Podes editar esse ficheiro para configurar o WeeChat @`a tua maneira, man tamb@'em podes modificar os par@^ametros dentro do WeeChat utilizando o comando @kbd{/set} - @xref{Comandos do WeeChat}.
|
||||
|
||||
@node Recursos de teclado, Comandos do WeeChat, Invocar o WeeChat, Utilizacao
|
||||
@section Recursos de teclado
|
||||
|
||||
@table @kbd
|
||||
@item Seta esquerda / Seta direita
|
||||
Ir um caractere para traz / para a frente na linha de comando@*
|
||||
@*
|
||||
@item Ctrl + Seta esquerda / Ctrl + Seta Direita
|
||||
Ir uma palavra para traz / para a frente na linha de comando@*
|
||||
@*
|
||||
@item Home / Ctrl + A
|
||||
Ir para o in@'icio da linha de comando@*
|
||||
@*
|
||||
@item End / Ctrl + E
|
||||
Ir para o fim da linha de comando@*
|
||||
@*
|
||||
@item Backspace / Delete
|
||||
Apagar o caractere anterior / seguinte na linha de comando@*
|
||||
@*
|
||||
@item Ctrl + Backspace / Ctrl + W
|
||||
Apagar a palavra anterior na linha de comando
|
||||
@*
|
||||
@item Tab
|
||||
Completar o comando ou o nick (@kbd{Tab} novamente : encontrar a pr@'oxima sugest@~ao)@*
|
||||
@*
|
||||
@item Qualquer caractere
|
||||
Inserir o caractere na linha de comando, no s@'itio do cursor@*
|
||||
@*
|
||||
@item Enter
|
||||
Executa o comando ou envia a mensagem@*
|
||||
@*
|
||||
@item Seta para cima / Seta para baixo
|
||||
Repetir os ultimos comandos/mensagens@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Navegar no hist@'orico da janela@*
|
||||
@*
|
||||
@item F5 / F6
|
||||
Comute ao amortecedor anterior / seguinte@*
|
||||
@*
|
||||
@item F7 / F8
|
||||
Comute ao janela anterior / seguinte@*
|
||||
@*
|
||||
@item F10
|
||||
Apagar a @'ultima mensagem da barra do info@*
|
||||
@*
|
||||
@item F11 / F12
|
||||
Scroll nicklist@*
|
||||
@*
|
||||
@item Ctrl + L
|
||||
Redesenhe a janela inteira@*
|
||||
@*
|
||||
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||
Identico a F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
|
||||
@*
|
||||
@item Alt + D
|
||||
Exposi@,{c}@~ao DCC atual@*
|
||||
@*
|
||||
@item Alt + R
|
||||
Hotlist desobstru@'ido (notifica@,{c}@~ao da atividade em outros amortecedores)@*
|
||||
@*
|
||||
@item Alt + S
|
||||
Comute ao amortecedor do servidor@*
|
||||
@*
|
||||
@item Alt + X
|
||||
Comute @`a primeira canaleta do servidor seguinte (ou do amortecedor do servidor se nenhuma canaleta for aberta)@*
|
||||
@*
|
||||
@item Alt + d@'igito (1-9)
|
||||
Comute ao amortecedor pelo n@'umero@*
|
||||
@*
|
||||
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
|
||||
Scroll nicklist@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Comandos do WeeChat, FIFO pipe, Recursos de teclado, Utilizacao
|
||||
@section Comandos do WeeChat
|
||||
|
||||
N@~AO ESCRITO !
|
||||
|
||||
@node FIFO pipe, , Comandos do WeeChat, Utilizacao
|
||||
@section FIFO pipe
|
||||
|
||||
You can remote control WeeChat, by sending commands or text to a FIFO pipe
|
||||
(you have to enable option "irc_fifo_pipe", it is disabled by default).@*
|
||||
The FIFO pipe is located in ~/.weechat/ and is called "weechat_fifo_xxxxx"
|
||||
(where xxxxx is the process ID (PID) of running WeeChat).@*
|
||||
So if many WeeChat are running, you have many FIFO pipe, one for each session.@*
|
||||
@*
|
||||
The syntax for the FIFO pipe commands/text is:@*
|
||||
@command{server,channel *text or command here}@*
|
||||
where server and channel are optional, but if channel is here, server should be too.@*
|
||||
@*
|
||||
Some examples:
|
||||
@table @asis
|
||||
@item @bullet{} change your nick on freenode to "mynick|out":
|
||||
@*
|
||||
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on #weechat channel:
|
||||
@*
|
||||
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
|
||||
@*
|
||||
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
|
||||
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
You can write a script to send command to all running WeeChat at same time, for example:@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
If the script is called "auto_weechat_command", you can run it with:@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *hello"}
|
||||
|
||||
|
||||
@c ******************************* Extencoes *********************************
|
||||
|
||||
@node Extencoes, Autores/Suporte, Utilizacao, Top
|
||||
@chapter Exten@,{c}@~oes
|
||||
|
||||
@menu
|
||||
* Scripts Perl::
|
||||
* Scripts Python::
|
||||
* Scripts Ruby::
|
||||
@end menu
|
||||
|
||||
@node Scripts Perl, Scripts Python, Extencoes, Extencoes
|
||||
@section Scripts Perl
|
||||
|
||||
@subsection Carregar/Descarregar Scripts Perl
|
||||
|
||||
Os Scripts Perl s@~ao carregados e descarregados com o comando @command{/perl}.
|
||||
(escreve @kbd{/help perl} dentro do WeeChat para obteres ajuda acerca do comando).@*
|
||||
|
||||
@emph{Exemplos:}@*
|
||||
@itemize @bullet
|
||||
@item
|
||||
Carregar um Script Perl: @kbd{/perl load /tmp/sample.pl}@*
|
||||
@item
|
||||
Descarregar todos os Scripts Perl: @kbd{/perl unload}@*
|
||||
@item
|
||||
Listar todos os Scripts Perl: @kbd{/perl}@*
|
||||
@end itemize
|
||||
|
||||
@subsection Interface WeeChat / Perl
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@command{weechat::register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
|
||||
@*
|
||||
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Perl.@*
|
||||
Todos os Scripts Perl para o Weechat devem invocar esta fun@,{c}@~ao.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome @'unico que indentifique o script (cada Script Perl deve ter um @'unico nome)
|
||||
@item @option{vers@~ao}: vers@~ao do script
|
||||
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Perl invocada quando o script Ă© descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
|
||||
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat::register ("sample", "1.0", "sample_end", "Sample script!");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat::print ( mensagem, [canal, [servidor]] );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na canal.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@item @option{canal}: nome da canal
|
||||
@item @option{servidor}: nome interno da servidor
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat::print ("mensagem");}@*
|
||||
@code{weechat::print ("mensagem", "#weechat");}@*
|
||||
@code{weechat::print ("mensagem", "#weechat", "freenode");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat::print_infobar ( atrasa, mensagem );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na barra do info.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
|
||||
(se 0, mensagem n@~ao forem apagados).
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat::print_infobar (5, "mensagem");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat::add_message_handler ( nome, fun@,{c}@~ao );}@*
|
||||
@*
|
||||
Anexa uma fun@,{c}@~ao Perl a uma mensagem de IRC.@*
|
||||
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome da mensagem IRC@*
|
||||
Para conheceres uma lista de mensagens de IRC, por favor lĂŞ o RFC 1459 e/ou o 2812:@*
|
||||
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl invocada quando a mensagem Ă© recebida
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat::add_message_handler ("privmsg", my_function);}@*
|
||||
@code{sub my_function}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
|
||||
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
|
||||
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat::add_command_handler ( nome, fun@,{c}@~ao );}@*
|
||||
@*
|
||||
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Perl.@*
|
||||
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome do novo comando@*
|
||||
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Perl. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Perl.
|
||||
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl ligada ao comando
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat::add_command_handler ("command", my_command);}@*
|
||||
@code{sub my_command}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ weechat::print("Argumentos: ".@@_[0]);}@*
|
||||
@code{@ @ @ @ return 0;}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat::command ( command, [channel, [server]] );}@*
|
||||
@*
|
||||
Execute a command or send a message to a channel.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{command}: command to execute (or message to send in a channel)
|
||||
@item @option{channel}: name of channel
|
||||
@item @option{server}: internal name of server
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Examples:}@*
|
||||
@code{weechat::command ("hello world!");}@*
|
||||
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
|
||||
@code{weechat::command ("/nick newnick", "", "freenode");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat::get_info ( nome, [servidor] );}@*
|
||||
@*
|
||||
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome do info a recuperar:
|
||||
@item @option{servidor}: nome interno da servidor
|
||||
@itemize @minus
|
||||
@item @option{0 ou version}: comece a vers@~ao de WeeChat
|
||||
@item @option{1 ou nick}: comece o nickname
|
||||
@item @option{2 ou channel}: comece o nome da canal
|
||||
@item @option{3 ou server}: comece o nome do servidor
|
||||
@item @option{4 ou weechatdir}: comece a WeeChat o diret@'orio home
|
||||
@item @option{5 ou away}: comece a bandeira ausente para o servidor
|
||||
@end itemize
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplos:}@*
|
||||
@code{$version = get_info("version");}@*
|
||||
@code{$nick = get_info("nick", "freenode");}@*
|
||||
@*
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Scripts Python, Scripts Ruby, Scripts Perl, Extencoes
|
||||
@section Scripts Python
|
||||
|
||||
@subsection Carregar/Descarregar Scripts Python
|
||||
|
||||
Os Scripts Python s@~ao carregados e descarregados com o comando @command{/python}.
|
||||
(escreve @kbd{/help python} dentro do WeeChat para obteres ajuda acerca do comando).@*
|
||||
|
||||
@emph{Exemplos:}@*
|
||||
@itemize @bullet
|
||||
@item
|
||||
Carregar um Script Python: @kbd{/python load /tmp/sample.py}@*
|
||||
@item
|
||||
Descarregar todos os Scripts Python: @kbd{/python unload}@*
|
||||
@item
|
||||
Listar todos os Scripts Python: @kbd{/python}@*
|
||||
@end itemize
|
||||
|
||||
@subsection Interface WeeChat / Python
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@command{weechat.register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
|
||||
@*
|
||||
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Python.@*
|
||||
Todos os Scripts Python para o Weechat devem invocar esta fun@,{c}@~ao.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome @'unico que indentifique o script (cada Script Python deve ter um @'unico nome)
|
||||
@item @option{vers@~ao}: vers@~ao do script
|
||||
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Python invocada quando o script Ă© descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
|
||||
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat.prnt ( mensagem, [canal, [servidor]] );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na canal.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@item @option{canal}: nome da canal
|
||||
@item @option{servidor}: nome interno da servidor
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat.prnt ("mensagem");}@*
|
||||
@code{weechat.prnt ("mensagem", "#weechat");}@*
|
||||
@code{weechat.prnt ("mensagem", "#weechat", "freenode");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat.print_infobar ( atrasa, mensagem );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na barra do info.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
|
||||
(se 0, mensagem n@~ao forem apagados).
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat.print_infobar (5, "mensagem");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat.add_message_handler ( nome, fun@,{c}@~ao );}@*
|
||||
@*
|
||||
Anexa uma fun@,{c}@~ao Python a uma mensagem de IRC.@*
|
||||
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome da mensagem IRC@*
|
||||
Para conheceres uma lista de mensagens de IRC, por favor lĂŞ o RFC 1459 e/ou o 2812:@*
|
||||
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Python invocada quando a mensagem Ă© recebida
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat.add_message_handler ("privmsg", my_function);}@*
|
||||
@code{sub my_function}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
|
||||
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
|
||||
@code{@ @ @ @ weechat.prnt ("host=$hostmask, chan=$channel, msg=$message\n");}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat.add_command_handler ( nome, fun@,{c}@~ao );}@*
|
||||
@*
|
||||
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Python.@*
|
||||
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome do novo comando@*
|
||||
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Python. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Python.
|
||||
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Python ligada ao comando
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{weechat.add_command_handler ("command", my_command);}@*
|
||||
@code{sub my_command}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ weechat.prnt("Argumentos: ".@@_[0]);}@*
|
||||
@code{@ @ @ @ return 0;}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat.command ( command, [channel, [server]] );}@*
|
||||
@*
|
||||
Execute a command or send a message to a channel.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{command}: command to execute (or message to send in a channel)
|
||||
@item @option{channel}: name of channel
|
||||
@item @option{server}: internal name of server
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Examples:}@*
|
||||
@code{weechat.command ("hello world!");}@*
|
||||
@code{weechat.command ("/kick toto please leave this chan", "#weechat");}@*
|
||||
@code{weechat.command ("/nick newnick", "", "freenode");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{weechat.get_info ( nome, [servidor] );}@*
|
||||
@*
|
||||
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome do info a recuperar:
|
||||
@item @option{servidor}: nome interno da servidor
|
||||
@itemize @minus
|
||||
@item @option{0 ou version}: comece a vers@~ao de WeeChat
|
||||
@item @option{1 ou nick}: comece o nickname
|
||||
@item @option{2 ou channel}: comece o nome da canal
|
||||
@item @option{3 ou server}: comece o nome do servidor
|
||||
@item @option{4 ou weechatdir}: comece a WeeChat o diret@'orio home
|
||||
@item @option{5 ou away}: comece a bandeira ausente para o servidor
|
||||
@end itemize
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplos:}@*
|
||||
@code{$version = weechat.get_info("version");}@*
|
||||
@code{$nick = weechat.get_info("nick", "freenode");}@*
|
||||
@*
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Scripts Ruby, , Scripts Python, Extencoes
|
||||
@section Scripts Ruby
|
||||
|
||||
N@~AO DESENVOLVIDO!
|
||||
|
||||
|
||||
@c **************************** Autores/Suporte *****************************
|
||||
|
||||
@node Autores/Suporte, , Extencoes, Top
|
||||
@chapter Autores / Suporte
|
||||
|
||||
@ifhtml
|
||||
@menu
|
||||
* Autores::
|
||||
* Obter Suporte::
|
||||
* Copyright::
|
||||
@end menu
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Autores::
|
||||
* Obter Suporte::
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
@node Autores, Obter Suporte, Autores/Suporte, Autores/Suporte
|
||||
@section Autores
|
||||
|
||||
O WeeChat @'e desenvolvido por :@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Obter Suporte, Copyright, Autores, Autores/Suporte
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@node Obter Suporte, , Autores, Autores/Suporte
|
||||
@end ifnothtml
|
||||
@section Obter Suporte
|
||||
|
||||
Antes de pedires suporte, agradecemos se leres toda a documenta@,{c}@~ao e a FAQ.@*
|
||||
(a documenta@,{c}@~ao @'e este documento que est@'as a ler, se n@~ao leste tudo at@'e aqui, est@'a na hora de come@,{c}ares do in@'icio !)@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Suporte por IRC:@*
|
||||
- servidor : @b{irc.freenode.net}@*
|
||||
- canal : @b{#weechat}@*@*
|
||||
@item
|
||||
Forum do WeeChat : @uref{http://forums.flashtux.org}@*@*
|
||||
@item
|
||||
Suporte por lista de correio-e :@*
|
||||
- para te inscreveres/desinscreveres :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||
- para enviares uma mensagem para a lista :@*@email{weechat-support@@nongnu.org}.@*
|
||||
|
||||
Os arquivos da lista est@~ao aqui :@*
|
||||
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||
@item
|
||||
Para mais detalhes, v@^e tamb@'em a p@'agina de suporte do WeeChat :@*
|
||||
@uref{http://weechat.flashtux.org/support.php}
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Copyright, , Obter Suporte, Autores/Suporte
|
||||
@section Copyright
|
||||
|
||||
Este manual documenta o cliente de IRC WeeChat, Ele faz parte do WeeChat.@*
|
||||
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
Tradu@,{c}@~ao portuguesa de Jo@~ao Jer@'onimo <@email{j_j_b_o@@sapo.pt, j_j_b_o AT sapo.pt}>@*
|
||||
@*
|
||||
A utiliza@,{c}@~ao deste documento @'e regida pela GNU General Public
|
||||
License vers@~ao 2 ou posterior.@*
|
||||
|
||||
@end ifhtml
|
||||
|
||||
@bye
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
DOMAIN = $(PACKAGE)
|
||||
subdir = po
|
||||
top_builddir = ..
|
||||
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
|
||||
COPYRIGHT_HOLDER =
|
||||
EXTRA_LOCALE_CATEGORIES =
|
||||
MSGID_BUGS_ADDRESS = flashcode@flashtux.org
|
||||
@@ -0,0 +1,39 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/irc/irc.h
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/python/wee-python.c
|
||||
./src/plugins/python/wee-python.h
|
||||
./src/plugins/plugins.c
|
||||
./src/plugins/plugins.h
|
||||
./src/gui/curses/gui-input.c
|
||||
./src/gui/curses/gui-display.c
|
||||
./src/gui/gtk/gui-display.c
|
||||
./src/gui/gtk/gui-input.c
|
||||
./src/gui/gui-common.c
|
||||
./src/gui/gui.h
|
||||
./src/common/command.c
|
||||
./src/common/command.h
|
||||
./src/common/completion.c
|
||||
./src/common/completion.h
|
||||
./src/common/fifo.c
|
||||
./src/common/fifo.h
|
||||
./src/common/history.c
|
||||
./src/common/history.h
|
||||
./src/common/hotlist.c
|
||||
./src/common/hotlist.h
|
||||
./src/common/log.c
|
||||
./src/common/log.h
|
||||
./src/common/weechat.c
|
||||
./src/common/weechat.h
|
||||
./src/common/weeconfig.c
|
||||
./src/common/weeconfig.h
|
||||
./src/common/weelist.c
|
||||
./src/common/weelist.h
|
||||
@@ -0,0 +1,19 @@
|
||||
# Sed script that remove the POT-Creation-Date line in the header entry
|
||||
# from a POT file.
|
||||
#
|
||||
# The distinction between the first and the following occurrences of the
|
||||
# pattern is achieved by looking at the hold space.
|
||||
/^"POT-Creation-Date: .*"$/{
|
||||
x
|
||||
# Test if the hold space is empty.
|
||||
s/P/P/
|
||||
ta
|
||||
# Yes it was empty. First occurrence. Remove the line.
|
||||
g
|
||||
d
|
||||
bb
|
||||
:a
|
||||
# The hold space was nonempty. Following occurrences. Do nothing.
|
||||
x
|
||||
:b
|
||||
}
|
||||
+3549
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
|
||||
OUTPUT=weechat
|
||||
|
||||
OBJS=weechat.o config.o command.o completion.o history.o
|
||||
OBJS_IRC=irc/irc.a
|
||||
OBJS_GUI=gui/gui.a
|
||||
|
||||
|
||||
# WeeChat with Curses interface
|
||||
ifeq ($(GUI), curses)
|
||||
LIBS_CURSES=-lcurses
|
||||
DEFINES=WEE_CURSES
|
||||
|
||||
curses: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_CURSES)
|
||||
endif
|
||||
|
||||
# WeeChat with Gtk+ interface
|
||||
ifeq ($(GUI), gtk)
|
||||
OBJS_GTK=gui-gtk.o
|
||||
LIBS_GTK=
|
||||
DEFINES=WEE_GTK
|
||||
gtk: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_GTK)
|
||||
endif
|
||||
|
||||
# WeeChat with Qt interface
|
||||
ifeq ($(GUI), qt)
|
||||
OBJS_QT=gui-qt.o
|
||||
LIBS_QT=
|
||||
DEFINES=WEE_QT
|
||||
qt: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_QT)
|
||||
endif
|
||||
|
||||
# WeeChat with Text interface
|
||||
ifeq ($(GUI), text)
|
||||
OBJS_TEXT=gui-text.o
|
||||
LIBS_TEXT=
|
||||
DEFINES=WEE_TEXT
|
||||
text: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_TEXT)
|
||||
endif
|
||||
|
||||
|
||||
all:
|
||||
make curses GUI=curses
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
irc/irc.a:
|
||||
cd irc && make
|
||||
|
||||
gui/gui.a:
|
||||
cd gui && make $(GUI) GUI=$(GUI)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core $(OUTPUT)
|
||||
cd irc && make clean
|
||||
cd gui && make clean
|
||||
|
||||
command.o: command.c weechat.h command.h irc/irc.h gui/gui.h completion.h \
|
||||
history.h config.h
|
||||
completion.o: completion.c weechat.h completion.h irc/irc.h gui/gui.h \
|
||||
history.h command.h
|
||||
config.o: config.c weechat.h config.h irc/irc.h gui/gui.h completion.h \
|
||||
history.h
|
||||
history.o: history.c weechat.h history.h gui/gui.h completion.h
|
||||
weechat.o: weechat.c weechat.h config.h command.h irc/irc.h gui/gui.h \
|
||||
completion.h history.h
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
SUBDIRS = common irc plugins gui
|
||||
-670
@@ -1,670 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* command.c: WeeChat internal commands */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "command.h"
|
||||
#include "irc/irc.h"
|
||||
#include "config.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
t_weechat_command weechat_commands[] =
|
||||
{ { "alias", N_("create an alias for a command"),
|
||||
N_("[alias_name [command [arguments]]"),
|
||||
N_("alias_name: name of alias\ncommand: command name (" WEECHAT_NAME
|
||||
" or IRC command)\n" "arguments: arguments for command"),
|
||||
0, MAX_ARGS, weechat_cmd_alias, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
0, 1, weechat_cmd_clear, NULL },
|
||||
{ "help", N_("display help about commands"),
|
||||
N_("[command]"), N_("command: name of a " WEECHAT_NAME " or IRC command"),
|
||||
0, 1, weechat_cmd_help, NULL },
|
||||
{ "set", N_("set config parameters"),
|
||||
N_("[option [value]]"), N_("option: name of an option\nvalue: value for option"),
|
||||
0, 2, weechat_cmd_set, NULL },
|
||||
{ "unalias", N_("remove an alias"),
|
||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
||||
1, 1, weechat_cmd_unalias, NULL },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
t_index_command *index_commands;
|
||||
t_index_command *last_index_command;
|
||||
|
||||
|
||||
/*
|
||||
* index_find_pos: find position for a command index (for sorting index)
|
||||
*/
|
||||
|
||||
t_index_command *
|
||||
index_command_find_pos (char *command)
|
||||
{
|
||||
t_index_command *ptr_index;
|
||||
|
||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
||||
{
|
||||
if (strcasecmp (command, ptr_index->command_name) < 0)
|
||||
return ptr_index;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* index_command_insert_sorted: insert index into sorted list
|
||||
*/
|
||||
|
||||
void
|
||||
index_command_insert_sorted (t_index_command *index)
|
||||
{
|
||||
t_index_command *pos_index;
|
||||
|
||||
pos_index = index_command_find_pos (index->command_name);
|
||||
|
||||
if (index_commands)
|
||||
{
|
||||
if (pos_index)
|
||||
{
|
||||
/* insert index into the list (before index found) */
|
||||
index->prev_index = pos_index->prev_index;
|
||||
index->next_index = pos_index;
|
||||
if (pos_index->prev_index)
|
||||
pos_index->prev_index->next_index = index;
|
||||
else
|
||||
index_commands = index;
|
||||
pos_index->prev_index = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add index to the end */
|
||||
index->prev_index = last_index_command;
|
||||
index->next_index = NULL;
|
||||
last_index_command->next_index = index;
|
||||
last_index_command = index;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index->prev_index = NULL;
|
||||
index->next_index = NULL;
|
||||
index_commands = index;
|
||||
last_index_command = index;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* index_command_build: build an index of commands (internal, irc and alias)
|
||||
* This list will be sorted, and used for completion
|
||||
*/
|
||||
|
||||
void
|
||||
index_command_build ()
|
||||
{
|
||||
int i;
|
||||
t_index_command *new_index;
|
||||
|
||||
index_commands = NULL;
|
||||
last_index_command = NULL;
|
||||
i = 0;
|
||||
while (weechat_commands[i].command_name)
|
||||
{
|
||||
if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command)))))
|
||||
{
|
||||
new_index->command_name = strdup (weechat_commands[i].command_name);
|
||||
index_command_insert_sorted (new_index);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while (irc_commands[i].command_name)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command)))))
|
||||
{
|
||||
new_index->command_name = strdup (irc_commands[i].command_name);
|
||||
index_command_insert_sorted (new_index);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* explode_string: explode a string according to separators
|
||||
*/
|
||||
|
||||
char **
|
||||
explode_string (char *string, char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
int i, n_items;
|
||||
char **array;
|
||||
char *ptr, *ptr1, *ptr2;
|
||||
|
||||
if (num_items != NULL)
|
||||
*num_items = 0;
|
||||
|
||||
n_items = num_items_max;
|
||||
|
||||
if (string == NULL)
|
||||
return NULL;
|
||||
|
||||
if (num_items_max == 0)
|
||||
{
|
||||
/* calculate number of items */
|
||||
ptr = string;
|
||||
i = 1;
|
||||
while ((ptr = strpbrk (ptr, separators)))
|
||||
{
|
||||
while (strchr (separators, ptr[0]) != NULL)
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
n_items = i;
|
||||
}
|
||||
|
||||
array =
|
||||
(char **) malloc ((num_items_max ? n_items : n_items + 1) *
|
||||
sizeof (char *));
|
||||
|
||||
ptr1 = string;
|
||||
ptr2 = string;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
while (strchr (separators, ptr1[0]) != NULL)
|
||||
ptr1++;
|
||||
if (i == (n_items - 1) || (ptr2 = strpbrk (ptr1, separators)) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\r')) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\n')) == NULL)
|
||||
ptr2 = strchr (ptr1, '\0');
|
||||
|
||||
if ((ptr1 == NULL) || (ptr2 == NULL))
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr2 - ptr1 > 0)
|
||||
{
|
||||
array[i] =
|
||||
(char *) malloc ((ptr2 - ptr1 + 1) * sizeof (char));
|
||||
array[i] = strncpy (array[i], ptr1, ptr2 - ptr1);
|
||||
array[i][ptr2 - ptr1] = '\0';
|
||||
ptr1 = ++ptr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_items_max == 0)
|
||||
{
|
||||
array[i] = NULL;
|
||||
if (num_items != NULL)
|
||||
*num_items = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_items != NULL)
|
||||
*num_items = num_items_max;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/*
|
||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
||||
* returns: 1 if command was executed succesfully
|
||||
* 0 if error (command not executed)
|
||||
*/
|
||||
|
||||
int
|
||||
exec_weechat_command (t_irc_server *server, char *string)
|
||||
{
|
||||
int i, j, argc, return_code;
|
||||
char *pos, *ptr_args, **argv;
|
||||
|
||||
if ((!string[0]) || (string[0] != '/'))
|
||||
return 0;
|
||||
|
||||
/* look for end of command */
|
||||
ptr_args = NULL;
|
||||
pos = strchr (string, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
ptr_args = pos;
|
||||
if (!ptr_args[0])
|
||||
ptr_args = NULL;
|
||||
}
|
||||
|
||||
argv = explode_string (ptr_args, " ", 0, &argc);
|
||||
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (weechat_commands[i].command_name, string + 1) == 0)
|
||||
{
|
||||
if ((argc < weechat_commands[i].min_arg)
|
||||
|| (argc > weechat_commands[i].max_arg))
|
||||
{
|
||||
if (weechat_commands[i].min_arg ==
|
||||
weechat_commands[i].max_arg)
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for "
|
||||
WEECHAT_NAME " command '%s' "
|
||||
"(expected: %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
weechat_commands[i].max_arg,
|
||||
(weechat_commands[i].max_arg >
|
||||
1) ? "s" : "");
|
||||
else
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for "
|
||||
WEECHAT_NAME " command '%s' "
|
||||
"(expected: between %d and %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
weechat_commands[i].min_arg,
|
||||
weechat_commands[i].max_arg,
|
||||
(weechat_commands[i].max_arg >
|
||||
1) ? "s" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (weechat_commands[i].cmd_function_args != NULL)
|
||||
return_code = (int) (weechat_commands[i].cmd_function_args)
|
||||
(argc, argv);
|
||||
else
|
||||
return_code = (int) (weechat_commands[i].cmd_function_1arg)
|
||||
(ptr_args);
|
||||
if (return_code < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s " WEECHAT_NAME " command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, string + 1);
|
||||
}
|
||||
if (argv)
|
||||
{
|
||||
for (j = 0; argv[j]; j++)
|
||||
free (argv[j]);
|
||||
free (argv);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (irc_commands[i].command_name, string + 1) == 0)
|
||||
{
|
||||
if ((argc < irc_commands[i].min_arg)
|
||||
|| (argc > irc_commands[i].max_arg))
|
||||
{
|
||||
if (irc_commands[i].min_arg == irc_commands[i].max_arg)
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("%s wrong argument count for IRC command '%s' "
|
||||
"(expected: %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
irc_commands[i].max_arg,
|
||||
(irc_commands[i].max_arg > 1) ? "s" : "");
|
||||
else
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("%s wrong argument count for IRC command '%s' "
|
||||
"(expected: between %d and %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
irc_commands[i].min_arg, irc_commands[i].max_arg,
|
||||
(irc_commands[i].max_arg > 1) ? "s" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((irc_commands[i].need_connection) &&
|
||||
((!server) || (!server->is_connected)))
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s command '%s' needs a server connection!\n"),
|
||||
WEECHAT_ERROR, irc_commands[i].command_name);
|
||||
return 0;
|
||||
}
|
||||
if (irc_commands[i].cmd_function_args != NULL)
|
||||
return_code = (int) (irc_commands[i].cmd_function_args)
|
||||
(server, argc, argv);
|
||||
else
|
||||
return_code = (int) (irc_commands[i].cmd_function_1arg)
|
||||
(server, ptr_args);
|
||||
if (return_code < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s IRC command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, string + 1);
|
||||
}
|
||||
if (argv)
|
||||
{
|
||||
for (j = 0; argv[j]; j++)
|
||||
free (argv[j]);
|
||||
free (argv);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
gui_printf (server->window,
|
||||
_("%s unknown command '%s' (type /help for help)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1);
|
||||
if (argv)
|
||||
{
|
||||
for (j = 0; argv[j]; j++)
|
||||
free (argv[j]);
|
||||
free (argv);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* user_command: interprets user command (if beginning with '/')
|
||||
* any other text is sent to the server, if connected
|
||||
*/
|
||||
|
||||
void
|
||||
user_command (t_irc_server *server, char *command)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if ((!command) || (command[0] == '\r') || (command[0] == '\n'))
|
||||
return;
|
||||
if ((command[0] == '/') && (command[1] != '/'))
|
||||
{
|
||||
/* WeeChat internal command (or IRC command) */
|
||||
exec_weechat_command (server, command);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((command[0] == '/') && (command[1] == '/'))
|
||||
command++;
|
||||
if (!WIN_IS_SERVER(gui_current_window))
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
command);
|
||||
|
||||
if (WIN_IS_PRIVATE(gui_current_window))
|
||||
{
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window), server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (CHANNEL(gui_current_window)->window, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color (CHANNEL(gui_current_window)->window,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
_("%s cannot find nick for sending message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_printf (server->window, _("This window is not a channel!\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_alias: display or create alias
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_alias (int argc, char **argv)
|
||||
{
|
||||
if (argc == 0)
|
||||
{
|
||||
/* List all aliases */
|
||||
}
|
||||
argv = NULL;
|
||||
gui_printf (NULL, _("(TODO) \"/alias\" command not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_clear: display or create alias
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_clear (int argc, char **argv)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
if (strcmp (argv[0], "-all") == 0)
|
||||
gui_window_clear_all ();
|
||||
else
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("unknown parameter \"%s\" for /clear command\n"),
|
||||
argv[0]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_window_clear (gui_current_window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_help: display help
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_help (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("> List of " WEECHAT_NAME " internal commands:\n"));
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
gui_printf (NULL, " %s - %s\n",
|
||||
weechat_commands[i].command_name,
|
||||
weechat_commands[i].command_description);
|
||||
gui_printf (NULL, _("> List of IRC commands:\n"));
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
gui_printf (NULL, " %s - %s\n",
|
||||
irc_commands[i].command_name,
|
||||
irc_commands[i].command_description);
|
||||
}
|
||||
if (argc == 1)
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
|
||||
{
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("> Help on " WEECHAT_NAME " internal command '%s':\n"),
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL,
|
||||
_("Syntax: /%s %s\n"),
|
||||
weechat_commands[i].command_name,
|
||||
(weechat_commands[i].
|
||||
arguments) ? weechat_commands[i].
|
||||
arguments : "");
|
||||
if (weechat_commands[i].arguments_description)
|
||||
{
|
||||
gui_printf (NULL, "%s\n",
|
||||
weechat_commands[i].
|
||||
arguments_description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (irc_commands[i].command_name, argv[0]) == 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("> Help on IRC command '%s':\n"),
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, _("Syntax: /%s %s\n"),
|
||||
irc_commands[i].command_name,
|
||||
(irc_commands[i].arguments) ?
|
||||
irc_commands[i].arguments : "");
|
||||
if (irc_commands[i].arguments_description)
|
||||
{
|
||||
gui_printf (NULL, "%s\n",
|
||||
irc_commands[i].
|
||||
arguments_description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
gui_printf (NULL,
|
||||
_("No help available, \"%s\" is an unknown command\n"),
|
||||
argv[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_set: set options
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_set (int argc, char **argv)
|
||||
{
|
||||
int i, j, section_displayed;
|
||||
char *color_name;
|
||||
|
||||
/* TODO: complete /set command */
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
section_displayed = 0;
|
||||
if (i != CONFIG_SECTION_SERVER)
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
if ((argc == 0) ||
|
||||
((argc > 0)
|
||||
&& (strstr (weechat_options[i][j].option_name, argv[0])
|
||||
!= NULL)))
|
||||
{
|
||||
if (!section_displayed)
|
||||
{
|
||||
gui_printf (NULL, "[%s]\n",
|
||||
config_sections[i].section_name);
|
||||
section_displayed = 1;
|
||||
}
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL, " %s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(*weechat_options[i][j].ptr_int) ?
|
||||
"ON" : "OFF");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
" %s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
*weechat_options[i][j].ptr_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
" %s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]);
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int);
|
||||
gui_printf (NULL,
|
||||
" %s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(color_name) ? color_name : _("(unknown)"));
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
gui_printf (NULL, " %s = %s\n",
|
||||
weechat_options[i][j].
|
||||
option_name,
|
||||
(*weechat_options[i][j].
|
||||
ptr_string) ?
|
||||
*weechat_options[i][j].
|
||||
ptr_string : "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_printf (NULL, _("(TODO) \"/set\" command not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* cmd_unalias: remove an alias
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_unalias (int argc, char **argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
{
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("Wrong argument count for unalias function (expexted: 1 arg)\n"));
|
||||
return -1;
|
||||
}
|
||||
argv = NULL;
|
||||
gui_printf (NULL, _("(TODO) \"/unalias\" not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "irc/irc.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
typedef struct t_weechat_command t_weechat_command;
|
||||
|
||||
struct t_weechat_command
|
||||
{
|
||||
char *command_name;
|
||||
char *command_description;
|
||||
char *arguments;
|
||||
char *arguments_description;
|
||||
int min_arg, max_arg;
|
||||
int (*cmd_function_args)(int, char **);
|
||||
int (*cmd_function_1arg)(char *);
|
||||
};
|
||||
|
||||
typedef struct t_index_command t_index_command;
|
||||
|
||||
struct t_index_command
|
||||
{
|
||||
char *command_name;
|
||||
t_index_command *prev_index;
|
||||
t_index_command *next_index;
|
||||
};
|
||||
|
||||
extern t_index_command *index_commands;
|
||||
|
||||
extern void index_command_build ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias(int, char **);
|
||||
extern int weechat_cmd_clear(int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_set (int, char **);
|
||||
extern int weechat_cmd_unalias (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
@@ -0,0 +1,39 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_main.a
|
||||
|
||||
lib_weechat_main_a_SOURCES = weechat.c \
|
||||
weechat.h \
|
||||
command.c \
|
||||
command.h \
|
||||
completion.c \
|
||||
completion.h \
|
||||
weelist.c \
|
||||
weelist.h \
|
||||
weeconfig.c \
|
||||
weeconfig.h \
|
||||
history.c \
|
||||
history.h \
|
||||
hotlist.c \
|
||||
hotlist.h \
|
||||
log.c \
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
typedef struct t_weechat_command t_weechat_command;
|
||||
|
||||
struct t_weechat_command
|
||||
{
|
||||
char *command_name;
|
||||
char *command_description;
|
||||
char *arguments;
|
||||
char *arguments_description;
|
||||
int min_arg, max_arg;
|
||||
int (*cmd_function_args)(int, char **);
|
||||
int (*cmd_function_1arg)(char *);
|
||||
};
|
||||
|
||||
typedef struct t_weechat_alias t_weechat_alias;
|
||||
|
||||
struct t_weechat_alias
|
||||
{
|
||||
char *alias_name;
|
||||
char *alias_command;
|
||||
t_weechat_alias *prev_alias;
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
extern t_weechat_command weechat_commands[];
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_weelist *index_commands;
|
||||
extern t_weelist *last_index_command;
|
||||
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_debug (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_perl (int, char **);
|
||||
extern int weechat_cmd_python (int, char **);
|
||||
extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
@@ -0,0 +1,798 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* completion.c: completes words according to context (cmd/nick) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "command.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* completion_init: init completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_init (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->base_command = NULL;
|
||||
completion->base_command_arg = 0;
|
||||
completion->position = -1;
|
||||
completion->base_word = NULL;
|
||||
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_free: free completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_free (t_completion *completion)
|
||||
{
|
||||
if (completion->base_command)
|
||||
free (completion->base_command);
|
||||
completion->base_command = NULL;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = NULL;
|
||||
|
||||
while (completion->completion_list)
|
||||
weelist_remove (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
completion->completion_list);
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_stop: stop completion (for example after 1 arg of command with 1 arg)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_stop (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->position = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_build_list: build data list according to command and argument #
|
||||
*/
|
||||
|
||||
void
|
||||
completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
t_weelist *ptr_list;
|
||||
int i, j;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
char option_name[256];
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "server") == 0)
|
||||
|| (strcasecmp (completion->base_command, "save") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "alias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_list->data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "buffer") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"move");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "disconnect") == 0))
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "debug") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"dump");
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
weechat_commands[i].command_name);
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
irc_commands[i].command_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "perl") == 0)
|
||||
|| (strcasecmp (completion->base_command, "python") == 0))
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"load");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"autoload");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"reload");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"unload");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "set") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
weechat_options[i][j].option_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "unalias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_alias->alias_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "window") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splith");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splitv");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"merge");
|
||||
return;
|
||||
}
|
||||
|
||||
if (completion->base_command_arg == 2)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"down");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"up");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"left");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"right");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"all");
|
||||
return;
|
||||
}
|
||||
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* IRC commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "admin") == 0)
|
||||
|| (strcasecmp (completion->base_command, "die") == 0)
|
||||
|| (strcasecmp (completion->base_command, "info") == 0)
|
||||
|| (strcasecmp (completion->base_command, "join") == 0)
|
||||
|| (strcasecmp (completion->base_command, "links") == 0)
|
||||
|| (strcasecmp (completion->base_command, "list") == 0)
|
||||
|| (strcasecmp (completion->base_command, "lusers") == 0)
|
||||
|| (strcasecmp (completion->base_command, "motd") == 0)
|
||||
|| (strcasecmp (completion->base_command, "oper") == 0)
|
||||
|| (strcasecmp (completion->base_command, "rehash") == 0)
|
||||
|| (strcasecmp (completion->base_command, "restart") == 0)
|
||||
|| (strcasecmp (completion->base_command, "service") == 0)
|
||||
|| (strcasecmp (completion->base_command, "servlist") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squery") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squit") == 0)
|
||||
|| (strcasecmp (completion->base_command, "stats") == 0)
|
||||
|| (strcasecmp (completion->base_command, "summon") == 0)
|
||||
|| (strcasecmp (completion->base_command, "time") == 0)
|
||||
|| (strcasecmp (completion->base_command, "trace") == 0)
|
||||
|| (strcasecmp (completion->base_command, "users") == 0)
|
||||
|| (strcasecmp (completion->base_command, "wallops") == 0)
|
||||
|| (strcasecmp (completion->base_command, "who") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "away") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_away);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "ctcp") == 0)
|
||||
&& (completion->base_command_arg == 2))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"action");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"version");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "dcc") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"chat");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"send");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
{
|
||||
/* arg1: nickname */
|
||||
if (completion->base_command_arg == 1)
|
||||
return;
|
||||
|
||||
/* arg > 2: not allowed */
|
||||
if (completion->base_command_arg > 2)
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg2: channel */
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
{
|
||||
for (ptr_channel = SERVER(gui_current_window->buffer)->channels;
|
||||
ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_channel->name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kick") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kill") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "me") == 0)
|
||||
{
|
||||
completion->context = COMPLETION_NICK;
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "notice") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "part") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_part);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "query") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "quit") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_quit);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "topic") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
if (!channel || !((t_irc_channel *)channel)->topic
|
||||
|| !((t_irc_channel *)channel)->topic[0])
|
||||
completion_stop (completion);
|
||||
else
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->topic);
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_find_context: find context for completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
int size, int pos)
|
||||
{
|
||||
int i, command, command_arg, pos_start, pos_end;
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
command = (buffer[0] == '/') ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
while (i < pos)
|
||||
{
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
command_arg++;
|
||||
i++;
|
||||
while ((i < pos) && (buffer[i] == ' ')) i++;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (command)
|
||||
{
|
||||
if (command_arg > 0)
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND_ARG;
|
||||
completion->base_command_arg = command_arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND;
|
||||
completion->base_command_arg = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel)
|
||||
completion->context = COMPLETION_NICK;
|
||||
else
|
||||
completion->context = COMPLETION_NULL;
|
||||
}
|
||||
|
||||
/* look for word to complete (base word) */
|
||||
completion->base_word_pos = 0;
|
||||
completion->position_replace = pos;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
i = pos;
|
||||
pos_start = i;
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
if ((i > 0) && (buffer[i-1] != ' '))
|
||||
{
|
||||
i--;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (pos_start <= pos_end)
|
||||
{
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->base_word)
|
||||
completion->base_word = strdup ("");
|
||||
|
||||
/* find command (for command argument completion only) */
|
||||
if (completion->context == COMPLETION_COMMAND_ARG)
|
||||
{
|
||||
pos_start = 0;
|
||||
while ((pos_start < size) && (buffer[pos_start] != '/'))
|
||||
pos_start++;
|
||||
if (buffer[pos_start] == '/')
|
||||
{
|
||||
pos_start++;
|
||||
pos_end = pos_start;
|
||||
while ((pos_end < size) && (buffer[pos_end] != ' '))
|
||||
pos_end++;
|
||||
if (buffer[pos_end] == ' ')
|
||||
pos_end--;
|
||||
|
||||
completion->base_command = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_command[i - pos_start] = buffer[i];
|
||||
completion->base_command[pos_end - pos_start + 1] = '\0';
|
||||
completion_build_list (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/* nick completion with nothing as base word is disabled,
|
||||
in order to prevent completion when pasting messages with [tab] inside */
|
||||
if ((completion->context == COMPLETION_NICK)
|
||||
&& ((!completion->base_word) || (!completion->base_word[0])))
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel &&
|
||||
(((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
&& (completion->context == COMPLETION_NICK))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
completion->context = COMPLETION_NICK;
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
SERVER(gui_current_window->buffer)->nick);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command: complete a command
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command (t_completion *completion)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word) - 1;
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word + 1, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command (completion);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command_arg: complete a command argument
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = completion->completion_list; ptr_weelist;
|
||||
ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command_arg (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nick: complete a nick
|
||||
*/
|
||||
|
||||
void
|
||||
completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_irc_nick *ptr_nick, *ptr_nick2;
|
||||
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_nick->nick;
|
||||
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2;
|
||||
ptr_nick2 = ptr_nick2->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick2->nick,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_nick (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_search: complete word according to context
|
||||
*/
|
||||
|
||||
void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
char *old_word_found;
|
||||
|
||||
/* if new completion => look for base word */
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_find_context (completion, channel, buffer, size, pos);
|
||||
}
|
||||
|
||||
/* completion */
|
||||
old_word_found = completion->word_found;
|
||||
switch (completion->context)
|
||||
{
|
||||
case COMPLETION_NULL:
|
||||
/* should never be executed */
|
||||
return;
|
||||
case COMPLETION_NICK:
|
||||
if (channel)
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case COMPLETION_COMMAND:
|
||||
completion_command (completion);
|
||||
break;
|
||||
case COMPLETION_COMMAND_ARG:
|
||||
if (completion->completion_list)
|
||||
completion_command_arg (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
break;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
{
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->diff_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_COMPLETION_H
|
||||
#define __WEECHAT_COMPLETION_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
|
||||
#define COMPLETION_NULL 0
|
||||
#define COMPLETION_NICK 1
|
||||
#define COMPLETION_COMMAND 2
|
||||
#define COMPLETION_COMMAND_ARG 3
|
||||
|
||||
typedef struct t_completion t_completion;
|
||||
|
||||
struct t_completion
|
||||
{
|
||||
/* completion context */
|
||||
int context; /* context: null, nick, command, cmd arg */
|
||||
char *base_command; /* command with arg to complete (can be NULL) */
|
||||
int base_command_arg; /* # arg to complete (if context is cmd arg) */
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where Tab was pressed */
|
||||
|
||||
/* for command argument completion */
|
||||
t_weelist *completion_list; /* data list for completion */
|
||||
t_weelist *last_completion; /* last data element for completion */
|
||||
|
||||
/* completion found */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word has to be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_free (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* fifo.c: FIFO pipe for WeeChat remote control */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "fifo.h"
|
||||
#include "command.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
int weechat_fifo = -1;
|
||||
char *weechat_fifo_filename = NULL;
|
||||
char *weechat_fifo_unterminated = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* fifo_create: create FIFO pipe for remote control
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_create ()
|
||||
{
|
||||
int filename_length;
|
||||
|
||||
if (cfg_irc_fifo_pipe)
|
||||
{
|
||||
/* build FIFO filename: "~/.weechat/weechat_fifo_" + process PID */
|
||||
if (!weechat_fifo_filename)
|
||||
{
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
weechat_fifo_filename = (char *) malloc (filename_length * sizeof (char));
|
||||
snprintf (weechat_fifo_filename, filename_length, "%s/weechat_fifo_%d",
|
||||
weechat_home, (int) getpid());
|
||||
}
|
||||
|
||||
/* create FIFO pipe, writable for user only */
|
||||
if ((weechat_fifo = mkfifo (weechat_fifo_filename, 0600)) != 0)
|
||||
{
|
||||
weechat_fifo = -1;
|
||||
gui_printf (NULL,
|
||||
_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* open FIFO pipe in read-only (for WeeChat), non nlobking mode */
|
||||
if ((weechat_fifo = open (weechat_fifo_filename, O_RDONLY | O_NONBLOCK)) == -1)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is open\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_exec: execute a command/text received by FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_exec (char *text)
|
||||
{
|
||||
char *pos_msg, *pos;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
pos = NULL;
|
||||
ptr_server = NULL;
|
||||
ptr_channel = NULL;
|
||||
ptr_buffer = NULL;
|
||||
|
||||
/* look for server/channel at beginning of text */
|
||||
/* text may be: "server,channel *text" or "server *text" or "*text" */
|
||||
if (text[0] == '*')
|
||||
{
|
||||
pos_msg = text + 1;
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid buffer for displaying text via FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_msg = strstr (text, " *");
|
||||
if (!pos_msg)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
pos_msg[0] = '\0';
|
||||
pos = pos_msg - 1;
|
||||
pos_msg += 2;
|
||||
while ((pos >= text) && (pos[0] == ' '))
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos--;
|
||||
}
|
||||
|
||||
if (text[0])
|
||||
{
|
||||
pos = strchr (text, ',');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
ptr_server = server_search (text);
|
||||
if (!ptr_server || !ptr_server->buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s server \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, text);
|
||||
return;
|
||||
}
|
||||
if (ptr_server)
|
||||
{
|
||||
if (pos)
|
||||
{
|
||||
ptr_channel = channel_search (ptr_server, pos + 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s channel \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, pos + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
else
|
||||
ptr_buffer = ptr_server->buffer;
|
||||
}
|
||||
|
||||
user_command (ptr_server, ptr_buffer, pos_msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_read: read data in FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_read ()
|
||||
{
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
int num_read;
|
||||
|
||||
num_read = read (weechat_fifo, buffer, sizeof (buffer) - 2);
|
||||
if (num_read > 0)
|
||||
{
|
||||
buffer[num_read] = '\0';
|
||||
|
||||
buf2 = NULL;
|
||||
ptr_buf = buffer;
|
||||
if (weechat_fifo_unterminated)
|
||||
{
|
||||
buf2 = (char *) malloc (strlen (weechat_fifo_unterminated) +
|
||||
strlen (buffer) + 1);
|
||||
if (buf2)
|
||||
{
|
||||
strcpy (buf2, weechat_fifo_unterminated);
|
||||
strcat (buf2, buffer);
|
||||
}
|
||||
ptr_buf = buf2;
|
||||
free (weechat_fifo_unterminated);
|
||||
weechat_fifo_unterminated = NULL;
|
||||
}
|
||||
|
||||
while (ptr_buf && ptr_buf[0])
|
||||
{
|
||||
next_ptr_buf = NULL;
|
||||
pos = strstr (ptr_buf, "\r\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
next_ptr_buf = pos + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strstr (ptr_buf, "\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
next_ptr_buf = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_fifo_unterminated = strdup (ptr_buf);
|
||||
ptr_buf = NULL;
|
||||
next_ptr_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_buf)
|
||||
fifo_exec (ptr_buf);
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_read < 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
fifo_remove ();
|
||||
}
|
||||
else
|
||||
{
|
||||
close (weechat_fifo);
|
||||
weechat_fifo = open (weechat_fifo_filename, O_RDONLY | O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_remove: remove FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_remove ()
|
||||
{
|
||||
if (weechat_fifo != -1)
|
||||
{
|
||||
/* close FIFO pipe */
|
||||
close (weechat_fifo);
|
||||
weechat_fifo = -1;
|
||||
}
|
||||
|
||||
/* remove FIFO from disk */
|
||||
if (weechat_fifo_filename)
|
||||
unlink (weechat_fifo_filename);
|
||||
|
||||
if (weechat_fifo_unterminated)
|
||||
{
|
||||
free (weechat_fifo_unterminated);
|
||||
weechat_fifo_unterminated = NULL;
|
||||
}
|
||||
|
||||
if (weechat_fifo_filename)
|
||||
{
|
||||
free (weechat_fifo_filename);
|
||||
weechat_fifo_filename = NULL;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is closed\n"));
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -20,7 +18,13 @@
|
||||
*/
|
||||
|
||||
|
||||
/* gui-gtk.c: Gtk+ GUI for WeeChat */
|
||||
#ifndef __WEECHAT_FIFO_H
|
||||
#define __WEECHAT_FIFO_H 1
|
||||
|
||||
extern int weechat_fifo;
|
||||
|
||||
/* ***** Gtk+ GUI for WeeChat, NOT developed! ***** */
|
||||
extern void fifo_create ();
|
||||
extern void fifo_read ();
|
||||
extern void fifo_remove ();
|
||||
|
||||
#endif /* fifo.h */
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_last = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
int num_history_general = 0;
|
||||
|
||||
|
||||
/*
|
||||
* history_hide_password: hide a nickserv password
|
||||
*/
|
||||
|
||||
void
|
||||
history_hide_password (char *string)
|
||||
{
|
||||
char *pos_pwd;
|
||||
|
||||
if (strstr (string, "nickserv "))
|
||||
{
|
||||
pos_pwd = strstr (string, "identify ");
|
||||
if (!pos_pwd)
|
||||
pos_pwd = strstr (string, "register ");
|
||||
if (pos_pwd)
|
||||
{
|
||||
pos_pwd += 9;
|
||||
while (pos_pwd[0])
|
||||
{
|
||||
pos_pwd[0] = '*';
|
||||
pos_pwd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_add: add a text/command to history
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
/* add history to general history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
else
|
||||
history_general_last = new_history;
|
||||
new_history->next_history = history_general;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
num_history_general++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (num_history_general > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = history_general_last->prev_history;
|
||||
history_general_last->prev_history->next_history = NULL;
|
||||
if (history_general_last->text)
|
||||
free (history_general_last->text);
|
||||
free (history_general_last);
|
||||
history_general_last = ptr_history;
|
||||
num_history_general--;
|
||||
}
|
||||
}
|
||||
|
||||
/* add history to local history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_general_free: free general history
|
||||
*/
|
||||
|
||||
void
|
||||
history_general_free ()
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (history_general)
|
||||
{
|
||||
ptr_history = history_general->next_history;
|
||||
if (history_general->text)
|
||||
free (history_general->text);
|
||||
free (history_general);
|
||||
history_general = ptr_history;
|
||||
}
|
||||
history_general = NULL;
|
||||
history_general_last = NULL;
|
||||
history_general_ptr = NULL;
|
||||
num_history_general = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* history_buffer_free: free history for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
history_buffer_free (void *buffer)
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (((t_gui_buffer *)(buffer))->history)
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)(buffer))->history->next_history;
|
||||
if (((t_gui_buffer *)(buffer))->history->text)
|
||||
free (((t_gui_buffer *)(buffer))->history->text);
|
||||
free (((t_gui_buffer *)(buffer))->history);
|
||||
((t_gui_buffer *)(buffer))->history = ptr_history;
|
||||
}
|
||||
((t_gui_buffer *)(buffer))->history = NULL;
|
||||
((t_gui_buffer *)(buffer))->last_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->ptr_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->num_history = 0;
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -33,5 +31,7 @@ struct t_history
|
||||
};
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_general_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
#endif /* history.h */
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* hotlist.c: WeeChat hotlist (buffers with activity) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "hotlist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_weechat_hotlist *hotlist = NULL;
|
||||
t_weechat_hotlist *last_hotlist = NULL;
|
||||
t_gui_buffer *hotlist_initial_buffer = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* hotlist_search: find hotlist with buffer pointer
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_search (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (ptr_hotlist->buffer == buffer)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_find_pos: find position for a inserting in hotlist (for sorting hotlist)
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_find_pos (t_weechat_hotlist *new_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (new_hotlist->priority > ptr_hotlist->priority)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_add: add a buffer to hotlist, with priority
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_add (int priority, t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist, *pos_hotlist;
|
||||
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
/* do not highlight current buffer */
|
||||
if (buffer == gui_current_window->buffer)
|
||||
return;
|
||||
|
||||
if ((pos_hotlist = hotlist_search (buffer)))
|
||||
{
|
||||
/* return if priority is greater or equal than the one to add */
|
||||
if (pos_hotlist->priority >= priority)
|
||||
return;
|
||||
/* remove buffer if present with lower priority and go on */
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
|
||||
if ((new_hotlist = (t_weechat_hotlist *) malloc (sizeof (t_weechat_hotlist))) == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s cannot add a buffer to hotlist\n"), WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
new_hotlist->priority = priority;
|
||||
new_hotlist->buffer = buffer;
|
||||
|
||||
if (hotlist)
|
||||
{
|
||||
pos_hotlist = hotlist_find_pos (new_hotlist);
|
||||
|
||||
if (pos_hotlist)
|
||||
{
|
||||
/* insert hotlist into the hotlist (before hotlist found) */
|
||||
new_hotlist->prev_hotlist = pos_hotlist->prev_hotlist;
|
||||
new_hotlist->next_hotlist = pos_hotlist;
|
||||
if (pos_hotlist->prev_hotlist)
|
||||
pos_hotlist->prev_hotlist->next_hotlist = new_hotlist;
|
||||
else
|
||||
hotlist = new_hotlist;
|
||||
pos_hotlist->prev_hotlist = new_hotlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add hotlist to the end */
|
||||
new_hotlist->prev_hotlist = last_hotlist;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
last_hotlist->next_hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_hotlist->prev_hotlist = NULL;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_free: free a hotlist and remove it from hotlist queue
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_free (t_weechat_hotlist *ptr_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist;
|
||||
|
||||
/* remove hotlist from queue */
|
||||
if (last_hotlist == ptr_hotlist)
|
||||
last_hotlist = ptr_hotlist->prev_hotlist;
|
||||
if (ptr_hotlist->prev_hotlist)
|
||||
{
|
||||
(ptr_hotlist->prev_hotlist)->next_hotlist = ptr_hotlist->next_hotlist;
|
||||
new_hotlist = hotlist;
|
||||
}
|
||||
else
|
||||
new_hotlist = ptr_hotlist->next_hotlist;
|
||||
|
||||
if (ptr_hotlist->next_hotlist)
|
||||
(ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist;
|
||||
|
||||
free (ptr_hotlist);
|
||||
hotlist = new_hotlist;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_free_all: free all hotlists
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_free_all ()
|
||||
{
|
||||
/* remove all hotlists */
|
||||
while (hotlist)
|
||||
hotlist_free (hotlist);
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_remove_buffer: remove a buffer from hotlist
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_remove_buffer (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *pos_hotlist;
|
||||
|
||||
pos_hotlist = hotlist_search (buffer);
|
||||
if (pos_hotlist)
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_HOTLIST_H
|
||||
#define __WEECHAT_HOTLIST_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
typedef struct t_weechat_hotlist t_weechat_hotlist;
|
||||
|
||||
struct t_weechat_hotlist
|
||||
{
|
||||
int priority; /* 0=crappy msg (join/part), 1=msg, */
|
||||
/* 2=nick highlight */
|
||||
t_gui_buffer *buffer; /* associated buffer */
|
||||
t_weechat_hotlist *prev_hotlist; /* link to previous hotlist */
|
||||
t_weechat_hotlist *next_hotlist; /* link to next hotlist */
|
||||
};
|
||||
|
||||
extern t_weechat_hotlist *hotlist;
|
||||
extern t_gui_buffer *hotlist_initial_buffer;
|
||||
|
||||
extern void hotlist_add (int, t_gui_buffer *);
|
||||
extern void hotlist_free (t_weechat_hotlist *);
|
||||
extern void hotlist_free_all ();
|
||||
extern void hotlist_remove_buffer (t_gui_buffer *);
|
||||
|
||||
#endif /* hotlist.h */
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* log.c: log buffers to files */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "log.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
/*
|
||||
* log_write_date: writes date to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write_date (t_gui_buffer *buffer)
|
||||
{
|
||||
static char buf_time[256];
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
{
|
||||
strftime (buf_time, sizeof (buf_time) - 1, cfg_log_timestamp, date_tmp);
|
||||
fprintf (buffer->log_file, "%s ", buf_time);
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write: writes a message to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write (t_gui_buffer *buffer, char *message)
|
||||
{
|
||||
if (buffer->log_file)
|
||||
{
|
||||
fprintf (buffer->log_file, "%s", message);
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write_line: writes a WeeChat line to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write_line (t_gui_buffer *buffer, t_gui_line *line)
|
||||
{
|
||||
t_gui_message *ptr_msg;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
log_write_date (buffer);
|
||||
for (ptr_msg = line->messages; ptr_msg; ptr_msg = ptr_msg->next_message)
|
||||
{
|
||||
if (ptr_msg->type != MSG_TYPE_TIME)
|
||||
fprintf (buffer->log_file, "%s", ptr_msg->message);
|
||||
}
|
||||
fprintf (buffer->log_file, "\n");
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_start: starts a log
|
||||
*/
|
||||
|
||||
void
|
||||
log_start (t_gui_buffer *buffer)
|
||||
{
|
||||
int length;
|
||||
char *ptr_home;
|
||||
|
||||
ptr_home = getenv ("HOME");
|
||||
length = strlen (cfg_log_path) +
|
||||
((cfg_log_path[0] == '~') ? strlen (ptr_home) : 0) +
|
||||
64;
|
||||
if (SERVER(buffer))
|
||||
length += strlen (SERVER(buffer)->name);
|
||||
if (CHANNEL(buffer))
|
||||
length += strlen (CHANNEL(buffer)->name);
|
||||
buffer->log_filename = (char *) malloc (length);
|
||||
if (!buffer->log_filename)
|
||||
{
|
||||
wee_log_printf (_("Not enough memory to write log file for a buffer\n"));
|
||||
return;
|
||||
}
|
||||
if (cfg_log_path[0] == '~')
|
||||
{
|
||||
strcpy (buffer->log_filename, ptr_home);
|
||||
strcat (buffer->log_filename, cfg_log_path + 1);
|
||||
}
|
||||
else
|
||||
strcpy (buffer->log_filename, cfg_log_path);
|
||||
if (buffer->log_filename[strlen (buffer->log_filename) - 1] != DIR_SEPARATOR_CHAR)
|
||||
strcat (buffer->log_filename, DIR_SEPARATOR);
|
||||
|
||||
if (SERVER(buffer))
|
||||
{
|
||||
strcat (buffer->log_filename, SERVER(buffer)->name);
|
||||
strcat (buffer->log_filename, ".");
|
||||
}
|
||||
if (CHANNEL(buffer))
|
||||
{
|
||||
strcat (buffer->log_filename, CHANNEL(buffer)->name);
|
||||
strcat (buffer->log_filename, ".");
|
||||
}
|
||||
strcat (buffer->log_filename, "weechatlog");
|
||||
|
||||
buffer->log_file = fopen (buffer->log_filename, "a");
|
||||
if (!buffer->log_file)
|
||||
{
|
||||
wee_log_printf (_("Unable to write log file for a buffer\n"));
|
||||
free (buffer->log_filename);
|
||||
return;
|
||||
}
|
||||
log_write (buffer, _("**** Beginning of log "));
|
||||
log_write_date (buffer);
|
||||
log_write (buffer, "****\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* log_end: ends a log
|
||||
*/
|
||||
|
||||
void
|
||||
log_end (t_gui_buffer *buffer)
|
||||
{
|
||||
if (buffer->log_file)
|
||||
{
|
||||
log_write (buffer, _("**** End of log "));
|
||||
log_write_date (buffer);
|
||||
log_write (buffer, "****\n");
|
||||
fclose (buffer->log_file);
|
||||
buffer->log_file = NULL;
|
||||
}
|
||||
if (buffer->log_filename)
|
||||
free (buffer->log_filename);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_LOG_H
|
||||
#define __WEECHAT_LOG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
extern void log_write_date (t_gui_buffer *);
|
||||
extern void log_write (t_gui_buffer *, char *);
|
||||
extern void log_write_line (t_gui_buffer *, t_gui_line *);
|
||||
extern void log_start (t_gui_buffer *);
|
||||
extern void log_end (t_gui_buffer *);
|
||||
|
||||
#endif /* log.h */
|
||||
@@ -0,0 +1,789 @@
|
||||
/* ############################################################################
|
||||
* ### ___ __ ______________ _____ ###
|
||||
* ### __ | / /___________ ____/__ /_______ __ /_ ###
|
||||
* ### __ | /| / /_ _ \ _ \ / __ __ \ __ `/ __/ ###
|
||||
* ### __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ ###
|
||||
* ### ____/|__/ \___/\___/\____/ /_/ /_/\__,_/ \__/ ###
|
||||
* ### ###
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By FlashCode <flashcode@flashtux.org> ###
|
||||
### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* weechat.c: core functions for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
int sigsegv = 0; /* SIGSEGV received? */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (!weechat_log_file)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
fprintf (weechat_log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
else
|
||||
fprintf (weechat_log_file, "%s", buffer);
|
||||
fflush (weechat_log_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *inbuf;
|
||||
ICONV_CONST char *ptr_inbuf;
|
||||
char *ptr_outbuf;
|
||||
size_t inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) from_code;
|
||||
(void) to_code;
|
||||
outbuf = strdup (string);
|
||||
#endif /* HAVE_ICONV */
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_config_options: display config options
|
||||
*/
|
||||
|
||||
void wee_display_config_options ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
printf (_("WeeChat configuration options (~/.weechat/weechat.rc):\n\n"));
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if (weechat_options[i])
|
||||
{
|
||||
j = 0;
|
||||
while (weechat_options[i][j].option_name)
|
||||
{
|
||||
printf ("* %s:\n",
|
||||
weechat_options[i][j].option_name);
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
printf (_(" . type boolean (values: 'on' or 'off')\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_int == BOOL_TRUE) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
printf (_(" . type integer (values: between %d and %d)\n"),
|
||||
weechat_options[i][j].min,
|
||||
weechat_options[i][j].max);
|
||||
printf (_(" . default value: %d\n"),
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
printf (_(" . type string (values: "));
|
||||
k = 0;
|
||||
while (weechat_options[i][j].array_values[k])
|
||||
{
|
||||
printf ("'%s'",
|
||||
weechat_options[i][j].array_values[k]);
|
||||
if (weechat_options[i][j].array_values[k + 1])
|
||||
printf (", ");
|
||||
k++;
|
||||
}
|
||||
printf (")\n");
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
printf (_(" . type color (Curses or Gtk color, look at WeeChat doc)\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
printf (_(" . type string (any string)\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
}
|
||||
printf (_(" . description: %s\n\n"),
|
||||
gettext (weechat_options[i][j].long_description));
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf (_("Moreover, you can define aliases in [alias] section, by adding lines like:\n"));
|
||||
printf ("j=join\n");
|
||||
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_commands: display WeeChat and/or IRC commands
|
||||
*/
|
||||
|
||||
void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (weechat_cmd)
|
||||
{
|
||||
printf (_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
printf ("* %s", weechat_commands[i].command_name);
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(weechat_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
|
||||
if (irc_cmd)
|
||||
{
|
||||
printf (_("IRC commands:\n"));
|
||||
printf ("\n");
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args ||
|
||||
irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
printf ("* %s", irc_commands[i].command_name);
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(irc_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
*/
|
||||
|
||||
void
|
||||
wee_parse_args (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
t_irc_server server_tmp;
|
||||
|
||||
server_cmd_line = 0;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if ((strcmp (argv[i], "-c") == 0)
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
if ((strcmp (argv[i], "-i") == 0)
|
||||
|| (strcmp (argv[i], "--irc-commands") == 0))
|
||||
{
|
||||
wee_display_commands (0, 1);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
if ((strcmp (argv[i], "-w") == 0)
|
||||
|| (strcmp (argv[i], "--weechat-commands") == 0))
|
||||
{
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
{
|
||||
fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!server_new (server_tmp.name, server_tmp.autoconnect,
|
||||
server_tmp.autoreconnect,
|
||||
server_tmp.autoreconnect_delay,
|
||||
1, server_tmp.address, server_tmp.port,
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
server_cmd_line = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_dir: create a directory
|
||||
* return: 1 if ok (or directory already exists)
|
||||
* 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
wee_create_dir (char *directory)
|
||||
{
|
||||
if (mkdir (directory, 0755) < 0)
|
||||
{
|
||||
/* exit if error (except if directory already exists) */
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, directory);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_home_dirs: create (if not found):
|
||||
* - WeeChat home directory ("~/.weechat")
|
||||
* - "perl" directory (and "autoload")
|
||||
* - "ruby" directory (and "autoload")
|
||||
* - "python" directory (and "autoload")
|
||||
*/
|
||||
|
||||
void
|
||||
wee_create_home_dirs ()
|
||||
{
|
||||
char *ptr_home, *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* TODO: rewrite this code for Windows version */
|
||||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!weechat_home)
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
|
||||
/* create home directory "~/.weechat" ; error is fatal */
|
||||
if (!wee_create_dir (weechat_home))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
dir_name = (char *) malloc (dir_length * sizeof (char));
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
/* create "~/.weechat/perl" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"perl");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/perl/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "perl", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
/* create "~/.weechat/python" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"python");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/python/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "python", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_RUBY
|
||||
/* create "~/.weechat/ruby" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"ruby");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/ruby/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "ruby", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* create "~/.weechat/logs" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"logs");
|
||||
if (!wee_create_dir (dir_name))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
chmod (dir_name, 0700);
|
||||
|
||||
free (dir_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_vars: initialize some variables
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_vars ()
|
||||
{
|
||||
/* init received messages queue */
|
||||
recv_msgq = NULL;
|
||||
msgq_last_msg = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_log: initialize log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_log ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
snprintf (filename, filename_length, "%s/" WEECHAT_LOG_NAME, weechat_home);
|
||||
if ((weechat_log_file = fopen (filename, "wt")) == NULL)
|
||||
fprintf (stderr,
|
||||
_("%s unable to create/append to log file (~/.weechat/%s)"),
|
||||
WEECHAT_WARNING, WEECHAT_LOG_NAME);
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_welcome_message: display WeeChat welcome message - yeah!
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_welcome_message ()
|
||||
{
|
||||
if (cfg_look_startup_logo)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
" ___ __ ______________ _____ \n"
|
||||
" __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
|
||||
}
|
||||
if (cfg_look_weechat_slogan && cfg_look_weechat_slogan[0])
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, PACKAGE_NAME);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s\n", cfg_look_weechat_slogan);
|
||||
}
|
||||
if (cfg_look_startup_version)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
||||
"%s" PACKAGE_STRING,
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s %s %s\n",
|
||||
_("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
if (cfg_look_startup_logo ||
|
||||
(cfg_look_weechat_slogan && cfg_look_weechat_slogan[0]) ||
|
||||
cfg_look_startup_version)
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
||||
|
||||
wee_log_printf ("%s (%s %s %s)\n",
|
||||
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_gui_shutdown: shutdown WeeChat GUI
|
||||
*/
|
||||
|
||||
void
|
||||
wee_gui_shutdown ()
|
||||
{
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown (int return_code)
|
||||
{
|
||||
fifo_remove ();
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
if (weechat_log_file)
|
||||
fclose (weechat_log_file);
|
||||
if (local_charset)
|
||||
free (local_charset);
|
||||
alias_free_all ();
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_dump writes dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_dump (int crash)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* prevent reentrance */
|
||||
if (sigsegv)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (crash)
|
||||
{
|
||||
sigsegv = 1;
|
||||
wee_log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
if (crash)
|
||||
{
|
||||
wee_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
wee_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
wee_log_printf ("****** and explain when this crash happened ******\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf ("****** WeeChat dump request ******\n");
|
||||
}
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
server_print_log (ptr_server);
|
||||
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
channel_print_log (ptr_channel);
|
||||
|
||||
for (ptr_nick = ptr_channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
nick_print_log (ptr_nick);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("[windows/buffers]\n");
|
||||
wee_log_printf (" => windows:\n");
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_window);
|
||||
}
|
||||
wee_log_printf (" => buffers:\n");
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_buffer);
|
||||
}
|
||||
wee_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
gui_window_print_log (ptr_window);
|
||||
}
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
gui_buffer_print_log (ptr_buffer);
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
wee_log_printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigsegv ()
|
||||
{
|
||||
wee_dump (1);
|
||||
wee_gui_shutdown ();
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat has crashed (SIGSEGV received)\n");
|
||||
fprintf (stderr, "*** Full crash dump was saved to ~/.weechat/weechat.log file\n");
|
||||
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* main: WeeChat startup
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#endif
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
case 0: /* config file OK */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
if (config_create_default () < 0)
|
||||
return EXIT_FAILURE;
|
||||
if (config_read () != 0)
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
gui_init (); /* init WeeChat interface */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
plugin_init (); /* init plugin interface(s) */
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_H
|
||||
#define __WEECHAT_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(ENABLE_NLS) && !defined(_)
|
||||
#include <locale.h>
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
#include <libintl.h>
|
||||
#else
|
||||
#include "../../intl/libintl.h"
|
||||
#endif
|
||||
#define _(x) gettext(x)
|
||||
#ifdef gettext_noop
|
||||
#define N_(string) gettext_noop (string)
|
||||
#else
|
||||
#define N_(string) (string)
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(_)
|
||||
#define _(x) (x)
|
||||
#define N_(string) (string)
|
||||
#endif
|
||||
|
||||
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _("WeeChat Error:")
|
||||
#define WEECHAT_WARNING _("WeeChat Warning:")
|
||||
|
||||
/* log file */
|
||||
|
||||
#define WEECHAT_LOG_NAME "weechat.log"
|
||||
|
||||
/* license */
|
||||
|
||||
#define WEE_LICENSE \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"This program is free software; you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation; either version 2 of the License, or\n" \
|
||||
"(at your option) any later version.\n" \
|
||||
"\n", \
|
||||
\
|
||||
"This program is distributed in the hope that it will be useful,\n" \
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \
|
||||
"GNU General Public License for more details.\n" \
|
||||
"\n" \
|
||||
"You should have received a copy of the GNU General Public License\n" \
|
||||
"along with this program; if not, write to the Free Software\n" \
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"Usage: %s [options ...]\n" \
|
||||
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -c, --config display config file options\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -i, --irc-commands display IRC commands\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n" \
|
||||
" -w, --weechat-commands display WeeChat commands\n\n"
|
||||
|
||||
/* directory separator, depending on OS */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DIR_SEPARATOR "\\"
|
||||
#define DIR_SEPARATOR_CHAR '\\'
|
||||
#else
|
||||
#define DIR_SEPARATOR "/"
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#endif
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_shutdown (int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -23,6 +21,8 @@
|
||||
#ifndef __WEECHAT_CONFIG_H
|
||||
#define __WEECHAT_CONFIG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define WEECHAT_CONFIG_NAME "weechat.rc"
|
||||
|
||||
#define CONFIG_SECTION_NONE -1
|
||||
@@ -30,10 +30,12 @@
|
||||
#define CONFIG_SECTION_COLORS 1
|
||||
#define CONFIG_SECTION_HISTORY 2
|
||||
#define CONFIG_SECTION_LOG 3
|
||||
#define CONFIG_SECTION_DCC 4
|
||||
#define CONFIG_SECTION_PROXY 5
|
||||
#define CONFIG_SECTION_SERVER 6
|
||||
#define CONFIG_NUMBER_SECTIONS 7
|
||||
#define CONFIG_SECTION_IRC 4
|
||||
#define CONFIG_SECTION_DCC 5
|
||||
#define CONFIG_SECTION_PROXY 6
|
||||
#define CONFIG_SECTION_ALIAS 7
|
||||
#define CONFIG_SECTION_SERVER 8
|
||||
#define CONFIG_NUMBER_SECTIONS 9
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -71,12 +73,17 @@ struct t_config_option
|
||||
char **array_values;
|
||||
int *ptr_int;
|
||||
char **ptr_string;
|
||||
int (*handler_change)(int *, char **);
|
||||
void (*handler_change)();
|
||||
};
|
||||
|
||||
extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern char *cfg_look_buffer_timestamp;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
@@ -88,6 +95,9 @@ extern int cfg_look_nickmode;
|
||||
extern int cfg_look_nickmode_empty;
|
||||
extern char *cfg_look_no_nickname;
|
||||
extern char *cfg_look_completor;
|
||||
extern int cfg_look_infobar;
|
||||
extern char *cfg_look_infobar_timestamp;
|
||||
extern int cfg_look_infobar_delay_highlight;
|
||||
|
||||
extern int cfg_col_title;
|
||||
extern int cfg_col_title_bg;
|
||||
@@ -100,43 +110,70 @@ extern int cfg_col_chat_nick;
|
||||
extern int cfg_col_chat_host;
|
||||
extern int cfg_col_chat_channel;
|
||||
extern int cfg_col_chat_dark;
|
||||
extern int cfg_col_chat_highlight;
|
||||
extern int cfg_col_chat_bg;
|
||||
extern int cfg_col_status;
|
||||
extern int cfg_col_status_active;
|
||||
extern int cfg_col_status_delimiters;
|
||||
extern int cfg_col_status_data_msg;
|
||||
extern int cfg_col_status_data_highlight;
|
||||
extern int cfg_col_status_data_other;
|
||||
extern int cfg_col_status_more;
|
||||
extern int cfg_col_status_bg;
|
||||
extern int cfg_col_infobar;
|
||||
extern int cfg_col_infobar_highlight;
|
||||
extern int cfg_col_infobar_bg;
|
||||
extern int cfg_col_input;
|
||||
extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
extern int cfg_col_nick_chanowner;
|
||||
extern int cfg_col_nick_chanadmin;
|
||||
extern int cfg_col_nick_op;
|
||||
extern int cfg_col_nick_halfop;
|
||||
extern int cfg_col_nick_voice;
|
||||
extern int cfg_col_nick_more;
|
||||
extern int cfg_col_nick_sep;
|
||||
extern int cfg_col_nick_self;
|
||||
extern int cfg_col_nick_private;
|
||||
extern int cfg_col_nick_bg;
|
||||
extern int cfg_col_dcc_selected;
|
||||
extern int cfg_col_dcc_waiting;
|
||||
extern int cfg_col_dcc_connecting;
|
||||
extern int cfg_col_dcc_active;
|
||||
extern int cfg_col_dcc_done;
|
||||
extern int cfg_col_dcc_failed;
|
||||
extern int cfg_col_dcc_aborted;
|
||||
|
||||
extern int cfg_history_max_lines;
|
||||
extern int cfg_history_max_commands;
|
||||
|
||||
extern int cfg_log_auto_channels;
|
||||
extern int cfg_log_auto_server;
|
||||
extern int cfg_log_auto_channel;
|
||||
extern int cfg_log_auto_private;
|
||||
extern int cfg_log_plugin_msg;
|
||||
extern char *cfg_log_path;
|
||||
extern char *cfg_log_name;
|
||||
extern char *cfg_log_timestamp;
|
||||
extern char *cfg_log_start_string;
|
||||
extern char *cfg_log_end_string;
|
||||
extern int cfg_log_hide_nickserv_pwd;
|
||||
|
||||
extern int cfg_irc_display_away;
|
||||
extern char *cfg_irc_default_msg_away;
|
||||
extern char *cfg_irc_default_msg_part;
|
||||
extern char *cfg_irc_default_msg_quit;
|
||||
extern int cfg_irc_away_check;
|
||||
extern int cfg_irc_lag_check;
|
||||
extern int cfg_irc_lag_min_show;
|
||||
extern int cfg_irc_lag_disconnect;
|
||||
extern int cfg_irc_fifo_pipe;
|
||||
|
||||
extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_max_size;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_convert_spaces;
|
||||
extern int cfg_dcc_auto_rename;
|
||||
extern int cfg_dcc_auto_resume;
|
||||
|
||||
@@ -148,8 +185,21 @@ extern char *cfg_proxy_password;
|
||||
extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS];
|
||||
extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
||||
|
||||
extern char *config_get_section ();
|
||||
extern void config_change_noop ();
|
||||
extern void config_change_title ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_away_check ();
|
||||
extern void config_change_fifo_pipe ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern int config_set_value (char *, char *);
|
||||
extern void *config_get_server_option_ptr (t_irc_server *, char *);
|
||||
extern int config_set_server_value (t_irc_server *, char *, char *);
|
||||
extern int config_read ();
|
||||
extern int config_create_default ();
|
||||
extern void config_write ();
|
||||
extern int config_write ();
|
||||
|
||||
#endif /* config.h */
|
||||
#endif /* weeconfig.h */
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* weelist.c: sorted lists management */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weelist.h"
|
||||
|
||||
|
||||
/*
|
||||
* weelist_search: search date in a list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_search (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) == 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* word not found in list */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_find_pos: find position for data (keeping list sorted)
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_find_pos (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) < 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* position not found, best position is at the end */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_insert: insert an element to the list (at good position)
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_insert (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *pos_weelist;
|
||||
|
||||
pos_weelist = weelist_find_pos (*weelist, element->data);
|
||||
|
||||
if (*weelist)
|
||||
{
|
||||
if (pos_weelist)
|
||||
{
|
||||
/* insert data into the list (before position found) */
|
||||
element->prev_weelist = pos_weelist->prev_weelist;
|
||||
element->next_weelist = pos_weelist;
|
||||
if (pos_weelist->prev_weelist)
|
||||
pos_weelist->prev_weelist->next_weelist = element;
|
||||
else
|
||||
*weelist = element;
|
||||
pos_weelist->prev_weelist = element;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add data to the end */
|
||||
element->prev_weelist = *last_weelist;
|
||||
element->next_weelist = NULL;
|
||||
(*last_weelist)->next_weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
element->prev_weelist = NULL;
|
||||
element->next_weelist = NULL;
|
||||
*weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_add: create new data and add it to list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_add (t_weelist **weelist, t_weelist **last_weelist, char *data)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
if (!data || (!data[0]))
|
||||
return NULL;
|
||||
|
||||
if ((new_weelist = ((t_weelist *) malloc (sizeof (t_weelist)))))
|
||||
{
|
||||
new_weelist->data = strdup (data);
|
||||
weelist_insert (weelist, last_weelist, new_weelist);
|
||||
return new_weelist;
|
||||
}
|
||||
/* failed to allocate new element */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_remove: free an element in a list
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
/* remove element from list */
|
||||
if (*last_weelist == element)
|
||||
*last_weelist = element->prev_weelist;
|
||||
if (element->prev_weelist)
|
||||
{
|
||||
(element->prev_weelist)->next_weelist = element->next_weelist;
|
||||
new_weelist = *weelist;
|
||||
}
|
||||
else
|
||||
new_weelist = element->next_weelist;
|
||||
|
||||
if (element->next_weelist)
|
||||
(element->next_weelist)->prev_weelist = element->prev_weelist;
|
||||
|
||||
/* free data */
|
||||
if (element->data)
|
||||
free (element->data);
|
||||
free (element);
|
||||
*weelist = new_weelist;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_LIST_H
|
||||
#define __WEECHAT_LIST_H 1
|
||||
|
||||
typedef struct t_weelist t_weelist;
|
||||
|
||||
struct t_weelist
|
||||
{
|
||||
char *data;
|
||||
t_weelist *prev_weelist;
|
||||
t_weelist *next_weelist;
|
||||
};
|
||||
|
||||
t_weelist *weelist_search (t_weelist *, char *);
|
||||
t_weelist *weelist_add (t_weelist **, t_weelist **, char *);
|
||||
void weelist_remove (t_weelist **, t_weelist **, t_weelist *);
|
||||
|
||||
#endif /* weelist.h */
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* completion.c: completes words according to context (cmd/nick) */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "irc/irc.h"
|
||||
#include "command.h"
|
||||
|
||||
|
||||
/*
|
||||
* completion_init: init completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_init (t_completion *completion)
|
||||
{
|
||||
completion->position = -1;
|
||||
completion->base_word = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command: complete a command
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command (t_completion *completion)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_index_command *ptr_index;
|
||||
|
||||
length = strlen (completion->base_word) - 1;
|
||||
word_found_seen = 0;
|
||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
||||
{
|
||||
if (strncasecmp (ptr_index->command_name, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_index->command_name;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_index->command_name, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command (completion);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nick: complete a nick
|
||||
*/
|
||||
|
||||
void
|
||||
completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_nick->nick;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_nick (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_search: complete word according to context
|
||||
*/
|
||||
|
||||
void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
int i, pos_start, pos_end;
|
||||
char *old_word_found;
|
||||
|
||||
/* TODO: complete when no word is there with command according to context */
|
||||
if (size == 0)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* if new complation => look for base word */
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
|
||||
if ((pos == size) || (buffer[pos-1] != ' '))
|
||||
pos--;
|
||||
if ((pos > 0) && (buffer[pos] == ' '))
|
||||
return;
|
||||
|
||||
i = pos;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
if (pos_start > pos_end)
|
||||
return;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
|
||||
if (completion->base_word[0] == '/')
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
}
|
||||
|
||||
/* completion */
|
||||
old_word_found = completion->word_found;
|
||||
if (completion->base_word[0] == '/')
|
||||
{
|
||||
completion_command (completion);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word) + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel)
|
||||
{
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_COMPLETION_H
|
||||
#define __WEECHAT_COMPLETION_H 1
|
||||
|
||||
typedef struct t_completion t_completion;
|
||||
|
||||
struct t_completion
|
||||
{
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where we shoud complete */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word should be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
-1021
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# WeeChat with Curses interface
|
||||
ifeq ($(GUI), curses)
|
||||
curses: curses/gui.a
|
||||
curses/gui.a:
|
||||
cd curses && make
|
||||
endif
|
||||
|
||||
# WeeChat with Gtk+ interface
|
||||
ifeq ($(GUI), gtk)
|
||||
gtk: gtk/gui.a
|
||||
gtk/gui.a:
|
||||
cd gtk && make
|
||||
endif
|
||||
|
||||
# WeeChat with Qt interface
|
||||
ifeq ($(GUI), qt)
|
||||
qt: qt/gui.a
|
||||
qt/gui.a:
|
||||
cd qt && make
|
||||
endif
|
||||
|
||||
# WeeChat with Text interface
|
||||
ifeq ($(GUI), text)
|
||||
text: text/gui.a
|
||||
text/gui.a:
|
||||
cd text && make
|
||||
endif
|
||||
|
||||
|
||||
all:
|
||||
make curses GUI=curses
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
cd curses && make clean
|
||||
cd gtk && make clean
|
||||
cd qt && make clean
|
||||
cd text && make clean
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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
|
||||
@@ -15,23 +15,27 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
noinst_LIBRARIES = lib_weechat_gui_common.a
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_GTK
|
||||
lib_weechat_gui_common_a_SOURCES = gui-common.c \
|
||||
gui.h
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
if GUI_NCURSES
|
||||
curses_dir=curses
|
||||
endif
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
if GUI_WXWIDGETS
|
||||
wxwidgets_dir=wxwidgets
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
if GUI_GTK
|
||||
gtk_dir=gtk
|
||||
endif
|
||||
|
||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../config.h \
|
||||
../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
||||
if GUI_QT
|
||||
qt_dir=qt
|
||||
endif
|
||||
|
||||
SUBDIRS = . $(curses_dir) $(wxwidgets_dir) $(gtk_dir) $(qt_dir)
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_CURSES
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
|
||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../completion.h \
|
||||
../../history.h ../../config.h ../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h ../../completion.h \
|
||||
../../history.h ../../command.h ../../irc/irc.h ../../gui/gui.h
|
||||
@@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
bin_PROGRAMS = weechat-curses
|
||||
|
||||
weechat_curses_LDADD = ../lib_weechat_gui_common.a \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(NCURSES_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_curses_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
+2086
-1099
File diff suppressed because it is too large
Load Diff
+650
-361
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = weechat-gtk
|
||||
|
||||
weechat_gtk_LDADD = ../lib_weechat_gui_common.a \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(GTK_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_gtk_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
@@ -0,0 +1,789 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* gui-display.c: display functions for Gtk GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
t_gui_color gui_colors[] =
|
||||
{ { "default", 0 },
|
||||
{ "black", 0 },
|
||||
{ "red", 0 },
|
||||
{ "lightred", 0 },
|
||||
{ "green", 0 },
|
||||
{ "lightgreen", 0 },
|
||||
{ "brown", 0 },
|
||||
{ "yellow", 0 },
|
||||
{ "blue", 0 },
|
||||
{ "lightblue", 0 },
|
||||
{ "magenta", 0L },
|
||||
{ "lightmagenta", 0 },
|
||||
{ "cyan", 0 },
|
||||
{ "lightcyan", 0 },
|
||||
{ "gray", 0 },
|
||||
{ "white", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
|
||||
{ "cyan", "magenta", "green", "brown", "lightblue", "gray",
|
||||
"lightcyan", "lightmagenta", "lightgreen", "blue" };
|
||||
|
||||
int color_attr[NUM_COLORS];
|
||||
|
||||
GtkWidget *gtk_main_window;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *entry_topic;
|
||||
GtkWidget *notebook1;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *scrolledwindow_chat;
|
||||
GtkWidget *scrolledwindow_nick;
|
||||
GtkWidget *entry_input;
|
||||
GtkWidget *label1;
|
||||
|
||||
|
||||
/*
|
||||
* gui_assign_color: assign a color (read from config)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_assign_color (int *color, char *color_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look for Gtk colors in table */
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
{
|
||||
*color = gui_colors[i].color;
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* color not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_color_by_name: get color by name
|
||||
*/
|
||||
|
||||
int
|
||||
gui_get_color_by_name (char *color_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look for Gtk in table */
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
return gui_colors[i].color;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* color not found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_color_by_value: get color name by value
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_get_color_by_value (int color_value)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look for Gtk colors in table */
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (gui_colors[i].color == color_value)
|
||||
return gui_colors[i].name;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* color not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_has_nicklist: returns 1 if window has nicklist
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_has_nicklist (t_gui_window *window)
|
||||
{
|
||||
return (window->textbuffer_nicklist != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_calculate_pos_size: calculate position and size for a window & sub-win
|
||||
*/
|
||||
|
||||
void
|
||||
gui_calculate_pos_size (t_gui_window *window)
|
||||
{
|
||||
/* TODO: write gui_calculate_pos_size for Gtk GUI */
|
||||
(void) window;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_title: draw title window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_title (t_gui_window *window)
|
||||
{
|
||||
char format[32];
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
if (CHANNEL(window))
|
||||
{
|
||||
sprintf (format, "%%-%ds", window->win_width);
|
||||
/* TODO: display topic */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: display title for server window */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_title: redraw title window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_title (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_title (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_line_num_splits: returns number of lines on window
|
||||
* (depending on window width and type (server/channel)
|
||||
* for alignment)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_get_line_num_splits (t_gui_window *window, t_gui_line *line)
|
||||
{
|
||||
int length, width;
|
||||
|
||||
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
|
||||
if (line->length_align >= window->win_chat_width - 5)
|
||||
{
|
||||
length = line->length;
|
||||
width = window->win_chat_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
length = line->length - line->length_align;
|
||||
width = window->win_chat_width - line->length_align;
|
||||
}
|
||||
|
||||
return (length % width == 0) ? (length / width) : ((length / width) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_end_of_line: display end of a line in the chat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
||||
{
|
||||
/* TODO: display end of line! */
|
||||
(void) window;
|
||||
(void) line;
|
||||
(void) count;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_line: display a line in the chat window
|
||||
* if stop_at_end == 1, screen will not scroll and then we
|
||||
* exit since chat window is full
|
||||
* returns: 1 if stop_at_end == 0 or screen not full
|
||||
* 0 if screen is full and if stop_at_end == 1
|
||||
*/
|
||||
|
||||
int
|
||||
gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
|
||||
{
|
||||
/* TODO: display line! */
|
||||
(void) window;
|
||||
(void) line;
|
||||
(void) stop_at_end;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_chat: draw chat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_chat (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw chat window */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_chat: redraw chat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_chat (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_chat (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_nick: draw nick window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_nick (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: display nicklist for Gtk GUI */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_nick: redraw nick window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_nick (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_nick (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_status: draw status window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_status (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw status window! */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_status: redraw status window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_status (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_status (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_infobar: draw infobar window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_infobar (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw infobar window! */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_infobar: redraw infobar window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_infobar (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_infobar (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_input: draw input window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_input (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw input window */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_input: redraw input window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_input (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_input (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window: redraw a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
gui_redraw_window_title (window);
|
||||
gui_redraw_window_chat (window);
|
||||
if (gui_window_has_nicklist (window))
|
||||
gui_redraw_window_nick (window);
|
||||
gui_redraw_window_status (window);
|
||||
gui_redraw_window_input (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_window: switch to another window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_switch_to_window (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
GtkTextIter start, end;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->is_displayed)
|
||||
{
|
||||
/* TODO: manage splitted windows */
|
||||
ptr_win->is_displayed = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_calculate_pos_size (window);
|
||||
|
||||
if (!window->textview_chat)
|
||||
{
|
||||
window->textview_chat = gtk_text_view_new ();
|
||||
gtk_widget_show (window->textview_chat);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), window->textview_chat);
|
||||
gtk_widget_set_size_request (window->textview_chat, 300, -1);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_chat), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_chat), FALSE);
|
||||
|
||||
window->textbuffer_chat = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_chat), window->textbuffer_chat);
|
||||
|
||||
window->texttag_chat = gtk_text_buffer_create_tag(window->textbuffer_chat, "courier", "font_family", "lucida");
|
||||
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
|
||||
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
|
||||
}
|
||||
if (WIN_IS_CHANNEL (window) && !window->textbuffer_nicklist)
|
||||
{
|
||||
|
||||
window->textview_nicklist = gtk_text_view_new ();
|
||||
gtk_widget_show (window->textview_nicklist);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), window->textview_nicklist);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
|
||||
|
||||
window->textbuffer_nicklist = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_nicklist), window->textbuffer_nicklist);
|
||||
}
|
||||
|
||||
/* change current window to the new window */
|
||||
gui_current_window = window;
|
||||
|
||||
window->is_displayed = 1;
|
||||
window->unread_data = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_previous_window: switch to previous window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_switch_to_previous_window ()
|
||||
{
|
||||
/* if only one windows then return */
|
||||
if (gui_windows == last_gui_window)
|
||||
return;
|
||||
|
||||
if (gui_current_window->prev_window)
|
||||
gui_switch_to_window (gui_current_window->prev_window);
|
||||
else
|
||||
gui_switch_to_window (last_gui_window);
|
||||
gui_redraw_window (gui_current_window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_next_window: switch to next window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_switch_to_next_window ()
|
||||
{
|
||||
/* if only one windows then return */
|
||||
if (gui_windows == last_gui_window)
|
||||
return;
|
||||
|
||||
if (gui_current_window->next_window)
|
||||
gui_switch_to_window (gui_current_window->next_window);
|
||||
else
|
||||
gui_switch_to_window (gui_windows);
|
||||
gui_redraw_window (gui_current_window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_page_up: display previous page on window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_page_up ()
|
||||
{
|
||||
if (!gui_current_window->first_line_displayed)
|
||||
{
|
||||
gui_current_window->sub_lines += gui_current_window->win_chat_height - 1;
|
||||
gui_redraw_window_chat (gui_current_window);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_page_down: display next page on window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_page_down ()
|
||||
{
|
||||
if (gui_current_window->sub_lines > 0)
|
||||
{
|
||||
gui_current_window->sub_lines -= gui_current_window->win_chat_height - 1;
|
||||
if (gui_current_window->sub_lines < 0)
|
||||
gui_current_window->sub_lines = 0;
|
||||
if (gui_current_window->sub_lines == 0)
|
||||
gui_current_window->unread_data = 0;
|
||||
gui_redraw_window_chat (gui_current_window);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_gtk_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_gtk_resize_handler ()
|
||||
{
|
||||
/* TODO: write resize handler for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_init_subwindows: init subwindows for a WeeChat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_init_subwindows (t_gui_window *window)
|
||||
{
|
||||
window->textview_chat = NULL;
|
||||
window->textbuffer_chat = NULL;
|
||||
window->texttag_chat = NULL;
|
||||
window->textview_nicklist = NULL;
|
||||
window->textbuffer_nicklist = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_pre_init: pre-initialize GUI (called before gui_init)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_pre_init (int *argc, char **argv[])
|
||||
{
|
||||
/* Initialise Gtk+ */
|
||||
gtk_init (argc, argv);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_init_colors: init GUI colors
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init_colors ()
|
||||
{
|
||||
/* TODO: init colors for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_set_window_title: set window title
|
||||
*/
|
||||
|
||||
void
|
||||
gui_set_window_title ()
|
||||
{
|
||||
/* TODO: set window title for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_init: init GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init ()
|
||||
{
|
||||
gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (gtk_main_window), PACKAGE_STRING);
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_container_add (GTK_CONTAINER (gtk_main_window), vbox1);
|
||||
|
||||
entry_topic = gtk_entry_new ();
|
||||
gtk_widget_show (entry_topic);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), entry_topic, FALSE, FALSE, 0);
|
||||
|
||||
notebook1 = gtk_notebook_new ();
|
||||
gtk_widget_show (notebook1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook1), GTK_POS_BOTTOM);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
scrolledwindow_chat = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow_chat);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_chat, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_chat), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
scrolledwindow_nick = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow_nick);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_nick, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_nick), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
entry_input = gtk_entry_new ();
|
||||
gtk_widget_show (entry_input);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), entry_input, FALSE, FALSE, 0);
|
||||
|
||||
label1 = gtk_label_new (_("server"));
|
||||
gtk_widget_show (label1);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
|
||||
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
|
||||
|
||||
gtk_widget_show_all (gtk_main_window);
|
||||
|
||||
/* create a new window */
|
||||
gui_current_window = gui_window_new (NULL, NULL, 1 /*0, 0, COLS, LINES*/);
|
||||
|
||||
/* TODO: set gui_ready to 1 when Gtk display functions will be ok */
|
||||
gui_ready = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_end: GUI end
|
||||
*/
|
||||
|
||||
void
|
||||
gui_end ()
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
/* delete all windows */
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
/* TODO: delete Gtk windows */
|
||||
/* TODO: free input buffer, lines, messages, completion */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_add_message: add a message to a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_add_message (t_gui_window *window, int type, int color, char *message)
|
||||
{
|
||||
char *pos;
|
||||
int length;
|
||||
GtkTextIter start, end;
|
||||
|
||||
/* create new line if previous was ending by '\n' (or if 1st line) */
|
||||
if (window->line_complete)
|
||||
{
|
||||
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, "\n", -1);
|
||||
window->line_complete = 0;
|
||||
}
|
||||
|
||||
pos = strchr (message, '\n');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
window->line_complete = 1;
|
||||
}
|
||||
|
||||
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, message, -1);
|
||||
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
|
||||
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
|
||||
|
||||
if (pos)
|
||||
pos[0] = '\n';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_printf_color_type: display a message in a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_printf_color_type (t_gui_window *window, int type, int color, char *message, ...)
|
||||
{
|
||||
static char buffer[8192];
|
||||
char timestamp[16];
|
||||
char *pos;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (gui_ready)
|
||||
{
|
||||
if (color == -1)
|
||||
color = COLOR_WIN_CHAT;
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
if (SERVER(gui_current_window))
|
||||
window = SERVER(gui_current_window)->window;
|
||||
else
|
||||
window = gui_current_window;
|
||||
}
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
wee_log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (gui_ready)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
|
||||
pos = buffer - 1;
|
||||
while (pos)
|
||||
{
|
||||
/* TODO: read timestamp format from config! */
|
||||
if (window->line_complete)
|
||||
{
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
|
||||
sprintf (timestamp, "%02d", date_tmp->tm_hour);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
|
||||
sprintf (timestamp, "%02d", date_tmp->tm_min);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
|
||||
sprintf (timestamp, "%02d", date_tmp->tm_sec);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
|
||||
}
|
||||
gui_add_message (window, type, color, pos + 1);
|
||||
pos = strchr (pos + 1, '\n');
|
||||
if (pos && !pos[1])
|
||||
pos = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
g_print ("%s", buffer);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* gui-input: user input functions for Gtk GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_read_keyb: read keyboard line
|
||||
*/
|
||||
|
||||
void
|
||||
gui_read_keyb ()
|
||||
{
|
||||
/* TODO: read keyboard for Gtk GUI */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with Gtk GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_loop ()
|
||||
{
|
||||
/* TODO: main loop function for Gtk GUI */
|
||||
gtk_main ();
|
||||
}
|
||||
@@ -0,0 +1,934 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* gui-common.c: display functions, used by any GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <curses.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "gui.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../common/hotlist.h"
|
||||
#include "../common/log.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
int gui_init_ok = 0; /* = 1 if GUI is initialized */
|
||||
int gui_ok = 0; /* = 1 if GUI is ok */
|
||||
/* (0 when term size too small) */
|
||||
int gui_add_hotlist = 1; /* 0 is for temporarly disable */
|
||||
/* hotlist add for all buffers */
|
||||
|
||||
t_gui_window *gui_windows = NULL; /* pointer to first window */
|
||||
t_gui_window *last_gui_window = NULL; /* pointer to last window */
|
||||
t_gui_window *gui_current_window = NULL; /* pointer to current window */
|
||||
|
||||
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
|
||||
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
|
||||
t_gui_buffer *buffer_before_dcc = NULL; /* buffer before dcc switch */
|
||||
t_gui_infobar *gui_infobar; /* pointer to infobar content */
|
||||
|
||||
|
||||
/*
|
||||
* gui_window_new: create a new window
|
||||
*/
|
||||
|
||||
t_gui_window *
|
||||
gui_window_new (int x, int y, int width, int height)
|
||||
{
|
||||
t_gui_window *new_window;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
|
||||
{
|
||||
new_window->win_x = x;
|
||||
new_window->win_y = y;
|
||||
new_window->win_width = width;
|
||||
new_window->win_height = height;
|
||||
|
||||
new_window->win_chat_x = 0;
|
||||
new_window->win_chat_y = 0;
|
||||
new_window->win_chat_width = 0;
|
||||
new_window->win_chat_height = 0;
|
||||
new_window->win_chat_cursor_x = 0;
|
||||
new_window->win_chat_cursor_y = 0;
|
||||
|
||||
new_window->win_nick_x = 0;
|
||||
new_window->win_nick_y = 0;
|
||||
new_window->win_nick_width = 0;
|
||||
new_window->win_nick_height = 0;
|
||||
new_window->win_nick_start = 0;
|
||||
|
||||
new_window->win_title = NULL;
|
||||
new_window->win_chat = NULL;
|
||||
new_window->win_nick = NULL;
|
||||
new_window->win_status = NULL;
|
||||
new_window->win_infobar = NULL;
|
||||
new_window->win_input = NULL;
|
||||
new_window->win_separator = NULL;
|
||||
|
||||
new_window->textview_chat = NULL;
|
||||
new_window->textbuffer_chat = NULL;
|
||||
new_window->texttag_chat = NULL;
|
||||
new_window->textview_nicklist = NULL;
|
||||
new_window->textbuffer_nicklist = NULL;
|
||||
|
||||
new_window->dcc_first = NULL;
|
||||
new_window->dcc_selected = NULL;
|
||||
new_window->dcc_last_displayed = NULL;
|
||||
|
||||
new_window->buffer = NULL;
|
||||
|
||||
new_window->first_line_displayed = 0;
|
||||
new_window->sub_lines = 0;
|
||||
|
||||
/* add window to windows queue */
|
||||
new_window->prev_window = last_gui_window;
|
||||
if (gui_windows)
|
||||
last_gui_window->next_window = new_window;
|
||||
else
|
||||
gui_windows = new_window;
|
||||
last_gui_window = new_window;
|
||||
new_window->next_window = NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return new_window;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_new: create a new buffer in current window
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_gui_buffer *new_buffer;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new buffer\n");
|
||||
#endif
|
||||
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
if (!dcc && gui_buffers && (!SERVER(gui_buffers)))
|
||||
{
|
||||
if (server)
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->buffer = gui_buffers;
|
||||
gui_buffers->server = server;
|
||||
gui_buffers->channel = channel;
|
||||
if (cfg_log_auto_server)
|
||||
log_start (gui_buffers);
|
||||
return gui_buffers;
|
||||
}
|
||||
|
||||
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
|
||||
{
|
||||
new_buffer->num_displayed = 0;
|
||||
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
|
||||
|
||||
/* assign server and channel to buffer */
|
||||
new_buffer->server = server;
|
||||
new_buffer->channel = channel;
|
||||
new_buffer->dcc = dcc;
|
||||
/* assign buffer to server and channel */
|
||||
if (server && !channel)
|
||||
SERVER(new_buffer)->buffer = new_buffer;
|
||||
if (channel)
|
||||
CHANNEL(new_buffer)->buffer = new_buffer;
|
||||
|
||||
if (!window->buffer)
|
||||
{
|
||||
window->buffer = new_buffer;
|
||||
window->first_line_displayed = 1;
|
||||
window->sub_lines = 0;
|
||||
gui_calculate_pos_size (window);
|
||||
gui_window_init_subwindows (window);
|
||||
}
|
||||
|
||||
/* init lines */
|
||||
new_buffer->lines = NULL;
|
||||
new_buffer->last_line = NULL;
|
||||
new_buffer->num_lines = 0;
|
||||
new_buffer->line_complete = 1;
|
||||
|
||||
/* notify level */
|
||||
new_buffer->notify_level = 3;
|
||||
|
||||
/* create/append to log file */
|
||||
new_buffer->log_filename = NULL;
|
||||
new_buffer->log_file = NULL;
|
||||
if ((cfg_log_auto_server && BUFFER_IS_SERVER(new_buffer))
|
||||
|| (cfg_log_auto_channel && BUFFER_IS_CHANNEL(new_buffer))
|
||||
|| (cfg_log_auto_private && BUFFER_IS_PRIVATE(new_buffer)))
|
||||
log_start (new_buffer);
|
||||
|
||||
/* init input buffer */
|
||||
new_buffer->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||
new_buffer->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||
new_buffer->input_buffer[0] = '\0';
|
||||
new_buffer->input_buffer_size = 0;
|
||||
new_buffer->input_buffer_pos = 0;
|
||||
new_buffer->input_buffer_1st_display = 0;
|
||||
|
||||
/* init completion */
|
||||
completion_init (&(new_buffer->completion));
|
||||
|
||||
/* init history */
|
||||
new_buffer->history = NULL;
|
||||
new_buffer->last_history = NULL;
|
||||
new_buffer->ptr_history = NULL;
|
||||
new_buffer->num_history = 0;
|
||||
|
||||
/* add buffer to buffers queue */
|
||||
new_buffer->prev_buffer = last_gui_buffer;
|
||||
if (gui_buffers)
|
||||
last_gui_buffer->next_buffer = new_buffer;
|
||||
else
|
||||
gui_buffers = new_buffer;
|
||||
last_gui_buffer = new_buffer;
|
||||
new_buffer->next_buffer = NULL;
|
||||
|
||||
/* switch to new buffer */
|
||||
if (switch_to_buffer)
|
||||
gui_switch_to_buffer (window, new_buffer);
|
||||
|
||||
/* redraw buffer */
|
||||
gui_redraw_buffer (new_buffer);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return new_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_clear: clear buffer content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_clear (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
while (buffer->lines->messages)
|
||||
{
|
||||
ptr_message = buffer->lines->messages->next_message;
|
||||
if (buffer->lines->messages->message)
|
||||
free (buffer->lines->messages->message);
|
||||
free (buffer->lines->messages);
|
||||
buffer->lines->messages = ptr_message;
|
||||
}
|
||||
free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
|
||||
buffer->lines = NULL;
|
||||
buffer->last_line = NULL;
|
||||
buffer->num_lines = 0;
|
||||
buffer->line_complete = 1;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
{
|
||||
ptr_win->first_line_displayed = 1;
|
||||
ptr_win->sub_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_clear_all: clear all buffers content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_clear_all ()
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
gui_buffer_clear (ptr_buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_infobar_printf: display message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
{
|
||||
static char buffer[1024];
|
||||
va_list argptr;
|
||||
t_gui_infobar *ptr_infobar;
|
||||
char *pos, *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
buffer);
|
||||
|
||||
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
|
||||
if (ptr_infobar)
|
||||
{
|
||||
ptr_infobar->color = color;
|
||||
ptr_infobar->text = strdup (buf2);
|
||||
pos = strchr (ptr_infobar->text, '\n');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
|
||||
ptr_infobar->next_infobar = gui_infobar;
|
||||
gui_infobar = ptr_infobar;
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
wee_log_printf (_("Not enough memory for infobar message\n"));
|
||||
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
if (window->buffer && (window->buffer->num_displayed > 0))
|
||||
window->buffer->num_displayed--;
|
||||
|
||||
/* remove window from windows list */
|
||||
if (window->prev_window)
|
||||
window->prev_window->next_window = window->next_window;
|
||||
if (window->next_window)
|
||||
window->next_window->prev_window = window->prev_window;
|
||||
if (gui_windows == window)
|
||||
gui_windows = window->next_window;
|
||||
if (last_gui_window == window)
|
||||
last_gui_window = window->prev_window;
|
||||
|
||||
free (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_infobar_remove: remove last displayed message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
gui_infobar_remove ()
|
||||
{
|
||||
t_gui_infobar *new_infobar;
|
||||
|
||||
if (gui_infobar)
|
||||
{
|
||||
new_infobar = gui_infobar->next_infobar;
|
||||
if (gui_infobar->text)
|
||||
free (gui_infobar->text);
|
||||
free (gui_infobar);
|
||||
gui_infobar = new_infobar;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_line_free: delete a line from a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_line_free (t_gui_line *line)
|
||||
{
|
||||
t_gui_message *ptr_message;
|
||||
|
||||
while (line->messages)
|
||||
{
|
||||
ptr_message = line->messages->next_message;
|
||||
if (line->messages->message)
|
||||
free (line->messages->message);
|
||||
free (line->messages);
|
||||
line->messages = ptr_message;
|
||||
}
|
||||
free (line);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_free: delete a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_gui_line *ptr_line;
|
||||
int create_new;
|
||||
|
||||
create_new = (buffer->server || buffer->channel);
|
||||
|
||||
hotlist_remove_buffer (buffer);
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
|
||||
if (buffer_before_dcc == buffer)
|
||||
buffer_before_dcc = NULL;
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if ((buffer == ptr_win->buffer) &&
|
||||
((buffer->next_buffer) || (buffer->prev_buffer)))
|
||||
gui_switch_to_previous_buffer (ptr_win);
|
||||
}
|
||||
}
|
||||
|
||||
/* decrease buffer number for all next buffers */
|
||||
for (ptr_buffer = buffer->next_buffer; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number--;
|
||||
}
|
||||
|
||||
/* free lines and messages */
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
|
||||
/* close log if opened */
|
||||
if (buffer->log_file)
|
||||
log_end (buffer);
|
||||
|
||||
if (buffer->input_buffer)
|
||||
free (buffer->input_buffer);
|
||||
|
||||
completion_free (&(buffer->completion));
|
||||
|
||||
history_buffer_free (buffer);
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
if (buffer->next_buffer)
|
||||
buffer->next_buffer->prev_buffer = buffer->prev_buffer;
|
||||
if (gui_buffers == buffer)
|
||||
gui_buffers = buffer->next_buffer;
|
||||
if (last_gui_buffer == buffer)
|
||||
last_gui_buffer = buffer->prev_buffer;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
ptr_win->buffer = NULL;
|
||||
}
|
||||
|
||||
free (buffer);
|
||||
|
||||
/* always at least one buffer */
|
||||
if (!gui_buffers && create_new && switch_to_another)
|
||||
(void) gui_buffer_new (gui_windows, NULL, NULL, 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a buffer
|
||||
*/
|
||||
|
||||
t_gui_line *
|
||||
gui_new_line (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *new_line, *ptr_line;
|
||||
|
||||
if ((new_line = (t_gui_line *) malloc (sizeof (struct t_gui_line))))
|
||||
{
|
||||
new_line->length = 0;
|
||||
new_line->length_align = 0;
|
||||
new_line->log_write = 1;
|
||||
new_line->line_with_message = 0;
|
||||
new_line->line_with_highlight = 0;
|
||||
new_line->messages = NULL;
|
||||
new_line->last_message = NULL;
|
||||
if (!buffer->lines)
|
||||
buffer->lines = new_line;
|
||||
else
|
||||
buffer->last_line->next_line = new_line;
|
||||
new_line->prev_line = buffer->last_line;
|
||||
new_line->next_line = NULL;
|
||||
buffer->last_line = new_line;
|
||||
buffer->num_lines++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("Not enough memory for new line\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove one line if necessary */
|
||||
if ((cfg_history_max_lines > 0)
|
||||
&& (buffer->num_lines > cfg_history_max_lines))
|
||||
{
|
||||
if (buffer->last_line == buffer->lines)
|
||||
buffer->last_line = NULL;
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
ptr_line->prev_line = NULL;
|
||||
buffer->num_lines--;
|
||||
//if (buffer->first_line_displayed)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
return new_line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_message: create a new message for last line of a buffer
|
||||
*/
|
||||
|
||||
t_gui_message *
|
||||
gui_new_message (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_message *new_message;
|
||||
|
||||
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
|
||||
{
|
||||
if (!buffer->last_line->messages)
|
||||
buffer->last_line->messages = new_message;
|
||||
else
|
||||
buffer->last_line->last_message->next_message = new_message;
|
||||
new_message->prev_message = buffer->last_line->last_message;
|
||||
new_message->next_message = NULL;
|
||||
buffer->last_line->last_message = new_message;
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("Not enough memory for new message\n"));
|
||||
return NULL;
|
||||
}
|
||||
return new_message;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_optimize_input_buffer_size: optimize input buffer size by adding
|
||||
* or deleting data block (predefined size)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_optimize_input_buffer_size (t_gui_buffer *buffer)
|
||||
{
|
||||
int optimal_size;
|
||||
|
||||
optimal_size = ((buffer->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||
INPUT_BUFFER_BLOCK_SIZE) + INPUT_BUFFER_BLOCK_SIZE;
|
||||
if (buffer->input_buffer_alloc != optimal_size)
|
||||
{
|
||||
buffer->input_buffer_alloc = optimal_size;
|
||||
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_delete_previous_word: delete previous word
|
||||
*/
|
||||
|
||||
void
|
||||
gui_delete_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i, j, num_char_deleted, num_char_end;
|
||||
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 0)
|
||||
i++;
|
||||
i++;
|
||||
num_char_deleted = buffer->input_buffer_pos - i;
|
||||
num_char_end = buffer->input_buffer_size -
|
||||
buffer->input_buffer_pos;
|
||||
|
||||
for (j = 0; j < num_char_end; j++)
|
||||
buffer->input_buffer[i + j] =
|
||||
buffer->input_buffer[buffer->input_buffer_pos + j];
|
||||
|
||||
buffer->input_buffer_size -= num_char_deleted;
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
buffer->input_buffer_pos = i;
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->completion.position = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_previous_word: move to beginning of previous word
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i < 0)
|
||||
buffer->input_buffer_pos = 0;
|
||||
else
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
buffer->input_buffer_pos = i + 1;
|
||||
}
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_next_word: move to the end of next
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_next_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (buffer->input_buffer_pos <
|
||||
buffer->input_buffer_size + 1)
|
||||
{
|
||||
i = buffer->input_buffer_pos;
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i++;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos = i - 1;
|
||||
else
|
||||
{
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i++;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos =
|
||||
buffer->input_buffer_size;
|
||||
else
|
||||
buffer->input_buffer_pos = i;
|
||||
|
||||
}
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_insert_string: insert a string into the input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_insert_string (t_gui_buffer *buffer, char *string, int pos)
|
||||
{
|
||||
int i, start, end, length;
|
||||
|
||||
length = strlen (string);
|
||||
|
||||
/* increase buffer size */
|
||||
buffer->input_buffer_size += length;
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
|
||||
/* move end of string to the right */
|
||||
start = pos + length;
|
||||
end = buffer->input_buffer_size - 1;
|
||||
for (i = end; i >= start; i--)
|
||||
buffer->input_buffer[i] =
|
||||
buffer->input_buffer[i - length];
|
||||
|
||||
/* insert new string */
|
||||
strncpy (buffer->input_buffer + pos, string, length);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_buffer_by_number: switch to another buffer with number
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_switch_to_buffer_by_number (t_gui_window *window, int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* buffer is currently displayed ? */
|
||||
if (number == window->buffer->number)
|
||||
return window->buffer;
|
||||
|
||||
/* search for buffer in the list */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number))
|
||||
{
|
||||
gui_switch_to_buffer (window, ptr_buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return ptr_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_buffer_by_number: switch to another buffer with number
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_buffer_to_number (t_gui_window *window, int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
int i;
|
||||
|
||||
/* buffer number is already ok ? */
|
||||
if (number == window->buffer->number)
|
||||
return;
|
||||
|
||||
if (number < 1)
|
||||
number = 1;
|
||||
|
||||
/* remove buffer from list */
|
||||
if (window->buffer == gui_buffers)
|
||||
{
|
||||
gui_buffers = window->buffer->next_buffer;
|
||||
gui_buffers->prev_buffer = NULL;
|
||||
}
|
||||
if (window->buffer == last_gui_buffer)
|
||||
{
|
||||
last_gui_buffer = window->buffer->prev_buffer;
|
||||
last_gui_buffer->next_buffer = NULL;
|
||||
}
|
||||
if (window->buffer->prev_buffer)
|
||||
(window->buffer->prev_buffer)->next_buffer = window->buffer->next_buffer;
|
||||
if (window->buffer->next_buffer)
|
||||
(window->buffer->next_buffer)->prev_buffer = window->buffer->prev_buffer;
|
||||
|
||||
if (number == 1)
|
||||
{
|
||||
gui_buffers->prev_buffer = window->buffer;
|
||||
window->buffer->prev_buffer = NULL;
|
||||
window->buffer->next_buffer = gui_buffers;
|
||||
gui_buffers = window->buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* assign new number to all buffers */
|
||||
i = 1;
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number = i++;
|
||||
}
|
||||
|
||||
/* search for new position in the list */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->number == number)
|
||||
break;
|
||||
}
|
||||
if (ptr_buffer)
|
||||
{
|
||||
/* insert before buffer found */
|
||||
window->buffer->prev_buffer = ptr_buffer->prev_buffer;
|
||||
window->buffer->next_buffer = ptr_buffer;
|
||||
if (ptr_buffer->prev_buffer)
|
||||
(ptr_buffer->prev_buffer)->next_buffer = window->buffer;
|
||||
ptr_buffer->prev_buffer = window->buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* number not found (too big)? => add to end */
|
||||
window->buffer->prev_buffer = last_gui_buffer;
|
||||
window->buffer->next_buffer = NULL;
|
||||
last_gui_buffer->next_buffer = window->buffer;
|
||||
last_gui_buffer = window->buffer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* assign new number to all buffers */
|
||||
i = 1;
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number = i++;
|
||||
}
|
||||
|
||||
gui_redraw_buffer (window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_print_log: print window infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_print_log (t_gui_window *window)
|
||||
{
|
||||
wee_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
wee_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
wee_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
wee_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
wee_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
wee_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
wee_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
wee_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
wee_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
wee_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
wee_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
wee_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
wee_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
wee_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
wee_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
wee_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
|
||||
wee_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
wee_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
wee_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
wee_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
wee_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
wee_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
wee_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
wee_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
wee_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
wee_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
wee_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
wee_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
wee_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
wee_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
wee_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
wee_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
wee_log_printf (" sub_lines . . . . . : %d\n", window->sub_lines);
|
||||
wee_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
wee_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_print_log: print buffer infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
int num;
|
||||
char buf[4096];
|
||||
|
||||
wee_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
wee_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
wee_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
wee_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
wee_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
wee_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
wee_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
wee_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
wee_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
wee_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
wee_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
wee_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
wee_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
wee_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
wee_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
wee_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
wee_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" => last 100 lines:\n");
|
||||
|
||||
num = 0;
|
||||
ptr_line = buffer->last_line;
|
||||
while (ptr_line && (num < 100))
|
||||
{
|
||||
num++;
|
||||
ptr_line = ptr_line->prev_line;
|
||||
}
|
||||
if (!ptr_line)
|
||||
ptr_line = buffer->lines;
|
||||
else
|
||||
ptr_line = ptr_line->next_line;
|
||||
|
||||
while (ptr_line)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
for (ptr_message = ptr_line->messages; ptr_message;
|
||||
ptr_message = ptr_message->next_message)
|
||||
{
|
||||
if (strlen (buf) + strlen (ptr_message->message) + 1 >= sizeof (buf))
|
||||
break;
|
||||
strcat (buf, ptr_message->message);
|
||||
}
|
||||
num--;
|
||||
wee_log_printf (" line N-%05d: %s\n", num, buf);
|
||||
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
}
|
||||
+228
-126
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -23,66 +21,82 @@
|
||||
#ifndef __WEECHAT_GUI_H
|
||||
#define __WEECHAT_GUI_H 1
|
||||
|
||||
#ifdef WEE_CURSES
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "../completion.h"
|
||||
#include "../history.h"
|
||||
|
||||
#ifdef WEE_CURSES
|
||||
#define KEY_ESCAPE 27
|
||||
#endif
|
||||
#include "../common/completion.h"
|
||||
#include "../common/history.h"
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 35
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_STATUS 11
|
||||
#define COLOR_WIN_STATUS_ACTIVE 12
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 13
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 14
|
||||
#define COLOR_WIN_STATUS_MORE 15
|
||||
#define COLOR_WIN_INPUT 16
|
||||
#define COLOR_WIN_INPUT_CHANNEL 17
|
||||
#define COLOR_WIN_INPUT_NICK 18
|
||||
#define COLOR_WIN_NICK 19
|
||||
#define COLOR_WIN_NICK_OP 20
|
||||
#define COLOR_WIN_NICK_HALFOP 21
|
||||
#define COLOR_WIN_NICK_VOICE 22
|
||||
#define COLOR_WIN_NICK_SEP 23
|
||||
#define COLOR_WIN_NICK_SELF 24
|
||||
#define COLOR_WIN_NICK_PRIVATE 25
|
||||
#define COLOR_WIN_NICK_FIRST 26
|
||||
#define COLOR_WIN_NICK_LAST 35
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define NUM_COLORS 50
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||
#define COLOR_WIN_STATUS 12
|
||||
#define COLOR_WIN_STATUS_DELIMITERS 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 15
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 16
|
||||
#define COLOR_WIN_STATUS_MORE 17
|
||||
#define COLOR_WIN_INFOBAR 18
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 19
|
||||
#define COLOR_WIN_INPUT 20
|
||||
#define COLOR_WIN_INPUT_CHANNEL 21
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_AWAY 24
|
||||
#define COLOR_WIN_NICK_CHANOWNER 25
|
||||
#define COLOR_WIN_NICK_CHANADMIN 26
|
||||
#define COLOR_WIN_NICK_OP 27
|
||||
#define COLOR_WIN_NICK_HALFOP 28
|
||||
#define COLOR_WIN_NICK_VOICE 29
|
||||
#define COLOR_WIN_NICK_MORE 30
|
||||
#define COLOR_WIN_NICK_SEP 31
|
||||
#define COLOR_WIN_NICK_SELF 32
|
||||
#define COLOR_WIN_NICK_PRIVATE 33
|
||||
#define COLOR_WIN_NICK_FIRST 34
|
||||
#define COLOR_WIN_NICK_LAST 43
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_SELECTED 44
|
||||
#define COLOR_DCC_WAITING 45
|
||||
#define COLOR_DCC_CONNECTING 46
|
||||
#define COLOR_DCC_ACTIVE 47
|
||||
#define COLOR_DCC_DONE 48
|
||||
#define COLOR_DCC_FAILED 49
|
||||
#define COLOR_DCC_ABORTED 50
|
||||
|
||||
#define SERVER(window) ((t_irc_server *)(window->server))
|
||||
#define CHANNEL(window) ((t_irc_channel *)(window->channel))
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define WIN_IS_SERVER(window) (SERVER(window) && !CHANNEL(window))
|
||||
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
|
||||
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
|
||||
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define MSG_TYPE_TIME 0
|
||||
#define MSG_TYPE_NICK 1
|
||||
#define MSG_TYPE_INFO 2
|
||||
#define MSG_TYPE_MSG 3
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_PREFIX 2
|
||||
#define MSG_TYPE_NICK 4
|
||||
#define MSG_TYPE_INFO 8
|
||||
#define MSG_TYPE_MSG 16
|
||||
#define MSG_TYPE_HIGHLIGHT 32
|
||||
#define MSG_TYPE_NOLOG 64
|
||||
|
||||
#define gui_printf_color(window, color, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
|
||||
#define gui_printf(window, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
#define gui_printf_type(buffer, type, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, type, -1, fmt, ##argz)
|
||||
|
||||
#define gui_printf(buffer, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog(buffer, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
@@ -101,7 +115,9 @@ struct t_gui_line
|
||||
{
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int log_write; /* = 1 if line will be written to log */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
int line_with_highlight; /* line contains highlight */
|
||||
t_gui_message *messages; /* messages for the line */
|
||||
t_gui_message *last_message; /* last message of the line */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
@@ -116,52 +132,46 @@ struct t_gui_color
|
||||
int color;
|
||||
};
|
||||
|
||||
typedef struct t_gui_window t_gui_window;
|
||||
typedef struct t_gui_infobar t_gui_infobar;
|
||||
|
||||
struct t_gui_window
|
||||
struct t_gui_infobar
|
||||
{
|
||||
int color; /* text color */
|
||||
char *text; /* infobar text */
|
||||
int remaining_time; /* delay (sec) before erasing this text */
|
||||
/* if < 0, text is never erased (except */
|
||||
/* by user action to erase it) */
|
||||
t_gui_infobar *next_infobar; /* next message for infobar */
|
||||
};
|
||||
|
||||
typedef struct t_gui_buffer t_gui_buffer;
|
||||
|
||||
struct t_gui_buffer
|
||||
{
|
||||
int num_displayed; /* number of windows displaying buffer */
|
||||
|
||||
int number; /* buffer number (for jump/switch) */
|
||||
|
||||
/* server/channel */
|
||||
void *server; /* window's server */
|
||||
void *channel; /* window's channel */
|
||||
|
||||
/* global position & size */
|
||||
int win_x, win_y; /* position of window */
|
||||
int win_width, win_height; /* window geometry */
|
||||
|
||||
/* chat window settings */
|
||||
int win_chat_x, win_chat_y; /* chat window position */
|
||||
int win_chat_width; /* width of chat window */
|
||||
int win_chat_height; /* height of chat window */
|
||||
int win_chat_cursor_x; /* position of cursor in chat window */
|
||||
int win_chat_cursor_y; /* position of cursor in chat window */
|
||||
|
||||
/* nicklist window settings */
|
||||
int win_nick_x, win_nick_y; /* chat window position */
|
||||
int win_nick_width; /* width of chat window */
|
||||
int win_nick_height; /* height of chat window */
|
||||
|
||||
/* windows */
|
||||
#ifdef WEE_CURSES
|
||||
WINDOW *win_title; /* title window */
|
||||
WINDOW *win_chat; /* chat window (exemple: channel) */
|
||||
WINDOW *win_nick; /* nick window */
|
||||
WINDOW *win_status; /* status window */
|
||||
WINDOW *win_input; /* input window */
|
||||
#endif
|
||||
#ifdef WEE_GTK
|
||||
/* TODO: declare Gtk+ window */
|
||||
#endif
|
||||
#ifdef WEE_QT
|
||||
/* TODO: declare Qt window */
|
||||
#endif
|
||||
void *server; /* buffer's server */
|
||||
void *channel; /* buffer's channel */
|
||||
int dcc; /* buffer is dcc status */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
int first_line_displayed; /* = 1 if first line is displayed */
|
||||
int sub_lines; /* if > 0 then do not display until end */
|
||||
int num_lines; /* number of lines in the window */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
int unread_data; /* highlight windows with unread data */
|
||||
|
||||
/* notify level: when activity should be displayed? default: 3 (always) */
|
||||
int notify_level; /* 0 = never */
|
||||
/* 1 = highlight only */
|
||||
/* 2 = highlight + message */
|
||||
/* 3 = highlight + message + join/part */
|
||||
|
||||
/* file to save buffer content */
|
||||
char *log_filename; /* filename for saving buffer content */
|
||||
FILE *log_file; /* for logging buffer to file */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
@@ -175,55 +185,147 @@ struct t_gui_window
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *last_history; /* last command in history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
int num_history; /* number of commands in history */
|
||||
|
||||
/* link to previous/next buffer */
|
||||
t_gui_buffer *prev_buffer; /* link to previous buffer */
|
||||
t_gui_buffer *next_buffer; /* link to next buffer */
|
||||
};
|
||||
|
||||
typedef struct t_gui_window t_gui_window;
|
||||
|
||||
struct t_gui_window
|
||||
{
|
||||
/* global position & size */
|
||||
int win_x, win_y; /* position of window */
|
||||
int win_width, win_height; /* window geometry */
|
||||
|
||||
/* chat window settings */
|
||||
int win_chat_x, win_chat_y; /* chat window position */
|
||||
int win_chat_width; /* width of chat window */
|
||||
int win_chat_height; /* height of chat window */
|
||||
int win_chat_cursor_x; /* position of cursor in chat window */
|
||||
int win_chat_cursor_y; /* position of cursor in chat window */
|
||||
|
||||
/* nicklist window settings */
|
||||
int win_nick_x, win_nick_y; /* nick window position */
|
||||
int win_nick_width; /* width of nick window */
|
||||
int win_nick_height; /* height of nick window */
|
||||
int win_nick_start; /* # of 1st nick for display (scroll) */
|
||||
|
||||
/* windows for Curses GUI */
|
||||
void *win_title; /* title window */
|
||||
void *win_chat; /* chat window (example: channel) */
|
||||
void *win_nick; /* nick window */
|
||||
void *win_status; /* status window */
|
||||
void *win_infobar; /* info bar window */
|
||||
void *win_input; /* input window */
|
||||
void *win_separator; /* separation between 2 splited (V) win */
|
||||
|
||||
/* windows for Gtk GUI */
|
||||
void *textview_chat; /* textview widget for chat */
|
||||
void *textbuffer_chat; /* textbuffer widget for chat */
|
||||
void *texttag_chat; /* texttag widget for chat */
|
||||
void *textview_nicklist; /* textview widget for nicklist */
|
||||
void *textbuffer_nicklist; /* textbuffer widget for nicklist */
|
||||
|
||||
/* windows for Qt GUI */
|
||||
/* TODO: declare Qt window */
|
||||
|
||||
/* DCC */
|
||||
void *dcc_first; /* first dcc displayed */
|
||||
void *dcc_selected; /* selected dcc */
|
||||
void *dcc_last_displayed; /* last dcc displayed (for scroll) */
|
||||
|
||||
t_gui_buffer *buffer; /* buffer currently displayed in window */
|
||||
|
||||
int first_line_displayed; /* = 1 if first line is displayed */
|
||||
int sub_lines; /* if > 0 then do not display until end */
|
||||
|
||||
/* link to next window */
|
||||
t_gui_window *prev_window; /* link to previous window */
|
||||
t_gui_window *next_window; /* link to next window */
|
||||
};
|
||||
|
||||
/* variables */
|
||||
|
||||
extern int gui_ready;
|
||||
extern int gui_init_ok;
|
||||
extern int gui_ok;
|
||||
extern int gui_add_hotlist;
|
||||
extern t_gui_window *gui_windows;
|
||||
extern t_gui_window *last_gui_window;
|
||||
extern t_gui_window *gui_current_window;
|
||||
extern t_gui_buffer *gui_buffers;
|
||||
extern t_gui_buffer *last_gui_buffer;
|
||||
extern t_gui_buffer *buffer_before_dcc;
|
||||
extern t_gui_infobar *gui_infobar;
|
||||
|
||||
/* prototypes */
|
||||
/* GUI independent functions */
|
||||
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_message *gui_new_message (t_gui_buffer *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
|
||||
extern void gui_delete_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
extern void gui_move_buffer_to_number (t_gui_window *, int);
|
||||
extern void gui_window_print_log (t_gui_window *);
|
||||
extern void gui_buffer_print_log (t_gui_buffer *);
|
||||
|
||||
/* GUI dependant functions */
|
||||
|
||||
extern int gui_assign_color (int *, char *);
|
||||
extern int gui_get_color_by_name (char *);
|
||||
extern char *gui_get_color_by_value (int);
|
||||
|
||||
extern void gui_draw_window_title (t_gui_window *);
|
||||
extern void gui_redraw_window_title (t_gui_window *);
|
||||
extern void gui_draw_window_chat (t_gui_window *);
|
||||
extern void gui_redraw_window_chat (t_gui_window *);
|
||||
extern void gui_draw_window_nick (t_gui_window *);
|
||||
extern void gui_redraw_window_nick (t_gui_window *);
|
||||
extern void gui_draw_window_status (t_gui_window *);
|
||||
extern void gui_redraw_window_status (t_gui_window *);
|
||||
extern void gui_draw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window (t_gui_window *);
|
||||
|
||||
extern void gui_window_clear (t_gui_window *);
|
||||
extern void gui_window_clear_all ();
|
||||
|
||||
extern void gui_switch_to_window (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window ();
|
||||
extern void gui_switch_to_next_window ();
|
||||
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
|
||||
extern int gui_buffer_has_nicklist (t_gui_buffer *);
|
||||
extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_status (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_input (t_gui_buffer *, int);
|
||||
extern void gui_redraw_buffer (t_gui_buffer *);
|
||||
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_get_dcc_buffer ();
|
||||
extern void gui_switch_to_dcc_buffer ();
|
||||
extern void gui_switch_to_previous_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window (t_gui_window *);
|
||||
extern void gui_switch_to_next_window (t_gui_window *);
|
||||
extern void gui_move_page_up (t_gui_window *);
|
||||
extern void gui_move_page_down (t_gui_window *);
|
||||
extern void gui_nick_move_beginning (t_gui_window *);
|
||||
extern void gui_nick_move_end (t_gui_window *);
|
||||
extern void gui_nick_move_page_up (t_gui_window *);
|
||||
extern void gui_nick_move_page_down (t_gui_window *);
|
||||
extern void gui_curses_resize_handler ();
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
extern int gui_window_merge_up (t_gui_window *);
|
||||
extern int gui_window_merge_down (t_gui_window *);
|
||||
extern int gui_window_merge_left (t_gui_window *);
|
||||
extern int gui_window_merge_right (t_gui_window *);
|
||||
extern void gui_window_merge_auto (t_gui_window *);
|
||||
extern void gui_window_merge_all (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
/* TODO: add coordinates and size */
|
||||
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
|
||||
extern void gui_display_nick (t_gui_window *, void *, int, int, int, int);
|
||||
|
||||
extern void gui_printf_type_color (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* gui-text.c: text GUI - display functions */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "gui-text.h"
|
||||
#include "command.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_init: init GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_init_irc_window: allocates a window for a channel or server
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init_irc_window (t_irc_window * window)
|
||||
{
|
||||
/* no window in text GUI */
|
||||
window->text = NULL;
|
||||
window->window = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_free_irc_window: free a GUI window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_free_irc_window (t_irc_window * window)
|
||||
{
|
||||
/* no window in text GUI */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_end: GUI end
|
||||
*/
|
||||
|
||||
void
|
||||
gui_end ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* read_keyb: read keyboard line
|
||||
*/
|
||||
|
||||
void
|
||||
read_keyb ()
|
||||
{
|
||||
int num_read;
|
||||
static char buffer[4096];
|
||||
static int pos_buffer = 0;
|
||||
char buffer_tmp[1024];
|
||||
int pos_buffer_tmp;
|
||||
|
||||
num_read = read (STDIN_FILENO, buffer_tmp, sizeof (buffer_tmp) - 1);
|
||||
pos_buffer_tmp = 0;
|
||||
while (pos_buffer_tmp < num_read)
|
||||
{
|
||||
switch (buffer_tmp[pos_buffer_tmp])
|
||||
{
|
||||
case '\r':
|
||||
break;
|
||||
case '\n':
|
||||
buffer[pos_buffer] = '\0';
|
||||
pos_buffer = 0;
|
||||
user_command (buffer);
|
||||
break;
|
||||
default:
|
||||
buffer[pos_buffer] = buffer_tmp[pos_buffer_tmp];
|
||||
if (pos_buffer < (int) (sizeof (buffer) - 2))
|
||||
pos_buffer++;
|
||||
}
|
||||
pos_buffer_tmp++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with text GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_loop ()
|
||||
{
|
||||
struct timeval timeout;
|
||||
fd_set read_fd;
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
quit_weechat = 0;
|
||||
while (!quit_weechat)
|
||||
{
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 10000;
|
||||
FD_ZERO (&read_fd);
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
}
|
||||
select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout);
|
||||
if (FD_ISSET (STDIN_FILENO, &read_fd))
|
||||
{
|
||||
read_keyb ();
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (FD_ISSET (ptr_server->sock4, &read_fd))
|
||||
recv_from_server (ptr_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_display_message: display a message on the screen
|
||||
*/
|
||||
|
||||
void
|
||||
gui_display_message (char *message)
|
||||
{
|
||||
printf ("%s\n", message);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
bin_PROGRAMS = weechat-wxwidgets
|
||||
|
||||
weechat_wxwidgets_LDADD = ../lib_weechat_gui_common.a \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(WXWIDGETS_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_wxwidgets_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -19,8 +17,4 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_GUI_GTK_H
|
||||
#define __WEECHAT_GUI_GTK_H 1
|
||||
|
||||
#endif /* gui-gtk.h */
|
||||
/* gui-display.c: display functions for wxWidgets GUI */
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -19,8 +17,4 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_GUI_GTK_H
|
||||
#define __WEECHAT_GUI_GTK_H 1
|
||||
|
||||
#endif /* gui-gtk.h */
|
||||
/* gui-input: user input functions for wxWidgets GUI */
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* history_add: add a text/command to history
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *window, char *string)
|
||||
{
|
||||
t_history *new_history;
|
||||
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
|
||||
/* add history to general history */
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
new_history->next_history = history_general;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
|
||||
/* add history to local history */
|
||||
if (((t_gui_window *)(window))->history)
|
||||
((t_gui_window *)(window))->history->prev_history = new_history;
|
||||
new_history->next_history = ((t_gui_window *)(window))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_window *)window)->history = new_history;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
|
||||
OUTPUT=irc.a
|
||||
OBJS=irc-commands.o irc-display.o irc-server.o irc-channel.o irc-nick.o
|
||||
DEFINES=WEE_CURSES
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
|
||||
irc-channel.o: irc-channel.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h
|
||||
irc-commands.o: irc-commands.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h ../command.h ../irc/irc.h ../config.h
|
||||
irc-display.o: irc-display.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h
|
||||
irc-nick.o: irc-nick.c ../weechat.h irc.h ../gui/gui.h ../completion.h \
|
||||
../history.h
|
||||
irc-server.o: irc-server.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h
|
||||
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_irc.a
|
||||
|
||||
lib_weechat_irc_a_SOURCES = irc.h \
|
||||
irc-commands.c \
|
||||
irc-send.c \
|
||||
irc-recv.c \
|
||||
irc-server.c \
|
||||
irc-channel.c \
|
||||
irc-nick.c \
|
||||
irc-dcc.c \
|
||||
irc-display.c
|
||||
+145
-13
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -19,18 +17,22 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-channel.c: manages a chat (channel or private chat) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
t_irc_channel *current_channel = NULL;
|
||||
char *channel_modes = "iklmnst";
|
||||
|
||||
|
||||
/*
|
||||
@@ -38,13 +40,10 @@ t_irc_channel *current_channel = NULL;
|
||||
*/
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
#if DEBUG >= 1
|
||||
log_printf ("joining channel %s\n", channel_name);
|
||||
#endif
|
||||
|
||||
/* alloc memory for new channel */
|
||||
if ((new_channel = (t_irc_channel *) malloc (sizeof (t_irc_channel))) == NULL)
|
||||
@@ -55,8 +54,15 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
|
||||
/* initialize new channel */
|
||||
new_channel->type = channel_type;
|
||||
new_channel->dcc_chat = NULL;
|
||||
new_channel->name = strdup (channel_name);
|
||||
new_channel->topic = NULL;
|
||||
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks_count = 0;
|
||||
new_channel->checking_away = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
@@ -69,7 +75,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
server->channels = new_channel;
|
||||
server->last_channel = new_channel;
|
||||
|
||||
gui_window_new (server, new_channel);
|
||||
gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
@@ -98,6 +104,14 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
|
||||
if (channel->next_channel)
|
||||
(channel->next_channel)->prev_channel = channel->prev_channel;
|
||||
|
||||
/* close DCC CHAT */
|
||||
if ((t_irc_dcc *)(channel->dcc_chat) &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
|
||||
{
|
||||
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (channel->name)
|
||||
free (channel->name);
|
||||
@@ -151,3 +165,121 @@ string_is_channel (char *string)
|
||||
first_char[1] = '\0';
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_away (t_irc_channel *channel)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
ptr_nick->is_away = 0;
|
||||
}
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_check_away: check for away on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
channel->checking_away++;
|
||||
server_sendf (server, "WHO %s\r\n", channel->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
ptr_nick = nick_search (channel, nick);
|
||||
if (ptr_nick)
|
||||
nick_set_away (channel, ptr_nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_create_dcc: create DCC CHAT channel
|
||||
*/
|
||||
|
||||
int
|
||||
channel_create_dcc (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
ptr_channel = channel_search (ptr_dcc->server, ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHAT_PRIVATE,
|
||||
ptr_dcc->nick, 0);
|
||||
if (!ptr_channel)
|
||||
return 0;
|
||||
|
||||
if (ptr_channel->dcc_chat &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
|
||||
return 0;
|
||||
|
||||
ptr_channel->dcc_chat = ptr_dcc;
|
||||
ptr_dcc->channel = ptr_channel;
|
||||
gui_redraw_buffer (ptr_channel->buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_dcc: remove a DCC CHAT
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_dcc (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = ptr_dcc->server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if ((t_irc_dcc *)(ptr_channel->dcc_chat) == ptr_dcc)
|
||||
{
|
||||
ptr_channel->dcc_chat = NULL;
|
||||
gui_redraw_buffer (ptr_channel->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_print_log: print channel infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
channel_print_log (t_irc_channel *channel)
|
||||
{
|
||||
wee_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
wee_log_printf (" type . . . . : %d\n", channel->type);
|
||||
wee_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
wee_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
wee_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
wee_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
wee_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
wee_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
wee_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
wee_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
wee_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
wee_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
wee_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
}
|
||||
|
||||
+177
-2793
File diff suppressed because it is too large
Load Diff
+1059
File diff suppressed because it is too large
Load Diff
+130
-52
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -19,18 +17,21 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-display.c: display functions for IRC */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../config.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@@ -40,65 +41,81 @@
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
int type;
|
||||
|
||||
type = MSG_TYPE_INFO | MSG_TYPE_PREFIX;
|
||||
|
||||
if (!cfg_log_plugin_msg && (prefix == PREFIX_PLUGIN))
|
||||
type |= MSG_TYPE_NOLOG;
|
||||
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_nick: display nick in chat window
|
||||
* if color_nick < 0 then nick is highlighted
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (window,
|
||||
if (nick->is_chanowner)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "~");
|
||||
else if (nick->is_chanadmin)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "&");
|
||||
else if (nick->is_op)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
else if (nick->is_halfop)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else if (nick->has_voice)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (window,
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else
|
||||
{
|
||||
if (nick->has_voice)
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
}
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT,
|
||||
"%s", nick->nick);
|
||||
if (color_nick < 0)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
else
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT,
|
||||
"%s", nick->nick);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
}
|
||||
|
||||
@@ -107,21 +124,82 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_mode (t_gui_window *window, char *channel_name, char set_flag,
|
||||
irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
char *symbol, char *nick_host, char *message, char *param)
|
||||
{
|
||||
irc_display_prefix (window, PREFIX_INFO);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
irc_display_prefix (buffer, PREFIX_INFO);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
if (param)
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s\n", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_server: display server description
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
}
|
||||
|
||||
+96
-38
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -19,15 +17,18 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-nick.c: manages nick list for channels */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
@@ -36,34 +37,38 @@
|
||||
*/
|
||||
|
||||
int
|
||||
nick_find_color (t_irc_channel *channel)
|
||||
nick_find_color (t_irc_nick *nick)
|
||||
{
|
||||
int i, color_less_used, min_used;
|
||||
int count_used[COLOR_WIN_NICK_NUMBER];
|
||||
t_irc_nick *ptr_nick;
|
||||
int i, color;
|
||||
|
||||
/* initialize array for counting usage of color */
|
||||
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
|
||||
count_used[i] = 0;
|
||||
|
||||
/* summarize each color usage */
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
count_used[ptr_nick->color - COLOR_WIN_NICK_FIRST]++;
|
||||
|
||||
/* look for color less used on channel */
|
||||
color_less_used = -1;
|
||||
min_used = INT_MAX;
|
||||
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
|
||||
color = 0;
|
||||
for (i = strlen (nick->nick) - 1; i >= 0; i--)
|
||||
{
|
||||
if (count_used[i] < min_used)
|
||||
{
|
||||
color_less_used = i;
|
||||
min_used = count_used[i];
|
||||
}
|
||||
color += (int)(nick->nick[i]);
|
||||
}
|
||||
color = (color % COLOR_WIN_NICK_NUMBER);
|
||||
|
||||
return (color_less_used < 0) ?
|
||||
COLOR_WIN_NICK_FIRST : COLOR_WIN_NICK_FIRST + color_less_used;
|
||||
return COLOR_WIN_NICK_FIRST + color;
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_score_for_sort: return score for sorting nick, according to privileges
|
||||
*/
|
||||
|
||||
int
|
||||
nick_score_for_sort (t_irc_nick *nick)
|
||||
{
|
||||
if (nick->is_chanowner)
|
||||
return -32;
|
||||
if (nick->is_chanadmin)
|
||||
return -16;
|
||||
if (nick->is_op)
|
||||
return -8;
|
||||
if (nick->is_halfop)
|
||||
return -4;
|
||||
if (nick->has_voice)
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -79,8 +84,8 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
{
|
||||
int score1, score2, comp;
|
||||
|
||||
score1 = - ( (nick1->is_op * 3) + (nick1->is_halfop * 2) + nick1->has_voice );
|
||||
score2 = - ( (nick2->is_op * 3) + (nick2->is_halfop * 2) + nick2->has_voice );
|
||||
score1 = nick_score_for_sort (nick1);
|
||||
score2 = nick_score_for_sort (nick2);
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
@@ -164,7 +169,8 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick)
|
||||
|
||||
t_irc_nick *
|
||||
nick_new (t_irc_channel *channel, char *nick_name,
|
||||
int is_op, int is_halfop, int has_voice)
|
||||
int is_chanowner, int is_chanadmin, int is_op, int is_halfop,
|
||||
int has_voice)
|
||||
{
|
||||
t_irc_nick *new_nick;
|
||||
|
||||
@@ -172,6 +178,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
if ((new_nick = nick_search (channel, nick_name)))
|
||||
{
|
||||
/* update nick */
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
@@ -181,23 +189,28 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
/* alloc memory for new nick */
|
||||
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
|
||||
{
|
||||
gui_printf (channel->window,
|
||||
gui_printf (channel->buffer,
|
||||
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->window)->nick) == 0)
|
||||
new_nick->is_away = 0;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
new_nick->color = nick_find_color (channel);
|
||||
new_nick->color = nick_find_color (new_nick);
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
channel->nicks_count++;
|
||||
|
||||
/* all is ok, return address of new nick */
|
||||
return new_nick;
|
||||
}
|
||||
@@ -230,10 +243,18 @@ nick_resort (t_irc_channel *channel, t_irc_nick *nick)
|
||||
void
|
||||
nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick)
|
||||
{
|
||||
int nick_is_me;
|
||||
|
||||
nick_is_me = (strcmp (nick->nick, SERVER(channel->buffer)->nick) == 0) ? 1 : 0;
|
||||
|
||||
/* change nickname */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
nick->nick = strdup (new_nick);
|
||||
if (nick_is_me)
|
||||
nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
nick->color = nick_find_color (nick);
|
||||
|
||||
/* insert again nick into sorted list */
|
||||
nick_resort (channel, nick);
|
||||
@@ -262,6 +283,8 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick)
|
||||
if (nick->next_nick)
|
||||
(nick->next_nick)->prev_nick = nick->prev_nick;
|
||||
|
||||
channel->nicks_count--;
|
||||
|
||||
/* free data */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
@@ -279,6 +302,9 @@ nick_free_all (t_irc_channel *channel)
|
||||
/* remove all nicks for the channel */
|
||||
while (channel->nicks)
|
||||
nick_free (channel, channel->nicks);
|
||||
|
||||
/* sould be zero, but prevent any bug :D */
|
||||
channel->nicks_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -318,7 +344,7 @@ nick_count (t_irc_channel *channel, int *total, int *count_op,
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
(*total)++;
|
||||
if (ptr_nick->is_op)
|
||||
if ((ptr_nick->is_chanowner) || (ptr_nick->is_chanadmin) || (ptr_nick->is_op))
|
||||
(*count_op)++;
|
||||
else
|
||||
{
|
||||
@@ -346,8 +372,7 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
max_length = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
length = strlen (ptr_nick->nick);
|
||||
if (length > max_length)
|
||||
@@ -355,3 +380,36 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
}
|
||||
return max_length;
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (nick->is_away != is_away)
|
||||
{
|
||||
nick->is_away = is_away;
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_print_log: print nick infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
wee_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
wee_log_printf (" is_chanowner . : %d\n", nick->is_chanowner);
|
||||
wee_log_printf (" is_chanadmin . : %d\n", nick->is_chanadmin);
|
||||
wee_log_printf (" is_op. . . . . : %d\n", nick->is_op);
|
||||
wee_log_printf (" is_halfop. . . : %d\n", nick->is_halfop);
|
||||
wee_log_printf (" has_voice. . . : %d\n", nick->has_voice);
|
||||
wee_log_printf (" is_away. . . . : %d\n", nick->is_away);
|
||||
wee_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
wee_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
wee_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
}
|
||||
|
||||
+3660
File diff suppressed because it is too large
Load Diff
+1743
File diff suppressed because it is too large
Load Diff
+808
-245
File diff suppressed because it is too large
Load Diff
+216
-29
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 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
|
||||
@@ -23,8 +21,13 @@
|
||||
#ifndef __WEECHAT_IRC_H
|
||||
#define __WEECHAT_IRC_H 1
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
|
||||
#define PREFIX_SERVER "-@-"
|
||||
#define PREFIX_INFO "-=-"
|
||||
#define PREFIX_ACTION_ME "-*-"
|
||||
@@ -32,9 +35,50 @@
|
||||
#define PREFIX_PART "<--"
|
||||
#define PREFIX_QUIT "<--"
|
||||
#define PREFIX_ERROR "=!="
|
||||
#define PREFIX_PLUGIN "-P-"
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
/* channel modes */
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
#define CHANNEL_MODE_KEY 1
|
||||
#define CHANNEL_MODE_LIMIT 2
|
||||
#define CHANNEL_MODE_MODERATED 3
|
||||
#define CHANNEL_MODE_NO_MSG_OUT 4
|
||||
#define CHANNEL_MODE_SECRET 5
|
||||
#define CHANNEL_MODE_TOPIC 6
|
||||
#define SET_CHANNEL_MODE(channel, set, mode) \
|
||||
if (set) \
|
||||
channel->modes[mode] = channel_modes[mode]; \
|
||||
else \
|
||||
channel->modes[mode] = ' ';
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* DCC types & status */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
@@ -42,10 +86,13 @@ typedef struct t_irc_nick t_irc_nick;
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int is_chanowner; /* chan owner? (specific to unrealircd) */
|
||||
int is_chanadmin; /* chan admin? (specific to unrealircd) */
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operaor privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
int color; /* color for nickname */
|
||||
int is_away; /* = 1 if nick is away, otherwise 0 */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
@@ -61,11 +108,17 @@ typedef struct t_irc_channel t_irc_channel;
|
||||
struct t_irc_channel
|
||||
{
|
||||
int type; /* channel type */
|
||||
void *dcc_chat; /* DCC CHAT pointer (NULL if not DCC) */
|
||||
char *name; /* name of channel (exemple: "#abc") */
|
||||
char *topic; /* topic of channel (host for private) */
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
int nicks_count; /* # nicks on channel (0 if dcc/pv) */
|
||||
int checking_away; /* = 1 if checking away with WHO cmd */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_window *window; /* GUI window allocated for channel */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for channel */
|
||||
t_irc_channel *prev_channel; /* link to previous channel */
|
||||
t_irc_channel *next_channel; /* link to next channel */
|
||||
};
|
||||
@@ -78,6 +131,10 @@ struct t_irc_server
|
||||
{
|
||||
/* user choices */
|
||||
char *name; /* name of server (only for display) */
|
||||
int autoconnect; /* = 1 if auto connect at startup */
|
||||
int autoreconnect; /* = 1 if auto reco when disconnected */
|
||||
int autoreconnect_delay; /* delay before trying again reconnect */
|
||||
int command_line; /* server was given on command line */
|
||||
char *address; /* address of server (IP or name) */
|
||||
int port; /* port for server (6667 by default) */
|
||||
char *password; /* password for server */
|
||||
@@ -86,15 +143,27 @@ struct t_irc_server
|
||||
char *nick3; /* 2nd alternate nickname */
|
||||
char *username; /* user name */
|
||||
char *realname; /* real name */
|
||||
char *command; /* command to run once connected */
|
||||
int command_delay; /* delay after execution of command */
|
||||
char *autojoin; /* channels to automatically join */
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
|
||||
/* internal vars */
|
||||
char *nick; /* current nickname */
|
||||
pid_t child_pid; /* pid of child process (connecting) */
|
||||
int child_read; /* to read into child pipe */
|
||||
int child_write; /* to write into child pipe */
|
||||
int sock; /* socket for server */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
int sock4; /* socket for server */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
int reconnect_join; /* 1 if channels opened to rejoin */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
t_gui_window *window; /* GUI window allocated for server */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int lag; /* lag (in milliseconds) */
|
||||
struct timeval lag_check_time; /* last time lag was checked (ping sent)*/
|
||||
time_t lag_next_check; /* time for next check */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
t_irc_server *prev_server; /* link to previous server */
|
||||
@@ -121,6 +190,8 @@ struct t_irc_command
|
||||
/* function called when cmd is received */
|
||||
};
|
||||
|
||||
/* irc messages */
|
||||
|
||||
typedef struct t_irc_message t_irc_message;
|
||||
|
||||
struct t_irc_message
|
||||
@@ -130,39 +201,90 @@ struct t_irc_message
|
||||
t_irc_message *next_message; /* link to next message */
|
||||
};
|
||||
|
||||
/* DCC */
|
||||
|
||||
typedef struct t_irc_dcc t_irc_dcc;
|
||||
|
||||
struct t_irc_dcc
|
||||
{
|
||||
t_irc_server *server; /* irc server */
|
||||
t_irc_channel *channel; /* irc channel (for DCC chat only) */
|
||||
int type; /* DCC type (send or receive) */
|
||||
int status; /* DCC status (waiting, sending, ..) */
|
||||
time_t start_time; /* the time when DCC started */
|
||||
time_t start_transfer; /* the time when DCC transfer started */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
int sock; /* socket for connection */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
int file; /* local file (for reading or writing) */
|
||||
char *filename; /* filename (given by sender) */
|
||||
char *local_filename; /* local filename (with path) */
|
||||
int filename_suffix; /* suffix (.1 for ex) if renaming file */
|
||||
unsigned long size; /* file size */
|
||||
unsigned long pos; /* number of bytes received/sent */
|
||||
unsigned long ack; /* number of bytes received OK */
|
||||
time_t last_check_time; /* last time we looked at bytes sent/rcv*/
|
||||
unsigned long last_check_pos; /* bytes sent/recv at last check */
|
||||
unsigned long bytes_per_sec; /* bytes per second */
|
||||
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers, *current_irc_server;
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern t_irc_channel *current_channel;
|
||||
extern int check_away;
|
||||
extern t_irc_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
extern void server_init (t_irc_server *);
|
||||
extern int server_init_with_url (char *, t_irc_server *);
|
||||
extern t_irc_server *server_alloc ();
|
||||
extern void server_create_window (t_irc_server *);
|
||||
extern void server_destroy (t_irc_server *);
|
||||
extern void server_free (t_irc_server *);
|
||||
extern void server_free_all ();
|
||||
extern t_irc_server *server_new (char *, char *, int, char *, char *, char *,
|
||||
char *, char *, char *);
|
||||
extern t_irc_server *server_new (char *, int, int, int, int, char *, int, char *,
|
||||
char *, char *, char *, char *, char *, char *,
|
||||
int, char *, int);
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern int server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_recv (t_irc_server *);
|
||||
extern int server_connect ();
|
||||
extern void server_disconnect (t_irc_server *);
|
||||
extern void server_child_read (t_irc_server *);
|
||||
extern int server_connect (t_irc_server *);
|
||||
extern void server_reconnect (t_irc_server *);
|
||||
extern void server_auto_connect (int);
|
||||
extern void server_disconnect (t_irc_server *, int);
|
||||
extern void server_disconnect_all ();
|
||||
extern t_irc_server *server_search (char *);
|
||||
extern int server_get_number_connected ();
|
||||
extern int server_name_already_exists (char *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
extern void server_print_log (t_irc_server *);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *);
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *, int);
|
||||
extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
extern int string_is_channel (char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
extern void channel_print_log (t_irc_channel *);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int);
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int, int, int);
|
||||
extern void nick_resort (t_irc_channel *, t_irc_nick *);
|
||||
extern void nick_change (t_irc_channel *, t_irc_nick *, char *);
|
||||
extern void nick_free (t_irc_channel *, t_irc_nick *);
|
||||
@@ -170,47 +292,95 @@ extern void nick_free_all (t_irc_channel *);
|
||||
extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
extern void nick_set_away (t_irc_channel *, t_irc_nick *, int);
|
||||
extern void nick_print_log (t_irc_nick *);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_redraw (int);
|
||||
extern void dcc_free (t_irc_dcc *);
|
||||
extern void dcc_close (t_irc_dcc *, int);
|
||||
extern void dcc_accept (t_irc_dcc *);
|
||||
extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
|
||||
char *, char *, unsigned long);
|
||||
extern void dcc_send_request (t_irc_server *, int, char *, char *);
|
||||
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
|
||||
extern void dcc_handle ();
|
||||
extern void dcc_end ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (t_gui_window *, char *);
|
||||
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||
extern void irc_login (t_irc_server *);
|
||||
/* IRC commands issued by user */
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_away (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dcc (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dehalfop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_halfop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_info (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_ison (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_join (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kick (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kickban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kill (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_links (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_list (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_lusers (t_irc_server *, char *);
|
||||
extern int irc_send_me (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int irc_send_me_all_channels (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_me (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_mode (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_motd (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_msg (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_names (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_nick (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_notice (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_op (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_oper (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_oper (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_part (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ping (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_pong (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_ping (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_pong (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_query (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_quit (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_quote (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_rehash (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_restart (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_service (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_servlist (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_squery (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_squit (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_stats (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_summon (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_time (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_topic (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_trace (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_unban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_userhost (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_users (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_version (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_voice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_wallops (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_who (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whowas (t_irc_server *, char *);
|
||||
/* IRC commands executed when received from server */
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_invite (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_kick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_mode (t_irc_server *, char *, char *);
|
||||
@@ -218,6 +388,7 @@ extern int irc_cmd_recv_nick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *);
|
||||
@@ -226,9 +397,16 @@ extern int irc_cmd_recv_topic (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_305 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_306 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_307 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_314 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_315 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *);
|
||||
@@ -236,12 +414,21 @@ extern int irc_cmd_recv_320 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_341 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_365 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_367 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_368 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_438 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_671 (t_irc_server *, char *, char *);
|
||||
|
||||
#endif /* irc.h */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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
|
||||
@@ -15,23 +15,24 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
endif
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_GTK
|
||||
if PLUGIN_PYTHON
|
||||
python_dir = python
|
||||
endif
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
# if PLUGIN_RUBY
|
||||
# ruby_dir = ruby
|
||||
# endif
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
|
||||
SUBDIRS = $(perl_dir) $(python_dir)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
noinst_LIBRARIES = lib_weechat_plugins.a
|
||||
|
||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../config.h \
|
||||
../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
||||
lib_weechat_plugins_a_SOURCES = plugins.h \
|
||||
plugins.c
|
||||
+4
-2
@@ -2,8 +2,10 @@ WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
This is plugins directory for WeeChat.
|
||||
In the future, you'll find there interfaces with many famous languages for
|
||||
|
||||
Today, Perl interface is developed.
|
||||
|
||||
In the future, you'll find there interfaces with other famous languages for
|
||||
writing extensions to WeeChat:
|
||||
- Perl interface,
|
||||
- Python interface,
|
||||
- Ruby interface.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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
|
||||
@@ -15,17 +15,9 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
OUTPUT=weechat
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PERL_CFLAGS)
|
||||
|
||||
all:
|
||||
cd src && make
|
||||
noinst_LIBRARIES = lib_weechat_perl.a
|
||||
|
||||
install:
|
||||
@mkdir -v -p $(DESTDIR)/usr/$(LOCALRPM)/bin
|
||||
@cp -v src/$(OUTPUT) $(DESTDIR)/usr/$(LOCALRPM)/bin/
|
||||
@mkdir -v -p $(DESTDIR)/usr/share/man/man1
|
||||
@cp -v weechat.1 $(DESTDIR)/usr/share/man/man1/
|
||||
@echo -e "\n=== WeeChat installed!\n"
|
||||
|
||||
clean:
|
||||
cd src && make clean
|
||||
lib_weechat_perl_a_SOURCES = wee-perl.h \
|
||||
wee-perl.c
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_PERL_H
|
||||
#define __WEECHAT_PERL_H 1
|
||||
|
||||
#include "../plugins.h"
|
||||
|
||||
extern void wee_perl_init ();
|
||||
extern t_plugin_script *wee_perl_search (char *);
|
||||
extern int wee_perl_exec (char *, char *, char *);
|
||||
extern int wee_perl_load (char *);
|
||||
extern void wee_perl_unload (t_plugin_script *);
|
||||
extern void wee_perl_unload_all ();
|
||||
extern void wee_perl_end ();
|
||||
|
||||
#endif /* wee-perl.h */
|
||||
@@ -0,0 +1,491 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* plugins.c: manages WeeChat plugins (Perl and/or Python and/or Ruby) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
#include "perl/wee-perl.h"
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
#include "python/wee-python.h"
|
||||
#endif
|
||||
|
||||
|
||||
char *plugin_name[3] = { "Perl", "Python", "Ruby" };
|
||||
|
||||
t_plugin_handler *plugin_msg_handlers = NULL;
|
||||
t_plugin_handler *last_plugin_msg_handler = NULL;
|
||||
|
||||
t_plugin_handler *plugin_cmd_handlers = NULL;
|
||||
t_plugin_handler *last_plugin_cmd_handler = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* plugin_auto_load: auto-load all scripts in a directory
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_auto_load (int plugin_type, char *directory)
|
||||
{
|
||||
int dir_length;
|
||||
char *dir_name, *current_dir;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
struct stat statbuf;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_length = strlen (weechat_home) + strlen (directory) + 2;
|
||||
dir_name =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||
|
||||
/* save working directory */
|
||||
current_dir = (char *) malloc (1024 * sizeof (char));
|
||||
if (!getcwd (current_dir, 1024 - 1))
|
||||
{
|
||||
free (current_dir);
|
||||
current_dir = NULL;
|
||||
}
|
||||
|
||||
/* browse autoload directory */
|
||||
dir = opendir (dir_name);
|
||||
chdir (dir_name);
|
||||
if (dir)
|
||||
{
|
||||
while ((entry = readdir (dir)))
|
||||
{
|
||||
lstat (entry->d_name, &statbuf);
|
||||
if (! S_ISDIR(statbuf.st_mode))
|
||||
{
|
||||
wee_log_printf (_("Auto-loading %s script: %s%s%s\n"),
|
||||
plugin_name[plugin_type],
|
||||
dir_name, DIR_SEPARATOR, entry->d_name);
|
||||
plugin_load (plugin_type, entry->d_name);
|
||||
}
|
||||
}
|
||||
closedir (dir);
|
||||
}
|
||||
|
||||
/* restore working directory */
|
||||
if (current_dir)
|
||||
{
|
||||
chdir (current_dir);
|
||||
free (current_dir);
|
||||
}
|
||||
free (dir_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_init: initialize all plugins
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_init ()
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_init();
|
||||
plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
wee_python_init();
|
||||
plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_load: load a plugin
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_load (int plugin_type, char *filename)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_load (filename);
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
#ifdef PLUGIN_PYTHON
|
||||
wee_python_load (filename);
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
(void) filename;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_search: look for message/command handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
plugin_handler_search (t_plugin_handler *plugin_handlers, char *name)
|
||||
{
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
for (ptr_plugin_handler = plugin_handlers; ptr_plugin_handler;
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||
{
|
||||
/* handler found */
|
||||
if (strcasecmp (ptr_plugin_handler->name, name) == 0)
|
||||
return ptr_plugin_handler;
|
||||
}
|
||||
/* handler not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_add: add a message/command handler
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_add (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler,
|
||||
int plugin_type, char *name, char *function)
|
||||
{
|
||||
t_plugin_handler *new_plugin_handler;
|
||||
|
||||
new_plugin_handler = (t_plugin_handler *)malloc (sizeof (t_plugin_handler));
|
||||
if (new_plugin_handler)
|
||||
{
|
||||
new_plugin_handler->plugin_type = plugin_type;
|
||||
new_plugin_handler->name = strdup (name);
|
||||
new_plugin_handler->function_name = strdup (function);
|
||||
new_plugin_handler->running = 0;
|
||||
|
||||
/* add new handler to list */
|
||||
new_plugin_handler->prev_handler = *last_plugin_handler;
|
||||
new_plugin_handler->next_handler = NULL;
|
||||
if (*plugin_handlers)
|
||||
(*last_plugin_handler)->next_handler = new_plugin_handler;
|
||||
else
|
||||
*plugin_handlers = new_plugin_handler;
|
||||
*last_plugin_handler = new_plugin_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to add handler for \"%s\" message (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_free: free message/command handler
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_free (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler,
|
||||
t_plugin_handler *ptr_plugin_handler)
|
||||
{
|
||||
t_plugin_handler *new_plugin_handlers;
|
||||
|
||||
/* remove handler from list */
|
||||
if (*last_plugin_handler == ptr_plugin_handler)
|
||||
*last_plugin_handler = ptr_plugin_handler->prev_handler;
|
||||
if (ptr_plugin_handler->prev_handler)
|
||||
{
|
||||
(ptr_plugin_handler->prev_handler)->next_handler = ptr_plugin_handler->next_handler;
|
||||
new_plugin_handlers = *plugin_handlers;
|
||||
}
|
||||
else
|
||||
new_plugin_handlers = ptr_plugin_handler->next_handler;
|
||||
|
||||
if (ptr_plugin_handler->next_handler)
|
||||
(ptr_plugin_handler->next_handler)->prev_handler = ptr_plugin_handler->prev_handler;
|
||||
|
||||
/* free data */
|
||||
free (ptr_plugin_handler->name);
|
||||
free (ptr_plugin_handler->function_name);
|
||||
free (ptr_plugin_handler);
|
||||
*plugin_handlers = new_plugin_handlers;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_free_all: remove all message/command handlers
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_free_all (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler)
|
||||
{
|
||||
while (*plugin_handlers)
|
||||
plugin_handler_free (plugin_handlers, last_plugin_handler,
|
||||
*plugin_handlers);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_free_all_type: remove all message/command handlers for one type
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_free_all_type (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler,
|
||||
int plugin_type)
|
||||
{
|
||||
t_plugin_handler *ptr_plugin_handler, *new_plugin_handler;
|
||||
|
||||
ptr_plugin_handler = *plugin_handlers;
|
||||
while (ptr_plugin_handler)
|
||||
{
|
||||
if (ptr_plugin_handler->plugin_type == plugin_type)
|
||||
{
|
||||
new_plugin_handler = ptr_plugin_handler->next_handler;
|
||||
plugin_handler_free (plugin_handlers, last_plugin_handler,
|
||||
ptr_plugin_handler);
|
||||
ptr_plugin_handler = new_plugin_handler;
|
||||
}
|
||||
else
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_event_msg: IRC message received => call all handlers for this message
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_event_msg (char *irc_command, char *server, char *arguments)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||
{
|
||||
if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
{
|
||||
if (ptr_plugin_handler->running == 0)
|
||||
{
|
||||
ptr_plugin_handler->running = 1;
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, server, arguments);
|
||||
ptr_plugin_handler->running = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef PLUGIN_PYTHON
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PYTHON)
|
||||
{
|
||||
if (ptr_plugin_handler->running == 0)
|
||||
{
|
||||
ptr_plugin_handler->running = 1;
|
||||
wee_python_exec (ptr_plugin_handler->function_name, server, arguments);
|
||||
ptr_plugin_handler->running = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) irc_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_exec_command: execute a command handler
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_exec_command (char *user_command, char *server, char *arguments)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||
{
|
||||
if (strcasecmp (ptr_plugin_handler->name, user_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
{
|
||||
if (ptr_plugin_handler->running == 0)
|
||||
{
|
||||
ptr_plugin_handler->running = 1;
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, server, arguments);
|
||||
ptr_plugin_handler->running = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef PLUGIN_PYTHON
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PYTHON)
|
||||
{
|
||||
if (ptr_plugin_handler->running == 0)
|
||||
{
|
||||
ptr_plugin_handler->running = 1;
|
||||
wee_python_exec (ptr_plugin_handler->function_name, server, arguments);
|
||||
ptr_plugin_handler->running = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* command executed */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) user_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
|
||||
/* no command executed */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_find_buffer: find a buffer for text display or command execution
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
plugin_find_buffer (char *server, char *channel)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
ptr_server = NULL;
|
||||
ptr_channel = NULL;
|
||||
ptr_buffer = NULL;
|
||||
|
||||
if (server && server[0])
|
||||
{
|
||||
ptr_server = server_search (server);
|
||||
if (!ptr_server)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
if (!ptr_server)
|
||||
ptr_server = SERVER(gui_buffers);
|
||||
}
|
||||
|
||||
if (channel && channel[0])
|
||||
{
|
||||
if (ptr_server)
|
||||
{
|
||||
ptr_channel = channel_search (ptr_server, channel);
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
if (ptr_buffer->dcc)
|
||||
ptr_buffer = gui_buffers;
|
||||
}
|
||||
|
||||
if (!ptr_buffer)
|
||||
return NULL;
|
||||
|
||||
return (ptr_buffer->dcc) ? NULL : ptr_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_unload: unload all scripts for a plugin type
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_unload (int plugin_type, char *scriptname)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) scriptname;
|
||||
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
/* unload one Perl script is not allowed */
|
||||
wee_perl_end ();
|
||||
wee_perl_init ();
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
#ifdef PLUGIN_PYTHON
|
||||
wee_python_end ();
|
||||
wee_python_init ();
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: unload Ruby scripts */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_end: shutdown plugin interface
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_end ()
|
||||
{
|
||||
plugin_handler_free_all (&plugin_msg_handlers, &last_plugin_msg_handler);
|
||||
plugin_handler_free_all (&plugin_cmd_handlers, &last_plugin_cmd_handler);
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_end();
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
wee_python_end();
|
||||
#endif
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user