[Pkg-silc-commits] r35 - in /kopete-silc-plugin: ./ branches/ branches/upstream/ branches/upstream/current/ branches/upstream/current/po/ branches/upstream/current/src/ branches/upstream/current/src/icons/ tags/

stesie-guest at users.alioth.debian.org stesie-guest at users.alioth.debian.org
Mon May 28 17:34:43 UTC 2007


Author: stesie-guest
Date: Mon May 28 17:34:43 2007
New Revision: 35

URL: http://svn.debian.org/wsvn/pkg-silc/?sc=1&rev=35
Log:
[svn-inject] Installing original source of kopete-silc-plugin

Added:
    kopete-silc-plugin/
    kopete-silc-plugin/branches/
    kopete-silc-plugin/branches/upstream/
    kopete-silc-plugin/branches/upstream/current/
    kopete-silc-plugin/branches/upstream/current/AUTHORS
    kopete-silc-plugin/branches/upstream/current/CMakeLists.txt
    kopete-silc-plugin/branches/upstream/current/COPYING
    kopete-silc-plugin/branches/upstream/current/ChangeLog
    kopete-silc-plugin/branches/upstream/current/NEWS
    kopete-silc-plugin/branches/upstream/current/README
    kopete-silc-plugin/branches/upstream/current/kopete_silc.desktop
    kopete-silc-plugin/branches/upstream/current/po/
    kopete-silc-plugin/branches/upstream/current/po/CMakeLists.txt
    kopete-silc-plugin/branches/upstream/current/po/Messages.sh   (with props)
    kopete-silc-plugin/branches/upstream/current/po/de.gmo   (with props)
    kopete-silc-plugin/branches/upstream/current/po/de.po
    kopete-silc-plugin/branches/upstream/current/po/extractrc   (with props)
    kopete-silc-plugin/branches/upstream/current/po/kopete_silc.pot
    kopete-silc-plugin/branches/upstream/current/silc.protocol
    kopete-silc-plugin/branches/upstream/current/src/
    kopete-silc-plugin/branches/upstream/current/src/CMakeLists.txt
    kopete-silc-plugin/branches/upstream/current/src/icons/
    kopete-silc-plugin/branches/upstream/current/src/icons/CMakeLists.txt
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_away.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_busy.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_channel.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_detached.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_hyper.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_indisposed.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_mute.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_op.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/icons/cr32-app-silc_protocol.png   (with props)
    kopete-silc-plugin/branches/upstream/current/src/silcaccount.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcaccount.h
    kopete-silc-plugin/branches/upstream/current/src/silcaddcontact.ui
    kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.h
    kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.h
    kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.h
    kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfo.ui
    kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.h
    kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.h
    kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfo.ui
    kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.h
    kopete-silc-plugin/branches/upstream/current/src/silcchanneljoin.ui
    kopete-silc-plugin/branches/upstream/current/src/silccontact.cpp
    kopete-silc-plugin/branches/upstream/current/src/silccontact.h
    kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.cpp
    kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.h
    kopete-silc-plugin/branches/upstream/current/src/silceditaccount.ui
    kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.cpp
    kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.h
    kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.h
    kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.h
    kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.h
    kopete-silc-plugin/branches/upstream/current/src/silcprotocol.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcprotocol.h
    kopete-silc-plugin/branches/upstream/current/src/silcservercontact.cpp
    kopete-silc-plugin/branches/upstream/current/src/silcservercontact.h
    kopete-silc-plugin/tags/

Added: kopete-silc-plugin/branches/upstream/current/AUTHORS
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/AUTHORS?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/AUTHORS (added)
+++ kopete-silc-plugin/branches/upstream/current/AUTHORS Mon May 28 17:34:43 2007
@@ -1,0 +1,3 @@
+Stefan Siegl <stesie at brokenpipe.de>
+Martin Albrecht <martin at rottendobben.com>
+Christian Dietrich <stettberger at brokenpipe.de>

Added: kopete-silc-plugin/branches/upstream/current/CMakeLists.txt
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/CMakeLists.txt?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/CMakeLists.txt (added)
+++ kopete-silc-plugin/branches/upstream/current/CMakeLists.txt Mon May 28 17:34:43 2007
@@ -1,0 +1,35 @@
+# Copyright(C) 2007 Stefan Siegl <stesie at brokenpipe.de>
+#
+# kopete_silc - silc plugin for kopete messenger
+#
+# 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
+
+project(kopete)
+add_subdirectory(src)
+add_subdirectory(po)
+
+# configure installation paths
+set(SHARE_INSTALL_PREFIX 
+  ${CMAKE_INSTALL_PREFIX}/share 
+  CACHE PATH "Base directory for files which go to share/" FORCE)
+
+# install services files
+install(FILES 
+  kopete_silc.desktop 
+  silc.protocol 
+  
+  DESTINATION "${SHARE_INSTALL_PREFIX}/services"
+)
+

Added: kopete-silc-plugin/branches/upstream/current/COPYING
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/COPYING?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/COPYING (added)
+++ kopete-silc-plugin/branches/upstream/current/COPYING Mon May 28 17:34:43 2007
@@ -1,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: kopete-silc-plugin/branches/upstream/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/ChangeLog?rev=35&op=file
==============================================================================
    (empty)

Added: kopete-silc-plugin/branches/upstream/current/NEWS
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/NEWS?rev=35&op=file
==============================================================================
    (empty)

Added: kopete-silc-plugin/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/README?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/README (added)
+++ kopete-silc-plugin/branches/upstream/current/README Mon May 28 17:34:43 2007
@@ -1,0 +1,93 @@
+		-*- mode: text; coding: utf-8 -*-
+
+
+L I C E N S E   :=
+
+  Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+  kopete_silc - silc plugin for kopete messenger
+ 
+  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
+
+
+
+F O R E W O R D   :=
+
+  Kopete SILC is a protocol plugin for Kopete, the KDE Instant Messenger. If
+  you ever cursed that you cannot join the SILC Network using Kopete this can
+  help you. It will add SILC support to Kopete.
+
+  The plugin is based on libsilc which is part of the SILC Toolkit mentioned
+  above. The library was initially written by Pekka Riikonen and is still
+  maintained by him. 
+
+
+
+I N S T A L L A T I O N   :=
+
+  kopete_silc doesn't rely on the quite common GNU Autoconf build
+  environment but CMake, like quite a lot of other KDE programs do
+
+  Furthermore you need to have libsilc 1.1 installed.
+
+  Since you read this, you probably succeeded in checking out your
+  very own copy from CVS, thus you've got all what you need to have to
+  successfully start out:
+
+  First enter
+
+        cmake .
+
+  Where libsilc is located will be checked using pkg-config
+  approach. KDE-checks are just common. Now you're set to run
+
+	make
+	make install
+
+  If it does not work, please fix and tell what was wrong. Don't just
+  cry and shout for help...
+
+  Since installation usually goes below /usr/local/ you probably want
+  to add this directory to your KDEDIRS, if it is not already. Do so
+  by entering
+
+        export KDEDIRS=$KDEDIRS:/usr/local/kde/
+
+  before launching kopete. This has to be executed before every run of
+  kopete, not only at compilation time. Therefore you probably want to
+  add this to your local profile.
+
+
+
+I F   I T   D O E S   N O T   W O R K   :=
+
+  please contact me at <stesie at brokenpipe.de>, but be patient.
+
+
+
+
+L A S T   B U T   N O T   L E A S T   :=
+
+  your contributions are welcome, 
+  please help in improving kopete_silc.
+
+  If you want CVS access to brokenpipe.de repository, please ask.
+
+
+
+
+Cheers,
+  Stefan Siegl <stesie at brokenpipe.de>
+
+$Id: README,v 1.7 2007-05-28 16:52:07 stesie Exp $

Added: kopete-silc-plugin/branches/upstream/current/kopete_silc.desktop
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/kopete_silc.desktop?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/kopete_silc.desktop (added)
+++ kopete-silc-plugin/branches/upstream/current/kopete_silc.desktop Mon May 28 17:34:43 2007
@@ -1,0 +1,19 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+X-Kopete-Version=1000900
+Icon=silc_protocol
+ServiceTypes=Kopete/Protocol
+X-KDE-Library=kopete_silc
+X-Kopete-Messaging-Protocol=messaging/silc
+X-KDE-PluginInfo-Author=Stefan Siegl
+X-KDE-PluginInfo-Email=stesie at brokenpipe.de
+X-KDE-PluginInfo-Name=kopete_silc
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=http://www.brokenpipe.de/SILC/
+X-KDE-PluginInfo-Category=Protocols
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=SILC
+Comment=Protocol to connect to SILC

Added: kopete-silc-plugin/branches/upstream/current/po/CMakeLists.txt
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/po/CMakeLists.txt?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/po/CMakeLists.txt (added)
+++ kopete-silc-plugin/branches/upstream/current/po/CMakeLists.txt Mon May 28 17:34:43 2007
@@ -1,0 +1,21 @@
+FIND_PROGRAM(MSGFMT gmsgfmt NAMES msgfmt)
+
+FILE(GLOB kopete_silc_POS *.po)
+
+FOREACH(poFile ${kopete_silc_POS})
+  STRING(REGEX REPLACE po$ gmo gmoFile ${poFile})
+  GET_FILENAME_COMPONENT(language ${poFile} NAME_WE)
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${gmoFile} 
+      COMMAND rm -f "${CMAKE_CURRENT_SOURCE_DIR}/${gmoFile}"
+      COMMAND ${MSGFMT} -o "${gmoFile}" "${poFile}"
+      COMMAND test ! -f ${gmoFile} || touch ${gmoFile}
+      DEPENDS ${poFile} 
+      )
+  INSTALL(FILES ${gmoFile}
+          DESTINATION "${CMAKE_INSTALL_PREFIX}/share/locale/${language}/LC_MESSAGES/"
+          RENAME "kopete_silc.mo")
+  SET(kopete_silc_GMO ${gmoFile} ${kopete_silc_GMO})
+ENDFOREACH(poFile)
+
+ADD_CUSTOM_TARGET(kopte_silc_gmo ALL DEPENDS ${kopete_silc_GMO})

Added: kopete-silc-plugin/branches/upstream/current/po/Messages.sh
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/po/Messages.sh?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/po/Messages.sh (added)
+++ kopete-silc-plugin/branches/upstream/current/po/Messages.sh Mon May 28 17:34:43 2007
@@ -1,0 +1,6 @@
+#!/bin/sh
+
+echo -n "Creating kopete_silc.pot..."
+./extractrc `cd ../src; find . -name \*.ui -o -name \*.rc` > ../src/rc.cpp
+xgettext --keyword=i18n ../src/*.cpp -o kopete_silc.pot
+echo " done"

Propchange: kopete-silc-plugin/branches/upstream/current/po/Messages.sh
------------------------------------------------------------------------------
    svn:executable = 

Added: kopete-silc-plugin/branches/upstream/current/po/de.gmo
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/po/de.gmo?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/po/de.gmo
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/po/de.po
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/po/de.po?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/po/de.po (added)
+++ kopete-silc-plugin/branches/upstream/current/po/de.po Mon May 28 17:34:43 2007
@@ -1,0 +1,1084 @@
+# translation of de.po to German
+# This file is distributed under the same license as the PACKAGE package.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
+#
+# Stefan Siegl <stesie at brokenpipe.de>, 2006.
+# Christian Dietrich <stettberger at brokenpipe.de>, 2007.
+msgid ""
+msgstr ""
+"Project-Id-Version: de\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-05-03 21:50+0200\n"
+"PO-Revision-Date: 2007-05-03 22:00+0200\n"
+"Last-Translator: Christian Dietrich <stettberger at brokenpipe.de>\n"
+"Language-Team: German <kopete_silc at list.zerties.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
+"Plural-Forms:  nplurals=2; plural=(n != 1);\n"
+
+#: ../src/rc.cpp:3
+msgid "Silc Channel Info"
+msgstr "Silc Kanal Informationen"
+
+#: ../src/rc.cpp:6 ../src/rc.cpp:308
+msgid "General"
+msgstr "Allgemein"
+
+#: ../src/rc.cpp:9
+msgid "Name:"
+msgstr "Spitzname:"
+
+#: ../src/rc.cpp:12
+msgid "Topic:"
+msgstr "Thema:"
+
+#: ../src/rc.cpp:15 ../src/rc.cpp:323
+msgid "allo&w rich text markup"
+msgstr "Erlaube formatierte Nachrichten"
+
+#: ../src/rc.cpp:18 ../src/rc.cpp:326
+#, fuzzy
+msgid "Alt+W"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:21
+msgid "Basic Options"
+msgstr "Grundeinstellungen"
+
+#: ../src/rc.cpp:24
+msgid "&private channel"
+msgstr "&Privater Kanal"
+
+#: ../src/rc.cpp:27
+#, fuzzy
+msgid "Alt+P"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:30
+msgid "&secret channel"
+msgstr "&Versteckter Kanal"
+
+#: ../src/rc.cpp:33
+#, fuzzy
+msgid "Alt+S"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:36
+msgid "&invite only channel"
+msgstr "Kanal kann nur durch &Einladung betreten werden"
+
+#: ../src/rc.cpp:39 ../src/rc.cpp:258
+#, fuzzy
+msgid "Alt+I"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:42
+msgid "&user silencing"
+msgstr "Benutzer dürfen nicht reden"
+
+#: ../src/rc.cpp:45
+#, fuzzy
+msgid "Alt+U"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:48
+msgid "&operator silencing"
+msgstr "Operatoren dürfen nicht reden"
+
+#: ../src/rc.cpp:51 ../src/rc.cpp:57 ../src/rc.cpp:348
+#, fuzzy
+msgid "Alt+O"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:54 ../src/rc.cpp:297 ../src/rc.cpp:345
+msgid "&OK"
+msgstr "&OK"
+
+#: ../src/rc.cpp:60 ../src/rc.cpp:351
+msgid "&Apply"
+msgstr "&Anwenden"
+
+#: ../src/rc.cpp:63 ../src/rc.cpp:219 ../src/rc.cpp:354
+#, fuzzy
+msgid "Alt+A"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:66 ../src/rc.cpp:301 ../src/rc.cpp:357
+msgid "&Cancel"
+msgstr "&Abbrechen"
+
+#: ../src/rc.cpp:69 ../src/rc.cpp:108 ../src/rc.cpp:360
+msgid "Alt+C"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:72
+msgid "silcAddContact"
+msgstr "silcAddContact"
+
+#: ../src/rc.cpp:75
+msgid ""
+"<p>Provide a nickname or channelname for the contact you wish to add. If you "
+"wish to add a nickname you may want to provide a fingeprint for that contact "
+"as well. The SILC network identifies contacts via fingerprints and so does "
+"this plugin. If you do not provide a fingerprint the contact you wish to add "
+"must be online as its fingerprint is read from the network. If this plugin "
+"cannot read the fingerprint from the network the contact will not be added "
+"at all.</p>"
+msgstr ""
+"<p>Geben Sie einen Spitznamen oder Kanalnamen für den Kontakt an, den Sie "
+"hinzufügen möchten. Wenn Sie einen Spitznamen hinzufügen möchten, wollen Sie "
+"eventuell auch einen Fingerabdruck für den Kontakt angeben. Das SILC-"
+"Netzwerk identifiziert Kontakte mittels Fingerabdruck, das Gleiche macht "
+"auch kopete_silc. Wenn Sie keinen Fingerabdruck angeben, muss der Kontakt, "
+"den Sie hinzufügen möchten, online sein, da der Fingerabdruck dann vom Netz "
+"gelesen wird. Wenn das Plugin den Fingerabdruck nicht vom Netzwerk lesen "
+"kann, wird der Kontakt überhaupt nicht hinzugefügt."
+
+#: ../src/rc.cpp:78
+msgid "proivde an optional fingerprint for the contact"
+msgstr "Biete einen zusätzlichen Fingerabruck für den Kontakt an"
+
+#: ../src/rc.cpp:81
+msgid ""
+"As Nicknames do not have to be unique in SILC you may want to provide an "
+"optional fingerprint for the contact to identify it. If you do not provide a "
+"fingerprint it is read from the network which means that the contact has to "
+"be online."
+msgstr ""
+"Nachdem Spitznamen in SILC nicht eindeutig sein müssen, möchten Sie "
+"vielleicht einen optionalen Fingerabdruck angeben, um den Kontakt zu "
+"identifizieren. Wenn Sie keinen Fingerabdruck angeben, wird er automatisch "
+"vom Netz gelesen, das heißt, dass der Kontakt online sein muss."
+
+#: ../src/rc.cpp:84 ../src/rc.cpp:96
+msgid "The name of the SILC contact or channel you would like to add."
+msgstr "Name des SILC Kontaktes oder Kanals, den Sie hinzufügen möchten."
+
+#: ../src/rc.cpp:87 ../src/rc.cpp:99
+msgid ""
+"The name of the SILC contact or channel you would like to add.  You may type "
+"simply the text of a person's nickname, or you may type a channel name."
+msgstr ""
+"Der Name des SILC Kontakts oder des Kanals, den Sie hinzufügen möchten. Sie "
+"können einfach den Spitznamen einer Person eingeben, oder den Namen eines "
+"Kanals."
+
+#: ../src/rc.cpp:90
+msgid "&Fingerprint:"
+msgstr "&Fingerabdruck:"
+
+#: ../src/rc.cpp:93
+msgid "&Nickname/channel:"
+msgstr "&Spitzname/Kanal:"
+
+#: ../src/rc.cpp:102
+msgid "<i>e.g. 0000:0001:0002:0003:0004::0005:0006:0007:0008:0009</i>"
+msgstr "<i> z.B. 0000:0001:0002:0003:0004::0005:0006:0007:0008:0009</i>"
+
+#: ../src/rc.cpp:105
+msgid "&contact is channel"
+msgstr "&Kontakt ist Kanal"
+
+#: ../src/rc.cpp:111
+msgid "check if the contact is a channel"
+msgstr "Prüfen, ob der Kontakt ein Kanal ist"
+
+#: ../src/rc.cpp:114
+msgid "check if you want to add a channel to your buddies list"
+msgstr "Prüfen sie, ob sie einen Kanal zu ihrer Kontaktliste hinzufügen wollen."
+
+#: ../src/rc.cpp:117
+msgid "SilcEditAccount"
+msgstr "SilcEditAccount"
+
+#: ../src/rc.cpp:120
+msgid "&Basic Setup"
+msgstr "&Grundlegende Einstellungen"
+
+#: ../src/rc.cpp:123
+msgid "Account Information"
+msgstr "Kontoinformationen"
+
+#: ../src/rc.cpp:126
+msgid "&Nickname:"
+msgstr "&Spitzname:"
+
+#: ../src/rc.cpp:129 ../src/rc.cpp:132 ../src/rc.cpp:171
+msgid "This is the name that everyone will see everytime you say something"
+msgstr "Dies ist der Name, den alle sehen werden, wenn Sie etwas sagen."
+
+#: ../src/rc.cpp:135
+msgid ""
+"The nickname you would like to use on the SILC network.  You may change this "
+"once online with the /nick command."
+msgstr ""
+"Der Spitzname, unter dem Sie im SILC Netzwerk auftreten möchten. Sie können "
+"diesen, wenn sie online sind, jederzeit mit dem /nick Kommando ändern."
+
+#: ../src/rc.cpp:138 ../src/rc.cpp:141
+msgid ""
+"The username you would prefer to use on the SILC network. Leave blank to use "
+"your system account name."
+msgstr ""
+"Der Benutzername, unter dem sie im Silcnetzwerk bewegen. Lassen sie das Feld "
+"frei und es wird der Name ihre Benuzterkontos verwendet"
+
+#: ../src/rc.cpp:144
+msgid "&Username:"
+msgstr "&Benutzername:"
+
+#: ../src/rc.cpp:147
+msgid ""
+"The username you would prefer to use on SILC network, if your system does "
+"not have identd support.  Leave blank to use your system account name."
+msgstr ""
+"Der Benutzername, unter dem sie im Silcnetzwerk bewegen, wenn ihr System "
+"keinen Ident Dienst anbietet. Lassen sie das Feld frei und es wird der Name "
+"ihre Benuzterkontos verwendet"
+
+#: ../src/rc.cpp:150 ../src/rc.cpp:153
+msgid ""
+"If you want other people on the SILC network to see your real name, you can "
+"enter it here."
+msgstr ""
+"Wenn sie ihren richtigen Namen anderen Leuten im SILC Netzwerk zugänglich "
+"machen wollen, können sie ihn hier eintragen"
+
+#: ../src/rc.cpp:156
+msgid "&Real name:"
+msgstr "&richtiger Name"
+
+#: ../src/rc.cpp:159
+msgid "E&xclude from connect all"
+msgstr "A&usnehmen von alle Verbinden"
+
+#: ../src/rc.cpp:162
+msgid "Alt+X"
+msgstr "Alt+X"
+
+#: ../src/rc.cpp:165
+msgid "Network Connection"
+msgstr "Netzwerkverbindung"
+
+#: ../src/rc.cpp:168
+msgid "Re&mote Host:"
+msgstr "Entfernter Rechner"
+
+#: ../src/rc.cpp:174
+msgid "silc.silcnet.org"
+msgstr "silc.silcnet.org"
+
+#: ../src/rc.cpp:177
+msgid "host[:port]"
+msgstr "Rechnername[:Port]"
+
+#: ../src/rc.cpp:180
+msgid "The alias you would like to use on SILC."
+msgstr "Das Pseudonym, dass sie im SILC Netzwerk verwenden wollen."
+
+#: ../src/rc.cpp:183
+msgid "Public &Keys"
+msgstr "Öffentliche Schlüssel"
+
+#: ../src/rc.cpp:186
+msgid "SILC-Server Fingerprints"
+msgstr "SILC-Server Fingerabdrücke"
+
+#: ../src/rc.cpp:189
+msgid "Hostname"
+msgstr "Rechnername"
+
+#: ../src/rc.cpp:192
+msgid "IP-Address"
+msgstr "IP-Adresse"
+
+#: ../src/rc.cpp:195
+msgid "Port"
+msgstr "Anschluss"
+
+#: ../src/rc.cpp:198 ../src/rc.cpp:329
+msgid "Fingerprint"
+msgstr "Fingerabdruck"
+
+#: ../src/rc.cpp:201
+msgid "&Remove"
+msgstr "&Entfernen"
+
+#: ../src/rc.cpp:204
+msgid "Beha&viour"
+msgstr "&Verhalten"
+
+#: ../src/rc.cpp:207
+msgid "Message settings"
+msgstr "Nachrichteneinstellungen"
+
+#: ../src/rc.cpp:210
+msgid "Sign channel &messages"
+msgstr "Nachrichten in Kanälen signieren"
+
+#: ../src/rc.cpp:213
+#, fuzzy
+msgid "Alt+M"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:216
+msgid "Sign channel &actions"
+msgstr "Aktionsnachrichten in Kanälen signieren"
+
+#: ../src/rc.cpp:222
+msgid "Sign p&rivate messages"
+msgstr "P&rivate Nachrichten signieren"
+
+#: ../src/rc.cpp:225
+msgid "Alt+R"
+msgstr "Alt+R"
+
+#: ../src/rc.cpp:228
+msgid "Sign pri&vate actions"
+msgstr "Pri&vate Aktionen signieren"
+
+#: ../src/rc.cpp:231
+msgid "Alt+V"
+msgstr "Alt+V"
+
+#: ../src/rc.cpp:234
+msgid "Displa&y small SilcMime images inline"
+msgstr "Zeige kleine SilcMime Bilder direkt an"
+
+#: ../src/rc.cpp:237
+#, fuzzy
+msgid "Alt+Y"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:240
+msgid "File Transfer settings"
+msgstr "Dateiübertragungseinstellungen"
+
+#: ../src/rc.cpp:243
+msgid "bind local port:"
+msgstr "Lokalen Port binden"
+
+#: ../src/rc.cpp:246
+msgid "bind always"
+msgstr "immer binden"
+
+#: ../src/rc.cpp:249
+msgid "bind never"
+msgstr "niemals binden"
+
+#: ../src/rc.cpp:252
+msgid "autodetect nat"
+msgstr "NAT automatisch erkennen"
+
+#: ../src/rc.cpp:255
+msgid "accept &incoming file transfer requests automatically"
+msgstr "Eingehende Anfrage über einen Dateitransfer automatisch annehmen"
+
+#: ../src/rc.cpp:261
+msgid "prefer to send data as SilcMime ob&jects"
+msgstr "Bervorzugte senden von Daten über SilcMIME"
+
+#: ../src/rc.cpp:264
+#, fuzzy
+msgid "Alt+J"
+msgstr "Alt+C"
+
+#: ../src/rc.cpp:267
+msgid "Default Messages"
+msgstr "Standart Nachricht"
+
+#: ../src/rc.cpp:270
+msgid "&Quit Message:"
+msgstr "Nachricht beim Trennen"
+
+#: ../src/rc.cpp:273
+msgid "kopete_silc : http://www.brokenpipe.de/SILC/"
+msgstr "kopete_silc : http://www.brokenpipe.de/SILC/"
+
+#: ../src/rc.cpp:276
+msgid "Choose channel to join"
+msgstr "Kanal zum Betreten wählen"
+
+#: ../src/rc.cpp:279
+msgid "Channel:"
+msgstr "Kanal:"
+
+#: ../src/rc.cpp:282
+msgid "Password:"
+msgstr "Kennwort:"
+
+#: ../src/rc.cpp:285
+msgid "c&laim founder status"
+msgstr "Beanspruche Gründerstatus"
+
+#: ../src/rc.cpp:288
+msgid "Alt+L"
+msgstr "Alt+L"
+
+#: ../src/rc.cpp:291
+msgid "use -au&th option"
+msgstr "Benutze die -auth Option"
+
+#: ../src/rc.cpp:294 ../src/rc.cpp:338
+msgid "Alt+T"
+msgstr "Alt+T"
+
+#: ../src/rc.cpp:305
+msgid "Silc User Info"
+msgstr "Silc Benutzerinformation"
+
+#: ../src/rc.cpp:311
+msgid "Channels:"
+msgstr "Kanäle:"
+
+#: ../src/rc.cpp:314
+msgid "Real name:"
+msgstr "richtiger Name:"
+
+#: ../src/rc.cpp:317
+msgid "Last update:"
+msgstr "Letztes Update"
+
+#: ../src/rc.cpp:320
+msgid "Nickname:"
+msgstr "Spitzname:"
+
+#: ../src/rc.cpp:332
+msgid "Fingerprint:"
+msgstr "Fingerabdruck:"
+
+#: ../src/rc.cpp:335
+msgid "&Trusted"
+msgstr "Ver&traut"
+
+#: ../src/rc.cpp:341
+msgid "Attributes"
+msgstr "Attribute"
+
+#: ../src/silcaccount.cpp:121
+msgid "failed to create SILC client"
+msgstr "Die Erzeugung eines SILC Clients schlug fehl"
+
+#: ../src/silcaccount.cpp:122 ../src/silcaccount.cpp:134
+msgid "Initialisation"
+msgstr "Initialisation"
+
+#: ../src/silcaccount.cpp:133
+msgid "failed to initialize SILC client"
+msgstr "Die Initialisation des SILC Clients schlug fehl"
+
+#: ../src/silcaccount.cpp:178
+msgid "Could not generated key pair"
+msgstr "Konnte Schlüsselpaar nicht erzeugen"
+
+#: ../src/silcaccount.cpp:179
+msgid "SILC Key Generation"
+msgstr "SILC Schlüsselerzeugung"
+
+#: ../src/silcaccount.cpp:191
+msgid "Join Channel ..."
+msgstr "Kanal betreten ..."
+
+#: ../src/silcaccount.cpp:193
+msgid "Show Server Window"
+msgstr "Server-Fenster anzeigen"
+
+#: ../src/silcaccount.cpp:195
+msgid "Show My Fingerprint"
+msgstr "Eigenen Fingerabdruck anzeigen"
+
+#: ../src/silcaccount.cpp:399
+msgid "Fingerprint of "
+msgstr "Fingerabdruck von"
+
+#: ../src/silcaccount.cpp:461
+msgid "<invalid-configuration>"
+msgstr "<ungültige-Konfiguration>"
+
+#: ../src/silcaccount.cpp:710
+msgid "\"%1\" is an invalid channel name."
+msgstr "\"%1\" ist kein gültiger Kanalname"
+
+#: ../src/silcaccount.cpp:711 ../src/silcchannelcontact.cpp:117
+msgid "SILC Plugin"
+msgstr "SILC Plugin"
+
+#: ../src/silcaccount.cpp:772
+msgid "Unable to establish connection to the remote host."
+msgstr "Verbindung zum entfernten Rechner schlug fehl"
+
+#: ../src/silcaccount.cpp:773 ../src/silcaccount.cpp:824
+#: ../src/silcaccount.cpp:844 ../src/silcaccount.cpp:1567
+#: ../src/silcaccount.cpp:1598
+msgid "Kopete SILC Plugin"
+msgstr "Kopete SILC Plugin"
+
+#: ../src/silcaccount.cpp:843
+msgid "Unable to connect to remote host. Protocol failure."
+msgstr "Verbindung zum entfernten Rechner schlug wegen eines Protokollfehlers fehl"
+
+#: ../src/silcaccount.cpp:984
+msgid "SILC Command %1 failed"
+msgstr "SILC-Befehl %1 fehlgeschlagen"
+
+#: ../src/silcaccount.cpp:1102
+msgid ""
+"Received client public key of %1. \n"
+"Fingerprint: %2\n"
+"\n"
+"However this does not match the cached client's fingerprint which appears to "
+"be `%3'. This probably should not happen"
+msgstr ""
+"Öffentlichen Schlüssel von %1 empfangen.\n"
+"Fingerabdruck: %2\n"
+"\n"
+"Der empfangene Fingerabruck stimmt jedoch nicht mit dem Gespeicherten, des "
+"Benutzers, der %3 ist, überein. Das sollte wahrscheinlich nicht passieren."
+
+#: ../src/silcaccount.cpp:1108 ../src/silcaccount.cpp:1119
+#: ../src/silcaccount.cpp:1134 ../src/silcaccount.cpp:1620
+#: ../src/silcaccount.cpp:1638
+msgid "Incoming Public Key"
+msgstr "Ankommender Öffentlicher Schlüssel"
+
+#: ../src/silcaccount.cpp:1115 ../src/silcaccount.cpp:1616
+msgid ""
+"Received client public key of %1. \n"
+"Fingerprint: %2\n"
+"Would you like to accept the key?"
+msgstr ""
+"Öffentlicher Schlüssel von %1 empfangen.\n"
+"Fingerabruck: %2\n"
+"Möchten sie den Schlüssel akzeptieren?"
+
+#: ../src/silcaccount.cpp:1132
+msgid "Unable to save received client public key of %1."
+msgstr "Konnte empfangenen öffentlichen Schlüssel von %1 nicht speichern"
+
+#: ../src/silcaccount.cpp:1165
+msgid "Cannot open %1 for reading"
+msgstr "Konnte %1 nicht zum lesen öffnen"
+
+#: ../src/silcaccount.cpp:1166 ../src/silcaccount.cpp:1178
+msgid "Opening Key File"
+msgstr "Schlüsseldatei öffnen"
+
+#: ../src/silcaccount.cpp:1177
+msgid "Cannot open %1 for writing"
+msgstr "Konnte %1 nicht zum schreiben öffnen"
+
+#: ../src/silcaccount.cpp:1302
+msgid "Kicked by %1."
+msgstr "Getreten von %1"
+
+#: ../src/silcaccount.cpp:1305
+msgid " Reason: %2"
+msgstr "Begründung:"
+
+#: ../src/silcaccount.cpp:1318
+msgid "You were kicked"
+msgstr "Du wurdest getreten"
+
+#: ../src/silcaccount.cpp:1346
+msgid "Given reason: %1"
+msgstr "Angegebene Begründung: %1"
+
+#: ../src/silcaccount.cpp:1347
+msgid "No reason given."
+msgstr "Keine Begründung angegeben"
+
+#: ../src/silcaccount.cpp:1353
+msgid "You have been killed from the SILC network by %1. "
+msgstr "Du wurdest aus dem SILC Netzwerk von %1 geworfen."
+
+#: ../src/silcaccount.cpp:1354
+msgid "You have been killed"
+msgstr "Du wurdest rausgeworfen"
+
+#: ../src/silcaccount.cpp:1360
+msgid "Killed by %1. "
+msgstr "Rausgeworfen von %1"
+
+#: ../src/silcaccount.cpp:1454
+msgid ""
+"Invitation from %1 received, however no channel name has been specified. "
+"Ignoring request."
+msgstr ""
+"Einladung von %1 empfangen, aber es wurde kein Kanal angegeben. Die "
+"Einladung wurde verworfen"
+
+#: ../src/silcaccount.cpp:1456 ../src/silcaccount.cpp:1464
+msgid "Incoming Invitation"
+msgstr "Eingehende Einladung"
+
+#: ../src/silcaccount.cpp:1462
+msgid "'%1' invited you into channel '%2'. Do you want to follow this invitation?"
+msgstr "%1 lud dich in den Kanal %2 ein. Wollen sie der Einadung nachkommen?"
+
+#: ../src/silcaccount.cpp:1563
+msgid ""
+"The authenticity of host '%1 (%2)' can't be established. Key fingerprint is %"
+"3.\n"
+"\n"
+"Are you sure you want to continue connecting?"
+msgstr ""
+"Die Authentizität des Rechners %1 (%2) ist ungeprüft. Der Fingerabdruck ist %"
+"3\n"
+"\n"
+"Sind sie sich sicher, dass sie fortfahren wollen?"
+
+#: ../src/silcaccount.cpp:1591
+msgid ""
+"The public key of the remote host %1 has changed. According to my config it "
+"used to have the fingerprint %2, however I have received the fingerprint %3 "
+"this time. This may mean that there is a man in the middle. \n"
+"Be careful, resetting connection now."
+msgstr ""
+"Der Öffentliche Schlüssel des entfernten Rechners %1 hat sich geändert. Der "
+"gespeicherte Fingerabdruck war %2, aber der empfangene Fingerabdruck lautet %"
+"3. Dies könnte ein bedeuten, dass jemand versucht sich in die Verbindung "
+"einzudringen. Seien sie vorsichtig, die Verbindung wird zurückgesetzt."
+
+#: ../src/silcaccount.cpp:1635
+msgid ""
+"Recieved client public key, but no key was requested. \n"
+"Fingerprint: %1\n"
+"This shouldn't happen, so the request will be ignored."
+msgstr ""
+"Es wurde ein öffentlicher Schlüssel empfangen, aber es wurde keiner "
+"angefragt.\n"
+"Fingerabdruck: %1\n"
+"Das sollte nicht geschehen, daher wird die Anfrage ignoriert."
+
+#: ../src/silcaccount.cpp:1665
+msgid ""
+"Please enter the passphrase.\n"
+"               The server window may contain additional information."
+msgstr ""
+"Bitte geben sie das Passwort ein.\n"
+"               Das Serverfenster könnte zusätzliche Informationen enthalten."
+
+#: ../src/silcaccount.cpp:1723 ../src/silcaccount.cpp:1739
+msgid "File Transfer '%1' from %2"
+msgstr "Dateiübertragung %1 von %2"
+
+#: ../src/silcaccount.cpp:1736
+msgid "The file %1 does already exist. Do you want to overwrite it?"
+msgstr "Die Datei %1 existiert bereits. Möchten Sie sie überschreiben?"
+
+#: ../src/silcaccount.cpp:1780
+msgid ""
+"Received incoming file transfer request from %1, however the sender "
+"requested, that the receiver shall bind a listening port. Unfortunately the "
+"latter is forbidden according this plugin's configuration.\n"
+"\n"
+"The file transfer request has been rejected."
+msgstr ""
+"Dateiübertragungsanfrage von %1 erhalten, aber der Sender verlangt, dass wir "
+"auf einem Port lauschen. Unglücklicherweise lässt die Konfiguration des "
+"Plugins dies nicht zu.\n"
+"\n"
+"Die Anfrage wurde daher verworfen."
+
+#: ../src/silcaccount.cpp:1785 ../src/silcaccount.cpp:1804
+msgid "Incoming File Transfer"
+msgstr "Eingehende Dateiübertragung"
+
+#: ../src/silcaccount.cpp:1800
+msgid ""
+"Received incoming file transfer request from %1 (%2:%3). Do you want to "
+"receive and store this file?"
+msgstr ""
+"Eine Anfrage auf Dateitransfer wurde von %1 (%2:%3) gesendet. Wollen sie die "
+"Datei empfangen und speichern?"
+
+#: ../src/silcbuddyattributes.cpp:146
+msgid "<b><u>Mood:</u></b> "
+msgstr "<b><u>Stimmung:</u></b> "
+
+#: ../src/silcbuddyattributes.cpp:148
+msgid "<b><u>Prefered medium:</u></b> "
+msgstr "<b><u>Bevorzugtes Medium:</u></b> "
+
+#: ../src/silcbuddyattributes.cpp:151
+msgid "<b><u>Timezone:</u></b> "
+msgstr "<b><u>Zeitzone:</u></b> "
+
+#: ../src/silcbuddyattributes.cpp:153
+msgid "<b><u>Language:</u></b> "
+msgstr "<b><u>Sprache:</u></b> "
+
+#: ../src/silcbuddyattributes.cpp:156
+msgid "<b><u>Location on Earth:</u></b><br>"
+msgstr "<b><u>Ort auf der Erde:</u></b><br>"
+
+#: ../src/silcbuddyattributes.cpp:158
+msgid "Longitude: "
+msgstr "Längengrad: "
+
+#: ../src/silcbuddyattributes.cpp:159
+msgid "Latitude: "
+msgstr "Breitengrad: "
+
+#: ../src/silcbuddyattributes.cpp:160
+msgid "Altitude: "
+msgstr "Höhe über NN: "
+
+#: ../src/silcbuddyattributes.cpp:162
+msgid "<b><u>Status Message:</u></b><br>"
+msgstr "<b><u>Statusnachricht:</u></b><br>"
+
+#: ../src/silcbuddyattributes.cpp:176
+msgid "email"
+msgstr "E-Mail"
+
+#: ../src/silcbuddyattributes.cpp:178
+msgid "phone call"
+msgstr "Telefon"
+
+#: ../src/silcbuddyattributes.cpp:180
+msgid "paging"
+msgstr "Pieper"
+
+#: ../src/silcbuddyattributes.cpp:182
+msgid "SMS"
+msgstr "SMS"
+
+#: ../src/silcbuddyattributes.cpp:184
+msgid "MMS"
+msgstr "MMS"
+
+#: ../src/silcbuddyattributes.cpp:186
+msgid "chatting"
+msgstr "Chatten"
+
+#: ../src/silcbuddyattributes.cpp:188
+#, fuzzy
+msgid "video conference"
+msgstr "Beginnen einer Konferenz"
+
+#: ../src/silcbuddyattributes.cpp:201
+msgid "happy"
+msgstr "glücklich "
+
+#: ../src/silcbuddyattributes.cpp:203
+msgid "sad"
+msgstr "traurig"
+
+#: ../src/silcbuddyattributes.cpp:205
+msgid "angry"
+msgstr "verärgert"
+
+#: ../src/silcbuddyattributes.cpp:207
+msgid "jealous"
+msgstr "eifersüchtig"
+
+#: ../src/silcbuddyattributes.cpp:209
+msgid "ashamed"
+msgstr "beschämt"
+
+#: ../src/silcbuddyattributes.cpp:211
+msgid "invincible"
+msgstr "unbesiegbar"
+
+#: ../src/silcbuddyattributes.cpp:213
+msgid "in love"
+msgstr "verliebt"
+
+#: ../src/silcbuddyattributes.cpp:215
+msgid "sleepy"
+msgstr "verschlafen"
+
+#: ../src/silcbuddyattributes.cpp:217
+msgid "bored"
+msgstr "gelangweilt"
+
+#: ../src/silcbuddyattributes.cpp:219
+msgid "exited"
+msgstr "aufgeregt"
+
+#: ../src/silcbuddyattributes.cpp:221
+msgid "anxious"
+msgstr "besorgt"
+
+#: ../src/silcbuddyattributes.cpp:224
+#, fuzzy
+msgid "normal"
+msgstr "Allgemein"
+
+#: ../src/silcbuddycontact.cpp:97 ../src/silcchannelcontact.cpp:168
+msgid ""
+"Unable to send this message now. The protocol is currently offline and does "
+"not support offline sending."
+msgstr ""
+"Konnte die Nachricht leider nicht verschicken, da wir nicht mit dem Server "
+"verbunden sind und das Protokoll kein Offline senden unterstützt."
+
+#: ../src/silcbuddycontact.cpp:99 ../src/silcbuddycontact.cpp:109
+#: ../src/silcchannelcontact.cpp:170
+msgid "User is Not Reachable"
+msgstr "Benutzer ist nicht erreichbar"
+
+#: ../src/silcbuddycontact.cpp:106
+msgid ""
+"This message cannot be sent right now, since the remote client is currently "
+"detached and the protocol does not support offline sending."
+msgstr ""
+"Diese Nachricht konnte leider nicht gesendet werden, da der Benutzer gerade "
+"abgekoppelt ist und das Protokoll das senden solcher Nachrichten nicht "
+"unterstützt."
+
+#: ../src/silcbuddycontact.cpp:404
+msgid "&Operator"
+msgstr "&Operator"
+
+#: ../src/silcbuddycontact.cpp:408
+msgid "&Kick from Channel"
+msgstr "&Aus dem Kanal werfen"
+
+#: ../src/silcbuddycontact.cpp:455 ../src/silcchannelcontact.cpp:702
+msgid "Kopete File Transfer"
+msgstr "Kopete Dateitransfer"
+
+#: ../src/silcbuddycontact.cpp:469
+msgid ""
+"You are trying to send a big file via SilcMIME message. Do you want to send "
+"it via SilcFiletransfer?"
+msgstr ""
+"Sie versuchen eine große Datei per SilcMIME zu senden. Möchten sie es nicht "
+"per Dateitransfer senden?"
+
+#: ../src/silcbuddycontact.cpp:472
+msgid "Sending MIME message"
+msgstr "MIME Nachricht senden"
+
+#: ../src/silcchannelcontact.cpp:116
+msgid "Sorry, you cannot join channels unless you go online"
+msgstr ""
+"Entschuldigung, aber sie müssen sich zuerst verbinden, bevor sie einen Kanal "
+"betreten."
+
+#: ../src/silccontact.cpp:163
+msgid "unknown signature status"
+msgstr "unbekannter Signaturstatus"
+
+#: ../src/silccontact.cpp:167
+msgid "untrusted signature"
+msgstr "nicht vertrauenswürdige Signatur"
+
+#: ../src/silccontact.cpp:171
+msgid "fully trusted signature."
+msgstr "vertrauenswürdige Signatur"
+
+#: ../src/silccontact.cpp:175
+msgid "verification FAILED."
+msgstr "Signaturprüfung fehlgeschlagen"
+
+#: ../src/silccontact.cpp:182
+msgid "Incoming Signed"
+msgstr "Einkommend signierte"
+
+#: ../src/silccontact.cpp:184
+msgid "Notice"
+msgstr "Notiz"
+
+#: ../src/silccontact.cpp:185 ../src/silccontact.cpp:200
+msgid "Action"
+msgstr "Aktion"
+
+#: ../src/silccontact.cpp:185 ../src/silccontact.cpp:200
+msgid "Message"
+msgstr "Nachricht"
+
+#: ../src/silccontact.cpp:198
+msgid "Outgoing Signed"
+msgstr "Ausgehend signierte"
+
+#: ../src/silccontact.cpp:339
+msgid "unknown"
+msgstr "unbekannt"
+
+#: ../src/silccontact.cpp:344
+msgid "<a href=\"%2\">MIME message</a> (%1)"
+msgstr "<a href=\"%2\">MIME Nachricht</a> (%1)"
+
+#: ../src/silccontact.cpp:345
+msgid "New MIME message (%1) saved <a href=\"%2\">here</a>"
+msgstr "Neue MIME Nachricht (%1) wurde <a href=\"%2\">hier</a> gespeichert"
+
+#: ../src/silceditaccountwidget.cpp:109
+msgid "<qt>You must enter a nickname.</qt>"
+msgstr "<qt>Sie müssen einen Spitznamen angeben</qt>"
+
+#: ../src/silceditaccountwidget.cpp:113
+msgid "<qt>Please remove any @ or space from the nickname</qt>"
+msgstr "<qt>Bitte entfernen sie alle Leerzeichen sowie @ aus dem Spitznamen</qt>"
+
+#: ../src/silceditaccountwidget.cpp:116
+msgid "<qt>You have to specify a remote host.</qt>"
+msgstr "<qt>Sie müssen einen Rechner angeben, zu dem sie sich verbinden wollen</qt>"
+
+#: ../src/silcfilemonitor.cpp:41
+msgid "Unable to perform file transfer."
+msgstr "Konnte Dateitransfer nicht ausführen"
+
+#: ../src/silcfilemonitor.cpp:45
+msgid "Unknown file transfer session. Unable to perform."
+msgstr "Unbekannte Dateitransfersitzung. Konnte nicht ausgeführt werden"
+
+#: ../src/silcfilemonitor.cpp:49
+msgid "File transfer already started. Stopping here."
+msgstr "Dateitransfer hat bereits begonnen. Höre hier auf."
+
+#: ../src/silcfilemonitor.cpp:53
+msgid "Unable to perform file transfer: no such file."
+msgstr "Konnte Dateitransfer nicht vollführen, da die Datei nicht existiert."
+
+#: ../src/silcfilemonitor.cpp:57
+msgid "Unable to perform file transfer: permission denied."
+msgstr ""
+"Konnte Dateitransfer nicht vollführen, da ihre Rechte an der Datei "
+"unzureichend sind."
+
+#: ../src/silcfilemonitor.cpp:61
+msgid "Unable to perform file transfer: key agreement failed."
+msgstr "Konnte Dateitransfer nicht vollführen, der Schlüsselaustausch fehlschlug."
+
+#: ../src/silcfilemonitor.cpp:67
+msgid "Cannot perform SILC file transfer"
+msgstr "Konnte SILC Dateitransfer nicht ausführen"
+
+#: ../src/silcmessagemanager.cpp:55
+msgid "You cannot invite a channel, try again an drop a buddy contact next time."
+msgstr ""
+"Sie können keinen Kanal einladen, ziehen sie das nächste Mal einen Kontakt "
+"hierher."
+
+#: ../src/silcmessagemanager.cpp:57
+msgid "Invite Buddy"
+msgstr "Kontakt einladen"
+
+#: ../src/silcmessagemanager.cpp:74
+msgid "Do you want to  start a conference with these buddies?"
+msgstr "Wollen sie eine Konferenz mit diesen Kontakten starten?"
+
+#: ../src/silcmessagemanager.cpp:75
+msgid "Starting a conference"
+msgstr "Beginnen einer Konferenz"
+
+#: ../src/silcmessagemanager.cpp:95
+msgid "Unable to figure out random room name for conference chat. Sorry."
+msgstr "Konnte keinen Zufallsnamen für den Konferenzraum erzeugen. Entschuldigung."
+
+#: ../src/silcmessagemanager.cpp:96
+msgid "Conference chat"
+msgstr "Konferenz"
+
+#: ../src/silcprotocol.cpp:48 ../src/silcprotocol.cpp:49
+#: ../src/silcprotocol.cpp:67 ../src/silcprotocol.cpp:68
+msgid "Online"
+msgstr "Online"
+
+#: ../src/silcprotocol.cpp:51
+msgid "Mute"
+msgstr "Stumm"
+
+#: ../src/silcprotocol.cpp:52
+msgid "Online, Mute"
+msgstr "Online, Stumm"
+
+#: ../src/silcprotocol.cpp:58
+msgid "Op/Mute"
+msgstr "Betreiber/Stumm"
+
+#: ../src/silcprotocol.cpp:58
+msgid "Online, Op, Mute"
+msgstr "Online, Betreiber, Stumm"
+
+#: ../src/silcprotocol.cpp:62
+msgid "Op"
+msgstr "Betreiber"
+
+#: ../src/silcprotocol.cpp:62
+msgid "Online, Op"
+msgstr "Online, Betreiber"
+
+#: ../src/silcprotocol.cpp:72 ../src/silcprotocol.cpp:73
+msgid "Connecting"
+msgstr "Verbinden"
+
+#: ../src/silcprotocol.cpp:79
+msgid "Gone"
+msgstr "Fort"
+
+#: ../src/silcprotocol.cpp:82
+msgid "Gone, Op"
+msgstr "Fort, Betreiber"
+
+#: ../src/silcprotocol.cpp:88
+msgid "Detached"
+msgstr "Getrennt"
+
+#: ../src/silcprotocol.cpp:94
+msgid "Indisposed"
+msgstr "Abgeneigt"
+
+#: ../src/silcprotocol.cpp:99
+msgid "Indisposed, Op"
+msgstr "Abgeneigt, Betreiber"
+
+#: ../src/silcprotocol.cpp:104
+msgid "Busy"
+msgstr "Beschäftigt"
+
+#: ../src/silcprotocol.cpp:107
+msgid "Busy, Op"
+msgstr "Beschäftigt, Betreiber"
+
+#: ../src/silcprotocol.cpp:112
+msgid "Hyper Active"
+msgstr "Hyperaktiv"
+
+#: ../src/silcprotocol.cpp:116
+msgid "Hyper Active, Mute"
+msgstr "Hyperaktiv, Stumm"
+
+#: ../src/silcprotocol.cpp:122 ../src/silcprotocol.cpp:123
+msgid "Hyper Active, Op, Mute"
+msgstr "Hyperaktiv, Betreiber, Stumm"
+
+#: ../src/silcprotocol.cpp:128
+msgid "Hyper Active, Op"
+msgstr "Hyperaktiv, Betreiber"
+
+#: ../src/silcprotocol.cpp:134
+msgid "Offline"
+msgstr "Offline"
+
+#: ../src/silcprotocol.cpp:147
+msgid "USAGE: /whois <nickname> - request whois information."
+msgstr "Benutzung: /whois <Spitzname> - holt Informationen ein"
+
+#: ../src/silcprotocol.cpp:152
+msgid "USAGE: /watch -add|-del <nickname> - watch a nickname."
+msgstr "Benutzung: /watch -add|-del <Spitzname> - beobachte einen Spitznamen"
+
+#: ../src/silcprotocol.cpp:157
+#, fuzzy
+msgid "USAGE: /notice <message> - send a notice message."
+msgstr "Benutzung: /notice <Nachricht> - senden einer Notiznachricht"
+
+#: ../src/silcprotocol.cpp:162
+msgid "USAGE: /me <action> - send an action message."
+msgstr "Benutzung: /me <Aktion> - senden einer Aktionsnachricht"
+
+#: ../src/silcprotocol.cpp:167
+msgid "USAGE: /getkey <nickname> - fetch remote client's public key"
+msgstr "Benutzung: /getkey <Spitzname> - hohlt den Öffentlichen Schlüssel"
+
+#: ../src/silcprotocol.cpp:171
+msgid "USAGE: /killme"
+msgstr "Benutzung: /killme"
+

Added: kopete-silc-plugin/branches/upstream/current/po/extractrc
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/po/extractrc?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/po/extractrc (added)
+++ kopete-silc-plugin/branches/upstream/current/po/extractrc Mon May 28 17:34:43 2007
@@ -1,0 +1,180 @@
+#! /usr/bin/env perl
+
+### TODO: other copyrights, license?
+# Copyright (c) 2004 Richard Evans <rich at ridas.com>
+
+sub usage
+{
+  warn <<"EOF";
+
+extractrc [flags] filenames
+
+This script extracts messages from designer (.ui) and XMLGUI (.rc) files and
+writes on standard output (usually redirected to rc.cpp) the equivalent
+i18n() calls so that xgettext can parse them.
+
+--tag=name        : Also extract the tag name(s). Repeat the flag to specify 
+                    multiple names: --tag=tag_one --tag=tag_two
+
+--tag-group=group : Use a group of tags - uses 'default' if omitted.
+                    Valid groups are: @{[TAG_GROUPS()]}
+
+--context=name    : Give i18n calls a context name: i18nc("name", ...)
+--lines           : Include source line numbers in comments (deprecated, it is switched on by default now)
+--help|?          : Display this summary
+
+EOF
+
+  exit;
+}
+
+###########################################################################################
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+use constant TAG_GROUP => 
+{
+  default => "[tT][eE][xX][tT]|title|string|whatsthis|tooltip|label",
+  koffice => "Example|GroupName|Text|Comment|Syntax|TypeName",
+  none    => "",
+};
+
+use constant TAG_GROUPS => join ", ", map "'$_'", sort keys %{&TAG_GROUP};
+
+
+###########################################################################################
+# Add options here as necessary - perldoc Getopt::Long for details on GetOptions
+
+GetOptions ( "tag=s"       => \my @opt_extra_tags,
+             "tag-group=s" => \my $opt_tag_group,
+             "context=s"   => \my $opt_context,       # I18N context
+             "lines"       => \my $opt_lines,
+             "help|?"      => \&usage );
+
+unless( @ARGV )
+{
+  warn "No filename specified";
+  exit;
+}
+
+$opt_tag_group ||= "default";
+
+die "Unknown tag group: '$opt_tag_group', should be one of " . TAG_GROUPS
+    unless exists TAG_GROUP->{$opt_tag_group};
+
+my $tags = TAG_GROUP->{$opt_tag_group};
+my $extra_tags  = join "", map "|" . quotemeta, @opt_extra_tags;
+my $text_string = qr/($tags$extra_tags)( [^>]*)?>/;    # Precompile regexp
+
+
+###########################################################################################
+# Program start proper - NB $. is the current line number
+
+for my $file_name ( @ARGV )
+{
+  my $fh;
+
+  unless ( open $fh, "<", $file_name )
+  {
+    # warn "Failed to open: '$file_name': $!";
+    next;
+  }
+
+  my $string          = "";
+  my $in_text         = 0;
+  my $start_line_no   = 0;
+  my $in_skipped_prop = 0;
+  my $tag = "";
+  my $attr = "";
+  my $context = "";
+
+  while ( <$fh> )
+  {
+     last if $. == 1 and $_ !~ /^(?:<!DOCTYPE|<\?xml|<!--|<ui version=)/;
+
+     chomp;
+
+     $string .= "\n" . $_;
+     
+     # 'database', 'associations' properties contain strings that shouldn't be translated
+
+     if ( $in_skipped_prop == 0 and $string =~ /<property name=\"(?:database|associations|populationText)\"/ )
+     {
+       $in_skipped_prop = 1;
+     }
+     elsif ( $in_skipped_prop and $string =~ /<\/property/ )
+     {
+       $string          = "";
+       $in_skipped_prop = 0;
+     }
+
+     $context = $opt_context;
+
+     unless ( $in_skipped_prop or $in_text )
+     {
+       if ( ($tag, $attr) = $string =~ /<$text_string/o )
+       {
+         ($attr) = $attr =~ /\w*context=\"([^\"]*)\"/ if $attr;
+         $context = $attr if $attr;
+
+         $string        =~ s/^.*<$text_string//so;
+         $in_text       =  1;
+         $start_line_no =  $.;
+       }
+       else
+       {
+         $string = "";
+       }
+     }
+
+     next unless $in_text;
+     next unless $string =~ /<\/$text_string/o;
+
+     my $text = $string;
+
+     $text =~ s/<\/$text_string.*$//o;
+     $text =~ s/&lt;/</g;
+     $text =~ s/&gt;/>/g;
+     $text =~ s/&amp;/&/g;
+     
+     # We need to escape characters exactly like uic does it:
+     $text =~ s/\\/\\\\/g; # escape \
+     $text =~ s/\"/\\\"/g; # escape "
+     $text =~ s/\r//g; # remove CR (Carriage Return)
+     $text =~ s/\n/\\n\"\n\"/g; # escape LF (Line Feed). uic also change the code line at a LF, we do not do that.
+
+     if ( $text cmp "" )
+     {
+       print "//i18n: tag $tag\n";
+       print "//i18n: file $file_name line $.\n";
+       # xgettext 0.16.1 does not seem to need no-c-format anymore
+       # print "// xgettext: no-c-format\n";
+       if ( $context )
+       {
+         print qq|i18nc("$context","$text");\n|;
+       }
+       else
+       {
+         print  qq|i18n("$text");\n|;
+       }
+     }
+     else
+     {
+       print "// Skipped empty message at $file_name line $.\n";
+     }
+
+     $string  =~ s/^.*<\/$text_string//o;
+     $in_text =  0;
+
+     # Text can be multiline in .ui files (possibly), but we warn about it in XMLGUI .rc files.
+
+     warn "there is <text> floating in: '$file_name'" if $. != $start_line_no and $file_name =~ /\.rc$/i;
+  }
+
+  close $fh or warn "Failed to close: '$file_name': $!";
+
+  die "parsing error in $file_name" if $in_text;
+}
+

Propchange: kopete-silc-plugin/branches/upstream/current/po/extractrc
------------------------------------------------------------------------------
    svn:executable = 

Added: kopete-silc-plugin/branches/upstream/current/po/kopete_silc.pot
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/po/kopete_silc.pot?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/po/kopete_silc.pot (added)
+++ kopete-silc-plugin/branches/upstream/current/po/kopete_silc.pot Mon May 28 17:34:43 2007
@@ -1,0 +1,1002 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-05-03 21:50+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/rc.cpp:3
+msgid "Silc Channel Info"
+msgstr ""
+
+#: ../src/rc.cpp:6 ../src/rc.cpp:308
+msgid "General"
+msgstr ""
+
+#: ../src/rc.cpp:9
+msgid "Name:"
+msgstr ""
+
+#: ../src/rc.cpp:12
+msgid "Topic:"
+msgstr ""
+
+#: ../src/rc.cpp:15 ../src/rc.cpp:323
+msgid "allo&w rich text markup"
+msgstr ""
+
+#: ../src/rc.cpp:18 ../src/rc.cpp:326
+msgid "Alt+W"
+msgstr ""
+
+#: ../src/rc.cpp:21
+msgid "Basic Options"
+msgstr ""
+
+#: ../src/rc.cpp:24
+msgid "&private channel"
+msgstr ""
+
+#: ../src/rc.cpp:27
+msgid "Alt+P"
+msgstr ""
+
+#: ../src/rc.cpp:30
+msgid "&secret channel"
+msgstr ""
+
+#: ../src/rc.cpp:33
+msgid "Alt+S"
+msgstr ""
+
+#: ../src/rc.cpp:36
+msgid "&invite only channel"
+msgstr ""
+
+#: ../src/rc.cpp:39 ../src/rc.cpp:258
+msgid "Alt+I"
+msgstr ""
+
+#: ../src/rc.cpp:42
+msgid "&user silencing"
+msgstr ""
+
+#: ../src/rc.cpp:45
+msgid "Alt+U"
+msgstr ""
+
+#: ../src/rc.cpp:48
+msgid "&operator silencing"
+msgstr ""
+
+#: ../src/rc.cpp:51 ../src/rc.cpp:57 ../src/rc.cpp:348
+msgid "Alt+O"
+msgstr ""
+
+#: ../src/rc.cpp:54 ../src/rc.cpp:297 ../src/rc.cpp:345
+msgid "&OK"
+msgstr ""
+
+#: ../src/rc.cpp:60 ../src/rc.cpp:351
+msgid "&Apply"
+msgstr ""
+
+#: ../src/rc.cpp:63 ../src/rc.cpp:219 ../src/rc.cpp:354
+msgid "Alt+A"
+msgstr ""
+
+#: ../src/rc.cpp:66 ../src/rc.cpp:301 ../src/rc.cpp:357
+msgid "&Cancel"
+msgstr ""
+
+#: ../src/rc.cpp:69 ../src/rc.cpp:108 ../src/rc.cpp:360
+msgid "Alt+C"
+msgstr ""
+
+#: ../src/rc.cpp:72
+msgid "silcAddContact"
+msgstr ""
+
+#: ../src/rc.cpp:75
+msgid ""
+"<p>Provide a nickname or channelname for the contact you wish to add. If you "
+"wish to add a nickname you may want to provide a fingeprint for that contact "
+"as well. The SILC network identifies contacts via fingerprints and so does "
+"this plugin. If you do not provide a fingerprint the contact you wish to add "
+"must be online as its fingerprint is read from the network. If this plugin "
+"cannot read the fingerprint from the network the contact will not be added "
+"at all.</p>"
+msgstr ""
+
+#: ../src/rc.cpp:78
+msgid "proivde an optional fingerprint for the contact"
+msgstr ""
+
+#: ../src/rc.cpp:81
+msgid ""
+"As Nicknames do not have to be unique in SILC you may want to provide an "
+"optional fingerprint for the contact to identify it. If you do not provide a "
+"fingerprint it is read from the network which means that the contact has to "
+"be online."
+msgstr ""
+
+#: ../src/rc.cpp:84 ../src/rc.cpp:96
+msgid "The name of the SILC contact or channel you would like to add."
+msgstr ""
+
+#: ../src/rc.cpp:87 ../src/rc.cpp:99
+msgid ""
+"The name of the SILC contact or channel you would like to add.  You may type "
+"simply the text of a person's nickname, or you may type a channel name."
+msgstr ""
+
+#: ../src/rc.cpp:90
+msgid "&Fingerprint:"
+msgstr ""
+
+#: ../src/rc.cpp:93
+msgid "&Nickname/channel:"
+msgstr ""
+
+#: ../src/rc.cpp:102
+msgid "<i>e.g. 0000:0001:0002:0003:0004::0005:0006:0007:0008:0009</i>"
+msgstr ""
+
+#: ../src/rc.cpp:105
+msgid "&contact is channel"
+msgstr ""
+
+#: ../src/rc.cpp:111
+msgid "check if the contact is a channel"
+msgstr ""
+
+#: ../src/rc.cpp:114
+msgid "check if you want to add a channel to your buddies list"
+msgstr ""
+
+#: ../src/rc.cpp:117
+msgid "SilcEditAccount"
+msgstr ""
+
+#: ../src/rc.cpp:120
+msgid "&Basic Setup"
+msgstr ""
+
+#: ../src/rc.cpp:123
+msgid "Account Information"
+msgstr ""
+
+#: ../src/rc.cpp:126
+msgid "&Nickname:"
+msgstr ""
+
+#: ../src/rc.cpp:129 ../src/rc.cpp:132 ../src/rc.cpp:171
+msgid "This is the name that everyone will see everytime you say something"
+msgstr ""
+
+#: ../src/rc.cpp:135
+msgid ""
+"The nickname you would like to use on the SILC network.  You may change this "
+"once online with the /nick command."
+msgstr ""
+
+#: ../src/rc.cpp:138 ../src/rc.cpp:141
+msgid ""
+"The username you would prefer to use on the SILC network. Leave blank to use "
+"your system account name."
+msgstr ""
+
+#: ../src/rc.cpp:144
+msgid "&Username:"
+msgstr ""
+
+#: ../src/rc.cpp:147
+msgid ""
+"The username you would prefer to use on SILC network, if your system does "
+"not have identd support.  Leave blank to use your system account name."
+msgstr ""
+
+#: ../src/rc.cpp:150 ../src/rc.cpp:153
+msgid ""
+"If you want other people on the SILC network to see your real name, you can "
+"enter it here."
+msgstr ""
+
+#: ../src/rc.cpp:156
+msgid "&Real name:"
+msgstr ""
+
+#: ../src/rc.cpp:159
+msgid "E&xclude from connect all"
+msgstr ""
+
+#: ../src/rc.cpp:162
+msgid "Alt+X"
+msgstr ""
+
+#: ../src/rc.cpp:165
+msgid "Network Connection"
+msgstr ""
+
+#: ../src/rc.cpp:168
+msgid "Re&mote Host:"
+msgstr ""
+
+#: ../src/rc.cpp:174
+msgid "silc.silcnet.org"
+msgstr ""
+
+#: ../src/rc.cpp:177
+msgid "host[:port]"
+msgstr ""
+
+#: ../src/rc.cpp:180
+msgid "The alias you would like to use on SILC."
+msgstr ""
+
+#: ../src/rc.cpp:183
+msgid "Public &Keys"
+msgstr ""
+
+#: ../src/rc.cpp:186
+msgid "SILC-Server Fingerprints"
+msgstr ""
+
+#: ../src/rc.cpp:189
+msgid "Hostname"
+msgstr ""
+
+#: ../src/rc.cpp:192
+msgid "IP-Address"
+msgstr ""
+
+#: ../src/rc.cpp:195
+msgid "Port"
+msgstr ""
+
+#: ../src/rc.cpp:198 ../src/rc.cpp:329
+msgid "Fingerprint"
+msgstr ""
+
+#: ../src/rc.cpp:201
+msgid "&Remove"
+msgstr ""
+
+#: ../src/rc.cpp:204
+msgid "Beha&viour"
+msgstr ""
+
+#: ../src/rc.cpp:207
+msgid "Message settings"
+msgstr ""
+
+#: ../src/rc.cpp:210
+msgid "Sign channel &messages"
+msgstr ""
+
+#: ../src/rc.cpp:213
+msgid "Alt+M"
+msgstr ""
+
+#: ../src/rc.cpp:216
+msgid "Sign channel &actions"
+msgstr ""
+
+#: ../src/rc.cpp:222
+msgid "Sign p&rivate messages"
+msgstr ""
+
+#: ../src/rc.cpp:225
+msgid "Alt+R"
+msgstr ""
+
+#: ../src/rc.cpp:228
+msgid "Sign pri&vate actions"
+msgstr ""
+
+#: ../src/rc.cpp:231
+msgid "Alt+V"
+msgstr ""
+
+#: ../src/rc.cpp:234
+msgid "Displa&y small SilcMime images inline"
+msgstr ""
+
+#: ../src/rc.cpp:237
+msgid "Alt+Y"
+msgstr ""
+
+#: ../src/rc.cpp:240
+msgid "File Transfer settings"
+msgstr ""
+
+#: ../src/rc.cpp:243
+msgid "bind local port:"
+msgstr ""
+
+#: ../src/rc.cpp:246
+msgid "bind always"
+msgstr ""
+
+#: ../src/rc.cpp:249
+msgid "bind never"
+msgstr ""
+
+#: ../src/rc.cpp:252
+msgid "autodetect nat"
+msgstr ""
+
+#: ../src/rc.cpp:255
+msgid "accept &incoming file transfer requests automatically"
+msgstr ""
+
+#: ../src/rc.cpp:261
+msgid "prefer to send data as SilcMime ob&jects"
+msgstr ""
+
+#: ../src/rc.cpp:264
+msgid "Alt+J"
+msgstr ""
+
+#: ../src/rc.cpp:267
+msgid "Default Messages"
+msgstr ""
+
+#: ../src/rc.cpp:270
+msgid "&Quit Message:"
+msgstr ""
+
+#: ../src/rc.cpp:273
+msgid "kopete_silc : http://www.brokenpipe.de/SILC/"
+msgstr ""
+
+#: ../src/rc.cpp:276
+msgid "Choose channel to join"
+msgstr ""
+
+#: ../src/rc.cpp:279
+msgid "Channel:"
+msgstr ""
+
+#: ../src/rc.cpp:282
+msgid "Password:"
+msgstr ""
+
+#: ../src/rc.cpp:285
+msgid "c&laim founder status"
+msgstr ""
+
+#: ../src/rc.cpp:288
+msgid "Alt+L"
+msgstr ""
+
+#: ../src/rc.cpp:291
+msgid "use -au&th option"
+msgstr ""
+
+#: ../src/rc.cpp:294 ../src/rc.cpp:338
+msgid "Alt+T"
+msgstr ""
+
+#: ../src/rc.cpp:305
+msgid "Silc User Info"
+msgstr ""
+
+#: ../src/rc.cpp:311
+msgid "Channels:"
+msgstr ""
+
+#: ../src/rc.cpp:314
+msgid "Real name:"
+msgstr ""
+
+#: ../src/rc.cpp:317
+msgid "Last update:"
+msgstr ""
+
+#: ../src/rc.cpp:320
+msgid "Nickname:"
+msgstr ""
+
+#: ../src/rc.cpp:332
+msgid "Fingerprint:"
+msgstr ""
+
+#: ../src/rc.cpp:335
+msgid "&Trusted"
+msgstr ""
+
+#: ../src/rc.cpp:341
+msgid "Attributes"
+msgstr ""
+
+#: ../src/silcaccount.cpp:121
+msgid "failed to create SILC client"
+msgstr ""
+
+#: ../src/silcaccount.cpp:122 ../src/silcaccount.cpp:134
+msgid "Initialisation"
+msgstr ""
+
+#: ../src/silcaccount.cpp:133
+msgid "failed to initialize SILC client"
+msgstr ""
+
+#: ../src/silcaccount.cpp:178
+msgid "Could not generated key pair"
+msgstr ""
+
+#: ../src/silcaccount.cpp:179
+msgid "SILC Key Generation"
+msgstr ""
+
+#: ../src/silcaccount.cpp:191
+msgid "Join Channel ..."
+msgstr ""
+
+#: ../src/silcaccount.cpp:193
+msgid "Show Server Window"
+msgstr ""
+
+#: ../src/silcaccount.cpp:195
+msgid "Show My Fingerprint"
+msgstr ""
+
+#: ../src/silcaccount.cpp:399
+msgid "Fingerprint of "
+msgstr ""
+
+#: ../src/silcaccount.cpp:461
+msgid "<invalid-configuration>"
+msgstr ""
+
+#: ../src/silcaccount.cpp:710
+msgid "\"%1\" is an invalid channel name."
+msgstr ""
+
+#: ../src/silcaccount.cpp:711 ../src/silcchannelcontact.cpp:117
+msgid "SILC Plugin"
+msgstr ""
+
+#: ../src/silcaccount.cpp:772
+msgid "Unable to establish connection to the remote host."
+msgstr ""
+
+#: ../src/silcaccount.cpp:773 ../src/silcaccount.cpp:824
+#: ../src/silcaccount.cpp:844 ../src/silcaccount.cpp:1567
+#: ../src/silcaccount.cpp:1598
+msgid "Kopete SILC Plugin"
+msgstr ""
+
+#: ../src/silcaccount.cpp:843
+msgid "Unable to connect to remote host. Protocol failure."
+msgstr ""
+
+#: ../src/silcaccount.cpp:984
+msgid "SILC Command %1 failed"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1102
+msgid ""
+"Received client public key of %1. \n"
+"Fingerprint: %2\n"
+"\n"
+"However this does not match the cached client's fingerprint which appears to "
+"be `%3'. This probably should not happen"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1108 ../src/silcaccount.cpp:1119
+#: ../src/silcaccount.cpp:1134 ../src/silcaccount.cpp:1620
+#: ../src/silcaccount.cpp:1638
+msgid "Incoming Public Key"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1115 ../src/silcaccount.cpp:1616
+msgid ""
+"Received client public key of %1. \n"
+"Fingerprint: %2\n"
+"Would you like to accept the key?"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1132
+msgid "Unable to save received client public key of %1."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1165
+msgid "Cannot open %1 for reading"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1166 ../src/silcaccount.cpp:1178
+msgid "Opening Key File"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1177
+msgid "Cannot open %1 for writing"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1302
+msgid "Kicked by %1."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1305
+msgid " Reason: %2"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1318
+msgid "You were kicked"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1346
+msgid "Given reason: %1"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1347
+msgid "No reason given."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1353
+msgid "You have been killed from the SILC network by %1. "
+msgstr ""
+
+#: ../src/silcaccount.cpp:1354
+msgid "You have been killed"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1360
+msgid "Killed by %1. "
+msgstr ""
+
+#: ../src/silcaccount.cpp:1454
+msgid ""
+"Invitation from %1 received, however no channel name has been specified. "
+"Ignoring request."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1456 ../src/silcaccount.cpp:1464
+msgid "Incoming Invitation"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1462
+msgid ""
+"'%1' invited you into channel '%2'. Do you want to follow this invitation?"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1563
+msgid ""
+"The authenticity of host '%1 (%2)' can't be established. Key fingerprint is %"
+"3.\n"
+"\n"
+"Are you sure you want to continue connecting?"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1591
+msgid ""
+"The public key of the remote host %1 has changed. According to my config it "
+"used to have the fingerprint %2, however I have received the fingerprint %3 "
+"this time. This may mean that there is a man in the middle. \n"
+"Be careful, resetting connection now."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1635
+msgid ""
+"Recieved client public key, but no key was requested. \n"
+"Fingerprint: %1\n"
+"This shouldn't happen, so the request will be ignored."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1665
+msgid ""
+"Please enter the passphrase.\n"
+"               The server window may contain additional information."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1723 ../src/silcaccount.cpp:1739
+msgid "File Transfer '%1' from %2"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1736
+msgid "The file %1 does already exist. Do you want to overwrite it?"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1780
+msgid ""
+"Received incoming file transfer request from %1, however the sender "
+"requested, that the receiver shall bind a listening port. Unfortunately the "
+"latter is forbidden according this plugin's configuration.\n"
+"\n"
+"The file transfer request has been rejected."
+msgstr ""
+
+#: ../src/silcaccount.cpp:1785 ../src/silcaccount.cpp:1804
+msgid "Incoming File Transfer"
+msgstr ""
+
+#: ../src/silcaccount.cpp:1800
+msgid ""
+"Received incoming file transfer request from %1 (%2:%3). Do you want to "
+"receive and store this file?"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:146
+msgid "<b><u>Mood:</u></b> "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:148
+msgid "<b><u>Prefered medium:</u></b> "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:151
+msgid "<b><u>Timezone:</u></b> "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:153
+msgid "<b><u>Language:</u></b> "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:156
+msgid "<b><u>Location on Earth:</u></b><br>"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:158
+msgid "Longitude: "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:159
+msgid "Latitude: "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:160
+msgid "Altitude: "
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:162
+msgid "<b><u>Status Message:</u></b><br>"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:176
+msgid "email"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:178
+msgid "phone call"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:180
+msgid "paging"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:182
+msgid "SMS"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:184
+msgid "MMS"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:186
+msgid "chatting"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:188
+msgid "video conference"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:201
+msgid "happy"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:203
+msgid "sad"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:205
+msgid "angry"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:207
+msgid "jealous"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:209
+msgid "ashamed"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:211
+msgid "invincible"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:213
+msgid "in love"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:215
+msgid "sleepy"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:217
+msgid "bored"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:219
+msgid "exited"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:221
+msgid "anxious"
+msgstr ""
+
+#: ../src/silcbuddyattributes.cpp:224
+msgid "normal"
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:97 ../src/silcchannelcontact.cpp:168
+msgid ""
+"Unable to send this message now. The protocol is currently offline and does "
+"not support offline sending."
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:99 ../src/silcbuddycontact.cpp:109
+#: ../src/silcchannelcontact.cpp:170
+msgid "User is Not Reachable"
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:106
+msgid ""
+"This message cannot be sent right now, since the remote client is currently "
+"detached and the protocol does not support offline sending."
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:404
+msgid "&Operator"
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:408
+msgid "&Kick from Channel"
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:455 ../src/silcchannelcontact.cpp:702
+msgid "Kopete File Transfer"
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:469
+msgid ""
+"You are trying to send a big file via SilcMIME message. Do you want to send "
+"it via SilcFiletransfer?"
+msgstr ""
+
+#: ../src/silcbuddycontact.cpp:472
+msgid "Sending MIME message"
+msgstr ""
+
+#: ../src/silcchannelcontact.cpp:116
+msgid "Sorry, you cannot join channels unless you go online"
+msgstr ""
+
+#: ../src/silccontact.cpp:163
+msgid "unknown signature status"
+msgstr ""
+
+#: ../src/silccontact.cpp:167
+msgid "untrusted signature"
+msgstr ""
+
+#: ../src/silccontact.cpp:171
+msgid "fully trusted signature."
+msgstr ""
+
+#: ../src/silccontact.cpp:175
+msgid "verification FAILED."
+msgstr ""
+
+#: ../src/silccontact.cpp:182
+msgid "Incoming Signed"
+msgstr ""
+
+#: ../src/silccontact.cpp:184
+msgid "Notice"
+msgstr ""
+
+#: ../src/silccontact.cpp:185 ../src/silccontact.cpp:200
+msgid "Action"
+msgstr ""
+
+#: ../src/silccontact.cpp:185 ../src/silccontact.cpp:200
+msgid "Message"
+msgstr ""
+
+#: ../src/silccontact.cpp:198
+msgid "Outgoing Signed"
+msgstr ""
+
+#: ../src/silccontact.cpp:339
+msgid "unknown"
+msgstr ""
+
+#: ../src/silccontact.cpp:344
+msgid "<a href=\"%2\">MIME message</a> (%1)"
+msgstr ""
+
+#: ../src/silccontact.cpp:345
+msgid "New MIME message (%1) saved <a href=\"%2\">here</a>"
+msgstr ""
+
+#: ../src/silceditaccountwidget.cpp:109
+msgid "<qt>You must enter a nickname.</qt>"
+msgstr ""
+
+#: ../src/silceditaccountwidget.cpp:113
+msgid "<qt>Please remove any @ or space from the nickname</qt>"
+msgstr ""
+
+#: ../src/silceditaccountwidget.cpp:116
+msgid "<qt>You have to specify a remote host.</qt>"
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:41
+msgid "Unable to perform file transfer."
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:45
+msgid "Unknown file transfer session. Unable to perform."
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:49
+msgid "File transfer already started. Stopping here."
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:53
+msgid "Unable to perform file transfer: no such file."
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:57
+msgid "Unable to perform file transfer: permission denied."
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:61
+msgid "Unable to perform file transfer: key agreement failed."
+msgstr ""
+
+#: ../src/silcfilemonitor.cpp:67
+msgid "Cannot perform SILC file transfer"
+msgstr ""
+
+#: ../src/silcmessagemanager.cpp:55
+msgid ""
+"You cannot invite a channel, try again an drop a buddy contact next time."
+msgstr ""
+
+#: ../src/silcmessagemanager.cpp:57
+msgid "Invite Buddy"
+msgstr ""
+
+#: ../src/silcmessagemanager.cpp:74
+msgid "Do you want to  start a conference with these buddies?"
+msgstr ""
+
+#: ../src/silcmessagemanager.cpp:75
+msgid "Starting a conference"
+msgstr ""
+
+#: ../src/silcmessagemanager.cpp:95
+msgid "Unable to figure out random room name for conference chat. Sorry."
+msgstr ""
+
+#: ../src/silcmessagemanager.cpp:96
+msgid "Conference chat"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:48 ../src/silcprotocol.cpp:49
+#: ../src/silcprotocol.cpp:67 ../src/silcprotocol.cpp:68
+msgid "Online"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:51
+msgid "Mute"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:52
+msgid "Online, Mute"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:58
+msgid "Op/Mute"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:58
+msgid "Online, Op, Mute"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:62
+msgid "Op"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:62
+msgid "Online, Op"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:72 ../src/silcprotocol.cpp:73
+msgid "Connecting"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:79
+msgid "Gone"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:82
+msgid "Gone, Op"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:88
+msgid "Detached"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:94
+msgid "Indisposed"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:99
+msgid "Indisposed, Op"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:104
+msgid "Busy"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:107
+msgid "Busy, Op"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:112
+msgid "Hyper Active"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:116
+msgid "Hyper Active, Mute"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:122 ../src/silcprotocol.cpp:123
+msgid "Hyper Active, Op, Mute"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:128
+msgid "Hyper Active, Op"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:134
+msgid "Offline"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:147
+msgid "USAGE: /whois <nickname> - request whois information."
+msgstr ""
+
+#: ../src/silcprotocol.cpp:152
+msgid "USAGE: /watch -add|-del <nickname> - watch a nickname."
+msgstr ""
+
+#: ../src/silcprotocol.cpp:157
+msgid "USAGE: /notice <message> - send a notice message."
+msgstr ""
+
+#: ../src/silcprotocol.cpp:162
+msgid "USAGE: /me <action> - send an action message."
+msgstr ""
+
+#: ../src/silcprotocol.cpp:167
+msgid "USAGE: /getkey <nickname> - fetch remote client's public key"
+msgstr ""
+
+#: ../src/silcprotocol.cpp:171
+msgid "USAGE: /killme"
+msgstr ""

Added: kopete-silc-plugin/branches/upstream/current/silc.protocol
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/silc.protocol?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/silc.protocol (added)
+++ kopete-silc-plugin/branches/upstream/current/silc.protocol Mon May 28 17:34:43 2007
@@ -1,0 +1,12 @@
+[Protocol]
+exec=kopete %u
+protocol=silc
+input=none
+output=none
+helper=true
+listing=
+reading=false
+writing=false
+makedir=false
+deleting=false
+Icon=silc_normal

Added: kopete-silc-plugin/branches/upstream/current/src/CMakeLists.txt
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/CMakeLists.txt?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/CMakeLists.txt (added)
+++ kopete-silc-plugin/branches/upstream/current/src/CMakeLists.txt Mon May 28 17:34:43 2007
@@ -1,0 +1,93 @@
+# Copyright(C) 2007 Stefan Siegl <stesie at brokenpipe.de>
+#
+# kopete_silc - silc plugin for kopete messenger
+#
+# 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
+
+find_package(KDE3 REQUIRED)
+add_subdirectory(icons)
+
+ADD_DEFINITIONS(-O0 -ggdb -DSILC_DIST_SKR -DSILC_DIST_TMA)
+
+# check for libsilc
+INCLUDE(${CMAKE_ROOT}/Modules/UsePkgConfig.cmake)
+PKGCONFIG(silc SILC_INCLUDE_DIRS SILC_LIB_DIRS SILC_LDFLAGS SILC_CFLAGS)
+PKGCONFIG(silcclient SILCCLIENT_INCLUDE_DIRS SILCCLIENT_LIB_DIRS SILCCLIENT_LDFLAGS SILCCLIENT_CFLAGS)
+
+INCLUDE_DIRECTORIES(
+  ${SILC_INCLUDE_DIRS} ${SILCCLIENT_INCLUDE_DIRS} 
+  ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src
+  ${KDE3_INCLUDE_DIRS} 
+  ${KDE3_INCLUDE_DIR}/kopete 
+  ${KDE3_INCLUDE_DIR}/kopete/ui)
+LINK_DIRECTORIES(${SILC_LIB_DIRS} ${SILCCLIENT_LIB_DIRS} ${KDE3_LIB_DIR})
+
+kde3_add_ui_files(kopete_silc_ui_SRCS
+  silcaddcontact.ui
+  silcbuddycontactinfo.ui
+  silcchannelcontactinfo.ui
+  silcchanneljoin.ui
+  silceditaccount.ui
+)
+
+set(kopete_silc_NOMOC_SRCS
+  silcbuddyattributes.cpp
+)
+
+set(kopete_silc_SRCS
+  silcaccount.cpp
+  silcaddcontactpage.cpp
+  silcbuddycontact.cpp
+  silcbuddycontactinfowidget.cpp
+  silcchannelcontact.cpp
+  silcchannelcontactinfowidget.cpp
+  silccontact.cpp
+  silccontactmanager.cpp
+  silceditaccountwidget.cpp
+  silcfiletransfer.cpp
+  silcjoindlgwidget.cpp
+  silcmessagemanager.cpp
+  silcprotocol.cpp
+  silcservercontact.cpp
+)
+
+kde3_automoc(${kopete_silc_SRCS})
+KDE3_ADD_KPART(kopete_silc 
+  ${kopete_silc_SRCS} 
+  ${kopete_silc_NOMOC_SRCS}
+  ${kopete_silc_ui_SRCS}
+)
+set_target_properties(kopete_silc PROPERTIES COMPILE_FLAGS "${SILC_CFLAGS} ${SILCCLIENT_CFLAGS}")
+
+target_link_libraries(kopete_silc 
+  ${QT_AND_KDECORE_LIBS} kutils kdeui kopete kio
+  ${SILC_LDFLAGS}
+  ${SILCCLIENT_LDFLAGS}
+  -Wl,-no-undefined
+)
+
+# configure installation paths
+set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name")
+set(EXEC_INSTALL_PREFIX 
+  "${CMAKE_INSTALL_PREFIX}"
+  CACHE PATH "Base directory for executables and libraries" FORCE)
+set(LIB_INSTALL_DIR
+  "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
+  CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
+set(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" 
+    CACHE PATH "the subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" FORCE)
+
+install(TARGETS kopete_silc DESTINATION ${PLUGIN_INSTALL_DIR})
+

Added: kopete-silc-plugin/branches/upstream/current/src/icons/CMakeLists.txt
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/CMakeLists.txt?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/icons/CMakeLists.txt (added)
+++ kopete-silc-plugin/branches/upstream/current/src/icons/CMakeLists.txt Mon May 28 17:34:43 2007
@@ -1,0 +1,49 @@
+# Copyright(C) 2007 Stefan Siegl <stesie at brokenpipe.de>
+#
+# kopete_silc - silc plugin for kopete messenger
+#
+# 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
+
+# configure installation paths
+set(SHARE_INSTALL_PREFIX 
+  ${CMAKE_INSTALL_PREFIX}/share 
+  CACHE PATH "Base directory for files which go to share/" FORCE)
+set(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" 
+    CACHE PATH "The parent directory where applications can install their data" FORCE)
+set(ICON_INSTALL_DIR "${DATA_INSTALL_DIR}/kopete/icons/crystalsvg"
+    CACHE PATH "The parent directory where the Kopete icons shall be installed to" FORCE)  
+
+
+set(kopete_silc_ICONS
+  cr16-action-silc_away.png
+  cr16-action-silc_busy.png
+  cr16-action-silc_channel.png
+  cr16-action-silc_detached.png
+  cr16-action-silc_hyper.png
+  cr16-action-silc_indisposed.png
+  cr16-action-silc_mute.png
+  cr16-action-silc_op.png
+  cr32-app-silc_protocol.png
+)
+
+FOREACH (_current_ICON ${kopete_silc_ICONS} )
+  STRING(REGEX REPLACE "^[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size  "${_current_ICON}")
+  STRING(REGEX REPLACE "^[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
+  STRING(REGEX REPLACE "^[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name  "${_current_ICON}")
+
+  #MESSAGE("handling icon: ${_current_ICON} -> ${_size}x${_size}/${_group}/${_name}")
+  INSTALL(FILES ${_current_ICON} DESTINATION ${ICON_INSTALL_DIR}/${_size}x${_size}/${_group}s/ RENAME ${_name})
+ENDFOREACH (_current_ICON)
+

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_away.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_away.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_away.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_busy.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_busy.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_busy.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_channel.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_channel.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_channel.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_detached.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_detached.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_detached.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_hyper.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_hyper.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_hyper.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_indisposed.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_indisposed.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_indisposed.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_mute.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_mute.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_mute.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_op.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_op.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr16-action-silc_op.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/icons/cr32-app-silc_protocol.png
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/icons/cr32-app-silc_protocol.png?rev=35&op=file
==============================================================================
Binary file - no diff available.

Propchange: kopete-silc-plugin/branches/upstream/current/src/icons/cr32-app-silc_protocol.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: kopete-silc-plugin/branches/upstream/current/src/silcaccount.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcaccount.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcaccount.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcaccount.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,2031 @@
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2006 Martin Albrecht <malb at informatik.uni-bremen.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+#include <assert.h>
+
+#include "silcaccount.h"
+#include "silccontact.h"
+#include "silcbuddycontact.h"
+#include "silcchannelcontact.h"
+#include "silcservercontact.h"
+#include "silcmessagemanager.h"
+#include "silcjoindlgwidget.h"
+#include "silcfiletransfer.h"
+#include "silcbuddyattributes.h"
+
+#include <kopetemetacontact.h>
+#include <kopeteonlinestatus.h>
+#include <kopeteuiglobal.h>
+#include <kopetechatsessionmanager.h>
+#include <ui/kopetefileconfirmdialog.h>
+#include <ui/kopeteview.h>
+
+#include <kdebug.h>
+#include <qcheckbox.h>
+
+#include <kuser.h>
+#include <klocale.h>
+#include <kconfigbase.h>
+#include <kaction.h>
+#include <kpopupmenu.h>
+#include <klineeditdlg.h>
+#include <kcompletion.h>
+#include <kglobalsettings.h>
+#include <kmessagebox.h>
+#include <klineedit.h>
+#include <kstandarddirs.h>
+#include <qdatastream.h>
+#include <qregexp.h>
+#include <kstandarddirs.h>
+#include <kopetecontactlist.h>
+#include <kpassdlg.h>
+#include <qimage.h>
+#include <qfile.h>
+
+namespace Kopete {
+  class KopeteView;
+}
+
+// sorry for this hack, unfortunately we need it for
+// the macros of recent libsilc to work ...
+typedef unsigned char SilcUInt8;
+
+// set ourself's usermode
+static void sendUmode(SilcTK::SilcClient client, 
+		      SilcTK::SilcClientConnection conn,
+		      SilcTK::SilcUInt32 umode);
+
+
+const QString SilcAccount::CONFIG_NICKNAME = QString("NickName");
+const QString SilcAccount::CONFIG_USERNAME = QString("UserName");
+const QString SilcAccount::CONFIG_REALNAME = QString("RealName");
+const QString SilcAccount::CONFIG_HOSTNAME = QString("HostName");
+const QString SilcAccount::CONFIG_SIGN_CHAT_MESSAGE = QString("SignChatMsg");
+const QString SilcAccount::CONFIG_SIGN_CHAT_ACTION = QString("SignChatAction");
+const QString SilcAccount::CONFIG_SIGN_PRIV_MESSAGE = QString("SignPrivMsg");
+const QString SilcAccount::CONFIG_SIGN_PRIV_ACTION = QString("SignPrivAction");
+const QString SilcAccount::CONFIG_DISPLAY_IMAGES_INLINE = QString("InlineImg");
+const QString SilcAccount::CONFIG_FT_USE_SILC_MIME = QString("UseSilcMime");
+const QString SilcAccount::CONFIG_FT_AUTO_ACCEPT = QString("FtAutoAccept");
+const QString SilcAccount::CONFIG_FT_BIND_SELECTION = QString("FtBindSelection");
+const QString SilcAccount::CONFIG_QUIT_MESSAGE = QString("QuitMessage");
+const QString SilcAccount::CONFIG_ATTR_MOOD = QString("AttrMood");
+const QString SilcAccount::CONFIG_ATTR_CONTACT = QString("AttrContact");
+const QString SilcAccount::CONFIG_ATTR_GEO_ALLOWED = QString("AttrGeoAllowed");
+const QString SilcAccount::CONFIG_ATTR_GEO_LONG = QString("AttGeoLong");
+const QString SilcAccount::CONFIG_ATTR_GEO_LAT = QString("AttrGeoLat");
+const QString SilcAccount::CONFIG_ATTR_GEO_ALT = QString("AttrGeoAlt");
+const QString SilcAccount::CONFIG_ATTR_MESSAGE = QString("AttrMessage");
+const QString SilcAccount::CONFIG_ATTR_LANGUAGE = QString("AttrLanguage");
+const QString SilcAccount::CONFIG_ATTR_TIMEZONE = QString("AttrTimezone");
+const QString SilcAccount::CONFIG_ATTR_ALLOWED = QString("AttrAllowed");
+
+const QString pubKeyName = QString("kopete_silc_public_key.pub");
+const QString prvKeyName = QString("kopete_silc_private_key.prv");
+
+/**
+ *
+ *
+ */
+
+SilcAccount::SilcAccount(SilcProtocol *proto, const QString &accountID,
+			 const char *name)
+  : Kopete::PasswordedAccount(proto, accountID, 0, name), _contactManager(this),
+    _pubkey(NULL), _privkey(NULL),  _client(NULL), _conn(NULL),  
+    libsilcTimerId(0), libsilcTimerLocked(false)
+{
+  KConfigGroup *config = configGroup();
+  QString nickname = name ? QString::fromUtf8(name) :
+    config->readEntry(CONFIG_NICKNAME);
+
+  if(nickname == QString::null) {
+    // account doesn't have a nickname assigned, therefore use some default
+    const char *userenv = getenv("USER");
+    if(! userenv) userenv = "SilcUser";
+    nickname = QString(userenv);
+  }
+  
+  setNickName(nickname);
+
+  /* SilcClient */
+  SilcTK::SilcClientParams params;
+  memset((void *)&params, 0, sizeof(params));
+  snprintf(params.nickname_format, 32, "%%n");
+
+  _client = silc_client_alloc(&SilcAccount::ops, &params, this, NULL);
+
+  if(! _client) {
+    KMessageBox::error(Kopete::UI::Global::mainWidget(),
+		       i18n("failed to create SILC client"),
+		       i18n("Initialisation"));
+    return;
+  }
+
+  if(! silc_client_init(_client, strdup(userName().utf8()), 
+                        SilcTK::silc_net_localhost(), strdup(realName().utf8()),
+                        NULL, NULL)) {
+    KMessageBox::error(Kopete::UI::Global::mainWidget(),
+		       i18n("failed to initialize SILC client"),
+		       i18n("Initialisation"));
+    SilcTK::silc_client_stop(_client, NULL, NULL);
+    SilcTK::silc_client_free(_client);
+    _client = NULL;
+    return;
+  }
+
+  SilcTK::silc_hash_alloc((const unsigned char *)"sha1", &sha1hash);
+
+  QString pubFile = locateLocal("appdata", pubKeyName);  
+  QString prvFile = locateLocal("appdata", prvKeyName);  
+
+  if(silc_load_key_pair(pubFile, prvFile, "", &_pubkey, &_privkey))
+  {
+    (void) 0;
+    // keypair does not exist ... try silc  
+  } else if(silc_load_key_pair(KUser().homeDir().append
+                               ("/.silc/public_key.pub").latin1(),
+                               KUser().homeDir().append
+                               ("/.silc/private_key.prv").latin1(),
+                               "", &_pubkey, &_privkey))
+  {
+    copyKey(KUser().homeDir().append("/.silc/public_key.pub"));
+    copyKey(KUser().homeDir().append("/.silc/private_key.prv"),true);
+    // keypair does not exist ... try silky 
+  } else if(silc_load_key_pair(KUser().homeDir().append
+                               ("/.silky/silky.pub").latin1(),                
+                               KUser().homeDir().append
+                               ("/.silky/silky.prv").latin1(),
+                               "", &_pubkey, &_privkey))
+  {
+    copyKey(KUser().homeDir().append("/.silky/silky.pub"));
+    copyKey(KUser().homeDir().append("/.silky/silky.prv"),true);
+    // try new one 
+  } else if(silc_create_key_pair("rsa", 2048, pubFile, prvFile, 
+                                 NULL, "", &_pubkey, &_privkey, FALSE)) {
+     (void) 0;
+  } else {
+    KMessageBox::error(Kopete::UI::Global::mainWidget(),
+		       i18n("Could not generated key pair"),
+		       i18n("SILC Key Generation"));
+    SilcTK::silc_client_stop(_client, NULL, NULL);
+    SilcTK::silc_client_free(_client);
+    _client = 0;
+    return;
+  }
+
+
+  SilcContact *myself = contactManager()->createBuddy(nickname);
+  setMyself(myself);
+
+  _myServer = contactManager()->createServer(hostName());
+
+  menuJoinChannel = new KAction(i18n("Join Channel ..."), QString::null, 0,
+				this, SLOT(slotJoinChannel()), this);
+  menuShowServer = new KAction(i18n("Show Server Window"), QString::null, 0,
+			       this, SLOT(slotShowServer()), this);
+  menuShowFingerprint = new KAction(i18n("Show My Fingerprint"), QString::null,
+				    0, this, SLOT(slotShowFingerprint()), this);
+  QObject::connect(Kopete::ContactList::self(), 
+                   SIGNAL(globalIdentityChanged(const QString&, const QVariant&)), 
+                   SLOT(slotGlobalIdentityChanged(const QString&, const QVariant&)));
+  QObject::connect(this, SIGNAL(disconnected()), SLOT(slotStopTimer()));
+
+  SilcTK::silc_client_run_one(_client);
+}
+
+
+SilcAccount::~SilcAccount() 
+{ 
+  if(_client) {
+    SilcTK::silc_client_stop(_client, NULL, NULL);
+    SilcTK::silc_client_free(_client);
+    _client = 0;
+  }
+
+  if(_myServer) {
+    delete _myServer;
+    _myServer = 0;
+  }
+  if(_pubkey)
+    SilcTK::silc_pkcs_public_key_free(_pubkey);
+  if(_privkey)
+    SilcTK::silc_pkcs_private_key_free(_privkey);
+}
+
+void
+SilcAccount::timerEvent(QTimerEvent *)
+{
+  if(! _client)
+    return;
+
+  if(libsilcTimerLocked)
+    return; // libsilcTimerLocked held, never ever call libsilc recursively.
+
+  // this isn't of course a good locking technique, but it's perfectly
+  // okay, since Kopete always runs single threaded.
+  libsilcTimerLocked = true;
+  
+  SilcTK::silc_client_run_one(_client);
+
+  libsilcTimerLocked = false;
+}
+
+void 
+SilcAccount::connect(const Kopete::OnlineStatus &status)
+{
+  if(! _client) {
+     return;
+  }
+  if(! _conn) {
+    setOnlineStatus(SilcProtocol::protocol()->statusConnecting);
+    kdDebug() << "connecting to " << hostName() << " now" << endl;
+
+    int collonpos = hostName().find(":");
+    QString host;
+    int port = 706;  
+    if(collonpos < 0) {
+      host = hostName();
+    } else {
+      //split
+      host = hostName().left(collonpos);
+      port = hostName().mid(collonpos + 1).toInt();    
+    }
+
+    SilcTK::SilcClientConnectionParams params;
+    /* Set connection parameters */
+    memset(&params, 0, sizeof(params));
+    params.nickname = (char *)nickName().latin1();
+    params.pfs = TRUE;
+
+    
+    SilcTK::SilcAsyncOperation asop = 
+      SilcTK::silc_client_connect_to_server
+      (_client, &params, _pubkey, _privkey, (char *)host.latin1(), port, 
+       (SilcTK::SilcClientConnectCallback) silc_connection_cb, NULL);
+    if(!asop) {
+      setOnlineStatus(SilcProtocol::protocol()->statusOffline);
+      return;
+    }
+
+    SilcTK::silc_client_run_one(_client);
+
+    libsilcTimerId = startTimer(250); 
+  }
+
+  else {
+    // we're connected already
+    if(myself()->onlineStatus() != status) {
+      setOnlineStatus(status);
+    }
+  }
+
+  // if the user presses connect-all, status is set to unknown, 
+  // use Online as a sane default ...
+  if(status.status() == Kopete::OnlineStatus::Unknown)
+    _wantedOnlineStatus = SilcProtocol::protocol()->statusOnline;
+  else
+    _wantedOnlineStatus = status;
+}
+
+void 
+SilcAccount::disconnect(void)
+{
+  // kopete directly calls disconnect() when it shut's down. 
+  // however we'd like to have setOnlineStatus called first, so ...
+
+  if(! _client) 
+    return;
+	
+  if(_conn) 
+    sendSilcCommand(QString("QUIT %1").arg(quitMessage()));
+}
+void 
+SilcAccount::slotStopTimer(void)
+{
+  killTimer(libsilcTimerId);
+  libsilcTimerId = 0;
+}
+
+bool
+SilcAccount::isBehindNat(void) const
+{
+  char *ip = localIp();
+
+  if (_conn) {
+
+    SilcTK::SilcUInt32 bin;
+    if (SilcTK::silc_net_addr2bin(ip, &bin, 4)) {
+      /* Now let's test for the private ip ranges */
+      /* 192.168.255.255 */
+      if((bin & 0xffff) == 0xa8c0) 
+        return TRUE;
+      /* 10.255.255.255 */
+      else if ((bin & 0xff) == 0x0a)
+        return TRUE;
+      /* 172.16.0.0 - 172.31.255.255 */ 
+      else if (((bin & 0xff) == 0xac) && (((bin >> 8) & 0xff) >= 16) 
+               && (((bin >> 8 )  & 0xff) <= 31))
+        return TRUE;
+      /* 169.254.255.255 */
+      else if ((bin & 0xffff) == 0xfea9)
+        return TRUE;
+    }
+  }
+  return FALSE;
+}
+char *
+SilcAccount::localIp(void) const 
+{
+ if (_conn) {
+   SilcTK::SilcSocket socket;
+   SilcTK::SilcStream stream;
+   char *ip;
+   /* Yes SilcToolkit 1.1 is much easier than 1.0 */
+   stream = SilcTK::silc_packet_stream_get_stream(_conn->stream);
+   SilcTK::silc_socket_stream_get_info(stream, &socket, NULL, NULL, NULL);
+   SilcTK::silc_net_check_local_by_sock(socket, NULL, &ip);
+   return ip;
+ } else return NULL;
+};
+
+void 
+SilcAccount::setOnlineStatus(const Kopete::OnlineStatus& status,
+			     const QString &)
+{
+  assert(myself()->account() == this);
+
+  // set new status
+  //myself()->setOnlineStatus(status);
+
+  if(status == SilcProtocol::protocol()->statusOffline) {
+    myself()->setOnlineStatus(status);
+    disconnect();
+    return;
+  }
+
+  if(status == SilcProtocol::protocol()->statusConnecting) {
+     if(myself()->onlineStatus() == SilcProtocol::protocol()->statusOffline) {
+      //it we are not online yet
+      myself()->setOnlineStatus(status);
+    }
+    return;
+  }
+
+  if(! _conn) {
+    connect(status);
+    return;
+  }
+
+  // the connectionstatus plugin may kick-off an unknown status
+  // which, when accepted, crashes Kopete. As this status
+  // has no description assigned we'll just ignore it for now
+  if(QString::null.compare(status.description())!=0)
+    myself()->setOnlineStatus(status);
+
+  // send the correct user mode ...
+  if(status == SilcProtocol::protocol()->statusGone)
+    sendUmode(_client, _conn, SILC_UMODE_GONE);
+
+  else if(status == SilcProtocol::protocol()->statusIndisposed)
+    sendUmode(_client, _conn, SILC_UMODE_INDISPOSED);
+
+  else if(status == SilcProtocol::protocol()->statusBusy)
+    sendUmode(_client, _conn, SILC_UMODE_BUSY);
+
+  else if(status == SilcProtocol::protocol()->statusHyper)
+    sendUmode(_client, _conn, SILC_UMODE_HYPER);
+
+  else
+    sendUmode(_client, _conn, 0);
+}
+
+void
+SilcAccount::slotShowServer(void)
+{
+  myServer()->view();
+}
+
+/**
+ * Shows the fingerprint of the current user to this user
+ * Code taken from silcapputil.c:silc_show_public_key()
+ */
+void SilcAccount::slotShowFingerprint(QString nickName)
+{ 
+  SilcTK::SilcUInt32 pk_len;
+  unsigned char *pk = SilcTK::silc_pkcs_public_key_encode(_pubkey,
+							  &pk_len);
+  char *fingerprint = SilcTK::silc_hash_fingerprint(0, pk, pk_len);
+
+  if(nickName==QString::null) 
+    nickName=this->nickName();   
+
+  KMessageBox::information(Kopete::UI::Global::mainWidget(),
+			   QString(fingerprint).replace(" ",":"),
+			   i18n("Fingerprint of ").append(nickName),
+                           QString::null, 0);  
+
+  
+  free(fingerprint); 
+  free(pk); 
+} 
+
+/** 
+ * create a new SilcContact (type depending on the first char of the
+ * contactId). This function is used by SilcProtocol::deserializeContact
+ * to create the contacts on the contactlist.
+ */
+bool
+SilcAccount::createContact(const QString &contactId,
+			   Kopete::MetaContact *meta)
+{
+  if(contactId[0] == '@')
+    _contactManager.createBuddy(meta, contactId.mid(1));
+
+  else if(contactId[0] == '#')
+    _contactManager.createChannel(contactId.mid(1), meta);
+
+  else {
+    std::cerr << "invalid contactId, refusing to create new contact: "
+	      << contactId.latin1() << std::endl;
+    return false;
+  }
+
+  return true;
+}
+
+void
+SilcAccount::connectWithPassword(const QString & /* password */)
+{
+  std::cout << "connectWithPassword called" << std::endl;
+}
+
+SilcChatSession *
+SilcAccount::chatSession(Kopete::ContactPtrList others)
+{
+  Kopete::ChatSessionManager *csm = Kopete::ChatSessionManager::self();
+
+  // check whether Kopete's ChatSessionManager knows about an existing 
+  // instance for the group `others' we need ...
+  SilcChatSession *chatSession = dynamic_cast<SilcChatSession *>
+    (csm->findChatSession(myself(), others, protocol()));
+  if(chatSession) return chatSession;
+
+  chatSession = new SilcChatSession(myself(), others, protocol());
+  return chatSession;							       
+}
+
+void
+SilcAccount::setNickName(const QString &nickname)
+{
+  configGroup()->writeEntry(CONFIG_NICKNAME, nickname);
+
+  if(myself())
+    myself()->setNickName(nickname);
+
+  QString host = hostName();
+  if(host.isEmpty()) host = QString(i18n("<invalid-configuration>"));
+  setAccountLabel(QString("%1@%2").arg(nickname).arg(host));
+}
+
+const QString
+SilcAccount::nickName(void) const 
+{
+  return myself()->nickName();
+}
+
+void
+SilcAccount::setUserName(const QString &name)
+{
+  configGroup()->writeEntry(CONFIG_USERNAME, name);
+}
+
+const QString
+SilcAccount::userName(void) const 
+{
+  const QString &username = configGroup()->readEntry(CONFIG_USERNAME);
+  
+  if(username.isEmpty()) {
+    // if there is no username set, use the user's login name.
+    // In case this is not available as well, default to something sane,
+    // since the SILC network requires us to specify such a name.
+    //
+    const char *userenv = getenv("USER");
+    if(! userenv) userenv = "SilcUser";
+    return QString(userenv);
+  }
+
+  return username;
+}
+
+void
+SilcAccount::setRealName(const QString &name)
+{
+  configGroup()->writeEntry(CONFIG_REALNAME, name);
+}
+
+const QString
+SilcAccount::realName(void) const 
+{
+  const QString &realname = configGroup()->readEntry(CONFIG_REALNAME);
+
+  if(realname.isEmpty()) {
+    // use some default value, since we're expected to have one ...
+    return QString("I'm a lucky kopete_silc user.");
+  }
+
+  return realname;
+}
+
+void
+SilcAccount::setHostName(const QString &name)
+{
+  configGroup()->writeEntry(CONFIG_HOSTNAME, name);
+  setAccountLabel(QString("%1@%2").arg(nickName()).arg(name));
+}
+
+const QString
+SilcAccount::hostName(void) const 
+{
+  return configGroup()->readEntry(CONFIG_HOSTNAME);
+}
+
+void
+SilcAccount::setDisplayImagesInline(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_DISPLAY_IMAGES_INLINE, flagStatus);
+}
+
+void
+SilcAccount::setUseSilcMime(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_FT_USE_SILC_MIME, flagStatus);
+}
+
+void
+SilcAccount::setFtAutoAccept(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_FT_AUTO_ACCEPT, flagStatus);
+}
+
+void
+SilcAccount::setFtBind(const int flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_FT_BIND_SELECTION, flagStatus);
+}
+
+int
+SilcAccount::getFtBind(void) const 
+{
+  return configGroup()->readNumEntry(CONFIG_FT_BIND_SELECTION);
+}
+
+bool
+SilcAccount::displayImagesInline(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_DISPLAY_IMAGES_INLINE);
+}
+
+bool
+SilcAccount::useSilcMime(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_FT_USE_SILC_MIME);
+}
+
+bool
+SilcAccount::ftAutoAccept(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_FT_AUTO_ACCEPT);
+}
+
+bool
+SilcAccount::ftNoBind(void) const
+{
+  switch(configGroup()->readNumEntry(CONFIG_FT_BIND_SELECTION)) {
+  case FT_BIND_ALWAYS:
+    return FALSE;
+
+  case FT_BIND_NEVER:
+    return TRUE;
+
+  default:
+  case FT_BIND_NAT_TEST:
+    return isBehindNat();
+  }
+}
+
+void
+SilcAccount::setQuitMessage(const QString &msg)
+{
+  configGroup()->writeEntry(CONFIG_QUIT_MESSAGE, msg);
+}
+
+const QString
+SilcAccount::quitMessage(void) const 
+{
+  const QString &msg = configGroup()->readEntry(CONFIG_QUIT_MESSAGE);
+
+  if(msg.isEmpty())
+    return QString("");
+
+  return msg;
+}
+
+void
+SilcAccount::setSignChannelMessages(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_SIGN_CHAT_MESSAGE, flagStatus);
+}
+
+bool
+SilcAccount::signChannelMessages(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_SIGN_CHAT_MESSAGE);
+}
+
+void
+SilcAccount::setSignChannelActions(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_SIGN_CHAT_ACTION, flagStatus);
+}
+
+bool
+SilcAccount::signChannelActions(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_SIGN_CHAT_ACTION);
+}
+
+void
+SilcAccount::setSignPrivateMessages(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_SIGN_PRIV_MESSAGE, flagStatus);
+}
+
+bool
+SilcAccount::signPrivateMessages(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_SIGN_PRIV_MESSAGE);
+}
+
+void
+SilcAccount::setSignPrivateActions(const bool flagStatus)
+{
+  configGroup()->writeEntry(CONFIG_SIGN_PRIV_ACTION, flagStatus);
+}
+
+bool
+SilcAccount::signPrivateActions(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_SIGN_PRIV_ACTION);
+}
+
+void 
+SilcAccount::setAttributeMood(SilcTK::SilcAttributeMood mood)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_MOOD, mood);
+}
+
+SilcTK::SilcAttributeMood 
+SilcAccount::getAttributeMood(void) const
+{
+  return (SilcTK::SilcAttributeMood) 
+    configGroup()->readUnsignedNumEntry(CONFIG_ATTR_MOOD);
+}
+
+void 
+SilcAccount::setAttributeContact(SilcTK::SilcAttributeContact contact)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_CONTACT, contact);
+}
+
+SilcTK::SilcAttributeContact 
+SilcAccount::getAttributeContact(void) const
+{
+  return (SilcTK::SilcAttributeContact) 
+    configGroup()->readUnsignedNumEntry(CONFIG_ATTR_CONTACT);
+}
+void 
+SilcAccount::setGeoInformations(bool allowed, double longitude, 
+                                double latitude, int altitude)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_GEO_ALLOWED, allowed);
+  configGroup()->writeEntry(CONFIG_ATTR_GEO_LONG, longitude);
+  configGroup()->writeEntry(CONFIG_ATTR_GEO_LAT, latitude);
+  configGroup()->writeEntry(CONFIG_ATTR_GEO_ALT, altitude);
+}
+
+bool 
+SilcAccount::getGeoAllowed(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_ATTR_GEO_ALLOWED);
+}
+
+double 
+SilcAccount::getGeoLongitude(void) const
+{
+  return configGroup()->readDoubleNumEntry(CONFIG_ATTR_GEO_LONG);
+}
+
+double 
+SilcAccount::getGeoLatitude(void) const
+{
+  return configGroup()->readDoubleNumEntry(CONFIG_ATTR_GEO_LAT);
+}
+
+int
+SilcAccount::getGeoAltitude(void) const
+{
+  return configGroup()->readNumEntry(CONFIG_ATTR_GEO_ALT);
+}
+
+bool 
+SilcAccount::getAttributesAllowed(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_ATTR_ALLOWED);
+}
+void 
+SilcAccount::setAttributesAllowed(bool allowed)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_ALLOWED, allowed);
+}
+
+bool 
+SilcAccount::getAttributeTimezone(void) const
+{
+  return configGroup()->readBoolEntry(CONFIG_ATTR_TIMEZONE);
+}
+void 
+SilcAccount::setAttributeTimezone(bool allowed)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_TIMEZONE, allowed);
+}
+
+void 
+SilcAccount::setAttributeMessage(const QString &message)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_MESSAGE, message);
+}
+
+const QString 
+SilcAccount::getAttributeMessage(void) const
+{
+  return configGroup()->readEntry(CONFIG_ATTR_MESSAGE);
+}
+
+void 
+SilcAccount::setAttributeLanguage(const QString &language)
+{
+  configGroup()->writeEntry(CONFIG_ATTR_LANGUAGE, language);
+}
+
+const QString 
+SilcAccount::getAttributeLanguage(void) const
+{
+  return configGroup()->readEntry(CONFIG_ATTR_LANGUAGE);
+}
+
+KActionMenu *
+SilcAccount::actionMenu(void)
+{
+  const QString &status = myself()->onlineStatus().description();
+  QString menuTitle = QString("%1 <%2>").arg(accountId()).arg(status);
+  KActionMenu *menu = Kopete::Account::actionMenu(); 
+
+  menu->popupMenu()->insertSeparator();
+
+  menuJoinChannel->setEnabled(isConnected());
+  menu->insert(menuJoinChannel);
+  menu->insert(menuShowServer);
+  menuShowFingerprint->setEnabled(isConnected()); 
+  menu->insert(menuShowFingerprint); 
+
+  return menu;
+}
+
+void 
+SilcAccount::slotJoinChannel(void)
+{
+  assert(isConnected());
+
+  QStringList chans = configGroup()->readListEntry("Recent Channel list");
+  KCompletion comp;
+  comp.insertItems(chans);
+
+  SilcJoinDlgWidget dlg(Kopete::UI::Global::mainWidget(), 0);
+  dlg.setCompletionList(comp);
+
+  while(true) {
+    if(dlg.exec() != QDialog::Accepted)
+      break;
+
+    QString chan = dlg.channel();
+    if(chan.isNull())
+      break;
+
+    // FIXME make sure channel-name is valid, i.e. compare against
+    // regexp, maximum length, etc.  There is no rule that the channel
+    // must begin with a '#' !!
+    {
+      slotJoinChannel(chan, dlg.founder(), dlg.auth(), dlg.password());
+
+      // push the joined channel to first in list
+      chans.remove(chan);
+      chans.prepend(chan);
+
+      configGroup()->writeEntry( "Recent Channel list", chans );
+      break;
+    }
+
+    KMessageBox::error(Kopete::UI::Global::mainWidget(),
+		       i18n("\"%1\" is an invalid channel name.").arg(chan),
+		       i18n("SILC Plugin"));
+  }
+}
+
+void 
+SilcAccount::slotJoinChannel(const QString &channel, bool founder, bool auth,
+			     const QString &password)
+{
+  SilcChannelContact *contact = contactManager()->createChannel(channel);
+  assert(contact);
+
+  contact->join(founder, auth, password);
+}
+
+void 
+SilcAccount::sendSilcCommand(const QString &command, 
+                             SilcTK::SilcClientCommandReply reply, 
+                             void *context)
+{
+  if(! _conn) return;
+  kdDebug() << "SILCCommand: " << command.latin1() << endl;
+  assert(_client);
+  SilcTK::SilcUInt16 cmd_ident = 
+    SilcTK::silc_client_command_call(_client, _conn, command.latin1());
+  if (reply)
+    /* I don't know why there is the SilcCommand argument here. it only change
+     * the value of the SilcClientCommandReply SilcCommand argument. We know
+     * what we send, so we ignore it.
+     */
+    SilcTK::silc_client_command_pending(_conn, 0, cmd_ident, reply, context);
+}
+
+
+void 
+SilcAccount::slotJoinedChannel(const QString &channel)
+{
+  SilcChannelContact *contact = contactManager()->lookupChannel(channel);
+  assert(contact);
+
+  contact->view();
+}
+
+void 
+SilcAccount::setAway(bool away, const QString &reason)
+{
+  if(away)
+    setOnlineStatus(SilcProtocol::protocol()->statusGone, reason);
+  
+  else
+    setOnlineStatus(SilcProtocol::protocol()->statusOnline, QString::null);
+}
+
+
+
+
+void 
+SilcAccount::silc_connection_cb(SilcTK::SilcClient client,
+                                SilcTK::SilcClientConnection conn,
+                                SilcTK::SilcClientConnectionStatus status,
+                                SilcTK::SilcStatus error,
+                                const char *message,
+                                void *context) 
+{
+  QString error_msg;
+  SilcAccount *account = static_cast<SilcAccount *>(client->application);
+  SilcBuddyContact *me = static_cast<SilcBuddyContact *>(account->myself());
+
+  switch(status) {
+  case SilcTK::SILC_CLIENT_CONN_SUCCESS:
+  case SilcTK::SILC_CLIENT_CONN_SUCCESS_RESUME:
+    kdDebug() << "client: connected" << endl;
+    if(! conn->local_entry)
+      return; // obviously failed to connect (key exchange failure)
+    // save connection context
+    account->_conn = conn;
+    me->setClientEntry(conn->local_entry);
+
+    account->setOnlineStatus(account->_wantedOnlineStatus);
+    // Set UserPhoto if set
+    if(! account->_globalIdentityPicture.isEmpty()) { 
+      account->setAttributePicture();
+      me->setProperty(Kopete::Global::Properties::self()->photo(), 
+                      account->_globalIdentityPicture);
+    }
+    account->updateAttributes();
+
+    // emit connected signal ...
+    emit account->connected();
+    break;
+  case SilcTK::SILC_CLIENT_CONN_DISCONNECTED:
+    kdDebug() << "client: disconnected" << endl;
+    account->_conn = 0;
+    account->setOnlineStatus(SilcProtocol::protocol()->statusOffline);
+
+    emit account->disconnected();
+
+    if(error)
+      KMessageBox::queuedMessageBox
+        (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, 
+         SilcTK::silc_get_status_message(error),
+         i18n("Kopete SilcTK::SILC Plugin"));
+    break;
+  case SilcTK::SILC_CLIENT_CONN_ERROR:
+    error_msg = i18n("unknown error");
+    goto display_error;
+  case SilcTK::SILC_CLIENT_CONN_ERROR_KE:
+    error_msg = i18n("key exchange failed");
+    goto display_error;
+  case SilcTK::SILC_CLIENT_CONN_ERROR_AUTH:
+    error_msg = i18n("authenitication failed");
+    goto display_error;
+  case SilcTK::SILC_CLIENT_CONN_ERROR_RESUME:
+    error_msg = i18n("resume error");
+    goto display_error;
+  case SilcTK::SILC_CLIENT_CONN_ERROR_TIMEOUT:
+    error_msg = i18n("timeout error");
+display_error:
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, 
+       i18n("Unable to establish connection to the remote host: %1")
+       .arg(error_msg), i18n("Kopete SilcTK::SILC Plugin"));
+    account->_conn = 0;
+    break;
+  }
+}
+
+///
+/// callback, telling that libsilc received the command and is now
+/// going to try and execute it ...
+///
+///////////////////////////////////////////////////////////////////////////////
+void
+SilcAccount::silc_command(SilcTK::SilcClient client, 
+			  SilcTK::SilcClientConnection,
+			  SilcTK::SilcBool /* success */,
+			  SilcTK::SilcCommand command, 
+			  SilcTK::SilcStatus status,
+                          SilcTK::SilcUInt32 /* argc */,
+                          unsigned char ** /* argv */)
+{
+  if (status != SILC_STATUS_OK) {
+    std::cerr << "MyBot: COMMAND " 
+	      << SilcTK::silc_get_command_name(command) << ": "
+	      << SilcTK::silc_get_status_message(status) << std::endl;
+    return;
+  }
+}
+
+
+///
+/// callback function, telling that a command was executed
+///
+///////////////////////////////////////////////////////////////////////////////
+void 
+SilcAccount::silc_command_reply(SilcTK::SilcClient client, 
+				SilcTK::SilcClientConnection,
+				SilcTK::SilcCommand command, 
+                                SilcTK::SilcStatus status,
+				SilcTK::SilcStatus error, 
+                                va_list va)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(client->application);
+
+  if(command == SILC_COMMAND_WATCH && status != SILC_STATUS_OK) 
+    return;
+
+  kdDebug() << SilcTK::silc_get_command_name(command) << status << " " << error << endl;
+  if(status >=  SILC_STATUS_ERR_NO_SUCH_NICK) {
+    // warn, that a command has failed, but don't do so for 
+    // no-such-nick errors 'caused by /whois requests, since these
+    // are usually initiated by ourselves (when logging on)
+    account->myServer()->appendMessage
+      (QString("SILC Command %1 failed: %2")
+       .arg(SilcTK::silc_get_command_name(command))
+       .arg(SilcTK::silc_get_status_message(error)));
+
+    // simply ignore some error messages ...
+    if(command == SILC_COMMAND_WHOIS
+       && error == SILC_STATUS_ERR_NO_SUCH_NICK)
+      return;
+
+    if(command == SILC_COMMAND_WATCH
+       && error == SILC_STATUS_ERR_NICKNAME_IN_USE)
+      return;
+
+    // warn finally ....
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+       i18n(SilcTK::silc_get_status_message(error)),
+       QString(i18n("SILC Command %1 failed"))
+       .arg(SilcTK::silc_get_command_name(command)));
+    return;
+  }
+
+  if(command == SILC_COMMAND_JOIN) {
+    (void) va_arg(va, char *); /* channelname */
+    SilcTK::SilcChannelEntry ce = va_arg(va, SilcTK::SilcChannelEntry);
+    /* SilcUInt32 channel_mode */ (void) va_arg(va, SilcTK::SilcUInt32); 
+    SilcTK::SilcHashTableList *user_list = 
+      va_arg(va, SilcTK::SilcHashTableList *);
+    
+    // we successfully have joined the channel, open a chat window ...
+    SilcContactManager *cm = account->contactManager();
+    SilcChannelContact *ch = cm->lookupChannel(QString(ce->channel_name));
+    assert(ch);
+
+    ch->setChannelEntry(ce);
+    ch->view();
+
+
+    // now insert the list of joined buddies ...
+    SilcTK::SilcChannelUser chu;
+    while (SilcTK::silc_hash_table_get(user_list, NULL, (void **)&chu)) {
+      if(!chu->client->nickname[0]) continue;
+
+      SilcTK::SilcClientEntry e = (SilcTK::SilcClientEntry) chu->client;
+
+      // either lookup buddy or create a new one ....
+      SilcBuddyContact *buddy = e->context 
+        ? (SilcBuddyContact *) e->context 
+        : account->contactManager()->createBuddy(e->nickname, NULL, e);
+
+      // this is to suppress useless `user is now online' messages ...
+      if(buddy->onlineStatus() == SilcProtocol::protocol()->statusOffline)
+        buddy->setOnlineStatus(SilcProtocol::protocol()->statusOnline);
+
+      // add buddy to list of chat members ...
+      ch->updateBuddyOnlineStatus(buddy);
+
+      // send a whois request ...
+      buddy->whoami();
+    }
+  }
+
+  if(command == SILC_COMMAND_WHOIS) {
+    SilcTK::SilcClientEntry client_entry = va_arg(va, SilcTK::SilcClientEntry);
+    QString nick = QString::fromUtf8(va_arg(va, char*));
+    QString username = QString::fromUtf8(va_arg(va, char*));
+    QString realname = QString::fromUtf8(va_arg(va, char*));
+    SilcTK::SilcDList channels = va_arg(va, SilcTK::SilcDList);
+    /* SilcTK::SilcUInt32 usermode */ (void) va_arg(va, SilcTK::SilcUInt32);
+    /* SilcTK::SilcUInt32 idletime */ (void) va_arg(va, SilcTK::SilcUInt32);
+    unsigned char *fingerprint = va_arg(va, unsigned char*);
+    /* SilcTK::SilcUInt32 *ch_umodes */ (void) va_arg(va, SilcTK::SilcUInt32);
+    SilcTK::SilcDList attrs = va_arg(va, SilcTK::SilcDList);
+    SilcBuddyContact *buddy = (SilcBuddyContact *) client_entry->context;
+    SilcContactManager *cm = account->contactManager();
+
+
+    if(! buddy)
+      buddy = cm->createBuddy(QString::fromUtf8(client_entry->nickname),
+			      NULL, client_entry);
+    
+    // Update Attributes, if some arrived
+    if(attrs) 
+      buddy->attributes->updateAttributes(attrs);
+    
+
+   //handle added buddies which do not have a valid fingerprint yet
+    SilcBuddyContactData *old_buddy =
+      cm->popPendingBuddy(QString::fromUtf8(client_entry->nickname));
+
+    if(old_buddy) {
+      buddy = new SilcBuddyContact(old_buddy->account,
+				   old_buddy->nickName(),
+				   buddy->convFingerprint((const char*)
+							  fingerprint),
+				   old_buddy->meta);
+
+      buddy->setClientEntry(client_entry);
+      cm->addBuddy(buddy);
+      delete old_buddy;
+
+      //online status
+      buddy->watchme(true);
+    }
+    
+    // store channel list for later use (i.e. display in userinfo widget)
+    if(channels) {
+      QStringList chlist;
+      SilcTK::SilcChannelPayload e;
+      SilcTK::silc_dlist_start(channels);
+	
+	while ((e = (SilcTK::SilcChannelPayload) SilcTK::silc_dlist_get(channels))
+	       != SILC_LIST_END) {
+	  SilcTK::SilcUInt32 len;
+	  const char *name = (char *) SilcTK::silc_channel_get_name(e, &len);
+	  chlist.append(QString::fromUtf8(name));
+	}
+      buddy->setChannelList(chlist);
+    }
+
+    // updateWhois should be one of the latest (since the info-widgets
+    // updates channellist etc. upon updateWhois signal ...)
+    buddy->updateWhois(username,realname);
+    setBuddyOnlineStatus(cm,buddy,client_entry->mode);
+  }
+
+  if(command == SILC_COMMAND_GETKEY) {
+    SilcTK::SilcUInt32 id_type = va_arg(va, SilcTK::SilcUInt32);
+    void *entry = va_arg(va, void *);
+    SilcTK::SilcPublicKey pubkey = va_arg(va, SilcTK::SilcPublicKey);
+
+    // we store client key's only, server and router keys are not of any
+    // interest for us at the moment ...
+    if(id_type == SILC_ID_CLIENT) {
+      SilcTK::SilcUInt32 pk_len;
+      unsigned char *pk = SilcTK::silc_pkcs_public_key_encode(pubkey, &pk_len);
+      char *fpKey = SilcTK::silc_hash_fingerprint(0, pk, pk_len);
+      QString fp = QString(fpKey).replace(QChar(' '), QChar(':'));
+      SilcTK::silc_free(fpKey);
+
+      SilcBuddyContact *buddy = (SilcBuddyContact *)
+	((SilcTK::SilcClientEntry) entry)->context;
+
+      if(buddy->fingerprint().compare(fp))
+	KMessageBox::queuedMessageBox
+	  (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+	   QString(i18n("Received client public key of %1. \n"
+			"Fingerprint: %2\n\n"
+			"However this does not match the cached client's "
+			"fingerprint which appears to be `%3'. "
+			"This probably should not happen"))
+	   .arg(buddy->nickName()).arg(fp).arg(buddy->fingerprint()),
+	   QString(i18n("Incoming Public Key")));
+
+      else {
+	// fingerprint of public key does match ...
+        if(!buddy->fpTrusted()) { //if not trusting already
+	  int answer = KMessageBox::questionYesNo
+	    (Kopete::UI::Global::mainWidget(),
+	     QString(i18n("Received client public key of %1. \n"
+		  	  "Fingerprint: %2\n"
+			  "Would you like to accept the key?"))
+	     .arg(buddy->nickName()).arg(fp),
+	     i18n("Incoming Public Key"));
+	  if(answer == KMessageBox::Yes) {
+            buddy->setFpTrusted(true);
+          } else {
+            SilcTK::silc_free(pk);
+            return;
+          }
+         }
+         QString fn = buddy->publicKeyPath(fp);
+         if(! SilcTK::silc_pkcs_save_public_key(fn.latin1(), pubkey, 
+                                                SilcTK::SILC_PKCS_FILE_BASE64))
+           KMessageBox::queuedMessageBox
+             (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+              QString(i18n("Unable to save received client public key of %1."))
+              .arg(buddy->nickName()),
+              QString(i18n("Incoming Public Key")));
+       }
+      SilcTK::silc_free(pk);
+    }
+  }
+
+  va_end(va);
+}
+
+
+QString
+SilcAccount::pubKeyPath(void)
+{
+  return locateLocal("appdata", pubKeyName);
+}
+
+QString
+SilcAccount::privKeyPath(void)
+{
+  return locateLocal("appdata", prvKeyName);
+}
+
+void
+SilcAccount::copyKey(QString keyPath, bool prvKey)
+{
+  QFile input(keyPath);
+  QFile output; 
+  char tmpByte;
+
+  if(!input.open(IO_ReadOnly)) {
+    KMessageBox::error(Kopete::UI::Global::mainWidget(),
+                       QString(i18n("Cannot open %1 for reading").arg(input.name())),
+                       i18n("Opening Key File"));
+    return;
+  }
+  if(prvKey) { 
+    output.setName(locateLocal("appdata",prvKeyName));
+  } else {  
+    output.setName(locateLocal("appdata",pubKeyName));
+  }  
+  if(!output.open(IO_WriteOnly)){
+     input.close();  
+     KMessageBox::error(Kopete::UI::Global::mainWidget(),
+                       QString(i18n("Cannot open %1 for writing").arg(output.name())),
+                       i18n("Opening Key File"));
+
+     return;
+  }
+
+  QDataStream inputstream(&input);
+  QDataStream outputstream(&output);
+  while(!inputstream.atEnd()) {
+    inputstream.readRawBytes(&tmpByte,1);
+    outputstream.writeRawBytes(&tmpByte,1) ;
+  }
+  output.close();
+  input.close();
+}
+
+
+static QString
+id_with_type_to_name(SilcTK::SilcIdType id_type, void *entry)
+{
+  if(! entry)
+    return QString::null;
+
+  switch(id_type) {
+  case SILC_ID_CLIENT:
+    return QString::fromUtf8(((SilcTK::SilcClientEntry) entry)->nickname);
+
+  case SILC_ID_SERVER:
+    return QString::fromUtf8(((SilcTK::SilcServerEntry) entry)->server_name);
+
+  case SILC_ID_CHANNEL:
+    return QString::fromUtf8(((SilcTK::SilcChannelEntry) entry)->channel_name);
+
+  default:
+    return QString::null;
+  }
+}
+
+void 
+SilcAccount::silc_notify(SilcTK::SilcClient client, 
+			 SilcTK::SilcClientConnection,
+			 SilcTK::SilcNotifyType type, ...)
+{
+  SilcAccount *account = (SilcAccount *) client->application;
+  va_list va;
+  va_start(va, type);
+
+  switch(type) {
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_NONE:
+    // received some generic text, usually not too important ...
+
+  case SILC_NOTIFY_TYPE_MOTD: {
+    // Recieved motion of the day ...
+    // ... simply dump these to the server window
+    const char *str = va_arg(va, char *);
+    account->myServer()->appendMessage(QString(str));
+    break;
+  }
+
+
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_JOIN: {
+    // Received 'user has joined' notification
+    SilcTK::SilcClientEntry ce = va_arg(va, SilcTK::SilcClientEntry);
+
+    SilcBuddyContact *buddy = ce->context
+      ? (SilcBuddyContact *) ce->context
+      : account->contactManager()->createBuddy(ce->nickname, NULL, ce);
+
+    SilcChannelContact *channel = 
+      (SilcChannelContact *) va_arg(va, SilcTK::SilcChannelEntry)->context;
+    if(!channel) break; /* channel is nil, when we are the joined client */ 
+
+    // this is to suppress useless `user is now online' messages ...
+    if(buddy->onlineStatus() == SilcProtocol::protocol()->statusOffline)
+      buddy->setOnlineStatus(SilcProtocol::protocol()->statusOnline);
+
+    // let updateBuddyOnlineStatus happily add the buddy to the channel list
+    channel->updateBuddyOnlineStatus(buddy);
+
+    // send a whois request ...
+    buddy->whoami();
+    break;
+  }
+
+
+
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_LEAVE: {
+    // received `user has left' notification 
+    SilcBuddyContact *buddy = 
+      (SilcBuddyContact *) va_arg(va, SilcTK::SilcClientEntry)->context;
+    assert(buddy);
+
+    SilcChannelContact *channel = 
+      (SilcChannelContact *) va_arg(va, SilcTK::SilcChannelEntry)->context;
+    assert(channel);
+
+    // FIXME, is there really no leave message available ??
+
+    if(! channel->isJoined(buddy))
+      channel->manager()->removeContact(buddy);
+    break;
+  }
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_KICKED: {
+    SilcBuddyContact *buddy =
+        (SilcBuddyContact *) va_arg(va, SilcTK::SilcClientEntry)->context;
+    assert(buddy);
+    
+    /* Kick Message, maybe NULL */
+    const char *str = va_arg(va, char *);
+
+    /* Kicker Maybe NULL, maybe somebody we don't have on our buddylist */
+    SilcTK::SilcClientEntry kicker =
+        va_arg(va, SilcTK::SilcClientEntry );
+
+    SilcChannelContact *channel = 
+      (SilcChannelContact *) va_arg(va, SilcTK::SilcChannelEntry)->context;
+    assert(channel);
+
+    QString r = i18n("Kicked by %1.").arg(kicker ? QString(kicker->nickname) 
+                                          : QString("annonymous"));
+    if(str)
+      r.append(i18n(" Reason: %2").arg(QString(str)));
+    
+    if(account->myself() != buddy) {
+      // don't remove the SilcBuddyContact from the chat members list,
+      // if another ClientEntry is joined to this channel
+      // (unfortunately we cannot tell about the kick in this case)
+      if(! channel->isJoined(buddy))
+	channel->manager()->removeContact(buddy, r);
+    }
+    else {
+        // FIXME: This is not the fine british way ( a /leave will be sent )
+        KMessageBox::queuedMessageBox
+	  (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, r,
+	   i18n("You were kicked"));
+        channel->manager()->view()->closeView();
+    }
+    break;
+  }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_KILLED: {
+    // received `user has been killed from network' notification
+    SilcTK::SilcClientEntry ce = va_arg(va, SilcTK::SilcClientEntry);
+    SilcBuddyContact *buddy = (SilcBuddyContact *) ce->context;
+    assert(buddy);
+
+    kdDebug() << "received kill notification for "
+	      << buddy->nickName() << endl;
+    
+    // kill message, might be NULL
+    const char *kill_message = va_arg(va, char *);
+
+    SilcTK::SilcIdType killer_type = (SilcTK::SilcIdType) va_arg(va, int);
+    void *killer_id = (void *) va_arg(va, void *);
+    QString killer = id_with_type_to_name(killer_type, killer_id);
+
+    // what for?  the buddy is killed from the network, not a channel !?
+    (void) va_arg(va, SilcTK::SilcChannelEntry);
+
+    QString reason = kill_message
+      ? i18n("Given reason: %1").arg(QString::fromUtf8(kill_message))
+      : i18n("No reason given.");
+
+    if(account->myself() == buddy) {
+      // we have been killed ...
+      KMessageBox::queuedMessageBox
+	(Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+	 i18n("You have been killed from the SILC network by %1. ")
+	 .arg(killer).append(reason), i18n("You have been killed"));
+      //account->setOnlineStatus(SilcProtocol::protocol()->statusOffline);
+    }
+    else {
+      // someone else has been killed ...
+      buddy->removeClientEntry(ce);
+      account->contactManager()->buddySignedOff(buddy, i18n("Killed by %1. ")
+						.arg(killer).append(reason));
+    }
+
+    break;
+  }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_SIGNOFF: {
+    // received `user has quit' notification 
+    SilcTK::SilcClientEntry ce = va_arg(va, SilcTK::SilcClientEntry);
+    const char *msg = va_arg(va, char *);
+
+    SilcBuddyContact *buddy = (SilcBuddyContact *) ce->context;
+    
+    // if we've received a watch-notification for this quit, the
+    // SilcBuddyContact is already marked offline, therefore do nothing.
+    if (!buddy)
+      break;
+
+    QString quitMsg = msg ? QString::fromUtf8(msg) : QString::null;
+
+    buddy->removeClientEntry(ce);
+    account->contactManager()->buddySignedOff(buddy, quitMsg);
+    break;
+  }
+
+    
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_NICK_CHANGE: {
+    SilcTK::SilcClientEntry ce = va_arg(va, SilcTK::SilcClientEntry);
+
+    assert(ce->context);
+
+    SilcBuddyContact *buddy = (SilcBuddyContact *) ce->context;
+    buddy->setNickName(QString::fromUtf8(ce->nickname));
+    break;
+  }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_CUMODE_CHANGE: {
+    int idtype = va_arg(va, int);
+    (void) va_arg(va, void *);
+    (void) va_arg(va, SilcTK::SilcUInt32);
+    SilcBuddyContact *buddy = 
+      (SilcBuddyContact *) va_arg(va, SilcTK::SilcClientEntry)->context;
+    SilcChannelContact *channel = 
+      (SilcChannelContact *) va_arg(va, SilcTK::SilcChannelEntry)->context;
+
+    if (idtype == SILC_ID_CLIENT)
+      channel->updateBuddyOnlineStatus(buddy);
+    break;
+  }
+
+	
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_CMODE_CHANGE: {
+    (void) va_arg(va,int); //changer_id_type ignored
+    (void) va_arg(va,void *); //changer_entry ignored
+    int mode = va_arg(va,SilcTK::SilcUInt32);
+    (void) va_arg(va,char *); //cipher_name ignored
+    (void) va_arg(va,char *); //hmac_name ignored
+    (void) va_arg(va,char *); //passphrase ignored
+    (void) va_arg(va,SilcTK::SilcPublicKey); //founder_key ignored
+    (void) va_arg(va,SilcTK::SilcDList); //channel_pubkeys ignored
+    SilcChannelContact *channel = 	
+      (SilcChannelContact *) va_arg(va,SilcTK::SilcChannelEntry)->context; 
+    channel->setNickNameForMode(mode);
+    break;
+  }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+  case SILC_NOTIFY_TYPE_INVITE: {
+    (void) va_arg(va, SilcTK::SilcChannelEntry);
+    char *str = va_arg(va, char *); // @todo do we have to free `str' ??
+    SilcTK::SilcClientEntry ce = va_arg(va, SilcTK::SilcClientEntry);
+    
+    SilcBuddyContact *buddy;
+    if(ce->context)
+      buddy = (SilcBuddyContact *) ce->context;
+    else
+      buddy = account->contactManager()->createBuddy(ce->nickname, NULL, ce);
+    assert(buddy);
+
+    if(! str) {
+      KMessageBox::queuedMessageBox
+	(Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+	 QString(i18n("Invitation from %1 received, however no "
+		      "channel name has been specified. Ignoring request."))
+	 .arg(buddy->nickName()), QString(i18n("Incoming Invitation")));
+      return;
+    }
+    
+    int answer = KMessageBox::questionYesNo
+      (Kopete::UI::Global::mainWidget(), 
+       QString(i18n("'%1' invited you into channel '%2'. "
+		    "Do you want to follow this invitation?"))
+       .arg(buddy->nickName()).arg(str), i18n("Incoming Invitation"));
+
+    if(answer == KMessageBox::Yes)
+      account->slotJoinChannel(str, false, true);
+	       
+    break;
+  }
+
+  case SILC_NOTIFY_TYPE_WATCH: {  
+    SilcTK::SilcClientEntry ce = va_arg(va,SilcTK::SilcClientEntry);
+    char *new_nick = va_arg(va,char*);
+    SilcTK::SilcUInt32 umode = va_arg(va,SilcTK::SilcUInt32);
+    SilcTK::SilcNotifyType type = va_arg(va,SilcTK::SilcUInt32);
+
+    SilcContactManager *cm = account->contactManager();
+    SilcBuddyContact *buddy = (SilcBuddyContact *)ce->context;
+    if(! buddy) buddy = cm->createBuddy(ce->nickname, NULL, ce);
+
+    switch(type) {
+      case SILC_NOTIFY_TYPE_NICK_CHANGE:
+	if(new_nick)
+	  buddy->setNickName(new_nick);
+
+	else
+	  // new_nick is NULL, do a whois inquiry to find it out ...
+	  // buddy->setNickName(ce->nickname); <- ce->nickname is the old nick
+	  buddy->whoami();
+	
+	break;
+
+      case SILC_NOTIFY_TYPE_UMODE_CHANGE:
+        setBuddyOnlineStatus(cm, buddy, umode);
+	break;
+
+      case SILC_NOTIFY_TYPE_NONE:
+        setBuddyOnlineStatus(cm, buddy, umode);
+        break;
+
+      case SILC_NOTIFY_TYPE_SIGNOFF:
+      case SILC_NOTIFY_TYPE_SERVER_SIGNOFF:
+      // ignore SILC_NOTIFY_TYPE_KILLED notification for the moment, since
+      // libsilc tends to notify WHO killed, not WHO WAS killed, therefore
+      // we'll remove the wrong person from the list ...
+      //case SILC_NOTIFY_TYPE_KILLED: 
+	buddy->removeClientEntry(ce);
+	cm->buddySignedOff(buddy);
+        break;
+    }
+    break;
+  }
+
+  }
+}
+
+
+
+void 
+SilcAccount::silc_get_auth_method(SilcTK::SilcClient /* client */, 
+				  SilcTK::SilcClientConnection /* conn */,
+				  char * /* hostname */, 
+				  SilcTK::SilcUInt16 /* port */,
+                                  SilcTK::SilcAuthMethod, /* authmethod */
+				  SilcTK::SilcGetAuthMeth completion,
+				  void *context)
+{
+  std::cerr << "silc_get_auth_method not fully implemented yet" << std::endl;
+  completion(SILC_AUTH_NONE, NULL, 0, context);
+}
+
+
+
+void 
+SilcAccount::silc_verify_public_key(SilcTK::SilcClient client, 
+				    SilcTK::SilcClientConnection conn,
+				    SilcTK::SilcConnectionType conn_type, 
+				    SilcTK::SilcPublicKey public_key,
+				    SilcTK::SilcVerifyPublicKey completion, 
+				    void *context)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(client->application);
+  
+  SilcTK::SilcUInt32 pk_len; 
+  unsigned char* pk;
+  /* encode the publickkey to revert the simplification */
+  pk = SilcTK::silc_pkcs_public_key_encode(public_key, &pk_len);
+  if(!pk) {
+    completion(FALSE, context);
+    return;
+  }
+
+  if (conn_type == SilcTK::SILC_CONN_SERVER ||
+      conn_type == SilcTK::SILC_CONN_ROUTER) {
+    char remote_ip[64] = "\0\0";
+    SilcTK::silc_net_gethostbyname(conn->remote_host, false, 
+                                   remote_ip, sizeof(remote_ip));
+    const QString &host = QString("%2_%3:%4")
+      .arg(conn->remote_host ? conn->remote_host : "none")
+      .arg(remote_ip).arg(conn->remote_port);
+    const QString &key = QString("%1key_%2")
+      .arg(conn_type == SilcTK::SILC_CONN_SERVER ? "server" : "router")
+      .arg(host);
+    const QString &result = account->configGroup()->readEntry(key);
+    
+
+    QString finger(SilcTK::silc_hash_fingerprint(NULL, pk, pk_len));
+    finger.replace(QChar(' '), QChar(':'));
+    
+    if(result.isEmpty()) {
+      // ask user what to do
+      int answer = KMessageBox::questionYesNo
+	(Kopete::UI::Global::mainWidget(), 
+	 QString(i18n("The authenticity of host '%1 (%2)' can't be "
+		      "established. Key fingerprint is %3.\n\n"
+		      "Are you sure you want to continue connecting?"))
+	 .arg(conn->remote_host).arg(remote_ip).arg(finger), 
+	 i18n("Kopete SILC Plugin"));
+
+      if(answer == KMessageBox::Yes) {
+	account->configGroup()->writeEntry(key, finger);
+	
+	// add the new host to the list of known hosts ...
+	const QString &key_hostlist = QString("%1key_hostlist")
+	  .arg(conn_type == SilcTK::SILC_CONN_SERVER 
+	       ? "server" : "router");
+	QStringList hostlist =
+	  account->configGroup()->readListEntry(key_hostlist);
+	hostlist.append(host);
+	account->configGroup()->writeEntry(key_hostlist, hostlist);
+
+	completion(TRUE, context);
+      }
+      else
+	completion(FALSE, context);
+    } 
+    else {
+      if(result.compare(finger)) {
+	// warn user ...
+	KMessageBox::queuedMessageBox
+	  (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, 
+	   QString(i18n("The public key of the remote host %1 has changed. "
+			"According to my config it used to have the "
+			"fingerprint %2, however I have received the "
+			"fingerprint %3 this time. This may mean that "
+			"there is a man in the middle. \n"
+			"Be careful, resetting connection now."))
+	   .arg(conn->remote_host).arg(result).arg(finger),
+	   i18n("Kopete SILC Plugin"));
+
+	completion(FALSE, context); // key-mismatch ...
+      } 
+      else
+	completion(TRUE, context);
+    }
+  }
+
+  else if(conn_type == SilcTK::SILC_CONN_CLIENT) {
+    QString finger = QString(SilcTK::silc_hash_fingerprint(NULL, pk, pk_len))
+      .replace(QChar(' '), QChar(':'));
+    SilcContactManager *cm = account->contactManager();
+    SilcBuddyContact *buddy = cm->lookupBuddyByFingerprint(finger);
+    if (buddy) {
+      if (!buddy->fpTrusted()) {
+        int answer = KMessageBox::questionYesNo
+          (Kopete::UI::Global::mainWidget(),
+           QString(i18n("Received client public key of %1. \n"
+                        "Fingerprint: %2\n"
+                        "Would you like to accept the key?"))
+           .arg(buddy->nickName()).arg(finger),
+           i18n("Incoming Public Key"));
+        if (answer == KMessageBox::Yes) {
+          buddy->setFpTrusted(true);
+          completion(TRUE, context);
+        }
+        else
+          completion(FALSE, context);
+      }
+      else 
+        /* The buddy is already trusted */
+        completion(TRUE, context);
+    }
+    else {
+      KMessageBox::queuedMessageBox
+        (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+         QString(i18n("Recieved client public key, but no key was requested. \n"
+                      "Fingerprint: %1\n"
+                      "This shouldn't happen, so the request will be ignored."))
+         .arg(finger), QString(i18n("Incoming Public Key")));
+      completion(FALSE, context);
+    }
+  }
+  
+  else {
+    std::cerr << "verify_public_key called for unknown conn_type" << std::endl;
+    completion(FALSE, context);
+  }
+}
+
+/**
+ * asking a password from the user in the least memory effecting and thus most
+ * secure way is the task here.
+ * 
+ * @todo memlock, overriding, disabling core dumps (?)
+ */
+
+void 
+SilcAccount::silc_ask_passphrase(SilcTK::SilcClient /* client */, 
+				 SilcTK::SilcClientConnection /* conn */,
+				 SilcTK::SilcAskPassphrase completion, 
+				 void *context)
+{
+  
+ QCString password;
+ int result = KPasswordDialog::getPassword(password, 
+        i18n("Please enter the passphrase.\n \
+              The server window may contain additional information."));
+ if (result == KPasswordDialog::Accepted) {
+    completion((unsigned char*)(const char*)password, password.length(),
+	       context);
+  } else {
+    completion(NULL, 0, context); //we failed
+  }
+}
+
+
+void 
+SilcAccount::silc_say(SilcTK::SilcClient client, 
+		      SilcTK::SilcClientConnection /* conn */,
+		      SilcTK::SilcClientMessageType /* type */, 
+		      char *msg, ...)
+{
+  char str[200];
+  va_list va;
+  va_start(va, msg);
+  vsnprintf(str, sizeof(str) - 1, msg, va);
+  va_end(va);
+
+  SilcAccount *account = static_cast<SilcAccount *>(client->application);
+  account->myServer()->appendMessage(QString(str));
+}
+
+
+void
+SilcAccount::silc_key_agreement(SilcTK::SilcClient,
+				SilcTK::SilcClientConnection,
+				SilcTK::SilcClientEntry, 
+				const char *, SilcTK::SilcUInt16,
+                                SilcTK::SilcUInt16)
+{
+  std::cerr << "silc_key_agreement called." << std::endl;
+}
+
+
+
+void
+SilcAccount::silc_ftp(SilcTK::SilcClient client,
+		      SilcTK::SilcClientConnection conn,
+		      SilcTK::SilcClientEntry client_entry,
+		      SilcTK::SilcUInt32 session_id,
+		      const char *hostname, SilcTK::SilcUInt16 port)
+{
+  kdDebug() << "Filetransfer from " << client_entry->nickname << endl;
+
+  SilcAccount *account = static_cast<SilcAccount *>(client->application);
+  SilcBuddyContact *buddy = (SilcBuddyContact *) client_entry->context;
+
+  if(!buddy) {
+    /* Buddy is not in our buddylist, create temporary buddy */
+    SilcContactManager *cm = account->contactManager();
+    buddy = cm->createBuddy(QString::fromUtf8(client_entry->nickname),
+                            NULL, client_entry);
+    client_entry->context = buddy;
+  }
+
+  if(account->ftNoBind() && !hostname) {
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+       QString(i18n("Received incoming file transfer request from %1, "
+		    "however the sender requested, that the receiver "
+		    "shall bind a listening port. Unfortunately the latter is "
+		    "forbidden according this plugin's configuration.\n\n"
+		    "The file transfer request has been rejected."))
+       .arg(buddy->nickName()), i18n("Incoming File Transfer"));
+    SilcTK::silc_client_file_close(client, conn, session_id);
+    return;
+  }
+
+  if(account->ftAutoAccept()) {
+    new SilcFileTransfer(account, buddy, session_id, false);
+  }
+
+  // else, we ought not auto-accept the file, therefore block and ask the user
+  else {
+    int answer = KMessageBox::questionYesNo
+      (Kopete::UI::Global::mainWidget(),
+       QString(i18n("Received incoming file transfer request from %1 "
+		    "(%2:%3). Do you want to receive and store "
+		    "this file?"))
+       .arg(buddy->nickName()).arg(hostname).arg(port),
+       i18n("Incoming File Transfer"));
+
+
+    if(answer != KMessageBox::Yes) {
+      SilcTK::silc_client_file_close(client, conn, session_id);
+      return;
+    }
+
+    new SilcFileTransfer(account, buddy, session_id);
+  }
+}
+
+
+
+///
+/// update the ourself's user mode
+///
+///////////////////////////////////////////////////////////////////////////////
+static void
+sendUmode(SilcTK::SilcClient client, 
+	  SilcTK::SilcClientConnection conn,
+	  SilcTK::SilcUInt32 umode)
+{
+  if(! conn) return;
+
+  // calculate the new umode flags ...
+  SilcTK::SilcUInt32 mode = conn->local_entry->mode;
+  mode &= ~(SILC_UMODE_GONE | SILC_UMODE_HYPER | 
+	    SILC_UMODE_BUSY | SILC_UMODE_INDISPOSED);
+  mode |= umode;
+
+  // convert id payload ...
+  SilcTK::SilcBuffer idp = 
+    SilcTK::silc_id_payload_encode(conn->local_id, SILC_ID_CLIENT);
+
+  // convert user mode ...
+  unsigned char mb[4];
+  SILC_PUT32_MSB(mode, mb);
+
+  // send the command ...
+  SilcTK::silc_client_command_send(client, conn, SILC_COMMAND_UMODE,
+				   NULL, NULL, 2,
+				   1, idp->data,
+                                   (SilcTK::SilcUInt32)(idp->tail - idp->data),
+				   2, mb, sizeof(mb));
+
+  // get rid of id payload ...
+  SilcTK::silc_buffer_free(idp);
+}
+
+void
+SilcAccount::setBuddyOnlineStatus(SilcContactManager *cm, 
+				  SilcBuddyContact *buddy, 
+				  SilcTK::SilcUInt32 mode)
+{
+  if(mode & (SILC_UMODE_DETACHED))
+    cm->setOnlineStatus(buddy, SilcProtocol::protocol()->statusDetached);
+
+  else if(mode & (SILC_UMODE_GONE))
+    cm->setOnlineStatus(buddy, SilcProtocol::protocol()->statusGone);
+
+  else if(mode & (SILC_UMODE_BUSY))
+    cm->setOnlineStatus(buddy, SilcProtocol::protocol()->statusBusy);
+
+  else if(mode & (SILC_UMODE_HYPER))
+    cm->setOnlineStatus(buddy, SilcProtocol::protocol()->statusHyper);
+
+  else if(mode & (SILC_UMODE_INDISPOSED))
+    cm->setOnlineStatus(buddy, SilcProtocol::protocol()->statusIndisposed);
+
+  else
+    cm->setOnlineStatus(buddy, SilcProtocol::protocol()->statusOnline); 
+}
+
+void 
+SilcAccount::slotGlobalIdentityChanged(const QString &key, const QVariant &value)
+{
+  SilcContact *me = static_cast<SilcContact *>(myself());
+
+  if(key == Kopete::Global::Properties::self()->photo().key()) {
+    _globalIdentityPicture = value.toString();
+    if (me->account()->conn()) 
+      setAttributePicture();
+  }
+}
+void 
+SilcAccount::setAttributePicture()
+{
+  SilcContact *me = static_cast<SilcContact *>(myself());
+  SilcTK::silc_client_attribute_del(_client, _conn, SILC_ATTRIBUTE_USER_ICON, NULL);
+  
+  QFile photo(_globalIdentityPicture);
+  photo.open(IO_ReadOnly);
+  QByteArray data = photo.readAll();
+  photo.close();
+
+  SilcTK::SilcMime mime = SilcTK::silc_mime_alloc();
+
+  SilcTK::silc_mime_add_field(mime, "MIME-Version", "1.0");
+  SilcTK::silc_mime_add_field(mime, "Content-Transfer-Encoding", "binary");
+  SilcTK::silc_mime_add_field(mime, "Content-Type", "image/png");
+  SilcTK::silc_mime_add_data(mime, (unsigned char *)data.data(), data.size());
+
+
+  SilcTK::silc_client_attribute_add(_client, _conn, SILC_ATTRIBUTE_USER_ICON,
+                                      (void *)mime, sizeof(*mime));
+  
+  me->setProperty(Kopete::Global::Properties::self()->photo(), _globalIdentityPicture);
+}
+
+  void 
+SilcAccount::updateAttributes(void)
+{
+  if(conn()) {
+    // Deleting all
+    SilcTK::silc_client_attribute_del(_client, _conn, 
+                                      SILC_ATTRIBUTE_STATUS_MOOD, NULL);
+    SilcTK::silc_client_attribute_del(_client, _conn, 
+                                      SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL);
+    SilcTK::silc_client_attribute_del(_client, _conn, 
+                                      SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL);
+    SilcTK::silc_client_attribute_del(_client, _conn, 
+                                      SILC_ATTRIBUTE_GEOLOCATION, NULL);
+    SilcTK::silc_client_attribute_del(_client, _conn, 
+                                      SILC_ATTRIBUTE_STATUS_MESSAGE, NULL);
+    if(getAttributesAllowed()) {
+      // mood
+      SilcTK::SilcAttributeMood mood = getAttributeMood();
+      SilcTK::silc_client_attribute_add(_client, _conn, SILC_ATTRIBUTE_STATUS_MOOD,
+                                        (void *)mood, sizeof(mood));
+      // contact
+      SilcTK::SilcAttributeContact contact = getAttributeContact();
+      if(contact)
+        SilcTK::silc_client_attribute_add(_client, _conn, 
+                                          SILC_ATTRIBUTE_PREFERRED_CONTACT,
+                                          (void *)contact, sizeof(contact));
+      // geolocation
+      if(getGeoAllowed()) {
+        SilcTK::SilcAttributeObjGeo geo;
+
+        QString longitude =  QString("%1").arg(getGeoLongitude());
+        QString latitude = QString("%1").arg(getGeoLatitude());
+        QString altitude =  QString("%1 m").arg(getGeoAltitude());
+
+        geo.longitude = (char *) longitude.latin1();
+        geo.latitude = (char *) latitude.latin1();
+        geo.altitude = (char *) altitude.latin1(); 
+        silc_client_attribute_add(_client, _conn,
+                                  SILC_ATTRIBUTE_GEOLOCATION, &geo,
+                                  sizeof(geo));
+      }
+      // Language
+      if(!getAttributeLanguage().isEmpty()) {
+        QStringList list = QStringList::split(QRegExp("[^a-zA-Z0-9.]+"), 
+                                              getAttributeLanguage());
+        for(QStringList::Iterator it = list.begin(); it != list.end(); it ++) {
+          silc_client_attribute_add(_client, _conn, 
+                                    SILC_ATTRIBUTE_PREFERRED_LANGUAGE, 
+                                    (void *)(*it).latin1(), 
+                                    sizeof((*it).latin1()));
+        }
+      }
+      if(!getAttributeMessage().isEmpty()) {
+        SilcTK::SilcMime mime = SilcTK::silc_mime_alloc();
+
+        SilcTK::silc_mime_add_field(mime, "MIME-Version", "1.0");
+        SilcTK::silc_mime_add_field(mime, "Content-Transfer-Encoding", "binary");
+        SilcTK::silc_mime_add_field(mime, "Content-Type",
+                                    "text/plain; charset=utf-8");
+
+        QCString content = QString(getAttributeMessage()).utf8();
+        SilcTK::silc_mime_add_data(mime, (unsigned char *)(const char *)content,
+                                   content.length());
+
+        silc_client_attribute_add(_client, _conn, 
+                                  SILC_ATTRIBUTE_STATUS_MESSAGE, 
+                                  mime, sizeof(*mime));
+      }
+    }
+  }
+}
+
+
+SilcTK::SilcClientOperations SilcAccount::ops = {
+  SilcAccount::silc_say,
+  SilcChannelContact::silc_channel_message,
+  SilcBuddyContact::silc_private_message,
+  SilcAccount::silc_notify,
+  SilcAccount::silc_command,
+  SilcAccount::silc_command_reply,
+  SilcAccount::silc_get_auth_method,
+  SilcAccount::silc_verify_public_key,
+  SilcAccount::silc_ask_passphrase,
+  SilcAccount::silc_key_agreement,
+  SilcAccount::silc_ftp 
+};
+
+#include "silcaccount.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcaccount.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcaccount.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcaccount.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcaccount.h Mon May 28 17:34:43 2007
@@ -1,0 +1,613 @@
+//                          -*- mode: C++ -*-
+// Copyright(C) 2005,2007 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCPROTOCOLSILCACCOUNT_H
+#define SILCPROTOCOLSILCACCOUNT_H
+
+#include <kopeteprotocol.h>
+#include <kopetepasswordedaccount.h>
+#include <kopeteonlinestatus.h>
+
+
+// include libsilc stuff into a separate namespace
+namespace SilcTK {
+#include <silc.h>
+#include <silcclient.h>
+}
+#include <kopetechatsession.h>
+
+// forward declare classes:
+class SilcProtocol;
+class SilcAccount;
+class SilcServerContact;
+class SilcChatSession;
+
+// kopete_silc includes
+#include "silcprotocol.h"
+#include "silccontactmanager.h"
+#include "silcbuddycontact.h"
+
+/**
+ * @brief Plugin reimplementation of Kopete::Account, supporting SILC protocol
+ *
+ * @author Stefan Siegl <ssiegl at gmx.de>
+ */
+class SilcAccount : public Kopete::PasswordedAccount
+{
+  Q_OBJECT
+  friend class SilcChannelContact;
+  friend class SilcBuddyContact;
+  friend class SilcProtocol;
+  friend class SilcContactManager;
+  friend class SilcFileTransfer;
+  friend class SilcChatSession;
+
+public:
+  SilcAccount(SilcProtocol *proto, const QString &accountID,
+	      const char *name = 0L);
+  
+  ~SilcAccount();
+
+  /**
+   * @brief send a command to the SILC network
+   */
+  void sendSilcCommand(const QString &command, 
+                       SilcTK::SilcClientCommandReply reply = NULL, 
+                       void *context = NULL);
+
+  SilcChatSession *chatSession(Kopete::ContactPtrList others);
+
+  inline SilcBuddyContact *myself(void) {
+    return static_cast<SilcBuddyContact *>(Kopete::Account::myself());
+  }
+
+  inline const SilcBuddyContact *myself(void) const {
+    return static_cast<SilcBuddyContact *>(Kopete::Account::myself());
+  }
+
+  inline SilcProtocol *protocol(void) {
+    return static_cast<SilcProtocol *>(Kopete::Account::protocol());
+  }
+
+  inline const SilcProtocol *protocol(void) const {
+    return static_cast<SilcProtocol *>(Kopete::Account::protocol());
+  }
+
+
+  /**
+   * @brief return absolute path of the public key file
+   */
+  QString pubKeyPath(void);
+
+  /**
+   * @brief return absolute path of the private key file
+   */
+  QString privKeyPath(void);
+
+  /**
+   * @brief SilcHash
+   */
+  SilcTK::SilcHash sha1hash;
+
+protected:
+  inline SilcTK::SilcPublicKey pubkey(void) const { return _pubkey; }
+  inline SilcTK::SilcPrivateKey privkey(void) const { return _privkey; }
+
+  inline SilcTK::SilcClient client(void) { return _client; }
+  inline SilcTK::SilcClientConnection conn(void) { return _conn; }
+  void copyKey(QString keyPath,bool prvKey=false);
+  
+
+signals:
+  /**
+   * @brief now connecting to the SILC network 
+   *
+   * This signal is emitted if the user has choosen to connect and the 
+   * connection has been set up correctly.
+   */
+  void connected();
+  
+  /**
+   * @brief user want's to disconnect from the SILC network 
+   */
+  void disconnected();
+
+public slots:
+  /** 
+   * @brief set away status, leaving an optional away message
+   */
+   virtual void setAway(bool away, const QString &reason = QString::null);
+
+  /**
+   * @brief connect to the silc network
+   */
+  virtual void connect(const Kopete::OnlineStatus& initialStatus =
+		       Kopete::OnlineStatus());
+
+  /** 
+   * @brief disconnect from the silc network 
+   */
+  virtual void disconnect();
+
+  /**
+   * @brief set the online status, optionally leaving away message 
+   */
+  virtual void setOnlineStatus(const Kopete::OnlineStatus& status,
+			       const QString &reason = QString::null);
+
+  /**
+   * @brief create a new SilcContact
+   */
+  virtual bool createContact(const QString &contactId,
+			     Kopete::MetaContact *parentContact);
+
+  // this is not yet used, but an abstract function
+  virtual void connectWithPassword(const QString &password);
+
+  /**
+   * @brief prepare actionMenu (the one popin up when clicking the network
+   * icon in the lower right of the kopete application window)
+   */
+  virtual KActionMenu *actionMenu(void);
+
+  /**
+   * @brief ask the user which channel to join and afterwards join it
+   */
+  void slotJoinChannel(void);
+
+  /** 
+   * @brief join the channel with the provided name an dopen a chat window
+   */
+  void slotJoinChannel(const QString &channel, bool founder = false,
+		       bool auth = false, const QString &password = "");
+
+  /**
+   * @brief show the server messages window
+   */
+  void slotShowServer(void);
+            
+   /**
+    * @brief show fingerprint of this account's user 
+    */
+  void slotShowFingerprint(QString name=QString::null);
+                 
+public:
+  /**
+   * @brief types of handling bind
+   */
+  enum BindSelection {FT_BIND_ALWAYS, FT_BIND_NEVER, FT_BIND_NAT_TEST};
+
+  static const QString CONFIG_NICKNAME;
+  static const QString CONFIG_USERNAME;
+  static const QString CONFIG_REALNAME;
+  static const QString CONFIG_HOSTNAME;
+  static const QString CONFIG_SIGN_CHAT_MESSAGE;
+  static const QString CONFIG_SIGN_CHAT_ACTION;
+  static const QString CONFIG_SIGN_PRIV_MESSAGE;
+  static const QString CONFIG_SIGN_PRIV_ACTION;
+  static const QString CONFIG_DISPLAY_IMAGES_INLINE;
+  static const QString CONFIG_FT_USE_SILC_MIME;
+  static const QString CONFIG_FT_AUTO_ACCEPT;
+  static const QString CONFIG_FT_BIND_SELECTION;
+  static const QString CONFIG_QUIT_MESSAGE;
+  static const QString CONFIG_ATTR_GEO_ALLOWED;
+  static const QString CONFIG_ATTR_GEO_LONG;
+  static const QString CONFIG_ATTR_GEO_LAT;
+  static const QString CONFIG_ATTR_GEO_ALT;
+  static const QString CONFIG_ATTR_MESSAGE;
+  static const QString CONFIG_ATTR_LANGUAGE;
+  static const QString CONFIG_ATTR_TIMEZONE;
+  static const QString CONFIG_ATTR_ALLOWED;
+
+  static const QString CONFIG_ATTR_MOOD;
+  static const QString CONFIG_ATTR_CONTACT;
+
+  /** 
+   * @brief set the nickname
+   */
+  void setNickName(const QString &nickname);
+
+  /** 
+   * @brief return set nickname
+   */
+  const QString nickName(void) const;
+
+  /** 
+   * @brief set local username
+   */
+  void setUserName(const QString &);
+
+  /**
+   * @brief return local username
+   */
+  const QString userName(void) const;
+
+  /** 
+   * @brief set real username
+   */
+  void setRealName(const QString &);
+
+  /**
+   * @brief return real username
+   */
+  const QString realName(void) const;
+
+  /**
+   * @brief set the name of the host to connect to
+   */
+  void setHostName(const QString &);
+
+  /**
+   * @brief return the name of the host to connect to
+   */
+  const QString hostName(void) const;
+
+  /**
+   * @brief return whether to display small images inline
+   */
+  void setDisplayImagesInline(const bool);
+
+  /**
+   * @brief set whether to prefer sending files using SilcMime
+   */
+  void setUseSilcMime(const bool);
+
+  /**
+   * @brief set whether incoming file requests should be accepted automatically
+   */
+  void setFtAutoAccept(const bool);
+
+  /** 
+   * @brief binding habbit when sending files:
+   * 0 - always
+   * 1 - never
+   * 2 - autodetect nat
+   */
+  void setFtBind(int);
+
+  /**
+   * @brief get the BindSelection, see setFtBind */
+  int getFtBind(void) const;
+
+  /**
+   * @brief whether to display small images inline
+   */
+  bool displayImagesInline(void) const;
+
+  /** 
+   * @brief whether to prefer to send files using SilcMime
+   */
+  bool useSilcMime(void) const;
+
+  /** 
+   * @brief return whether incoming file request shall be accepted automatically
+   */
+  bool ftAutoAccept(void) const;
+
+  /**
+   * @brief return whether or not to bind a port when sending files
+   */
+  bool ftNoBind(void) const;
+
+  /** 
+   * @brief set the quit message
+   */
+  void setQuitMessage(const QString &nickname);
+
+  /** 
+   * @brief return set quit message
+   */
+  const QString quitMessage(void) const;
+  
+  /**
+   * @brief set whether outgoing channel messages ought to be signed
+   */
+  void setSignChannelMessages(const bool);
+
+  /**
+   * @brief return whether outgoing channel messages are sent digitally signed
+   */
+  bool signChannelMessages(void) const;
+
+  /** 
+   * @brief set whether or not outgoing channel actions ought to be signed
+   */
+  void setSignChannelActions(const bool);
+  
+  /**
+   * @brief return whether outgoing channel actions are to be sent 
+   * digitally signed.
+   */
+  bool signChannelActions(void) const;
+
+  /**
+   * @brief set whether to sign outgoing private messages
+   */
+  void setSignPrivateMessages(const bool);
+
+  /**
+   * @brief return whether we sign outgoing private messages
+   */
+  bool signPrivateMessages(void) const;
+
+  /** 
+   * @brief set whether to digitally sign outgoing private actions
+   */
+  void setSignPrivateActions(const bool);
+  
+  /** 
+   * @brief return whether we sign outgoing private actions 
+   */
+  bool signPrivateActions(void) const;
+
+  /** 
+   * @brief set mood attribute
+   */
+  void setAttributeMood(SilcTK::SilcAttributeMood mood);
+
+  /**
+   * @brief get mood attribute
+   */
+  SilcTK::SilcAttributeMood getAttributeMood(void) const;
+  
+  /** 
+   * @brief set contact attribute
+   */
+  void setAttributeContact(SilcTK::SilcAttributeContact contact);
+
+  /**
+   * @brief get contact attribute
+   */
+  SilcTK::SilcAttributeContact getAttributeContact(void) const;
+
+  /**
+   * @brief set geo informations
+   */
+  void setGeoInformations(bool allowed, double longitude, double latitude,
+                          int altitude);
+
+  
+  /**
+   * @brief if sending of attribute informations is allowed at all
+   */
+  void setAttributesAllowed(bool allowed);
+  bool getAttributesAllowed(void) const;
+  /**
+   * @brief if sending of timezone informations is allowed 
+   */
+  void setAttributeTimezone(bool allowed);
+  bool getAttributeTimezone(void) const;
+  
+  /** 
+   * @brief set attribute status message
+   */
+  void setAttributeMessage(const QString &message);
+
+  /** 
+   * @brief return set attribute status message
+   */
+  const QString getAttributeMessage(void) const;
+  
+  /** 
+   * @brief set attribute status language
+   */
+  void setAttributeLanguage(const QString &language);
+
+  /** 
+   * @brief return set attribute status message
+   */
+  const QString getAttributeLanguage(void) const;
+  
+  /**
+   * @brief if sending of geo informations is allowed
+   */
+  bool getGeoAllowed(void) const;
+  
+  /**
+   * @brief get attribute longitude
+  */
+  double getGeoLongitude(void) const;
+  
+  /**
+   * @brief get attribute latitude
+  */
+  double getGeoLatitude(void) const;
+  
+  /**
+   * @brief get attribute altitude
+  */
+  int getGeoAltitude(void) const;
+  
+  /**
+   * @brief updates attributes
+   */
+  void updateAttributes(void);
+
+  /**
+   * @brief return pointer to the associated SilcContactManager instance
+   */
+  inline SilcContactManager *contactManager(void) { 
+    return &_contactManager;
+  }
+
+  /**
+   * @brief check wheater account is behind NAT
+   */
+  bool isBehindNat(void) const;
+
+  /*
+   * @brief get the local ip, becaue silc_net_localhost return crap
+   */
+  char *localIp(void) const;
+
+protected:
+  /**
+   * @brief regularly call libsilc's mailoop
+   */
+  void timerEvent(QTimerEvent *);
+
+
+private:
+  /**
+   * @brief the "Join Channel" entry in the account's popup menu
+   */
+  KAction *menuJoinChannel;
+  KAction *menuShowServer;
+  KAction *menuShowFingerprint; 
+
+  /**
+   * @brief the onlineStatus which shall be entered after connecting
+   */
+  Kopete::OnlineStatus _wantedOnlineStatus;
+
+  /**
+   * @brief pointer to the allocated SilcContactManager instance
+   */
+  SilcContactManager _contactManager;
+
+  SilcServerContact *_myServer;
+  SilcServerContact *myServer(void) { return _myServer; }
+
+  /**
+   * @brief the loaded public key
+   */
+  SilcTK::SilcPublicKey _pubkey;
+  
+  /**
+   * @brief the loaded private key
+   */
+  SilcTK::SilcPrivateKey _privkey;
+
+  /**
+   * @brief pointer to the SilcClient structure
+   */
+  SilcTK::SilcClient _client;
+
+  /**
+   * @brief libsilc server connection handle
+   */
+  SilcTK::SilcClientConnection _conn;
+
+  /**
+   * @brief path to local identity picture (cached)
+   */
+  QString _globalIdentityPicture;
+
+  /**
+   * @brief set _globalIdentityPicture to Attributes
+   */
+  void setAttributePicture();
+
+  /**
+   * @brief this function is called by the libsilc when something changed on
+   * connection (online, offline)
+   */
+
+  static void silc_connection_cb(SilcTK::SilcClient client,
+                                 SilcTK::SilcClientConnection conn,
+                                 SilcTK::SilcClientConnectionStatus status,
+                                 SilcTK::SilcStatus error,
+                                 const char *message,
+                                 void *context);
+
+
+  static void silc_command(SilcTK::SilcClient client, 
+			   SilcTK::SilcClientConnection conn,
+			   SilcTK::SilcBool success,
+			   SilcTK::SilcCommand command, 
+			   SilcTK::SilcStatus status,
+                           SilcTK::SilcUInt32 argc,
+                           unsigned char **argv);
+
+  static void silc_command_reply(SilcTK::SilcClient client, 
+				 SilcTK::SilcClientConnection conn,
+				 SilcTK::SilcCommand command, 
+                                 SilcTK::SilcStatus status,
+				 SilcTK::SilcStatus error, 
+                                 va_list va);
+
+  static void silc_notify(SilcTK::SilcClient client, 
+			  SilcTK::SilcClientConnection conn,
+			  SilcTK::SilcNotifyType type, ...);
+
+
+  static void silc_get_auth_method(SilcTK::SilcClient client, 
+				   SilcTK::SilcClientConnection conn,
+				   char *hostname, 
+				   SilcTK::SilcUInt16 port,
+                                   SilcTK::SilcAuthMethod authmethod,
+				   SilcTK::SilcGetAuthMeth completion,
+				   void *context);
+
+  static void silc_verify_public_key(SilcTK::SilcClient client, 
+                                     SilcTK::SilcClientConnection conn,
+                                     SilcTK::SilcConnectionType conn_type,
+                                     SilcTK::SilcPublicKey public_key,
+                                     SilcTK::SilcVerifyPublicKey completion, 
+                                     void *context);
+
+  static void silc_ask_passphrase(SilcTK::SilcClient client, 
+				  SilcTK::SilcClientConnection conn,
+				  SilcTK::SilcAskPassphrase completion, 
+				  void *context);
+
+  static void silc_say(SilcTK::SilcClient client, 
+		       SilcTK::SilcClientConnection conn,
+		       SilcTK::SilcClientMessageType type, 
+		       char *msg, ...)
+    __attribute__ ((__format__ (__printf__, 4, 5)));
+
+  static void silc_key_agreement(SilcTK::SilcClient client,
+				 SilcTK::SilcClientConnection conn,
+				 SilcTK::SilcClientEntry entry, 
+		          	 const char *hostname, SilcTK::SilcUInt16 protocol,
+                                 SilcTK::SilcUInt16 port);
+
+  static void silc_ftp(SilcTK::SilcClient client,
+		       SilcTK::SilcClientConnection conn,
+		       SilcTK::SilcClientEntry client_entry,
+		       SilcTK::SilcUInt32 session_id,
+		       const char *hostname, SilcTK::SilcUInt16 port);
+
+  static void setBuddyOnlineStatus(SilcContactManager *cm,
+                                   SilcBuddyContact *buddy,
+                                   SilcTK::SilcUInt32 mode);
+  
+  
+  static SilcTK::SilcClientOperations ops;
+
+
+  int libsilcTimerId;
+  bool libsilcTimerLocked;
+
+
+private slots:
+  /**
+   * @brief the SilcEngine successfully joined a channel (thus open chat window)
+   */
+  void slotJoinedChannel(const QString &);
+  /**
+   * @brief is called when disconnected to stop the timer
+   */
+  void slotStopTimer(void);
+  /**
+   * @brief global properties of kopete were changed (needed for userphotos)
+   */
+  void slotGlobalIdentityChanged (const QString &key, const QVariant &value);
+};
+#endif

Added: kopete-silc-plugin/branches/upstream/current/src/silcaddcontact.ui
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcaddcontact.ui?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcaddcontact.ui (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcaddcontact.ui Mon May 28 17:34:43 2007
@@ -1,0 +1,217 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>silcAddContact</class>
+<widget class="QWidget">
+    <property name="name">
+        <cstring>silcAddContact</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>459</width>
+            <height>217</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>silcAddContact</string>
+    </property>
+        <vbox>
+            <property name="name">
+                <cstring>unnamed</cstring>
+            </property>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textLabel1</cstring>
+                </property>
+                <property name="sizePolicy">
+                    <sizepolicy>
+                        <hsizetype>7</hsizetype>
+                        <vsizetype>5</vsizetype>
+                        <horstretch>0</horstretch>
+                        <verstretch>0</verstretch>
+                    </sizepolicy>
+                </property>
+                <property name="text">
+                    <string>&lt;p&gt;Provide a nickname or channelname for the contact you wish to add. If you wish to add a nickname you may want to provide a fingeprint for that contact as well. The SILC network identifies contacts via fingerprints and so does this plugin. If you do not provide a fingerprint the contact you wish to add must be online as its fingerprint is read from the network. If this plugin cannot read the fingerprint from the network the contact will not be added at all.&lt;/p&gt;</string>
+                </property>
+                <property name="textFormat">
+                    <enum>AutoText</enum>
+                </property>
+                <property name="scaledContents">
+                    <bool>false</bool>
+                </property>
+                <property name="alignment">
+                    <set>WordBreak|AlignVCenter</set>
+                </property>
+            </widget>
+            <widget class="QLayoutWidget">
+                <property name="name">
+                    <cstring>layout21</cstring>
+                </property>
+                <grid>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLineEdit" row="1" column="1">
+                        <property name="name">
+                            <cstring>fingerprint</cstring>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>proivde an optional fingerprint for the contact</string>
+                        </property>
+                        <property name="whatsThis" stdset="0">
+                            <string>As Nicknames do not have to be unique in SILC you may want to provide an optional fingerprint for the contact to identify it. If you do not provide a fingerprint it is read from the network which means that the contact has to be online.</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="0" column="1">
+                        <property name="name">
+                            <cstring>addID</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>7</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>The name of the SILC contact or channel you would like to add.</string>
+                        </property>
+                        <property name="whatsThis" stdset="0">
+                            <string>The name of the SILC contact or channel you would like to add.  You may type simply the text of a person's nickname, or you may type a channel name.</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="1" column="0">
+                        <property name="name">
+                            <cstring>textLabel2</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Fingerprint:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                        <property name="buddy" stdset="0">
+                            <cstring>fingerprint</cstring>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="0" column="0">
+                        <property name="name">
+                            <cstring>lblAddID</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Nickname/channel:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                        <property name="buddy" stdset="0">
+                            <cstring>addID</cstring>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>The name of the SILC contact or channel you would like to add.</string>
+                        </property>
+                        <property name="whatsThis" stdset="0">
+                            <string>The name of the SILC contact or channel you would like to add.  You may type simply the text of a person's nickname, or you may type a channel name.</string>
+                        </property>
+                    </widget>
+                </grid>
+            </widget>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textLabel3</cstring>
+                </property>
+                <property name="sizePolicy">
+                    <sizepolicy>
+                        <hsizetype>7</hsizetype>
+                        <vsizetype>5</vsizetype>
+                        <horstretch>0</horstretch>
+                        <verstretch>0</verstretch>
+                    </sizepolicy>
+                </property>
+                <property name="text">
+                    <string>&lt;i&gt;e.g. 0000:0001:0002:0003:0004::0005:0006:0007:0008:0009&lt;/i&gt;</string>
+                </property>
+                <property name="alignment">
+                    <set>WordBreak|AlignVCenter|AlignRight</set>
+                </property>
+            </widget>
+            <widget class="QLayoutWidget">
+                <property name="name">
+                    <cstring>layout23</cstring>
+                </property>
+                <grid>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QCheckBox" row="0" column="1">
+                        <property name="name">
+                            <cstring>ischannel</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>5</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>&amp;contact is channel</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+C</string>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>check if the contact is a channel</string>
+                        </property>
+                        <property name="whatsThis" stdset="0">
+                            <string>check if you want to add a channel to your buddies list</string>
+                        </property>
+                    </widget>
+                    <spacer row="0" column="0">
+                        <property name="name">
+                            <cstring>spacer2</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Horizontal</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>100</width>
+                                <height>16</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </grid>
+            </widget>
+            <spacer>
+                <property name="name">
+                    <cstring>spacer</cstring>
+                </property>
+                <property name="orientation">
+                    <enum>Vertical</enum>
+                </property>
+                <property name="sizeType">
+                    <enum>Expanding</enum>
+                </property>
+                <property name="sizeHint">
+                    <size>
+                        <width>439</width>
+                        <height>46</height>
+                    </size>
+                </property>
+            </spacer>
+        </vbox>
+</widget>
+<tabstops>
+    <tabstop>addID</tabstop>
+    <tabstop>fingerprint</tabstop>
+    <tabstop>ischannel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>

Added: kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,75 @@
+//              -*- mode: C++ -*-
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include "silccontactmanager.h"
+#include "silcaddcontactpage.h"
+#include "silcaccount.h"
+
+#include <kopeteaccount.h>
+
+//layout
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qlineedit.h>
+
+SilcAddContactPage::SilcAddContactPage(QWidget *parent, SilcAccount *account)
+  : AddContactPage(parent)
+{
+  (void) account;
+
+  (new QVBoxLayout(this))->setAutoAdd(true);
+  this->silcAddContactUI = new silcAddContact(this);
+}
+
+SilcAddContactPage::~SilcAddContactPage()
+{
+
+}
+
+bool 
+SilcAddContactPage::apply(Kopete::Account *account, Kopete::MetaContact *m)
+{ 
+  SilcAccount *_account = (SilcAccount*)account;
+  SilcContactManager *cm = _account->contactManager();
+
+  if(this->silcAddContactUI->ischannel->isChecked()) {
+     cm->createChannel(this->silcAddContactUI->addID->text(),m);
+  } else {
+     SilcBuddyContact *buddy;
+     QString nick = this->silcAddContactUI->addID->text();
+     QString finger = this->silcAddContactUI->fingerprint->text();
+     if(not finger.isEmpty()) {
+        //user provided a fingerprint
+        buddy = new SilcBuddyContact(_account, nick, finger, m);
+        cm->addBuddy(buddy);
+        buddy->watchme(true);
+     } else {
+        cm->createBuddy(nick,m);
+     }
+     _account->sendSilcCommand(QString("WHOIS %1").arg(nick));
+  }
+  return true;
+}
+
+bool 
+SilcAddContactPage::validateData(void)
+{
+	return true;
+}
+
+#include "silcaddcontactpage.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcaddcontactpage.h Mon May 28 17:34:43 2007
@@ -1,0 +1,59 @@
+//              -*- mode: C++ -*-
+//
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCPROTOCOL_SILCADDCONTACTPAGE_H
+#define SILCPROTOCOL_SILCADDCONTACTPAGE_H
+
+namespace Kopete {
+  class Account;
+  class MetaContact;
+}
+
+// forward declare classes:
+class SilcProtocol;
+class SilcAccount;
+
+// include base widget classes
+#include "silcaddcontact.h"
+#include <ui/addcontactpage.h>
+
+/**
+ * @brief Create the AddContactPage widget and implement it's functionality
+ *
+ * @author Stefan Siegl <ssiegl at gmx.de>
+ */
+class SilcAddContactPage
+  : public AddContactPage
+{
+  Q_OBJECT;
+
+public:
+  SilcAddContactPage(QWidget *parent = 0, SilcAccount *account = 0);
+  ~SilcAddContactPage();
+
+  silcAddContact *silcAddContactUI;
+
+public slots:
+  virtual bool apply(Kopete::Account *account, Kopete::MetaContact *m);
+
+private slots:
+  virtual bool validateData();
+};
+
+#endif // SILCPROTOCOL_SILCADDCONTACTPAGE_H

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,272 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+#include <assert.h>
+#include <kdebug.h>
+#include <qfile.h>
+#include <qimage.h>
+#include <kstandarddirs.h>
+
+#include "silcbuddyattributes.h"
+#include "silcbuddycontact.h"
+
+
+// sorry for this hack, unfortunately we need it for
+// the macros of recent libsilc to work ...
+typedef unsigned char SilcUInt8;
+
+SilcBuddyAttributes::SilcBuddyAttributes(SilcBuddyContact *bud) 
+{
+  buddy = bud;
+  _vcard = NULL;
+  _mood = SilcTK::SILC_ATTRIBUTE_MOOD_NORMAL;
+  _contactinfo = SilcTK::SILC_ATTRIBUTE_CONTACT_NONE;
+  memset(&_geolocation, 0, sizeof(_geolocation));
+}
+
+
+SilcBuddyAttributes::~SilcBuddyAttributes() {}
+
+void
+SilcBuddyAttributes::updateAttributes(SilcTK::SilcDList attrs)
+{
+  assert(attrs);
+    
+  SilcTK::SilcAttributePayload attr;
+  SilcTK::SilcAttribute attribute;
+  SilcTK::SilcMime mime;
+  char p[1024];
+  bool preferred_language_start = FALSE;
+  QString status_text;
+  QString status_message;
+  QString mime_type;
+  char *ptr;
+  SilcTK::SilcUInt32 len;
+
+
+  SilcTK::silc_dlist_start(attrs);
+  while ((attr = (SilcTK::SilcAttributePayload) SilcTK::silc_dlist_get(attrs))
+         != SILC_LIST_END) {
+    if (silc_attribute_get_flags(attr) != SILC_ATTRIBUTE_FLAG_VALID)
+      continue;
+    attribute = SilcTK::silc_attribute_get_attribute(attr);
+    switch(attribute) {
+    case SILC_ATTRIBUTE_USER_INFO:
+      silc_free(_vcard);
+      SilcTK::silc_attribute_get_object(attr, (void *)&_vcard, sizeof(_vcard));
+      break;
+    case SILC_ATTRIBUTE_STATUS_MOOD:
+      SilcTK::silc_attribute_get_object(attr, (void *)&_mood, sizeof(_mood));
+      break;
+    case SILC_ATTRIBUTE_STATUS_FREETEXT:
+      memset(&p, 0, sizeof(p));
+      SilcTK::silc_attribute_get_object(attr, (void *)&p, sizeof(p) - 1);
+      status_text = QString::fromUtf8(p);
+      break;
+    case SILC_ATTRIBUTE_STATUS_MESSAGE:
+      mime = SilcTK::silc_mime_alloc();
+      // untested
+      if (!SilcTK::silc_attribute_get_object(attr, (void *)mime, sizeof(*mime)))
+        break;
+      ptr = (char *)SilcTK::silc_mime_get_field(mime, "Content-Type");
+      if(!ptr) {
+        status_message = QString::fromUtf8
+          ((char *)SilcTK::silc_mime_get_data(mime, NULL));
+        goto mime_free;
+      }
+      mime_type = QString(ptr);
+      if ( mime_type.startsWith("text/plain") 
+           || mime_type.startsWith("text/html") ) {
+        if (mime_type.contains("utf-8")) 
+          status_message = QString::fromUtf8((char *)SilcTK::silc_mime_get_data(mime, NULL));
+        else
+          status_message = QString::fromLatin1((char *)SilcTK::silc_mime_get_data(mime, NULL));
+        if (mime_type.startsWith("text/plain")) 
+          status_message = status_message.replace("\n", "<br>");
+      } 
+      else if ( mime_type.startsWith("multipart/alternate") ) {
+        SilcTK::SilcDList parts = SilcTK::silc_mime_get_multiparts(mime, NULL);
+        SilcTK::SilcMime part;
+
+        SilcTK::silc_dlist_start(parts);
+        while ((part = (SilcTK::SilcMime)SilcTK::silc_dlist_get(parts)) != SILC_LIST_END) {
+          mime_type = SilcTK::silc_mime_get_field(part, "Content-Type");
+
+          if ( mime_type.startsWith("text/plain") 
+               || mime_type.startsWith("text/html") ) {
+            if (mime_type.contains("utf-8"))
+              status_message = QString::fromUtf8((char *)SilcTK::silc_mime_get_data(part, NULL));
+            else
+              status_message = QString::fromLatin1((char *)SilcTK::silc_mime_get_data(part, NULL));
+            if (mime_type.startsWith("text/plain")) 
+              status_message = status_message.replace("\n", "<br>");
+          }
+        }
+      }
+      goto mime_free;
+    case SILC_ATTRIBUTE_PREFERRED_LANGUAGE:
+      memset(&p, 0, sizeof(p));
+      SilcTK::silc_attribute_get_object(attr, (void *)&p, sizeof(p)-1);
+      if(!preferred_language_start) {
+        _language = QString::fromUtf8(p);
+        preferred_language_start = TRUE;
+      }
+      else
+        _language.append(", " + QString::fromUtf8(p));
+      break;
+    case SILC_ATTRIBUTE_TIMEZONE:
+      memset(&p, 0, sizeof(p));
+      SilcTK::silc_attribute_get_object(attr, (void *)&p, sizeof(p)-1);
+      _timezone = QString::fromUtf8(p);
+      break;
+    case SILC_ATTRIBUTE_PREFERRED_CONTACT:
+      SilcTK::silc_attribute_get_object(attr, (void *)&_contactinfo, sizeof(_contactinfo));
+      break;
+    case SILC_ATTRIBUTE_GEOLOCATION:
+      SilcTK::silc_attribute_get_object(attr, (void *)&_geolocation, sizeof(_geolocation));
+      break;
+    case SILC_ATTRIBUTE_USER_ICON:
+      mime = SilcTK::silc_mime_alloc();
+      if (!SilcTK::silc_attribute_get_object(attr, (void *)mime, sizeof(*mime)))
+        break;
+      ptr = (char *)SilcTK::silc_mime_get_field(mime, "Content-Type");
+      if (!ptr)
+        goto mime_free; 
+      
+      mime_type = QString(ptr);
+      if (mime_type.startsWith("image/")) {
+        QString newLocation(locateLocal("appdata", "silcphotos/"+ buddy->fingerprint()));
+
+        ptr = (char *)SilcTK::silc_mime_get_data(mime, &len);
+        if (!ptr || !len) 
+          goto mime_free;
+   
+        QFile file(newLocation);
+        file.open(IO_WriteOnly);
+        file.writeBlock(ptr, len);
+        file.close();
+      
+        QImage image(newLocation);
+        if (image.height() > 96 || image.width() > 96)
+          image = image.smoothScale(96, 96, QImage::ScaleMin);
+        image.save(newLocation, "PNG");
+
+        buddy->setProperty(Kopete::Global::Properties::self()->photo(), newLocation);
+      }
+mime_free:
+      SilcTK::silc_mime_free(mime);
+      break;
+    }
+
+  }
+  if (! status_message.isEmpty())
+    _status_text = status_message;
+  else if (! status_text.isEmpty())
+    _status_text = status_text;
+}
+
+QString 
+SilcBuddyAttributes::getInformations() const
+{
+  QString info;
+  
+  info += i18n("<b><u>Mood:</u></b> ") + getMood() + "<br>";
+  if(!getContact().isEmpty()) 
+    info += i18n("<b><u>Preferred medium:</u></b> ")
+      + getContact() + "<br>";
+  if(_timezone)
+    info += i18n("<b><u>Timezone:</u></b> ") + _timezone + "<br>";
+  if(_language)
+    info += i18n("<b><u>Language:</u></b> ") + _language + "<br>";
+  // FIXME: Hack
+  if(memcmp(&_geolocation, "\0\0\0\0", 4) != 0)
+    info += i18n("<b><u>Location on Earth:</u></b><br>")
+      + "<table><tr><td></td><td>"
+      + i18n("Longitude: ") + _geolocation.longitude + "<br>"
+      + i18n("Latitude: ") + _geolocation.latitude + "<br>"
+      + i18n("Altitude: ") + _geolocation.altitude + "</td></tr></table>";
+  if(_status_text)
+    info += i18n("<b><u>Status Message:</u></b><br>") + _status_text + "<br>";
+
+  return info;
+}
+
+QString
+SilcBuddyAttributes::getContact() const
+{
+  QStringList contacts;
+  if (! _contactinfo)
+    return QString::null;
+
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_EMAIL)
+    contacts.append(i18n("email"));
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_CALL)
+    contacts.append(i18n("phone call"));
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_PAGE)
+    contacts.append(i18n("paging"));
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_SMS)
+    contacts.append(i18n("SMS"));
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_MMS)
+    contacts.append(i18n("MMS"));
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_CHAT)
+    contacts.append(i18n("chatting"));
+  if (_contactinfo & SilcTK::SILC_ATTRIBUTE_CONTACT_VIDEO)
+    contacts.append(i18n("video conference"));
+
+  if (contacts.size() == 0)
+    return QString::null;
+  return contacts.join(", ");
+}
+
+QString 
+SilcBuddyAttributes::getMood() const
+{
+  QStringList moods;
+  /* I love vim macros */
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_HAPPY)
+    moods.append(i18n("happy"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_SAD)
+    moods.append(i18n("sad"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_ANGRY)
+    moods.append(i18n("angry"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_JEALOUS)
+    moods.append(i18n("jealous"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_ASHAMED)
+    moods.append(i18n("ashamed"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_INVINCIBLE)
+    moods.append(i18n("invincible"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_INLOVE)
+    moods.append(i18n("in love"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_SLEEPY)
+    moods.append(i18n("sleepy"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_BORED)
+    moods.append(i18n("bored"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_EXCITED)
+    moods.append(i18n("excited"));
+  if (_mood & SilcTK::SILC_ATTRIBUTE_MOOD_ANXIOUS)
+    moods.append(i18n("anxious"));
+
+  if (moods.size() == 0)
+    moods.append(QString(i18n("normal")));
+
+  return moods.join(", ");
+}
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddyattributes.h Mon May 28 17:34:43 2007
@@ -1,0 +1,117 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCBUDDYATTRIBUTES_H
+#define KOPETESILC_SILCBUDDYATTRIBUTES_H
+
+#include <qstring.h>
+
+#include <klocale.h>
+
+// include libsilc stuff into a separate namespace
+namespace SilcTK {
+#include <silc.h>
+#include <silcclient.h>
+}
+
+//#include "silcprotocol.h"
+//#include "silccontact.h"
+
+class SilcBuddyContact;
+
+/**
+ * @brief class for managing silcattributes
+ *
+ * every SilcBuddyContact has an attributes field, where his SilcAttributes
+ * are managed
+ *
+ * @author Christian Dietrich <stettberger at brokenpipe.de>
+ */
+
+class SilcBuddyAttributes {
+public:
+
+  SilcBuddyAttributes(SilcBuddyContact *);
+  virtual ~SilcBuddyAttributes();
+
+  void updateAttributes(SilcTK::SilcDList attrs);
+
+  QString getInformations() const;
+
+private:
+  /**
+   * @brief SilcBuddyContact this attributes belongs to
+   */
+  SilcBuddyContact *buddy;
+
+  /**
+   * @brief SILC_ATTRIBUTE_USER_INFO
+   */
+  SilcTK::SilcVCard _vcard;
+  
+  /**
+   * @brief SILC_ATTRIBUTE_STATUS_MOOD
+   */
+  SilcTK::SilcAttributeMood _mood;
+  
+  /**
+   * @brief SILC_ATTRIBUTE_STATUS_FREETEXT or SILC_ATTRIBUTE_STATUS_MESSAGE 
+   */
+  QString _status_text;
+
+  /**
+   * @brief SILC_ATTRIBUTE_PREFERRED_LANGUAGE
+   */
+  QString _language;
+
+  /**
+   * @brief SILC_ATTRIBUTE_PREFERRED_CONTACT
+   */
+  SilcTK::SilcAttributeContact _contactinfo;
+
+  /**
+   * @brief SILC_ATTRIBUTE_TIMEZONE
+   */
+  QString _timezone;
+
+  /**
+   * @brief SILC_ATTRIBUTE_GEOLOCATION
+   */
+  SilcTK::SilcAttributeObjGeo _geolocation;
+
+  /**
+   * @brief SILC_ATTRIBUTE_USER_ICON
+   *
+   * path to the user icon
+   *
+   */
+  QString _usericon;
+
+  /**
+   * @brief SilcAttributeMood to QString
+   */
+  QString getMood() const;
+  /**
+   * @brief SilcAttributeContact to QString
+   */
+  QString getContact() const;
+};
+
+
+#endif // KOPETESILC_SILCBUDDYATTRIBUTES_H

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,818 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2006 Martin Albrecht <malb at informatik.uni-bremen.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+#include <assert.h>
+
+#include "silcprotocol.h"
+#include "silcaccount.h"
+#include "silcbuddycontact.h"
+#include "silcchannelcontact.h"
+#include "silcbuddycontactinfowidget.h"
+#include "silcfiletransfer.h"
+#include "silcbuddyattributes.h"
+
+#include <kopetemetacontact.h>
+#include <kopetechatsession.h>
+#include <kopeteuiglobal.h>
+
+#include <kmimemagic.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <kstandarddirs.h>
+
+// sorry for this hack, unfortunately we need it for
+// the macros of recent libsilc to work ...
+typedef unsigned char SilcUInt8;
+
+
+SilcBuddyContact::SilcBuddyContact(SilcAccount *account,
+				   const QString &nick, 
+                                   const QString &fingerprint,
+				   Kopete::MetaContact *meta,
+				   const QString &icon)
+  : SilcContact(account, QString("@%1").arg(fingerprint), meta, icon),
+    _channels(), _clientEntries(), _fpTrusted(false), _watched(false), 
+    _allowRichText(false)
+{
+  actionIsOp = NULL;
+  actionKick = NULL;
+
+  attributes = new SilcBuddyAttributes(this);
+
+  setNickName(nick);
+  setFileCapable(true);
+
+  QObject::connect
+    (this, SIGNAL(onlineStatusChanged(Kopete::Contact *,
+                                      const Kopete::OnlineStatus &,
+                                      const Kopete::OnlineStatus &)),
+     this, SLOT(slotOnlineStatusChanged(Kopete::Contact *,
+                                        const Kopete::OnlineStatus &,
+                                        const Kopete::OnlineStatus &)));
+
+  QObject::connect
+    (this, SIGNAL(propertyChanged(Kopete::Contact *, const QString &,
+				  const QVariant &, const QVariant &)),
+     this, SLOT(slotPropertyChanged(Kopete::Contact *, const QString &,
+				    const QVariant &, const QVariant &)));
+}
+ 
+SilcBuddyContact::~SilcBuddyContact() {
+  this->watchme(false);
+  delete attributes;
+}
+
+void
+SilcBuddyContact::slotSendMessage(Kopete::Message &msg,
+				  Kopete::ChatSession *session)
+{
+  if(session != manager()) return;
+
+  SilcAccount *account = static_cast<SilcAccount *>(this->account());
+
+  if(! account->conn()) {
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, 
+       i18n("Unable to send this message now. The protocol is currently "
+	    "offline and does not support offline sending."),
+       i18n( "User is Not Reachable"));
+    return;
+  }
+
+  if(onlineStatus() == SilcProtocol::protocol()->statusDetached) {
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+       i18n("This message cannot be sent right now, since the remote client "
+	    "is currently detached and the protocol does not support "
+	    "offline sending."),
+       i18n("User is Not Reachable"));
+    return;
+  }
+
+  // get plain text message ...
+  SilcTK::SilcMessageFlags flags = SILC_MESSAGE_FLAG_UTF8;
+  unsigned char *buf = NULL;
+  SilcTK::SilcUInt32 buflen = 0;
+  QCString plaintext;
+
+  if(account->signPrivateMessages())
+    flags |= SILC_MESSAGE_FLAG_SIGNED;
+
+  if(allowRichText()) {
+    SilcTK::SilcMime mime = getMessageAsMime(msg);
+    buf = SilcTK::silc_mime_encode(mime, &buflen);
+    SilcTK::silc_mime_free(mime);
+
+    flags |= SILC_MESSAGE_FLAG_DATA;
+  }
+  else {
+    plaintext = msg.plainBody().utf8();
+    buf = (unsigned char *) (const char *) plaintext;
+    buflen = plaintext.length();
+
+    // use of rich text is forbidden, reset message to plain
+    // (so our channel log doesn't show any markup as well)
+    msg.setBody(msg.plainBody());
+  }
+
+  prettyPrintMessage(msg, flags);
+
+  assert(clientEntry());
+
+  // pass message to libsilc ...
+  SilcTK::silc_client_send_private_message
+    (account->client(), account->conn(), clientEntry(), flags,
+     account->sha1hash, buf, buflen);     
+
+  // append message locally ...
+  session->appendMessage(msg);
+  session->messageSucceeded();
+}
+
+
+
+void 
+SilcBuddyContact::silc_private_message(SilcTK::SilcClient client,
+				       SilcTK::SilcClientConnection,
+				       SilcTK::SilcClientEntry sender,
+				       SilcTK::SilcMessagePayload payload,
+				       SilcTK::SilcMessageFlags flags,
+				       const unsigned char *message,
+				       SilcTK::SilcUInt32 message_len)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(client->application);
+  SilcBuddyContact *buddy = (SilcBuddyContact *) sender->context;
+  
+  if(! buddy)
+    buddy = account->contactManager()->createBuddy
+      (sender->nickname, NULL, sender);
+
+  if(! buddy) {
+    std::cerr << "unable to allocate new buddy instance" << std::endl;
+    return;
+  }
+
+  // If the messages is digitally signed, verify it, if possible.
+  SignatureStatus sigstat = Unknown;
+  if (flags & SILC_MESSAGE_FLAG_SIGNED)
+    sigstat = buddy->verifySignature(payload);
+
+  // make sure there's a ChatSession, then add ourself ...
+  Kopete::ChatSession *session = buddy->manager(Kopete::Contact::CanCreate);
+  session->addContact(buddy, Kopete::OnlineStatus::Online);
+
+  // convert Utf8 stuff depending on whether SILC_MESSAGE_FLAG_UTF8 is set
+  QString text;
+  if(flags & SILC_MESSAGE_FLAG_UTF8)
+    text = QString::fromUtf8((const char *) message, message_len);
+  else if(flags & SILC_MESSAGE_FLAG_DATA);
+  else
+    text = QString::fromLatin1((const char *) message, message_len);
+
+  Kopete::Message msg;
+  if(flags & SILC_MESSAGE_FLAG_NOTICE)
+    msg = Kopete::Message(buddy, account->myself(), QString("%1 -*- %2")
+			  .arg(buddy->nickName()).arg(text),
+			  Kopete::Message::Internal,
+			  Kopete::Message::PlainText, QString::null,
+			  Kopete::Message::TypeAction);
+
+  else if(flags & SILC_MESSAGE_FLAG_DATA) {
+    /* SilcMimeMessage */
+    QStringList *filenames;
+    SilcTK::SilcMime tmp = SilcTK::silc_mime_decode(NULL, message, message_len);
+    /* Assemble mime partials */
+    SilcTK::SilcMime mime = buddy->mime_asm(tmp);
+    if (!mime) return;
+
+    QString type = SilcTK::silc_mime_get_field(mime, "Content-Type");
+    if(type.isEmpty()) goto mimeout;
+
+    if (type.left(21).compare("multipart/alternative") == 0) {
+      msg = Kopete::Message(buddy, account->myself(), 
+			    QString::null,
+			    Kopete::Message::Inbound,
+			    Kopete::Message::PlainText, QString::null,
+			    Kopete::Message::TypeNormal);
+      buddy->mimeAlternateToMsg(msg, mime, buddy->allowRichText());
+      session->appendMessage(msg);
+    }
+    else {
+      filenames = buddy->saveMime(mime);
+      for(QStringList::Iterator it = filenames->begin(); 
+	  it != filenames->end(); ++it ) {
+        msg = Kopete::Message(buddy, account->myself(),
+                              buddy->mimeDisplayMessage(*it),
+                              Kopete::Message::Inbound,
+                              Kopete::Message::RichText, QString::null,
+                              Kopete::Message::TypeNormal);
+
+        prettyPrintMessage(msg, flags, sigstat);
+        session->appendMessage(msg);
+      }
+      delete filenames;
+    }
+
+mimeout:
+    SilcTK::silc_mime_free(mime);
+    return;
+  }
+  else
+    msg = Kopete::Message(buddy, account->myself(), text, 
+			  Kopete::Message::Inbound,
+			  Kopete::Message::PlainText, QString::null,
+			  (flags & SILC_MESSAGE_FLAG_ACTION)
+			  ? Kopete::Message::TypeAction
+			  : Kopete::Message::TypeNormal);
+
+  prettyPrintMessage(msg, flags, sigstat);
+  session->appendMessage(msg);
+
+  // make sure there's a view associated with this ChatSession ...
+  buddy->view();
+
+  // force online status online, in case buddy was marked offline - we just got
+  // a message, therefore he or she needs to be online :-)
+  //
+  // FIXME, this shouldn't be necessary actually, implement some slotConnected
+  if(buddy->onlineStatus() == SilcProtocol::protocol()->statusOffline)
+    buddy->setOnlineStatus(SilcProtocol::protocol()->statusOnline);
+}
+
+
+void 
+SilcBuddyContact::serialize(QMap<QString, QString> &serializedData,
+			    QMap<QString, QString>&)
+{
+  serializedData["fpTrusted"] = fpTrusted() ? "yes" : "no";
+  serializedData["allowRichText"] = allowRichText() ? "yes" : "no";
+}
+
+/**
+ * note: if we trust some fingerprint we gotta have it's key
+ */
+
+void 
+SilcBuddyContact::setFpTrusted(bool trust)
+{
+  if(trust) {
+    if( !havePublicKey() ) {
+      account()->sendSilcCommand( QString("GETKEY %1").arg(nickName()) );
+    }
+  }
+  _fpTrusted = trust;
+}
+
+QString
+SilcBuddyContact::convFingerprint(const char *fp)
+{
+  QString qfp = QString::null;
+  //asserting 20 byte of valid data
+  for(int i = 0; i<20 ; fp ++) {
+    qfp += ((*fp >> 4) & 0xF) > 9 
+      ? ((*fp >> 4) & 0xF) + 'A' - 10
+      : ((*fp >> 4) & 0xF) + '0';
+    qfp += (*fp & 0xF) > 9 ? (*fp & 0xF) + 'A' - 10 : (*fp & 0xF) + '0';
+    if((++i % 2) == 0 && i!=20 ) qfp += ':'; //&& fp[1]
+    if(i == 10) qfp += ':';
+  }
+
+  return qfp;
+}
+
+
+void 
+SilcBuddyContact::setClientEntry(SilcTK::SilcClientEntry e)
+{
+  int count;
+  for (count = 0; count < _clientEntries.count(); count++)
+    SilcTK::silc_client_unref_client(account()->client(), 
+                                     account()->conn(),
+                                     _clientEntries[count]);
+  _clientEntries.clear();
+
+  if(! e) return;
+  this->addClientEntry(e);
+}
+
+
+void
+SilcBuddyContact::addClientEntry(SilcTK::SilcClientEntry e)
+{
+  assert(e);
+
+  e = SilcTK::silc_client_ref_client(account()->client(), 
+                                     account()->conn(), e);
+
+  _clientEntries.push_back(e);
+  e->context = this;
+}
+
+void
+SilcBuddyContact::removeClientEntry(SilcTK::SilcClientEntry e)
+{
+  assert(e);
+
+  _clientEntries.remove(e);
+  e->context = NULL;
+
+  SilcTK::silc_client_unref_client(account()->client(),
+                                   account()->conn(), e);
+
+  if(_clientEntries.empty()) {
+    // last client entry has been dropped, mark buddy as offline ...
+    this->setOnlineStatus(SilcProtocol::protocol()->statusOffline);
+  }
+}
+
+
+const SilcTK::SilcClientEntry
+SilcBuddyContact::clientEntry(SilcChannelContact *ch) const
+{
+  SilcTK::SilcChannelEntry che = ch->channelEntry();
+  if(! che) return NULL;
+
+  for(unsigned int i = 0; i < this->clientEntriesCount(); i ++) {
+    SilcTK::SilcClientEntry ce = this->clientEntry(i);
+    SilcTK::SilcChannelUser cu = SilcTK::silc_client_on_channel(che, ce);
+    if(cu) return ce;
+  }
+  
+  return NULL;
+}
+
+SilcTK::SilcClientEntry 
+SilcBuddyContact::clientEntry(SilcChannelContact *ch)
+{
+  SilcTK::SilcChannelEntry che = ch->channelEntry();
+  if(! che) return NULL;
+
+  for(unsigned int i = 0; i < this->clientEntriesCount(); i ++) {
+    SilcTK::SilcClientEntry ce = this->clientEntry(i);
+    SilcTK::SilcChannelUser cu = SilcTK::silc_client_on_channel(che, ce);
+    if(cu) return ce;
+  }
+
+  return NULL;
+}
+
+
+void
+SilcBuddyContact::slotIsOp(void)
+{
+  if(! activeManager) return;
+
+  Kopete::ContactPtrList members = activeManager->members();
+  SilcChannelContact *ch = static_cast<SilcChannelContact *>(members.first());
+
+  ch->setOp(this, actionIsOp->isChecked());
+}
+
+
+void
+SilcBuddyContact::slotKick(void)
+{
+
+  if(! activeManager) return;
+
+  Kopete::ContactPtrList members = activeManager->members();
+  SilcChannelContact *ch = static_cast<SilcChannelContact *>(members.first());
+
+  ch->kick(this);
+}
+
+QPtrList<KAction> *
+SilcBuddyContact::customContextMenuActions(Kopete::ChatSession *manager)
+{
+  // store a ptr. to the active ChatSession, we need this, to remember
+  // for which channel we need to supply or drop operator rights, etc. ...
+  activeManager = manager; 
+
+  QPtrList<KAction> *actions = new QPtrList<KAction>();
+
+  if(! actionIsOp)
+    actionIsOp = new KToggleAction(i18n("&Operator"), KShortcut::null(), 
+				   this, SLOT(slotIsOp()), this);
+  
+  if (! actionKick)
+      actionKick = new KAction(i18n("&Kick from Channel"),
+                                    KShortcut::null(), this,
+                                    SLOT(slotKick()), this);
+
+  SilcBuddyContact *me = static_cast<SilcBuddyContact *>(account()->myself());
+  SilcChannelContact *channel = NULL;
+  if(manager) {
+    Kopete::ContactPtrList members = manager->members();
+
+    if(! strcmp(members.first()->className(), "SilcChannelContact"))
+      channel = static_cast<SilcChannelContact *>(members.first());
+  }
+
+  // add operator entry ...
+  actionIsOp->setEnabled(channel && channel->isOp(me));
+  actionIsOp->setChecked(channel && channel->isOp(this));
+  actions->append(actionIsOp);
+
+  actionKick->setEnabled(channel && channel->isOp(me) 
+                        && me != this);
+  actions->append(actionKick);
+  
+  return actions;
+}
+
+
+void
+SilcBuddyContact::slotOnlineStatusChanged(Kopete::Contact *,
+                                          const Kopete::OnlineStatus &status,
+                                          const Kopete::OnlineStatus & /*old*/)
+{
+  if(status == SilcProtocol::protocol()->statusOffline
+     || status.status() == Kopete::OnlineStatus::Unknown) {
+    // assume we're offline, thus left all channels ...
+    setClientEntry(NULL);
+  }
+}
+
+
+void 
+SilcBuddyContact::sendFile(const KURL &sourceURL,
+			   const QString & /* fileName */, uint /* fileSize */)
+{
+  QString filePath;
+
+  if(! sourceURL.isValid())
+    filePath = KFileDialog::getOpenFileName(QString::null, "*", 0L,
+					    i18n("Kopete File Transfer"));
+  else
+    filePath = sourceURL.path(-1);
+
+  QFile file(filePath);
+  if(! file.exists())
+    return;
+
+  if(account()->useSilcMime()) {
+    if (file.size() < (23 << (5 + (2 * 3)))) 
+      sendFileAsMime(filePath);
+    else {
+        int answer = KMessageBox::questionYesNo
+          (Kopete::UI::Global::mainWidget(),
+           QString(i18n("You are trying to send a big file via Silc"
+                        "MIME message. Do you want to send it via Silc"
+                        "Filetransfer?")),
+           i18n("Sending MIME message"));
+        if (answer == KMessageBox::Yes) 
+          new SilcFileTransfer(account(), this, filePath);
+        else
+          sendFileAsMime(filePath);
+    }
+  }
+  else 
+    new SilcFileTransfer(account(), this, filePath);
+}
+
+
+void 
+SilcBuddyContact::slotUserInfo(void)
+{
+  new SilcBuddyContactInfoWidget(this);;
+}
+
+
+/**
+ * @short verify the validity of the signature on the provided message
+ * @todo we should have a locally stored public key cache
+ */
+SilcContact::SignatureStatus 
+SilcBuddyContact::verifySignature(SilcTK::SilcMessagePayload message)
+{
+  // get public key from the signature payload and compare it with the
+  // one stored in the client entry
+  const unsigned char *pk_data;
+  SilcTK::SilcUInt32 pk_datalen;
+  SilcTK::SilcPublicKey pk = 
+     silc_message_signed_get_public_key(message, &pk_data, &pk_datalen);
+
+  SilcContact::SignatureStatus retval;
+  QString fp;
+  if(pk) {
+    // extract the fingerprint from the signatures public key
+    char *fpKey = SilcTK::silc_hash_fingerprint(NULL, pk_data, pk_datalen);
+    fp = QString(fpKey).replace(QChar(' '), QChar(':'));
+    free(fpKey);
+
+    // compare the stored fingerprint with the received key's one
+    if(fp.compare(fingerprint()) == 0)
+      retval = fpTrusted() ? Trusted : Valid;
+    else
+      retval = Unknown;
+  }
+  
+  else {
+    fp = fingerprint();
+    retval = fpTrusted() ? Trusted : Valid;
+  }
+
+  QString fn = publicKeyPath(fp);
+  if(QFile::exists(fn)) {
+    if(pk) SilcTK::silc_pkcs_public_key_free(pk);
+    if (! SilcTK::silc_pkcs_load_public_key(fn.latin1(), &pk) &&
+	! SilcTK::silc_pkcs_load_public_key(fn.latin1(), &pk))
+      return Unknown;
+  }
+  
+  // if we don't have a public key, we simply cannot verify ...
+  if(! pk) return Unknown;
+  
+  // check whether the signature is valid
+  if(SilcTK::silc_message_signed_verify
+     (message, pk, account()->sha1hash) != SILC_AUTH_OK)
+    retval = Failed;
+
+  SilcTK::silc_pkcs_public_key_free(pk);
+  return retval;
+}
+
+/**
+ * returns the path to look for the clients public key.
+ *
+ * The returned filename is of the form 
+ @verbatim
+  $kopete_appdata/kopete_silc_clientkeys/clientkey_XXXX_XXXX_XXXX_XXXX_XXXX__XXXX_XXXX_XXXX_XXXX_XXXX.pub
+ @endverbatim
+ *
+ * @param fp provide a fingerprint
+ */
+
+const QString 
+SilcBuddyContact::publicKeyPath(const QString fp) 
+{
+  QString fn = locateLocal("appdata",
+			   QString("kopete_silc_clientkeys/clientkey_%1.pub")
+			   .arg(QString(fp).replace(":","_")));
+  return fn;
+}
+
+/**
+ * Behaves like the above function but receives fingerprint from this buddy.
+ */
+
+const QString 
+SilcBuddyContact::publicKeyPath(void) const {
+  return SilcBuddyContact::publicKeyPath(this->fingerprint());
+}
+
+/**
+ * performs a WHOIS request for a buddy.
+ *
+ * If possible a known public key is used. 
+ *
+ * @returns true if has be called with public key and false otherwise
+ */
+
+bool 
+SilcBuddyContact::whoami(void) 
+{
+  QString fp = publicKeyPath();
+  if(QFile::exists(fp)) {
+    account()->sendSilcCommand( QString("WHOIS -pubkey %1 -details")
+				.arg(fp.latin1()) ); 
+    return true;
+  } else {
+    account()->sendSilcCommand( QString("WHOIS %1 -details")
+				.arg(nickName()) ); 
+    return false;
+  }
+}
+
+/**
+ * @brief either add or remote the buddy from the watch list
+ *
+ * @return whether public keys are used for watching
+ */
+ /*
+ * This seems to be wrong, pubkey watch of offline buddies and libsilc
+ * 1.0.3 works 
+ *
+ *   We rely on always watching using the nickname, i.e. never use the 
+ *   public key for watching purposes. This is simply because we cannot
+ *   watch offline buddies using public key approach ...
+ *
+ *   ... and first testing whether the buddy is offline before setting the
+ *   suitable watch is painful.
+ *
+ *   @return whether public keys are used for watching, i.e. always false
+ */
+bool
+SilcBuddyContact::watchme(bool watch)
+{ 
+  QString fp = this->publicKeyPath();
+  this->_watched = watch;
+
+  if(! watch) {
+    if(QFile::exists(fp)) {
+      account()->sendSilcCommand(QString("WATCH -pubkey -%1").arg(fp.latin1()),
+                                 (SilcTK::SilcClientCommandReply) 
+                                 watchme_callback, 
+                                 this);
+      return true;
+    } else {
+      // @fixme check whether there is another buddy with this
+      // nickname, which we might disable watching for, ...
+      account()->sendSilcCommand(QString("WATCH -del %1").arg(nickName()),
+                                 (SilcTK::SilcClientCommandReply)
+                                 watchme_callback, 
+                                 this);
+      return false;
+    }
+  } else {
+    if(QFile::exists(fp)) {
+     account()->sendSilcCommand(QString("WATCH -pubkey +%1").arg(fp.latin1()),
+                                (SilcTK::SilcClientCommandReply)
+                                watchme_callback, 
+                                this);
+     return true;
+    } else {
+      account()->sendSilcCommand(QString("WATCH -add %1").arg(nickName()),
+                                 (SilcTK::SilcClientCommandReply)
+                                 watchme_callback, 
+                                 this);
+      return false;
+    }
+  }
+}
+
+/*
+ * @brief callback for buddy->watchme to retry the watch, if it fails
+ */
+
+bool
+SilcBuddyContact::watchme_callback(SilcTK::SilcClient,
+                 SilcTK::SilcClientConnection,
+                 SilcTK::SilcCommand,
+                 SilcTK::SilcStatus status,
+                 SilcTK::SilcStatus error,
+                 void *context,
+                 va_list)
+{
+  SilcBuddyContact *buddy = (SilcBuddyContact *) context;
+  if(status != SILC_STATUS_OK && ( error == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
+                                   || error == SILC_STATUS_ERR_TIMEDOUT))
+    buddy->watchme(buddy->watched());
+  return false;
+}
+
+
+/**
+* Updates the local cache of WHOIS information which may be displayerd
+* via the user information interface.
+*
+*/
+
+void
+SilcBuddyContact::updateWhois(QString username, QString realname) {
+  this->_username=username;
+  this->_realname=realname;
+  this->_update=QDateTime::currentDateTime();
+  emit signalWhois(this->nickName(),username,realname);
+}
+
+
+/**
+ * returns true if a public key matching a given fingerprint is found locally.
+ */
+bool 
+SilcBuddyContact::havePublicKey(QString fp) 
+{
+  return QFile::exists(SilcBuddyContact::publicKeyPath(fp));
+}
+
+/**
+ * behaves essentially as the above function but receives the fingerprint from
+ * this buddy.
+ */
+
+bool
+SilcBuddyContact::havePublicKey(void) {
+  return SilcBuddyContact::havePublicKey(this->fingerprint());
+}
+
+
+/**
+ * make sure to update /watch status in case of nickname changes 
+ */
+void 
+SilcBuddyContact::slotPropertyChanged(Kopete::Contact *contact,
+				      const QString &key,
+				      const QVariant &oldValue,
+				      const QVariant &)
+{
+  if(contact != this) return;
+  if(key.compare("nickName")) return;
+  
+  if(! _watched) return;
+
+  // @fixme check whether there is another buddy with this nickname, which
+  // we might disable watching for, ...
+  if(! oldValue.toString().isNull())
+    account()->sendSilcCommand(QString("WATCH -del %1")
+			       .arg(oldValue.toString()));
+  watchme(true);
+}
+
+void 
+SilcBuddyContact::sendFileAsMime(const QString &fileName) 
+{
+  int chunks = 0;
+  SilcTK::SilcBuffer buffer;
+  QFile file(fileName);
+  Kopete::ChatSession *session = manager(Kopete::Contact::CanCreate);
+
+  /* Sending Chunks */
+  SilcTK::SilcDList parts = getFileAsMime(fileName);
+  SilcTK::silc_dlist_start(parts);
+  while ((buffer = (SilcTK::SilcBuffer)SilcTK::silc_dlist_get(parts)) != SILC_LIST_END) { 
+    chunks++;
+    SilcTK::silc_client_send_private_message
+      (account()->client(), account()->conn(), clientEntry(), 
+       SILC_MESSAGE_FLAG_DATA, account()->sha1hash, 
+       (unsigned char*)buffer->data, (buffer->end - buffer->data));
+  }
+  SilcTK::silc_mime_partial_free(parts);
+
+  
+  Kopete::Message msg = 
+    Kopete::Message(account()->myself(), this, 
+		    account()->myself()->mimeDisplayMessage(fileName, chunks),
+                    Kopete::Message::Outbound,
+                    Kopete::Message::RichText, QString::null,
+                    Kopete::Message::TypeNormal);
+  
+
+  session->appendMessage(msg);
+  session->messageSucceeded();
+}
+
+void 
+SilcBuddyContact::mimeAlternateToMsg( Kopete::Message &msg, 
+                                      SilcTK::SilcMime mime,
+                                      bool allowRichText) const
+{
+  SilcTK::SilcDList parts = SilcTK::silc_mime_get_multiparts(mime, NULL);
+  SilcTK::SilcMime part;
+  QString type, text, html;
+
+  SilcTK::silc_dlist_start(parts);
+  while ((part = (SilcTK::SilcMime)SilcTK::silc_dlist_get(parts)) != SILC_LIST_END) {
+    type = SilcTK::silc_mime_get_field(part, "Content-Type");
+    if(type.left(10).compare("text/plain") == 0) {
+      if (type.contains("utf-8"))
+        text = QString::fromUtf8((char *)SilcTK::silc_mime_get_data(part, NULL));
+      else
+        text = QString::fromLatin1((char *)SilcTK::silc_mime_get_data(part, NULL));
+    }
+    else if(type.left(9).compare("text/html") == 0) {
+      if (type.contains("utf-8"))
+        html = QString::fromUtf8((char *)SilcTK::silc_mime_get_data(part, NULL));
+      else
+        html = QString::fromLatin1((char *)SilcTK::silc_mime_get_data(part, NULL));
+    }
+  }
+  if ( ! allowRichText || html.isEmpty())
+    /* Use text */
+    msg.setBody(text, Kopete::Message::PlainText);  
+  else 
+    msg.setBody(html, Kopete::Message::RichText);
+}
+
+SilcBuddyContactData::SilcBuddyContactData(SilcAccount * account, 
+                                                QString nickName,
+                                                QString finger,
+                                                Kopete::MetaContact *meta)
+ :nickname(nickName),finger(finger),meta(meta),account(account)
+{
+  return; 
+}
+
+#include "silcbuddycontact.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddycontact.h Mon May 28 17:34:43 2007
@@ -1,0 +1,240 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2006 Martin Albrecht <malb at informatik.uni-bremen.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCBUDDYCONTACT_H
+#define KOPETESILC_SILCBUDDYCONTACT_H
+
+#include <kaction.h>
+#include <kactionclasses.h>
+#include <qdatetime.h>
+
+#include "silccontact.h"
+
+class SilcBuddyAttributes;
+class SilcChannelContact;
+
+/**
+ * @brief Reimplementation of Kopete::Contact class, used for SILC Users
+ *
+ * Every user of the connected SILC network will have it's very own
+ * SilcBuddyContact class associated as soon as he or she is known to
+ * kopete_silc.  This is as soon as he or she joins a joined chat session,
+ * incoming private message, etc.
+ * 
+ * @author Stefan Siegl <ssiegl at gmx.de>
+ */
+class SilcBuddyContact : public SilcContact {
+  Q_OBJECT;
+
+public:
+
+  SignatureStatus verifySignature(SilcTK::SilcMessagePayload payload);
+
+  SilcBuddyContact(SilcAccount *account,
+		   const QString &nickname,
+		   const QString &fingerprint,
+		   Kopete::MetaContact *meta,
+		   const QString &icon = QString::null);
+  virtual ~SilcBuddyContact();
+
+
+  /**
+   * @brief return a pointer to the first associated client entry
+   */
+  inline SilcTK::SilcClientEntry clientEntry(unsigned int i = 0)
+  {
+    if(_clientEntries.empty() || i > _clientEntries.count()) return NULL;
+    return _clientEntries[i];
+  }
+
+  inline const SilcTK::SilcClientEntry clientEntry(unsigned int i = 0) const 
+  {
+    if(_clientEntries.empty() || i > _clientEntries.count()) return NULL;
+    return _clientEntries[i];
+  }
+
+  const SilcTK::SilcClientEntry clientEntry(SilcChannelContact *ch) const;
+  
+  SilcTK::SilcClientEntry clientEntry(SilcChannelContact *ch);
+
+  KDE_DEPRECATED inline const unsigned int clientEntriesCount(void) const
+  {
+    return _clientEntries.count();
+  }
+
+  /**
+   * @brief reset the list of associated client entries, add the provided one
+   */
+  void setClientEntry(SilcTK::SilcClientEntry e);
+
+  /**
+   * @brief add the provided client entry to the list of associated entries
+   */
+  void addClientEntry(SilcTK::SilcClientEntry e);
+
+  /**
+   * @brief remove the provided client entry from the list of associated ones
+   */
+  void removeClientEntry(SilcTK::SilcClientEntry e);
+
+
+  inline const QString fingerprint(void) const 
+  {
+    return contactId().mid(1);
+  }
+
+  bool fpTrusted(void) const
+  {
+    return _fpTrusted;
+  }
+
+  void setFpTrusted(bool trusted);
+
+  inline const QStringList &channelList(void) const
+  {
+    return _channels;
+  }
+
+  inline bool allowRichText(void) const { return _allowRichText; };
+  inline void setAllowRichText(bool v) { _allowRichText = v; };
+
+  void setChannelList(QStringList &list) 
+  {
+    _channels = list;
+  }
+
+  static QString convFingerprint(const char *);
+
+  static void silc_private_message(SilcTK::SilcClient client,
+				   SilcTK::SilcClientConnection conn,
+				   SilcTK::SilcClientEntry sender,
+				   SilcTK::SilcMessagePayload payload,
+				   SilcTK::SilcMessageFlags flags,
+				   const unsigned char *message,
+				   SilcTK::SilcUInt32 message_len);
+
+  static const QString publicKeyPath(QString fp);
+  const QString publicKeyPath(void) const;
+  static bool havePublicKey(QString fp);
+  bool havePublicKey(void);
+  bool whoami(void);
+  void updateWhois(QString username, QString realname);
+
+  /**
+   * @brief either add or remote the buddy from the watch list
+   */
+  bool watchme(bool watch);
+  static bool watchme_callback(SilcTK::SilcClient client,
+                 SilcTK::SilcClientConnection conn,
+                 SilcTK::SilcCommand command,
+                 SilcTK::SilcStatus status,
+                 SilcTK::SilcStatus error,
+                 void *context,
+                 va_list ap);
+
+  inline bool watched(void) const  { return _watched; };
+
+  virtual void serialize(QMap<QString, QString>&, QMap<QString, QString>&);
+
+  virtual QPtrList<KAction> *customContextMenuActions(Kopete::ChatSession *);
+
+  virtual void sendFile(const KURL &sourceURL = KURL(),
+			const QString &fileName = QString::null,
+			uint fileSize = 0L);
+
+  virtual void slotUserInfo(void);
+
+  void mimeAlternateToMsg( Kopete::Message &, SilcTK::SilcMime, bool) const;
+
+  /* this data is provided by WHOIS */
+  QString _username;
+  QString _realname;
+  QStringList _channels;
+  QDateTime _update;
+
+  
+  /**
+   * @brief send file as mime to contact
+   */
+  virtual void sendFileAsMime(const QString &fileName);
+
+  /**
+   * @brief SilcBuddyAttributes of this buddy
+   */
+  SilcBuddyAttributes *attributes;
+
+signals:
+  void signalWhois(QString nickname, QString username, QString realname);
+
+public slots:
+  void slotIsOp(void);
+  void slotKick(void);
+
+protected slots:
+  /**
+   * @brief send private message to the SILC network
+   */
+  virtual void slotSendMessage(Kopete::Message &, Kopete::ChatSession *);
+
+private slots:
+  /**
+   * @brief reset _clientEntry to NULL if we went offline
+   */
+  void slotOnlineStatusChanged(Kopete::Contact *contact,
+			       const Kopete::OnlineStatus &status,
+			       const Kopete::OnlineStatus &oldStatus);
+
+  void slotPropertyChanged(Kopete::Contact *contact, const QString &key,
+			   const QVariant &oldValue,
+			   const QVariant &newValue);
+
+private:
+  QValueList<SilcTK::SilcClientEntry> _clientEntries;
+  bool _fpTrusted;
+  bool _watched;
+  bool _allowRichText;
+
+  Kopete::ChatSession *activeManager;
+  KToggleAction *actionIsOp;
+  KAction *actionKick;
+};
+
+/**
+ * Pending Buddies have this format
+ *
+ */
+
+class SilcBuddyContactData {
+  public:
+  QString nickname;
+  QString finger;
+  Kopete::MetaContact *meta;
+  SilcAccount *account; 
+
+  SilcBuddyContactData(SilcAccount * account, 
+                       QString nickname,
+                       QString finger,
+                       Kopete::MetaContact *meta);
+  inline QString &nickName() { return nickname; }
+
+};
+
+#endif // KOPETESILC_SILCBUDDYCONTACT_H

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfo.ui
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfo.ui?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfo.ui (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfo.ui Mon May 28 17:34:43 2007
@@ -1,0 +1,392 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SilcBuddyContactInfo</class>
+<widget class="QDialog">
+    <property name="name">
+        <cstring>SilcBuddyContactInfo</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>476</width>
+            <height>335</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>Silc User Info</string>
+    </property>
+    <vbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="QTabWidget">
+            <property name="name">
+                <cstring>tabWidget3</cstring>
+            </property>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>General</string>
+                </attribute>
+                <grid>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLineEdit" row="3" column="1">
+                        <property name="name">
+                            <cstring>update</cstring>
+                        </property>
+                        <property name="readOnly">
+                            <bool>true</bool>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="2" column="0">
+                        <property name="name">
+                            <cstring>_channels</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Channels:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="1" column="1">
+                        <property name="name">
+                            <cstring>realname</cstring>
+                        </property>
+                        <property name="readOnly">
+                            <bool>true</bool>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="0" column="1">
+                        <property name="name">
+                            <cstring>nickname</cstring>
+                        </property>
+                        <property name="readOnly">
+                            <bool>true</bool>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="2" column="1">
+                        <property name="name">
+                            <cstring>channels</cstring>
+                        </property>
+                        <property name="readOnly">
+                            <bool>true</bool>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="1" column="0">
+                        <property name="name">
+                            <cstring>_realname</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Real name:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="3" column="0">
+                        <property name="name">
+                            <cstring>_update</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Last update:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="0" column="0">
+                        <property name="name">
+                            <cstring>_nickname</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Nickname:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                    </widget>
+                    <spacer row="4" column="1">
+                        <property name="name">
+                            <cstring>spacer5</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Fixed</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>25</height>
+                            </size>
+                        </property>
+                    </spacer>
+                    <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="2">
+                        <property name="name">
+                            <cstring>chkAllowRichText</cstring>
+                        </property>
+                        <property name="text">
+                            <string>allo&amp;w rich text markup</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+W</string>
+                        </property>
+                    </widget>
+                    <spacer row="6" column="1">
+                        <property name="name">
+                            <cstring>spacer11</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>41</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </grid>
+            </widget>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>Fingerprint</string>
+                </attribute>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLayoutWidget">
+                        <property name="name">
+                            <cstring>layout10</cstring>
+                        </property>
+                        <hbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLabel">
+                                <property name="name">
+                                    <cstring>_fingerprint</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>5</hsizetype>
+                                        <vsizetype>1</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="text">
+                                    <string>Fingerprint:</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit">
+                                <property name="name">
+                                    <cstring>fingerprint</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>7</hsizetype>
+                                        <vsizetype>0</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="readOnly">
+                                    <bool>true</bool>
+                                </property>
+                            </widget>
+                        </hbox>
+                    </widget>
+                    <widget class="QLayoutWidget">
+                        <property name="name">
+                            <cstring>layout11</cstring>
+                        </property>
+                        <hbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <spacer>
+                                <property name="name">
+                                    <cstring>spacer1</cstring>
+                                </property>
+                                <property name="orientation">
+                                    <enum>Horizontal</enum>
+                                </property>
+                                <property name="sizeType">
+                                    <enum>Expanding</enum>
+                                </property>
+                                <property name="sizeHint">
+                                    <size>
+                                        <width>343</width>
+                                        <height>32</height>
+                                    </size>
+                                </property>
+                            </spacer>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>fpTrusted</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>5</hsizetype>
+                                        <vsizetype>5</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="minimumSize">
+                                    <size>
+                                        <width>0</width>
+                                        <height>32</height>
+                                    </size>
+                                </property>
+                                <property name="text">
+                                    <string>&amp;Trusted</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+T</string>
+                                </property>
+                            </widget>
+                        </hbox>
+                    </widget>
+                    <spacer>
+                        <property name="name">
+                            <cstring>spacer12</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>21</width>
+                                <height>161</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </vbox>
+            </widget>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>TabPage</cstring>
+                </property>
+                <attribute name="title">
+                    <string>Attributes</string>
+                </attribute>
+                <hbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLabel">
+                        <property name="name">
+                            <cstring>labelAttributes</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>7</hsizetype>
+                                <vsizetype>7</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignTop</set>
+                        </property>
+                    </widget>
+                </hbox>
+            </widget>
+        </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout5</cstring>
+            </property>
+            <hbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <spacer>
+                    <property name="name">
+                        <cstring>Horizontal Spacing2</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>160</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonOk</cstring>
+                    </property>
+                    <property name="enabled">
+                        <bool>true</bool>
+                    </property>
+                    <property name="text">
+                        <string>&amp;OK</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+O</string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                    <property name="default">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonApply</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Apply</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+A</string>
+                    </property>
+                </widget>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonCancel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Cancel</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+C</string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,99 @@
+// Copyright(C) 2005,2006 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2006 Martin Albrecht <malb at informatik.uni-bremen.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+
+#include "silcbuddycontactinfowidget.h"
+#include "silcbuddycontact.h"
+#include "silcbuddyattributes.h"
+
+#include <kdebug.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+SilcBuddyContactInfoWidget::SilcBuddyContactInfoWidget(SilcBuddyContact *b)
+  : SilcBuddyContactInfo(), _buddy(b)
+{
+  b->whoami();
+  fingerprint->setText(b->fingerprint());
+  fpTrusted->setChecked(b->fpTrusted());
+  chkAllowRichText->setChecked(b->allowRichText());
+  nickname->setText(QString("%1 (%2)").arg(b->nickName()).arg(b->_username));
+  realname->setText(QString(b->_realname));
+  update->setText(b->_update.toString("dd.MM.yyyy hh:mm:ss"));
+  labelAttributes->setText(b->attributes->getInformations()); 
+
+  // show list of channels ...
+  channels->setText(b->channelList().join(" "));
+
+  QObject::connect((QObject *) buttonApply, SIGNAL(clicked()),
+		   this, SLOT(slotApply()));
+  QObject::connect((QObject *) buttonOk, SIGNAL(clicked()),
+		   this, SLOT(slotOk()));
+  QObject::connect((QObject *) buttonCancel, SIGNAL(clicked()),
+		   this, SLOT(slotCancel()));
+
+  QObject::connect((QObject *)b, SIGNAL(signalWhois(QString, QString, QString)),
+		   this, SLOT(slotWhois(QString, QString, QString)));
+
+  show();
+}
+
+SilcBuddyContactInfoWidget::~SilcBuddyContactInfoWidget()
+{
+}
+
+void
+SilcBuddyContactInfoWidget::slotApply(void)
+{
+  _buddy->setFpTrusted(fpTrusted->isChecked());
+  _buddy->setAllowRichText(chkAllowRichText->isChecked());
+}
+
+void
+SilcBuddyContactInfoWidget::slotOk(void)
+{
+  slotApply();
+  delete this;
+}
+
+void
+SilcBuddyContactInfoWidget::slotCancel(void)
+{
+  delete this;
+}
+
+void
+SilcBuddyContactInfoWidget::slotWhois(QString _nickname, QString _username,
+QString _realname)
+{
+  nickname->setText(QString("%1 (%2)").arg(_nickname).arg(_username));
+  realname->setText(QString(_realname));
+  update->setText(QDateTime::currentDateTime().
+		  toString("dd.MM.yyyy hh:mm:ss"));
+
+  // show list of channels ...
+  channels->setText(_buddy->channelList().join(" "));
+  // Show Attributes 
+  labelAttributes->setText(_buddy->attributes->getInformations()); 
+}
+
+
+#include "silcbuddycontactinfowidget.moc"
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcbuddycontactinfowidget.h Mon May 28 17:34:43 2007
@@ -1,0 +1,45 @@
+//                     -*- mode: C++ -*-
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCBUDDYCONTACTINFOWIDGET_H
+#define SILCBUDDYCONTACTINFOWIDGET_H
+
+#include "silcbuddycontactinfo.h"
+
+class SilcBuddyContact;
+class SilcBuddyContactInfoWidget : private SilcBuddyContactInfo
+{
+  Q_OBJECT
+
+public:
+  SilcBuddyContactInfoWidget(SilcBuddyContact *buddy);
+  ~SilcBuddyContactInfoWidget();
+
+private slots:
+  void slotOk(void);
+  void slotApply(void);
+  void slotCancel(void);
+  void slotWhois(QString nickname, QString username,QString realname);
+
+private:
+  SilcBuddyContact *_buddy;
+
+};
+
+#endif
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,758 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+#include <assert.h>
+
+#include "silcaccount.h"
+#include "silcchannelcontact.h"
+#include "silcchannelcontactinfowidget.h"
+#include "silcbuddycontact.h"
+#include "silcmessagemanager.h"
+
+#include <kopetemetacontact.h>
+#include <kopetemessage.h>
+#include <kopetechatsession.h>
+#include <kopetechatsessionmanager.h>
+#include <kopeteuiglobal.h>
+#include <ui/kopeteview.h>
+#include <kdebug.h>
+#include <qfileinfo.h>
+#include <qcstring.h>
+#include <kmimemagic.h>
+#include <kfiledialog.h>
+
+#include <klocale.h>
+#include <kmessagebox.h>
+
+
+// sorry for this hack, unfortunately we need it for
+// the macros of recent libsilc to work ...
+typedef unsigned char SilcUInt8;
+typedef SilcTK::SilcUInt32 SilcUInt32;
+
+SilcChannelContact::SilcChannelContact(SilcAccount *account,
+				       const QString &channel, 
+				       Kopete::MetaContact *meta,
+				       const QString &icon)
+  : SilcContact(account, QString("#%1").arg(channel), meta, icon),
+    _channelEntry(NULL), _allowRichText(false)
+{
+  modeToBeSet = 0;
+  setNickName(channel);
+
+  QObject::connect
+    (this, SIGNAL(onlineStatusChanged(Kopete::Contact *,
+				      const Kopete::OnlineStatus &, 
+				      const Kopete::OnlineStatus &)),
+     this, SLOT(slotOnlineStatusChanged(Kopete::Contact *,
+					const Kopete::OnlineStatus &,
+					const Kopete::OnlineStatus &)));
+
+  if(account->isConnected())
+    setOnlineStatus(SilcProtocol::protocol()->statusOnlineChannel);
+}
+ 
+SilcChannelContact::~SilcChannelContact() { }
+
+Kopete::ChatSession *
+SilcChannelContact::manager(Kopete::Contact::CanCreateFlags flags)
+{
+  Kopete::ChatSession *session =
+    SilcContact::manager(Kopete::Contact::CannotCreate);
+
+  if(! session && (flags & Kopete::Contact::CanCreate)) {
+    session = SilcContact::manager(flags);
+
+    if(_channelEntry)
+      setNickNameForMode(_channelEntry->mode);
+
+    // update myselves status, this is, show op crown, etc. if we got one
+    SilcBuddyContact *b = static_cast<SilcBuddyContact *>(account()->myself());
+    updateBuddyOnlineStatus(b);
+  }
+
+  return session;
+}
+
+/**
+ * @brief join the channel
+ *
+ * We need this wrapper around the more specialized join function in order
+ * to overwrite the join method from the SilcContact class.
+ */
+void
+SilcChannelContact::join(void)
+{
+  join(false, false, QString::null);
+}
+
+void
+SilcChannelContact::join(bool founder, bool auth, const QString &password)
+{
+  if(_joined) return;
+
+  SilcAccount *account = static_cast<SilcAccount *>(this->account());
+
+  if(! account->isConnected()) {
+    KMessageBox::error(Kopete::UI::Global::mainWidget(),
+		       i18n("Sorry, you cannot join channels unless "
+			    "you go online"), i18n("SILC Plugin"));
+    return;
+  }
+
+  QString arg = QString("JOIN %1 %2").arg(nickName()).arg(password);
+
+  if(founder)
+    arg.append(" -founder");
+
+  if(auth)
+    arg.append(" -auth");
+
+  account->sendSilcCommand(arg);
+  setFileCapable(true);
+}
+
+
+
+void
+SilcChannelContact::setChannelEntry(SilcTK::SilcChannelEntry e)
+{
+  _channelEntry = e;
+  if(e) e->context = this;
+  
+  _joined = e != NULL;
+
+  if(modeToBeSet && e->mode != modeToBeSet) {
+    _channelEntry->mode = modeToBeSet;
+    commitModeChange();
+    modeToBeSet = 0;
+  }
+
+  SilcBuddyContact *buddy;
+  for (buddy = toInvite.first(); buddy; buddy = toInvite.next() )
+    invite(buddy);
+  toInvite.clear();
+}
+
+
+void
+SilcChannelContact::slotSendMessage(Kopete::Message &msg,
+				    Kopete::ChatSession *session)
+{
+  if(session != manager())
+    return;
+
+  SilcAccount *account = static_cast<SilcAccount *>(this->account());
+
+  if(! account->conn()) {
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, 
+       i18n("Unable to send this message now. The protocol is currently "
+	    "offline and does not support offline sending."),
+       i18n( "User is Not Reachable"));
+    return;
+  }
+
+  // get plain text message ...
+  SilcTK::SilcMessageFlags flags = SILC_MESSAGE_FLAG_UTF8;
+  unsigned char *buf = NULL;
+  SilcTK::SilcUInt32 buflen = 0;
+  QCString plaintext;
+
+  if(account->signChannelMessages())
+    flags |= SILC_MESSAGE_FLAG_SIGNED;
+
+  if(allowRichText()) {
+    SilcTK::SilcMime mime = getMessageAsMime(msg);
+    buf = SilcTK::silc_mime_encode(mime, &buflen);
+    SilcTK::silc_mime_free(mime);
+
+    flags |= SILC_MESSAGE_FLAG_DATA;
+  }
+  else {
+    plaintext = msg.plainBody().utf8();
+    buf = (unsigned char *) (const char *) plaintext;
+    buflen = plaintext.length();
+
+    // use of rich text is forbidden, reset message to plain
+    // (so our channel log doesn't show any markup as well)
+    msg.setBody(msg.plainBody());
+  }
+
+  prettyPrintMessage(msg, flags);
+
+  // pass message to libsilc ...
+  SilcTK::silc_client_send_channel_message
+    (account->client(), account->conn(), channelEntry(), NULL, flags,
+     account->sha1hash, buf, buflen);
+  
+  if(allowRichText())
+    SilcTK::silc_free(buf);
+   
+  // append message locally ...
+  session->appendMessage(msg);
+  session->messageSucceeded();
+}
+
+void
+SilcChannelContact::slotOnlineStatusChanged(Kopete::Contact *,
+					    const Kopete::OnlineStatus &status,
+					    const Kopete::OnlineStatus &old)
+{
+  if(status == SilcProtocol::protocol()->statusOffline
+     || status.status() == Kopete::OnlineStatus::Unknown) {
+    // assume we're offline, thus left all channels ...
+    setChannelEntry(NULL);
+    return;
+  }
+
+  if(old != SilcProtocol::protocol()->statusOffline
+     && old.status() != Kopete::OnlineStatus::Unknown) return;
+
+  if(manager())
+    join(); // autojoin the channel, if there's an open window for it ...
+}
+
+
+void
+SilcChannelContact::leave(void)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(this->account());
+  account->sendSilcCommand(QString("LEAVE %1").arg(nickName()));
+  setChannelEntry(NULL); // libsilc frees the channel entry after leaving
+  setFileCapable(false);
+}
+
+
+bool
+SilcChannelContact::isJoined(SilcBuddyContact *buddy)
+{
+  // channelEntry() is not set during the connection phase ...
+  if(! channelEntry()) return false;
+
+  return buddy->clientEntry(this) != NULL;
+}
+
+
+/**
+ * @todo we shouldn't assume the first available fingerprint is the joined one
+ */
+int
+SilcChannelContact::channelUserMode(SilcBuddyContact *buddy)
+{
+  // channelEntry() is not set during the connection phase ...
+  if(! channelEntry()) return -1;
+
+  SilcTK::SilcChannelUser cu = 
+    SilcTK::silc_client_on_channel(channelEntry(), buddy->clientEntry());
+  if(! cu) return -1;
+
+  return cu->mode;
+}
+
+bool
+SilcChannelContact::isOp(SilcBuddyContact *buddy)
+{
+  int cumode = channelUserMode(buddy);
+
+  if(cumode < 0) return false; // error, how to tell?
+  return (cumode & SILC_CHANNEL_UMODE_CHANOP) != 0;
+}
+
+bool
+SilcChannelContact::isFounder(SilcBuddyContact *buddy)
+{
+  int cumode = channelUserMode(buddy);
+
+  if(cumode < 0) return false; // error, how to tell?
+  return (cumode & SILC_CHANNEL_UMODE_CHANFO) != 0;
+}
+
+
+void
+SilcChannelContact::setOp(SilcBuddyContact *buddy, bool status)
+{
+  SilcTK::SilcChannelUser cu = 
+    SilcTK::silc_client_on_channel(channelEntry(), buddy->clientEntry());
+  if(! cu) return;
+
+  // get current mode ...
+  SilcTK::SilcUInt32 mode = cu->mode;
+
+  // update mode ...
+  mode &= ~SILC_CHANNEL_UMODE_CHANOP;
+  if(status) mode |= SILC_CHANNEL_UMODE_CHANOP;
+
+  // prepare to send the command finally ...
+  SilcTK::SilcBuffer idp_channel = 
+    SilcTK::silc_id_payload_encode(&channelEntry()->id, SILC_ID_CHANNEL);
+  SilcTK::SilcBuffer idp_client =
+    SilcTK::silc_id_payload_encode(&buddy->clientEntry()->id, SILC_ID_CLIENT);
+
+  unsigned char modebuf[4];
+  SILC_PUT32_MSB(mode, modebuf);
+
+  // finally send the command ...
+  SilcAccount *acc = static_cast<SilcAccount *>(account());
+  SilcTK::silc_client_command_send(acc->client(), acc->conn(),
+				   SILC_COMMAND_CUMODE, NULL, NULL, 3,
+				   1, idp_channel->data, 
+                                   silc_buffer_len(idp_channel),
+				   2, modebuf, sizeof(modebuf),
+				   3, idp_client->data, 
+                                   silc_buffer_len(idp_client));
+}
+
+
+void
+SilcChannelContact::kick(SilcBuddyContact *buddy)
+{
+  if(! channelEntry())
+    return;
+
+  SilcAccount *acc = static_cast<SilcAccount *>(account());
+
+  for(unsigned int i = 0; i < buddy->clientEntriesCount(); i ++) {
+    SilcTK::SilcClientEntry ce = buddy->clientEntry(i);
+    if(! SilcTK::silc_client_on_channel(channelEntry(), ce))
+      continue; // this ce doesn't participate on this channel
+
+    // prepare to send the command finally ...
+    SilcTK::SilcBuffer idp_channel = 
+      SilcTK::silc_id_payload_encode(&channelEntry()->id, SILC_ID_CHANNEL);
+    SilcTK::SilcBuffer idp_client =
+      SilcTK::silc_id_payload_encode(&ce->id, SILC_ID_CLIENT);
+
+    // finally send the command ...
+    SilcTK::silc_client_command_send(acc->client(), acc->conn(),
+				     SILC_COMMAND_KICK, NULL, NULL, 2,
+				     1, idp_channel->data, 
+                                     silc_buffer_len(idp_channel),
+				     2, idp_client->data, 
+                                     silc_buffer_len(idp_client));
+  }
+}
+
+
+const Kopete::OnlineStatus &
+SilcChannelContact::getBuddyOnlineStatus(SilcBuddyContact *buddy)
+{
+  if(buddy->onlineStatus() == SilcProtocol::protocol()->statusGone)
+    return isOp(buddy)
+      ? SilcProtocol::protocol()->statusGoneOp
+      : SilcProtocol::protocol()->statusGone;
+      
+  if(buddy->onlineStatus() == SilcProtocol::protocol()->statusIndisposed)
+    return isOp(buddy)
+      ? SilcProtocol::protocol()->statusIndisposedOp
+      : SilcProtocol::protocol()->statusIndisposed;
+
+  if(buddy->onlineStatus() == SilcProtocol::protocol()->statusBusy)
+    return isOp(buddy)
+      ? SilcProtocol::protocol()->statusBusyOp
+      : SilcProtocol::protocol()->statusBusy;
+
+  if(buddy->onlineStatus() == SilcProtocol::protocol()->statusHyper)
+    return isOp(buddy)
+      ? SilcProtocol::protocol()->statusHyperOp
+      : SilcProtocol::protocol()->statusHyper;
+  
+  if(buddy->onlineStatus() == SilcProtocol::protocol()->statusOnline)
+    return isOp(buddy)
+      ? SilcProtocol::protocol()->statusOnlineOp
+      : SilcProtocol::protocol()->statusOnline;
+
+  return SilcProtocol::protocol()->statusOffline;
+}
+
+void
+SilcChannelContact::updateBuddyOnlineStatus(SilcBuddyContact *buddy)
+{
+  // check whether the assigned status is correct for this channel,
+  // i.e. check whether we don't have to use the Op'd variant for example
+  const Kopete::OnlineStatus chuser_status = getBuddyOnlineStatus(buddy);
+
+  if(! manager()->members().contains(buddy)) {
+    manager()->addContact(buddy, chuser_status);
+    return;
+  }
+
+  if(manager()->contactOnlineStatus(buddy) != chuser_status)
+    manager()->setContactOnlineStatus(buddy, chuser_status);
+}
+
+void 
+SilcChannelContact::silc_channel_message(SilcTK::SilcClient /* client */, 
+					 SilcTK::SilcClientConnection /*conn*/,
+					 SilcTK::SilcClientEntry sender, 
+					 SilcTK::SilcChannelEntry channel,
+					 SilcTK::SilcMessagePayload payload,
+					 SilcTK::SilcMessageFlags flags, 
+					 const unsigned char *message,
+					 SilcTK::SilcUInt32 message_len)
+{
+  SilcChannelContact *ch = (SilcChannelContact *) channel->context;
+  SilcBuddyContact *buddy = (SilcBuddyContact *) sender->context;
+
+  if(! ch) {
+    std::cerr << "cannot find SilcChannel structure for "
+	      << channel->channel_name << std::endl;
+    return;
+  }
+
+  // if we haven't heard of the buddy, use the channel name ... hmm.
+  // @todo we ought to create a new buddy contact instead
+  if(! buddy) {
+    return;
+  }
+
+  /* If the messages is digitally signed, verify it, if possible. */
+  SignatureStatus sigstat = Unknown;
+  if (flags & SILC_MESSAGE_FLAG_SIGNED)
+    sigstat = buddy->verifySignature(payload);
+
+  // convert Utf8 stuff depending on whether SILC_MESSAGE_FLAG_UTF8 is set
+  QString text;
+  if(flags & SILC_MESSAGE_FLAG_UTF8)
+    text = QString::fromUtf8((const char *) message, message_len);
+  else if (flags & SILC_MESSAGE_FLAG_DATA);
+  else
+    text = QString::fromLatin1((const char *) message, message_len);
+
+    Kopete::Message msg;
+  if(flags & SILC_MESSAGE_FLAG_NOTICE)
+    msg = Kopete::Message(buddy, ch->manager()->members(), QString("%1 -*- %2")
+			  .arg(buddy->nickName()).arg(text),
+			  Kopete::Message::Internal,
+			  Kopete::Message::PlainText, QString::null,
+			  Kopete::Message::TypeAction);
+  else if (flags & SILC_MESSAGE_FLAG_DATA) {
+    /* SilcMimeMessage */
+    QStringList *filenames;
+    SilcTK::SilcMime tmp = SilcTK::silc_mime_decode(NULL, message, 
+                                                    message_len);
+    /* Assemble mime partials */
+    SilcTK::SilcMime mime = buddy->mime_asm(tmp);
+    if (!mime) return;
+
+    QString type = SilcTK::silc_mime_get_field(mime, "Content-Type");
+    if(type.isEmpty()) goto mimeout;
+
+    if (type.left(21).compare("multipart/alternative") == 0) {
+        msg = Kopete::Message(buddy, ch->manager()->members(), 
+                              QString::null,
+                              Kopete::Message::Inbound,
+                              Kopete::Message::PlainText, QString::null,
+                              Kopete::Message::TypeNormal);
+        buddy->mimeAlternateToMsg(msg, mime, ch->allowRichText());
+        ch->manager()->appendMessage(msg);
+    }
+    else {
+      filenames = buddy->saveMime(mime);
+      for ( QStringList::Iterator it = filenames->begin(); 
+            it != filenames->end(); ++it ) {
+        msg = Kopete::Message(buddy, ch->manager()->members(), 
+                              buddy->mimeDisplayMessage(*it),
+                              Kopete::Message::Inbound,
+                              Kopete::Message::RichText, QString::null,
+                              Kopete::Message::TypeNormal);
+
+        prettyPrintMessage(msg, flags, sigstat);
+        ch->manager()->appendMessage(msg);
+      }
+      delete filenames;
+    }
+mimeout:
+    SilcTK::silc_mime_free(mime);
+    return;
+  }
+  else
+    msg = Kopete::Message(buddy, ch->manager()->members(), text, 
+			  Kopete::Message::Inbound, 
+			  Kopete::Message::PlainText, QString::null,
+			  (flags & SILC_MESSAGE_FLAG_ACTION)
+			  ? Kopete::Message::TypeAction
+			  : Kopete::Message::TypeNormal);
+
+  prettyPrintMessage(msg, flags, sigstat);
+
+  ch->manager()->appendMessage(msg);
+}
+
+
+void 
+SilcChannelContact::silc_channel_message(SilcTK::SilcClient client,
+					 SilcTK::SilcClientConnection conn,
+					 SilcTK::SilcClientEntry sender,
+					 SilcTK::SilcChannelEntry channel,
+					 SilcTK::SilcMessagePayload payload,
+					 SilcTK::SilcChannelPrivateKey,
+					 SilcTK::SilcMessageFlags flags, 
+					 const unsigned char *msg,
+					 SilcTK::SilcUInt32 msg_len)
+{
+  SilcChannelContact::silc_channel_message(client, conn, sender, channel, 
+					   payload, flags, msg, msg_len);
+} 
+
+
+void SilcChannelContact::setNickNameForMode(int mode) {
+  QString _mode = "";
+  
+  if(mode & SILC_CHANNEL_MODE_PRIVATE) {
+    _mode.append("p");
+  }	
+
+  if(mode & SILC_CHANNEL_MODE_SECRET) {
+    _mode.append("s");
+  }       
+
+  if(mode & SILC_CHANNEL_MODE_PRIVKEY) {
+    _mode.append("K");
+  }      
+  
+  if(mode & SILC_CHANNEL_MODE_INVITE) {
+    _mode.append("i");
+  }
+  
+  if(mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) {
+    _mode.append("C");
+  }
+  
+  if(_mode != "") {
+    _mode = " ["+_mode+"]";
+  }
+ 
+ manager()->setDisplayName(nickName().append(_mode));
+}
+
+
+
+void 
+SilcChannelContact::invite(const SilcBuddyContact *buddy)
+{
+  if(!_joined) {
+    toInvite.append(buddy);
+    return;
+  }
+  // prepare to send the command finally ...
+  SilcTK::SilcBuffer idp_channel = 
+    SilcTK::silc_id_payload_encode(&channelEntry()->id, SILC_ID_CHANNEL);
+  SilcTK::SilcBuffer idp_client =
+    SilcTK::silc_id_payload_encode(&buddy->clientEntry()->id, SILC_ID_CLIENT);
+
+
+  SilcAccount *acc = static_cast<SilcAccount *>(account());
+  SilcTK::silc_client_command_send(acc->client(), acc->conn(),
+				   SILC_COMMAND_INVITE, NULL, NULL, 2,
+				   1, idp_channel->data, 
+                                   silc_buffer_len(idp_channel),
+				   2, idp_client->data, 
+                                   silc_buffer_len(idp_client));
+}
+
+
+
+void 
+SilcChannelContact::slotUserInfo(void)
+{
+  new SilcChannelContactInfoWidget(this);;
+}
+
+
+void
+SilcChannelContact::setTopic(QString &newTopic)
+{
+  QString oldTopic = topic();
+  if(!oldTopic.isNull() && newTopic.compare(oldTopic) == 0)
+    return;
+
+  account()->sendSilcCommand
+    (QString("TOPIC %1 %2").arg(nickName()).arg(newTopic));
+}
+
+
+void
+SilcChannelContact::setPrivate(bool state)
+{
+  if(! channelEntry()) {
+    modeToBeSet &= ~SILC_CHANNEL_MODE_PRIVATE;
+    if(state) modeToBeSet |= SILC_CHANNEL_MODE_PRIVATE;
+    return;
+  }
+  else if (state == isPrivate())
+    return;
+
+  _channelEntry->mode &= ~SILC_CHANNEL_MODE_PRIVATE;
+  if(state) _channelEntry->mode |= SILC_CHANNEL_MODE_PRIVATE;
+
+  commitModeChange();
+}
+
+
+void
+SilcChannelContact::setSecret(bool state)
+{
+  if(! channelEntry()) {
+    modeToBeSet &= ~SILC_CHANNEL_MODE_SECRET;
+    if(state) modeToBeSet |= SILC_CHANNEL_MODE_SECRET;
+    return;
+  }
+  else if (state == isSecret())
+    return;
+
+  _channelEntry->mode &= ~SILC_CHANNEL_MODE_SECRET;
+  if(state) _channelEntry->mode |= SILC_CHANNEL_MODE_SECRET;
+
+  commitModeChange();
+}
+
+
+void
+SilcChannelContact::setInviteOnly(bool state)
+{
+  if(! channelEntry()) {
+    modeToBeSet &= ~SILC_CHANNEL_MODE_INVITE;
+    if(state) modeToBeSet |= SILC_CHANNEL_MODE_INVITE;
+    return;
+  }
+  else if (state == isInviteOnly())
+    return;
+
+  _channelEntry->mode &= ~SILC_CHANNEL_MODE_INVITE;
+  if(state) _channelEntry->mode |= SILC_CHANNEL_MODE_INVITE;
+
+  commitModeChange();
+}
+
+
+void
+SilcChannelContact::setSilenceUser(bool state)
+{
+  if(! channelEntry()) {
+    modeToBeSet &= ~SILC_CHANNEL_MODE_SILENCE_USERS;
+    if(state) modeToBeSet |= SILC_CHANNEL_MODE_SILENCE_USERS;
+    return;
+  }
+  else if (state == isSilenceUser())
+    return;
+
+  _channelEntry->mode &= ~SILC_CHANNEL_MODE_SILENCE_USERS;
+  if(state) _channelEntry->mode |= SILC_CHANNEL_MODE_SILENCE_USERS;
+
+  commitModeChange();
+}
+
+
+void
+SilcChannelContact::setSilenceOperator(bool state)
+{
+  if(! channelEntry()) {
+    modeToBeSet &= ~SILC_CHANNEL_MODE_SILENCE_OPERS;
+    if(state) modeToBeSet |= SILC_CHANNEL_MODE_SILENCE_OPERS;
+    return;
+  }
+  else if (state == isSilenceOperator())
+    return;
+
+  _channelEntry->mode &= ~SILC_CHANNEL_MODE_SILENCE_OPERS;
+  if(state) _channelEntry->mode |= SILC_CHANNEL_MODE_SILENCE_OPERS;
+
+  commitModeChange();
+}
+
+
+void
+SilcChannelContact::commitModeChange(void)
+{
+  assert(channelEntry());
+
+  SilcTK::SilcBuffer idp_channel = 
+    SilcTK::silc_id_payload_encode(&channelEntry()->id, SILC_ID_CHANNEL);
+
+  unsigned char modebuf[4];
+  SILC_PUT32_MSB(channelEntry()->mode, modebuf);
+
+  SilcAccount *acc = static_cast<SilcAccount *>(account());
+  SilcTK::silc_client_command_send(acc->client(), acc->conn(),
+				   SILC_COMMAND_CMODE, NULL, NULL, 2,
+				   1, idp_channel->data, 
+                                   silc_buffer_len(idp_channel),
+				   2, modebuf, sizeof(modebuf));
+}
+
+void 
+SilcChannelContact::sendFile(const KURL &sourceURL,
+			   const QString & /* fileName */, uint /* fileSize */) 
+{
+  QString filePath;
+
+  if(! sourceURL.isValid())
+    filePath = KFileDialog::getOpenFileName(QString::null, "*", 0L,
+					    i18n("Kopete File Transfer"));
+  else
+    filePath = sourceURL.path(-1);
+
+  QFile file(filePath);
+  if(! file.exists())
+    return;
+  sendFileAsMime(filePath);
+}
+
+void 
+SilcChannelContact::sendFileAsMime(const QString &fileName)
+{
+  int chunks = 0;
+  SilcTK::SilcBuffer buffer;
+  QFile file(fileName);
+
+  /* Sending Chunks */
+  SilcTK::SilcDList parts = getFileAsMime(fileName);
+  SilcTK::silc_dlist_start(parts);
+  while ((buffer = (SilcTK::SilcBuffer)SilcTK::silc_dlist_get(parts))
+	 != SILC_LIST_END) { 
+    chunks ++;
+    SilcTK::silc_client_send_channel_message
+      (account()->client(), account()->conn(), channelEntry(), NULL, 
+       SILC_MESSAGE_FLAG_DATA, account()->sha1hash, 
+       (unsigned char*)buffer->data, silc_buffer_len(buffer));
+  }
+  SilcTK::silc_mime_partial_free(parts);
+  
+  Kopete::Message msg = 
+    Kopete::Message(account()->myself(), manager()->members(), 
+		    account()->myself()->mimeDisplayMessage(fileName, chunks),
+                    Kopete::Message::Outbound,
+                    Kopete::Message::RichText, QString::null,
+                    Kopete::Message::TypeNormal);
+
+  manager()->appendMessage(msg);
+}
+
+void 
+SilcChannelContact::serialize(QMap<QString, QString> &serializedData,
+			      QMap<QString, QString>&)
+{
+  serializedData["allowRichText"] = allowRichText() ? "yes" : "no";
+}
+
+#include "silcchannelcontact.moc"
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcchannelcontact.h Mon May 28 17:34:43 2007
@@ -1,0 +1,225 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCCHANNELCONTACT_H
+#define KOPETESILC_SILCCHANNELCONTACT_H
+
+//#include "silcaccount.h"
+#include "silccontact.h"
+
+class SilcAccount;
+class SilcBuddyContact;
+
+/**
+ * @brief Reimplementation of Kopete::Contact class, used for SILC Channels
+ *
+ * Every channel of the connected SILC network will have it's very own
+ * SilcChannelContact class associated as soon as it is known to
+ * kopete_silc.  This is as soon as the users tries to either add a specific
+ * channel to the contact list or otherwise joins a channel.
+ *
+ * The name of the represented channel is stored as the nickName() of this
+ * contact.
+ * 
+ * @author Stefan Siegl <ssiegl at gmx.de>
+ */
+class SilcChannelContact : public SilcContact {
+  Q_OBJECT;
+
+public:
+  SilcChannelContact(SilcAccount *, const QString &channelname, 
+		     Kopete::MetaContact *meta,
+		     const QString &icon = QString::null);
+  virtual ~SilcChannelContact();
+  
+  /**
+   * @brief return the primary message manager of this contact
+   */
+  virtual Kopete::ChatSession *manager(Kopete::Contact::CanCreateFlags =
+				       Kopete::Contact::CannotCreate);
+
+  /**
+   * @brief join the channel
+   */
+  virtual void join(void);
+  virtual void join(bool founder, bool auth, const QString &password = "");
+
+  /**
+   * @brief leave the channel (if joined)
+   */
+  virtual void leave(void);
+
+  /** 
+   * @brief invite buddy into this channel
+   */
+  void invite(const SilcBuddyContact *buddy);
+
+  /**
+   * @brief kick user from channel
+   */
+  void kick(SilcBuddyContact *buddy);
+
+  /** 
+   * @brief callback for libsilc to pass us an incoming channel message
+   */
+  static void silc_channel_message(SilcTK::SilcClient client, 
+				   SilcTK::SilcClientConnection conn,
+				   SilcTK::SilcClientEntry sender, 
+				   SilcTK::SilcChannelEntry channel,
+				   SilcTK::SilcMessagePayload payload,
+				   SilcTK::SilcMessageFlags flags, 
+				   const unsigned char *message,
+				   SilcTK::SilcUInt32 message_len);
+
+  static void silc_channel_message(SilcTK::SilcClient client,
+				   SilcTK::SilcClientConnection conn,
+				   SilcTK::SilcClientEntry sender,
+				   SilcTK::SilcChannelEntry channel,
+				   SilcTK::SilcMessagePayload payload,
+				   SilcTK::SilcChannelPrivateKey key,
+				   SilcTK::SilcMessageFlags flags, 
+				   const unsigned char *message,
+				   SilcTK::SilcUInt32 message_len);
+
+  inline SilcTK::SilcChannelEntry channelEntry(void) 
+  {
+    return _channelEntry;
+  }
+
+  /**
+   * @brief return the channel's topic
+   */
+  inline const QString topic(void) const 
+  {
+    return (_channelEntry && _channelEntry->topic) ? 
+      QString::fromUtf8(_channelEntry->topic) : QString::null;
+  }
+
+  /**
+   * @brief set channel topic
+   */
+  void setTopic(QString &);
+
+  void setChannelEntry(SilcTK::SilcChannelEntry e);
+
+  bool isOp(SilcBuddyContact *buddy);
+  bool isFounder(SilcBuddyContact *buddy);
+
+  inline bool isPrivate(void) const
+  {
+    return channelMode() & SILC_CHANNEL_MODE_PRIVATE;
+  }
+  inline bool isSecret(void) const
+  {
+    return channelMode() & SILC_CHANNEL_MODE_SECRET;
+  }
+  inline bool isInviteOnly(void) const
+  {
+    return channelMode() & SILC_CHANNEL_MODE_INVITE;
+  }
+  inline bool isSilenceUser(void) const
+  {
+    return channelMode() & SILC_CHANNEL_MODE_SILENCE_USERS;
+  }
+  inline bool isSilenceOperator(void) const
+  {
+    return channelMode() & SILC_CHANNEL_MODE_SILENCE_OPERS;
+  }
+
+  void setPrivate(bool);
+  void setSecret(bool);
+  void setInviteOnly(bool);
+  void setSilenceUser(bool);
+  void setSilenceOperator(bool);
+
+  void setOp(SilcBuddyContact *buddy, bool);
+
+  void setNickNameForMode(int mode);
+
+  inline bool allowRichText(void) const { return _allowRichText; };
+  inline void setAllowRichText(bool v) { _allowRichText = v; };
+
+  virtual void serialize(QMap<QString, QString>&, QMap<QString, QString>&);
+
+  /** 
+   * @brief check whether the given buddy is joined into this channel
+   */
+  bool isJoined(SilcBuddyContact *buddy);
+
+  /**
+   * @brief display channel configuration dialog
+   */
+  virtual void slotUserInfo(void);
+  
+  /**
+   * @brief send file as mime to contact
+   */
+  virtual void sendFileAsMime(const QString &fileName);
+  
+  virtual void sendFile(const KURL &sourceURL = KURL(),
+			const QString &fileName = QString::null,
+			uint fileSize = 0L);
+private slots:
+  /**
+   * @brief send (outgoing) message to the SILC network
+   */
+  virtual void slotSendMessage(Kopete::Message &, Kopete::ChatSession *);
+
+  /**
+   * @brief autojoin channel when SilcAccount is going online
+   */
+  void slotOnlineStatusChanged(Kopete::Contact *contact,
+			       const Kopete::OnlineStatus &status,
+			       const Kopete::OnlineStatus &oldStatus);
+
+public slots:
+  void updateBuddyOnlineStatus(SilcBuddyContact *buddy);
+
+private:
+  /**
+   * @brief buddies to be invited after join 
+   */
+  QPtrList<SilcBuddyContact> toInvite;
+
+  /**
+   * @brief mode to be set after join
+   */
+  SilcTK::SilcUInt32 modeToBeSet;
+
+  const Kopete::OnlineStatus &getBuddyOnlineStatus(SilcBuddyContact *buddy);
+
+  SilcTK::SilcChannelEntry _channelEntry;
+
+  /**
+   * @brief return the CU-Mode for buddy, -1 on error.
+   */
+  int channelUserMode(SilcBuddyContact *buddy);
+
+  void commitModeChange(void);
+
+  inline int channelMode(void) const
+  {
+    return _channelEntry ? _channelEntry->mode : 0;
+  }
+
+  bool _allowRichText;
+};
+
+#endif // KOPETESILC_SILCCHANNELCONTACT_H

Added: kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfo.ui
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfo.ui?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfo.ui (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfo.ui Mon May 28 17:34:43 2007
@@ -1,0 +1,323 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SilcChannelContactInfo</class>
+<widget class="QDialog">
+    <property name="name">
+        <cstring>SilcChannelContactInfo</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>502</width>
+            <height>321</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>Silc Channel Info</string>
+    </property>
+    <vbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="QTabWidget">
+            <property name="name">
+                <cstring>tabWidget4</cstring>
+            </property>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>General</string>
+                </attribute>
+                <grid>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLineEdit" row="0" column="1">
+                        <property name="name">
+                            <cstring>chname</cstring>
+                        </property>
+                        <property name="readOnly">
+                            <bool>true</bool>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="0" column="0">
+                        <property name="name">
+                            <cstring>_chname</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Name:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="1" column="1">
+                        <property name="name">
+                            <cstring>topic</cstring>
+                        </property>
+                        <property name="readOnly">
+                            <bool>false</bool>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="1" column="0">
+                        <property name="name">
+                            <cstring>_topic</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Topic:</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignVCenter|AlignRight</set>
+                        </property>
+                    </widget>
+                    <spacer row="2" column="1">
+                        <property name="name">
+                            <cstring>spacer15</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Fixed</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>25</height>
+                            </size>
+                        </property>
+                    </spacer>
+                    <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+                        <property name="name">
+                            <cstring>chkAllowRichText</cstring>
+                        </property>
+                        <property name="text">
+                            <string>allo&amp;w rich text markup</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+W</string>
+                        </property>
+                    </widget>
+                    <spacer row="4" column="1">
+                        <property name="name">
+                            <cstring>spacer16</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>41</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </grid>
+            </widget>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>Basic Options</string>
+                </attribute>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>chkPrivate</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>&amp;private channel</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+P</string>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>chkSecret</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>&amp;secret channel</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+S</string>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>chkInviteOnly</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>&amp;invite only channel</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+I</string>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>chkSilenceUser</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>&amp;user silencing</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+U</string>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>chkSilenceOperator</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>&amp;operator silencing</string>
+                        </property>
+                        <property name="accel">
+                            <string>Alt+O</string>
+                        </property>
+                    </widget>
+                    <spacer>
+                        <property name="name">
+                            <cstring>spacer17</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>71</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </vbox>
+            </widget>
+        </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout6</cstring>
+            </property>
+            <hbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <spacer>
+                    <property name="name">
+                        <cstring>Horizontal Spacing2</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>220</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonOk</cstring>
+                    </property>
+                    <property name="enabled">
+                        <bool>true</bool>
+                    </property>
+                    <property name="text">
+                        <string>&amp;OK</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+O</string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                    <property name="default">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonApply</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Apply</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+A</string>
+                    </property>
+                </widget>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonCancel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Cancel</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+C</string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>

Added: kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,119 @@
+// Copyright(C) 2007 Stefan Siegl <stesie at brokenpipe.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+
+#include "silcchannelcontactinfowidget.h"
+#include "silcchannelcontact.h"
+#include "silcaccount.h"
+
+#include <kopeteuiglobal.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <qlineedit.h>
+#include <qcheckbox.h>
+
+SilcChannelContactInfoWidget::SilcChannelContactInfoWidget
+(SilcChannelContact *c)
+  : SilcChannelContactInfo(), _channel(c)
+{
+  chname->setText(c->nickName());
+  topic->setText(c->topic());
+
+  chkAllowRichText->setChecked(c->allowRichText());
+
+  // initialize channel config check boxes ...
+  chkPrivate->setChecked(c->isPrivate());
+  chkSecret->setChecked(c->isSecret());
+  chkInviteOnly->setChecked(c->isInviteOnly());
+  chkSilenceUser->setChecked(c->isSilenceUser());
+  chkSilenceOperator->setChecked(c->isSilenceOperator());
+
+
+  // possibly disable all widgets, to keep user from editing ...
+  SilcBuddyContact *me = _channel->account()->myself();
+  bool allowFounderChanges = c->isFounder(me);
+  bool allowChanges = c->isOp(me) || allowFounderChanges;
+
+  topic->setReadOnly(!allowChanges);
+  chkPrivate->setEnabled(allowChanges);
+  chkSecret->setEnabled(allowChanges);
+  chkInviteOnly->setEnabled(allowChanges);
+  chkSilenceUser->setEnabled(allowFounderChanges);
+  chkSilenceOperator->setEnabled(allowFounderChanges);
+
+
+  // connect buttons ...
+  QObject::connect((QObject *) buttonOk, SIGNAL(clicked()),
+		   this, SLOT(slotOk()));
+  QObject::connect((QObject *) buttonApply, SIGNAL(clicked()),
+		   this, SLOT(slotApply()));
+  QObject::connect((QObject *) buttonCancel, SIGNAL(clicked()),
+		   this, SLOT(slotCancel()));
+
+  show();
+}
+
+SilcChannelContactInfoWidget::~SilcChannelContactInfoWidget()
+{
+}
+
+void
+SilcChannelContactInfoWidget::slotApply(void)
+{
+  SilcBuddyContact *me = _channel->account()->myself();
+
+  bool allowFounderChanges = _channel->isFounder(me);
+  bool allowChanges = _channel->isOp(me) || allowFounderChanges;
+
+  if(allowChanges) {
+    QString newTopic = topic->text();
+    _channel->setTopic(newTopic);
+  }
+
+  if(allowChanges) {
+    _channel->setPrivate(chkPrivate->isChecked());
+    _channel->setSecret(chkSecret->isChecked());
+    _channel->setInviteOnly(chkInviteOnly->isChecked());
+  }
+
+  if(allowFounderChanges) {
+    _channel->setSilenceUser(chkSilenceUser->isChecked());
+    _channel->setSilenceOperator(chkSilenceOperator->isChecked());
+  }
+
+  _channel->setAllowRichText(chkAllowRichText->isChecked());
+}
+
+void
+SilcChannelContactInfoWidget::slotOk(void)
+{
+  slotApply();
+  delete this;
+}
+
+void
+SilcChannelContactInfoWidget::slotCancel(void)
+{
+  delete this;
+}
+
+
+#include "silcchannelcontactinfowidget.moc"
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcchannelcontactinfowidget.h Mon May 28 17:34:43 2007
@@ -1,0 +1,45 @@
+//                     -*- mode: C++ -*-
+//
+// Copyright(C) 2007 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCCHANNELCONTACTINFOWIDGET_H
+#define SILCCHANNELCONTACTINFOWIDGET_H
+
+#include "silcchannelcontactinfo.h"
+
+class SilcChannelContact;
+class SilcChannelContactInfoWidget : private SilcChannelContactInfo
+{
+  Q_OBJECT
+
+public:
+  SilcChannelContactInfoWidget(SilcChannelContact *channel);
+  ~SilcChannelContactInfoWidget();
+
+private slots:
+  void slotOk(void);
+  void slotApply(void);
+  void slotCancel(void);
+
+private:
+  SilcChannelContact *_channel;
+
+};
+
+#endif
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcchanneljoin.ui
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcchanneljoin.ui?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcchanneljoin.ui (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcchanneljoin.ui Mon May 28 17:34:43 2007
@@ -1,0 +1,227 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>joinDlg</class>
+<widget class="QDialog">
+    <property name="name">
+        <cstring>joinDlg</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>491</width>
+            <height>182</height>
+        </rect>
+    </property>
+    <property name="minimumSize">
+        <size>
+            <width>350</width>
+            <height>100</height>
+        </size>
+    </property>
+    <property name="caption">
+        <string>Choose channel to join</string>
+    </property>
+    <property name="sizeGripEnabled">
+        <bool>true</bool>
+    </property>
+    <vbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout10</cstring>
+            </property>
+            <grid>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="KLineEdit" row="0" column="1">
+                    <property name="name">
+                        <cstring>txtChannel</cstring>
+                    </property>
+                    <property name="minimumSize">
+                        <size>
+                            <width>0</width>
+                            <height>22</height>
+                        </size>
+                    </property>
+                </widget>
+                <widget class="QLineEdit" row="1" column="1">
+                    <property name="name">
+                        <cstring>txtPassword</cstring>
+                    </property>
+                    <property name="echoMode">
+                        <enum>Password</enum>
+                    </property>
+                </widget>
+                <widget class="QLabel" row="0" column="0">
+                    <property name="name">
+                        <cstring>textLabel1</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Channel:</string>
+                    </property>
+                </widget>
+                <widget class="QLabel" row="1" column="0">
+                    <property name="name">
+                        <cstring>textLabel2</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Password:</string>
+                    </property>
+                </widget>
+            </grid>
+        </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout3</cstring>
+            </property>
+            <vbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QCheckBox">
+                    <property name="name">
+                        <cstring>chkFounder</cstring>
+                    </property>
+                    <property name="minimumSize">
+                        <size>
+                            <width>0</width>
+                            <height>22</height>
+                        </size>
+                    </property>
+                    <property name="text">
+                        <string>c&amp;laim founder status</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+L</string>
+                    </property>
+                </widget>
+                <widget class="QCheckBox">
+                    <property name="name">
+                        <cstring>chkAuth</cstring>
+                    </property>
+                    <property name="minimumSize">
+                        <size>
+                            <width>0</width>
+                            <height>22</height>
+                        </size>
+                    </property>
+                    <property name="text">
+                        <string>use -au&amp;th option</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+T</string>
+                    </property>
+                </widget>
+            </vbox>
+        </widget>
+        <spacer>
+            <property name="name">
+                <cstring>spacer3</cstring>
+            </property>
+            <property name="orientation">
+                <enum>Vertical</enum>
+            </property>
+            <property name="sizeType">
+                <enum>Expanding</enum>
+            </property>
+            <property name="sizeHint">
+                <size>
+                    <width>21</width>
+                    <height>71</height>
+                </size>
+            </property>
+        </spacer>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout1</cstring>
+            </property>
+            <hbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <spacer>
+                    <property name="name">
+                        <cstring>Horizontal Spacing2</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>215</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonOk</cstring>
+                    </property>
+                    <property name="minimumSize">
+                        <size>
+                            <width>0</width>
+                            <height>22</height>
+                        </size>
+                    </property>
+                    <property name="text">
+                        <string>&amp;OK</string>
+                    </property>
+                    <property name="accel">
+                        <string></string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                    <property name="default">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>buttonCancel</cstring>
+                    </property>
+                    <property name="minimumSize">
+                        <size>
+                            <width>0</width>
+                            <height>22</height>
+                        </size>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Cancel</string>
+                    </property>
+                    <property name="accel">
+                        <string></string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<connections>
+    <connection>
+        <sender>buttonOk</sender>
+        <signal>clicked()</signal>
+        <receiver>joinDlg</receiver>
+        <slot>accept()</slot>
+    </connection>
+    <connection>
+        <sender>buttonCancel</sender>
+        <signal>clicked()</signal>
+        <receiver>joinDlg</receiver>
+        <slot>reject()</slot>
+    </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+    <includehint>klineedit.h</includehint>
+</includehints>
+</UI>

Added: kopete-silc-plugin/branches/upstream/current/src/silccontact.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silccontact.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silccontact.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silccontact.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,379 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+
+#include "silcaccount.h"
+#include "silccontact.h"
+#include "silcmessagemanager.h"
+
+#include <kopetemetacontact.h>
+#include <kopetechatsession.h>
+#include <kopetechatsessionmanager.h>
+#include <kopetemessage.h>
+
+#include <ui/kopeteview.h>
+
+#include <kmimemagic.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qimage.h>
+
+SilcContact::SilcContact(SilcAccount *account, const QString &nickname, 
+			 Kopete::MetaContact *meta, const QString &icon)
+  : Kopete::Contact(account, nickname, meta, icon),
+    _chatSession(NULL),
+    _joined(false)
+{
+  SilcProtocol *proto = static_cast<SilcProtocol *>(account->protocol());
+  setOnlineStatus(proto->statusOffline);
+  mimeasm = NULL;
+}
+ 
+SilcContact::~SilcContact() 
+{
+  if(mimeasm)
+    SilcTK::silc_mime_assembler_free(mimeasm);
+}
+
+SilcAccount *
+SilcContact::account(void)
+{
+  return static_cast<SilcAccount *>(Kopete::Contact::account());
+}
+
+Kopete::ChatSession *
+SilcContact::manager(Kopete::Contact::CanCreateFlags flags)
+{
+  if(_chatSession) 
+    return _chatSession;
+
+  if(! (flags & Kopete::Contact::CanCreate))
+    return NULL; // not allowed to create new chat session
+
+  if(! account()->isConnected())
+    return NULL; // account has no SilcEngine attacted, i.e. it's offline
+                 // FIXME, shall we connect here?
+
+  QPtrList<Kopete::Contact> myself;
+  myself.append(this);
+  
+  _chatSession = account()->chatSession(myself);
+  _chatSession->setDisplayName(nickName());
+
+  // connect the neccessary signals ...
+  QObject::connect(manager(), SIGNAL(messageSent(Kopete::Message &, 
+						 Kopete::ChatSession *)),
+		   this, SLOT(slotSendMessage(Kopete::Message &,
+					      Kopete::ChatSession *)));
+
+  QObject::connect(manager(), SIGNAL(closing(Kopete::ChatSession *)), 
+		   this, SLOT(slotCloseSession()));
+
+  if(! _joined)
+    join();
+  
+  return _chatSession;
+}
+
+KopeteView *
+SilcContact::view(void)
+{
+  Kopete::ChatSession *session = manager(Kopete::Contact::CanCreate);
+  KopeteView *view = session->view(true);
+
+  if(! view) {
+    std::cerr << "Dude, FAILED to create view for ChatSession!" << std::endl;
+    return NULL;
+  }
+
+  if(! _joined)
+    join();
+
+  view->makeVisible();
+  return view;
+}
+
+void
+SilcContact::slotCloseSession(void)
+{
+  QObject::disconnect(_chatSession, 0, this, 0);
+
+  leave();
+  _chatSession = NULL;
+}
+
+void
+SilcContact::join(void)
+{
+  _joined = true;
+}
+
+void
+SilcContact::leave(void)
+{
+  _joined = false;
+}
+
+void 
+SilcContact::deleteContact(void)
+{
+  // we must not delete the contact, since it is referenced from within
+  // the silc client library
+  metaContact()->removeContact(this);
+  
+  Kopete::MetaContact *m = new Kopete::MetaContact();
+  m->setTemporary(true);
+  setMetaContact(m);
+}
+
+void
+SilcContact::prettyPrintMessage(Kopete::Message &msg, int flags,
+				SignatureStatus sigstat)
+{
+  if(!(flags & SILC_MESSAGE_FLAG_SIGNED)) 
+    return;
+
+  if(msg.direction() == Kopete::Message::Inbound
+     || msg.direction() == Kopete::Message::Internal) {
+    QString sigstatComment;
+
+    switch(sigstat) {
+    case Unknown:
+      sigstatComment = i18n("unknown signature status");
+      break;
+
+    case Valid:
+      sigstatComment = i18n("untrusted signature");
+      break;
+
+    case Trusted:
+      sigstatComment = i18n("fully trusted signature.");
+      break;
+
+    case Failed:
+      sigstatComment = i18n("verification FAILED.");
+      break;
+    }
+
+    msg.setBody(QString::fromLatin1
+		("<table width=\"100%\" border=0 cellspacing=0 cellpadding=0>"
+		 "<tr><td class=\"highlight\"><font size=\"-1\">")
+		+ i18n("Incoming Signed") + " "
+		+ (flags & SILC_MESSAGE_FLAG_NOTICE
+		   ? i18n("Notice") : (flags & SILC_MESSAGE_FLAG_ACTION
+				       ? i18n("Action") : i18n("Message")))
+		+ ": <b>" + sigstatComment 
+		+ QString::fromLatin1("</b></font></td></tr>"
+				      "<tr><td class=\"highlight\">")
+		+ msg.escapedBody()
+		+ QString::fromLatin1(" </td></tr></table>")
+		, Kopete::Message::RichText );
+  }
+
+  else {
+    msg.setBody(QString::fromLatin1
+		("<table width=\"100%\" border=0 cellspacing=0 cellpadding=0>"
+		 "<tr><td class=\"highlight\"><font size=\"-1\"><b>")
+		+ i18n("Outgoing Signed") + " "
+		+ (flags & SILC_MESSAGE_FLAG_ACTION
+		   ? i18n("Action") : i18n("Message"))
+		+ QString::fromLatin1(": </b></font></td></tr>"
+				      "<tr><td class=\"highlight\">")
+		+ msg.escapedBody()
+		+ QString::fromLatin1(" </td></tr></table>")
+		, Kopete::Message::RichText );
+  }
+}
+
+SilcTK::SilcMime
+SilcContact::mime_asm(SilcTK::SilcMime part)
+{
+  if(!part) return NULL;
+
+  QString type = SilcTK::silc_mime_get_field(part, "Content-Type");
+  if(type.isEmpty()) return NULL;
+
+  if (SilcTK::silc_mime_is_partial(part)) {
+    if (!mimeasm)  
+      mimeasm = SilcTK::silc_mime_assembler_alloc();
+    SilcTK::SilcMime mime = SilcTK::silc_mime_assemble(mimeasm, part);
+    if(mime)
+      return mime;
+    return NULL;
+  }
+  return part;
+}
+
+QStringList *
+SilcContact::saveMime(SilcTK::SilcMime mime)
+{
+  QStringList *list = new QStringList;
+  if (SilcTK::silc_mime_is_multipart(mime)) {
+    SilcTK::SilcMime p;
+    const char *mixed;
+    SilcTK::SilcDList parts = SilcTK::silc_mime_get_multiparts(mime, &mixed);
+
+    /* Only "mixed" type supported */
+    if (strcmp(mixed, "mixed"))
+      return list;
+
+    SilcTK::silc_dlist_start(parts);
+    while ((p = (SilcTK::SilcMime)SilcTK::silc_dlist_get(parts))
+	   != SILC_LIST_END) { 
+      QStringList *tmp = saveMime(p);
+      *list += *tmp;
+    }
+  }
+  else {
+    SilcTK::SilcUInt32 len;
+    char temp[] = "/tmp/kopete.mime.XXXXXX";
+
+    const char *data = (const char *)SilcTK::silc_mime_get_data(mime, &len);
+    int fd = mkstemp(temp);
+    if (!data || !len || fd == -1) return list;
+    close(fd);
+
+    QFile file(temp);
+    file.open(IO_WriteOnly);
+    file.writeBlock(data, len);
+    file.close();
+
+    list->append(file.name());
+  }
+  return list;
+}
+
+
+SilcTK::SilcMime
+SilcContact::getMessageAsMime(Kopete::Message &msg)
+{
+  // prepare text/plain part
+  SilcTK::SilcMime plain = SilcTK::silc_mime_alloc();
+  SilcTK::silc_mime_add_field(plain, "MIME-Version", "1.0");
+  SilcTK::silc_mime_add_field(plain, "Content-Transfer-Encoding", "binary");
+  SilcTK::silc_mime_add_field(plain, "Content-Type",
+			      "text/plain; charset=utf-8");
+
+  QCString plaintext = msg.plainBody().utf8();
+  SilcTK::silc_mime_add_data(plain, (unsigned char *) (const char *) plaintext,
+			     plaintext.length());
+
+  // prepare text/html part
+  SilcTK::SilcMime html = SilcTK::silc_mime_alloc();
+  SilcTK::silc_mime_add_field(html, "MIME-Version", "1.0");
+  SilcTK::silc_mime_add_field(html, "Content-Transfer-Encoding", "binary");
+  SilcTK::silc_mime_add_field(html, "Content-Type",
+			      "text/html; charset=utf-8");
+
+  QCString htmltext = msg.escapedBody().utf8();
+  SilcTK::silc_mime_add_data(html, (unsigned char *) (const char *) htmltext,
+			     htmltext.length());
+
+  // no produce the multipart/alternative thingy
+  SilcTK::SilcMime mime = SilcTK::silc_mime_alloc();
+  SilcTK::silc_mime_set_multipart(mime, "alternative", "boundary");
+  SilcTK::silc_mime_add_multipart(mime, plain);
+  SilcTK::silc_mime_add_multipart(mime, html);
+
+  return mime;
+}
+
+
+SilcTK::SilcDList 
+SilcContact::getFileAsMime(const QString &fileName) 
+{
+  QFile file(fileName);
+  SilcTK::SilcMime mime = SilcTK::silc_mime_alloc();
+
+  SilcTK::silc_mime_add_field(mime, "MIME-Version", "1.0");
+  SilcTK::silc_mime_add_field(mime, "Content-Transfer-Encoding", "binary");
+  
+  KMimeMagicResult *mtype = KMimeMagic::self()->findFileType(fileName);
+  if(mtype && mtype->isValid())
+    SilcTK::silc_mime_add_field(mime, "Content-Type", 
+                                mtype->mimeType().latin1());
+  else
+    SilcTK::silc_mime_add_field(mime, "Content-Type", 
+                                "application/octet-stream");
+  file.open(IO_ReadOnly);
+  QByteArray content = file.readAll();
+  SilcTK::silc_mime_add_data(mime, (unsigned char *)content.data(), content.size());
+
+  SilcTK::SilcDList ret = SilcTK::silc_mime_encode_partial(mime, 23 << 10);
+  SilcTK::silc_mime_free(mime);
+
+  return ret;
+}
+
+void
+SilcContact::sendFileAsMime(const QString &) {}
+
+
+QString
+SilcContact::mimeDisplayMessage(QString fname, int outgoing_chunks)
+{
+  QFileInfo info(fname);
+
+  /* find mime type */
+  KMimeMagicResult *mtype = KMimeMagic::self()->findFileType(fname);
+  QString ctype = (mtype && mtype->isValid()) 
+    ? QString(mtype->mimeType()) : QString(i18n("unknown"));
+    
+
+  QString msg =
+    QString(outgoing_chunks
+	    ? i18n("<a href=\"%2\">MIME message</a> (%1)")
+	    : i18n("New MIME message (%1) saved <a href=\"%2\">here</a>"))
+    .arg(ctype).arg(fname);
+
+  if(outgoing_chunks)
+    msg.append(QString(" sent in %1 chunks").arg(outgoing_chunks));
+
+  msg.append(QString(" (%1.%2 Kbyte)")
+	     .arg((info.size() / 1024))
+	     .arg((info.size() % 1024) / 100));
+
+  if(account()->displayImagesInline()
+     && ctype.left(6).compare("image/") == 0) {
+    QImage img(fname);
+    int h = img.height();
+    int w = img.width();
+
+    if(w > 400) {
+      h = h * 400 / w;
+      w = 400;
+    }
+
+    if(h > 300) {
+      w = w * 300 / h;
+      h = 300;
+    }
+
+    msg.append(QString("<br><img src=\"%1\" width=\"%2\" height=\"%3\">")
+	       .arg(fname).arg(w).arg(h));
+  }
+
+  return msg;
+}
+#include "silccontact.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silccontact.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silccontact.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silccontact.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silccontact.h Mon May 28 17:34:43 2007
@@ -1,0 +1,186 @@
+//                       -*- mode: C++ -*-
+// Copyright(C) 2005,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCCONTACT_H
+#define KOPETESILC_SILCCONTACT_H
+
+#include <kopetecontact.h>
+
+namespace Kopete {
+  class ChatSession;
+  class MetaContact;
+  class Message;
+}
+
+// include libsilc stuff into a separate namespace
+namespace SilcTK {
+#include <silc.h>
+#include <silcclient.h>
+}
+
+class KopeteView;
+
+class SilcAccount;
+class SilcChatSession;
+
+/**
+ * @brief abstract reimplementation of Kopete::Contact class
+ *
+ * Every channel and every user of the connected SILC network will have it's
+ * very own representation in kopete_silc.  SilcContact is an abstract
+ * parent class of SilcChannelContact (representing channels) and
+ * SilcBuddyContact (specialized for buddies, i.e. users)
+ *
+ * @author Stefan Siegl <stesie at brokenpipe.de>
+ */
+class SilcContact : public Kopete::Contact {
+  Q_OBJECT;
+
+public:
+  enum SignatureStatus {
+    /**
+     * the signer is not known or the signature couldn't be verified for
+     * whatever reason.
+     */
+    Unknown,
+
+    /** 
+     * the signature could be verified successfully
+     */
+    Valid,
+
+    /** 
+     * the signature could be verified and the public key is marked as trusted
+     */
+    Trusted,
+
+    /**
+     * failed, the signature is invalid
+     */
+    Failed
+  };
+
+
+
+  SilcContact(SilcAccount *account, const QString &nickname, 
+	      Kopete::MetaContact *, const QString &icon = QString::null);
+  virtual ~SilcContact();
+
+  /**
+   * @brief return the primary message manager of this contact
+   */
+  virtual Kopete::ChatSession *manager(Kopete::Contact::CanCreateFlags =
+				       Kopete::Contact::CannotCreate);
+
+  /**
+   * @brief return KopeteView for this channel (or create a new one)
+   *
+   * This is somewhat a convenience function, call it to force a chat window
+   * being opened for this channel or one-on-one chat.
+   */
+  virtual KopeteView *view(void);
+
+  /**
+   * @brief join the SilcContact
+   *
+   * Default implementation does nothing.
+   */
+  virtual void join(void);
+
+  /**
+   * @brief leave the channel (if joined)
+   *
+   * Default implementation does nothing.
+   */
+  virtual void leave(void);
+
+  /**
+   * @brief access this contact's Kopete::Account subclass (aka SilcAccount)
+   */
+  SilcAccount *account(void); 
+
+  /**
+   * @brief signals in the chat window that a message has been signed
+   */
+  static void prettyPrintMessage(Kopete::Message &msg, int flags,
+				 SignatureStatus status = Unknown);
+  /**
+   * @brief assembles mime parts, if mime message is complete return it
+   */
+  SilcTK::SilcMime mime_asm(SilcTK::SilcMime part);
+ 
+  /**
+   * @brief save mime message and return a list of files where parts were
+   * saved
+   */
+  QStringList *saveMime(SilcTK::SilcMime mime);
+
+  /**
+   * @brief send file as mime to contact
+   */
+  virtual void sendFileAsMime(const QString &fileName);
+
+  /**
+   * @brief generate a message to display for incoming SilcMime message
+   */
+  virtual QString mimeDisplayMessage(QString fname, int out_chunks = 0);
+
+  /**
+   * @brief creates an mime message form file
+   */
+  SilcTK::SilcDList getFileAsMime(const QString &fileName);
+
+  /**
+   * @brief produce a multipart/alternative SilcMime from a Kopete::Message
+   */
+  SilcTK::SilcMime getMessageAsMime(Kopete::Message &msg);
+
+
+protected:
+  /** 
+   * @brief the Kopete::ChatSession associated to this SilcContact
+   */
+  SilcChatSession *_chatSession;
+
+  /**
+   * @brief whether or not the channel is currently joined
+   */
+  bool _joined;
+
+public slots:
+  virtual void deleteContact(void);
+  
+private slots:
+  /**
+   * @brief send outgoing message
+   */
+  virtual void slotSendMessage(Kopete::Message &, Kopete::ChatSession *) = 0;
+
+  /**
+   * @brief the Kopete::ChatSession was closed
+   */
+  void slotCloseSession(void);
+private:
+  /**
+   * @brief silcmimeassembler
+   */
+  SilcTK::SilcMimeAssembler mimeasm;
+};
+
+#endif // KOPETESILC_SILCCONTACT_H

Added: kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,404 @@
+//                          -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2006 Martin Albrecht <malb at informatik.uni-bremen.de>
+//
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+
+#include <kopetemetacontact.h>
+#include <kopeteuiglobal.h>
+#include <kopetechatsession.h>
+
+#include <kdebug.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+#include "silcaccount.h"
+#include "silccontactmanager.h"
+#include "silcbuddycontact.h"
+#include "silcchannelcontact.h"
+#include "silcservercontact.h"
+
+template <class T> int 
+SilcContactList<T>::compareItems(QPtrCollection::Item item1,
+				 QPtrCollection::Item item2)
+{
+  T *contact1 = (T *) item1;
+  T *contact2 = (T *) item2;
+  return contact1->nickName().compare(contact2->nickName());
+}
+
+template <class T> T *
+SilcContactList<T>::lookup(const QString &name) 
+{
+  typename SilcContactList<T>::iterator iter = begin();
+  while(iter != end()) {
+    if((*iter)->nickName().compare(name) == 0)
+      return static_cast<T*>(*iter);
+    else
+      iter ++;
+  }
+  
+  return NULL;
+}
+
+template <> SilcBuddyContact *
+SilcContactList<SilcBuddyContact>::lookupByFingerprint(const QString &finger)
+{
+  SilcContactList<SilcBuddyContact>::iterator iter = begin();
+
+  while(iter != end()) {
+    if(! static_cast<SilcBuddyContact *>(*iter)->fingerprint().compare(finger))
+      return static_cast<SilcBuddyContact *>(*iter);
+    else
+      iter ++;
+  }
+  
+  return NULL;
+}
+
+template <> SilcBuddyContact *
+SilcContactList<SilcBuddyContact>::lookupById(const QString &id)
+{
+  SilcContactList<SilcBuddyContact>::iterator iter = begin();
+
+  while(iter != end()) {
+    if(! static_cast<SilcBuddyContact *>(*iter)->contactId().compare(id))
+      return static_cast<SilcBuddyContact *>(*iter);
+    else
+      iter ++;
+  }
+  
+  return NULL;
+}
+
+template <class T> void
+SilcContactList<T>::setStatus(Kopete::OnlineStatus status)
+{
+  typename SilcContactList<T>::iterator iter = begin();
+  for(; iter != end(); iter ++)
+    (*iter)->setOnlineStatus(status);
+}
+
+SilcContactManager::SilcContactManager(SilcAccount *account)
+  : _channels(), _account(account), _outstandingWhoisRequests(0)
+{
+  QObject::connect(account, SIGNAL(connected()),
+		   this, SLOT(slotConnected()));
+  QObject::connect(account, SIGNAL(disconnected()),
+		   this, SLOT(slotDisconnected()));
+}
+
+SilcContactManager::~SilcContactManager() { }
+
+
+void
+SilcContactManager::getClientsCallback(SilcTK::SilcClient,
+				       SilcTK::SilcClientConnection,
+                                       SilcTK::SilcStatus status,
+                                       SilcTK::SilcDList celist,
+				       void *context)
+{
+  SilcTK::SilcClientEntry client_entry;
+  SilcBuddyContact *req = (SilcBuddyContact *) context;
+  SilcContactManager *cm = req->account()->contactManager();
+  SilcAccount *account = req->account();
+
+  if (status == SILC_STATUS_ERR_TIMEDOUT) {
+    SilcTK::silc_client_get_clients_whois(account->client(),
+					  account->conn(), 
+					  req->nickName().utf8(),
+					  NULL, NULL, getClientsCallback,
+					  (void *) req);
+    return;
+  }
+  
+  if (!celist) return;
+
+  SilcTK::silc_dlist_start(celist);
+
+  // add each found entry and watch it ...
+  while ((client_entry = (SilcTK::SilcClientEntry) SilcTK::silc_dlist_get(celist))
+         != SILC_LIST_END) {
+    SilcBuddyContact *buddy = (SilcBuddyContact *) client_entry->context;
+
+    if(! buddy)
+      buddy =
+	cm->createBuddy(QString::fromUtf8(client_entry->nickname),
+			NULL, client_entry);
+
+    req->account()->setBuddyOnlineStatus(cm, buddy, client_entry->mode);
+  }
+
+  if(-- cm->_outstandingWhoisRequests == 0) {
+    // no more outstanding whois requests, fire watch requests ...
+    cm->watchAllBuddies(1);
+  }
+}
+
+
+void
+SilcContactManager::watchAllBuddies(bool watch)
+{
+  SilcContactList<SilcBuddyContact>::iterator iter = _buddies.begin();
+  for(; iter != _buddies.end(); iter ++) {
+    if((* iter) == account()->myself())
+      continue;
+    
+    SilcBuddyContact *buddy = static_cast<SilcBuddyContact*>(* iter);
+    buddy->watchme(watch);
+  }
+}
+
+
+void
+SilcContactManager::slotConnected(void)
+{
+  // set online status again, the first call initiated by 
+  // SilcAccount::setOnlineStatus probably was not successful, since
+  // the connection wasn't up then ...
+  account()->setOnlineStatus(account()->myself()->onlineStatus());
+
+  // mark all channels online ...
+  _channels.setStatus(SilcProtocol::protocol()->statusOnlineChannel);
+
+  // send a whois request for every buddy we've heard of and put this buddy
+  // on the watch list ...
+  //
+  // we obviously need to do this one after another, i.e. send the /watch
+  // commands as soon as any other /whois request has been answered ...
+  // ... this is probably some work around for some hidden bug ...
+  SilcContactList<SilcBuddyContact>::iterator iter = _buddies.begin();
+  for(; iter != _buddies.end(); iter ++) {
+    if((* iter) == account()->myself())
+       continue;
+
+    SilcBuddyContact *buddy = static_cast<SilcBuddyContact*>(* iter);
+
+    _outstandingWhoisRequests ++;
+    SilcTK::silc_client_get_clients_whois(account()->client(),
+					  account()->conn(), 
+					  buddy->nickName().utf8(),
+					  NULL, NULL, getClientsCallback,
+					  (void *) buddy);
+  } 
+}
+
+void
+SilcContactManager::setOnlineStatus(SilcBuddyContact *buddy, 
+				    const Kopete::OnlineStatus &status)
+{
+  if(!buddy) {
+    return;
+  }
+  buddy->setOnlineStatus(status);
+
+  // finally notify open chat windows to update their information ...
+  SilcContactList<SilcChannelContact>::iterator iter = _channels.begin();
+
+  for(; iter != _channels.end(); iter ++) {
+    if(! (* iter)->manager()) continue; // ignore channels without a manager
+    const Kopete::ContactPtrList members = (* iter)->manager()->members();
+
+    if(members.contains(buddy))
+      static_cast<SilcChannelContact *>(* iter)->updateBuddyOnlineStatus(buddy);
+  }
+}
+
+
+void
+SilcContactManager::slotDisconnected(void)
+{
+  // mark all contacts as offline ...
+  _channels.setStatus(SilcProtocol::protocol()->statusOffline);
+  _buddies.setStatus(SilcProtocol::protocol()->statusOffline);
+
+  _outstandingWhoisRequests = 0;
+}
+
+SilcServerContact *
+SilcContactManager::createServer(const QString &hostname)
+{
+  Kopete::MetaContact *meta = new Kopete::MetaContact();
+  meta->setTemporary(true);
+
+  return new SilcServerContact(_account, hostname, meta);
+}
+
+SilcChannelContact *
+SilcContactManager::createChannel(const QString &channel,
+				  Kopete::MetaContact *meta,
+				  SilcTK::SilcChannelEntry entry)
+{
+  if(entry && entry->context) return (SilcChannelContact *) entry->context;
+
+  if(! meta) {
+    meta = new Kopete::MetaContact();
+    meta->setTemporary(true);
+  }
+
+  SilcChannelContact *c = new SilcChannelContact(_account, channel, meta);
+  if(entry) c->setChannelEntry(entry);
+  _channels.append(c);
+
+  return c;
+}
+
+SilcBuddyContact *
+SilcContactManager::createBuddy(Kopete::MetaContact *meta,
+				const QString &finger)
+{
+  // check whether there already is a buddy with this fingerprint ...
+  SilcBuddyContact *bc = _buddies.lookupByFingerprint(finger);
+  if(bc) 
+    return bc;
+
+  if(! meta) {
+    meta = new Kopete::MetaContact();
+    meta->setTemporary(true);
+  }
+
+  SilcBuddyContact *contact =
+    new SilcBuddyContact(_account, QString::null, finger, meta);
+  
+  _buddies.append(contact);
+  return contact;
+}
+
+SilcBuddyContactData *
+SilcContactManager::popPendingBuddy(const QString &nickname)
+{
+
+  SilcBuddyContactData *buddy;
+  for ( buddy = _pending_buddies.first(); buddy; buddy =
+        _pending_buddies.next() ) {
+    if(buddy->nickName().compare(nickname) == 0) {
+      _pending_buddies.remove(buddy);
+      break;
+    }
+  }
+  return buddy;
+}
+
+SilcBuddyContact *
+SilcContactManager::createBuddy(const QString &nickname,
+				Kopete::MetaContact *meta,
+                                SilcTK::SilcClientEntry entry
+                                )
+{
+   QString finger;
+   if(!_buddies.lookupByFingerprint("self")) {
+     finger = "self"; //we are "self"
+   } else {
+     finger = nickname;
+   }
+
+  if(entry) {
+    if(entry->context)
+      return (SilcBuddyContact *) entry->context;
+    finger = SilcBuddyContact::convFingerprint
+      ((const char *) entry->fingerprint);
+
+    SilcBuddyContact *bc = _buddies.lookupByFingerprint(finger);
+    if(bc) {
+      //if(! bc->clientEntry())
+	bc->setNickName(QString::fromUtf8(entry->nickname));
+
+      bc->addClientEntry(entry);
+      return bc;
+    }
+  }
+
+  if(! meta) {
+    meta = new Kopete::MetaContact();
+    meta->setTemporary(true);
+  }
+
+  //incomplete Buddy
+  if(! nickname.compare(finger)) {
+    SilcBuddyContactData *buddy = new SilcBuddyContactData(_account, nickname,
+							   finger, meta);
+    this->_pending_buddies.append(buddy);
+    return NULL;
+  } 
+
+  SilcBuddyContact *contact =
+    new SilcBuddyContact(_account, nickname, finger, meta);  
+
+  contact->setClientEntry(entry);
+  _buddies.append(contact);
+
+  contact->watchme(true);
+  
+  return contact;
+}
+
+void 
+SilcContactManager::buddySignedOff(SilcBuddyContact *buddy,
+				   const QString &reason)
+{
+  // now check all channels for the quitting buddy
+  SilcContactList<SilcChannelContact>::iterator iter = _channels.begin();
+
+  for(; iter != _channels.end(); iter ++) {
+    if(! (* iter)->manager()) continue; // no manager, i.e. no window
+    const Kopete::ContactPtrList members = (* iter)->manager()->members();
+
+    if(members.contains(buddy)
+       && !static_cast<SilcChannelContact*>(* iter)->isJoined(buddy))
+      (* iter)->manager()->removeContact(buddy, reason);
+  }
+}
+
+SilcBuddyContact *
+SilcContactManager::lookupBuddy(const QString &name)
+{
+  return _buddies.lookup(name);
+}
+
+SilcBuddyContact *
+SilcContactManager::lookupBuddyByFingerprint(const QString &finger)
+{
+  return _buddies.lookupByFingerprint(finger);
+}
+
+bool
+SilcContactManager::addBuddy(SilcBuddyContact *buddy)
+{
+  if(this->_buddies.lookupByFingerprint(buddy->fingerprint())) {
+   return false;
+  } else {
+   _buddies.append(buddy);
+    return true;
+  }
+}
+
+SilcChannelContact *
+SilcContactManager::lookupChannel(const QString &name)
+{
+  return _channels.lookup(name);
+}
+
+SilcBuddyContact *
+SilcContactManager::lookupBuddyById(const QString &id)
+{
+  return _buddies.lookupById(id);
+}
+
+#include "silccontactmanager.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silccontactmanager.h Mon May 28 17:34:43 2007
@@ -1,0 +1,272 @@
+//                          -*- mode: C++ -*-
+//
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2006 Martin Albrecht <malb at informatik.uni-bremen.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCCONTACTMANAGER_H
+#define KOPETESILC_SILCCONTACTMANAGER_H
+
+#include <qptrlist.h>
+#include <kdemacros.h>
+#include <qobject.h>
+
+//#include "silccontact.h"
+
+class SilcAccount;
+class SilcBuddyContact;
+class SilcChannelContact;
+class SilcServerContact;
+class SilcBuddyContactData;
+class SilcContact;
+
+// include libsilc stuff directly into a separate namespace
+// we cannot just include silcaccount.h, since it does rely on 
+// SilcContactManager class ....
+namespace SilcTK {
+#include <silc.h>
+#include <silcclient.h>
+}
+
+namespace Kopete {
+  class OnlineStatus;
+  class MetaContact;
+}
+
+/**
+ * @brief list of SilcContact instances
+ *
+ * @author Stefan Siegl <stesie at brokenpipe.de>
+ */
+template <class T>
+class SilcContactList : public QPtrList<SilcContact> {
+public:
+  /**
+   * @brief compare function needed by QPtrList
+   */
+  int compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2);
+
+  /** 
+   * @brief look for the SilcContact with the provided name
+   */
+  T *lookup(const QString &name);
+
+  SilcBuddyContact *lookupByFingerprint(const QString &fingerprint);
+  SilcBuddyContact *lookupById(const QString &id);
+
+  /**
+   * @brief mark all registered SilcContact instances with the provided
+   * Kopete::OnlineStatus
+   */
+  void setStatus(Kopete::OnlineStatus status);
+};
+
+
+
+/**
+ * @brief create, destroy and otherwise care for SilcContact instances
+ *
+ * SilcContactManager is mainly responsible for creating instances of
+ * SilcChannelContact and SilcBuddyContact.  Every SilcAccount has such a
+ * manager throughout it's lifetime.
+ *
+ * On connection establishment and shutdown as well as while being connected
+ * it updates the online status of the buddies, etc.
+ *
+ * Furthermore it listens for incoming private messages (from SilcEngine
+ * driver) and delivers them to the corresponding SilcBuddyContact (which is
+ * to be created if it is not already existing)
+ *
+ * @author Stefan Siegl <stesie at brokenpipe.de>
+ */
+class SilcContactManager : public QObject {
+  Q_OBJECT;
+
+public:
+  SilcContactManager(SilcAccount *);
+  ~SilcContactManager();
+
+  /**
+   * @brief create new SilcChannelContact (if not already existing)
+   *
+   * createChannel calls lookupChannel to check whether there already is a
+   * SilcChannelContact with the specified name.  If there is not, it will
+   * allocate a new one, with the specified Kopete::MetaContact set as it's
+   * parent.
+   *
+   * If you do not specify a Kopete::MetaContact, a new (temporary, i.e. not
+   * displayed in the contact list) one will be created for you.
+   *
+   * @param name - the name of the channel
+   * @param meta - the meta contact to set as parent (or NULL)
+   */
+  SilcChannelContact *createChannel(const QString &name,
+				    Kopete::MetaContact *meta = 0, 
+				    SilcTK::SilcChannelEntry = 0);
+
+  /**
+   * @brief find an already existing SilcChannelContact
+   *
+   * NULL is returned, in case the channel is yet unknown
+   *
+   * @param name - the name of the channel to seek for
+   */
+  SilcChannelContact *lookupChannel(const QString &name);
+
+  /**
+   * @brief create new SilcBuddyContact (if not already existing)
+   *
+   * createBuddy calls lookupBuddy to check whether there already is a
+   * SilcBuddyContact with the specified name.  If there is not, it will
+   * allocate a new one, with the specified Kopete::MetaContact set as it's
+   * parent.
+   *
+   * If you do not specify a Kopete::MetaContact, a new (temporary, i.e. not
+   * displayed in the contact list) one will be created for you.
+   *
+   * @param name - the name of the (remote) user
+   * @param entry - the SilcTK structure for this client
+   * @param meta - the meta contact to set as parent (or NULL)
+   */
+ 
+  SilcBuddyContact *createBuddy(const QString &name,
+                                Kopete::MetaContact *meta = NULL,
+                                SilcTK::SilcClientEntry entry = NULL);
+
+  SilcBuddyContact *createBuddy(Kopete::MetaContact *meta,
+				const QString &finger);
+
+  /**
+   * pops the buddy identified by nickname from the pending buddies
+   * list
+   *
+   * returns NULL if nothing is found
+   * 
+   * @param nickname - nickname to identify buddy
+   */
+
+  SilcBuddyContactData *popPendingBuddy(const QString &nickname);
+
+  /**
+   * @brief find an already existing SilcBuddyContact
+   *
+   * NULL is returned, in case the buddy is not known yet
+   *
+   * @param name - the nickname of the buddy to seek for
+   * @deprecated  You should not identify a buddy by it's nickname, use
+   * it's fingerprint instead.
+   */
+  KDE_DEPRECATED SilcBuddyContact *lookupBuddy(const QString &name);
+
+
+/**
+   * @brief find an already existing SilcBuddyContact
+   *
+   * NULL is returned, in case the buddy is not known yet
+   *
+   * @param name - the fingerprint of the buddy to seek for
+   */
+
+  SilcBuddyContact * lookupBuddyByFingerprint(const QString &finger);
+
+  /**
+   * @brief adds a buddy to the Buddy List
+   *
+   * false is returned if the buddy is already in the listens
+   *
+   * @param buddy - the buddy to add
+   */
+
+   bool addBuddy(SilcBuddyContact *buddy);
+
+  /**
+   * @brief find an already existing SilcBuddyContact by it's ID
+   *
+   * @param id - the id, including the `buddy.' part
+   */
+  SilcBuddyContact *lookupBuddyById(const QString &id);
+
+  /**
+   * @brief return a pointer back to the SilcAccount class
+   */
+  inline SilcAccount *account(void) const { return _account; }
+
+  /**
+   * @brief remove buddy from every channel he was joined in to
+   */
+  void buddySignedOff(SilcBuddyContact *buddy,
+		      const QString &message = QString::null);
+
+  /**
+   */
+  void setOnlineStatus(SilcBuddyContact *, const Kopete::OnlineStatus &);
+
+  SilcServerContact *createServer(const QString &hostname);
+
+  /**
+   * @brief add all buddies to the watch list (or remove them again)
+   */
+  void watchAllBuddies(bool watch);
+
+protected:
+  /**
+   * @brief list of registered channels
+   */
+  SilcContactList<SilcChannelContact> _channels;
+
+  /**
+   * @brief list of registered users
+   */
+  SilcContactList<SilcBuddyContact> _buddies;
+
+  /**
+   * @brief list of pending users
+   */
+  QPtrList<SilcBuddyContactData> _pending_buddies;
+
+private:
+  /**
+   * @brief pointer back to the SilcAccount (our parent)
+   */
+  SilcAccount *_account;
+
+  static void getClientsCallback(SilcTK::SilcClient,
+				 SilcTK::SilcClientConnection,
+				 SilcTK::SilcStatus status,
+				 SilcTK::SilcDList celist,
+				 void *context);
+
+  unsigned int _outstandingWhoisRequests;
+
+private slots:
+  /** 
+   * @brief connection to the SILC network successfully established
+   *
+   * Mark all registered SilcChannelContact instances 'online' and fire
+   * /WHOIS requests for buddies to learn about their online status.
+   */
+  void slotConnected(void);
+
+  /**
+   * @brief connection to the SILC network was reset
+   *
+   * Mark all buddies and channels offline.
+   */
+  void slotDisconnected(void);
+};
+
+#endif // KOPETESILC_SILCCONTACTMANAGER_H

Added: kopete-silc-plugin/branches/upstream/current/src/silceditaccount.ui
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silceditaccount.ui?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silceditaccount.ui (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silceditaccount.ui Mon May 28 17:34:43 2007
@@ -1,0 +1,936 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SilcEditAccount</class>
+<widget class="QWidget">
+    <property name="name">
+        <cstring>SilcEditAccount</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>467</width>
+            <height>671</height>
+        </rect>
+    </property>
+    <property name="sizePolicy">
+        <sizepolicy>
+            <hsizetype>3</hsizetype>
+            <vsizetype>3</vsizetype>
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+        </sizepolicy>
+    </property>
+    <property name="baseSize">
+        <size>
+            <width>440</width>
+            <height>575</height>
+        </size>
+    </property>
+    <property name="caption">
+        <string>SilcEditAccount</string>
+    </property>
+    <grid>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="QTabWidget" row="0" column="0">
+            <property name="name">
+                <cstring>Tabulate</cstring>
+            </property>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>&amp;Basic Setup</string>
+                </attribute>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>grpAccountInformation</cstring>
+                        </property>
+                        <property name="frameShape">
+                            <enum>GroupBoxPanel</enum>
+                        </property>
+                        <property name="frameShadow">
+                            <enum>Sunken</enum>
+                        </property>
+                        <property name="title">
+                            <string>Account Information</string>
+                        </property>
+                        <grid>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLabel" row="0" column="0">
+                                <property name="name">
+                                    <cstring>lblNickName</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>&amp;Nickname:</string>
+                                </property>
+                                <property name="buddy" stdset="0">
+                                    <cstring>NickName</cstring>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>This is the name that everyone will see everytime you say something</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit" row="0" column="1">
+                                <property name="name">
+                                    <cstring>NickName</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>3</hsizetype>
+                                        <vsizetype>0</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="minimumSize">
+                                    <size>
+                                        <width>150</width>
+                                        <height>0</height>
+                                    </size>
+                                </property>
+                                <property name="toolTip" stdset="0">
+                                    <string>This is the name that everyone will see everytime you say something</string>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>The nickname you would like to use on the SILC network.  You may change this once online with the /nick command.</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit" row="1" column="1">
+                                <property name="name">
+                                    <cstring>UserName</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>3</hsizetype>
+                                        <vsizetype>0</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="minimumSize">
+                                    <size>
+                                        <width>150</width>
+                                        <height>0</height>
+                                    </size>
+                                </property>
+                                <property name="echoMode">
+                                    <enum>Normal</enum>
+                                </property>
+                                <property name="toolTip" stdset="0">
+                                    <string>The username you would prefer to use on the SILC network. Leave blank to use your system account name.</string>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>The username you would prefer to use on the SILC network. Leave blank to use your system account name.</string>
+                                </property>
+                            </widget>
+                            <widget class="QLabel" row="1" column="0">
+                                <property name="name">
+                                    <cstring>lblUserName</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>&amp;Username:</string>
+                                </property>
+                                <property name="buddy" stdset="0">
+                                    <cstring>UserName</cstring>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>The username you would prefer to use on SILC network, if your system does not have identd support.  Leave blank to use your system account name.</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit" row="2" column="1">
+                                <property name="name">
+                                    <cstring>RealName</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>3</hsizetype>
+                                        <vsizetype>0</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="minimumSize">
+                                    <size>
+                                        <width>150</width>
+                                        <height>0</height>
+                                    </size>
+                                </property>
+                                <property name="echoMode">
+                                    <enum>Normal</enum>
+                                </property>
+                                <property name="toolTip" stdset="0">
+                                    <string>If you want other people on the SILC network to see your real name, you can enter it here.</string>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>If you want other people on the SILC network to see your real name, you can enter it here.</string>
+                                </property>
+                            </widget>
+                            <widget class="QLabel" row="2" column="0">
+                                <property name="name">
+                                    <cstring>lblRealName</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>&amp;Real name:</string>
+                                </property>
+                                <property name="buddy" stdset="0">
+                                    <cstring>RealName</cstring>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+                                <property name="name">
+                                    <cstring>ExcludeConnect</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>E&amp;xclude from connect all</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+X</string>
+                                </property>
+                            </widget>
+                        </grid>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>grpNetworkConnection</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>5</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="title">
+                            <string>Network Connection</string>
+                        </property>
+                        <grid>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLabel" row="0" column="0">
+                                <property name="name">
+                                    <cstring>lblRemoteHost</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Re&amp;mote Host:</string>
+                                </property>
+                                <property name="buddy" stdset="0">
+                                    <cstring>RemoteHost</cstring>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>This is the name that everyone will see everytime you say something</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit" row="0" column="1">
+                                <property name="name">
+                                    <cstring>RemoteHost</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>3</hsizetype>
+                                        <vsizetype>0</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                                <property name="minimumSize">
+                                    <size>
+                                        <width>150</width>
+                                        <height>0</height>
+                                    </size>
+                                </property>
+                                <property name="text">
+                                    <string>silc.silcnet.org</string>
+                                </property>
+                                <property name="toolTip" stdset="0">
+                                    <string>host[:port]</string>
+                                </property>
+                                <property name="whatsThis" stdset="0">
+                                    <string>The alias you would like to use on SILC.</string>
+                                </property>
+                            </widget>
+                        </grid>
+                    </widget>
+                    <spacer>
+                        <property name="name">
+                            <cstring>spcBasicSetup</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>160</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </vbox>
+            </widget>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>Public &amp;Keys</string>
+                </attribute>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>grpServerFingerprints</cstring>
+                        </property>
+                        <property name="title">
+                            <string>SILC-Server Fingerprints</string>
+                        </property>
+                        <vbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLayoutWidget">
+                                <property name="name">
+                                    <cstring>hboxServerFingerprints</cstring>
+                                </property>
+                                <hbox>
+                                    <property name="name">
+                                        <cstring>unnamed</cstring>
+                                    </property>
+                                    <widget class="QListView">
+                                        <column>
+                                            <property name="text">
+                                                <string>Hostname</string>
+                                            </property>
+                                            <property name="clickable">
+                                                <bool>true</bool>
+                                            </property>
+                                            <property name="resizable">
+                                                <bool>true</bool>
+                                            </property>
+                                        </column>
+                                        <column>
+                                            <property name="text">
+                                                <string>IP-Address</string>
+                                            </property>
+                                            <property name="clickable">
+                                                <bool>true</bool>
+                                            </property>
+                                            <property name="resizable">
+                                                <bool>true</bool>
+                                            </property>
+                                        </column>
+                                        <column>
+                                            <property name="text">
+                                                <string>Port</string>
+                                            </property>
+                                            <property name="clickable">
+                                                <bool>true</bool>
+                                            </property>
+                                            <property name="resizable">
+                                                <bool>true</bool>
+                                            </property>
+                                        </column>
+                                        <column>
+                                            <property name="text">
+                                                <string>Fingerprint</string>
+                                            </property>
+                                            <property name="clickable">
+                                                <bool>true</bool>
+                                            </property>
+                                            <property name="resizable">
+                                                <bool>true</bool>
+                                            </property>
+                                        </column>
+                                        <property name="name">
+                                            <cstring>listServerFingerprints</cstring>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLayoutWidget">
+                                        <property name="name">
+                                            <cstring>vboxRemove</cstring>
+                                        </property>
+                                        <vbox>
+                                            <property name="name">
+                                                <cstring>unnamed</cstring>
+                                            </property>
+                                            <widget class="QPushButton">
+                                                <property name="name">
+                                                    <cstring>cmdRemove</cstring>
+                                                </property>
+                                                <property name="text">
+                                                    <string>&amp;Remove</string>
+                                                </property>
+                                            </widget>
+                                            <spacer>
+                                                <property name="name">
+                                                    <cstring>spcRemove</cstring>
+                                                </property>
+                                                <property name="orientation">
+                                                    <enum>Vertical</enum>
+                                                </property>
+                                                <property name="sizeType">
+                                                    <enum>Expanding</enum>
+                                                </property>
+                                                <property name="sizeHint">
+                                                    <size>
+                                                        <width>20</width>
+                                                        <height>121</height>
+                                                    </size>
+                                                </property>
+                                            </spacer>
+                                        </vbox>
+                                    </widget>
+                                </hbox>
+                            </widget>
+                        </vbox>
+                    </widget>
+                </vbox>
+            </widget>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>TabPage</cstring>
+                </property>
+                <attribute name="title">
+                    <string>Beha&amp;viour</string>
+                </attribute>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>grpMessageSettings</cstring>
+                        </property>
+                        <property name="title">
+                            <string>Message settings</string>
+                        </property>
+                        <vbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>chkSignChannelMessages</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Sign channel &amp;messages</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+M</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>chkSignChannelActions</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Sign channel &amp;actions</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+A</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>chkSignPrivateMessages</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Sign p&amp;rivate messages</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+R</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>chkSignPrivateActions</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Sign pri&amp;vate actions</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+V</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>chkDisplayImagesInline</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Displa&amp;y small SilcMime images inline</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+Y</string>
+                                </property>
+                            </widget>
+                        </vbox>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>groupBox5</cstring>
+                        </property>
+                        <property name="title">
+                            <string>File Transfer settings</string>
+                        </property>
+                        <grid>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLabel" row="2" column="0">
+                                <property name="name">
+                                    <cstring>textLabel2</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>bind local port:</string>
+                                </property>
+                            </widget>
+                            <widget class="QComboBox" row="2" column="1">
+                                <item>
+                                    <property name="text">
+                                        <string>bind always</string>
+                                    </property>
+                                </item>
+                                <item>
+                                    <property name="text">
+                                        <string>bind never</string>
+                                    </property>
+                                </item>
+                                <item>
+                                    <property name="text">
+                                        <string>autodetect nat</string>
+                                    </property>
+                                </item>
+                                <property name="name">
+                                    <cstring>bindSelection</cstring>
+                                </property>
+                                <property name="sizePolicy">
+                                    <sizepolicy>
+                                        <hsizetype>7</hsizetype>
+                                        <vsizetype>0</vsizetype>
+                                        <horstretch>0</horstretch>
+                                        <verstretch>0</verstretch>
+                                    </sizepolicy>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+                                <property name="name">
+                                    <cstring>chkFtAutoAccept</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>accept &amp;incoming file transfer requests automatically</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+I</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+                                <property name="name">
+                                    <cstring>chkUseSilcMime</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>prefer to send data as SilcMime ob&amp;jects</string>
+                                </property>
+                                <property name="accel">
+                                    <string>Alt+J</string>
+                                </property>
+                            </widget>
+                        </grid>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>boxDefaultMessages</cstring>
+                        </property>
+                        <property name="title">
+                            <string>Default Messages</string>
+                        </property>
+                        <hbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLabel">
+                                <property name="name">
+                                    <cstring>lblQuitMessage</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>&amp;Quit Message:</string>
+                                </property>
+                                <property name="buddy" stdset="0">
+                                    <cstring>QuitMessage</cstring>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit">
+                                <property name="name">
+                                    <cstring>QuitMessage</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>kopete_silc : http://www.brokenpipe.de/SILC/</string>
+                                </property>
+                            </widget>
+                        </hbox>
+                    </widget>
+                    <spacer>
+                        <property name="name">
+                            <cstring>spacer4</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>20</width>
+                                <height>65</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </vbox>
+            </widget>
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>TabPage</cstring>
+                </property>
+                <attribute name="title">
+                    <string>Attributes</string>
+                </attribute>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>chkAttr</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Sending of attributes allowed</string>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>attrTimezone</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Sending timezone allowed</string>
+                        </property>
+                    </widget>
+                    <widget class="QLayoutWidget">
+                        <property name="name">
+                            <cstring>layout3</cstring>
+                        </property>
+                        <hbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QLabel">
+                                <property name="name">
+                                    <cstring>textLabel1</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Language:</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit">
+                                <property name="name">
+                                    <cstring>attrLanguage</cstring>
+                                </property>
+                            </widget>
+                        </hbox>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>groupBox7</cstring>
+                        </property>
+                        <property name="title">
+                            <string>Mood</string>
+                        </property>
+                        <grid>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QCheckBox" row="0" column="0">
+                                <property name="name">
+                                    <cstring>attrMoodHappy</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>happy</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="0">
+                                <property name="name">
+                                    <cstring>attrMoodSad</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>sad</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="1">
+                                <property name="name">
+                                    <cstring>attrMoodJealous</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>jealous</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="2">
+                                <property name="name">
+                                    <cstring>attrMoodInLove</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>in love</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="1">
+                                <property name="name">
+                                    <cstring>attrMoodAshamed</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>ashamed</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="2">
+                                <property name="name">
+                                    <cstring>attrMoodSleepy</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>sleepy</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="3">
+                                <property name="name">
+                                    <cstring>attrMoodExcited</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>excited</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="3">
+                                <property name="name">
+                                    <cstring>attrMoodAnxious</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>anxious</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="2" column="0">
+                                <property name="name">
+                                    <cstring>attrMoodAngry</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>angry</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="2" column="1">
+                                <property name="name">
+                                    <cstring>attrMoodInvincible</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>invincible</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="2" column="2">
+                                <property name="name">
+                                    <cstring>attrMoodBored</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>bored</string>
+                                </property>
+                            </widget>
+                        </grid>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>groupBox8</cstring>
+                        </property>
+                        <property name="title">
+                            <string>Preferred medium</string>
+                        </property>
+                        <grid>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QCheckBox" row="0" column="0">
+                                <property name="name">
+                                    <cstring>attrContactEmail</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>email</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="1">
+                                <property name="name">
+                                    <cstring>attrContactPaging</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>paging</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="0">
+                                <property name="name">
+                                    <cstring>attrContactPhone</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>phone call</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="2">
+                                <property name="name">
+                                    <cstring>attrContactMMS</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>MMS</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="3">
+                                <property name="name">
+                                    <cstring>attrContactVideo</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>video conference</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="1">
+                                <property name="name">
+                                    <cstring>attrContactSMS</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>SMS</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="1" column="2">
+                                <property name="name">
+                                    <cstring>attrContactChat</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>chatting</string>
+                                </property>
+                            </widget>
+                        </grid>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>groupBox9</cstring>
+                        </property>
+                        <property name="title">
+                            <string>Location on Earth</string>
+                        </property>
+                        <hbox>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>chkAttrGeo</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>allowed</string>
+                                </property>
+                            </widget>
+                            <widget class="KDoubleNumInput">
+                                <property name="name">
+                                    <cstring>attrGeoLong</cstring>
+                                </property>
+                                <property name="label">
+                                    <string>Longitude</string>
+                                </property>
+                                <property name="minValue">
+                                    <number>-180</number>
+                                </property>
+                                <property name="maxValue">
+                                    <number>180</number>
+                                </property>
+                            </widget>
+                            <widget class="KDoubleNumInput">
+                                <property name="name">
+                                    <cstring>attrGeoLat</cstring>
+                                </property>
+                                <property name="label">
+                                    <string>Latitude</string>
+                                </property>
+                                <property name="minValue">
+                                    <number>-90</number>
+                                </property>
+                                <property name="maxValue">
+                                    <number>90</number>
+                                </property>
+                            </widget>
+                            <widget class="KIntNumInput">
+                                <property name="name">
+                                    <cstring>attrGeoAlt</cstring>
+                                </property>
+                                <property name="label">
+                                    <string>Altitude</string>
+                                </property>
+                                <property name="minValue">
+                                    <number>-11034</number>
+                                </property>
+                                <property name="maxValue">
+                                    <number>8850</number>
+                                </property>
+                            </widget>
+                        </hbox>
+                    </widget>
+                    <widget class="QGroupBox">
+                        <property name="name">
+                            <cstring>groupBox11</cstring>
+                        </property>
+                        <property name="title">
+                            <string>Status Message</string>
+                        </property>
+                        <grid>
+                            <property name="name">
+                                <cstring>unnamed</cstring>
+                            </property>
+                            <widget class="KTextEdit" row="0" column="0">
+                                <property name="name">
+                                    <cstring>attrStatus</cstring>
+                                </property>
+                                <property name="acceptDrops">
+                                    <bool>true</bool>
+                                </property>
+                            </widget>
+                        </grid>
+                    </widget>
+                </vbox>
+            </widget>
+        </widget>
+    </grid>
+</widget>
+<tabstops>
+    <tabstop>Tabulate</tabstop>
+    <tabstop>NickName</tabstop>
+    <tabstop>UserName</tabstop>
+    <tabstop>RealName</tabstop>
+    <tabstop>RemoteHost</tabstop>
+    <tabstop>listServerFingerprints</tabstop>
+    <tabstop>cmdRemove</tabstop>
+    <tabstop>chkSignChannelMessages</tabstop>
+    <tabstop>chkSignChannelActions</tabstop>
+    <tabstop>chkSignPrivateMessages</tabstop>
+    <tabstop>chkSignPrivateActions</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>ktextedit.h</includehint>
+</includehints>
+</UI>

Added: kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,347 @@
+//              -*- mode: C++ -*-
+// Copyright(C) 2005,2007 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <kconfigbase.h>
+#include <qlistview.h>
+#include <knuminput.h>
+#include <ktextedit.h>
+#include <kdebug.h>
+
+#include "silcprotocol.h"
+
+#include "silceditaccountwidget.h"
+#include "silcaccount.h"
+
+SilcEditAccountWidget::SilcEditAccountWidget(SilcProtocol *,
+					     SilcAccount *account,
+					     QWidget *parent)
+  : SilcEditAccount(parent), KopeteEditAccountWidget(account),
+    serverKeysToDelete()
+{
+  if(account) {
+    // editing an already existing SilcAccount, therefore show it's current
+    // settings in our SilcEditAccountWidget
+    NickName->setText(account->myself()->nickName());
+    UserName->setText(account->userName());
+    RealName->setText(account->realName());
+    RemoteHost->setText(account->hostName());
+    ExcludeConnect->setChecked(account->excludeConnect());
+
+    // set message sign flags ...
+    chkSignChannelMessages->setChecked(account->signChannelMessages());
+    chkSignChannelActions->setChecked(account->signChannelActions());
+    chkSignPrivateMessages->setChecked(account->signPrivateMessages());
+    chkSignPrivateActions->setChecked(account->signPrivateActions());
+    chkDisplayImagesInline->setChecked(account->displayImagesInline());
+
+    // set File Transfer settings ...
+    chkUseSilcMime->setChecked(account->useSilcMime());
+    chkFtAutoAccept->setChecked(account->ftAutoAccept());
+    bindSelection->setCurrentItem(account->getFtBind());
+
+    // set Default Messages settings ...
+    QuitMessage->setText(account->quitMessage());
+
+    // list available server fingerprints ...
+    QStringList list =
+      account->configGroup()->readListEntry("serverkey_hostlist");
+    for(QStringList::Iterator it = list.begin(); it != list.end(); it ++) {
+      const int i = (* it).findRev(':');
+      if(i < 0) {
+	std::cerr << "invalid hostlist entry " << (* it).latin1() << std::endl;
+	continue;
+      }
+
+      const QString port = (* it).mid(i + 1);
+      const int j = (* it).findRev('_', i);
+      if(j < 0) {
+	std::cerr << "invalid hostlist entry " << (* it).latin1() << std::endl;
+	continue;
+      }
+
+      const QString ip = (* it).mid(j + 1, i - j - 1);
+      const QString host = (* it).left(j);
+      const QString hostent = QString("serverkey_%2").arg(* it);
+      const QString &finger = account->configGroup()->readEntry(hostent);
+
+      QListViewItem *item = new QListViewItem(listServerFingerprints, 
+					      host, ip, port, finger);
+      if(! item) {
+	std::cerr << "unable to allocate QListViewItem" << std::endl;
+	continue;
+      }
+
+      listServerFingerprints->insertItem(item);
+    }
+    // set moods
+    setAttributeMood((SilcTK::SilcAttributeMood) account->getAttributeMood());
+    // set contact mediums
+    setAttributeContact
+      ((SilcTK::SilcAttributeContact) account->getAttributeContact());
+
+    // set other attributes
+    attrTimezone->setChecked(account->getAttributeTimezone());
+    chkAttr->setChecked(account->getAttributesAllowed());
+    attrLanguage->setText(account->getAttributeLanguage());
+    attrStatus->setText(account->getAttributeMessage());
+
+    chkAttrGeo->setChecked(account->getGeoAllowed());
+    attrGeoLong->setValue(account->getGeoLongitude());
+    attrGeoLat->setValue(account->getGeoLatitude());
+    attrGeoAlt->setValue(account->getGeoAltitude());
+
+    slotGeoAllowToggle(account->getGeoAllowed());
+    slotAllowToggle(account->getAttributesAllowed());
+
+  }
+
+  QObject::connect((QObject *) cmdRemove, SIGNAL(clicked()), 
+		   this, SLOT(slotRemoveServerKey()));
+  QObject::connect((QObject *) chkAttrGeo, SIGNAL(toggled(bool)), 
+		   this, SLOT(slotGeoAllowToggle(bool)));
+  QObject::connect((QObject *) chkAttr, SIGNAL(toggled(bool)), 
+		   this, SLOT(slotAllowToggle(bool)));
+}
+
+SilcEditAccountWidget::~SilcEditAccountWidget()
+{
+}
+
+bool
+SilcEditAccountWidget::validateData(void)
+{
+  if(NickName->text().isEmpty())
+    KMessageBox::sorry(this, i18n("<qt>You must enter a nickname.</qt>"));
+  else if(NickName->text().contains("@") || NickName->text().contains(" ")) {
+    //BUG: this is a hack, do it properly
+    KMessageBox::sorry(this, 
+    i18n("<qt>Please remove any @ or space from the nickname</qt>"));
+  }
+  else if(RemoteHost->text().isEmpty())
+    KMessageBox::sorry(this, i18n("<qt>You have to specify a "
+				  "remote host.</qt>"));
+  else
+    return true; // all the stuff is valid
+
+  return false;
+}
+
+Kopete::Account *
+SilcEditAccountWidget::apply(void)
+{
+  
+  const QString nickName = this->NickName->text();
+  const QString remoteHost = RemoteHost->text();
+
+  SilcAccount *a;
+
+  if(! this->account()) {
+    a = new SilcAccount(SilcProtocol::protocol(),
+			QString("%1@%2").arg(nickName).arg(remoteHost), 
+			nickName.utf8());
+    if(! a) return NULL;
+    this->setAccount(a);
+  }
+  else {
+    a = static_cast<SilcAccount *>(this->account());
+    a->setNickName(nickName);
+  }
+
+  if(!validateData()) {
+    return a;
+  }
+
+  a->setRealName(RealName->text());
+  a->setUserName(UserName->text());
+  a->setHostName(remoteHost);
+  a->setExcludeConnect(ExcludeConnect->isChecked());
+
+  a->setSignChannelMessages(chkSignChannelMessages->isChecked());
+  a->setSignChannelActions(chkSignChannelActions->isChecked());
+  a->setSignPrivateMessages(chkSignPrivateMessages->isChecked());
+  a->setSignPrivateActions(chkSignPrivateActions->isChecked());
+  a->setDisplayImagesInline(chkDisplayImagesInline->isChecked());
+
+  a->setUseSilcMime(chkUseSilcMime->isChecked());
+  a->setFtAutoAccept(chkFtAutoAccept->isChecked());
+  a->setFtBind(bindSelection->currentItem());
+
+  a->setQuitMessage(QuitMessage->text());
+  a->setAttributeMood(getAttributeMood());
+  a->setAttributeContact(getAttributeContact());
+
+  // delete the keys, queued for deletion
+  QStringList list = a->configGroup()->readListEntry("serverkey_hostlist");
+  for(QStringList::Iterator it = serverKeysToDelete.begin(); 
+      it != serverKeysToDelete.end(); it ++) {
+    a->configGroup()->deleteEntry(QString("serverkey_%1").arg(* it));
+    list.remove(* it);
+  }
+  a->configGroup()->writeEntry("serverkey_hostlist", list);
+
+  a->setGeoInformations(chkAttrGeo->isChecked(), attrGeoLong->value(),
+                        attrGeoLat->value(), attrGeoAlt->value());
+  a->setAttributeLanguage(attrLanguage->text());
+  a->setAttributeMessage(attrStatus->text());
+  a->setAttributesAllowed(chkAttr->isChecked());
+  a->setAttributeTimezone(attrTimezone->isChecked());
+
+  a->updateAttributes();
+
+  return a;
+}
+
+
+
+void
+SilcEditAccountWidget::slotRemoveServerKey(void)
+{
+  QListViewItem *sel = listServerFingerprints->selectedItem();
+  if(! sel) return;
+
+  QString hostent = 
+    QString("%1_%2:%3").arg(sel->text(0)).arg(sel->text(1)).arg(sel->text(2));
+
+  serverKeysToDelete += hostent; // queue for real deletion
+  delete sel; // remove item from list
+}
+void
+SilcEditAccountWidget::slotGeoAllowToggle(bool value)
+{
+  attrGeoLong->setEnabled(value);
+  attrGeoLat->setEnabled(value);
+  attrGeoAlt->setEnabled(value);
+}
+
+void 
+SilcEditAccountWidget::slotAllowToggle(bool value)
+{
+  attrTimezone->setEnabled(value);
+  attrLanguage->setEnabled(value);
+  attrMoodHappy->setEnabled(value);
+  attrMoodSad->setEnabled(value);
+  attrMoodAngry->setEnabled(value);
+  attrMoodJealous->setEnabled(value);
+  attrMoodAshamed->setEnabled(value);
+  attrMoodInvincible->setEnabled(value);
+  attrMoodInLove->setEnabled(value);
+  attrMoodSleepy->setEnabled(value);
+  attrMoodBored->setEnabled(value);
+  attrMoodExcited->setEnabled(value);
+  attrMoodAnxious->setEnabled(value);
+  attrContactEmail->setEnabled(value);
+  attrContactPhone->setEnabled(value);
+  attrContactPaging->setEnabled(value);
+  attrContactSMS->setEnabled(value);
+  attrContactMMS->setEnabled(value);
+  attrContactChat->setEnabled(value);
+  attrContactVideo->setEnabled(value);
+  attrStatus->setEnabled(value);  
+  chkAttrGeo->setEnabled(value);
+  slotGeoAllowToggle(value & chkAttrGeo->isChecked());
+}
+
+void
+SilcEditAccountWidget::setAttributeMood(SilcTK::SilcAttributeMood mood)
+{
+  attrMoodHappy->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_HAPPY);
+  attrMoodSad->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_SAD);
+  attrMoodAngry->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_ANGRY);
+  attrMoodJealous->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_JEALOUS);
+  attrMoodAshamed->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_ASHAMED);
+  attrMoodInvincible->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_INVINCIBLE);
+  attrMoodInLove->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_INLOVE);
+  attrMoodSleepy->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_SLEEPY);
+  attrMoodBored->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_BORED);
+  attrMoodExcited->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_EXCITED);
+  attrMoodAnxious->setChecked(mood & SilcTK::SILC_ATTRIBUTE_MOOD_ANXIOUS);
+}
+
+SilcTK::SilcAttributeMood 
+SilcEditAccountWidget::getAttributeMood(void)
+{
+  SilcTK::SilcUInt32 mood = 0;
+  
+  if(attrMoodHappy->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_HAPPY;
+  if(attrMoodSad->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_SAD;
+  if(attrMoodAngry->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_ANGRY;
+  if(attrMoodJealous->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_JEALOUS;
+  if(attrMoodAshamed->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_ASHAMED;
+  if(attrMoodInvincible->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_INVINCIBLE;
+  if(attrMoodInLove->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_INLOVE;
+  if(attrMoodSleepy->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_SLEEPY;
+  if(attrMoodBored->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_BORED;
+  if(attrMoodExcited->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_EXCITED;
+  if(attrMoodAnxious->isChecked())
+    mood |= SilcTK::SILC_ATTRIBUTE_MOOD_ANXIOUS;
+  
+  return (SilcTK::SilcAttributeMood) mood;  
+}
+
+void 
+SilcEditAccountWidget::setAttributeContact(SilcTK::SilcAttributeContact contact)
+{
+  attrContactEmail->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_EMAIL);
+  attrContactPhone->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_CALL);
+  attrContactPaging->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_PAGE);
+  attrContactSMS->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_SMS);
+  attrContactMMS->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_MMS);
+  attrContactChat->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_CHAT);
+  attrContactVideo->setChecked(contact & SilcTK::SILC_ATTRIBUTE_CONTACT_VIDEO);
+}
+
+SilcTK::SilcAttributeContact 
+SilcEditAccountWidget::getAttributeContact(void)
+{
+  SilcTK::SilcUInt32 contact = 0;
+  if(attrContactEmail->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_EMAIL;
+  if(attrContactPhone->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_CALL;
+  if(attrContactPaging->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_PAGE;
+  if(attrContactSMS->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_SMS;
+  if(attrContactMMS->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_MMS;
+  if(attrContactChat->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_CHAT;
+  if(attrContactVideo->isChecked())
+    contact |= SilcTK::SILC_ATTRIBUTE_CONTACT_VIDEO;
+
+  return (SilcTK::SilcAttributeContact) contact;
+}
+
+#include "silceditaccountwidget.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silceditaccountwidget.h Mon May 28 17:34:43 2007
@@ -1,0 +1,99 @@
+//              -*- mode: C++ -*-
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCEDITACCOUNTWIDGET_H
+#define KOPETESILC_SILCEDITACCOUNTWIDGET_H
+
+#include <ui/editaccountwidget.h>
+
+// import the base widget class
+#include "silceditaccount.h" 
+
+// include libsilc stuff into a separate namespace
+namespace SilcTK {
+#include <silc.h>
+#include <silcclient.h>
+}
+
+
+// forward declarations
+class SilcProtocol;
+class SilcAccount;
+
+/**
+ * @brief create the KopeteEditAccountWidget
+ *
+ * @author Stefan Siegl <stesie at brokenpipe.de>
+ */
+class SilcEditAccountWidget :
+  public SilcEditAccount,
+  public KopeteEditAccountWidget {
+  Q_OBJECT;
+
+public:
+  SilcEditAccountWidget(SilcProtocol *proto, SilcAccount *account,
+			QWidget *parent);
+  ~SilcEditAccountWidget();
+
+  /**
+   * @brief validate the data, entered by the user
+   *
+   * Validate the data entered by the user.  In error case a suitable error
+   * message is displayed.
+   *
+   * @return true if the entered data is valid, false on error
+   */
+  virtual bool validateData(void);
+
+  /**
+   * @brief apply the settings made by the user to the concerned SilcAccount
+   *
+   * @return pointer to (maybe new allocated) SilcAccount class
+   */
+  virtual Kopete::Account *apply(void);
+
+  /**
+   * @brief collect mood setting from attribute tab
+   */
+  SilcTK::SilcAttributeMood getAttributeMood(void);
+
+  /** 
+   * @brief set mood setting to attribute tab
+   */
+  void setAttributeMood(SilcTK::SilcAttributeMood mood);
+  
+  /**
+   * @brief collect contact setting from attribute tab
+   */
+  SilcTK::SilcAttributeContact getAttributeContact(void);
+
+  /** 
+   * @brief set mood setting to attribute tab
+   */
+  void setAttributeContact(SilcTK::SilcAttributeContact contact);
+
+private slots:
+  void slotRemoveServerKey(void);
+  void slotGeoAllowToggle(bool value);
+  void slotAllowToggle(bool value);
+
+private:
+  QStringList serverKeysToDelete;
+};
+
+#endif // KOPETESILC_SILCEDITACCOUNTWIDGET_H

Added: kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,324 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+
+#include "silcfiletransfer.h"
+#include "silcaccount.h"
+#include "silcbuddycontact.h"
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+
+#include <kopeteuiglobal.h>
+#include <qfile.h>
+#include <kfiledialog.h> 
+
+
+
+SilcFileTransfer::SilcFileTransfer(SilcAccount *account, SilcBuddyContact *contact, 
+		       const QString &file)
+{
+  kdDebug() << "New outgoing filetransfer" << endl;
+  mAccount = account;
+  mLocalFile.setName(file);
+  mContact = contact;
+  mFileSize = mLocalFile.size();
+  mFileOffset = -1;
+  
+  mKopeteTransfer = Kopete::TransferManager::transferManager()->addTransfer
+    (contact, mLocalFile.name(), mLocalFile.size(), contact->contactId(),
+     Kopete::FileTransferInfo::Outgoing);
+
+  SilcTK::SilcClientConnectionParams params;
+  memset(&params, 0, sizeof(params));
+
+  if (! account->ftNoBind() ) 
+    params.local_ip = account->localIp();
+
+  SilcTK::SilcClientFileError err =
+    SilcTK::silc_client_file_send(account->client(), account->conn(),
+				  mContact->clientEntry(), &params, 
+                                  account->pubkey(), account->privkey(), 
+                                  sendFileMonitor, this, file.latin1(), &mSid);
+  if (err) {
+    error(err);
+    close();
+    deleteLater();
+    return;
+  }
+
+  connect(mKopeteTransfer, SIGNAL(result(KIO::Job *)),
+	  this, SLOT(slotTransferResult()));
+}
+
+SilcFileTransfer::SilcFileTransfer(SilcAccount *account, SilcBuddyContact *contact, 
+		       SilcTK::SilcUInt32 sid, bool ask_name)
+{
+  mAccount = account;
+  mContact = contact;
+  mSid = sid;
+  mFileOffset = 0;
+  mKopeteTransfer = NULL;
+  
+  kdDebug() << "New incoming filetransfer from "
+	    << contact->nickName() << endl;
+  
+  SilcTK::SilcClientConnectionParams params;
+  memset(&params, 0, sizeof(params));
+  params.local_ip = account->localIp();
+  params.no_authentication = TRUE;
+
+  SilcTK::SilcClientFileError err;
+  if (!ask_name)
+    err = SilcTK::silc_client_file_receive(account->client(), account->conn(),
+                                           &params, account->pubkey(), 
+                                           account->privkey(),
+                                           sendFileMonitor, this, 
+                                           NULL, sid, 0, 0);
+  else
+    err = SilcTK::silc_client_file_receive
+      (account->client(), account->conn(), &params, account->pubkey(), 
+       account->privkey(), sendFileMonitor, this, 0, sid, ask_filename, 
+       (void *) contact);
+
+}
+
+SilcFileTransfer::~SilcFileTransfer() 
+{
+}
+
+void 
+SilcFileTransfer::error(SilcTK::SilcClientFileError error)
+{
+  KIO::Error kio_error;
+  QString msg;
+
+  switch(error) {
+  case SilcTK::SILC_CLIENT_FILE_OK:
+    return;
+
+  case SilcTK::SILC_CLIENT_FILE_ERROR:
+    msg = i18n("Unable to perform file transfer.");
+    kio_error = KIO::ERR_UNKNOWN;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_UNKNOWN_SESSION:
+    msg = i18n("Unknown file transfer session. Unable to perform.");
+    kio_error = KIO::ERR_INTERNAL;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_ALREADY_STARTED:
+    msg = i18n("File transfer already started. Stopping here.");
+    kio_error = KIO::ERR_INTERNAL;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_NO_SUCH_FILE:
+    msg = i18n("Unable to perform file transfer: no such file.");
+    kio_error = KIO::ERR_DOES_NOT_EXIST;
+    break;
+  
+  case SilcTK::SILC_CLIENT_FILE_PERMISSION_DENIED:
+    msg = i18n("Unable to perform file transfer: permission denied.");
+    kio_error =  KIO::ERR_ACCESS_DENIED;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED:
+    msg = i18n("Unable to perform file transfer: key agreement failed.");
+    kio_error = KIO::ERR_INTERNAL;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_CONNECT_FAILED:
+    msg = i18n("Unable to perform file transfer: error during connect.");
+    kio_error = KIO::ERR_COULD_NOT_CONNECT;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_TIMEOUT:
+    msg = i18n("Unable to perform file transfer: connection timeout.");
+    kio_error = KIO::ERR_SERVER_TIMEOUT;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_NO_MEMORY:
+    msg = i18n("Unable to performfile transfer: system out of memory.");
+    kio_error = KIO::ERR_OUT_OF_MEMORY;
+    break;
+  }
+
+  mKopeteTransfer->slotError(kio_error, msg);
+}
+
+void 
+SilcFileTransfer::setOffset(Q_LLONG offset) 
+{
+  mFileOffset = offset;
+  if(mFileSize == offset) {
+    kdDebug() << "File Transfer completed" << endl;
+    if(mKopeteTransfer)
+      mKopeteTransfer->slotComplete();
+  } else {
+    if (mKopeteTransfer)
+      mKopeteTransfer->slotProcessed ( offset );
+  }
+}
+
+void 
+SilcFileTransfer::initTransfer(QString filename, Q_LLONG filesize) 
+{
+  mFileSize = filesize;
+
+  mKopeteTransfer = Kopete::TransferManager::transferManager()->addTransfer
+    (mContact, filename, (unsigned long)filesize, mContact->contactId(),
+    Kopete::FileTransferInfo::Incoming);
+
+  connect(mKopeteTransfer, SIGNAL(result(KIO::Job *)),
+	  this, SLOT(slotTransferResult()));
+}
+
+
+bool
+SilcFileTransfer::closed() 
+{
+  if (!mSid)
+    return TRUE;
+
+  return FALSE;
+}
+
+void 
+SilcFileTransfer::close()
+{
+  if(mSid != 0) {
+    SilcTK::silc_client_file_close(mAccount->client(), mAccount->conn(), mSid);
+    mSid = 0;
+  }
+  kdDebug() << "FileTransfer closed" << endl;
+}
+
+void
+SilcFileTransfer::ask_filename(SilcTK::SilcClient client,
+                               SilcTK::SilcClientConnection conn,
+                               SilcTK::SilcUInt32 session_id,
+                               const char *remote_filename,
+                               SilcTK::SilcClientFileName completion,
+                               void *completion_context,
+                               void *context)
+{
+  SilcBuddyContact *buddy = (SilcBuddyContact *) context;
+  QString fileName;
+  while(1) {
+    fileName =
+      KFileDialog::getSaveFileName(QString::null, QString::null, 
+                                   Kopete::UI::Global::mainWidget(), 
+                                   QString(i18n("File Transfer '%1' from %2"))
+                                   .arg(remote_filename)
+                                   .arg(buddy->nickName()));
+
+    if(fileName.isEmpty()) {
+      SilcTK::silc_client_file_close(client, conn, session_id);
+      return;
+    }
+
+    QFileInfo fileInfo(fileName);
+    if(fileInfo.exists()) {
+      int answer = KMessageBox::questionYesNo
+        (Kopete::UI::Global::mainWidget(),
+         QString(i18n("The file %1 does already exist. "
+                      "Do you want to overwrite it?"))
+         .arg(fileInfo.fileName()),
+         QString(i18n("File Transfer '%1' from %2"))
+         .arg(remote_filename)
+         .arg(buddy->nickName()));
+
+      if(answer == KMessageBox::Yes) {
+        QFile::remove(fileName);
+        break;
+      }
+    }
+    else 
+      break;
+  }
+  completion(fileName.latin1(), completion_context);
+}
+
+void
+SilcFileTransfer::sendFileMonitor(SilcTK::SilcClient, SilcTK::SilcClientConnection,
+		SilcTK::SilcClientMonitorStatus status,
+		SilcTK::SilcClientFileError error,
+		SilcTK::SilcUInt64 offset, SilcTK::SilcUInt64 filesize,
+		SilcTK::SilcClientEntry,
+		SilcTK::SilcUInt32, const char * filepath, void *ctx)
+{
+  SilcFileTransfer *transfer = (SilcFileTransfer *)ctx;
+
+  if(!transfer) return;
+
+  switch(status) {
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT:
+    std::cerr << "key agreement." << std::endl;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_SEND:
+    std::cerr << "send: " 
+	      << (int) offset / filesize * 100 << "%" << std::endl;
+    transfer->setOffset(offset);
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_RECEIVE:
+    if (! transfer->validTransfer())
+      transfer->initTransfer(QString(filepath), (Q_LLONG)filesize);
+    transfer->setOffset(offset);
+    std::cerr << "receive." <<std::endl;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_GET:
+    std::cerr << "get." << std::endl;
+    break;
+
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_PUT:
+    std::cerr << "put." << std::endl;
+    break;
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_DISCONNECT:
+    std::cerr << "disconntected." << std::endl;
+    if (! transfer->complete())
+      transfer->error(SilcTK::SILC_CLIENT_FILE_ERROR);
+    transfer->close();
+    break;
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_CLOSED:
+    std::cerr << "closed." << std::endl;
+    transfer->deleteLater();
+    break;
+  case SilcTK::SILC_CLIENT_FILE_MONITOR_ERROR:
+    transfer->error(error);
+    transfer->close();
+    break;
+  }
+}
+
+void 
+SilcFileTransfer::slotTransferResult()
+{
+  if(mKopeteTransfer->error() == KIO::ERR_USER_CANCELED) { 
+    kdDebug() << "Filetransfer aborted" << endl;
+    close();
+  }
+}
+
+#include "silcfiletransfer.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcfiletransfer.h Mon May 28 17:34:43 2007
@@ -1,0 +1,125 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCFILETRANSFER_H
+#define SILCFILETRANSFER_H
+
+// include libsilc stuff into a separate namespace
+namespace SilcTK {
+#include <silc.h>
+#include <silcclient.h>
+}
+
+#include <qobject.h>
+#include <qfile.h>
+#include <kopetetransfermanager.h>
+
+//#include "silcaccount.h"
+class SilcAccount;
+class SilcBuddyContact;
+
+
+
+class SilcFileTransfer : public QObject
+{
+  Q_OBJECT
+
+  public:
+
+    /*
+     * @brief initialize the transfer, after an file request was recieved
+     * ask user for filename
+     */
+    SilcFileTransfer(SilcAccount *account, SilcBuddyContact *contact, 
+              SilcTK::SilcUInt32 sid, bool ask_name = TRUE);
+    /*
+     * @brief initialize the transfer, and send an file request
+     */
+    SilcFileTransfer(SilcAccount *account, SilcBuddyContact *contact, const QString &file );
+
+    ~SilcFileTransfer ();
+
+    /* 
+     * @brief starts the KopeteTransfer for recieved transfer
+     */
+    void initTransfer(QString filename, Q_LLONG filesize);
+
+    /* 
+     * @brief check if transfer was closed already
+     */
+    bool closed(void);
+
+    /* 
+     * @brief close the connection
+     */
+    void close(void);
+
+    /* 
+     * @brief handle an occured error on the silc side of the transfer
+     */
+    void error(SilcTK::SilcClientFileError error);
+    
+    /* 
+     * @brief was the transfer completed already
+     */
+    inline bool complete(void) { return (mFileSize == mFileOffset); }
+
+    /*
+     * @brief check for the KopeteTransfer
+     */
+    inline bool validTransfer(void) { return mKopeteTransfer ? true : false; }
+
+    /* 
+     * @brief set the offset, to update the progressbar
+     */
+    void setOffset ( Q_LLONG offset );
+    
+  public slots:
+    void slotTransferResult(void);
+    
+  protected:
+    SilcTK::SilcUInt32 mSid;
+    Kopete::Transfer *mKopeteTransfer;
+    SilcAccount *mAccount;
+    SilcBuddyContact *mContact;
+    QFile mLocalFile;
+    Q_LLONG mFileOffset;
+    Q_LLONG mFileSize;
+
+  private:
+    static void
+      ask_filename(SilcTK::SilcClient client,
+                   SilcTK::SilcClientConnection conn,
+                   SilcTK::SilcUInt32 session_id,
+                   const char *remote_filename,
+                   SilcTK::SilcClientFileName completion,
+                   void *completion_context,
+                   void *context);
+    void static
+      sendFileMonitor(SilcTK::SilcClient client,
+                         SilcTK::SilcClientConnection conn,
+                         SilcTK::SilcClientMonitorStatus status,
+                         SilcTK::SilcClientFileError error,
+                         SilcTK::SilcUInt64 offset, SilcTK::SilcUInt64 filesize,
+                         SilcTK::SilcClientEntry client_entry,
+                         SilcTK::SilcUInt32 session_id,
+                         const char *filepath, void *ctx);
+};
+#endif /* SILCFILEMONITOR_H */

Added: kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,40 @@
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+
+#include "silcjoindlgwidget.h"
+
+SilcJoinDlgWidget::SilcJoinDlgWidget(QWidget* parent, const char* name,
+				     bool modal, WFlags fl)
+: joinDlg(parent,name, modal,fl)
+{
+}
+
+SilcJoinDlgWidget::~SilcJoinDlgWidget()
+{
+}
+
+void
+SilcJoinDlgWidget::setCompletionList(KCompletion &comp)
+{
+  txtChannel->setCompletionObject(&comp);
+  txtChannel->setCompletionMode(KGlobalSettings::CompletionPopup);
+}
+
+
+#include "silcjoindlgwidget.moc"
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcjoindlgwidget.h Mon May 28 17:34:43 2007
@@ -1,0 +1,51 @@
+//                      -*- mode: C++ -*-
+//
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCJOINDLGWIDGET_H
+#define SILCJOINDLGWIDGET_H
+
+#include "silcchanneljoin.h"
+#include <kcompletion.h>
+#include <klineedit.h>
+#include <qcheckbox.h>
+
+class SilcJoinDlgWidget : protected joinDlg
+{
+  Q_OBJECT
+
+public:
+  SilcJoinDlgWidget(QWidget* parent = 0, const char* name = 0,
+		    bool modal = FALSE, WFlags fl = 0);
+  ~SilcJoinDlgWidget();
+
+  void setCompletionList(KCompletion &items);
+
+  inline QString channel(void) const { return txtChannel->text(); }
+  inline QString password(void) const { return txtPassword->text(); }
+
+  inline bool founder(void) const { return chkFounder->isChecked(); }
+  inline bool auth(void) const { return chkAuth->isChecked(); }
+  
+public slots:
+  inline int exec(void) { return QDialog::exec(); }
+  
+};
+
+#endif
+

Added: kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,118 @@
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// Copyright(C) 2007 Christian Dietrich <stettberger at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+#include <assert.h>
+
+// for message boxes ...
+#include <kmessagebox.h>
+#include <kopeteuiglobal.h>
+#include <klocale.h>
+
+// our own stuff ...
+#include "silcaccount.h"
+#include "silcmessagemanager.h"
+#include "silccontact.h"
+#include "silcchannelcontact.h"
+
+SilcChatSession::SilcChatSession(const SilcContact *user, 
+				 Kopete::ContactPtrList others,
+				 SilcProtocol *protocol, 
+				 const char *name)
+  : Kopete::ChatSession(user, others, protocol, name)
+{
+  Kopete::ChatSessionManager::self()->registerChatSession(this);
+  ///@todo invite depends on state
+  setMayInvite(true);
+}
+
+SilcChatSession::~SilcChatSession()
+{
+
+}
+
+void 
+SilcChatSession::inviteContact(const QString &cid)
+{
+  if(cid[0] != '@') {
+    KMessageBox::queuedMessageBox
+      (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+       i18n("You cannot invite a channel, try again an "
+	    "drop a buddy contact next time."),
+       i18n("Invite Buddy"));
+    return;
+  }
+
+  // lookup the SilcBuddyContact* who wants to join
+  SilcAccount *a = static_cast<SilcAccount *>(account());
+  SilcBuddyContact *buddy = a->contactManager()->lookupBuddyById(cid);
+  assert(buddy);
+
+  // lookup the SilcChannelContact* which channel ought to be joined
+  Kopete::ContactPtrList mb = members();
+  Kopete::Contact *contact = mb.first();
+  assert(contact);
+
+  if(strcmp(contact->className(), "SilcChannelContact")) {
+    int answer = KMessageBox::questionYesNo
+      (Kopete::UI::Global::mainWidget(),
+       QString(i18n("Do you want to  start a conference with these buddies?")),
+       i18n("Starting a conference"));
+    if (answer == KMessageBox::Yes) {
+      SilcBuddyContact *buddy_two = static_cast<SilcBuddyContact *>(contact);
+      int retry = 5;
+      SilcChannelContact *channel;
+      SilcTK::SilcChannelEntry ch;
+      QString chnam;
+
+      while (retry) {
+        chnam = QString("#ad-hoc-%1").arg(random());
+        ch = SilcTK::silc_client_get_channel(a->client(), 
+                                             a->conn(),
+                                             (char *) chnam.latin1());
+
+        if(! ch) break;
+        retry--;
+      }
+      if(ch) {
+        KMessageBox::queuedMessageBox
+          (Kopete::UI::Global::mainWidget(), KMessageBox::Sorry,
+           i18n("Unable to figure out random room name for conference chat. Sorry."),
+           i18n("Conference chat"));
+        return;
+      }
+
+      channel = a->contactManager()->createChannel(chnam);
+      assert(channel);
+
+      channel->join();
+      channel->invite(buddy_two);
+      channel->invite(buddy);
+
+      channel->setSecret(true);
+      channel->setPrivate(true);
+      channel->setInviteOnly(true);
+    }
+    return;
+  }
+
+  SilcChannelContact *channel = static_cast<SilcChannelContact *>(contact);
+  channel->invite(buddy);
+}
+
+#include "silcmessagemanager.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcmessagemanager.h Mon May 28 17:34:43 2007
@@ -1,0 +1,40 @@
+//                          -*- mode: C++ -*-
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCPROTOCOL_SILCMESSAGEMANAGER_H
+#define SILCPROTOCOL_SILCMESSAGEMANAGER_H
+
+#include <kopetechatsession.h>
+#include <kopetechatsessionmanager.h>
+
+class SilcContact;
+class SilcProtocol;
+
+class SilcChatSession : public Kopete::ChatSession {
+  Q_OBJECT;
+
+public:
+  SilcChatSession(const SilcContact *user, Kopete::ContactPtrList others,
+		  SilcProtocol *protocol, const char *name = 0);
+  ~SilcChatSession();
+
+  virtual void inviteContact(const QString &contactId);
+
+};
+
+#endif 

Added: kopete-silc-plugin/branches/upstream/current/src/silcprotocol.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcprotocol.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcprotocol.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcprotocol.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,394 @@
+// Copyright(C) 2005,2006,2007 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+
+//#undef KDE_NO_COMPAT
+#include <kxmlguiclient.h>
+#include <kgenericfactory.h>
+
+#include <kopeteonlinestatus.h>
+#include <kopeteonlinestatusmanager.h>
+#include <kopeteaccountmanager.h>
+#include <kopetecommandhandler.h>
+#include <kopetechatsession.h>
+#include <kopetemessage.h>
+
+#include "silcprotocol.h"
+#include "silcaddcontactpage.h"
+#include "silceditaccountwidget.h"
+#include "silcchannelcontact.h"
+#include "silcbuddycontact.h"
+#include "silcaccount.h"
+
+typedef KGenericFactory<SilcProtocol> SilcProtocolFactory;
+K_EXPORT_COMPONENT_FACTORY(kopete_silc, SilcProtocolFactory("kopete_silc"));
+
+SilcProtocol *SilcProtocol::_protocol = NULL;
+
+SilcProtocol::SilcProtocol(QObject *parent, const char *name,
+			   const QStringList & /* args */)
+  : Kopete::Protocol(SilcProtocolFactory::instance(), parent, name),
+
+    // register online statuses ...
+    statusOnline(Kopete::OnlineStatus::Online, Online, this,
+		 Online, QString::null, i18n("Online"),
+		 i18n("Online"), Kopete::OnlineStatusManager::Online),
+    statusOnlineMute(Kopete::OnlineStatus::Online, OnlineMute, this,
+		     OnlineMute, "silc_mute", i18n("Mute"),
+		     i18n("Online, Mute"),
+		     Kopete::OnlineStatusManager::Online,
+		     Kopete::OnlineStatusManager::HideFromMenu),
+    statusOnlineOpMute(Kopete::OnlineStatus::Online, OnlineOpMute, this,
+		       OnlineOpMute,
+		       QStringList::split(' ', "silc_op silc_mute"),
+		       i18n("Op/Mute"), i18n("Online, Op, Mute"),
+		       Kopete::OnlineStatusManager::Online,
+		       Kopete::OnlineStatusManager::HideFromMenu),
+    statusOnlineOp(Kopete::OnlineStatus::Online, OnlineOp, this,
+		   OnlineOp, "silc_op", i18n("Op"), i18n("Online, Op"),
+		   Kopete::OnlineStatusManager::Online,
+		   Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusOnlineChannel(Kopete::OnlineStatus::Online, OnlineChannel, this,
+			OnlineChannel, "silc_channel", i18n("Online"),
+			i18n("Online"), Kopete::OnlineStatusManager::Online,
+			Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusConnecting(Kopete::OnlineStatus::Connecting, Connecting, this,
+		     Connecting, "silc_channel", i18n("Connecting"),
+		     i18n("Connecting"),Kopete::OnlineStatusManager::Offline,
+		     Kopete::OnlineStatusManager::HideFromMenu),
+			
+
+    statusGone(Kopete::OnlineStatus::Away, Gone, this,
+	       Gone, "silc_away", 
+	       i18n("Gone"), i18n("Gone"), Kopete::OnlineStatusManager::Away),
+    statusGoneOp(Kopete::OnlineStatus::Away, GoneOp, this, GoneOp,
+		 QStringList::split(' ', "silc_op silc_away"), 
+		 i18n("Gone, Op"), i18n("Gone, Op"),
+		 Kopete::OnlineStatusManager::Away,
+		 Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusDetached(Kopete::OnlineStatus::Away, Detached, this,
+		   Gone, "silc_detached", 
+		   i18n("Detached"), i18n("Detached"),
+		   Kopete::OnlineStatusManager::Away,
+		   Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusIndisposed(Kopete::OnlineStatus::Away, Indisposed, this,
+		     Indisposed, "silc_indisposed", 
+		     i18n("Indisposed"), i18n("Indisposed"),
+		     Kopete::OnlineStatusManager::Away),
+    statusIndisposedOp(Kopete::OnlineStatus::Away,IndisposedOp, this,
+		       IndisposedOp, 
+		       QStringList::split(' ', "silc_indisposed silc_op"),
+		       i18n("Indisposed, Op"), i18n("Indisposed, Op"),
+		       Kopete::OnlineStatusManager::Away,
+		       Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusBusy(Kopete::OnlineStatus::Away, Busy, this, Busy, "silc_busy", 
+	       i18n("Busy"), i18n("Busy"), Kopete::OnlineStatusManager::Away),
+    statusBusyOp(Kopete::OnlineStatus::Away, BusyOp, this, BusyOp,
+		 QStringList::split(' ', "silc_op silc_busy"), 
+		 i18n("Busy, Op"), i18n("Busy, Op"),
+		 Kopete::OnlineStatusManager::Away,
+		 Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusHyper(Kopete::OnlineStatus::Online, Hyper, this, Hyper,
+		"silc_hyper", i18n("Hyper Active"), i18n("Hyper Active"),
+		Kopete::OnlineStatusManager::Online),
+    statusHyperMute(Kopete::OnlineStatus::Online, HyperMute, this, HyperMute,
+		    QStringList::split(' ', "silc_hyper silc_mute"), 
+		    i18n("Hyper Active, Mute"), i18n("Hyper Active, Mute"),
+		    Kopete::OnlineStatusManager::Online,
+		    Kopete::OnlineStatusManager::HideFromMenu),
+    statusHyperOpMute(Kopete::OnlineStatus::Online, HyperOpMute, this,
+		      HyperOpMute,
+		      QStringList::split(' ', "silc_hyper silc_op silc_mute"), 
+		      i18n("Hyper Active, Op, Mute"),
+		      i18n("Hyper Active, Op, Mute"),
+		      Kopete::OnlineStatusManager::Online,
+		      Kopete::OnlineStatusManager::HideFromMenu),
+    statusHyperOp(Kopete::OnlineStatus::Online, HyperOp, this, HyperOp,
+		  QStringList::split(' ', "silc_hyper silc_op"), 
+		  i18n("Hyper Active, Op"), i18n("Hyper Active, Op"),
+		  Kopete::OnlineStatusManager::Online,
+		  Kopete::OnlineStatusManager::HideFromMenu),
+
+    statusOffline(Kopete::OnlineStatus::Offline, 0, this,
+		  Offline, QString::null,
+		  i18n("Offline"), i18n("Offline"),
+		  Kopete::OnlineStatusManager::Offline)
+{
+  _protocol = this;
+  setCapabilities(FullRTF);
+
+  // add our i18n catalogue ...
+  KGlobal::locale()->insertCatalogue("kopete_silc");
+
+  // register silc-protocol's commands (at least these we do support) ...
+  Kopete::CommandHandler::commandHandler()->registerCommand
+    (this, QString("whois"),
+     SLOT(slotWhoisCommand(const QString&, Kopete::ChatSession *)),
+     i18n("USAGE: /whois <nickname> - request whois information."), 1);
+
+  Kopete::CommandHandler::commandHandler()->registerCommand
+    (this, QString("watch"),
+     SLOT(slotWatchCommand(const QString&, Kopete::ChatSession *)),
+     i18n("USAGE: /watch -add|-del <nickname> - watch a nickname."), 1);
+  
+  Kopete::CommandHandler::commandHandler()->registerCommand
+    (this, QString("notice"),
+     SLOT(slotNoticeCommand(const QString &, Kopete::ChatSession *)),
+     i18n("USAGE: /notice <message> - send a notice message."), 1);
+
+  Kopete::CommandHandler::commandHandler()->registerCommand
+    (this, QString("me"),
+     SLOT(slotAction(const QString &, Kopete::ChatSession *)),
+     i18n("USAGE: /me <action> - send an action message."), 1);
+  
+  Kopete::CommandHandler::commandHandler()->registerCommand
+    (this, QString("getkey"),
+     SLOT(slotGetkeyCommand(const QString&, Kopete::ChatSession *)),
+     i18n("USAGE: /getkey <nickname> - fetch remote client's public key"), 1);
+  Kopete::CommandHandler::commandHandler()->registerCommand
+    (this, QString("killme"),
+    SLOT(slotKillmeCommand(const QString&, Kopete::ChatSession *)),
+    i18n("USAGE: /killme"), 0);
+}
+
+
+
+SilcProtocol::~SilcProtocol()
+{
+  _protocol = NULL;
+}
+
+
+
+Kopete::Account *
+SilcProtocol::createNewAccount(const QString &accountId)
+{
+  return new SilcAccount(this, accountId);
+}
+
+
+
+AddContactPage *
+SilcProtocol::createAddContactWidget(QWidget *parent, Kopete::Account *account)
+{
+  return new SilcAddContactPage(parent, static_cast<SilcAccount *>(account));
+}
+
+
+
+
+KopeteEditAccountWidget *
+SilcProtocol::createEditAccountWidget(Kopete::Account *account,
+				      QWidget *parent)
+{
+  return new SilcEditAccountWidget(this, static_cast<SilcAccount *>(account),
+				   parent);
+}
+
+
+SilcProtocol *
+SilcProtocol::protocol(void) 
+{
+  return _protocol;
+}
+
+Kopete::Contact *
+SilcProtocol::deserializeContact(Kopete::MetaContact *meta,
+				 const QMap<QString, QString> &serializedData, 
+				 const QMap<QString, QString> &)
+{
+  QString contactId = serializedData[ "contactId" ];
+
+  QDict<Kopete::Account> accounts = 
+    Kopete::AccountManager::self()->accounts(this);
+
+  if(accounts.isEmpty()) {
+    std::cerr << "No accounts loaded, configuration invalid." << std::endl;
+    return NULL;
+  }
+
+  Kopete::Account *a = accounts[serializedData["accountId"]];
+  if(! a) {
+    std::cerr << "Account " << serializedData["accountId"]
+	      << "used to be available, but isn't anymore" << std::endl;
+    return NULL;
+  }
+
+  if(! a->addContact(contactId, meta))
+    return NULL; 
+
+  Kopete::Contact *contact = a->contacts()[contactId];
+  if(! strcmp(contact->className(), "SilcBuddyContact")) {
+    SilcBuddyContact *buddy = static_cast<SilcBuddyContact *>(contact);
+    buddy->setFpTrusted(serializedData["fpTrusted"].compare("yes") == 0);
+    buddy->setAllowRichText(serializedData["allowRichText"]
+			    .compare("yes") == 0);
+  } 
+  else if(! strcmp(contact->className(), "SilcChannelContact")) {
+    SilcChannelContact *channel = static_cast<SilcChannelContact *>(contact);
+    channel->setAllowRichText(serializedData["allowRichText"]
+			      .compare("yes") == 0);
+  }
+
+  return contact;
+}
+
+/**
+ * sends a WHOIS request to the network for the given nick
+ *
+ * @todo if possible the public key should be used.
+ */
+
+void
+SilcProtocol::slotWhoisCommand(const QString &nick, Kopete::ChatSession *cs)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(cs->account());
+  account->sendSilcCommand(QString("WHOIS %1").arg(nick));
+}
+
+void
+SilcProtocol::slotKillmeCommand(const QString &, Kopete::ChatSession *cs)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(cs->account());
+  account->sendSilcCommand(QString("KILL %1 -pubkey").arg(account->nickName()));
+}
+
+void
+SilcProtocol::slotWatchCommand(const QString &cmd, Kopete::ChatSession *cs)
+{    
+  SilcAccount *account = static_cast<SilcAccount *>(cs->account());
+  if(cmd.contains("-add ") || cmd.contains("-del ") || cmd.contains("-pubkey "))
+    account->sendSilcCommand(QString("WATCH %1").arg(cmd));
+  // @todo emit error message in case of error?
+}
+
+void
+SilcProtocol::slotNoticeCommand(const QString &notice, Kopete::ChatSession *cs)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(cs->account());
+  Kopete::ContactPtrList members = cs->members();
+  Kopete::Contact *contact = members.first();
+
+  QCString text = notice.utf8();
+  SilcTK::SilcMessageFlags flags =
+    SILC_MESSAGE_FLAG_NOTICE | SILC_MESSAGE_FLAG_UTF8;
+
+  if(! strcmp(contact->className(), "SilcChannelContact")) {
+    // send action to channel ...
+    SilcChannelContact *channel = static_cast<SilcChannelContact *>(contact);
+
+    // @fixme: add signChannelNotices() method
+    //if(account->signChannelActions())
+    //  flags |= SILC_MESSAGE_FLAG_SIGNED;
+
+    SilcTK::silc_client_send_channel_message
+      (account->client(), account->conn(), channel->channelEntry(), NULL,
+        flags, account->sha1hash, (unsigned char *) (const char *) text, 
+        text.length());
+
+  }
+  else if(! strcmp(contact->className(), "SilcBuddyContact")) {
+    // send action to buddy ...
+    SilcBuddyContact *buddy = static_cast<SilcBuddyContact *>(contact);
+
+    // @fixme add signPrivateNotices() method
+    //if(account->signPrivateActions())
+    //  flags |= SILC_MESSAGE_FLAG_SIGNED;
+
+    SilcTK::silc_client_send_private_message
+      (account->client(), account->conn(), buddy->clientEntry(), flags,
+       account->sha1hash, (unsigned char *) (const char *) text, 
+       text.length());     
+  }
+  else 
+    return; // ignore for SilcServerContact ...
+
+  Kopete::Message msg(account->myself(), cs->members(),
+		      notice, 
+		      Kopete::Message::Internal, 
+		      Kopete::Message::PlainText, QString::null,
+		      Kopete::Message::TypeAction);
+  SilcContact::prettyPrintMessage(msg, flags);
+
+  cs->appendMessage(msg);
+}
+
+void
+SilcProtocol::slotGetkeyCommand(const QString &nick, Kopete::ChatSession *cs)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(cs->account());
+  account->sendSilcCommand(QString("GETKEY %1").arg(nick));
+}
+
+void
+SilcProtocol::slotAction(const QString &action, Kopete::ChatSession *cs)
+{
+  SilcAccount *account = static_cast<SilcAccount *>(cs->account());
+  Kopete::ContactPtrList members = cs->members();
+  Kopete::Contact *contact = members.first();
+
+  QCString text = action.utf8();
+  SilcTK::SilcMessageFlags flags =
+    SILC_MESSAGE_FLAG_ACTION | SILC_MESSAGE_FLAG_UTF8;
+
+  if(! strcmp(contact->className(), "SilcChannelContact")) {
+    // send action to channel ...
+    SilcChannelContact *channel = static_cast<SilcChannelContact *>(contact);
+
+    if(account->signChannelActions())
+      flags |= SILC_MESSAGE_FLAG_SIGNED;
+
+    SilcTK::silc_client_send_channel_message
+      (account->client(), account->conn(), channel->channelEntry(), NULL,
+       flags, account->sha1hash, (unsigned char *) (const char *) text, 
+       text.length());
+
+
+  }
+  else if(! strcmp(contact->className(), "SilcBuddyContact")) {
+    // send action to buddy ...
+    SilcBuddyContact *buddy = static_cast<SilcBuddyContact *>(contact);
+
+    if(account->signPrivateActions())
+      flags |= SILC_MESSAGE_FLAG_SIGNED;
+
+    SilcTK::silc_client_send_private_message
+      (account->client(), account->conn(), buddy->clientEntry(), flags,
+       account->sha1hash, (unsigned char *) (const char *) text, 
+       text.length());     
+  }
+  else 
+    return; // ignore for SilcServerContact ...
+
+  Kopete::Message msg(account->myself(), cs->members(), action, 
+		      Kopete::Message::Outbound, 
+		      Kopete::Message::PlainText, QString::null,
+		      Kopete::Message::TypeAction);
+  SilcContact::prettyPrintMessage(msg, flags);
+
+  cs->appendMessage(msg);
+
+}
+
+#include "silcprotocol.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcprotocol.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcprotocol.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcprotocol.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcprotocol.h Mon May 28 17:34:43 2007
@@ -1,0 +1,168 @@
+// Copyright(C) 2005,2006 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 SILCPROTOCOLSILCPROTOCOL_H
+#define SILCPROTOCOLSILCPROTOCOL_H
+
+#include <kopeteprotocol.h>
+//#include "silcaccount.h"
+
+namespace Kopete {
+  class OnlineStatus;
+  class ChatSession;
+}
+
+// forward declare classes:
+class SilcProtocol;
+class SilcAccount;
+
+/**
+ * @brief Plugin reimplementation to support SILC protocol
+ *
+ * @author Stefan Siegl <ssiegl at gmx.de>
+ */
+class SilcProtocol : public Kopete::Protocol
+{
+  Q_OBJECT
+
+public:
+  SilcProtocol(QObject *parent, const char *name, const QStringList &args);
+  ~SilcProtocol();
+
+  /**
+   * @brief create new SilcAccount with the provided accountId
+   * @param accountId - the unique ID for the new Kopete::Account
+   */
+  virtual Kopete::Account *createNewAccount(const QString &accountId);
+
+  /**
+   * @brief create the AddContactPage widget
+   *
+   * Create the AddContactPage widget, which is displayed, if the user
+   * chooses File > Add Contact and asks to add buddies from the
+   * SILC protocol then.
+   * @param parent - the parent QWidget
+   * @param account - the SilcAccount to add the new Kopete::Contact to
+   */
+  virtual AddContactPage *createAddContactWidget(QWidget *parent,
+						 Kopete::Account *account);
+
+  /**
+   * @brief create KopeteEditAccountWidget
+   *
+   * Create the KopeteEditAccountWidget allowing the user to modify the given
+   * account. 
+   * @param account - the SilcAccount to modify
+   * @param parent - the parent QWidget
+   */
+  virtual KopeteEditAccountWidget
+    *createEditAccountWidget(Kopete::Account *account, QWidget *parent);
+
+  /** 
+   * @brief deserialize contact data
+   *
+   * Deserialize, i.e. read from config file, contact data
+   */
+  virtual Kopete::Contact 
+    *deserializeContact(Kopete::MetaContact *meta,
+			const QMap<QString, QString> &serializedData, 
+			const QMap<QString, QString> &addressBookData);
+
+  const Kopete::OnlineStatus statusOnline;
+  const Kopete::OnlineStatus statusOnlineMute;
+  const Kopete::OnlineStatus statusOnlineOpMute;
+  const Kopete::OnlineStatus statusOnlineOp;
+
+
+
+  const Kopete::OnlineStatus statusOnlineChannel;
+  const Kopete::OnlineStatus statusConnecting;
+
+  const Kopete::OnlineStatus statusGone;
+  const Kopete::OnlineStatus statusGoneOp;
+
+  const Kopete::OnlineStatus statusDetached;
+
+  const Kopete::OnlineStatus statusIndisposed;
+  const Kopete::OnlineStatus statusIndisposedOp;
+
+  const Kopete::OnlineStatus statusBusy;
+  const Kopete::OnlineStatus statusBusyOp;
+
+  const Kopete::OnlineStatus statusHyper;
+  const Kopete::OnlineStatus statusHyperMute;
+  const Kopete::OnlineStatus statusHyperOpMute;
+  const Kopete::OnlineStatus statusHyperOp;
+
+  const Kopete::OnlineStatus statusOffline;
+
+  static SilcProtocol *protocol(void);
+
+public slots:
+  /**
+   * @brief send a /whois request to the server
+   *
+   * @param nickname - the nickname for which to request the whois
+   * @param session - the Kopete::ChatSession issuing the request
+   */
+  void slotWhoisCommand(const QString &nick, Kopete::ChatSession *);
+
+  void slotKillmeCommand(const QString &nick, Kopete::ChatSession *);
+
+  void slotWatchCommand(const QString &nick, Kopete::ChatSession *cs);
+
+  void slotNoticeCommand(const QString &nick, Kopete::ChatSession *);
+
+  void slotAction(const QString &action, Kopete::ChatSession *);
+
+  void slotGetkeyCommand(const QString &nick, Kopete::ChatSession *);
+
+private:
+  static SilcProtocol *_protocol;
+
+  enum InternalStatus {
+    Online = 0x80,
+    OnlineMute = 0x80 | 1,
+    OnlineOp = 0x80 | 2,
+    OnlineOpMute = 0x80 | 1 | 2,
+
+    OnlineChannel = 1,
+    
+    Hyper = 0x40,
+    HyperMute = 0x40 | 1,
+    HyperOp = 0x40 | 2,
+    HyperOpMute = 0x40 | 1 | 2,
+
+    Gone = 0x20,
+    GoneOp = 0x20 | 2,
+
+    Detached = 0x20 | 4,
+
+    Busy = 0x10,
+    BusyOp = 0x10 | 2,
+
+    Indisposed = 0x08,
+    IndisposedOp = 0x08 | 2,
+
+    Offline = 0,
+
+    Connecting = 0x04
+  };
+
+};
+
+#endif

Added: kopete-silc-plugin/branches/upstream/current/src/silcservercontact.cpp
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcservercontact.cpp?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcservercontact.cpp (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcservercontact.cpp Mon May 28 17:34:43 2007
@@ -1,0 +1,102 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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
+
+#include <iostream>
+
+#include "silcaccount.h"
+#include "silcservercontact.h"
+#include "silcmessagemanager.h"
+
+#include <kopetemetacontact.h>
+#include <kopetechatsession.h>
+#include <kopeteuiglobal.h>
+
+#include <klocale.h>
+#include <kmessagebox.h>
+
+SilcServerContact::SilcServerContact(SilcAccount *account,
+                                     const QString &nick, 
+                                     Kopete::MetaContact *meta,
+                                     const QString &icon)
+  : SilcContact(account, QString("!%1").arg(nick), meta, icon),
+    msgBuffer()
+{
+  setNickName(nick);
+}
+ 
+SilcServerContact::~SilcServerContact() { }
+
+void
+SilcServerContact::appendMessage(const QString &text)
+{
+  Kopete::ContactPtrList members;
+  members.append(this);
+  Kopete::Message msg(this, members, text, Kopete::Message::Internal);
+  
+  // we don't want to annoy the user ...
+  msg.setImportance(Kopete::Message::Low);
+
+  if(manager() && manager()->view())
+    manager()->appendMessage(msg);
+  else
+    msgBuffer.append(msg);
+}
+
+KopeteView *
+SilcServerContact::view(void)
+{
+  KopeteView *view = SilcContact::view();
+  if(! view) return NULL;
+
+  while(! msgBuffer.isEmpty()) {
+    manager()->appendMessage(msgBuffer.front());
+    msgBuffer.pop_front();
+  }
+
+  return view;
+}
+
+void 
+SilcServerContact::slotSendMessage(Kopete::Message &, Kopete::ChatSession *)
+{
+  
+}
+
+Kopete::ChatSession *
+SilcServerContact::manager(Kopete::Contact::CanCreateFlags flags)
+{
+  if(_chatSession) 
+    return _chatSession;
+
+  if(! (flags & Kopete::Contact::CanCreate))
+    return NULL; // not allowed to create new chat session
+
+  QPtrList<Kopete::Contact> myself;
+  myself.append(this);
+  
+  _chatSession = account()->chatSession(myself);
+  _chatSession->setDisplayName(nickName());
+
+  QObject::connect(manager(), SIGNAL(closing(Kopete::ChatSession *)), 
+                   this, SLOT(slotCloseSession()));
+
+  return _chatSession;
+}
+
+#include "silcservercontact.moc"

Added: kopete-silc-plugin/branches/upstream/current/src/silcservercontact.h
URL: http://svn.debian.org/wsvn/pkg-silc/kopete-silc-plugin/branches/upstream/current/src/silcservercontact.h?rev=35&op=file
==============================================================================
--- kopete-silc-plugin/branches/upstream/current/src/silcservercontact.h (added)
+++ kopete-silc-plugin/branches/upstream/current/src/silcservercontact.h Mon May 28 17:34:43 2007
@@ -1,0 +1,63 @@
+//                       -*- mode: C++ -*-
+//
+// Copyright(C) 2005 Stefan Siegl <stesie at brokenpipe.de>
+// kopete_silc - silc plugin for kopete messenger
+//
+// 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 KOPETESILC_SILCSERVERCONTACT_H
+#define KOPETESILC_SILCSERVERCONTACT_H
+
+#include "silccontact.h"
+
+/**
+ * @brief Reimplementation of Kopete::Contact class, used for SILC Servers
+ *
+ * The SilcServerContact class represents a SILC Server, it is used to
+ * display server messages, etc.
+ *
+ * @author Stefan Siegl <stesie at brokenpipe.de>
+ */
+class SilcServerContact : public SilcContact {
+  Q_OBJECT;
+
+public:
+  SilcServerContact(SilcAccount *, const QString &nickname, 
+		    Kopete::MetaContact *meta,
+		    const QString &icon = QString::null);
+  virtual ~SilcServerContact();
+
+  void appendMessage(const QString &);
+
+  virtual KopeteView *view(void);
+
+  /**
+   * @brief return the primary message manager of this contact
+   */
+  virtual Kopete::ChatSession *manager(Kopete::Contact::CanCreateFlags =
+				       Kopete::Contact::CannotCreate);
+
+private:
+  QValueList<Kopete::Message> msgBuffer;
+
+private slots:
+  /**
+   * @brief send outgoing message
+   */
+  virtual void slotSendMessage(Kopete::Message &, Kopete::ChatSession *);
+
+};
+
+#endif // KOPETESILC_SILCSERVERCONTACT_H




More information about the Pkg-silc-commits mailing list