mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Compare commits
527 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5a20d282e | |||
| ed76104d42 | |||
| 04206f8032 | |||
| 54a5f181b5 | |||
| dd735af7f8 | |||
| 87fb462f35 | |||
| b3018f8ae7 | |||
| 1f363eeb24 | |||
| f5ecafd6a8 | |||
| c8361419b8 | |||
| 10161cd16c | |||
| a83507eb77 | |||
| 159371cbd9 | |||
| 78c110ace2 | |||
| 83b7741ef2 | |||
| 64c1dbba0e | |||
| 6eb449b370 | |||
| 2bbc2d53eb | |||
| 68cf327088 | |||
| bf3f696830 | |||
| 3bca573d49 | |||
| ba98dca08a | |||
| 4812123dc5 | |||
| ed1755eacc | |||
| bd80891676 | |||
| 8a2a0ec0ae | |||
| e49b4131f2 | |||
| a164b85e3a | |||
| b0758b6fac | |||
| 5830b0ab40 | |||
| d94a7d05ea | |||
| bea5769a05 | |||
| fd562722d0 | |||
| 639d8b3ba9 | |||
| b536a8a491 | |||
| 51cacc0fdb | |||
| e07859395f | |||
| 7cf7e5b9ff | |||
| 87e934766b | |||
| e4b59681b2 | |||
| dd8ce32004 | |||
| b575a4f578 | |||
| 6b1f5a4a92 | |||
| dd3977367f | |||
| 8a9e8ecc88 | |||
| 5dfab7643d | |||
| cea0851071 | |||
| 6919005d74 | |||
| 8497d25d34 | |||
| 4ea734a376 | |||
| 3369a00959 | |||
| a6d93cf432 | |||
| e6a1bb4694 | |||
| 6b6def5890 | |||
| be1c9be925 | |||
| e5754e1fe6 | |||
| c0e4ba60d7 | |||
| 5f101c3833 | |||
| 079e4a4028 | |||
| 24ceb3bb95 | |||
| dec92aeba6 | |||
| 5551542566 | |||
| 9411a2fad0 | |||
| ee4f5716d3 | |||
| e26772dcdb | |||
| 232b5684ca | |||
| 93b2be7a41 | |||
| b86c95e7dc | |||
| 9d52621c44 | |||
| 0e6b0a3b0c | |||
| e081a6af17 | |||
| 3f3a202739 | |||
| 0f055b087a | |||
| 0e531f5e6a | |||
| c2f4bdd0fc | |||
| 32a7fbb767 | |||
| b7484eeea7 | |||
| f7872a9dd8 | |||
| cde66456fb | |||
| 6beb8b6465 | |||
| 1a140ab8b5 | |||
| e148a40ae1 | |||
| ee2951bf11 | |||
| 73359fcc05 | |||
| 0bc32f561b | |||
| d179625e52 | |||
| bd9cdeec5c | |||
| a9f04c5fd9 | |||
| 1e382ab9bd | |||
| 2855b71520 | |||
| 7b4453a507 | |||
| aeb7170024 | |||
| 357d7c5a2f | |||
| b2ec60110c | |||
| 9eb142036e | |||
| fa54807ef6 | |||
| 11d77e6168 | |||
| 2ca5b4f651 | |||
| 38e2003a17 | |||
| 7bb815a540 | |||
| 5a3976d6a5 | |||
| cdc33d08b0 | |||
| 5130b1dc4f | |||
| cdfc5b6c5a | |||
| 50ef2b0306 | |||
| b25824eb4f | |||
| 97a1d0e79d | |||
| 219e9d443a | |||
| 77d50aef98 | |||
| eea49832ea | |||
| 16389e0728 | |||
| 4a7b3436ae | |||
| 799bb14928 | |||
| 75c58c423c | |||
| 63e73b30ad | |||
| 29006d8cec | |||
| 85b1702077 | |||
| caff3dd011 | |||
| 9d4300c0d7 | |||
| 8aa7e3e3e6 | |||
| 150c5e9749 | |||
| 6bec96cd4d | |||
| 068284dd19 | |||
| 38a8c321c0 | |||
| 0094d143b3 | |||
| 530dc9fb67 | |||
| 96a69fd7f3 | |||
| 938915d387 | |||
| 25bbe3d284 | |||
| 9c7d05f605 | |||
| c953db4d64 | |||
| 9d6ca20478 | |||
| 7f4a213239 | |||
| e18f14e5d3 | |||
| 8f3455d0a9 | |||
| dfbea2850a | |||
| 8a299adb3b | |||
| a29416e352 | |||
| c346216e34 | |||
| da7df57b1a | |||
| 61fac4d49e | |||
| 4f5c1b6e09 | |||
| 2962a8e6c8 | |||
| 76263dc7cf | |||
| 554fa728ae | |||
| 5881048405 | |||
| c517253a72 | |||
| fe16f6d48f | |||
| f276fd9494 | |||
| 517de7ab94 | |||
| 06463e5937 | |||
| d80c8e9e57 | |||
| f74b280a1f | |||
| cd4f50c136 | |||
| 767e378c53 | |||
| 60503d9383 | |||
| 11321acb96 | |||
| 84b1a27265 | |||
| 51322e7917 | |||
| d256d72eef | |||
| 8a61b0eee0 | |||
| d4ecb032d4 | |||
| 3f946e304d | |||
| 97b6bbcb9e | |||
| 357edc193e | |||
| ace03b808d | |||
| 428cfbc297 | |||
| 02cd829c4c | |||
| 17973de52a | |||
| 364667f788 | |||
| 10d7c6c34a | |||
| 38fa7c93ac | |||
| 9e328d3fef | |||
| 312d8015f5 | |||
| 110aa59ca8 | |||
| 89b955c79e | |||
| 3d724fb634 | |||
| 29d0225e4a | |||
| 8416212077 | |||
| c36f08d7d7 | |||
| 1230735c5f | |||
| 77d7b703de | |||
| 60db73c19a | |||
| a9ca2987bb | |||
| 220308e1fa | |||
| 8166d15235 | |||
| 575525d965 | |||
| 6271304832 | |||
| bdf9eadf43 | |||
| 15ea11b57b | |||
| f3390da5e3 | |||
| eeff957278 | |||
| 1eac6d8fdd | |||
| 23696b44da | |||
| 63ffae72af | |||
| 376c8a29d6 | |||
| 8b1e3b9890 | |||
| 1b2c5571e6 | |||
| 4c6c367557 | |||
| 99ad719ab9 | |||
| a68a1f8192 | |||
| 930c40eae1 | |||
| 9238a37351 | |||
| a7c4c7237c | |||
| a9912cd266 | |||
| 1d07964d17 | |||
| 06bd0f9f0e | |||
| 4b1679900a | |||
| 99f03cd2a3 | |||
| 3d41a3fa2f | |||
| 089b167573 | |||
| fc2d9732e5 | |||
| 94a3b5e1ae | |||
| 6b12f19083 | |||
| 8a6d35cf12 | |||
| d286f3922c | |||
| 505b43d15b | |||
| 07a820ced6 | |||
| df6a41566b | |||
| 263606fffb | |||
| d4d065253e | |||
| 673e7680af | |||
| ad1120c84c | |||
| f2a78ebc16 | |||
| fef0932c1d | |||
| 96bd473887 | |||
| 89d107c1a9 | |||
| 54d4fc12a6 | |||
| 55125beee4 | |||
| a724278215 | |||
| e3799797ef | |||
| b738f4c8aa | |||
| 6f3b6d9e50 | |||
| def35c5a66 | |||
| da4ee1a6ee | |||
| 7c31dd9189 | |||
| dbad2a0206 | |||
| ec1d57063c | |||
| 5bd56f86c6 | |||
| 2fab4da03d | |||
| c69c77507c | |||
| b330ec3dae | |||
| ae8f8a5700 | |||
| 5e8b47f187 | |||
| f4abd0bf59 | |||
| abe7e08147 | |||
| 4e9193a943 | |||
| bbd373c44d | |||
| 6b011234cf | |||
| 71a76ada48 | |||
| a7ddb89076 | |||
| 6fe262c131 | |||
| 0a32bc5326 | |||
| 70fe8e9472 | |||
| b0310b6e78 | |||
| 8218316502 | |||
| d00c99f292 | |||
| f72e5952f2 | |||
| ebf5f9e66d | |||
| 7330dc862a | |||
| 9eb1422bb7 | |||
| d86a783b6a | |||
| 5b3f96dace | |||
| 821c2e87c8 | |||
| 1de7b52aa2 | |||
| 4d4a667094 | |||
| 0eb3d45582 | |||
| 7c63a73999 | |||
| 2ab3467c05 | |||
| 37d74c4941 | |||
| 01186c6c8b | |||
| 29ffe7e0d8 | |||
| a8619181b7 | |||
| 5a90270a79 | |||
| 3900a0f5ae | |||
| 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 |
@@ -0,0 +1,996 @@
|
||||
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 May 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 | [] [] [] |
|
||||
libgphoto2 | [] |
|
||||
libgphoto2_port | [] |
|
||||
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 5 0 40 43 2 51 91 19 1 14
|
||||
|
||||
eo es et eu fa fi fr ga gl he hi hr hu id is
|
||||
+-----------------------------------------------+
|
||||
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 | [] [] [] [] [] |
|
||||
libgphoto2 | [] [] [] |
|
||||
libgphoto2_port | [] |
|
||||
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 hi hr hu id is
|
||||
15 85 21 15 2 35 115 45 16 8 1 6 40 27 1
|
||||
|
||||
it 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 | [] |
|
||||
libgphoto2 | [] [] |
|
||||
libgphoto2_port | [] [] |
|
||||
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 | [] |
|
||||
+--------------------------------------------------+
|
||||
it ja ko ku lg lt lv mk mn ms mt nb nl nn no nso
|
||||
46 35 11 2 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
|
||||
+----------------------------------------------+
|
||||
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 | [] [] [] [] [] [] |
|
||||
libgphoto2 | [] [] |
|
||||
libgphoto2_port | [] |
|
||||
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
|
||||
1 3 47 29 57 6 78 73 5 44 12 12 50 85
|
||||
|
||||
ta tg th tk tr uk ven vi wa xh zh_CN zh_TW zu
|
||||
+-----------------------------------------------+
|
||||
GNUnet | | 0
|
||||
a2ps | [] [] [] | 19
|
||||
aegis | | 0
|
||||
ant-phone | [] [] | 5
|
||||
anubis | [] [] [] | 11
|
||||
ap-utils | () [] | 2
|
||||
aspell | [] [] [] | 13
|
||||
bash | [] | 11
|
||||
batchelor | [] [] | 7
|
||||
bfd | | 1
|
||||
bibshelf | [] | 5
|
||||
binutils | [] | 6
|
||||
bison | [] [] | 18
|
||||
bluez-pin | [] [] [] [] [] | 25
|
||||
clisp | | 7
|
||||
console-tools | [] [] | 5
|
||||
coreutils | [] [] | 17
|
||||
cpio | [] [] [] | 7
|
||||
cpplib | [] [] | 8
|
||||
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 | [] | 5
|
||||
gcal | [] | 5
|
||||
gcc | [] [] | 4
|
||||
gettext-examples | [] [] [] [] [] | 21
|
||||
gettext-runtime | [] [] [] [] [] | 25
|
||||
gettext-tools | [] [] [] [] [] | 19
|
||||
gimp-print | [] | 11
|
||||
gip | [] | 8
|
||||
gliv | [] [] | 7
|
||||
glunarclock | [] [] | 13
|
||||
gmult | [] [] [] | 13
|
||||
gnubiff | [] | 3
|
||||
gnucash | () [] | 10
|
||||
gnucash-glossary | [] [] | 9
|
||||
gpe-aerial | [] [] | 13
|
||||
gpe-beam | [] [] | 13
|
||||
gpe-calendar | [] [] [] [] | 18
|
||||
gpe-clock | [] [] [] [] | 17
|
||||
gpe-conf | [] [] | 12
|
||||
gpe-contacts | [] [] | 7
|
||||
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 | [] [] [] | 17
|
||||
gphoto2 | [] [] [] | 18
|
||||
gprof | [] [] | 10
|
||||
gpsdrive | | 3
|
||||
gramadoir | [] | 6
|
||||
grep | [] [] [] [] | 32
|
||||
gretl | | 4
|
||||
gsasl | [] [] | 12
|
||||
gss | [] | 5
|
||||
gst-plugins | [] [] [] | 17
|
||||
gstreamer | [] [] [] [] | 15
|
||||
gtick | [] | 11
|
||||
gtkspell | [] [] [] [] | 21
|
||||
hello | [] [] [] [] | 37
|
||||
id-utils | [] [] | 13
|
||||
impost | [] | 3
|
||||
indent | [] [] [] [] | 25
|
||||
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
|
||||
libgphoto2 | [] | 9
|
||||
libgphoto2_port | | 5
|
||||
libgsasl | [] | 7
|
||||
libiconv | [] [] [] [] [] | 32
|
||||
libidn | [] [] | 6
|
||||
lifelines | | 4
|
||||
lilypond | | 1
|
||||
lingoteach | [] | 6
|
||||
lynx | [] [] [] | 15
|
||||
m4 | [] [] | 17
|
||||
mailutils | [] | 7
|
||||
make | [] [] | 18
|
||||
man-db | | 5
|
||||
minicom | | 11
|
||||
mysecretdiary | [] [] | 12
|
||||
nano | [] [] | 13
|
||||
nano_1_0 | [] [] [] | 18
|
||||
opcodes | [] [] | 9
|
||||
parted | [] [] [] | 18
|
||||
psmisc | [] | 7
|
||||
ptx | [] [] | 23
|
||||
pwdutils | | 1
|
||||
python | | 0
|
||||
radius | [] | 6
|
||||
recode | [] [] | 22
|
||||
rpm | [] [] | 11
|
||||
screem | | 1
|
||||
scrollkeeper | [] [] [] | 24
|
||||
sed | [] [] [] | 21
|
||||
sh-utils | [] | 15
|
||||
shared-mime-info | [] [] [] | 21
|
||||
sharutils | [] [] [] | 20
|
||||
silky | | 3
|
||||
skencil | | 6
|
||||
sketch | | 6
|
||||
solfege | | 4
|
||||
soundtracker | [] | 8
|
||||
sp | [] | 3
|
||||
stardict | [] [] [] [] | 10
|
||||
tar | [] [] [] [] | 15
|
||||
texinfo | [] [] | 14
|
||||
textutils | [] [] [] | 17
|
||||
tin | | 1
|
||||
tp-robot | [] [] [] | 8
|
||||
tuxpaint | [] [] [] [] | 34
|
||||
unicode-han-tra... | | 0
|
||||
unicode-transla... | | 2
|
||||
util-linux | [] [] [] | 18
|
||||
vorbis-tools | [] | 10
|
||||
wastesedge | | 1
|
||||
wdiff | [] [] | 22
|
||||
wget | [] [] | 7
|
||||
xchat | [] [] [] [] | 26
|
||||
xkeyboard-config | [] | 2
|
||||
xpad | [] | 5
|
||||
+-----------------------------------------------+
|
||||
73 teams ta tg th tk tr uk ven vi wa xh zh_CN zh_TW zu
|
||||
149 domains 0 0 0 1 77 30 0 92 16 0 42 32 0 1746
|
||||
|
||||
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 May 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.
|
||||
|
||||
|
||||
@@ -4,26 +4,44 @@ WeeChat - Wee Enhanced Environment for Chat
|
||||
Developers:
|
||||
----------
|
||||
|
||||
All developers are connected to IRC:
|
||||
* General code
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
* Scripts plugins
|
||||
|
||||
Kolter <kolter@free.fr>
|
||||
Web : http://kolter.free.fr
|
||||
IRC : nick is "kolter" @ irc.freenode.net
|
||||
Jabber: kolter@jabber.org
|
||||
|
||||
|
||||
Debian packager:
|
||||
---------------
|
||||
|
||||
Julien Louis <ptitlouis@sysif.net>
|
||||
IRC : nick is "ptitlouis" @ irc.freenode.net
|
||||
Jabber: ptitlouis@amessage.info
|
||||
|
||||
|
||||
Contributors:
|
||||
------------
|
||||
|
||||
Rudolf Polzer <rpolzer-rp@durchnull.de> (IRC: "divVerent")
|
||||
Jiri Golembiovsky <golemj@gmail.com> (IRC: "GolemJ")
|
||||
Jim Ramsay <i.am@jimramsay.com> (IRC: "lack")
|
||||
|
||||
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://www.flashtux.org
|
||||
IRC : nick is "FlashCode"
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga"
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@tuxisland.org>
|
||||
Web : http://www.tuxisland.org
|
||||
IRC : nick is "xahlexx"
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2004-02-07
|
||||
WeeChat known bugs, 2005-11-11
|
||||
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- some refresh bugs with splited windows
|
||||
- ./configure does not check that Ruby libraries are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- 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!)
|
||||
- too much opened channels => display bug
|
||||
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
||||
- when function key (non used by WeeChat) is pressed, prompt is deleted
|
||||
- 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)
|
||||
- WeeChat may crash if too much nicks in nicklist when position is top or bottom
|
||||
|
||||
@@ -1,9 +1,221 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-02-07
|
||||
ChangeLog - 2005-11-11
|
||||
|
||||
|
||||
Version 0.1.6 (2005-11-11):
|
||||
* new color management system, IRC colors are now correctly
|
||||
displayed and can be removed by new options irc_colors_receive
|
||||
and irc_colors_send
|
||||
* fixed scroll problem when one line is bigger than screen size
|
||||
* added setting for having one server buffer for all servers
|
||||
(look_one_server_buffer)
|
||||
* added setting for ignoring some chars when completing nicks
|
||||
* fixed IRC message parser bug
|
||||
* signal SIGPIPE is now ignored
|
||||
* added partial match for highlights
|
||||
* added dcc_own_ip and dcc_port_range settings
|
||||
* full UTF-8 support, auto-detection of UTF-8 usage (locale)
|
||||
* added "Day changed to [date]" message when day changes
|
||||
* new plugin interface, rewritten from scratch: now loads dynamic C
|
||||
library, and perl/python are plugin scripts
|
||||
* log options (for server/channel/private) can now be set while
|
||||
WeeChat is running
|
||||
* added channel modes +e and +f
|
||||
* added some missing IRC commands, fixed command 367
|
||||
* added colors for input buffer and current channel of status bar
|
||||
* added online help for config options (with /set full_option_name)
|
||||
* enhanced "smart" hotlist, with names (new options:
|
||||
look_hotlist_names_{count|level|length})
|
||||
|
||||
Version 0.1.5 (2005-09-24):
|
||||
* added /ame command (send CTCP action to all channels of all
|
||||
connected servers)
|
||||
* added setting "irc_notice_as_pv" to see notices as pv
|
||||
* added nicks colors in setup file
|
||||
* fixed DCC bug: delete failed file only if really empty (on disk)
|
||||
* fixed IRC message parser bug
|
||||
* fixed scroll problem (screen moving when scrolling and new line
|
||||
displayed)
|
||||
* fixed infinite loop when scrolling back and displaying long lines
|
||||
* fixed crash when closing a buffer used by more than one window
|
||||
* added some missing IRC commands
|
||||
* fixed DCC display bug (now decodes string according to charset)
|
||||
* added /ignore and /unignore commands
|
||||
* fixed bug with strings comparison (str[n]casecmp) and some locales
|
||||
(like turkish), now using ASCII comparison (thanks to roktas)
|
||||
* signal SIGQUIT is now ignored
|
||||
* fixed refresh bug when one line is bigger than screen size
|
||||
* fixed look_nicklist_min_size and look_nicklist_max_size options
|
||||
* fixed refresh bug when changing channel modes
|
||||
* jump to next server now saves current channel buffer for each server
|
||||
* ctrl-up/ctrl-down keys added to call previous/next command in global
|
||||
history (common to all buffers)
|
||||
|
||||
Version 0.1.4 (2005-07-30):
|
||||
* join and part/quit prefixes (arrows) now displayed with different colors
|
||||
* added "irc_highlight" setting, to get highlight with any word
|
||||
* fixed auto-rejoin for channels with key
|
||||
* fixed /ctcp command (now any command/data allowed)
|
||||
* added /amsg command (send text to all channels of all connected servers)
|
||||
* fixed SIGSEGV handler (now write a core file by aborting program)
|
||||
* fixed statusbar & infobar background refresh problem with some systems
|
||||
* added color for private in hotlist (different than color for highlight)
|
||||
* added DCC resume and timeout
|
||||
* added function for Perl/Python to get DCC list
|
||||
* fixed FIFO pipe (command now authorized on a buffer not connected
|
||||
to an IRC server)
|
||||
* topic completion now decodes UTF-8 string
|
||||
* fixed bug with IRC URL on command line (irc://)
|
||||
* new keyboard management: keys are setup in config file, new command
|
||||
/key was added and some new default keys were added, alt-k key is
|
||||
used to grab key (useful for /key command)
|
||||
* added seconds in infobar time (optional thanks to new setting)
|
||||
* fixed some curses refreshs
|
||||
* channels auto-prefixed by "#" (if no prefix found) for /join command
|
||||
|
||||
Version 0.1.3 (2005-07-02):
|
||||
* proxy support (http, socks4, socks5) with authentification (http, socks5)
|
||||
and ipv6 support (client to proxy)
|
||||
* completion added for config option (with /set command)
|
||||
* commands from users outside channel now authorized (if special user or
|
||||
channel without "n" flag)
|
||||
* added IPv6 support
|
||||
* kill command now received and displayed
|
||||
* added SSL support
|
||||
* channel notify levels are saved in config file (new option
|
||||
"server_notify_levels" for server sections)
|
||||
* part message now accepts %v (replaced by WeeChat version), like quit message
|
||||
* errors while loading perl scripts are now displayed in server buffer
|
||||
(instead of current buffer)
|
||||
* in python scripts, all messages written in stdin and stderr are redirected
|
||||
in server buffer
|
||||
* fix a filename error while loading a python script manually
|
||||
* fixed plugins "print" and "prnt" functions: now ok for writing on server
|
||||
buffers
|
||||
* fixed color problem with new libcurses version
|
||||
* fixed crash when using Alt-S or Alt-X on DCC buffer (Alt-D)
|
||||
* fixed startup crash when config file (~/.weechat/weechat.rc) is not found
|
||||
* improved Perl/Python libs detection for ./configure script
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
@@ -1,158 +1,198 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
WeeChat FAQ, 2005-11-11
|
||||
=======================
|
||||
|
||||
WeeChat FAQ, 2004-01-01
|
||||
Intended audience:
|
||||
All WeeChat users.
|
||||
|
||||
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- Compiling
|
||||
1.2
|
||||
================================================================================
|
||||
Q: I can't compile WeeChat CVS.
|
||||
|
||||
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
|
||||
1.2 I can't compile WeeChat CVS.
|
||||
|
||||
2- Using WeeChat
|
||||
|
||||
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
|
||||
2.2 I've launched WeeChat, but I'm lost, what can I do?
|
||||
2.3 How can I customize key bindings?
|
||||
2.4 How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
2.5 How can I load Python scripts?
|
||||
2.6 How can I load Ruby scripts?
|
||||
|
||||
3- Development
|
||||
|
||||
3.1 How should I report bugs?
|
||||
3.2 How should I submit patches?
|
||||
3.3 How should I submit new feature request?
|
||||
3.4 Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows?
|
||||
3.5 I want to help WeeChat developers. What can I do?
|
||||
3.6 Can I give money or other things to WeeChat developers?
|
||||
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.
|
||||
|
||||
|
||||
/------------------------------------------------------------------------------\
|
||||
| 1- Compiling |
|
||||
\------------------------------------------------------------------------------/
|
||||
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)
|
||||
* nicklist available in all GUI
|
||||
* extensible with scripts (Perl, Python, Ruby)
|
||||
* horizontal and vertical window split
|
||||
* infobar highlight
|
||||
* FIFO pipe for remote control
|
||||
* 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
|
||||
|
||||
|
||||
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
|
||||
2.2
|
||||
================================================================================
|
||||
Q: I've launched WeeChat, but I'm lost, what can I do?
|
||||
|
||||
Curses GUI is built by default.
|
||||
To build Gtk or Qt GUI you've to specify extra options to ./configure script:
|
||||
--enable-gtk to enable gtk 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!
|
||||
A: For help you can type /help. For help about a command, type /help command.
|
||||
Keys and commands are listed in documentation.
|
||||
|
||||
|
||||
1.2 I can't compile WeeChat CVS.
|
||||
2.3
|
||||
================================================================================
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
Check that you have latest version of autoconf and automake.
|
||||
WeeChat has been developed with autoconf version 2.56 and automake version 1.7.
|
||||
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.
|
||||
A: You have to setup charset used for decoding (ISO and UTF), encoding, and
|
||||
internal WeeChat charset.
|
||||
Internal charset should be empty value, except if WeeChat failed to
|
||||
detect your locale (WeeChat looks for "UTF-8" in your locale name).
|
||||
|
||||
|
||||
/------------------------------------------------------------------------------\
|
||||
| 2- Using WeeChat |
|
||||
\------------------------------------------------------------------------------/
|
||||
2.4
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
|
||||
A: Key bindings are customizable with /key command.
|
||||
Default key Meta-k (usually Alt-k) lets you grab key code and insert it
|
||||
in input zone.
|
||||
|
||||
|
||||
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
Because WeeChat is very light and has new features.
|
||||
Some new features:
|
||||
* many GUI (Curses, Gtk, 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" ;)
|
||||
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.2 I've launched WeeChat, but I'm lost, what can I do?
|
||||
2.6
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
Are Python scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
For help you can type /help. For help about a command, type /help command.
|
||||
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.3 How can I customize key bindings?
|
||||
2.7
|
||||
================================================================================
|
||||
Q: How can I load Ruby scripts?
|
||||
|
||||
Today you can't do that. This will be available in a future version.
|
||||
A: Today Ruby interface is not developed, so you can't load any Ruby script.
|
||||
|
||||
|
||||
2.4 How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
3.1
|
||||
================================================================================
|
||||
Q: How should I report bugs?
|
||||
|
||||
Yes, you can use /perl command to launch 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 compatible with X-Chat, not with Irssi, sorry ;)
|
||||
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)
|
||||
|
||||
|
||||
2.5 How can I load Python scripts?
|
||||
3.2
|
||||
================================================================================
|
||||
Q: How should I submit patches?
|
||||
|
||||
Today Python interface is not developed, so can't load any Python script.
|
||||
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)
|
||||
|
||||
|
||||
2.6 How can I load Ruby scripts?
|
||||
3.3
|
||||
================================================================================
|
||||
Q: How should I submit new feature request?
|
||||
|
||||
Today Ruby interface is not developed, so can't load any Ruby script.
|
||||
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- Development |
|
||||
\------------------------------------------------------------------------------/
|
||||
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.1 How should I report bugs?
|
||||
3.5
|
||||
================================================================================
|
||||
Q: Will WeeChat be ported to QNX or other operating systems?
|
||||
|
||||
There is 3 ways to report bugs:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #eci
|
||||
If no one can help you (huh?), try another way, see below.
|
||||
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)
|
||||
A: Yes. Future versions will be available for these OS.
|
||||
We need help for such systems, any help is welcome :)
|
||||
|
||||
|
||||
3.2 How should I submit patches?
|
||||
3.6
|
||||
================================================================================
|
||||
Q: I want to help WeeChat developers. What can I do?
|
||||
|
||||
There is 3 ways to submit patches:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #eci
|
||||
If no one can help you (huh?), try another way, see below.
|
||||
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)
|
||||
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.3 How should I submit new feature request?
|
||||
3.7
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
There is 2 ways to submit your feature request:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #eci
|
||||
If no one can help you (huh?), try another way, see below.
|
||||
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 Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows ?
|
||||
|
||||
Yes. Future versions will be available for these OS.
|
||||
|
||||
|
||||
3.5 I want to help WeeChat developers. What can I do?
|
||||
|
||||
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.6 Can I give money or other things to WeeChat developers?
|
||||
|
||||
No.
|
||||
A: You can give us money to help development.
|
||||
Details on http://weechat.flashtux.org/donate.php?lang=en
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
WeeChat FAQ, 2005-11-11
|
||||
=======================
|
||||
|
||||
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)
|
||||
* liste des pseudos disponible dans toutes les interfaces
|
||||
* extensible par des scripts (Perl, Python, Ruby)
|
||||
* découpage de la fenêtre horizontalement et verticalement
|
||||
* highlight dans la barre d'infos
|
||||
* tube FIFO pour contrĂ´le Ă distance
|
||||
* 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 (ISO et UTF),
|
||||
l'encodage ainsi que le charset interne Ă WeeChat.
|
||||
Le charset interne Ă WeeChat doit ĂŞtre une valeur vide, sauf si WeeChat
|
||||
n'arrive pas à déterminer votre locale (WeeChat recherche "UTF-8" dans
|
||||
le nom de la locale).
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: Comment puis-je configurer les raccourcis clavier ?
|
||||
|
||||
R: Les raccourcis clavier sont modifiables avec la commande /key.
|
||||
La touche par défaut Meta-k (souvent Alt-k) permet de capturer le code
|
||||
d'une touche et de l'inclure dans la zone de saisie.
|
||||
|
||||
|
||||
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: Vous pouvez donner de l'argent pour aider le développement.
|
||||
Plus de détails sur http://weechat.flashtux.org/donate.php
|
||||
@@ -2,9 +2,11 @@ WeeChat - Installation instructions
|
||||
===================================
|
||||
|
||||
1) Run './configure'
|
||||
options: --disable-curses : do not build Curses interface
|
||||
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) Run 'make'
|
||||
|
||||
@@ -12,4 +14,4 @@ WeeChat - Installation instructions
|
||||
|
||||
4) Enjoy ! :-)
|
||||
|
||||
See AUTHORS for any support, feel free to contact us for any problem ;)
|
||||
See AUTHORS for support, feel free to contact us for any problem ;)
|
||||
|
||||
+10
-4
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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,8 +15,14 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
SUBDIRS = po intl src
|
||||
SUBDIRS = po doc intl src
|
||||
|
||||
EXTRA_DIST = weechat.1 BUGS FAQ
|
||||
EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
|
||||
debian/changelog debian/control \
|
||||
debian/copyright debian/compat \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install \
|
||||
weechat_icon_32.png
|
||||
|
||||
man_MANS = weechat.1
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -1,6 +1,65 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-11-11
|
||||
|
||||
WeeChat 0.1.6 released.
|
||||
|
||||
Important release notes:
|
||||
|
||||
- incompatibility with some old scripts: now all handlers have to return
|
||||
a code for completion, and to do some actions about message to ignore
|
||||
(please look at documentation for detail)
|
||||
|
||||
- on OpenBSD, the new option "plugins_extension" should be set to ".so.0.0"
|
||||
since the plugins names are ending by ".so.0.0" and not ".so"
|
||||
|
||||
- with new and full UTF-8 support, the option "look_charset_internal"
|
||||
should be set to blank for most cases. Forces it only if your locale is
|
||||
not properly detected by WeeChat (you can set "UTF-8" or "ISO-8859-15"
|
||||
for example, depending on your locale). WeeChat is looking for "UTF-8" in
|
||||
your locale name at startup.
|
||||
|
||||
* FlashCode, 2005-09-24
|
||||
|
||||
WeeChat 0.1.5 released.
|
||||
|
||||
* FlashCode, 2005-07-30
|
||||
|
||||
WeeChat 0.1.4 released.
|
||||
|
||||
* FlashCode, 2005-07-02
|
||||
|
||||
WeeChat 0.1.3 released.
|
||||
|
||||
* FlashCode, 2005-05-21
|
||||
|
||||
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.
|
||||
|
||||
@@ -12,20 +12,17 @@ Features
|
||||
* IRC chat client with multi-server connection
|
||||
* many GUI (curses, Gtk, Qt) (1)
|
||||
* small, fast and very light
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* customizable and extensible with plugins (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)
|
||||
* developed from scratch
|
||||
* multi-platform (GNU/Linux, *BSD, Mac OS X, QNX, Windows & other) (3)
|
||||
* 100% GPL & free
|
||||
|
||||
|
||||
Copyright
|
||||
---------
|
||||
|
||||
WeeChat (c) Copyright 2004
|
||||
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):
|
||||
@@ -46,6 +43,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
---
|
||||
(1) only curses interface is available today
|
||||
(2) plugin interfaces are not yet developed
|
||||
(3) only GNU/Linux version is available today
|
||||
(1) only Curses interface is available today
|
||||
(2) only Perl and Python plugins are available today
|
||||
(3) Windows is under construction
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2004-02-07
|
||||
TODO - 2005-11-11
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,83 +10,46 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.5:
|
||||
------
|
||||
|
||||
* General:
|
||||
# debug messages can be enabled via ./configure --enbale-debug option
|
||||
+ Solaris version
|
||||
+ Windows version
|
||||
# Solaris version
|
||||
|
||||
* WeeChat commands:
|
||||
# "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colors, time
|
||||
format, etc)
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
# info bar
|
||||
# add clock
|
||||
# highlight should not occur on partial words
|
||||
# one buffer for all servers
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- allow decode/encode charsets for servers or chan (not globally)
|
||||
# interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
? Qt GUI
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
+ add key bindings to config file
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* General:
|
||||
- Windows version
|
||||
- *BSD version
|
||||
* WeeChat commands
|
||||
- be able to bind a key on more than one command
|
||||
- be able to make an alias running more than one command
|
||||
- host with "*" possible with /ignore command
|
||||
- "/completion" command: do shortcuts (for example when we type "u"
|
||||
in the text bar it send it to the server as "you")
|
||||
- "/last": command to look for text in previous messages
|
||||
- completion system for scripts arguments
|
||||
# "/uptime" command
|
||||
- "/upgrade" command: reload WeeChat himself without disconnecting from server
|
||||
|
||||
* IRC protocol:
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- customizable CTCP version reply
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/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
|
||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||
nick/host connect to the given irc network
|
||||
|
||||
* 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
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- 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)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- log chats to file
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
- proxy support
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
* Configuration:
|
||||
- load config file after GUI (so init values by default (colors, ...) before
|
||||
loading config)
|
||||
- be able to launch more than one command when connecting to server
|
||||
|
||||
* Plugins:
|
||||
- Python plugin
|
||||
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
# dynamically load plugins as a separate library
|
||||
- allow print function to write on all buffers or all channels of a server
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
+14
-53
@@ -1,55 +1,16 @@
|
||||
#!/bin/sh
|
||||
rm -f config.cache
|
||||
|
||||
### GETTEXT ###
|
||||
|
||||
echo searching for GNU gettext intl directory...
|
||||
|
||||
dirs="/usr/share /usr/local/share /opt/share /usr /usr/local /opt /usr/gnu/share"
|
||||
found=0
|
||||
for try in $dirs; do
|
||||
echo -n " -> $try/gettext/intl... "
|
||||
if test -d $try/gettext/intl; then
|
||||
echo found it
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
echo no
|
||||
done
|
||||
if test "$found" != 1; then
|
||||
echo ERROR: Cannot find gettext/intl directory.
|
||||
echo ERROR: Install GNU gettext in /usr or /usr/local prefix.
|
||||
exit 7
|
||||
fi;
|
||||
|
||||
echo copying gettext intl files...
|
||||
intldir="$try/gettext/intl"
|
||||
if test ! -d intl; then
|
||||
mkdir intl
|
||||
fi
|
||||
olddir=`pwd`
|
||||
cd $intldir
|
||||
for file in *; do
|
||||
if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
|
||||
rm -f $olddir/intl/$file
|
||||
cp $intldir/$file $olddir/intl/
|
||||
fi
|
||||
done
|
||||
cp -f $try/gettext/po/Makefile.in.in $olddir/po/
|
||||
cd $olddir
|
||||
if test -f intl/plural.c; then
|
||||
sleep 2
|
||||
touch intl/plural.c
|
||||
fi
|
||||
|
||||
### END GETTEXT ###
|
||||
|
||||
echo "running aclocal..."
|
||||
aclocal -I /usr/share/aclocal
|
||||
echo "running autoconf..."
|
||||
autoconf
|
||||
echo "running autoheader..."
|
||||
autoheader
|
||||
echo "running automake..."
|
||||
automake -a
|
||||
echo "autogen.sh ok, now run ./configure script"
|
||||
# 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
|
||||
libtoolize --automake --force --copy &&
|
||||
aclocal &&
|
||||
# autoheader creates config.h.in needed by autoconf
|
||||
autoheader &&
|
||||
# autoconf creates configure
|
||||
autoconf &&
|
||||
# automake creates Makefile.in
|
||||
automake --add-missing --copy --gnu
|
||||
|
||||
+341
-58
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
@@ -19,69 +19,146 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.5, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.6, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.5])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.6])
|
||||
|
||||
# Checks for programs.
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# Add some flags for some OS
|
||||
case "$host_os" in
|
||||
freebsd* | openbsd*)
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
;;
|
||||
netbsd*)
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr"
|
||||
ALL_LINGUAS="fr es cs"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0)
|
||||
# Checks for libraries
|
||||
AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0)
|
||||
|
||||
# Checks for header files.
|
||||
# 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.
|
||||
# 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_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
# Variables in config.h
|
||||
|
||||
AH_VERBATIM([PREFIX], [#undef PREFIX])
|
||||
AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
|
||||
AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
|
||||
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
|
||||
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
|
||||
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(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
|
||||
# Arguments for ./configure
|
||||
|
||||
enable_plugins="no"
|
||||
enable_python="no"
|
||||
PYTHON_CFLAGS=
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no Gtk+)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl script plugin (default=no Perl plugin)],enable_perl=$enableval,enable_perl=no)
|
||||
AC_ARG_ENABLE(python, [ --enable-python Turn on Python script plugin (default=no Python plugin)],enable_python=$enableval,enable_python=no)
|
||||
AC_ARG_ENABLE(ruby, [ --enable-ruby Turn on Ruby script plugin (default=no Ruby script)],enable_ruby=$enableval,enable_ruby=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "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")
|
||||
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(PLUGINS, test "$enable_plugins" = "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")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
|
||||
if test "x$enable_curses" = "xyes" ; then
|
||||
if test "$LIBCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
|
||||
# ------------------------------------------------------------------------------
|
||||
# GUI
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSESW_FOUND" = "0" ; 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
|
||||
AC_MSG_WARN([
|
||||
*** ncursesw library not found! Falling back to "ncurses"
|
||||
*** Be careful, UTF-8 display may not work properly if your locale is UTF-8.])
|
||||
NCURSES_LIBS="-lncurses"
|
||||
else
|
||||
NCURSES_LIBS="-lncursesw"
|
||||
AC_CHECK_HEADERS(ncursesw/curses.h)
|
||||
fi
|
||||
CURSES_LIBS="-lcurses"
|
||||
AC_SUBST(CURSES_LIBS)
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
#if test "x$enable_wxwidgets" = "xyes" ; then
|
||||
# AM_OPTIONS_WXCONFIG
|
||||
# AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
#
|
||||
# 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.])
|
||||
@@ -92,47 +169,242 @@ if test "x$enable_gtk" = "xyes" ; then
|
||||
AC_SUBST(GTK_LIBS)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# plugins
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
PLUGINS_LIBS=
|
||||
|
||||
if test "x$enable_perl" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `perl -MExtUtils::Embed -e ldopts`"
|
||||
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
|
||||
|
||||
AC_PATH_PROG(PERL, perl perl5)
|
||||
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 headers files)
|
||||
|
||||
PERL_HEADER_TEST=`PT=perltest.c ; echo "#include <EXTERN.h>" > $PT; echo "#include <perl.h>" >> $PT; echo "#include <XSUB.h>" >> $PT ; echo "int main() { return 0; }" >> $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ccopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
|
||||
|
||||
if test "x$PERL_HEADER_TEST" = "x0" ; then
|
||||
PERL_CFLAGS=`$PERL -MExtUtils::Embed -e ccopts`
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Perl headers couldn't be found in your system.
|
||||
*** Try to install it with your software package manager.])
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
AC_MSG_CHECKING(for Perl library)
|
||||
|
||||
PERL_LIB_TEST=`PT=perltest.c ; echo "int main() { return 0; }" > $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ldopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
|
||||
|
||||
if test "x$PERL_LIB_TEST" = "x0" ; then
|
||||
PERL_LFLAGS=`$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)
|
||||
|
||||
AC_SUBST(PERL_CFLAGS)
|
||||
AC_SUBST(PERL_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_PERL)
|
||||
fi
|
||||
|
||||
if test "x$enable_python" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
|
||||
AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2)
|
||||
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_SYSPREFIX=`$PYTHON -c 'import sys; print "%s" % sys.prefix'`
|
||||
PYTHON_VERSION=`$PYTHON -c 'import sys ; print sys.version[[:3]]'`
|
||||
PYTHON_INCLUDE=`$PYTHON -c "import distutils.sysconfig,string; print distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
|
||||
|
||||
AC_MSG_CHECKING(for Python header files)
|
||||
if test -r "$PYTHON_INCLUDE/Python.h"; then
|
||||
PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
|
||||
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 distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
|
||||
PYTHON_LFLAGS="-lpython$PYTHON_VERSION "`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBS')+' '+distutils.sysconfig.get_config_var('SYSLIBS')+' '+distutils.sysconfig.get_config_var('LINKFORSHARED')"`
|
||||
|
||||
AC_MSG_CHECKING(for Python library)
|
||||
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
|
||||
elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
|
||||
elif test -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_SYSPREFIX/lib/ $PYTHON_LFLAGS"
|
||||
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)
|
||||
|
||||
AC_SUBST(PYTHON_CFLAGS)
|
||||
AC_SUBST(PYTHON_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_PYTHON)
|
||||
fi
|
||||
|
||||
if test "x$enable_ruby" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
|
||||
# TODO: check that ruby lib and headers are installed
|
||||
|
||||
RUBY_CFLAGS=-I`ruby -rrbconfig -e "puts Config::CONFIG[['archdir']]"`
|
||||
RUBY_LFLAGS=`ruby -rrbconfig -e "puts Config::CONFIG[['LIBRUBYARG_SHARED']]"`
|
||||
AC_SUBST(RUBY_CFLAGS)
|
||||
AC_SUBST(RUBY_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_RUBY)
|
||||
fi
|
||||
|
||||
if test "x$enable_plugins" = "xyes" ; then
|
||||
AC_CHECK_FUNCS(dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
|
||||
if test "$LIBDL_FOUND" != "yes"; then
|
||||
AC_CHECK_LIB(dl, dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
|
||||
if test "$LIBDL_FOUND" = "yes"; then
|
||||
PLUGINS_LIBS="-ldl"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** "dl" library (dynamic library loader) couldn't be found in your system.
|
||||
*** Try to install it with your software package manager or disable plugins.])
|
||||
fi
|
||||
fi
|
||||
AC_DEFINE(PLUGINS)
|
||||
fi
|
||||
|
||||
AC_SUBST(PLUGINS_LIBS)
|
||||
|
||||
if test "x$enable_debug" = "xyes" ; then
|
||||
# ------------------------------------------------------------------------------
|
||||
# gnutls
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_gnutls" = "xyes" ; then
|
||||
found_gnutls="no"
|
||||
AM_PATH_LIBGNUTLS( 1.0.0, found_gnutls=yes, AC_MSG_WARN([[
|
||||
*** libgnutls was not found. You may want to get it from
|
||||
*** ftp://ftp.gnutls.org/pub/gnutls/
|
||||
*** WeeChat will be built without GnuTLS support.]]))
|
||||
if test "x$found_gnutls" = "xyes" ; then
|
||||
GNUTLS_CFLAGS=`libgnutls-config --cflags`
|
||||
GNUTLS_LFLAGS=`libgnutls-config --libs`
|
||||
AC_SUBST(GNUTLS_CFLAGS)
|
||||
AC_SUBST(GNUTLS_LFLAGS)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
else
|
||||
enable_gnutls="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# general vars
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$prefix" = "xNONE" ; then
|
||||
prefix="$ac_default_prefix"
|
||||
fi
|
||||
|
||||
if test "x$exec_prefix" = "xNONE" ; then
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
|
||||
|
||||
WEECHAT_LIBDIR=`eval echo ${libdir}/weechat`
|
||||
AC_DEFINE_UNQUOTED(WEECHAT_LIBDIR, "$WEECHAT_LIBDIR")
|
||||
|
||||
WEECHAT_SHAREDIR=`eval echo ${datadir}/weechat`
|
||||
AC_DEFINE_UNQUOTED(WEECHAT_SHAREDIR, "$WEECHAT_SHAREDIR")
|
||||
|
||||
weechat_libdir=${libdir}/weechat
|
||||
AC_SUBST(weechat_libdir)
|
||||
|
||||
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
|
||||
|
||||
CFLAGS="-Wall -W -pipe -O2"
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
|
||||
case "$host_os" in
|
||||
freebsd* | netbsd*)
|
||||
if test "x$enable_perl" = "xyes" -o "x$enable_python" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
fi
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
;;
|
||||
openbsd*)
|
||||
if test "x$enable_python" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# output Makefiles
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
doc/Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
src/plugins/Makefile
|
||||
src/plugins/perl/Makefile
|
||||
src/plugins/scripts/Makefile
|
||||
src/plugins/scripts/perl/Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
src/plugins/scripts/ruby/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
|
||||
# ------------------------------------------------------------------------------
|
||||
# end message
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
listgui=
|
||||
if test "x$enable_curses" = "xyes" ; then
|
||||
listgui="$listgui Curses"
|
||||
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+"
|
||||
@@ -142,20 +414,31 @@ if test "x$enable_qt" = "xyes" ; then
|
||||
fi
|
||||
|
||||
if test "x$listgui" = "x" ; then
|
||||
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
|
||||
AC_MSG_ERROR([
|
||||
*** No interface specified...
|
||||
*** Please specify at least ncurses, WxWidgets, Gtk or Qt.])
|
||||
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 Print debugging messages...... : $enable_debug
|
||||
echo
|
||||
eval eval echo WeeChat will be installed in $bindir.
|
||||
echo
|
||||
echo configure complete, now type \'make\' to build WeeChat
|
||||
echo
|
||||
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 "Build with GNUtls support..................... : $enable_gnutls"
|
||||
echo "Build with Plugin support..................... : $enable_plugins"
|
||||
echo " Perl plugin..................... : $enable_perl"
|
||||
echo " Python plugin................... : $enable_python"
|
||||
echo " Ruby plugin..................... : $enable_ruby"
|
||||
echo "Compile with debug info....................... : $msg_debug_compiler"
|
||||
echo "Print debugging messages...................... : $msg_debug_verbose"
|
||||
echo ""
|
||||
eval echo "WeeChat will be installed in $bindir."
|
||||
echo ""
|
||||
echo "configure complete, now type 'make' to build WeeChat $VERSION"
|
||||
echo ""
|
||||
|
||||
Vendored
+97
@@ -1,3 +1,100 @@
|
||||
weechat (0.1.5-1) unstable; urgency=low
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 24 Sep 2005 14:08:55 +0200
|
||||
|
||||
weechat (0.1.4-2) unstable; urgency=low
|
||||
|
||||
* Add autotools-dev to Build-Depends.
|
||||
* update autotools stuff automatically to always
|
||||
have up-to-date config.{guess,sub}
|
||||
* Update Build-Depends: libgnutls11-dev -> libgnutls-dev
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Mon, 1 Aug 2005 11:46:39 +0200
|
||||
|
||||
weechat (0.1.4-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 30 Jul 2005 16:26:55 +0200
|
||||
|
||||
weechat (0.1.3-2) unstable; urgency=low
|
||||
|
||||
* Update config.{guess,sub} to fix FTBFS on k*BSD (Closes: #316791)
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Fri, 8 Jul 2005 21:30:38 +0200
|
||||
|
||||
weechat (0.1.3-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 2 Jul 2005 20:06:29 +0200
|
||||
|
||||
weechat (0.1.2-3) unstable; urgency=low
|
||||
|
||||
* Apply patch against gui-display.c to fix curses color bug.
|
||||
* remove dh_install --sourcedir to allow builds on woody.
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sun, 19 Jun 2005 22:37:11 +0200
|
||||
|
||||
weechat (0.1.2-2) unstable; urgency=low
|
||||
|
||||
* Patch src/gui/curse/gui-display.c to fix segfault
|
||||
when config file does not exists (Closes: #310589).
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Tue, 24 May 2005 20:55:02 +0200
|
||||
|
||||
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.
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
4
|
||||
Vendored
+27
-16
@@ -1,17 +1,27 @@
|
||||
Source: weechat
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
|
||||
Standards-Version: 3.5.8
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Uploaders: Julien Louis <ptitlouis@sysif.net>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncursesw5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls-dev, libtool, texinfo
|
||||
Standards-Version: 3.6.2.1
|
||||
|
||||
Package: weechat
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${Source-Version})
|
||||
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.
|
||||
It is customizable and extensible with plugins/scripts, and includes:
|
||||
- nicklist
|
||||
- smart hotlist
|
||||
- infobar with highlight notification
|
||||
- horizontal and vertical split
|
||||
- double charset support (decode/encode)
|
||||
- FIFO pipe for remote control
|
||||
- and much more!
|
||||
.
|
||||
Homepage: http://weechat.flashtux.org/
|
||||
|
||||
Package: weechat-curses
|
||||
Architecture: any
|
||||
@@ -19,20 +29,21 @@ 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-gtk
|
||||
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.
|
||||
It is customizable and extensible with plugins/scripts, and includes:
|
||||
- nicklist
|
||||
- smart hotlist
|
||||
- infobar with highlight notification
|
||||
- horizontal and vertical split
|
||||
- double charset support (decode/encode)
|
||||
- FIFO pipe for remote control
|
||||
- and much more!
|
||||
.
|
||||
Homepage: http://weechat.flashtux.org/
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
Recommends: weechat-curses | weechat-gtk
|
||||
Recommends: weechat-curses
|
||||
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.
|
||||
extensible IRC client. It is useless without weechat-curses.
|
||||
|
||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 07 Feb 2004 20:30: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
+24
-22
@@ -1,9 +1,6 @@
|
||||
#!/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
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
@@ -17,7 +14,8 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl --enable-gtk
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--infodir=\$${prefix}/share/info --enable-perl --enable-python
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -32,7 +30,7 @@ clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
-$(MAKE) clean
|
||||
-$(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -40,33 +38,37 @@ install: build
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
$(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
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
|
||||
dh_install
|
||||
# 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
|
||||
dh_testdir -pweechat-common
|
||||
dh_testroot -pweechat-common
|
||||
dh_installchangelogs -pweechat-common
|
||||
dh_testdir -pweechat-common -pweechat
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installinfo -pweechat-common
|
||||
dh_installexamples -pweechat-common
|
||||
dh_installman weechat.1 -pweechat-common
|
||||
dh_compress -pweechat-common
|
||||
dh_fixperms -pweechat-common
|
||||
dh_installdeb -pweechat-common
|
||||
dh_shlibdeps -pweechat-common
|
||||
dh_gencontrol -pweechat-common
|
||||
dh_md5sums -pweechat-common
|
||||
dh_builddeb -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 -a
|
||||
dh_testroot -a
|
||||
dh_link -a
|
||||
# dh_installchangelogs -a
|
||||
# dh_installdocs -a
|
||||
dh_installman doc/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
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
version=2
|
||||
http://weechat.flashtux.org/download/weechat-(\d.*)\.tar\.bz2
|
||||
Vendored
+1
-3
@@ -1,9 +1,7 @@
|
||||
AUTHORS
|
||||
BUGS
|
||||
ChangeLog
|
||||
COPYING
|
||||
FAQ
|
||||
INSTALL
|
||||
FAQ.fr
|
||||
NEWS
|
||||
README
|
||||
TODO
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
debian/tmp/usr/share/locale/
|
||||
Vendored
+2
-1
@@ -1 +1,2 @@
|
||||
usr/bin/weechat-curses
|
||||
debian/tmp/usr/bin/weechat-curses
|
||||
debian/tmp/usr/lib/weechat
|
||||
|
||||
@@ -1,33 +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
|
||||
#
|
||||
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.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=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=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
|
||||
@@ -0,0 +1,28 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
man_MANS = weechat-curses.1
|
||||
|
||||
info_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \
|
||||
weechat_doc_es.texi weechat_doc_pt.texi
|
||||
|
||||
#weechat_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \
|
||||
# weechat_doc_es.texi weechat_doc_pt.texi
|
||||
|
||||
AM_MAKEINFOHTMLFLAGS = --no-split --number-sections
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
@@ -1,10 +1,10 @@
|
||||
.TH WEECHAT 1 "February 2004" "FlashCode"
|
||||
.TH WEECHAT 1 "November 2005" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat \- Wee Enhanced Environment for Chat
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B weechat
|
||||
.B weechat-curses
|
||||
.RI [ options... ]
|
||||
or
|
||||
.RI [ url... ]
|
||||
@@ -19,30 +19,54 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a, \-\-no\-connect
|
||||
.br
|
||||
disable auto-connect to servers at startup
|
||||
.TP
|
||||
.B \-c, \-\-config
|
||||
.br
|
||||
display config file help (list of options)
|
||||
.TP
|
||||
.B \-f, \-\-key\-functions
|
||||
.br
|
||||
display internal functions for keys
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
.br
|
||||
display summary of options
|
||||
.TP
|
||||
.B \-i, \-\-irc\-commands
|
||||
.br
|
||||
display IRC commands
|
||||
.TP
|
||||
.B \-k, \-\-keys
|
||||
.br
|
||||
display default keys
|
||||
.TP
|
||||
.B \-l, \-\-license
|
||||
.br
|
||||
display program license
|
||||
.TP
|
||||
.B \-p, \-\-no\-plugin
|
||||
.br
|
||||
don't load any plugin at startup
|
||||
.TP
|
||||
.B \-v, \-\-version
|
||||
.br
|
||||
display WeeChat version
|
||||
.TP
|
||||
.B \-w, \-\-weechat\-commands
|
||||
.br
|
||||
display WeeChat commands
|
||||
|
||||
.SH URL
|
||||
WeeChat can use an URL (Uniform Resource Locator) to automatically connect
|
||||
to an IRC server. These are in the following form:
|
||||
.TP
|
||||
.B irc://[[nickname][:password]@]server[:port][/[#&+!]channel]
|
||||
.B irc[6][s]://[[nickname][:password]@]server[:port][/[#&+!]channel[,channel...]]
|
||||
.TP
|
||||
Exemple to join WeeChat channel support:
|
||||
irc://irc.freenode.net/weechat
|
||||
Exemple to join WeeChat channel support with nick "FlashCode":
|
||||
irc://FlashCode@irc.freenode.net/weechat
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
@@ -53,11 +77,7 @@ configuration file for WeeChat
|
||||
WeeChat log file
|
||||
|
||||
.SH AUTHOR
|
||||
WeeChat is written by:
|
||||
.br
|
||||
- FlashCode <flashcode@flashtux.org>
|
||||
- Bounga <bounga@altern.org>
|
||||
- Xahlexx <xahlexx@tuxisland.org>
|
||||
WeeChat is written by FlashCode <flashcode@flashtux.org>
|
||||
.br
|
||||
WeeChat on the web:
|
||||
.UR
|
||||
+2192
-235
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2236
-237
File diff suppressed because it is too large
Load Diff
+2390
-134
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+23
-7
@@ -1,28 +1,44 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc.h
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/irc/irc-dcc.c
|
||||
./src/irc/irc-ignore.c
|
||||
./src/irc/irc.h
|
||||
./src/plugins/plugins.c
|
||||
./src/plugins/plugins.h
|
||||
./src/plugins/plugins-config.c
|
||||
./src/plugins/plugins-config.h
|
||||
./src/plugins/plugins-interface.c
|
||||
./src/plugins/weechat-plugin.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.h
|
||||
./src/gui/gui-action.c
|
||||
./src/gui/gui-common.c
|
||||
./src/gui/gui-keyboard.c
|
||||
./src/gui/gui.h
|
||||
./src/common/command.c
|
||||
./src/common/completion.c
|
||||
./src/common/history.c
|
||||
./src/common/weechat.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/utf8.c
|
||||
./src/common/utf8.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
|
||||
|
||||
+2857
-1276
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
|
||||
+13
-3
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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,7 +15,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GNUTLS_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_main.a
|
||||
|
||||
@@ -25,7 +25,17 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
command.h \
|
||||
completion.c \
|
||||
completion.h \
|
||||
weelist.c \
|
||||
weelist.h \
|
||||
weeconfig.c \
|
||||
weeconfig.h \
|
||||
history.c \
|
||||
history.h
|
||||
history.h \
|
||||
hotlist.c \
|
||||
hotlist.h \
|
||||
log.c \
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h \
|
||||
utf8.c \
|
||||
utf8.h
|
||||
|
||||
+1788
-593
File diff suppressed because it is too large
Load Diff
+21
-15
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -21,7 +21,9 @@
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
@@ -48,33 +50,37 @@ struct t_weechat_alias
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
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_weechat_command weechat_commands[];
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_index_command *index_commands;
|
||||
extern t_weelist *index_commands;
|
||||
extern t_weelist *last_index_command;
|
||||
|
||||
extern t_index_command *index_command_search (char *);
|
||||
extern t_index_command *index_command_new (char *);
|
||||
extern void index_command_build ();
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
extern void free_exploded_string (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_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 void weechat_cmd_ignore_display (char *, t_irc_ignore *);
|
||||
extern int weechat_cmd_ignore (int, char **);
|
||||
extern int weechat_cmd_key (char *);
|
||||
extern int weechat_cmd_plugin (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_unignore (int, char **);
|
||||
extern int weechat_cmd_uptime (int, char **);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
||||
+967
-73
File diff suppressed because it is too large
Load Diff
+26
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -21,16 +21,35 @@
|
||||
#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
|
||||
{
|
||||
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) */
|
||||
/* 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 */
|
||||
char *args; /* command line args (including base word) */
|
||||
|
||||
/* 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) */
|
||||
int diff_length; /* length difference (<= diff_size) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* 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_buffer = (gui_current_window->buffer->has_input) ? gui_current_window->buffer : gui_buffers;
|
||||
ptr_server = SERVER(ptr_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_msg = strstr (text, " *");
|
||||
if (!pos_msg)
|
||||
{
|
||||
irc_display_prefix (NULL, 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, 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, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s channel \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, pos + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
else
|
||||
ptr_buffer = gui_buffers;
|
||||
}
|
||||
|
||||
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,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -18,17 +18,13 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_PERL_H
|
||||
#define __WEECHAT_PERL_H 1
|
||||
#ifndef __WEECHAT_FIFO_H
|
||||
#define __WEECHAT_FIFO_H 1
|
||||
|
||||
#include "../plugins.h"
|
||||
extern int weechat_fifo;
|
||||
|
||||
extern void wee_perl_init ();
|
||||
extern t_plugin_script *wee_perl_search (char *);
|
||||
extern int wee_perl_exec (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 ();
|
||||
extern void fifo_create ();
|
||||
extern void fifo_read ();
|
||||
extern void fifo_remove ();
|
||||
|
||||
#endif /* wee-perl.h */
|
||||
#endif /* fifo.h */
|
||||
+134
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
/* history.c: memorize commands or text */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -29,39 +29,157 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
t_history *history_global = NULL;
|
||||
t_history *history_global_last = NULL;
|
||||
t_history *history_global_ptr = NULL;
|
||||
int num_history_global = 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 *window, char *string)
|
||||
history_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history;
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
/* add history to global 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);
|
||||
|
||||
/* add history to general history */
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
new_history->next_history = history_general;
|
||||
if (history_global)
|
||||
history_global->prev_history = new_history;
|
||||
else
|
||||
history_global_last = new_history;
|
||||
new_history->next_history = history_global;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
history_global = new_history;
|
||||
num_history_global++;
|
||||
|
||||
/* 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;
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (num_history_global > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = history_global_last->prev_history;
|
||||
history_global_last->prev_history->next_history = NULL;
|
||||
if (history_global_last->text)
|
||||
free (history_global_last->text);
|
||||
free (history_global_last);
|
||||
history_global_last = ptr_history;
|
||||
num_history_global--;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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_window *)window)->history = new_history;
|
||||
((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_global_free: free global history
|
||||
*/
|
||||
|
||||
void
|
||||
history_global_free ()
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (history_global)
|
||||
{
|
||||
ptr_history = history_global->next_history;
|
||||
if (history_global->text)
|
||||
free (history_global->text);
|
||||
free (history_global);
|
||||
history_global = ptr_history;
|
||||
}
|
||||
history_global = NULL;
|
||||
history_global_last = NULL;
|
||||
history_global_ptr = NULL;
|
||||
num_history_global = 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,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -30,6 +30,12 @@ struct t_history
|
||||
t_history *prev_history; /* link to previous text/command */
|
||||
};
|
||||
|
||||
extern t_history *history_global;
|
||||
extern t_history *history_global_last;
|
||||
extern t_history *history_global_ptr;
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_global_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,50 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#define HOTLIST_LOW 0
|
||||
#define HOTLIST_MSG 1
|
||||
#define HOTLIST_PRIVATE 2
|
||||
#define HOTLIST_HIGHLIGHT 3
|
||||
|
||||
typedef struct t_weechat_hotlist t_weechat_hotlist;
|
||||
|
||||
struct t_weechat_hotlist
|
||||
{
|
||||
int priority; /* 0=crappy msg (join/part), 1=msg, */
|
||||
/* 2=pv, 3=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,177 @@
|
||||
/*
|
||||
* 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_line: writes a line to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write_line (t_gui_buffer *buffer, char *message)
|
||||
{
|
||||
char *msg_no_color;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
|
||||
log_write_date (buffer);
|
||||
fprintf (buffer->log_file, "%s\n",
|
||||
(msg_no_color) ? msg_no_color : message);
|
||||
fflush (buffer->log_file);
|
||||
if (msg_no_color)
|
||||
free (msg_no_color);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write: writes a message to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write (t_gui_buffer *buffer, char *message)
|
||||
{
|
||||
char *msg_no_color;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
|
||||
fprintf (buffer->log_file, "%s",
|
||||
(msg_no_color) ? msg_no_color : message);
|
||||
fflush (buffer->log_file);
|
||||
if (msg_no_color)
|
||||
free (msg_no_color);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -18,17 +18,16 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_PERL_H
|
||||
#define __WEECHAT_PERL_H 1
|
||||
#ifndef __WEECHAT_LOG_H
|
||||
#define __WEECHAT_LOG_H 1
|
||||
|
||||
#include "../plugins.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
extern void wee_perl_init ();
|
||||
extern t_plugin_script *wee_perl_search (char *);
|
||||
extern int wee_perl_exec (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 ();
|
||||
extern void log_write_date (t_gui_buffer *);
|
||||
extern void log_write_line (t_gui_buffer *, char *);
|
||||
extern void log_write (t_gui_buffer *, char *);
|
||||
extern void log_start (t_gui_buffer *);
|
||||
extern void log_end (t_gui_buffer *);
|
||||
|
||||
#endif /* wee-perl.h */
|
||||
#endif /* log.h */
|
||||
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* utf8.c: UTF-8 string functions for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "utf8.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
int local_utf8 = 0;
|
||||
|
||||
|
||||
/*
|
||||
* utf8_init: initializes UTF-8 in WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
utf8_init ()
|
||||
{
|
||||
local_utf8 = 0;
|
||||
|
||||
if (cfg_look_charset_internal && cfg_look_charset_internal[0])
|
||||
{
|
||||
if (strstr (cfg_look_charset_internal, "UTF-8")
|
||||
|| strstr (cfg_look_charset_internal, "utf-8"))
|
||||
local_utf8 = 1;
|
||||
}
|
||||
else if ((local_charset)
|
||||
&& ((strstr (local_charset, "UTF-8")
|
||||
|| strstr (local_charset, "utf-8"))))
|
||||
local_utf8 = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_is_valid: return 1 if UTF-8 string is valid, 0 otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_is_valid (char *string)
|
||||
{
|
||||
while (string[0])
|
||||
{
|
||||
/* UTF-8, 2 bytes, should be: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
if (!string[1] || (((unsigned char)(string[1]) & 0xC0) != 0x80))
|
||||
return 0;
|
||||
string += 2;
|
||||
}
|
||||
/* UTF-8, 3 bytes, should be: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF0) == 0xE0)
|
||||
{
|
||||
if (!string[1] || !string[2]
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80))
|
||||
return 0;
|
||||
string += 3;
|
||||
}
|
||||
/* UTF-8, 4 bytes, should be: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF8) == 0xF0)
|
||||
{
|
||||
if (!string[1] || !string[2] || !string[3]
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[3]) & 0xC0) != 0x80))
|
||||
return 0;
|
||||
string += 4;
|
||||
}
|
||||
/* UTF-8, 1 byte, should be: 0vvvvvvv */
|
||||
else if ((unsigned char)(string[0]) >= 0x80)
|
||||
return 0;
|
||||
else
|
||||
string++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_prev_char: return previous UTF-8 char in a string
|
||||
*/
|
||||
|
||||
char *
|
||||
utf8_prev_char (char *string_start, char *string)
|
||||
{
|
||||
if (!string || (string <= string_start))
|
||||
return NULL;
|
||||
|
||||
string--;
|
||||
|
||||
if (!local_utf8)
|
||||
return string;
|
||||
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, at least 2 bytes */
|
||||
string--;
|
||||
if (string < string_start)
|
||||
return string + 1;
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, at least 3 bytes */
|
||||
string--;
|
||||
if (string < string_start)
|
||||
return string + 1;
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, 4 bytes */
|
||||
string--;
|
||||
if (string < string_start)
|
||||
return string + 1;
|
||||
return string;
|
||||
}
|
||||
else
|
||||
return string;
|
||||
}
|
||||
else
|
||||
return string;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_next_char: return next UTF-8 char in a string
|
||||
*/
|
||||
|
||||
char *
|
||||
utf8_next_char (char *string)
|
||||
{
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + 1;
|
||||
|
||||
/* UTF-8, 2 bytes: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
if (!string[1])
|
||||
return string + 1;
|
||||
return string + 2;
|
||||
}
|
||||
/* UTF-8, 3 bytes: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF0) == 0xE0)
|
||||
{
|
||||
if (!string[1])
|
||||
return string + 1;
|
||||
if (!string[2])
|
||||
return string + 2;
|
||||
return string + 3;
|
||||
}
|
||||
/* UTF-8, 4 bytes: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF8) == 0xF0)
|
||||
{
|
||||
if (!string[1])
|
||||
return string + 1;
|
||||
if (!string[2])
|
||||
return string + 2;
|
||||
if (!string[3])
|
||||
return string + 3;
|
||||
return string + 4;
|
||||
}
|
||||
/* UTF-8, 1 byte: 0vvvvvvv */
|
||||
return string + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_char_size: return UTF-8 char size
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_char_size (char *string)
|
||||
{
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
return utf8_next_char (string) - string;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_strlen: return length of an UTF-8 string (<= strlen(string))
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_strlen (char *string)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
return strlen (string);
|
||||
|
||||
length = 0;
|
||||
while (string[0])
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_strlen: return length of an UTF-8 string, for N bytes
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_strnlen (char *string, int bytes)
|
||||
{
|
||||
char *start;
|
||||
int length;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
{
|
||||
length = strlen (string);
|
||||
if (bytes > length)
|
||||
return length;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
start = string;
|
||||
length = 0;
|
||||
while (string[0] && (string - start < bytes))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_add_offset: moves forward N chars in an UTF-8 string
|
||||
*/
|
||||
|
||||
char *
|
||||
utf8_add_offset (char *string, int offset)
|
||||
{
|
||||
int count;
|
||||
|
||||
if (!string)
|
||||
return string;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + offset;
|
||||
|
||||
count = 0;
|
||||
while (string[0] && (count < offset))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_real_pos: get real position in UTF-8
|
||||
* for example: ("aébc", 2) returns 3
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_real_pos (char *string, int pos)
|
||||
{
|
||||
int count, real_pos;
|
||||
char *next_char;
|
||||
|
||||
if (!string || !local_utf8)
|
||||
return pos;
|
||||
|
||||
count = 0;
|
||||
real_pos = 0;
|
||||
while (string[0] && (count < pos))
|
||||
{
|
||||
next_char = utf8_next_char (string);
|
||||
real_pos += (next_char - string);
|
||||
string = next_char;
|
||||
count++;
|
||||
}
|
||||
return real_pos;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_pos: get position in UTF-8
|
||||
* for example: ("aébc", 3) returns 2
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_pos (char *string, int real_pos)
|
||||
{
|
||||
int count;
|
||||
char *limit;
|
||||
|
||||
if (!string || !local_charset)
|
||||
return real_pos;
|
||||
|
||||
count = 0;
|
||||
limit = string + real_pos;
|
||||
while (string[0] && (string < limit))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -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_UTF8_H
|
||||
#define __WEECHAT_UTF8_H 1
|
||||
|
||||
extern int local_utf8;
|
||||
|
||||
extern void utf8_init ();
|
||||
extern int utf8_is_valid (char *);
|
||||
extern char *utf8_prev_char (char *, char *);
|
||||
extern char *utf8_next_char (char *);
|
||||
extern int utf8_char_size (char *);
|
||||
extern int utf8_strlen (char *);
|
||||
extern int utf8_strnlen (char *, int);
|
||||
extern char *utf8_add_offset (char *, int);
|
||||
extern int utf8_real_pos (char *, int);
|
||||
extern int utf8_pos (char *, int);
|
||||
|
||||
#endif /* utf8.h */
|
||||
+541
-101
@@ -8,15 +8,13 @@
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By: FlashCode <flashcode@flashtux.org> ###
|
||||
* ### Bounga <bounga@altern.org> ###
|
||||
* ### Xahlexx <xahlexx@tuxisland.org> ###
|
||||
* ### By FlashCode <flashcode@flashtux.org> ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -50,30 +48,118 @@
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
|
||||
#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 "utf8.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
#include "../plugins/plugins.h"
|
||||
#endif
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *log_file; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
time_t weechat_start_time; /* WeeChat start time (used by /uptime command) */
|
||||
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) */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1, UTF-8 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
int auto_connect; /* enabled by default, can by disabled on cmd line */
|
||||
int auto_load_plugins; /* enabled by default, can by disabled on cmd line */
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
* ascii_strcasecmp: locale and case independent string comparison
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
int
|
||||
ascii_strcasecmp (char *string1, char *string2)
|
||||
{
|
||||
/* do nothing */
|
||||
int c1, c2;
|
||||
|
||||
if (!string1 || !string2)
|
||||
return (string1) ? 1 : ((string2) ? -1 : 0);
|
||||
|
||||
while (string1[0] && string2[0])
|
||||
{
|
||||
c1 = (int)((unsigned char) string1[0]);
|
||||
c2 = (int)((unsigned char) string2[0]);
|
||||
|
||||
if ((c1 >= 'A') && (c1 <= 'Z'))
|
||||
c1 += ('a' - 'A');
|
||||
|
||||
if ((c2 >= 'A') && (c2 <= 'Z'))
|
||||
c2 += ('a' - 'A');
|
||||
|
||||
if ((c1 - c2) != 0)
|
||||
return c1 - c2;
|
||||
|
||||
string1++;
|
||||
string2++;
|
||||
}
|
||||
|
||||
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ascii_strncasecmp: locale and case independent string comparison
|
||||
* with max length
|
||||
*/
|
||||
|
||||
int
|
||||
ascii_strncasecmp (char *string1, char *string2, int max)
|
||||
{
|
||||
int c1, c2, count;
|
||||
|
||||
if (!string1 || !string2)
|
||||
return (string1) ? 1 : ((string2) ? -1 : 0);
|
||||
|
||||
count = 0;
|
||||
while ((count < max) && string1[0] && string2[0])
|
||||
{
|
||||
c1 = (int)((unsigned char) string1[0]);
|
||||
c2 = (int)((unsigned char) string2[0]);
|
||||
|
||||
if ((c1 >= 'A') && (c1 <= 'Z'))
|
||||
c1 += ('a' - 'A');
|
||||
|
||||
if ((c2 >= 'A') && (c2 <= 'Z'))
|
||||
c2 += ('a' - 'A');
|
||||
|
||||
if ((c1 - c2) != 0)
|
||||
return c1 - c2;
|
||||
|
||||
string1++;
|
||||
string2++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= max)
|
||||
return 0;
|
||||
else
|
||||
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -84,27 +170,112 @@ void
|
||||
wee_log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
char *ptr_buffer;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (!log_file)
|
||||
if (!weechat_log_file)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
/* keep only valid chars */
|
||||
ptr_buffer = buffer;
|
||||
while (ptr_buffer[0])
|
||||
{
|
||||
if ((ptr_buffer[0] != '\n')
|
||||
&& (ptr_buffer[0] != '\r')
|
||||
&& ((unsigned char)(ptr_buffer[0]) < 32))
|
||||
ptr_buffer[0] = '.';
|
||||
ptr_buffer++;
|
||||
}
|
||||
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
fprintf (log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
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 (log_file, "[????-??-?? ??:??:??] %s", buffer);
|
||||
fflush (log_file);
|
||||
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]
|
||||
&& (ascii_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));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -169,8 +340,9 @@ void wee_display_config_options ()
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
}
|
||||
printf (_(" . description: %s\n\n"),
|
||||
gettext (weechat_options[i][j].long_description));
|
||||
printf (_(" . description: %s\n"),
|
||||
_(weechat_options[i][j].long_description));
|
||||
printf ("\n");
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -180,6 +352,102 @@ void wee_display_config_options ()
|
||||
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_display_key_functions: display WeeChat key functions
|
||||
*/
|
||||
|
||||
void wee_display_key_functions ()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf (_("Internal key functions:\n"));
|
||||
printf ("\n");
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
printf ("* %s: %s\n",
|
||||
gui_key_functions[i].function_name,
|
||||
_(gui_key_functions[i].description));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_keys: display WeeChat default keys
|
||||
*/
|
||||
|
||||
void
|
||||
wee_display_keys ()
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name;
|
||||
|
||||
printf (_("%s default keys:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_key_get_expanded_name (ptr_key->key);
|
||||
printf ("* %s => %s\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
(ptr_key->function) ? gui_key_function_search_by_ptr (ptr_key->function) : ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
*/
|
||||
@@ -191,35 +459,67 @@ wee_parse_args (int argc, char *argv[])
|
||||
t_irc_server server_tmp;
|
||||
|
||||
server_cmd_line = 0;
|
||||
auto_connect = 1;
|
||||
auto_load_plugins = 1;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if ((strcmp (argv[i], "-c") == 0)
|
||||
if ((strcmp (argv[i], "-a") == 0)
|
||||
|| (strcmp (argv[i], "--no-connect") == 0))
|
||||
auto_connect = 0;
|
||||
else if ((strcmp (argv[i], "-c") == 0)
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-f") == 0)
|
||||
|| (strcmp (argv[i], "--key-functions") == 0))
|
||||
{
|
||||
wee_display_key_functions ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-i") == 0)
|
||||
|| (strcmp (argv[i], "--irc-commands") == 0))
|
||||
{
|
||||
wee_display_commands (0, 1);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-k") == 0)
|
||||
|| (strcmp (argv[i], "--keys") == 0))
|
||||
{
|
||||
wee_display_keys ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-p") == 0)
|
||||
|| (strcmp (argv[i], "--no-plugin") == 0))
|
||||
auto_load_plugins = 0;
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
else if ((strcmp (argv[i], "-w") == 0)
|
||||
|| (strcmp (argv[i], "--weechat-commands") == 0))
|
||||
{
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0))
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
{
|
||||
@@ -228,11 +528,14 @@ wee_parse_args (int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!server_new (server_tmp.name, 0, 1,
|
||||
server_tmp.address, server_tmp.port,
|
||||
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.ipv6, server_tmp.ssl,
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, server_tmp.autojoin))
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
@@ -290,7 +593,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
@@ -299,7 +602,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
@@ -309,50 +612,21 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
dir_name = (char *) malloc (dir_length * sizeof (char));
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
/* create "~/.weechat/perl" */
|
||||
/* create "~/.weechat/logs" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"perl");
|
||||
if (wee_create_dir (dir_name))
|
||||
"logs");
|
||||
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);
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
#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
|
||||
chmod (dir_name, 0700);
|
||||
|
||||
free (dir_name);
|
||||
}
|
||||
@@ -364,12 +638,19 @@ wee_create_home_dirs ()
|
||||
void
|
||||
wee_init_vars ()
|
||||
{
|
||||
/* GUI not yet initialized */
|
||||
gui_ready = 0;
|
||||
|
||||
/* start time, used by /uptime command */
|
||||
weechat_start_time = time (NULL);
|
||||
|
||||
/* init received messages queue */
|
||||
recv_msgq = NULL;
|
||||
msgq_last_msg = NULL;
|
||||
|
||||
/* init gnutls */
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_global_init ();
|
||||
gnutls_certificate_allocate_credentials (&gnutls_xcred);
|
||||
gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -386,7 +667,7 @@ wee_init_log ()
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
snprintf (filename, filename_length, "%s/" WEECHAT_LOG_NAME, weechat_home);
|
||||
if ((log_file = fopen (filename, "wt")) == NULL)
|
||||
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);
|
||||
@@ -402,35 +683,57 @@ weechat_welcome_message ()
|
||||
{
|
||||
if (cfg_look_startup_logo)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
" ___ __ ______________ _____ \n"
|
||||
" __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
|
||||
gui_printf (NULL,
|
||||
"%s ___ __ ______________ _____ \n"
|
||||
"%s __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
"%s __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
"%s __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
"%s ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK));
|
||||
}
|
||||
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);
|
||||
gui_printf (NULL, _("%sWelcome to %s%s%s, %s\n"),
|
||||
(cfg_look_startup_logo) ? " " : "",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
PACKAGE_NAME,
|
||||
GUI_NO_COLOR,
|
||||
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__);
|
||||
gui_printf (NULL, "%s%s%s%s, %s %s %s\n",
|
||||
(cfg_look_startup_logo) ? " " : "",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
PACKAGE_STRING,
|
||||
GUI_NO_COLOR,
|
||||
_("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");
|
||||
gui_printf (NULL,
|
||||
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK));
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -438,13 +741,134 @@ weechat_welcome_message ()
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown ()
|
||||
wee_shutdown (int return_code, int crash)
|
||||
{
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
if (log_file)
|
||||
fclose (log_file);
|
||||
exit (EXIT_SUCCESS);
|
||||
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 ();
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_certificate_free_credentials (gnutls_xcred);
|
||||
gnutls_global_deinit();
|
||||
#endif
|
||||
|
||||
if (crash)
|
||||
abort();
|
||||
else
|
||||
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");
|
||||
ignore_print_log ();
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
wee_log_printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -460,13 +884,21 @@ main (int argc, char *argv[])
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#endif
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE 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 */
|
||||
gui_key_init (); /* init keyboard (default key bindings) */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
index_command_build (); /* build commands index for completion */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
@@ -483,18 +915,26 @@ main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_init (); /* init WeeChat interface */
|
||||
plugin_init (); /* init plugin interface(s) */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (auto_load_plugins);/* init plugin interface(s) */
|
||||
#endif
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (server_cmd_line);
|
||||
server_auto_connect (auto_connect, server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
#ifdef PLUGINS
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
#endif
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
wee_shutdown (); /* quit WeeChat (oh no, why?) */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
|
||||
+45
-20
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -26,10 +26,19 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_NLS) && !defined(_)
|
||||
#include <locale.h>
|
||||
#include <libintl.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)
|
||||
@@ -43,11 +52,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define WEECHAT_COPYRIGHT PACKAGE_NAME " (c) 2004 by Wee Team"
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(PACKAGE_NAME " Warning:")
|
||||
#define WEECHAT_ERROR _("WeeChat Error:")
|
||||
#define WEECHAT_WARNING _("WeeChat Warning:")
|
||||
|
||||
/* log file */
|
||||
|
||||
@@ -56,11 +65,8 @@
|
||||
/* license */
|
||||
|
||||
#define WEE_LICENSE \
|
||||
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@tuxisland.org>\n" \
|
||||
"Website: " WEECHAT_WEBSITE "\n\n" \
|
||||
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" \
|
||||
@@ -77,31 +83,50 @@
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode, Bounga and Xahlexx - " WEECHAT_WEBSITE "\n\n" \
|
||||
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"
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -c, --config config file help (list of options)\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n\n"
|
||||
" -a, --no-connect disable auto-connect to servers at startup\n" \
|
||||
" -c, --config display config file options\n" \
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n" \
|
||||
" -h, --help this help\n" \
|
||||
" -i, --irc-commands display IRC commands\n" \
|
||||
" -k, --keys display WeeChat default keys\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -p, --no-plugin don't load any plugin at startup\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 "\\"
|
||||
#define DIR_SEPARATOR_CHAR '\\'
|
||||
#else
|
||||
#define DIR_SEPARATOR "/"
|
||||
#define DIR_SEPARATOR "/"
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#endif
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern time_t weechat_start_time;
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
extern gnutls_certificate_credentials gnutls_xcred;
|
||||
#endif
|
||||
|
||||
extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown ();
|
||||
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, int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
+1054
-210
File diff suppressed because it is too large
Load Diff
+90
-15
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -21,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
|
||||
@@ -28,11 +30,15 @@
|
||||
#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_ALIAS 6
|
||||
#define CONFIG_SECTION_SERVER 7
|
||||
#define CONFIG_NUMBER_SECTIONS 8
|
||||
#define CONFIG_SECTION_IRC 4
|
||||
#define CONFIG_SECTION_DCC 5
|
||||
#define CONFIG_SECTION_PROXY 6
|
||||
#define CONFIG_SECTION_PLUGINS 7
|
||||
#define CONFIG_SECTION_KEYS 8
|
||||
#define CONFIG_SECTION_ALIAS 9
|
||||
#define CONFIG_SECTION_IGNORE 10
|
||||
#define CONFIG_SECTION_SERVER 11
|
||||
#define CONFIG_NUMBER_SECTIONS 12
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -77,9 +83,15 @@ 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_iso;
|
||||
extern char *cfg_look_charset_decode_utf;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_one_server_buffer;
|
||||
extern char *cfg_look_buffer_timestamp;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_nicks_number;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
extern int cfg_look_nicklist;
|
||||
extern int cfg_look_nicklist_position;
|
||||
extern int cfg_look_nicklist_min_size;
|
||||
@@ -88,10 +100,18 @@ extern int cfg_look_nickmode;
|
||||
extern int cfg_look_nickmode_empty;
|
||||
extern char *cfg_look_no_nickname;
|
||||
extern char *cfg_look_completor;
|
||||
extern char *cfg_look_nick_completion_ignore;
|
||||
extern int cfg_look_infobar;
|
||||
extern char *cfg_look_infobar_timestamp;
|
||||
extern int cfg_look_infobar_seconds;
|
||||
extern int cfg_look_infobar_delay_highlight;
|
||||
extern int cfg_look_hotlist_names_count;
|
||||
extern int cfg_look_hotlist_names_level;
|
||||
extern int cfg_look_hotlist_names_length;
|
||||
extern int cfg_look_day_change;
|
||||
extern char *cfg_look_day_change_timestamp;
|
||||
|
||||
extern int cfg_col_real_white;
|
||||
extern int cfg_col_title;
|
||||
extern int cfg_col_title_bg;
|
||||
extern int cfg_col_chat;
|
||||
@@ -99,6 +119,9 @@ extern int cfg_col_chat_time;
|
||||
extern int cfg_col_chat_time_sep;
|
||||
extern int cfg_col_chat_prefix1;
|
||||
extern int cfg_col_chat_prefix2;
|
||||
extern int cfg_col_chat_server;
|
||||
extern int cfg_col_chat_join;
|
||||
extern int cfg_col_chat_part;
|
||||
extern int cfg_col_chat_nick;
|
||||
extern int cfg_col_chat_host;
|
||||
extern int cfg_col_chat_channel;
|
||||
@@ -106,64 +129,116 @@ 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_channel;
|
||||
extern int cfg_col_status_data_msg;
|
||||
extern int cfg_col_status_data_private;
|
||||
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_delimiters;
|
||||
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_delimiters;
|
||||
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_colors[COLOR_WIN_NICK_NUMBER];
|
||||
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_notice_as_pv;
|
||||
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 char *cfg_irc_highlight;
|
||||
extern int cfg_irc_colors_receive;
|
||||
extern int cfg_irc_colors_send;
|
||||
|
||||
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_port_range;
|
||||
extern char *cfg_dcc_own_ip;
|
||||
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;
|
||||
|
||||
extern int cfg_proxy_use;
|
||||
extern int cfg_proxy_type;
|
||||
extern char *cfg_proxy_type_values[];
|
||||
extern int cfg_proxy_ipv6;
|
||||
extern char *cfg_proxy_address;
|
||||
extern int cfg_proxy_port;
|
||||
extern char *cfg_proxy_username;
|
||||
extern char *cfg_proxy_password;
|
||||
|
||||
extern char *cfg_plugins_path;
|
||||
extern char *cfg_plugins_autoload;
|
||||
extern char *cfg_plugins_extension;
|
||||
|
||||
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_windows ();
|
||||
extern void config_change_window_content ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_charset ();
|
||||
extern void config_change_one_server_buffer ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_nicks_colors ();
|
||||
extern void config_change_away_check ();
|
||||
extern void config_change_fifo_pipe ();
|
||||
extern void config_change_notify_levels ();
|
||||
extern void config_change_log ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern void config_option_search_option_value (char *, t_config_option **, void **);
|
||||
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 int config_write ();
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* 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 (ascii_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 (ascii_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;
|
||||
|
||||
if (!element)
|
||||
return;
|
||||
|
||||
/* 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 */
|
||||
+16
-3
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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,10 +15,23 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
if GUI_CURSES
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_gui_common.a
|
||||
|
||||
lib_weechat_gui_common_a_SOURCES = gui-common.c \
|
||||
gui-action.c \
|
||||
gui-keyboard.c \
|
||||
gui.h
|
||||
|
||||
if GUI_NCURSES
|
||||
curses_dir=curses
|
||||
endif
|
||||
|
||||
if GUI_WXWIDGETS
|
||||
wxwidgets_dir=wxwidgets
|
||||
endif
|
||||
|
||||
if GUI_GTK
|
||||
gtk_dir=gtk
|
||||
endif
|
||||
@@ -27,4 +40,4 @@ if GUI_QT
|
||||
qt_dir=qt
|
||||
endif
|
||||
|
||||
SUBDIRS = $(curses_dir) $(gtk_dir) $(qt_dir)
|
||||
SUBDIRS = . $(curses_dir) $(wxwidgets_dir) $(gtk_dir) $(qt_dir)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
@@ -19,12 +19,24 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
bin_PROGRAMS = weechat-curses
|
||||
|
||||
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
|
||||
if PLUGINS
|
||||
weechat_curses_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(CURSES_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
../../plugins/lib_weechat_plugins.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(NCURSES_LIBS) \
|
||||
$(GNUTLS_LFLAGS)
|
||||
else
|
||||
weechat_curses_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(NCURSES_LIBS) \
|
||||
$(GNUTLS_LFLAGS)
|
||||
endif
|
||||
|
||||
weechat_curses_SOURCES = ../gui.h \
|
||||
../gui-common.c \
|
||||
gui-display.c \
|
||||
gui-input.c
|
||||
weechat_curses_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
|
||||
+2825
-1199
File diff suppressed because it is too large
Load Diff
+356
-314
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -31,319 +31,252 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <curses.h>
|
||||
|
||||
#ifdef HAVE_NCURSESW_CURSES_H
|
||||
#include <ncursesw/ncurses.h>
|
||||
#else
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/fifo.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
#define KEY_ESCAPE 27
|
||||
|
||||
/*
|
||||
* gui_read_keyb: read keyboard line
|
||||
* gui_input_default_key_bindings: create default key bindings
|
||||
*/
|
||||
|
||||
void
|
||||
gui_read_keyb ()
|
||||
gui_input_default_key_bindings ()
|
||||
{
|
||||
int key, i;
|
||||
t_gui_window *ptr_window;
|
||||
char new_char[2];
|
||||
|
||||
key = getch ();
|
||||
if (key != ERR)
|
||||
int i;
|
||||
char key_str[32], command[32];
|
||||
|
||||
/* keys binded with internal functions */
|
||||
gui_key_bind ( /* RC */ "ctrl-M", "return");
|
||||
gui_key_bind ( /* RC */ "ctrl-J", "return");
|
||||
gui_key_bind ( /* tab */ "ctrl-I", "tab");
|
||||
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
|
||||
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
|
||||
gui_key_bind ( /* del */ "meta2-3~", "delete");
|
||||
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
|
||||
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
|
||||
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
|
||||
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
|
||||
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
|
||||
gui_key_bind ( /* home */ "meta2-1~", "home");
|
||||
gui_key_bind ( /* home */ "meta2-H", "home");
|
||||
gui_key_bind ( /* home */ "meta2-7~", "home");
|
||||
gui_key_bind ( /* ^A */ "ctrl-A", "home");
|
||||
gui_key_bind ( /* end */ "meta2-4~", "end");
|
||||
gui_key_bind ( /* end */ "meta2-F", "end");
|
||||
gui_key_bind ( /* end */ "meta2-8~", "end");
|
||||
gui_key_bind ( /* ^E */ "ctrl-E", "end");
|
||||
gui_key_bind ( /* left */ "meta2-D", "left");
|
||||
gui_key_bind ( /* right */ "meta2-C", "right");
|
||||
gui_key_bind ( /* up */ "meta2-A", "up");
|
||||
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
|
||||
gui_key_bind ( /* down */ "meta2-B", "down");
|
||||
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
|
||||
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
|
||||
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
|
||||
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
|
||||
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
|
||||
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
|
||||
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
|
||||
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
|
||||
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
|
||||
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
|
||||
gui_key_bind ( /* m-f */ "meta-f", "next_word");
|
||||
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
|
||||
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
|
||||
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
|
||||
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
|
||||
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
|
||||
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
|
||||
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
|
||||
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
|
||||
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
|
||||
/* keys binded with commands */
|
||||
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
|
||||
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
|
||||
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
|
||||
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
|
||||
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
|
||||
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
|
||||
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
|
||||
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
|
||||
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
|
||||
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
|
||||
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
|
||||
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
|
||||
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
|
||||
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
|
||||
|
||||
/* bind meta-j + {01..99} to switch to buffers # > 10 */
|
||||
for (i = 1; i < 100; i++)
|
||||
{
|
||||
switch (key)
|
||||
sprintf (key_str, "meta-j%02d", i);
|
||||
sprintf (command, "/buffer %d", i);
|
||||
gui_key_bind (key_str, command);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_key_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
/* resize event */
|
||||
case KEY_RESIZE:
|
||||
gui_redraw_window (gui_current_window);
|
||||
break;
|
||||
/* previous window */
|
||||
case KEY_F(6):
|
||||
gui_switch_to_previous_window ();
|
||||
break;
|
||||
/* next window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_next_window ();
|
||||
break;
|
||||
/* remove last infobar message */
|
||||
case KEY_F(10):
|
||||
gui_infobar_remove ();
|
||||
break;
|
||||
/* cursor up */
|
||||
case KEY_UP:
|
||||
if (gui_current_window->ptr_history)
|
||||
{
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->ptr_history->next_history;
|
||||
if (!gui_current_window->ptr_history)
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->history;
|
||||
}
|
||||
else
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->history;
|
||||
if (gui_current_window->ptr_history)
|
||||
{
|
||||
gui_current_window->input_buffer_size =
|
||||
strlen (gui_current_window->ptr_history->text);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
strcpy (gui_current_window->input_buffer,
|
||||
gui_current_window->ptr_history->text);
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* cursor down */
|
||||
case KEY_DOWN:
|
||||
if (gui_current_window->ptr_history)
|
||||
{
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->ptr_history->prev_history;
|
||||
if (gui_current_window->ptr_history)
|
||||
gui_current_window->input_buffer_size =
|
||||
strlen (gui_current_window->ptr_history->text);
|
||||
else
|
||||
gui_current_window->input_buffer_size = 0;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
if (gui_current_window->ptr_history)
|
||||
strcpy (gui_current_window->input_buffer,
|
||||
gui_current_window->ptr_history->text);
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* cursor left */
|
||||
case KEY_LEFT:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
{
|
||||
gui_current_window->input_buffer_pos--;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* cursor right */
|
||||
case KEY_RIGHT:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
{
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* home key */
|
||||
case KEY_HOME:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
{
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* end key */
|
||||
case KEY_END:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
{
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* page up */
|
||||
case KEY_PPAGE:
|
||||
gui_move_page_up ();
|
||||
break;
|
||||
/* page down */
|
||||
case KEY_NPAGE:
|
||||
gui_move_page_down ();
|
||||
break;
|
||||
/* erase before cursor and move cursor to the left */
|
||||
case 127:
|
||||
case KEY_BACKSPACE:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos-1;
|
||||
while (gui_current_window->input_buffer[i])
|
||||
{
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i+1];
|
||||
i++;
|
||||
}
|
||||
gui_current_window->input_buffer_size--;
|
||||
gui_current_window->input_buffer_pos--;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
}
|
||||
break;
|
||||
/* Control + Backspace */
|
||||
case 0x08:
|
||||
gui_delete_previous_word ();
|
||||
break;
|
||||
/* erase char under cursor */
|
||||
case KEY_DC:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos;
|
||||
while (gui_current_window->input_buffer[i])
|
||||
{
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i+1];
|
||||
i++;
|
||||
}
|
||||
gui_current_window->input_buffer_size--;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
}
|
||||
break;
|
||||
/* Tab : completion */
|
||||
case '\t':
|
||||
completion_search (&(gui_current_window->completion),
|
||||
CHANNEL(gui_current_window),
|
||||
gui_current_window->input_buffer,
|
||||
gui_current_window->input_buffer_size,
|
||||
gui_current_window->input_buffer_pos);
|
||||
if (gui_current_window->completion.word_found)
|
||||
{
|
||||
// replace word with new completed word into input buffer
|
||||
gui_current_window->input_buffer_size +=
|
||||
gui_current_window->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
|
||||
if (gui_current_window->completion.diff_size > 0)
|
||||
{
|
||||
for (i = gui_current_window->input_buffer_size - 1;
|
||||
i >= gui_current_window->completion.position_replace +
|
||||
(int)strlen (gui_current_window->completion.word_found); i--)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i -
|
||||
gui_current_window->completion.diff_size];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = gui_current_window->completion.position_replace +
|
||||
strlen (gui_current_window->completion.word_found);
|
||||
i < gui_current_window->input_buffer_size; i++)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i -
|
||||
gui_current_window->completion.diff_size];
|
||||
}
|
||||
|
||||
strncpy (gui_current_window->input_buffer + gui_current_window->completion.position_replace,
|
||||
gui_current_window->completion.word_found,
|
||||
strlen (gui_current_window->completion.word_found));
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->completion.position_replace +
|
||||
strlen (gui_current_window->completion.word_found);
|
||||
gui_current_window->completion.position =
|
||||
gui_current_window->input_buffer_pos;
|
||||
|
||||
/* add space or completor to the end of completion, if needed */
|
||||
if (gui_current_window->completion.base_word[0] == '/')
|
||||
{
|
||||
if (gui_current_window->input_buffer[gui_current_window->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (" ",
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position++;
|
||||
gui_current_window->input_buffer_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gui_current_window->completion.base_word_pos == 0)
|
||||
{
|
||||
if (strncmp (gui_current_window->input_buffer + gui_current_window->input_buffer_pos,
|
||||
cfg_look_completor, strlen (cfg_look_completor)) != 0)
|
||||
gui_buffer_insert_string (cfg_look_completor,
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->input_buffer[gui_current_window->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (" ",
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position++;
|
||||
gui_current_window->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
}
|
||||
break;
|
||||
/* escape code (for control-key) */
|
||||
case KEY_ESCAPE:
|
||||
if ((key = getch()) != ERR)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KEY_LEFT:
|
||||
gui_switch_to_previous_window ();
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
gui_switch_to_next_window ();
|
||||
break;
|
||||
case 79:
|
||||
/* TODO: replace 79 by constant name! */
|
||||
if (key == 79)
|
||||
{
|
||||
if ((key = getch()) != ERR)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
/* Control + Right */
|
||||
case 99:
|
||||
gui_move_next_word ();
|
||||
break;
|
||||
/* Control + Left */
|
||||
case 100:
|
||||
gui_move_previous_word ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* send command/message */
|
||||
case '\n':
|
||||
if (gui_current_window->input_buffer_size > 0)
|
||||
{
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
history_add (gui_current_window, gui_current_window->input_buffer);
|
||||
gui_current_window->input_buffer_size = 0;
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
gui_current_window->input_buffer_1st_display = 0;
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->ptr_history = NULL;
|
||||
ptr_window = gui_current_window;
|
||||
user_command (SERVER(gui_current_window),
|
||||
gui_current_window->input_buffer);
|
||||
if (ptr_window == gui_current_window)
|
||||
gui_draw_window_input (ptr_window);
|
||||
if (ptr_window)
|
||||
ptr_window->input_buffer[0] = '\0';
|
||||
}
|
||||
break;
|
||||
/* other key => add to input buffer */
|
||||
default:
|
||||
/*gui_printf (gui_current_window,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
new_char[0] = key;
|
||||
new_char[1] = '\0';
|
||||
gui_buffer_insert_string (new_char,
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
break;
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += strlen (expanded_key);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_read: read keyboard chars
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_read ()
|
||||
{
|
||||
int key, i, insert_ok;
|
||||
char key_str[32];
|
||||
|
||||
i = 0;
|
||||
/* do not loop too much here (for example when big paste was made),
|
||||
to read also socket & co */
|
||||
while (i < 8)
|
||||
{
|
||||
if (gui_key_grab && (gui_key_grab_count > 10))
|
||||
gui_input_grab_end ();
|
||||
|
||||
key = getch ();
|
||||
insert_ok = 1;
|
||||
|
||||
if (key == ERR)
|
||||
{
|
||||
if (gui_key_grab && (gui_key_grab_count > 0))
|
||||
gui_input_grab_end ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (key == KEY_RESIZE)
|
||||
{
|
||||
gui_refresh_screen ();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key < 32)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else if (key == 127)
|
||||
{
|
||||
key_str[0] = '^';
|
||||
key_str[1] = '?';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local_utf8)
|
||||
{
|
||||
/* 1 char: 0vvvvvvv */
|
||||
if (key < 0x80)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
/* 2 chars: 110vvvvv 10vvvvvv */
|
||||
else if ((key & 0xE0) == 0xC0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
/* 3 chars: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF0) == 0xE0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = '\0';
|
||||
}
|
||||
/* 4 chars: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF8) == 0xF0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = (char) (getch ());
|
||||
key_str[4] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp (key_str, "^") == 0)
|
||||
{
|
||||
key_str[1] = '^';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
|
||||
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
|
||||
|
||||
if ((gui_key_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
if (gui_current_window->buffer->dcc)
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
else
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (key_str);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,15 +288,24 @@ void
|
||||
gui_main_loop ()
|
||||
{
|
||||
fd_set read_fd;
|
||||
static struct timeval timeout;
|
||||
static struct timeval timeout, tv;
|
||||
static struct timezone tz;
|
||||
t_irc_server *ptr_server;
|
||||
int old_min, old_sec;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
int old_day, old_min, old_sec, diff;
|
||||
char text_time[1024];
|
||||
time_t new_time;
|
||||
struct tm *local_time;
|
||||
|
||||
quit_weechat = 0;
|
||||
|
||||
new_time = time (NULL);
|
||||
local_time = localtime (&new_time);
|
||||
old_day = local_time->tm_mday;
|
||||
|
||||
old_min = -1;
|
||||
old_sec = -1;
|
||||
check_away = 0;
|
||||
while (!quit_weechat)
|
||||
{
|
||||
new_time = time (NULL);
|
||||
@@ -373,48 +315,148 @@ gui_main_loop ()
|
||||
if (local_time->tm_min != old_min)
|
||||
{
|
||||
old_min = local_time->tm_min;
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
|
||||
if (cfg_look_day_change
|
||||
&& (local_time->tm_mday != old_day))
|
||||
{
|
||||
strftime (text_time, sizeof (text_time),
|
||||
cfg_look_day_change_timestamp, local_time);
|
||||
gui_add_hotlist = 0;
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (!ptr_buffer->dcc)
|
||||
gui_printf_nolog_notime (ptr_buffer,
|
||||
_("Day changed to %s\n"),
|
||||
text_time);
|
||||
}
|
||||
gui_add_hotlist = 1;
|
||||
}
|
||||
old_day = local_time->tm_mday;
|
||||
}
|
||||
|
||||
/* second has changed ? => count down time for infobar, if needed */
|
||||
/* second has changed ? */
|
||||
if (local_time->tm_sec != old_sec)
|
||||
{
|
||||
old_sec = local_time->tm_sec;
|
||||
/* TODO: manage splitted windows! */
|
||||
|
||||
if (cfg_look_infobar_seconds)
|
||||
{
|
||||
gui_draw_buffer_infobar_time (gui_current_window->buffer);
|
||||
wmove (gui_current_window->win_input,
|
||||
0, gui_current_window->win_input_x);
|
||||
wrefresh (gui_current_window->win_input);
|
||||
}
|
||||
|
||||
/* infobar count down */
|
||||
if (gui_infobar && gui_infobar->remaining_time > 0)
|
||||
{
|
||||
gui_infobar->remaining_time--;
|
||||
if (gui_infobar->remaining_time == 0)
|
||||
{
|
||||
gui_infobar_remove ();
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* away check */
|
||||
if (cfg_irc_away_check != 0)
|
||||
{
|
||||
check_away++;
|
||||
if (check_away >= (cfg_irc_away_check * 60))
|
||||
{
|
||||
check_away = 0;
|
||||
server_check_away ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FD_ZERO (&read_fd);
|
||||
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
if (weechat_fifo != -1)
|
||||
FD_SET (weechat_fifo, &read_fd);
|
||||
|
||||
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)
|
||||
{
|
||||
if (ptr_server->sock4 >= 0)
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
/* check if reconnection is pending */
|
||||
if ((!ptr_server->is_connected)
|
||||
&& (ptr_server->reconnect_start > 0)
|
||||
&& (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay)))
|
||||
server_reconnect (ptr_server);
|
||||
else
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
/* check for lag */
|
||||
if ((ptr_server->lag_check_time.tv_sec == 0)
|
||||
&& (new_time >= ptr_server->lag_next_check))
|
||||
{
|
||||
server_sendf (ptr_server, "PING %s\r\n", ptr_server->address);
|
||||
gettimeofday (&(ptr_server->lag_check_time), &tz);
|
||||
}
|
||||
|
||||
/* lag timeout => disconnect */
|
||||
if ((ptr_server->lag_check_time.tv_sec != 0)
|
||||
&& (cfg_irc_lag_disconnect > 0))
|
||||
{
|
||||
gettimeofday (&tv, &tz);
|
||||
diff = (int) get_timeval_diff (&(ptr_server->lag_check_time), &tv);
|
||||
if (diff / 1000 > cfg_irc_lag_disconnect * 60)
|
||||
{
|
||||
irc_display_prefix (ptr_server, ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s lag is high, disconnecting from server...\n"),
|
||||
WEECHAT_WARNING);
|
||||
server_disconnect (ptr_server, 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
|
||||
FD_SET (ptr_server->child_read, &read_fd);
|
||||
else
|
||||
{
|
||||
if (ptr_server->sock >= 0)
|
||||
FD_SET (ptr_server->sock, &read_fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout))
|
||||
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0)
|
||||
{
|
||||
if (FD_ISSET (STDIN_FILENO, &read_fd))
|
||||
{
|
||||
gui_read_keyb ();
|
||||
gui_input_read ();
|
||||
}
|
||||
else
|
||||
if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd)))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
fifo_read ();
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
|
||||
{
|
||||
if ((ptr_server->sock4 >= 0) &&
|
||||
(FD_ISSET (ptr_server->sock4, &read_fd)))
|
||||
if (FD_ISSET (ptr_server->child_read, &read_fd))
|
||||
server_child_read (ptr_server);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ptr_server->sock >= 0) &&
|
||||
(FD_ISSET (ptr_server->sock, &read_fd)))
|
||||
server_recv (ptr_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* manages active DCC */
|
||||
dcc_handle ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
@@ -19,12 +19,11 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = weechat-gtk
|
||||
|
||||
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
|
||||
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.h \
|
||||
../gui-common.c \
|
||||
gui-display.c \
|
||||
weechat_gtk_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -89,7 +89,7 @@ gui_assign_color (int *color, char *color_name)
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
{
|
||||
*color = gui_colors[i].color;
|
||||
return 1;
|
||||
@@ -114,7 +114,7 @@ gui_get_color_by_name (char *color_name)
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
return gui_colors[i].color;
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1332
-317
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,565 @@
|
||||
/*
|
||||
* 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-keyboard: keyboard functions (GUI independant) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "gui.h"
|
||||
#include "../common/command.h"
|
||||
|
||||
|
||||
t_gui_key *gui_keys = NULL;
|
||||
t_gui_key *last_gui_key = NULL;
|
||||
|
||||
char gui_key_buffer[128];
|
||||
int gui_key_grab = 0;
|
||||
int gui_key_grab_count = 0;
|
||||
|
||||
t_gui_key_function gui_key_functions[] =
|
||||
{ { "return", gui_action_return,
|
||||
N_("terminate line") },
|
||||
{ "tab", gui_action_tab,
|
||||
N_("complete word") },
|
||||
{ "backspace", gui_action_backspace,
|
||||
N_("delete previous char") },
|
||||
{ "delete", gui_action_delete,
|
||||
N_("delete next char") },
|
||||
{ "delete_end_line", gui_action_delete_end_of_line,
|
||||
N_("delete until end of line") },
|
||||
{ "delete_beginning_line", gui_action_delete_begin_of_line,
|
||||
N_("delete until beginning of line") },
|
||||
{ "delete_line", gui_action_delete_line,
|
||||
N_("delete entire line") },
|
||||
{ "delete_previous_word", gui_action_delete_previous_word,
|
||||
N_("delete previous word") },
|
||||
{ "delete_next_word", gui_action_delete_next_word,
|
||||
N_("delete next word") },
|
||||
{ "clipboard_paste", gui_action_clipboard_paste,
|
||||
N_("paste current clipboard content") },
|
||||
{ "transpose_chars", gui_action_transpose_chars,
|
||||
N_("transpose chars") },
|
||||
{ "home", gui_action_home,
|
||||
N_("go to beginning of line") },
|
||||
{ "end", gui_action_end,
|
||||
N_("go to end of line") },
|
||||
{ "left", gui_action_left,
|
||||
N_("move one char left") },
|
||||
{ "previous_word", gui_action_previous_word,
|
||||
N_("move to previous word") },
|
||||
{ "right", gui_action_right,
|
||||
N_("move one char right") },
|
||||
{ "next_word", gui_action_next_word,
|
||||
N_("move to next word") },
|
||||
{ "up", gui_action_up,
|
||||
N_("call previous command in history") },
|
||||
{ "up_global", gui_action_up_global,
|
||||
N_("call previous command in global history") },
|
||||
{ "down", gui_action_down,
|
||||
N_("call next command in history") },
|
||||
{ "down_global", gui_action_down_global,
|
||||
N_("call next command in global history") },
|
||||
{ "page_up", gui_action_page_up,
|
||||
N_("scroll one page up") },
|
||||
{ "page_down", gui_action_page_down,
|
||||
N_("scroll one page down") },
|
||||
{ "nick_beginning", gui_action_nick_beginning,
|
||||
N_("display beginning of nicklist") },
|
||||
{ "nick_end", gui_action_nick_end,
|
||||
N_("display end of nicklist") },
|
||||
{ "nick_page_up", gui_action_nick_page_up,
|
||||
N_("scroll nicklist one page up") },
|
||||
{ "nick_page_down", gui_action_nick_page_down,
|
||||
N_("scroll nicklist one page down") },
|
||||
{ "jump_smart", gui_action_jump_smart,
|
||||
N_("jump to buffer with activity") },
|
||||
{ "jump_dcc", gui_action_jump_dcc,
|
||||
N_("jump to DCC buffer") },
|
||||
{ "jump_last_buffer", gui_action_jump_last_buffer,
|
||||
N_("jump to last buffer") },
|
||||
{ "jump_server", gui_action_jump_server,
|
||||
N_("jump to server buffer") },
|
||||
{ "jump_next_server", gui_action_jump_next_server,
|
||||
N_("jump to next server") },
|
||||
{ "switch_server", gui_action_switch_server,
|
||||
N_("switch active server on servers buffer") },
|
||||
{ "hotlist_clear", gui_action_hotlist_clear,
|
||||
N_("clear hotlist") },
|
||||
{ "infobar_clear", gui_action_infobar_clear,
|
||||
N_("clear infobar") },
|
||||
{ "refresh", gui_action_refresh_screen,
|
||||
N_("refresh screen") },
|
||||
{ "grab_key", gui_action_grab_key,
|
||||
N_("grab a key") },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* gui_key_init: init keyboard (create default key bindings)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_key_init ()
|
||||
{
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
|
||||
gui_input_default_key_bindings ();
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_init_show: init "show mode"
|
||||
*/
|
||||
|
||||
void
|
||||
gui_key_init_grab ()
|
||||
{
|
||||
gui_key_grab = 1;
|
||||
gui_key_grab_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_get_internal_code: get internal code from user key name
|
||||
* for example: return "^R" for "ctrl-R"
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_key_get_internal_code (char *key)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if ((result = (char *) malloc (strlen (key) + 1)))
|
||||
{
|
||||
result[0] = '\0';
|
||||
while (key[0])
|
||||
{
|
||||
if (ascii_strncasecmp (key, "meta2-", 6) == 0)
|
||||
{
|
||||
strcat (result, "^[[");
|
||||
key += 6;
|
||||
}
|
||||
if (ascii_strncasecmp (key, "meta-", 5) == 0)
|
||||
{
|
||||
strcat (result, "^[");
|
||||
key += 5;
|
||||
}
|
||||
else if (ascii_strncasecmp (key, "ctrl-", 5) == 0)
|
||||
{
|
||||
strcat (result, "^");
|
||||
key += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncat (result, key, 1);
|
||||
key++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_get_expanded_name: get expanded name from internal key code
|
||||
* for example: return "ctrl-R" for "^R"
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_key_get_expanded_name (char *key)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if ((result = (char *) malloc ((strlen (key) * 5) + 1)))
|
||||
{
|
||||
result[0] = '\0';
|
||||
while (key[0])
|
||||
{
|
||||
if (ascii_strncasecmp (key, "^[[", 3) == 0)
|
||||
{
|
||||
strcat (result, "meta2-");
|
||||
key += 3;
|
||||
}
|
||||
if (ascii_strncasecmp (key, "^[", 2) == 0)
|
||||
{
|
||||
strcat (result, "meta-");
|
||||
key += 2;
|
||||
}
|
||||
else if ((key[0] == '^') && (key[1]))
|
||||
{
|
||||
strcat (result, "ctrl-");
|
||||
key++;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncat (result, key, 1);
|
||||
key++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_find_pos: find position for a key (for sorting keys list)
|
||||
*/
|
||||
|
||||
t_gui_key *
|
||||
gui_key_find_pos (t_gui_key *key)
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
if (ascii_strcasecmp (key->key, ptr_key->key) < 0)
|
||||
return ptr_key;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_insert_sorted: insert key into sorted list
|
||||
*/
|
||||
|
||||
void
|
||||
gui_key_insert_sorted (t_gui_key *key)
|
||||
{
|
||||
t_gui_key *pos_key;
|
||||
|
||||
if (gui_keys)
|
||||
{
|
||||
pos_key = gui_key_find_pos (key);
|
||||
|
||||
if (pos_key)
|
||||
{
|
||||
/* insert key into the list (before key found) */
|
||||
key->prev_key = pos_key->prev_key;
|
||||
key->next_key = pos_key;
|
||||
if (pos_key->prev_key)
|
||||
pos_key->prev_key->next_key = key;
|
||||
else
|
||||
gui_keys = key;
|
||||
pos_key->prev_key = key;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add key to the end */
|
||||
key->prev_key = last_gui_key;
|
||||
key->next_key = NULL;
|
||||
last_gui_key->next_key = key;
|
||||
last_gui_key = key;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
key->prev_key = NULL;
|
||||
key->next_key = NULL;
|
||||
gui_keys = key;
|
||||
last_gui_key = key;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_new: add a new key in keys list
|
||||
*/
|
||||
|
||||
t_gui_key *
|
||||
gui_key_new (char *key, char *command, void *function)
|
||||
{
|
||||
t_gui_key *new_key;
|
||||
char *internal_code;
|
||||
|
||||
if ((new_key = (t_gui_key *) malloc (sizeof (t_gui_key))))
|
||||
{
|
||||
internal_code = gui_key_get_internal_code (key);
|
||||
new_key->key = (internal_code) ? strdup (internal_code) : strdup (key);
|
||||
if (internal_code)
|
||||
free (internal_code);
|
||||
new_key->command = (command) ? strdup (command) : NULL;
|
||||
new_key->function = function;
|
||||
gui_key_insert_sorted (new_key);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return new_key;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_search: search a key
|
||||
*/
|
||||
|
||||
t_gui_key *
|
||||
gui_key_search (char *key)
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_key->key, key) == 0)
|
||||
return ptr_key;
|
||||
}
|
||||
|
||||
/* key not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_cmp: compares 2 keys
|
||||
*/
|
||||
|
||||
int
|
||||
gui_key_cmp (char *key, char *search)
|
||||
{
|
||||
while (search[0])
|
||||
{
|
||||
if (toupper(key[0]) != toupper(search[0]))
|
||||
return search[0] - key[0];
|
||||
key++;
|
||||
search++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_search_part: search a key (maybe part of string)
|
||||
*/
|
||||
|
||||
t_gui_key *
|
||||
gui_key_search_part (char *key)
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
if (gui_key_cmp (ptr_key->key, key) == 0)
|
||||
return ptr_key;
|
||||
}
|
||||
|
||||
/* key not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_function_search_by_name: search a function by name
|
||||
*/
|
||||
|
||||
void *
|
||||
gui_key_function_search_by_name (char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
if (ascii_strcasecmp (gui_key_functions[i].function_name, name) == 0)
|
||||
return gui_key_functions[i].function;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* function not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_function_search_by_ptr: search a function by pointer
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_key_function_search_by_ptr (void *function)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
if (gui_key_functions[i].function == function)
|
||||
return gui_key_functions[i].function_name;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* function not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_bind: bind a key to a function (command or special function)
|
||||
*/
|
||||
|
||||
t_gui_key *
|
||||
gui_key_bind (char *key, char *command)
|
||||
{
|
||||
t_gui_key_function *ptr_function;
|
||||
t_gui_key *new_key;
|
||||
|
||||
if (!key || !command)
|
||||
{
|
||||
wee_log_printf (_("%s unable to bind key \"%s\"\n"),
|
||||
WEECHAT_ERROR, key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr_function = NULL;
|
||||
if (command[0] != '/')
|
||||
{
|
||||
ptr_function = gui_key_function_search_by_name (command);
|
||||
if (!ptr_function)
|
||||
{
|
||||
wee_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
|
||||
WEECHAT_ERROR, key, command);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gui_key_unbind (key);
|
||||
|
||||
new_key = gui_key_new (key,
|
||||
(ptr_function) ? NULL : command,
|
||||
ptr_function);
|
||||
if (!new_key)
|
||||
{
|
||||
wee_log_printf (_("%s not enough memory for key binding\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new_key;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_unbind: remove a key binding
|
||||
*/
|
||||
|
||||
int
|
||||
gui_key_unbind (char *key)
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
char *internal_code;
|
||||
|
||||
internal_code = gui_key_get_internal_code (key);
|
||||
|
||||
ptr_key = gui_key_search ((internal_code) ? internal_code : key);
|
||||
if (ptr_key)
|
||||
gui_key_free (ptr_key);
|
||||
|
||||
if (internal_code)
|
||||
free (internal_code);
|
||||
|
||||
return (ptr_key != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_pressed: treat new key pressed
|
||||
* return: 1 if key should be added to input buffer
|
||||
* 0 otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
gui_key_pressed (char *key_str)
|
||||
{
|
||||
int first_key;
|
||||
t_gui_key *ptr_key;
|
||||
|
||||
/* add key to buffer */
|
||||
first_key = (gui_key_buffer[0] == '\0');
|
||||
strcat (gui_key_buffer, key_str);
|
||||
|
||||
/* if we are in "show mode", increase counter and return */
|
||||
if (gui_key_grab)
|
||||
{
|
||||
gui_key_grab_count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* look for key combo in key table */
|
||||
ptr_key = gui_key_search_part (gui_key_buffer);
|
||||
if (ptr_key)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_key->key, gui_key_buffer) == 0)
|
||||
{
|
||||
/* exact combo found => execute function or command */
|
||||
gui_key_buffer[0] = '\0';
|
||||
if (ptr_key->command)
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer,
|
||||
ptr_key->command);
|
||||
else
|
||||
(void)(ptr_key->function)(gui_current_window);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
gui_key_buffer[0] = '\0';
|
||||
|
||||
/* if this is first key and not found (even partial) => return 1
|
||||
else return 0 (= silently discard sequence of bad keys) */
|
||||
return first_key;
|
||||
}
|
||||
|
||||
/*
|
||||
* key_free: delete a key binding
|
||||
*/
|
||||
|
||||
void
|
||||
gui_key_free (t_gui_key *key)
|
||||
{
|
||||
/* free memory */
|
||||
if (key->key)
|
||||
free (key->key);
|
||||
if (key->command)
|
||||
free (key->command);
|
||||
|
||||
/* remove key from keys list */
|
||||
if (key->prev_key)
|
||||
key->prev_key->next_key = key->next_key;
|
||||
if (key->next_key)
|
||||
key->next_key->prev_key = key->prev_key;
|
||||
if (gui_keys == key)
|
||||
gui_keys = key->next_key;
|
||||
if (last_gui_key == key)
|
||||
last_gui_key = key->prev_key;
|
||||
|
||||
free (key);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_key_free_all: delete all key bindings
|
||||
*/
|
||||
|
||||
void
|
||||
gui_key_free_all ()
|
||||
{
|
||||
while (gui_keys)
|
||||
gui_key_free (gui_keys);
|
||||
}
|
||||
+387
-138
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -26,87 +26,159 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 38
|
||||
#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_ACTIVE 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 15
|
||||
#define COLOR_WIN_STATUS_MORE 16
|
||||
#define COLOR_WIN_INFOBAR 17
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 18
|
||||
#define COLOR_WIN_INPUT 19
|
||||
#define COLOR_WIN_INPUT_CHANNEL 20
|
||||
#define COLOR_WIN_INPUT_NICK 21
|
||||
#define COLOR_WIN_NICK 22
|
||||
#define COLOR_WIN_NICK_OP 23
|
||||
#define COLOR_WIN_NICK_HALFOP 24
|
||||
#define COLOR_WIN_NICK_VOICE 25
|
||||
#define COLOR_WIN_NICK_SEP 26
|
||||
#define COLOR_WIN_NICK_SELF 27
|
||||
#define COLOR_WIN_NICK_PRIVATE 28
|
||||
#define COLOR_WIN_NICK_FIRST 29
|
||||
#define COLOR_WIN_NICK_LAST 38
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
/* shift ncurses colors for compatibility with colors
|
||||
in IRC messages (same as other IRC clients) */
|
||||
|
||||
#define SERVER(window) ((t_irc_server *)(window->server))
|
||||
#define CHANNEL(window) ((t_irc_channel *)(window->channel))
|
||||
#define WEECHAT_COLOR_BLACK COLOR_BLACK
|
||||
#define WEECHAT_COLOR_RED COLOR_BLUE
|
||||
#define WEECHAT_COLOR_GREEN COLOR_GREEN
|
||||
#define WEECHAT_COLOR_YELLOW COLOR_CYAN
|
||||
#define WEECHAT_COLOR_BLUE COLOR_RED
|
||||
#define WEECHAT_COLOR_MAGENTA COLOR_MAGENTA
|
||||
#define WEECHAT_COLOR_CYAN COLOR_YELLOW
|
||||
#define WEECHAT_COLOR_WHITE COLOR_WHITE
|
||||
|
||||
#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 COLOR_WIN_NICK_NUMBER 10
|
||||
|
||||
#define MSG_TYPE_TIME 0
|
||||
#define MSG_TYPE_NICK 1
|
||||
#define MSG_TYPE_INFO 2
|
||||
#define MSG_TYPE_MSG 3
|
||||
typedef enum t_weechat_color t_weechat_color;
|
||||
|
||||
#define gui_printf_color(window, color, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
|
||||
#define gui_printf(window, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
struct t_gui_message
|
||||
enum t_weechat_color
|
||||
{
|
||||
int type; /* type of message (time, nick, other) */
|
||||
int color; /* color of message */
|
||||
char *message; /* message content */
|
||||
t_gui_message *prev_message; /* link to previous message for line */
|
||||
t_gui_message *next_message; /* link to next message for line */
|
||||
COLOR_WIN_TITLE = 0,
|
||||
COLOR_WIN_CHAT,
|
||||
COLOR_WIN_CHAT_TIME,
|
||||
COLOR_WIN_CHAT_TIME_SEP,
|
||||
COLOR_WIN_CHAT_PREFIX1,
|
||||
COLOR_WIN_CHAT_PREFIX2,
|
||||
COLOR_WIN_CHAT_SERVER,
|
||||
COLOR_WIN_CHAT_JOIN,
|
||||
COLOR_WIN_CHAT_PART,
|
||||
COLOR_WIN_CHAT_NICK,
|
||||
COLOR_WIN_CHAT_HOST,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
COLOR_WIN_CHAT_DARK,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
COLOR_WIN_STATUS,
|
||||
COLOR_WIN_STATUS_DELIMITERS,
|
||||
COLOR_WIN_STATUS_CHANNEL,
|
||||
COLOR_WIN_STATUS_DATA_MSG,
|
||||
COLOR_WIN_STATUS_DATA_PRIVATE,
|
||||
COLOR_WIN_STATUS_DATA_HIGHLIGHT,
|
||||
COLOR_WIN_STATUS_DATA_OTHER,
|
||||
COLOR_WIN_STATUS_MORE,
|
||||
COLOR_WIN_INFOBAR,
|
||||
COLOR_WIN_INFOBAR_DELIMITERS,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
COLOR_WIN_INPUT,
|
||||
COLOR_WIN_INPUT_CHANNEL,
|
||||
COLOR_WIN_INPUT_NICK,
|
||||
COLOR_WIN_INPUT_DELIMITERS,
|
||||
COLOR_WIN_NICK,
|
||||
COLOR_WIN_NICK_AWAY,
|
||||
COLOR_WIN_NICK_CHANOWNER,
|
||||
COLOR_WIN_NICK_CHANADMIN,
|
||||
COLOR_WIN_NICK_OP,
|
||||
COLOR_WIN_NICK_HALFOP,
|
||||
COLOR_WIN_NICK_VOICE,
|
||||
COLOR_WIN_NICK_MORE,
|
||||
COLOR_WIN_NICK_SEP,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
COLOR_WIN_NICK_1,
|
||||
COLOR_WIN_NICK_2,
|
||||
COLOR_WIN_NICK_3,
|
||||
COLOR_WIN_NICK_4,
|
||||
COLOR_WIN_NICK_5,
|
||||
COLOR_WIN_NICK_6,
|
||||
COLOR_WIN_NICK_7,
|
||||
COLOR_WIN_NICK_8,
|
||||
COLOR_WIN_NICK_9,
|
||||
COLOR_WIN_NICK_10,
|
||||
COLOR_DCC_SELECTED,
|
||||
COLOR_DCC_WAITING,
|
||||
COLOR_DCC_CONNECTING,
|
||||
COLOR_DCC_ACTIVE,
|
||||
COLOR_DCC_DONE,
|
||||
COLOR_DCC_FAILED,
|
||||
COLOR_DCC_ABORTED,
|
||||
NUM_COLORS
|
||||
};
|
||||
|
||||
typedef struct t_gui_line t_gui_line;
|
||||
/* attributes in IRC messages for color & style (bold, ..) */
|
||||
|
||||
struct t_gui_line
|
||||
{
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
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 */
|
||||
t_gui_line *next_line; /* link to next line */
|
||||
};
|
||||
#define GUI_ATTR_BOLD_CHAR '\x02'
|
||||
#define GUI_ATTR_BOLD_STR "\x02"
|
||||
#define GUI_ATTR_COLOR_CHAR '\x03'
|
||||
#define GUI_ATTR_COLOR_STR "\x03"
|
||||
#define GUI_ATTR_RESET_CHAR '\x0F'
|
||||
#define GUI_ATTR_RESET_STR "\x0F"
|
||||
#define GUI_ATTR_FIXED_CHAR '\x11'
|
||||
#define GUI_ATTR_FIXED_STR "\x11"
|
||||
#define GUI_ATTR_REVERSE_CHAR '\x12'
|
||||
#define GUI_ATTR_REVERSE_STR "\x12"
|
||||
#define GUI_ATTR_REVERSE2_CHAR '\x16'
|
||||
#define GUI_ATTR_REVERSE2_STR "\x16"
|
||||
#define GUI_ATTR_ITALIC_CHAR '\x1D'
|
||||
#define GUI_ATTR_ITALIC_STR "\x1D"
|
||||
#define GUI_ATTR_UNDERLINE_CHAR '\x1F'
|
||||
#define GUI_ATTR_UNDERLINE_STR "\x1F"
|
||||
|
||||
/* WeeChat internal attributes (should never be in IRC messages) */
|
||||
|
||||
#define GUI_ATTR_WEECHAT_COLOR_CHAR '\x19'
|
||||
#define GUI_ATTR_WEECHAT_COLOR_STR "\x19"
|
||||
#define GUI_ATTR_WEECHAT_SET_CHAR '\x1A'
|
||||
#define GUI_ATTR_WEECHAT_SET_STR "\x1A"
|
||||
#define GUI_ATTR_WEECHAT_REMOVE_CHAR '\x1B'
|
||||
#define GUI_ATTR_WEECHAT_REMOVE_STR "\x1B"
|
||||
|
||||
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
|
||||
#define GUI_NO_COLOR GUI_ATTR_RESET_STR
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define BUFFER_IS_SERVER(buffer) ((SERVER(buffer) || (buffer->all_servers)) && !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 BUFFER_HAS_NICKLIST(buffer) (BUFFER_IS_CHANNEL(buffer))
|
||||
|
||||
#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(buffer, fmt, argz...) \
|
||||
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, fmt, ##argz)
|
||||
|
||||
#define gui_printf_type(buffer, type, fmt, argz...) \
|
||||
gui_printf_internal(buffer, 1, type, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog(buffer, fmt, argz...) \
|
||||
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
|
||||
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, fmt, ##argz)
|
||||
|
||||
#define NOTIFY_LEVEL_MIN 0
|
||||
#define NOTIFY_LEVEL_MAX 3
|
||||
#define NOTIFY_LEVEL_DEFAULT NOTIFY_LEVEL_MAX
|
||||
|
||||
#define KEY_SHOW_MODE_DISPLAY 1
|
||||
#define KEY_SHOW_MODE_BIND 2
|
||||
|
||||
typedef struct t_gui_color t_gui_color;
|
||||
|
||||
struct t_gui_color
|
||||
{
|
||||
char *name;
|
||||
int color;
|
||||
int foreground; /* foreground color */
|
||||
int background; /* background color */
|
||||
int attributes; /* attributes (bold, ..) */
|
||||
char *string; /* WeeChat color: "\x19??", ?? is #color*/
|
||||
};
|
||||
|
||||
typedef struct t_gui_infobar t_gui_infobar;
|
||||
@@ -121,16 +193,78 @@ struct t_gui_infobar
|
||||
t_gui_infobar *next_infobar; /* next message for infobar */
|
||||
};
|
||||
|
||||
typedef struct t_gui_line t_gui_line;
|
||||
|
||||
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 */
|
||||
char *data; /* line content */
|
||||
int ofs_after_date; /* offset to first char after date */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
t_gui_line *next_line; /* link to next line */
|
||||
};
|
||||
|
||||
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; /* buffer's server */
|
||||
int all_servers; /* =1 if all servers are displayed here */
|
||||
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 num_lines; /* number of lines in the window */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
|
||||
/* 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 */
|
||||
int has_input; /* = 1 if buffer has input (DCC has not)*/
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size in bytes */
|
||||
int input_buffer_length; /* number of chars in buffer */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* 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
|
||||
{
|
||||
int is_displayed; /* = 1 if window is displayed */
|
||||
|
||||
/* 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 */
|
||||
@@ -143,17 +277,22 @@ struct t_gui_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 */
|
||||
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) */
|
||||
|
||||
/* input window settings */
|
||||
int win_input_x; /* position of cursor in input window */
|
||||
|
||||
/* windows for Curses GUI */
|
||||
void *win_title; /* title window */
|
||||
void *win_chat; /* chat window (exemple: channel) */
|
||||
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 */
|
||||
@@ -165,88 +304,198 @@ struct t_gui_window
|
||||
/* windows for Qt GUI */
|
||||
/* TODO: declare Qt window */
|
||||
|
||||
/* 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 current_style_fg;; /* current color used for foreground */
|
||||
int current_style_bg;; /* current color used for background */
|
||||
int current_style_attr; /* current attributes (bold, ..) */
|
||||
int current_color_attr; /* attr sum of last color(s) displayed */
|
||||
|
||||
/* 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 */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
int unread_data; /* highlight windows with unread data */
|
||||
t_gui_line *start_line; /* pointer to line if scrolling */
|
||||
int start_line_pos; /* position in first line displayed */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
|
||||
/* link to next window */
|
||||
t_gui_window *prev_window; /* link to previous window */
|
||||
t_gui_window *next_window; /* link to next window */
|
||||
};
|
||||
|
||||
typedef struct t_gui_key t_gui_key;
|
||||
|
||||
struct t_gui_key
|
||||
{
|
||||
char *key; /* key combo (ex: a, ^W, ^W^C, meta-a) */
|
||||
char *command; /* associated command (may be NULL) */
|
||||
void (*function)(t_gui_window *);
|
||||
/* associated function (if cmd is NULL) */
|
||||
t_gui_key *prev_key; /* link to previous key */
|
||||
t_gui_key *next_key; /* link to next key */
|
||||
};
|
||||
|
||||
typedef struct t_gui_key_function t_gui_key_function;
|
||||
|
||||
struct t_gui_key_function
|
||||
{
|
||||
char *function_name; /* name of function */
|
||||
void (*function)(); /* associated function */
|
||||
char *description; /* description of function */
|
||||
};
|
||||
|
||||
/* 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;
|
||||
extern t_gui_key *gui_keys;
|
||||
extern t_gui_key *last_gui_key;
|
||||
extern t_gui_key_function gui_key_functions[];
|
||||
extern char gui_key_buffer[128];
|
||||
extern int gui_key_grab;
|
||||
extern int gui_key_grab_count;
|
||||
extern char *gui_input_clipboard;
|
||||
|
||||
/* prototypes */
|
||||
extern t_gui_color *gui_color[NUM_COLORS];
|
||||
|
||||
/* GUI independent functions */
|
||||
extern t_gui_window *gui_window_new (/*@null@*/ void *, /*@null@*/ void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
|
||||
extern void gui_window_clear (t_gui_window *);
|
||||
extern void gui_window_clear_all ();
|
||||
/* GUI independent functions: windows & buffers */
|
||||
|
||||
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 t_gui_line *gui_new_line (t_gui_window *);
|
||||
extern t_gui_message *gui_new_message (t_gui_window *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_window *);
|
||||
extern void gui_delete_previous_word ();
|
||||
extern void gui_move_previous_word ();
|
||||
extern void gui_move_next_word ();
|
||||
extern void gui_buffer_insert_string (char *, int);
|
||||
/* GUI dependant functions */
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern int gui_word_strlen (t_gui_window *, char *);
|
||||
extern int gui_word_real_pos (t_gui_window *, char *, int);
|
||||
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
|
||||
extern void gui_exec_action_dcc (t_gui_window *, char *);
|
||||
extern int gui_insert_string_input (t_gui_window *, char *, int);
|
||||
extern void gui_merge_servers (t_gui_window *);
|
||||
extern void gui_split_server (t_gui_window *);
|
||||
extern void gui_window_switch_server (t_gui_window *);
|
||||
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_switch_to_window_by_buffer (t_gui_window *, int);
|
||||
extern void gui_switch_to_dcc_buffer (t_gui_window *);
|
||||
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 independent functions: actions */
|
||||
|
||||
extern void gui_action_clipboard_copy (char *, int);
|
||||
extern void gui_action_clipboard_paste (t_gui_window *);
|
||||
extern void gui_action_return (t_gui_window *);
|
||||
extern void gui_action_tab (t_gui_window *);
|
||||
extern void gui_action_backspace (t_gui_window *);
|
||||
extern void gui_action_delete (t_gui_window *);
|
||||
extern void gui_action_delete_previous_word (t_gui_window *);
|
||||
extern void gui_action_delete_next_word (t_gui_window *);
|
||||
extern void gui_action_delete_begin_of_line (t_gui_window *);
|
||||
extern void gui_action_delete_end_of_line (t_gui_window *);
|
||||
extern void gui_action_delete_line (t_gui_window *);
|
||||
extern void gui_action_transpose_chars (t_gui_window *);
|
||||
extern void gui_action_home (t_gui_window *);
|
||||
extern void gui_action_end (t_gui_window *);
|
||||
extern void gui_action_left (t_gui_window *);
|
||||
extern void gui_action_previous_word (t_gui_window *);
|
||||
extern void gui_action_right (t_gui_window *);
|
||||
extern void gui_action_next_word (t_gui_window *);
|
||||
extern void gui_action_up (t_gui_window *);
|
||||
extern void gui_action_up_global (t_gui_window *);
|
||||
extern void gui_action_down (t_gui_window *);
|
||||
extern void gui_action_down_global (t_gui_window *);
|
||||
extern void gui_action_page_up (t_gui_window *);
|
||||
extern void gui_action_page_down (t_gui_window *);
|
||||
extern void gui_action_nick_beginning (t_gui_window *);
|
||||
extern void gui_action_nick_end (t_gui_window *);
|
||||
extern void gui_action_nick_page_up (t_gui_window *);
|
||||
extern void gui_action_nick_page_down (t_gui_window *);
|
||||
extern void gui_action_jump_smart (t_gui_window *);
|
||||
extern void gui_action_jump_dcc (t_gui_window *);
|
||||
extern void gui_action_jump_last_buffer (t_gui_window *);
|
||||
extern void gui_action_jump_server (t_gui_window *);
|
||||
extern void gui_action_jump_next_server (t_gui_window *);
|
||||
extern void gui_action_switch_server (t_gui_window *);
|
||||
extern void gui_action_hotlist_clear (t_gui_window *);
|
||||
extern void gui_action_infobar_clear (t_gui_window *);
|
||||
extern void gui_action_refresh_screen ();
|
||||
extern void gui_action_grab_key (t_gui_window *);
|
||||
|
||||
/* GUI independent functions: keys */
|
||||
|
||||
extern void gui_key_init ();
|
||||
extern void gui_key_init_grab ();
|
||||
extern char *gui_key_get_internal_code (char *);
|
||||
extern char *gui_key_get_expanded_name (char *);
|
||||
extern void *gui_key_function_search_by_name (char *);
|
||||
extern char *gui_key_function_search_by_ptr (void *);
|
||||
extern t_gui_key *gui_key_bind (char *, char *);
|
||||
extern int gui_key_unbind (char *);
|
||||
extern int gui_key_pressed (char *);
|
||||
extern void gui_key_free (t_gui_key *);
|
||||
extern void gui_key_free_all ();
|
||||
|
||||
/* GUI dependant functions: display */
|
||||
|
||||
extern int gui_assign_color (int *, char *);
|
||||
extern int gui_get_color_by_name (char *);
|
||||
extern char *gui_get_color_by_value (int);
|
||||
extern int gui_window_has_nicklist (t_gui_window *);
|
||||
extern char *gui_get_color_name (int);
|
||||
extern unsigned char *gui_color_decode (unsigned char *, int);
|
||||
extern unsigned char *gui_color_decode_for_user_entry (unsigned char *);
|
||||
extern unsigned char *gui_color_encode (unsigned char *);
|
||||
extern int gui_buffer_has_nicklist (t_gui_buffer *);
|
||||
extern void gui_calculate_pos_size (t_gui_window *);
|
||||
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_infobar (t_gui_window *);
|
||||
extern void gui_redraw_window_infobar (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_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 void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern char *gui_word_get_next_char (t_gui_window *, unsigned char *, 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_time (t_gui_buffer *);
|
||||
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 (t_gui_window *);
|
||||
extern void gui_window_page_up (t_gui_window *);
|
||||
extern void gui_window_page_down (t_gui_window *);
|
||||
extern void gui_window_nick_beginning (t_gui_window *);
|
||||
extern void gui_window_nick_end (t_gui_window *);
|
||||
extern void gui_window_nick_page_up (t_gui_window *);
|
||||
extern void gui_window_nick_page_down (t_gui_window *);
|
||||
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_refresh_screen ();
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_init_color_pairs ();
|
||||
extern void gui_rebuild_weechat_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_window *, int, int, char *, ...);
|
||||
extern void gui_input_default_key_bindings ();
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# 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 \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_wxwidgets_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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 wxWidgets GUI */
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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 wxWidgets GUI */
|
||||
+4
-2
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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,7 +15,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GNUTLS_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_irc.a
|
||||
|
||||
@@ -26,4 +26,6 @@ lib_weechat_irc_a_SOURCES = irc.h \
|
||||
irc-server.c \
|
||||
irc-channel.c \
|
||||
irc-nick.c \
|
||||
irc-dcc.c \
|
||||
irc-ignore.c \
|
||||
irc-display.c
|
||||
|
||||
+279
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -25,13 +25,15 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_irc_channel *current_channel = NULL;
|
||||
char *channel_modes = "iklmnst";
|
||||
|
||||
|
||||
/*
|
||||
@@ -40,7 +42,7 @@ t_irc_channel *current_channel = NULL;
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_window)
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
@@ -53,8 +55,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;
|
||||
|
||||
@@ -67,7 +76,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, switch_to_window);
|
||||
gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
@@ -81,7 +90,15 @@ void
|
||||
channel_free (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
t_irc_channel *new_channels;
|
||||
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* remove channel from queue */
|
||||
if (server->last_channel == channel)
|
||||
server->last_channel = channel->prev_channel;
|
||||
@@ -95,7 +112,7 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
|
||||
|
||||
if (channel->next_channel)
|
||||
(channel->next_channel)->prev_channel = channel->prev_channel;
|
||||
|
||||
|
||||
/* free data */
|
||||
if (channel->name)
|
||||
free (channel->name);
|
||||
@@ -126,11 +143,14 @@ t_irc_channel *
|
||||
channel_search (t_irc_server *server, char *channel_name)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
|
||||
if (!server || !channel_name)
|
||||
return NULL;
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (strcasecmp (ptr_channel->name, channel_name) == 0)
|
||||
if (ascii_strcasecmp (ptr_channel->name, channel_name) == 0)
|
||||
return ptr_channel;
|
||||
}
|
||||
return NULL;
|
||||
@@ -145,7 +165,258 @@ string_is_channel (char *string)
|
||||
{
|
||||
char first_char[2];
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
first_char[0] = string[0];
|
||||
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_get_notify_level: get channel notify level
|
||||
*/
|
||||
|
||||
int
|
||||
channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *name, *pos, *pos2, notify;
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
|
||||
if ((!server->notify_levels) || (!server->notify_levels[0]))
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (!pos)
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
|
||||
pos2 = pos + strlen (channel->name);
|
||||
if (pos2[0] != ':')
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
pos2++;
|
||||
if (!pos2[0])
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
|
||||
notify = (int)(pos2[0] - '0');
|
||||
if ((notify < NOTIFY_LEVEL_MIN) || (notify > NOTIFY_LEVEL_MAX))
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
else
|
||||
return notify;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_remove_notify_level: remove channel notify from list
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *name, *pos, *pos2;
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (channel->name);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0])
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0] == ',')
|
||||
pos2++;
|
||||
if (!pos2[0] && (pos != server->notify_levels))
|
||||
pos--;
|
||||
strcpy (pos, pos2);
|
||||
server->notify_levels = (char *) realloc (server->notify_levels,
|
||||
strlen (server->notify_levels) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_notify_level: set channel notify level
|
||||
*/
|
||||
|
||||
void
|
||||
channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int notify)
|
||||
{
|
||||
char *name, *pos, *pos2, level_string[2];
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
if (notify == NOTIFY_LEVEL_DEFAULT)
|
||||
{
|
||||
channel_remove_notify_level (server, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server->notify_levels)
|
||||
{
|
||||
server->notify_levels = (char *) malloc (strlen (channel->name) + 3);
|
||||
server->notify_levels[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (channel->name) + 1;
|
||||
if (pos2[0])
|
||||
{
|
||||
pos2[0] = '0' + notify;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* realloc notify list to add channel */
|
||||
server->notify_levels = (char *) realloc (server->notify_levels,
|
||||
strlen (server->notify_levels) + 1 +
|
||||
strlen (channel->name) + 2 + 1);
|
||||
}
|
||||
|
||||
/* channel not in notify list => add it */
|
||||
if (server->notify_levels[0])
|
||||
strcat (server->notify_levels, ",");
|
||||
strcat (server->notify_levels, channel->name);
|
||||
strcat (server->notify_levels, ":");
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
strcat (server->notify_levels, level_string);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
+209
-113
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -35,70 +35,108 @@ t_irc_command irc_commands[] =
|
||||
N_("[target]"),
|
||||
N_("target: server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_admin, NULL },
|
||||
{ "ame", N_("send a CTCP action to all channels of all connected servers"),
|
||||
N_("message"),
|
||||
N_("message: message to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_ame, NULL },
|
||||
{ "amsg", N_("send message to all channels of all connected servers"),
|
||||
N_("text"),
|
||||
N_("text: text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_amsg, NULL },
|
||||
{ "away", N_("toggle away status"),
|
||||
N_("[-all] [message]"),
|
||||
N_("-all: toggle away status on all connected servers\n"
|
||||
"message: message for away (if no message is given, away status is removed)"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_away, NULL },
|
||||
{ "ctcp", N_("send a ctcp message"),
|
||||
N_("nickname type"),
|
||||
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
|
||||
{ "ban", N_("bans nicks or hosts"),
|
||||
N_("[channel] [nickname [nickname ...]]"),
|
||||
N_("channel: channel for ban\n"
|
||||
"nickname: user or host to ban"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
|
||||
N_("nickname type [arguments]"),
|
||||
N_("nickname: user to send CTCP to\n"
|
||||
"type: CTCP type (examples: \"version\", \"ping\", ..)\n"
|
||||
"arguments: arguments for CTCP"),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
{ "dcc", N_("starts DCC (file or chat) or close chat"),
|
||||
N_("action [nickname [file]]"),
|
||||
N_("action: 'send' (file) or 'chat' or 'close' (chat)\n"
|
||||
"nickname: nickname to send file or chat\n"
|
||||
"file: filename (on local host)"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "dehalfop", N_("removes half channel operator status from nickname(s)"),
|
||||
N_("[nickname [nickname]]"), "",
|
||||
0, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
N_("[nickname [nickname]]"), "",
|
||||
0, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
{ "devoice", N_("removes voice from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_devoice, NULL, NULL },
|
||||
N_("[nickname [nickname]]"), "",
|
||||
0, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
|
||||
{ "die", N_("shutdown the server"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, irc_cmd_send_die, NULL },
|
||||
{ "error", N_("error received from IRC server"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "halfop", N_("gives half channel operator status to nickname(s)"),
|
||||
N_("[nickname [nickname]]"), "",
|
||||
0, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
|
||||
{ "info", N_("get information describing the server"),
|
||||
N_("[target]"),
|
||||
N_("target: server name"),
|
||||
0, 1, 1, NULL, irc_cmd_send_info, NULL },
|
||||
{ "invite", N_("invite a nick on a channel"),
|
||||
N_("nickname channel"),
|
||||
N_("nickname: nick to invite\nchannel: channel to invite"),
|
||||
2, 2, 1, NULL, irc_cmd_send_invite, NULL },
|
||||
N_("nickname: nick to invite\n"
|
||||
"channel: channel to invite"),
|
||||
1, 2, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite },
|
||||
{ "ison", N_("check if a nickname is currently on IRC"),
|
||||
N_("nickname [nickname ...]"),
|
||||
N_("nickname: nickname"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_ison, NULL },
|
||||
{ "join", N_("join a channel"),
|
||||
N_("channel[,channel] [key[,key]]"),
|
||||
N_("channel: channel name to join\nkey: key to join the channel"),
|
||||
N_("channel: channel name to join\n"
|
||||
"key: key to join the channel"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_join, irc_cmd_recv_join },
|
||||
{ "kick", N_("forcibly remove a user from a channel"),
|
||||
N_("[channel] nickname [comment]"),
|
||||
N_("channel: channel where user is\nnickname: nickname to kick\ncomment: comment for kick"),
|
||||
N_("channel: channel where user is\n"
|
||||
"nickname: nickname to kick\n"
|
||||
"comment: comment for kick"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick },
|
||||
{ "kickban", N_("kicks and bans a nick from a channel"),
|
||||
N_("[channel] nickname [comment]"),
|
||||
N_("channel: channel where user is\n"
|
||||
"nickname: nickname to kick and ban\n"
|
||||
"comment: comment for kick"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_kickban, NULL },
|
||||
{ "kill", N_("close client-server connection"),
|
||||
N_("nickname comment"),
|
||||
N_("nickname: nickname\ncomment: comment for kill"),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, NULL },
|
||||
N_("nickname: nickname\n"
|
||||
"comment: comment for kill"),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill },
|
||||
{ "links", N_("list all servernames which are known by the server answering the query"),
|
||||
N_("[[remove_server] server_mask]"),
|
||||
N_("remote_server: this server should answer the query\n"
|
||||
N_("[[server] server_mask]"),
|
||||
N_("server: this server should answer the query\n"
|
||||
"server_mask: list of servers must match this mask"),
|
||||
0, 2, 1, NULL, irc_cmd_send_links, NULL },
|
||||
{ "list", N_("list channels and their topic"),
|
||||
N_("[channel[,channel] [server]]"),
|
||||
N_("channel: channel to list\nserver: server name"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_list, NULL },
|
||||
{ "lusers", N_("get statistics about ths size of the IRC network"),
|
||||
{ "lusers", N_("get statistics about the size of the IRC network"),
|
||||
N_("[mask [target]]"),
|
||||
N_("mask: servers matching the mask only\n"
|
||||
"target: server for forwarding request"),
|
||||
0, 2, 1, NULL, irc_cmd_send_lusers, NULL },
|
||||
{ "me", N_("send a ctcp action to the current channel"),
|
||||
{ "me", N_("send a CTCP action to the current channel"),
|
||||
N_("message"),
|
||||
N_("message: message to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
{ "mode", N_("change channel or user mode"),
|
||||
N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | "
|
||||
"{ nickname {[+|-]|i|w|s|o}"),
|
||||
"{ nickname {[+|-]|i|w|s|o} }"),
|
||||
N_("channel modes:\n"
|
||||
" channel: channel name to modify\n"
|
||||
" o: give/take channel operator privileges\n"
|
||||
@@ -110,6 +148,7 @@ t_irc_command irc_commands[] =
|
||||
" m: moderated channel\n"
|
||||
" l: set the user limit to channel\n"
|
||||
" b: set a ban mask to keep users out\n"
|
||||
" e: set exception mask\n"
|
||||
" v: give/take the ability to speak on a moderated channel\n"
|
||||
" k: set a channel key (password)\n"
|
||||
"user modes:\n"
|
||||
@@ -117,48 +156,58 @@ t_irc_command irc_commands[] =
|
||||
" i: mark a user as invisible\n"
|
||||
" s: mark a user for receive server notices\n"
|
||||
" w: user receives wallops\n"
|
||||
" o: operator flag\n"),
|
||||
" o: operator flag"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode },
|
||||
{ "msg", N_("send message to a nick or channel"),
|
||||
N_("receiver[,receiver] text"),
|
||||
N_("receiver: nick or channel (may be mask, '*' = current channel)"
|
||||
"\ntext: text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
|
||||
{ "motd", N_("get the \"Message Of The Day\""),
|
||||
N_("[target]"),
|
||||
N_("target: server name"),
|
||||
0, 1, 1, NULL, irc_cmd_send_motd, NULL },
|
||||
{ "msg", N_("send message to a nick or channel"),
|
||||
N_("receiver[,receiver] text"),
|
||||
N_("receiver: nick or channel (may be mask, '*' = current channel)\n"
|
||||
"text: text to send"),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
|
||||
{ "names", N_("list nicknames on channels"),
|
||||
N_("[channel[,channel]]"), N_("channel: channel name"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL },
|
||||
0, 1, 1, NULL, irc_cmd_send_names, NULL },
|
||||
{ "nick", N_("change current nickname"),
|
||||
N_("nickname"), N_("nickname: new nickname for current IRC server"),
|
||||
1, 1, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick },
|
||||
N_("[-all] nickname"),
|
||||
N_("-all: set new nickname for all connected servers\n"
|
||||
"nickname: new nickname"),
|
||||
1, 2, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick },
|
||||
{ "notice", N_("send notice message to user"),
|
||||
N_("nickname text"), N_("nickname: user to send notice to\ntext: text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice },
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice },
|
||||
{ "op", N_("gives channel operator status to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_op, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_op, NULL, NULL },
|
||||
{ "oper", N_("get operator privileges"),
|
||||
N_("user password"),
|
||||
N_("user/password: used to get privileges on current IRC server"),
|
||||
2, 2, 1, NULL, irc_cmd_send_oper, NULL },
|
||||
{ "part", N_("leave a channel"),
|
||||
N_("[channel[,channel]]"), N_("channel: channel name to leave"),
|
||||
N_("[channel[,channel]] [part_message]"),
|
||||
N_("channel: channel name to leave\n"
|
||||
"part_message: part message (displayed to other users)"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part },
|
||||
{ "ping", N_("ping server"),
|
||||
N_("server1 [server2]"),
|
||||
N_("server1: server to ping\nserver2: forward ping to this server"),
|
||||
1, 2, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping },
|
||||
{ "pong", N_("answer to a ping message"),
|
||||
N_("daemon [daemon2]"), N_("daemon: daemon who has responded to Ping message\n"
|
||||
"daemon2: forward message to this daemon"),
|
||||
1, 2, 1, NULL, irc_cmd_send_pong, NULL },
|
||||
N_("daemon [daemon2]"),
|
||||
N_("daemon: daemon who has responded to Ping message\n"
|
||||
"daemon2: forward message to this daemon"),
|
||||
1, 2, 1, NULL, irc_cmd_send_pong, irc_cmd_recv_pong },
|
||||
{ "privmsg", N_("message received"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
|
||||
{ "quit", N_("close all connections & quit " PACKAGE_NAME),
|
||||
{ "query", N_("send a private message to a nick"),
|
||||
N_("nickname [text]"),
|
||||
N_("nickname: nickname for private conversation\n"
|
||||
"text: text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
|
||||
{ "quit", N_("close all connections & quit"),
|
||||
N_("[quit_message]"),
|
||||
N_("quit_message: quit message (displayed to other users)"),
|
||||
0, MAX_ARGS, 0, NULL, irc_cmd_send_quit, irc_cmd_recv_quit },
|
||||
@@ -178,14 +227,17 @@ t_irc_command irc_commands[] =
|
||||
"type: reserved for future usage"),
|
||||
6, 6, 1, NULL, irc_cmd_send_service, NULL },
|
||||
{ "servlist", N_("list services currently connected to the network"),
|
||||
N_("[mask [type]]"), N_("mask: list only services matching this mask\n"
|
||||
"type: list only services of this type"),
|
||||
N_("[mask [type]]"),
|
||||
N_("mask: list only services matching this mask\n"
|
||||
"type: list only services of this type"),
|
||||
0, 2, 1, NULL, irc_cmd_send_servlist, NULL },
|
||||
{ "squery", N_("deliver a message to a service"),
|
||||
N_("service text"), N_("service: name of service\ntext: text to send"),
|
||||
N_("service text"),
|
||||
N_("service: name of service\ntext: text to send"),
|
||||
2, 2, 1, NULL, irc_cmd_send_squery, NULL },
|
||||
{ "squit", N_("disconnect server links"),
|
||||
N_("server commnent"), N_("server: server name\ncomment: comment for quit"),
|
||||
N_("server comment"),
|
||||
N_("server: server name\ncomment: comment for quit"),
|
||||
2, 2, 1, NULL, irc_cmd_send_squit, NULL },
|
||||
{ "stats", N_("query statistics about server"),
|
||||
N_("[query [server]]"),
|
||||
@@ -194,18 +246,25 @@ t_irc_command irc_commands[] =
|
||||
{ "summon", N_("give users who are on a host running an IRC server a message "
|
||||
"asking them to please join IRC"),
|
||||
N_("user [target [channel]]"),
|
||||
N_("user: username\ntarget: server name\nchannel: channel name"),
|
||||
N_("user: username\ntarget: server name\n"
|
||||
"channel: channel name"),
|
||||
1, 3, 1, NULL, irc_cmd_send_summon, NULL },
|
||||
{ "time", N_("query local time from server"),
|
||||
N_("[target]"), N_("target: query time from specified server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_time, NULL },
|
||||
{ "topic", N_("get/set channel topic"),
|
||||
N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel "
|
||||
"(if topic is \"-delete\" then topic is deleted)"),
|
||||
N_("[channel] [topic]"),
|
||||
N_("channel: channel name\ntopic: new topic for channel "
|
||||
"(if topic is \"-delete\" then topic is deleted)"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic },
|
||||
{ "trace", N_("find the route to specific server"),
|
||||
N_("[target]"), N_("target: server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_trace, NULL },
|
||||
{ "unban", N_("unbans nicks or hosts"),
|
||||
N_("[channel] nickname [nickname ...]"),
|
||||
N_("channel: channel for unban\n"
|
||||
"nickname: user or host to unban"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_unban, NULL },
|
||||
{ "userhost", N_("return a list of information about nicknames"),
|
||||
N_("nickname [nickname ...]"), N_("nickname: nickname"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_userhost, NULL },
|
||||
@@ -213,98 +272,120 @@ t_irc_command irc_commands[] =
|
||||
N_("[target]"), N_("target: server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_users, NULL },
|
||||
{ "version", N_("gives the version info of nick or server (current or specified)"),
|
||||
N_("[server | nickname]"), N_("server: server name\nnickname: nickname"),
|
||||
N_("[server | nickname]"),
|
||||
N_("server: server name\n"
|
||||
"nickname: nickname"),
|
||||
0, 1, 1, NULL, irc_cmd_send_version, NULL },
|
||||
{ "voice", N_("gives voice to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_voice, NULL, NULL },
|
||||
N_("[nickname [nickname]]"), "",
|
||||
0, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL },
|
||||
{ "wallops", N_("send a message to all currently connected users who have "
|
||||
"set the 'w' user mode for themselves"),
|
||||
N_("text"), N_("text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
|
||||
{ "who", N_("generate a query which returns a list of information"),
|
||||
N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
|
||||
"o: only operators are returned according to the mask supplied\n"),
|
||||
N_("[mask [\"o\"]]"),
|
||||
N_("mask: only information which match this mask\n"
|
||||
"o: only operators are returned according to the mask supplied"),
|
||||
0, 2, 1, NULL, irc_cmd_send_who, NULL },
|
||||
{ "whois", N_("query information about user(s)"),
|
||||
N_("[server] nickname[,nickname]"), N_("server: server name\n"
|
||||
"nickname: nickname (may be a mask)"),
|
||||
N_("[server] nickname[,nickname]"),
|
||||
N_("server: server name\n"
|
||||
"nickname: nickname (may be a mask)"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_whois, NULL },
|
||||
{ "whowas", N_("ask for information about a nickname which no longer exists"),
|
||||
N_("nickname [,nickname [,nickname ...]] [count [target]]"),
|
||||
N_("nickname: nickname to search\ncount: number of replies to return "
|
||||
"(full search if negative number)\n"
|
||||
"target: reply should match this mask"),
|
||||
N_("nickname: nickname to search\n"
|
||||
"count: number of replies to return (full search if negative number)\n"
|
||||
"target: reply should match this mask"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_whowas, NULL },
|
||||
{ "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
|
||||
{ "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
|
||||
{ "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
|
||||
{ "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
|
||||
{ "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
|
||||
{ "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
|
||||
{ "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
|
||||
{ "312", N_("whois (server)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_312 },
|
||||
{ "313", N_("whois (operator)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_313 },
|
||||
{ "314", N_("whowas"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_314 },
|
||||
{ "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "317", N_("whois (idle)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_317 },
|
||||
{ "318", N_("whois (end)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_318 },
|
||||
{ "319", N_("whois (channels)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_319 },
|
||||
{ "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
|
||||
{ "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "008", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "020", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "042", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "221", N_("user mode string"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_221 },
|
||||
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
|
||||
{ "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
|
||||
{ "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
|
||||
{ "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
|
||||
{ "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
|
||||
{ "307", N_("whois (registered nick)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_307 },
|
||||
{ "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
|
||||
{ "312", N_("whois (server)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_312 },
|
||||
{ "313", N_("whois (operator)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_313 },
|
||||
{ "314", N_("whowas"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_314 },
|
||||
{ "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_315 },
|
||||
{ "317", N_("whois (idle)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_317 },
|
||||
{ "318", N_("whois (end)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_318 },
|
||||
{ "319", N_("whois (channels)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_319 },
|
||||
{ "320", N_("whois (identified user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_320 },
|
||||
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
|
||||
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
|
||||
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
|
||||
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
|
||||
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
|
||||
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
|
||||
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
|
||||
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
|
||||
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
|
||||
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
|
||||
{ "332", N_("topic of channel"),
|
||||
N_("channel :topic"),
|
||||
N_("channel: name of channel\ntopic: topic of the channel"),
|
||||
N_("channel: name of channel\n"
|
||||
"topic: topic of the channel"),
|
||||
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_332 },
|
||||
{ "333", N_("infos about topic (nick & date changed)"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, NULL, irc_cmd_recv_333 },
|
||||
{ "341", N_("inviting"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_341 },
|
||||
{ "344", N_("channel reop"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_344 },
|
||||
{ "345", N_("end of channel reop list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_345 },
|
||||
{ "348", N_("channel exception list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_348 },
|
||||
{ "349", N_("end of channel exception list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_349 },
|
||||
{ "351", N_("server version"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_351 },
|
||||
{ "352", N_("who"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_352 },
|
||||
{ "353", N_("list of nicks on channel"),
|
||||
N_("channel :[[@|+]nick ...]"),
|
||||
N_("channel: name of channel\nnick: nick on the channel"),
|
||||
N_("channel: name of channel\n"
|
||||
"nick: nick on the channel"),
|
||||
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 },
|
||||
{ "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 },
|
||||
{ "369", N_("end of /whowas list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 },
|
||||
{ "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
|
||||
{ "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
|
||||
{ "369", N_("end of /whowas list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "381", N_("you are now an IRC operator"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "382", N_("rehashing"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "401", N_("no such nick/channel"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "402", N_("no such server"),
|
||||
@@ -317,12 +398,12 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "406", N_("was no such nick"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "406", N_("was no such nick"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "407", N_("was no such nick"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "409", N_("no origin"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "410", N_("no services"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "411", N_("no recipient"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "412", N_("no text to send"),
|
||||
@@ -341,12 +422,14 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "431", N_("no nickname given"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "432", N_("erroneus nickname"),
|
||||
{ "432", N_("erroneous nickname"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "433", N_("nickname already in use"),
|
||||
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_433 },
|
||||
{ "436", N_("nickname collision"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "438", N_("not authorized to change nickname"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_438 },
|
||||
{ "441", N_("user not in channel"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "442", N_("not on channel"),
|
||||
@@ -373,6 +456,8 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "467", N_("channel key already set"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "470", N_("forwarding to another channel"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "471", N_("channel is already full"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "472", N_("unknown mode char to me"),
|
||||
@@ -383,17 +468,28 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "475", N_("cannot join channel (bad channel key)"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "476", N_("bad channel mask"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "477", N_("channel doesn't support modes"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "481", N_("you're not an IRC operator"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "482", N_("you're not channel operator"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "483", N_("you can't kill a server!"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "484", N_("your connection is restricted!"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "485", N_("user is immune from kick/deop"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "491", N_("no O-lines for your host"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "501", N_("unknown mode flag"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "502", N_("can't change mode for other users"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "505", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "671", N_("whois (secure connection)"),
|
||||
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
+1432
File diff suppressed because it is too large
Load Diff
+156
-59
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -36,21 +36,50 @@
|
||||
|
||||
|
||||
/*
|
||||
* irc_display_prefix: display prefix for action or info message
|
||||
* irc_display_prefix: display a prefix for action/info/error msg
|
||||
* prefix must be 3 chars length
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
irc_display_prefix (t_irc_server *server, 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 (buffer, type, "%s%c%s%c%s%c ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
|
||||
prefix[0],
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX2),
|
||||
prefix[1],
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
|
||||
prefix[2]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
{
|
||||
if (strcmp (prefix, PREFIX_JOIN) == 0)
|
||||
gui_printf_type (buffer, type, "%s%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_JOIN), prefix);
|
||||
else if (strcmp (prefix, PREFIX_PART) == 0)
|
||||
gui_printf_type (buffer, type, "%s%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PART), prefix);
|
||||
else
|
||||
gui_printf_type (buffer, type, "%s%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1), prefix);
|
||||
}
|
||||
if (server && (server->buffer == buffer) && buffer->all_servers)
|
||||
{
|
||||
gui_printf_type (buffer, type, "%s[%s%s%s] ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER), server->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
}
|
||||
gui_printf_type (buffer, type, GUI_NO_COLOR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -59,55 +88,52 @@ irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
|
||||
int type, int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
(nick) ? "<" : ">");
|
||||
if (nick && cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
if (nick->is_chanowner)
|
||||
gui_printf_type (buffer, type, "%s~",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_chanadmin)
|
||||
gui_printf_type (buffer, type, "%s&",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_op)
|
||||
gui_printf_type (buffer, type, "%s@",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_halfop)
|
||||
gui_printf_type (buffer, type, "%s%%",
|
||||
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
|
||||
else if (nick->has_voice)
|
||||
gui_printf_type (buffer, type, "%s+",
|
||||
GUI_COLOR(COLOR_WIN_NICK_VOICE));
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (window,
|
||||
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, " ");
|
||||
}
|
||||
}
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_type (buffer, type, "%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
if (color_nick < 0)
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
else
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR((nick && color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT,
|
||||
"%s", nick->nick);
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
(nick) ? "> " : "< ");
|
||||
gui_printf_type (buffer, type, GUI_NO_COLOR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -115,21 +141,92 @@ 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_irc_server *server, 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 (server, buffer, PREFIX_INFO);
|
||||
gui_printf (buffer, "%s[%s%s%s/%s%c%s%s] %s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
channel_name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
set_flag,
|
||||
symbol,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
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 (buffer, " %s%s %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
message,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
param);
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s\n", message);
|
||||
gui_printf (buffer, " %s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
message);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_server: display server description
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("%sServer: %s%s %s[%s%s%s]\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
server->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
|
||||
gui_printf (NULL, " server_autoconnect . . . .: %s%s\n",
|
||||
(server->autoconnect) ? _("on") : _("off"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
gui_printf (NULL, " server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
gui_printf (NULL, " server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
gui_printf (NULL, " server_ipv6 . . . . . . .: %s\n",
|
||||
(server->ipv6) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_ssl . . . . . . . .: %s\n",
|
||||
(server->ssl) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
gui_printf (NULL, " server_nick1/2/3 . . . . .: %s %s/ %s%s %s/ %s%s\n",
|
||||
server->nick1,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
server->nick2,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
server->nick3);
|
||||
gui_printf (NULL, " server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
gui_printf (NULL, " server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
gui_printf (NULL, " server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf (NULL, " server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
gui_printf (NULL, " server_notify_levels . . .: %s\n",
|
||||
(server->notify_levels && server->notify_levels[0]) ?
|
||||
server->notify_levels : "");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* irc-ignore.c: manages IRC ignore list */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/command.h"
|
||||
|
||||
|
||||
char *ignore_types[] =
|
||||
{ IGNORE_ACTION, IGNORE_CTCP, IGNORE_DCC, IGNORE_PRIVATE, NULL };
|
||||
|
||||
t_irc_ignore *irc_ignore = NULL;
|
||||
t_irc_ignore *last_irc_ignore = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* ignore_check_mask: returns 1 is mask1 and mask2 are the same host
|
||||
* anyone or both strings may have user and/or host after
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_check_mask (char *mask1, char *mask2)
|
||||
{
|
||||
char *m1, *m2, *pos;
|
||||
int match;
|
||||
|
||||
if (!mask1 || !mask1[0] || !mask2 || !mask2[0])
|
||||
return 0;
|
||||
|
||||
m1 = strdup (mask1);
|
||||
m2 = strdup (mask2);
|
||||
|
||||
pos = strchr (m1, '!');
|
||||
if (!pos)
|
||||
{
|
||||
/* remove '!' from m2 */
|
||||
pos = strchr (m2, '!');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
}
|
||||
pos = strchr (m2, '!');
|
||||
if (!pos)
|
||||
{
|
||||
/* remove '!' from m1 */
|
||||
pos = strchr (m1, '!');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
}
|
||||
|
||||
/* TODO: use regexp to match both masks */
|
||||
match = ascii_strcasecmp (m1, m2);
|
||||
|
||||
free (m1);
|
||||
free (m2);
|
||||
|
||||
return (match == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_match: check if pointed ignore matches with arguments
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
/* check mask */
|
||||
if ((strcmp (mask, "*") != 0) && (strcmp (ptr_ignore->mask, "*") != 0)
|
||||
&& (!ignore_check_mask (ptr_ignore->mask, mask)))
|
||||
return 0;
|
||||
|
||||
/* mask is matching, go on with type */
|
||||
if ((strcmp (type, "*") != 0) && (strcmp (ptr_ignore->type, "*") != 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->type, type) != 0))
|
||||
return 0;
|
||||
|
||||
/* mask and type matching, go on with server */
|
||||
if (server_name && server_name[0])
|
||||
{
|
||||
if ((strcmp (server_name, "*") != 0) && (strcmp (ptr_ignore->server_name, "*") != 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->server_name, server_name) != 0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (ptr_ignore->server_name, "*") != 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* mask, type and server matching, go on with channel */
|
||||
if (channel_name && channel_name[0])
|
||||
{
|
||||
if ((strcmp (channel_name, "*") != 0) && (strcmp (ptr_ignore->channel_name, "*") != 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->channel_name, channel_name) != 0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (ptr_ignore->channel_name, "*") != 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* all is matching => we find a ignore! */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_check: check if an ignore is set for arguments
|
||||
* returns 1 if at least one ignore exists (message should NOT be displayed)
|
||||
* 0 if no ignore found (message will be displayed)
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_check (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
if (!mask || !mask[0] || !type || !type[0])
|
||||
return 0;
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
if (ignore_match (ptr_ignore, mask, type, channel_name, server_name))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* no ignore found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_search: search for an ignore
|
||||
*/
|
||||
|
||||
t_irc_ignore *
|
||||
ignore_search (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
if ((ascii_strcasecmp (ptr_ignore->mask, mask) == 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->type, type) == 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->channel_name, channel_name) == 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->server_name, server_name) == 0))
|
||||
return ptr_ignore;
|
||||
}
|
||||
|
||||
/* ignore not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_add: add an ignore in list
|
||||
*/
|
||||
|
||||
t_irc_ignore *
|
||||
ignore_add (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
int i, type_index;
|
||||
t_irc_command *command_ptr;
|
||||
t_irc_ignore *new_ignore;
|
||||
|
||||
if (!mask || !mask[0] || !type || !type[0] || !channel_name || !channel_name[0]
|
||||
|| !server_name || !server_name[0])
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s too few arguments for ignore\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Adding ignore: mask:'%s', type:'%s', channel:'%s', server:'%s'\n",
|
||||
mask, type, channel_name, server_name);
|
||||
#endif
|
||||
|
||||
type_index = -1;
|
||||
command_ptr = NULL;
|
||||
|
||||
if ((strcmp (mask, "*") == 0) && (strcmp (type, "*") == 0))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s mask or type/command should be non generic value for ignore\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ignore_search (mask, type, channel_name, server_name))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s ignore already exists\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp (type, "*") != 0)
|
||||
{
|
||||
/* look for type in pre-defined ignore types */
|
||||
for (i = 0; ignore_types[i]; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (type, ignore_types[i]) == 0)
|
||||
{
|
||||
type_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* not a pre-defined ignore type, so it MUST be an IRC command */
|
||||
if (type_index < 0)
|
||||
{
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].recv_function &&
|
||||
(ascii_strcasecmp (type, irc_commands[i].command_name) == 0))
|
||||
{
|
||||
command_ptr = &irc_commands[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* not a pre-defined command and not an IRC command => error */
|
||||
if ((type_index < 0) && (!command_ptr))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown type or IRC command \"%s\" for ignore\n"),
|
||||
WEECHAT_ERROR, type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* create new ignore */
|
||||
new_ignore = (t_irc_ignore *) malloc (sizeof (t_irc_ignore));
|
||||
if (new_ignore)
|
||||
{
|
||||
new_ignore->mask = strdup (mask);
|
||||
new_ignore->type = strdup (type);
|
||||
new_ignore->server_name = strdup (server_name);
|
||||
new_ignore->channel_name = strdup (channel_name);
|
||||
|
||||
/* add new ignore to queue */
|
||||
new_ignore->prev_ignore = last_irc_ignore;
|
||||
new_ignore->next_ignore = NULL;
|
||||
if (irc_ignore)
|
||||
last_irc_ignore->next_ignore = new_ignore;
|
||||
else
|
||||
irc_ignore = new_ignore;
|
||||
last_irc_ignore = new_ignore;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s not enough memory to create ignore\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new_ignore;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_add_from_config: add an ignore to list, read from config file
|
||||
* (comma serparated values)
|
||||
*/
|
||||
|
||||
t_irc_ignore *
|
||||
ignore_add_from_config (char *string)
|
||||
{
|
||||
t_irc_ignore *new_ignore;
|
||||
char *string2;
|
||||
char *pos_mask, *pos_type, *pos_channel, *pos_server;
|
||||
|
||||
if (!string || !string[0])
|
||||
return NULL;
|
||||
|
||||
new_ignore = NULL;
|
||||
string2 = strdup (string);
|
||||
|
||||
pos_mask = string2;
|
||||
pos_type = strchr (pos_mask, ',');
|
||||
if (pos_type)
|
||||
{
|
||||
pos_type[0] = '\0';
|
||||
pos_type++;
|
||||
pos_channel = strchr (pos_type, ',');
|
||||
if (pos_channel)
|
||||
{
|
||||
pos_channel[0] = '\0';
|
||||
pos_channel++;
|
||||
pos_server = strchr (pos_channel, ',');
|
||||
if (pos_server)
|
||||
{
|
||||
pos_server[0] = '\0';
|
||||
pos_server++;
|
||||
new_ignore = ignore_add (pos_mask, pos_type, pos_channel, pos_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free (string2);
|
||||
return new_ignore;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_free: free an ignore
|
||||
*/
|
||||
|
||||
void
|
||||
ignore_free (t_irc_ignore *ptr_ignore)
|
||||
{
|
||||
t_irc_ignore *new_irc_ignore;
|
||||
|
||||
/* free data */
|
||||
if (ptr_ignore->mask)
|
||||
free (ptr_ignore->mask);
|
||||
if (ptr_ignore->type)
|
||||
free (ptr_ignore->type);
|
||||
if (ptr_ignore->channel_name)
|
||||
free (ptr_ignore->channel_name);
|
||||
if (ptr_ignore->server_name)
|
||||
free (ptr_ignore->server_name);
|
||||
|
||||
/* remove ignore from queue */
|
||||
if (last_irc_ignore == ptr_ignore)
|
||||
last_irc_ignore = ptr_ignore->prev_ignore;
|
||||
if (ptr_ignore->prev_ignore)
|
||||
{
|
||||
(ptr_ignore->prev_ignore)->next_ignore = ptr_ignore->next_ignore;
|
||||
new_irc_ignore = irc_ignore;
|
||||
}
|
||||
else
|
||||
new_irc_ignore = ptr_ignore->next_ignore;
|
||||
|
||||
if (ptr_ignore->next_ignore)
|
||||
(ptr_ignore->next_ignore)->prev_ignore = ptr_ignore->prev_ignore;
|
||||
|
||||
free (ptr_ignore);
|
||||
irc_ignore = new_irc_ignore;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_free_all: free all ignores
|
||||
*/
|
||||
|
||||
void
|
||||
ignore_free_all ()
|
||||
{
|
||||
while (irc_ignore)
|
||||
ignore_free (irc_ignore);
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_search_free: search and free ignore(s)
|
||||
* return: number of ignore found and deleted
|
||||
* 0 if no ignore found
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_search_free (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
int found;
|
||||
t_irc_ignore *ptr_ignore, *next_ignore;
|
||||
|
||||
found = 0;
|
||||
ptr_ignore = irc_ignore;
|
||||
while (ptr_ignore)
|
||||
{
|
||||
if (ignore_match (ptr_ignore, mask, type, channel_name, server_name))
|
||||
{
|
||||
found++;
|
||||
if (found == 1)
|
||||
gui_printf (NULL, "\n");
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore);
|
||||
next_ignore = ptr_ignore->next_ignore;
|
||||
ignore_free (ptr_ignore);
|
||||
ptr_ignore = next_ignore;
|
||||
}
|
||||
else
|
||||
ptr_ignore = ptr_ignore->next_ignore;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_search_free_by_number: search and free ignore(s) by number
|
||||
* return: 1 if ignore found and deleted
|
||||
* 0 if ignore not found
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_search_free_by_number (int number)
|
||||
{
|
||||
int i;
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
if (number < 1)
|
||||
return 0;
|
||||
|
||||
i = 0;
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
i++;
|
||||
if (i == number)
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore);
|
||||
ignore_free (ptr_ignore);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ignore number not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_print_log: print ignore list in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
ignore_print_log ()
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
wee_log_printf ("[ignore list]\n");
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
|
||||
wee_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
|
||||
wee_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
|
||||
wee_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
|
||||
wee_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
|
||||
wee_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
|
||||
wee_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
|
||||
}
|
||||
}
|
||||
+100
-40
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -30,41 +30,46 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
|
||||
|
||||
/*
|
||||
* nick_find_color: find a color for a nick (less used will be better!)
|
||||
* nick_find_color: find a color for a nick (according to nick letters)
|
||||
*/
|
||||
|
||||
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 % cfg_look_color_nicks_number);
|
||||
|
||||
return (color_less_used < 0) ?
|
||||
COLOR_WIN_NICK_FIRST : COLOR_WIN_NICK_FIRST + color_less_used;
|
||||
return COLOR_WIN_NICK_1 + 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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -80,15 +85,14 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
{
|
||||
int score1, score2, comp;
|
||||
|
||||
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
|
||||
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
|
||||
score1 = nick_score_for_sort (nick1);
|
||||
score2 = nick_score_for_sort (nick2);
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
comp = ascii_strcasecmp (nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
score1++;
|
||||
else
|
||||
if (comp < 0)
|
||||
score2++;
|
||||
if (comp < 0)
|
||||
score2++;
|
||||
|
||||
/* nick1 > nick2 */
|
||||
if (score1 > score2)
|
||||
@@ -165,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;
|
||||
|
||||
@@ -173,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;
|
||||
@@ -182,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 (ascii_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;
|
||||
}
|
||||
@@ -231,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);
|
||||
@@ -263,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);
|
||||
@@ -280,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -290,11 +315,14 @@ t_irc_nick *
|
||||
nick_search (t_irc_channel *channel, char *nickname)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
|
||||
if (!nickname)
|
||||
return NULL;
|
||||
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strcasecmp (ptr_nick->nick, nickname) == 0)
|
||||
if (ascii_strcasecmp (ptr_nick->nick, nickname) == 0)
|
||||
return ptr_nick;
|
||||
}
|
||||
return NULL;
|
||||
@@ -319,7 +347,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
|
||||
{
|
||||
@@ -347,8 +375,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)
|
||||
@@ -356,3 +383,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);
|
||||
}
|
||||
|
||||
+3358
-1176
File diff suppressed because it is too large
Load Diff
+1057
-185
File diff suppressed because it is too large
Load Diff
+1196
-197
File diff suppressed because it is too large
Load Diff
+298
-66
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -21,8 +21,22 @@
|
||||
#ifndef __WEECHAT_IRC_H
|
||||
#define __WEECHAT_IRC_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
|
||||
#define PREFIX_SERVER "-@-"
|
||||
#define PREFIX_INFO "-=-"
|
||||
#define PREFIX_ACTION_ME "-*-"
|
||||
@@ -34,8 +48,46 @@
|
||||
|
||||
#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;
|
||||
@@ -43,10 +95,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 is_halfop; /* half operator 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 */
|
||||
};
|
||||
@@ -62,11 +117,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 */
|
||||
};
|
||||
@@ -80,26 +141,47 @@ 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) */
|
||||
int ipv6; /* use IPv6 protocol */
|
||||
int ssl; /* SSL protocol */
|
||||
char *password; /* password for server */
|
||||
char *nick1; /* first nickname for the server */
|
||||
char *nick2; /* alternate nickname */
|
||||
char *nick3; /* 2nd alternate nickname */
|
||||
char *username; /* user name */
|
||||
char *realname; /* real name */
|
||||
char *command; /* command to run once connected */
|
||||
char *autojoin; /* channels to automatically join */
|
||||
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 */
|
||||
char *notify_levels; /* channels notify levels */
|
||||
|
||||
/* 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 (IPv4 or IPv6) */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
int sock4; /* socket for server */
|
||||
#ifdef HAVE_GNUTLS
|
||||
int ssl_connected; /* = 1 if connected with SSL */
|
||||
gnutls_session gnutls_sess; /* gnutls session (only if SSL is used) */
|
||||
#endif
|
||||
|
||||
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_gui_buffer *saved_buffer; /* channel before jumping to next 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 */
|
||||
@@ -122,10 +204,12 @@ struct t_irc_command
|
||||
/* function called when user enters cmd */
|
||||
int (*cmd_function_1arg)(t_irc_server *, char *);
|
||||
/* function called when user enters cmd */
|
||||
int (*recv_function)(t_irc_server *, char *, char *);
|
||||
int (*recv_function)(t_irc_server *, char *, char *, char *);
|
||||
/* function called when cmd is received */
|
||||
};
|
||||
|
||||
/* irc messages */
|
||||
|
||||
typedef struct t_irc_message t_irc_message;
|
||||
|
||||
struct t_irc_message
|
||||
@@ -135,10 +219,73 @@ struct t_irc_message
|
||||
t_irc_message *next_message; /* link to next message */
|
||||
};
|
||||
|
||||
/* DCC types */
|
||||
|
||||
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 */
|
||||
unsigned long start_resume; /* start of resume (in bytes) */
|
||||
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 */
|
||||
time_t last_activity; /* time of last byte received/sent */
|
||||
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
/* ignore types */
|
||||
|
||||
/* pre-defined ignore types, all other types are made with IRC commands */
|
||||
/* for example: part join quit notice invite ... */
|
||||
|
||||
#define IGNORE_ACTION "action"
|
||||
#define IGNORE_CTCP "ctcp"
|
||||
#define IGNORE_DCC "dcc"
|
||||
#define IGNORE_PRIVATE "pv"
|
||||
|
||||
typedef struct t_irc_ignore t_irc_ignore;
|
||||
|
||||
struct t_irc_ignore
|
||||
{
|
||||
char *mask; /* nickname or mask */
|
||||
char *type; /* type of ignore */
|
||||
char *channel_name; /* name of channel, "*" == all */
|
||||
char *server_name; /* name of server, "*" == all */
|
||||
t_irc_ignore *prev_ignore; /* pointer to previous ignore */
|
||||
t_irc_ignore *next_ignore; /* pointer to next ignore */
|
||||
};
|
||||
|
||||
/* variables */
|
||||
|
||||
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;
|
||||
extern char *ignore_types[];
|
||||
extern t_irc_ignore *irc_ignore;
|
||||
extern t_irc_ignore *irc_last_ignore;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
@@ -148,18 +295,35 @@ extern t_irc_server *server_alloc ();
|
||||
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 *, int, int, char *, int, char *, char *,
|
||||
char *, char *, char *, char *, char *, char *);
|
||||
extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int,
|
||||
char *, char *, char *, char *, char *, char *,
|
||||
char *, int, char *, int, char *);
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_recv (t_irc_server *);
|
||||
extern int server_connect ();
|
||||
extern void server_auto_connect (int);
|
||||
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, 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 void server_get_number_buffer (t_irc_server *, int *, int *);
|
||||
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 *);
|
||||
|
||||
/* proxy functions (irc-server.c) */
|
||||
extern void convbase64_8x3_to_6x4(char *from, char* to);
|
||||
extern void base64encode(char *from, char *to);
|
||||
extern int pass_httpproxy(int, char*, int);
|
||||
extern int resolve(char *hostname, char *ip, int *version);
|
||||
extern int pass_socks4proxy(int, char*, int, char*);
|
||||
extern int pass_socks5proxy(int, char*, int);
|
||||
extern int pass_proxy(int, char*, int, char*);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
@@ -168,10 +332,20 @@ 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 int channel_get_notify_level (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_remove_notify_level (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_notify_level (t_irc_server *, t_irc_channel *, int);
|
||||
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 int nick_find_color (t_irc_nick *);
|
||||
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 *);
|
||||
@@ -179,38 +353,67 @@ 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 void dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
|
||||
extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long);
|
||||
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 (/*@null@*/ 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 *,
|
||||
char *, char *);
|
||||
extern void irc_display_prefix (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int,
|
||||
int, int, int);
|
||||
extern void irc_display_mode (t_irc_server *, 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_is_highlight (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_ame (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_amsg (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_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 *, 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_msg (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 *);
|
||||
@@ -219,6 +422,7 @@ 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 *, 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 *);
|
||||
@@ -232,6 +436,7 @@ 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 *);
|
||||
@@ -241,45 +446,72 @@ 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_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 *);
|
||||
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_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 *);
|
||||
extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *);
|
||||
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_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_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 *);
|
||||
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_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_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_433 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_kick (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_kill (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_mode (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_nick (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_topic (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_221 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_305 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_306 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_307 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_314 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_315 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_320 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_341 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_344 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_345 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_348 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_349 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_365 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_367 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_368 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_438 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_671 (t_irc_server *, char *, char *, char *);
|
||||
|
||||
/* ignore functions (irc-ignore.c) */
|
||||
|
||||
extern int ignore_check (char *, char *, char *, char *);
|
||||
extern t_irc_ignore *ignore_add (char *, char *, char *, char *);
|
||||
extern t_irc_ignore *ignore_add_from_config (char *);
|
||||
extern void ignore_free_all ();
|
||||
extern int ignore_search_free (char *, char *, char *, char *);
|
||||
extern int ignore_search_free_by_number (int);
|
||||
extern void ignore_print_log ();
|
||||
|
||||
#endif /* irc.h */
|
||||
|
||||
+15
-12
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
@@ -18,21 +18,24 @@
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
# if PLUGIN_PYTHON
|
||||
# python_dir = python
|
||||
# endif
|
||||
if PLUGIN_PYTHON
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
# if PLUGIN_RUBY
|
||||
# ruby_dir = ruby
|
||||
# endif
|
||||
if PLUGIN_RUBY
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
|
||||
SUBDIRS = $(perl_dir)
|
||||
SUBDIRS = $(script_dir)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_plugins.a
|
||||
|
||||
lib_weechat_plugins_a_SOURCES = plugins.h \
|
||||
plugins.c
|
||||
lib_weechat_plugins_a_SOURCES = weechat-plugin.h \
|
||||
plugins.h \
|
||||
plugins.c \
|
||||
plugins-interface.c \
|
||||
plugins-config.h \
|
||||
plugins-config.c
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
This is plugins directory for WeeChat.
|
||||
|
||||
Today, Perl interface is developed.
|
||||
|
||||
In the future, you'll find there interfaces with other famous languages for
|
||||
writing extensions to WeeChat:
|
||||
- Python interface,
|
||||
- Ruby interface.
|
||||
@@ -1,578 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004 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
|
||||
*/
|
||||
|
||||
/* wee-perl.c: Perl plugin support for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
#include "../../common/weechat.h"
|
||||
#include "../plugins.h"
|
||||
#include "wee-perl.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "../../gui/gui.h"
|
||||
|
||||
|
||||
static PerlInterpreter *my_perl = NULL;
|
||||
|
||||
t_plugin_script *perl_scripts = NULL;
|
||||
t_plugin_script *last_perl_script = NULL;
|
||||
|
||||
extern void boot_DynaLoader (pTHX_ CV* cv);
|
||||
|
||||
|
||||
/*
|
||||
* IRC::register: startup function for all WeeChat Perl scripts
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_register)
|
||||
{
|
||||
char *name, *version, *shutdown_func, *description;
|
||||
int integer;
|
||||
t_plugin_script *ptr_perl_script, *perl_script_found, *new_perl_script;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
version = SvPV (ST (1), integer);
|
||||
shutdown_func = SvPV (ST (2), integer);
|
||||
description = SvPV (ST (3), integer);
|
||||
|
||||
perl_script_found = NULL;
|
||||
for (ptr_perl_script = perl_scripts; ptr_perl_script;
|
||||
ptr_perl_script = ptr_perl_script->next_script)
|
||||
{
|
||||
if (strcasecmp (ptr_perl_script->name, name) == 0)
|
||||
{
|
||||
perl_script_found = ptr_perl_script;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (perl_script_found)
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: unable to register Perl script \"%s\" (another script "
|
||||
"already exists with this name)\n"),
|
||||
name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* registering script */
|
||||
new_perl_script = (t_plugin_script *)malloc (sizeof (t_plugin_script));
|
||||
if (new_perl_script)
|
||||
{
|
||||
new_perl_script->name = strdup (name);
|
||||
new_perl_script->version = strdup (version);
|
||||
new_perl_script->shutdown_func = strdup (shutdown_func);
|
||||
new_perl_script->description = strdup (description);
|
||||
|
||||
/* add new script to list */
|
||||
new_perl_script->prev_script = last_perl_script;
|
||||
new_perl_script->next_script = NULL;
|
||||
if (perl_scripts)
|
||||
last_perl_script->next_script = new_perl_script;
|
||||
else
|
||||
perl_scripts = new_perl_script;
|
||||
last_perl_script = new_perl_script;
|
||||
|
||||
wee_log_printf (_("registered Perl script: \"%s\", version %s (%s)\n"),
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to load Perl script \"%s\" (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
XST_mPV (0, VERSION);
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print: print message to current window
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print)
|
||||
{
|
||||
int i, integer;
|
||||
char *message;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
message = SvPV (ST (i), integer);
|
||||
irc_display_prefix (gui_current_window, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window, "%s", message);
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print_with_channel: print message to a specific channel/server
|
||||
* (server is optional)
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print_with_channel)
|
||||
{
|
||||
int integer;
|
||||
char *message, *channel, *server = NULL;
|
||||
t_gui_window *ptr_window;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
/* server specified */
|
||||
if (items > 2)
|
||||
{
|
||||
server = SvPV (ST (2), integer);
|
||||
if (!server[0])
|
||||
server = NULL;
|
||||
}
|
||||
|
||||
/* look for window for printing message */
|
||||
channel = SvPV (ST (1), integer);
|
||||
ptr_window = NULL;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (!server || (strcasecmp (ptr_server->name, server)) == 0)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (strcasecmp (ptr_channel->name, channel) == 0)
|
||||
{
|
||||
ptr_window = ptr_channel->window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptr_window)
|
||||
break;
|
||||
}
|
||||
|
||||
/* window found => display message & return 1 */
|
||||
if (ptr_window)
|
||||
{
|
||||
message = SvPV (ST (0), integer);
|
||||
irc_display_prefix (ptr_window, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_window, "%s", message);
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/* no window found => return 0 */
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print_infobar: print message to infobar
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print_infobar)
|
||||
{
|
||||
int integer;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
if (items == 2)
|
||||
gui_infobar_printf (SvIV (ST (0)), COLOR_WIN_INFOBAR, SvPV (ST (1), integer));
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: wrong parameters for IRC::print_infobar Perl function\n"));
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::add_message_handler: add handler for messages (privmsg, ...)
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_add_message_handler)
|
||||
{
|
||||
char *name, *function;
|
||||
int integer;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
plugin_handler_add (&plugin_msg_handlers, &last_plugin_msg_handler,
|
||||
PLUGIN_TYPE_PERL, name, function);
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::add_command_handler: add command handler (define/redefine commands)
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_add_command_handler)
|
||||
{
|
||||
char *name, *function;
|
||||
int integer;
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
if (!index_command_search (name))
|
||||
index_command_new (name);
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
free (ptr_plugin_handler->function_name);
|
||||
ptr_plugin_handler->function_name = strdup (function);
|
||||
}
|
||||
else
|
||||
plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
|
||||
PLUGIN_TYPE_PERL, name, function);
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::get_info: get various infos
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_get_info)
|
||||
{
|
||||
char *arg, *info = NULL;
|
||||
int integer;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
arg = SvPV (ST (0), integer);
|
||||
|
||||
if (arg)
|
||||
{
|
||||
|
||||
if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) )
|
||||
{
|
||||
info = PACKAGE_STRING;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) )
|
||||
{
|
||||
info = current_irc_server->nick;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) )
|
||||
{
|
||||
if (WIN_IS_CHANNEL (gui_current_window))
|
||||
info = CHANNEL (gui_current_window)->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
|
||||
{
|
||||
info = current_irc_server->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) )
|
||||
{
|
||||
info = weechat_home;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) )
|
||||
{
|
||||
XST_mIV (0, current_irc_server->is_away);
|
||||
XSRETURN (1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (info)
|
||||
XST_mPV (0, info);
|
||||
else
|
||||
XST_mPV (0, "");
|
||||
}
|
||||
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* xs_init: initialize subroutines
|
||||
*/
|
||||
|
||||
void
|
||||
xs_init (pTHX)
|
||||
{
|
||||
newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
|
||||
newXS ("IRC::register", XS_IRC_register, "IRC");
|
||||
newXS ("IRC::print", XS_IRC_print, "IRC");
|
||||
newXS ("IRC::print_with_channel", XS_IRC_print_with_channel, "IRC");
|
||||
newXS ("IRC::print_infobar", XS_IRC_print_infobar, "IRC");
|
||||
newXS ("IRC::add_message_handler", XS_IRC_add_message_handler, "IRC");
|
||||
newXS ("IRC::add_command_handler", XS_IRC_add_command_handler, "IRC");
|
||||
newXS ("IRC::get_info", XS_IRC_get_info, "IRC");
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_init: initialize Perl interface for WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_init ()
|
||||
{
|
||||
char *perl_args[] = { "", "-e", "0" };
|
||||
/* Following Perl code is extracted/modified from X-Chat IRC client */
|
||||
/* X-Chat is (c) 1998-2002 Peter Zelezny */
|
||||
char *weechat_perl_func =
|
||||
{
|
||||
"sub wee_perl_load_file"
|
||||
"{"
|
||||
" my $filename = shift;"
|
||||
" local $/ = undef;"
|
||||
" open FILE, $filename or return \"__WEECHAT_ERROR__\";"
|
||||
" $_ = <FILE>;"
|
||||
" close FILE;"
|
||||
" return $_;"
|
||||
"}"
|
||||
"sub wee_perl_load_eval_file"
|
||||
"{"
|
||||
" my $filename = shift;"
|
||||
" my $content = wee_perl_load_file ($filename);"
|
||||
" if ($content eq \"__WEECHAT_ERROR__\")"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " Perl script '$filename' not found.\\n\";"
|
||||
" return 1;"
|
||||
" }"
|
||||
" eval $content;"
|
||||
" if ($@)"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " unable to load Perl script '$filename':\\n\";"
|
||||
" IRC::print \"$@\\n\";"
|
||||
" return 2;"
|
||||
" }"
|
||||
" return 0;"
|
||||
"}"
|
||||
"$SIG{__WARN__} = sub { IRC::print \"$_[0]\n\"; };"
|
||||
};
|
||||
|
||||
my_perl = perl_alloc ();
|
||||
perl_construct (my_perl);
|
||||
perl_parse (my_perl, xs_init, 3, perl_args, NULL);
|
||||
eval_pv (weechat_perl_func, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_search: search a (loaded) Perl script by name
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
wee_perl_search (char *name)
|
||||
{
|
||||
t_plugin_script *ptr_perl_script;
|
||||
|
||||
for (ptr_perl_script = perl_scripts; ptr_perl_script;
|
||||
ptr_perl_script = ptr_perl_script->next_script)
|
||||
{
|
||||
if (strcmp (ptr_perl_script->name, name) == 0)
|
||||
return ptr_perl_script;
|
||||
}
|
||||
|
||||
/* script not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_exec: execute a Perl script
|
||||
*/
|
||||
|
||||
int
|
||||
wee_perl_exec (char *function, char *arguments)
|
||||
{
|
||||
char *argv[2];
|
||||
int count, return_code;
|
||||
SV *sv;
|
||||
|
||||
/* call Perl function */
|
||||
dSP;
|
||||
ENTER;
|
||||
SAVETMPS;
|
||||
PUSHMARK(sp);
|
||||
argv[0] = arguments;
|
||||
argv[1] = NULL;
|
||||
count = perl_call_argv (function, G_EVAL | G_SCALAR, argv);
|
||||
SPAGAIN;
|
||||
|
||||
/* check if ok */
|
||||
sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV));
|
||||
return_code = 1;
|
||||
if (SvTRUE (sv))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: %s\n"),
|
||||
SvPV (sv, count));
|
||||
POPs;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count != 1)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),
|
||||
function, count);
|
||||
}
|
||||
else
|
||||
return_code = POPi;
|
||||
}
|
||||
|
||||
PUTBACK;
|
||||
FREETMPS;
|
||||
LEAVE;
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_load: load a Perl script
|
||||
*/
|
||||
|
||||
int
|
||||
wee_perl_load (char *filename)
|
||||
{
|
||||
/* execute Perl script */
|
||||
wee_log_printf (_("loading Perl script \"%s\"\n"), filename);
|
||||
return wee_perl_exec ("wee_perl_load_eval_file", filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_script_free: free a Perl script
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_script_free (t_plugin_script *ptr_perl_script)
|
||||
{
|
||||
t_plugin_script *new_perl_scripts;
|
||||
|
||||
/* remove script from list */
|
||||
if (last_perl_script == ptr_perl_script)
|
||||
last_perl_script = ptr_perl_script->prev_script;
|
||||
if (ptr_perl_script->prev_script)
|
||||
{
|
||||
(ptr_perl_script->prev_script)->next_script = ptr_perl_script->next_script;
|
||||
new_perl_scripts = perl_scripts;
|
||||
}
|
||||
else
|
||||
new_perl_scripts = ptr_perl_script->next_script;
|
||||
|
||||
if (ptr_perl_script->next_script)
|
||||
(ptr_perl_script->next_script)->prev_script = ptr_perl_script->prev_script;
|
||||
|
||||
/* free data */
|
||||
if (ptr_perl_script->name)
|
||||
free (ptr_perl_script->name);
|
||||
if (ptr_perl_script->version)
|
||||
free (ptr_perl_script->version);
|
||||
if (ptr_perl_script->shutdown_func)
|
||||
free (ptr_perl_script->shutdown_func);
|
||||
if (ptr_perl_script->description)
|
||||
free (ptr_perl_script->description);
|
||||
free (ptr_perl_script);
|
||||
perl_scripts = new_perl_scripts;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_unload: unload a Perl script
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_unload (t_plugin_script *ptr_perl_script)
|
||||
{
|
||||
if (ptr_perl_script)
|
||||
{
|
||||
wee_log_printf (_("unloading Perl script \"%s\"\n"),
|
||||
ptr_perl_script->name);
|
||||
|
||||
/* call shutdown callback function */
|
||||
if (ptr_perl_script->shutdown_func[0])
|
||||
wee_perl_exec (ptr_perl_script->shutdown_func, "");
|
||||
wee_perl_script_free (ptr_perl_script);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_unload_all: unload all Perl scripts
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_unload_all ()
|
||||
{
|
||||
wee_log_printf (_("unloading all Perl scripts...\n"));
|
||||
while (perl_scripts)
|
||||
wee_perl_unload (perl_scripts);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_end: shutdown Perl interface
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_end ()
|
||||
{
|
||||
/* unload all scripts */
|
||||
wee_perl_unload_all ();
|
||||
|
||||
/* free all handlers */
|
||||
plugin_handler_free_all_type (&plugin_msg_handlers,
|
||||
&last_plugin_msg_handler,
|
||||
PLUGIN_TYPE_PERL);
|
||||
plugin_handler_free_all_type (&plugin_cmd_handlers,
|
||||
&last_plugin_cmd_handler,
|
||||
PLUGIN_TYPE_PERL);
|
||||
|
||||
/* free Perl interpreter */
|
||||
if (my_perl)
|
||||
{
|
||||
perl_destruct (my_perl);
|
||||
perl_free (my_perl);
|
||||
my_perl = NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* 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-config.c: plugins configuration */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "weechat-plugin.h"
|
||||
#include "plugins-config.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
t_plugin_option *plugin_options = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* plugin_config_search_internal: search a plugin option (internal function)
|
||||
* This function should not be called directly.
|
||||
*/
|
||||
|
||||
t_plugin_option *
|
||||
plugin_config_search_internal (char *option)
|
||||
{
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
|
||||
ptr_plugin_option = ptr_plugin_option->next_option)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_plugin_option->option_name,
|
||||
option) == 0)
|
||||
{
|
||||
return ptr_plugin_option;
|
||||
}
|
||||
}
|
||||
|
||||
/* plugin option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_search: search a plugin option
|
||||
*/
|
||||
|
||||
t_plugin_option *
|
||||
plugin_config_search (t_weechat_plugin *plugin, char *option)
|
||||
{
|
||||
char *internal_option;
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
internal_option = (char *)malloc (strlen (plugin->name) +
|
||||
strlen (option) + 2);
|
||||
if (!internal_option)
|
||||
return NULL;
|
||||
|
||||
strcpy (internal_option, plugin->name);
|
||||
strcat (internal_option, ".");
|
||||
strcat (internal_option, option);
|
||||
|
||||
ptr_plugin_option = plugin_config_search_internal (internal_option);
|
||||
|
||||
free (internal_option);
|
||||
|
||||
return ptr_plugin_option;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_set_internal: set value for a plugin option (internal function)
|
||||
* This function should not be called directly.
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_config_set_internal (char *option, char *value)
|
||||
{
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
ptr_plugin_option = plugin_config_search_internal (option);
|
||||
if (ptr_plugin_option)
|
||||
{
|
||||
if (!value || !value[0])
|
||||
{
|
||||
/* remove option from list */
|
||||
if (ptr_plugin_option->prev_option)
|
||||
(ptr_plugin_option->prev_option)->next_option =
|
||||
ptr_plugin_option->next_option;
|
||||
else
|
||||
plugin_options = ptr_plugin_option->next_option;
|
||||
if (ptr_plugin_option->next_option)
|
||||
(ptr_plugin_option->next_option)->prev_option =
|
||||
ptr_plugin_option->prev_option;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* replace old value by new one */
|
||||
if (ptr_plugin_option->value)
|
||||
free (ptr_plugin_option->value);
|
||||
ptr_plugin_option->value = strdup (value);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_plugin_option = (t_plugin_option *)malloc (sizeof (t_plugin_option));
|
||||
if (ptr_plugin_option)
|
||||
{
|
||||
/* create new option */
|
||||
ptr_plugin_option->option_name = strdup (option);
|
||||
ptr_plugin_option->value = strdup (value);
|
||||
if (plugin_options)
|
||||
plugin_options->prev_option = ptr_plugin_option;
|
||||
ptr_plugin_option->prev_option = NULL;
|
||||
ptr_plugin_option->next_option = plugin_options;
|
||||
plugin_options = ptr_plugin_option;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* failed to set plugin option */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_set: set value for a plugin option (create it if not found)
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_config_set (t_weechat_plugin *plugin, char *option, char *value)
|
||||
{
|
||||
char *internal_option;
|
||||
int return_code;
|
||||
|
||||
internal_option = (char *)malloc (strlen (plugin->name) +
|
||||
strlen (option) + 2);
|
||||
if (!internal_option)
|
||||
return 0;
|
||||
|
||||
strcpy (internal_option, plugin->name);
|
||||
strcat (internal_option, ".");
|
||||
strcat (internal_option, option);
|
||||
|
||||
return_code = plugin_config_set_internal (internal_option, value);
|
||||
free (internal_option);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_read: read WeeChat plugins configuration
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_config_read ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
FILE *file;
|
||||
int line_number;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
|
||||
weechat_home, DIR_SEPARATOR);
|
||||
if ((file = fopen (filename, "rt")) == NULL)
|
||||
return;
|
||||
|
||||
line_number = 0;
|
||||
while (!feof (file))
|
||||
{
|
||||
ptr_line = fgets (line, sizeof (line) - 1, file);
|
||||
line_number++;
|
||||
if (ptr_line)
|
||||
{
|
||||
/* skip spaces */
|
||||
while (ptr_line[0] == ' ')
|
||||
ptr_line++;
|
||||
/* not a comment and not an empty line */
|
||||
if ((ptr_line[0] != '#') && (ptr_line[0] != '\r')
|
||||
&& (ptr_line[0] != '\n'))
|
||||
{
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\r');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
plugin_config_set_internal (ptr_line, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_write: write WeeChat configurtion
|
||||
* return: 0 if ok
|
||||
* < 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_config_write ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
FILE *file;
|
||||
time_t current_time;
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return -2;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
|
||||
weechat_home, DIR_SEPARATOR);
|
||||
|
||||
if ((file = fopen (filename, "wt")) == NULL)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
||||
WEECHAT_ERROR, filename);
|
||||
free (filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s plugins configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when options are updated.\n#\n"));
|
||||
|
||||
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
|
||||
ptr_plugin_option = ptr_plugin_option->next_option)
|
||||
{
|
||||
fprintf (file, "%s=%s\n",
|
||||
ptr_plugin_option->option_name,
|
||||
ptr_plugin_option->value);
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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_PLUGINS_CONFIG_H
|
||||
#define __WEECHAT_PLUGINS_CONFIG_H 1
|
||||
|
||||
#define WEECHAT_PLUGINS_CONFIG_NAME "plugins.rc"
|
||||
|
||||
typedef struct t_plugin_option t_plugin_option;
|
||||
|
||||
struct t_plugin_option
|
||||
{
|
||||
char *option_name; /* option name in config file */
|
||||
char *value; /* value of option */
|
||||
t_plugin_option *prev_option; /* link to previous option */
|
||||
t_plugin_option *next_option; /* link to next option */
|
||||
};
|
||||
|
||||
extern t_plugin_option *plugin_config_search (t_weechat_plugin *, char *);
|
||||
extern int plugin_config_set (t_weechat_plugin *, char *, char *);
|
||||
extern void plugin_config_read ();
|
||||
extern int plugin_config_write ();
|
||||
|
||||
#endif /* plugins-config.h */
|
||||
@@ -0,0 +1,646 @@
|
||||
/*
|
||||
* 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-interface.c: WeeChat plugins interface */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "plugins-config.h"
|
||||
#include "../common/command.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* weechat_ascii_strcasecmp: locale and case independent string comparison
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
|
||||
char *string1, char *string2)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
return ascii_strcasecmp (string1, string2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ascii_strncasecmp: locale and case independent string comparison
|
||||
* with max length
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
|
||||
char *string1, char *string2, int max)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
return ascii_strncasecmp (string1, string2, max);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_explode_string: explode a string
|
||||
*/
|
||||
|
||||
char **
|
||||
weechat_explode_string (t_weechat_plugin *plugin, char *string,
|
||||
char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!plugin || !string || !separators || !num_items)
|
||||
return NULL;
|
||||
|
||||
return explode_string (string, separators, num_items_max, num_items);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_free_exploded_string: free exploded string
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
free_exploded_string (exploded_string);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *path)
|
||||
{
|
||||
char *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!path)
|
||||
return 0;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_length = strlen (weechat_home) + strlen (path) + 2;
|
||||
dir_name =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!dir_name)
|
||||
return 0;
|
||||
|
||||
snprintf (dir_name, dir_length, "%s/%s", weechat_home, path);
|
||||
|
||||
if (mkdir (dir_name, 0755) < 0)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
free (dir_name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
free (dir_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_exec_on_files: find files in a directory and execute a
|
||||
* function on each file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
|
||||
int (*callback)(t_weechat_plugin *, char *))
|
||||
{
|
||||
if (directory && callback)
|
||||
plugin_exec_on_files (plugin, directory, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_printf: print a message on a server or channel buffer
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_printf (t_weechat_plugin *plugin,
|
||||
char *server, char *channel, char *message, ...)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
|
||||
ptr_buffer = plugin_find_buffer (server, channel);
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
irc_display_prefix (NULL, ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s\n", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_printf_server: print a message on server buffer
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "%s\n", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_infobar_printf: print a message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[1024];
|
||||
|
||||
if (!plugin || (time_displayed < 0) || !message)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_msg_handler_add: add a message handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
weechat_plugin_msg_handler_add (t_weechat_plugin *plugin, char *message,
|
||||
t_plugin_handler_func *handler_func,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
if (plugin && message && handler_func)
|
||||
return plugin_msg_handler_add (plugin, message, handler_func,
|
||||
handler_args, handler_pointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_cmd_handler_add: add a command handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
|
||||
char *description, char *arguments,
|
||||
char *arguments_description,
|
||||
t_plugin_handler_func *handler_func,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
if (plugin && command && handler_func)
|
||||
return plugin_cmd_handler_add (plugin, command, description, arguments,
|
||||
arguments_description,
|
||||
handler_func,
|
||||
handler_args, handler_pointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_handler_remove: remove a WeeChat handler
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_handler_remove (t_weechat_plugin *plugin,
|
||||
t_plugin_handler *handler)
|
||||
{
|
||||
if (plugin && handler)
|
||||
plugin_handler_remove (plugin, handler);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_handler_remove_all: remove all WeeChat handlers
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_handler_remove_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
if (plugin)
|
||||
plugin_handler_remove_all (plugin);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_exec_command: execute a command (simulate user entry)
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_exec_command (t_weechat_plugin *plugin,
|
||||
char *server, char *channel, char *command)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
if (!plugin || !command)
|
||||
return;
|
||||
|
||||
plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel);
|
||||
if (ptr_server && ptr_channel)
|
||||
user_command (ptr_server, ptr_channel->buffer, command);
|
||||
else if (ptr_server && (ptr_server->buffer))
|
||||
user_command (ptr_server, ptr_server->buffer, command);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_info: get info about WeeChat
|
||||
* WARNING: caller should free string returned
|
||||
* by this function after use
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
if (!plugin || !info)
|
||||
return NULL;
|
||||
|
||||
/* below are infos that do NOT need server to return info */
|
||||
|
||||
if (ascii_strcasecmp (info, "version") == 0)
|
||||
{
|
||||
return strdup (PACKAGE_VERSION);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechatdir") == 0)
|
||||
{
|
||||
/* WARNING: deprecated info, you should use "weechat_dir" */
|
||||
/* will be removed in a future version */
|
||||
return strdup (weechat_home);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechat_dir") == 0)
|
||||
{
|
||||
return strdup (weechat_home);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechat_libdir") == 0)
|
||||
{
|
||||
return strdup (WEECHAT_LIBDIR);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechat_sharedir") == 0)
|
||||
{
|
||||
return strdup (WEECHAT_SHAREDIR);
|
||||
}
|
||||
|
||||
/* below are infos that need server to return value */
|
||||
|
||||
plugin_find_server_channel (server, NULL, &ptr_server, &ptr_channel);
|
||||
if (!ptr_server)
|
||||
return NULL;
|
||||
|
||||
if (ascii_strcasecmp (info, "nick") == 0)
|
||||
{
|
||||
if (ptr_server->is_connected && ptr_server->nick)
|
||||
return strdup (ptr_server->nick);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "channel") == 0)
|
||||
{
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
return strdup (CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "server") == 0)
|
||||
{
|
||||
if (ptr_server->is_connected && ptr_server->name)
|
||||
return strdup (ptr_server->name);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "away") == 0)
|
||||
{
|
||||
if (ptr_server->is_connected && ptr_server->is_away)
|
||||
return strdup ("1");
|
||||
else
|
||||
return strdup ("0");
|
||||
}
|
||||
|
||||
/* info not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_dcc_info: get list of DCC files/chats info
|
||||
*/
|
||||
|
||||
t_plugin_dcc_info *
|
||||
weechat_plugin_get_dcc_info (t_weechat_plugin *plugin)
|
||||
{
|
||||
t_plugin_dcc_info *dcc_info, *last_dcc_info, *new_dcc_info;
|
||||
t_irc_dcc *ptr_dcc;
|
||||
|
||||
if (!plugin)
|
||||
return NULL;
|
||||
|
||||
if (dcc_list)
|
||||
{
|
||||
dcc_info = NULL;
|
||||
last_dcc_info = NULL;
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
new_dcc_info = (t_plugin_dcc_info *)malloc (sizeof (t_plugin_dcc_info));
|
||||
if (new_dcc_info)
|
||||
{
|
||||
new_dcc_info->server = (ptr_dcc->server) ? strdup (ptr_dcc->server->name) : strdup ("");
|
||||
new_dcc_info->channel = (ptr_dcc->channel) ? strdup (ptr_dcc->channel->name) : strdup ("");
|
||||
new_dcc_info->type = ptr_dcc->type;
|
||||
new_dcc_info->status = ptr_dcc->status;
|
||||
new_dcc_info->start_time = ptr_dcc->start_time;
|
||||
new_dcc_info->start_transfer = ptr_dcc->start_transfer;
|
||||
new_dcc_info->addr = ptr_dcc->addr;
|
||||
new_dcc_info->port = ptr_dcc->port;
|
||||
new_dcc_info->nick = (ptr_dcc->nick) ? strdup (ptr_dcc->nick) : strdup ("");
|
||||
new_dcc_info->filename = (ptr_dcc->filename) ? strdup (ptr_dcc->filename) : strdup ("");
|
||||
new_dcc_info->local_filename = (ptr_dcc->local_filename) ? strdup (ptr_dcc->local_filename) : strdup ("");
|
||||
new_dcc_info->filename_suffix = ptr_dcc->filename_suffix;
|
||||
new_dcc_info->size = ptr_dcc->size;
|
||||
new_dcc_info->pos = ptr_dcc->pos;
|
||||
new_dcc_info->start_resume = ptr_dcc->start_resume;
|
||||
new_dcc_info->bytes_per_sec = ptr_dcc->bytes_per_sec;
|
||||
|
||||
new_dcc_info->prev_dcc = last_dcc_info;
|
||||
new_dcc_info->next_dcc = NULL;
|
||||
if (!dcc_info)
|
||||
{
|
||||
dcc_info = new_dcc_info;
|
||||
last_dcc_info = new_dcc_info;
|
||||
}
|
||||
else
|
||||
last_dcc_info->next_dcc = new_dcc_info;
|
||||
}
|
||||
}
|
||||
|
||||
return dcc_info;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_free_dcc_info: free dcc info struct list
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info)
|
||||
{
|
||||
t_plugin_dcc_info *new_dcc_info;
|
||||
|
||||
if (!plugin || !dcc_info)
|
||||
return;
|
||||
|
||||
while (dcc_info)
|
||||
{
|
||||
if (dcc_info->server)
|
||||
free (dcc_info->server);
|
||||
if (dcc_info->channel)
|
||||
free (dcc_info->channel);
|
||||
if (dcc_info->nick)
|
||||
free (dcc_info->nick);
|
||||
if (dcc_info->filename)
|
||||
free (dcc_info->filename);
|
||||
if (dcc_info->local_filename)
|
||||
free (dcc_info->local_filename);
|
||||
new_dcc_info = dcc_info->next_dcc;
|
||||
free (dcc_info);
|
||||
dcc_info = new_dcc_info;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_config_str_value: return string value for any option
|
||||
* This function should never be called directly
|
||||
* (only used by weechat_get_config)
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
|
||||
{
|
||||
char buf_temp[1024], *color_name;
|
||||
|
||||
if (!value)
|
||||
{
|
||||
if (option->option_type == OPTION_TYPE_STRING)
|
||||
value = option->ptr_string;
|
||||
else
|
||||
value = option->ptr_int;
|
||||
}
|
||||
|
||||
switch (option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
return (*((int *)value)) ?
|
||||
strdup ("on") : strdup ("off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
snprintf (buf_temp, sizeof (buf_temp), "%d",
|
||||
*((int *)value));
|
||||
return strdup (buf_temp);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
return option->array_values[*((int *)value)];
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
color_name = gui_get_color_name (*((int *)value));
|
||||
return (color_name) ? strdup (color_name) : strdup ("");
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
|
||||
break;
|
||||
}
|
||||
|
||||
/* should never be executed! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_config: get value of a config option
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
|
||||
{
|
||||
int i, j;
|
||||
t_irc_server *ptr_server;
|
||||
char option_name[256];
|
||||
void *ptr_option_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
if ((!option) ||
|
||||
((option) && (option[0])
|
||||
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
|
||||
{
|
||||
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
if ((!option) ||
|
||||
((option) && (option[0])
|
||||
&& (strstr (option_name, option) != NULL)))
|
||||
{
|
||||
ptr_option_value = config_get_server_option_ptr (ptr_server,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
if (ptr_option_value)
|
||||
{
|
||||
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
|
||||
ptr_option_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_set_config: set value of a config option
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value)
|
||||
{
|
||||
char *pos, *server_name;
|
||||
t_irc_server *ptr_server;
|
||||
t_config_option *ptr_option;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!option || !value)
|
||||
return 0;
|
||||
|
||||
pos = strchr (option, '.');
|
||||
if (pos)
|
||||
{
|
||||
/* server config option modification */
|
||||
server_name = (char *)malloc (pos - option + 1);
|
||||
strncpy (server_name, option, pos - option);
|
||||
if (server_name)
|
||||
{
|
||||
ptr_server = server_search (server_name);
|
||||
free (server_name);
|
||||
if (ptr_server)
|
||||
return (config_set_server_value (ptr_server, pos + 1, value) == 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_option = config_option_search (option);
|
||||
if (ptr_option)
|
||||
{
|
||||
if (ptr_option->handler_change)
|
||||
{
|
||||
if (config_option_set_value (ptr_option, value) == 0)
|
||||
{
|
||||
(void) (ptr_option->handler_change());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* failed to set config option */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_plugin_config: get value of a plugin config option
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_plugin_config (t_weechat_plugin *plugin, char *option)
|
||||
{
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
if (!option)
|
||||
return NULL;
|
||||
|
||||
ptr_plugin_option = plugin_config_search (plugin, option);
|
||||
if (ptr_plugin_option)
|
||||
return (ptr_plugin_option->value) ? strdup (ptr_plugin_option->value) : NULL;
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_set_plugin_config: set value of a plugin config option
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_set_plugin_config (t_weechat_plugin *plugin, char *option, char *value)
|
||||
{
|
||||
if (!option)
|
||||
return 0;
|
||||
|
||||
if (plugin_config_set (plugin, option, value))
|
||||
{
|
||||
plugin_config_write ();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+836
-269
File diff suppressed because it is too large
Load Diff
+33
-46
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@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
|
||||
@@ -21,54 +21,41 @@
|
||||
#ifndef __WEECHAT_PLUGINS_H
|
||||
#define __WEECHAT_PLUGINS_H 1
|
||||
|
||||
#define PLUGIN_TYPE_PERL 0
|
||||
#define PLUGIN_TYPE_PYTHON 1
|
||||
#define PLUGIN_TYPE_RUBY 2
|
||||
#include "weechat-plugin.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
typedef struct t_plugin_script t_plugin_script;
|
||||
typedef int (t_weechat_init_func) (t_weechat_plugin *);
|
||||
typedef void (t_weechat_end_func) (t_weechat_plugin *);
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
char *name; /* name of script */
|
||||
char *version; /* version of script */
|
||||
char *shutdown_func; /* function when script ends */
|
||||
char *description; /* description of script */
|
||||
t_plugin_script *prev_script; /* link to previous Perl script */
|
||||
t_plugin_script *next_script; /* link to next Perl script */
|
||||
};
|
||||
extern t_weechat_plugin *weechat_plugins;
|
||||
extern t_weechat_plugin *last_weechat_plugin;
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
|
||||
struct t_plugin_handler
|
||||
{
|
||||
int plugin_type; /* plugin type (Perl, Python, Ruby) */
|
||||
char *name; /* name of IRC command (PRIVMSG, ..)
|
||||
or command (without first '/') */
|
||||
char *function_name; /* name of function (handler) */
|
||||
t_plugin_handler *prev_handler; /* link to previous handler */
|
||||
t_plugin_handler *next_handler; /* link to next handler */
|
||||
};
|
||||
|
||||
extern t_plugin_handler *plugin_msg_handlers;
|
||||
extern t_plugin_handler *last_plugin_msg_handler;
|
||||
|
||||
extern t_plugin_handler *plugin_cmd_handlers;
|
||||
extern t_plugin_handler *last_plugin_cmd_handler;
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
extern t_plugin_script *perl_scripts;
|
||||
#endif
|
||||
|
||||
extern void plugin_init ();
|
||||
extern void plugin_load (int, char *);
|
||||
extern void plugin_unload (int, /*@null@*/ char *);
|
||||
extern t_plugin_handler *plugin_handler_search (t_plugin_handler *, char *);
|
||||
extern void plugin_handler_add (t_plugin_handler **, t_plugin_handler **,
|
||||
int, char *, char *);
|
||||
extern void plugin_handler_free_all_type (t_plugin_handler **,
|
||||
t_plugin_handler **, int);
|
||||
extern void plugin_event_msg (char *, char *);
|
||||
extern int plugin_exec_command (char *, /*@null@*/ char *);
|
||||
extern t_gui_buffer *plugin_find_buffer (char *, char *);
|
||||
extern void plugin_find_server_channel (char *, char *,
|
||||
t_irc_server **, t_irc_channel **);
|
||||
extern void plugin_exec_on_files (t_weechat_plugin *, char *,
|
||||
int (*)(t_weechat_plugin *, char *));
|
||||
extern t_weechat_plugin *plugin_search (char *);
|
||||
extern t_plugin_handler *plugin_msg_handler_add (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern t_plugin_handler *plugin_cmd_handler_add (t_weechat_plugin *, char *,
|
||||
char *, char *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern int plugin_msg_handler_exec (char *, char *, char *);
|
||||
extern int plugin_cmd_handler_exec (char *, char *, char *);
|
||||
extern void plugin_handler_remove (t_weechat_plugin *,
|
||||
t_plugin_handler *);
|
||||
extern void plugin_handler_remove_all (t_weechat_plugin *);
|
||||
extern t_weechat_plugin *plugin_load (char *);
|
||||
extern void plugin_auto_load ();
|
||||
extern void plugin_remove (t_weechat_plugin *);
|
||||
extern void plugin_unload (t_weechat_plugin *);
|
||||
extern void plugin_unload_name (char *);
|
||||
extern void plugin_unload_all ();
|
||||
extern void plugin_init (int);
|
||||
extern void plugin_end ();
|
||||
|
||||
#endif /* plugins.h */
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# 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_LTLIBRARIES = lib_weechat_plugins_scripts.la
|
||||
|
||||
lib_weechat_plugins_scripts_la_SOURCES = weechat-script.h \
|
||||
weechat-script.c
|
||||
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
endif
|
||||
|
||||
if PLUGIN_PYTHON
|
||||
python_dir = python
|
||||
endif
|
||||
|
||||
if PLUGIN_RUBY
|
||||
ruby_dir = ruby
|
||||
endif
|
||||
|
||||
SUBDIRS = . $(perl_dir) $(python_dir) $(ruby_dir)
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2004 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
|
||||
@@ -17,7 +17,10 @@
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PERL_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_perl.a
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_weechat_perl_a_SOURCES = wee-perl.h \
|
||||
wee-perl.c
|
||||
lib_LTLIBRARIES = libperl.la
|
||||
|
||||
libperl_la_SOURCES = weechat-perl.c
|
||||
libperl_la_LDFLAGS = -module
|
||||
libperl_la_LIBADD = ../lib_weechat_plugins_scripts.la $(PERL_LFLAGS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
# 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\" $(PYTHON_CFLAGS)
|
||||
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_LTLIBRARIES = libpython.la
|
||||
|
||||
libpython_la_SOURCES = weechat-python.c
|
||||
libpython_la_LDFLAGS = -module
|
||||
libpython_la_LIBADD = ../lib_weechat_plugins_scripts.la $(PYTHON_LFLAGS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
# 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\" $(RUBY_CFLAGS)
|
||||
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_LTLIBRARIES = libruby.la
|
||||
|
||||
libruby_la_SOURCES = weechat-ruby.c
|
||||
libruby_la_LDFLAGS = -module
|
||||
libruby_la_LIBADD = ../lib_weechat_plugins_scripts.la $(RUBY_LFLAGS)
|
||||
@@ -0,0 +1,976 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* wee-ruby.c: Ruby plugin support for WeeChat */
|
||||
|
||||
|
||||
#include <ruby.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#undef _
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../weechat-script.h"
|
||||
|
||||
|
||||
char plugin_name[] = "Ruby";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Ruby scripts support";
|
||||
|
||||
t_weechat_plugin *ruby_plugin;
|
||||
|
||||
t_plugin_script *ruby_scripts = NULL;
|
||||
t_plugin_script *ruby_current_script = NULL;
|
||||
char *ruby_current_script_filename = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* weechat_ruby_exec: execute a Ruby script
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_exec (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *function, char *server, char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) script;
|
||||
(void) function;
|
||||
(void) server;
|
||||
(void) arguments;
|
||||
|
||||
/* TODO: exec Ruby script */
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_handler: general message and command handler for Ruby
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_handler (t_weechat_plugin *plugin,
|
||||
char *server, char *command, char *arguments,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) command;
|
||||
|
||||
return weechat_ruby_exec (plugin, (t_plugin_script *)handler_pointer,
|
||||
handler_args, server, arguments);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_register: startup function for all WeeChat Ruby scripts
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
VALUE shutdown_func, VALUE description)
|
||||
{
|
||||
char *c_name, *c_version, *c_shutdown_func, *c_description;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (NIL_P (name) || NIL_P (version) || NIL_P (shutdown_func) || NIL_P (description))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (name, T_STRING);
|
||||
Check_Type (version, T_STRING);
|
||||
Check_Type (shutdown_func, T_STRING);
|
||||
Check_Type (description, T_STRING);
|
||||
|
||||
c_name = STR2CSTR (name);
|
||||
c_version = STR2CSTR (version);
|
||||
c_shutdown_func = STR2CSTR (shutdown_func);
|
||||
c_description = STR2CSTR (description);
|
||||
|
||||
if (weechat_script_search (ruby_plugin, &ruby_scripts, c_name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
c_name);
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/* register script */
|
||||
ruby_current_script = weechat_script_add (ruby_plugin,
|
||||
&ruby_scripts,
|
||||
(ruby_current_script_filename) ?
|
||||
ruby_current_script_filename : "",
|
||||
c_name, c_version, c_shutdown_func,
|
||||
c_description);
|
||||
if (ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
c_name, c_version, c_description);
|
||||
}
|
||||
else
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
c_name);
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_print (VALUE class, VALUE message, VALUE channel_name,
|
||||
VALUE server_name)
|
||||
{
|
||||
char *c_message, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to print message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_message = NULL;
|
||||
c_channel_name = NULL;
|
||||
c_server_name = NULL;
|
||||
|
||||
if (NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (message, T_STRING);
|
||||
if (!NIL_P (channel_name))
|
||||
Check_Type (channel_name, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
|
||||
c_message = STR2CSTR (message);
|
||||
if (!NIL_P (channel_name))
|
||||
c_channel_name = STR2CSTR (channel_name);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
|
||||
ruby_plugin->printf (ruby_plugin,
|
||||
c_server_name, c_channel_name,
|
||||
"%s", c_message);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_print_infobar: print message to infobar
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
|
||||
{
|
||||
int c_delay;
|
||||
char *c_message;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_delay = 1;
|
||||
c_message = NULL;
|
||||
|
||||
if (NIL_P (delay) || NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (delay, T_FIXNUM);
|
||||
Check_Type (message, T_STRING);
|
||||
|
||||
c_delay = FIX2INT (delay);
|
||||
c_message = STR2CSTR (message);
|
||||
|
||||
ruby_plugin->infobar_printf (ruby_plugin, c_delay, c_message);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_command: send command to server
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_command (VALUE class, VALUE command, VALUE channel_name,
|
||||
VALUE server_name)
|
||||
{
|
||||
char *c_command, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to run command, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_command = NULL;
|
||||
c_channel_name = NULL;
|
||||
c_server_name = NULL;
|
||||
|
||||
if (NIL_P (command))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (command, T_STRING);
|
||||
if (!NIL_P (channel_name))
|
||||
Check_Type (channel_name, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
|
||||
c_command = STR2CSTR (command);
|
||||
if (!NIL_P (channel_name))
|
||||
c_channel_name = STR2CSTR (channel_name);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
|
||||
ruby_plugin->exec_command (ruby_plugin,
|
||||
c_server_name, c_channel_name,
|
||||
c_command);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_add_message_handler: add handler for messages
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_add_message_handler (VALUE class, VALUE message, VALUE function)
|
||||
{
|
||||
char *c_message, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_message = NULL;
|
||||
c_function = NULL;
|
||||
|
||||
if (NIL_P (message) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (message, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
|
||||
c_message = STR2CSTR (message);
|
||||
c_function = STR2CSTR (function);
|
||||
|
||||
if (ruby_plugin->msg_handler_add (ruby_plugin, c_message,
|
||||
weechat_ruby_handler, c_function,
|
||||
(void *)ruby_current_script))
|
||||
return INT2FIX (1);
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_add_command_handler: define/redefines commands
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_add_command_handler (VALUE class, VALUE command, VALUE function,
|
||||
VALUE description, VALUE arguments,
|
||||
VALUE arguments_description)
|
||||
{
|
||||
char *c_command, *c_function, *c_description, *c_arguments;
|
||||
char *c_arguments_description;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_command = NULL;
|
||||
c_function = NULL;
|
||||
c_description = NULL;
|
||||
c_arguments = NULL;
|
||||
c_arguments_description = NULL;
|
||||
|
||||
if (NIL_P (command) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (command, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
if (!NIL_P (description))
|
||||
Check_Type (description, T_STRING);
|
||||
if (!NIL_P (arguments))
|
||||
Check_Type (arguments, T_STRING);
|
||||
if (!NIL_P (arguments_description))
|
||||
Check_Type (arguments_description, T_STRING);
|
||||
|
||||
c_command = STR2CSTR (command);
|
||||
c_function = STR2CSTR (function);
|
||||
if (!NIL_P (description))
|
||||
c_description = STR2CSTR (description);
|
||||
if (!NIL_P (arguments))
|
||||
c_arguments = STR2CSTR (arguments);
|
||||
if (!NIL_P (arguments_description))
|
||||
c_arguments_description = STR2CSTR (arguments_description);
|
||||
|
||||
if (ruby_plugin->cmd_handler_add (ruby_plugin,
|
||||
c_command,
|
||||
c_description,
|
||||
c_arguments,
|
||||
c_arguments_description,
|
||||
weechat_ruby_handler,
|
||||
c_function,
|
||||
(void *)ruby_current_script))
|
||||
return INT2FIX (1);
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_remove_handler: remove a handler
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
|
||||
{
|
||||
char *c_command, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_command = NULL;
|
||||
c_function = NULL;
|
||||
|
||||
if (NIL_P (command) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (command, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
|
||||
c_command = STR2CSTR (command);
|
||||
c_function = STR2CSTR (function);
|
||||
|
||||
weechat_script_remove_handler (ruby_plugin, ruby_current_script,
|
||||
c_command, c_function);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_info: get various infos
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_info (VALUE class, VALUE arg, VALUE server_name)
|
||||
{
|
||||
char *c_arg, *c_server_name, *info;
|
||||
VALUE return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get info, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_arg = NULL;
|
||||
c_server_name = NULL;
|
||||
|
||||
if (NIL_P (arg))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (arg, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
|
||||
c_arg = STR2CSTR (arg);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
|
||||
if (c_arg)
|
||||
{
|
||||
info = ruby_plugin->get_info (ruby_plugin, c_arg, c_server_name);
|
||||
|
||||
if (info)
|
||||
{
|
||||
return_value = rb_str_new2 (info);
|
||||
free (info);
|
||||
return return_value;
|
||||
}
|
||||
}
|
||||
|
||||
return rb_str_new2 ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_dcc_info: get infos about DCC
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_dcc_info (VALUE class)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/* TODO: get dcc info for Ruby */
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_config: get value of a WeeChat config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_config (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option, *return_value;
|
||||
VALUE ruby_return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
if (c_option)
|
||||
{
|
||||
return_value = ruby_plugin->get_config (ruby_plugin, c_option);
|
||||
|
||||
if (return_value)
|
||||
{
|
||||
ruby_return_value = rb_str_new2 (return_value);
|
||||
free (return_value);
|
||||
return ruby_return_value;
|
||||
}
|
||||
}
|
||||
|
||||
return rb_str_new2 ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_set_config: set value of a WeeChat config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_set_config (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to set config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
c_value = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (value, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
c_value = STR2CSTR (value);
|
||||
|
||||
if (c_option && c_value)
|
||||
{
|
||||
if (ruby_plugin->set_config (ruby_plugin, c_option, c_value))
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_plugin_config: get value of a plugin config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_plugin_config (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option, *return_value;
|
||||
VALUE ruby_return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
if (c_option)
|
||||
{
|
||||
return_value = weechat_script_get_plugin_config (ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option);
|
||||
|
||||
if (return_value)
|
||||
{
|
||||
ruby_return_value = rb_str_new2 (return_value);
|
||||
free (return_value);
|
||||
return ruby_return_value;
|
||||
}
|
||||
}
|
||||
|
||||
return rb_str_new2 ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_set_plugin_config: set value of a plugin config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_set_plugin_config (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
c_value = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (value, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
c_value = STR2CSTR (value);
|
||||
|
||||
if (c_option && c_value)
|
||||
{
|
||||
if (weechat_script_set_plugin_config (ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option, c_value))
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ruby subroutines
|
||||
*/
|
||||
|
||||
/* TODO: write Ruby functions interface */
|
||||
|
||||
/*
|
||||
* weechat_ruby_load: load a Ruby script
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) filename;
|
||||
|
||||
/* TODO: load & exec Ruby script */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_unload: unload a Ruby script
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_ruby_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) script;
|
||||
|
||||
/* TODO: unload a Ruby script */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_unload_name: unload a Ruby script by name
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_ruby_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) name;
|
||||
|
||||
/* TODO: unload a Ruby script by name */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_unload_all: unload all Ruby scripts
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_ruby_unload_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
/* TODO: unload all Ruby scripts */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_cmd: /ruby command handler
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
char *server, char *command, char *arguments,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int argc, path_length, handler_found;
|
||||
char **argv, *path_script, *dir_home;
|
||||
t_plugin_script *ptr_script;
|
||||
t_plugin_handler *ptr_handler;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) command;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
if (arguments)
|
||||
argv = plugin->explode_string (plugin, arguments, " ", 0, &argc);
|
||||
else
|
||||
{
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
}
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 0:
|
||||
/* list registered Ruby scripts */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Registered Ruby scripts:");
|
||||
if (ruby_scripts)
|
||||
{
|
||||
for (ptr_script = ruby_scripts;
|
||||
ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
plugin->printf_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby message handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Ruby message handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == HANDLER_MESSAGE)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " IRC(%s) => Ruby(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby command handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Ruby command handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == HANDLER_COMMAND)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " /%s => Ruby(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
break;
|
||||
case 1:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "autoload") == 0)
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
else if (plugin->ascii_strcasecmp (plugin, argv[0], "reload") == 0)
|
||||
{
|
||||
weechat_ruby_unload_all (plugin);
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
}
|
||||
else if (plugin->ascii_strcasecmp (plugin, argv[0], "unload") == 0)
|
||||
weechat_ruby_unload_all (plugin);
|
||||
break;
|
||||
case 2:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "load") == 0)
|
||||
{
|
||||
/* load Ruby script */
|
||||
if ((strstr (argv[1], "/")) || (strstr (argv[1], "\\")))
|
||||
path_script = NULL;
|
||||
else
|
||||
{
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (dir_home)
|
||||
{
|
||||
path_length = strlen (dir_home) + strlen (argv[1]) + 16;
|
||||
path_script = (char *) malloc (path_length * sizeof (char));
|
||||
if (path_script)
|
||||
snprintf (path_script, path_length, "%s/ruby/%s",
|
||||
dir_home, argv[1]);
|
||||
else
|
||||
path_script = NULL;
|
||||
free (dir_home);
|
||||
}
|
||||
else
|
||||
path_script = NULL;
|
||||
}
|
||||
weechat_ruby_load (plugin, (path_script) ? path_script : argv[1]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
}
|
||||
else if (plugin->ascii_strcasecmp (plugin, argv[0], "unload") == 0)
|
||||
{
|
||||
/* unload Ruby script */
|
||||
weechat_ruby_unload_name (plugin, argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: unknown option for "
|
||||
"\"ruby\" command");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: wrong argument count for \"ruby\" command");
|
||||
}
|
||||
|
||||
if (argv)
|
||||
plugin->free_exploded_string (plugin, argv);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_init: initialize Ruby plugin
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
{
|
||||
ruby_plugin = plugin;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Ruby module \"weechat\"");
|
||||
|
||||
/* TODO: initialize Ruby interpreter */
|
||||
|
||||
|
||||
plugin->cmd_handler_add (plugin, "ruby",
|
||||
"list/load/unload Ruby scripts",
|
||||
"[load filename] | [autoload] | [reload] | [unload]",
|
||||
"filename: Ruby script (file) to load\n\n"
|
||||
"Without argument, /ruby command lists all loaded Ruby scripts.",
|
||||
weechat_ruby_cmd, NULL, NULL);
|
||||
|
||||
plugin->mkdir_home (plugin, "ruby");
|
||||
plugin->mkdir_home (plugin, "ruby/autoload");
|
||||
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
|
||||
/* init ok */
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_end: shutdown Ruby interface
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
weechat_ruby_unload_all (plugin);
|
||||
|
||||
/* TODO: free interpreter */
|
||||
|
||||
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby plugin ended");
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user