summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdchat/docs/Chat_Readme.txt82
-rw-r--r--src/core/stdchat/docs/Chat_license.txt340
-rw-r--r--src/core/stdchat/res/1.icobin502 -> 0 bytes
-rw-r--r--src/core/stdchat/res/2.icobin502 -> 0 bytes
-rw-r--r--src/core/stdchat/res/3.icobin502 -> 0 bytes
-rw-r--r--src/core/stdchat/res/4.icobin502 -> 0 bytes
-rw-r--r--src/core/stdchat/res/5.icobin502 -> 0 bytes
-rw-r--r--src/core/stdchat/res/6.icobin502 -> 0 bytes
-rw-r--r--src/core/stdchat/res/action.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/addmode.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/bkgcolor.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/blank.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/bold.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/chat.rc390
-rw-r--r--src/core/stdchat/res/close.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/color.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/filter.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/filter2.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/highlight.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/history.icobin5430 -> 0 bytes
-rw-r--r--src/core/stdchat/res/info.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/italics.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/join.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/kick.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/message.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/messageout.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/nick.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/nicklist.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/nicklist2.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/notice.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/overlay.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/part.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/quit.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/removestatus.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/smiley.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/smileyc.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/tag1.icobin286 -> 0 bytes
-rw-r--r--src/core/stdchat/res/tag2.icobin2862 -> 0 bytes
-rw-r--r--src/core/stdchat/res/topic.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/topicbut.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/underline.icobin1150 -> 0 bytes
-rw-r--r--src/core/stdchat/res/version.rc42
-rw-r--r--src/core/stdchat/res/window.icobin5430 -> 0 bytes
-rw-r--r--src/core/stdchat/src/log.cpp157
-rw-r--r--src/core/stdchat/src/main.cpp500
-rw-r--r--src/core/stdchat/src/manager.cpp125
-rw-r--r--src/core/stdchat/src/message.cpp67
-rw-r--r--src/core/stdchat/src/options.cpp761
-rw-r--r--src/core/stdchat/src/resource.h137
-rw-r--r--src/core/stdchat/src/services.cpp108
-rw-r--r--src/core/stdchat/src/stdafx.cxx18
-rw-r--r--src/core/stdchat/src/stdafx.h174
-rw-r--r--src/core/stdchat/src/tools.cpp211
-rw-r--r--src/core/stdchat/src/version.h13
-rw-r--r--src/core/stdchat/src/window.cpp2610
-rw-r--r--src/core/stdchat/stdchat.vcxproj28
-rw-r--r--src/core/stdchat/stdchat.vcxproj.filters4
57 files changed, 0 insertions, 5767 deletions
diff --git a/src/core/stdchat/docs/Chat_Readme.txt b/src/core/stdchat/docs/Chat_Readme.txt
deleted file mode 100644
index 331fc555fc..0000000000
--- a/src/core/stdchat/docs/Chat_Readme.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-----------------------------oOo----------------------------
-
- Chat v 0.3.1.6
-
- Released 2004-05-26, last updated 2005-08-19
-
-------------------------------------------------------------
-
-Important information
-----------
-
-#1 This plugin provides a groupchat interface for any protocol that wish to use it.
-
-#2 End users need not worry about anything more than setting your preferences in
-
-#3 Developers can take a look at the included m_chat.h for
- an introduction on how to use it. Feel free to contact me if you need more
- information on how to get it working.
-
-
-
-Change log
-----------
-
-Please go to:
-http://www.miranda-im.org/download/details.php?action=viewlog&id=1309
-
-
-
-Author
----------
-
-My name is Jörgen Persson, also known as Matrix, I have been using
-Miranda IM since 2001 and so far I have been responsible for the IRC part and
-I am nowadays considered to be a 'core guy'. If you wish to contact me you can e-mail
-me at: i_am_matrix at users dot sourceforge dot net. You can also join #miranda
-on the FreeNode network, where you can talk to me and other fans of Miranda IM.
-
-
-
-How to install
-----------
-
-Use an unzipper of choice (I use WinZip) and extract the files to the 'Plugins'
-directory of your Miranda IM installation. Please note that you must restart
-Miranda IM for the installation to complete. If you are upgrading to another
-version you will have to shut down Miranda before extracting the files
-or the process will fail.
-
-
-
-Credits
-----------
-
-Egodust, "The coding encyclopedia". Thanks! We miss You!!!
-Valkyre, Thanks for the bold, italics and underline icons
-
-
-Base Address
-----------
-
-0x54 110000 (matrix)
-
-
-
-Copyright and license
----------------------
-Copyright (C) 2005 Jörgen Persson
-
-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. \ No newline at end of file
diff --git a/src/core/stdchat/docs/Chat_license.txt b/src/core/stdchat/docs/Chat_license.txt
deleted file mode 100644
index 7f1161073d..0000000000
--- a/src/core/stdchat/docs/Chat_license.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- 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) 19yy <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) 19yy 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.
diff --git a/src/core/stdchat/res/1.ico b/src/core/stdchat/res/1.ico
deleted file mode 100644
index 61fa00e172..0000000000
--- a/src/core/stdchat/res/1.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/2.ico b/src/core/stdchat/res/2.ico
deleted file mode 100644
index 5c1dc06fbc..0000000000
--- a/src/core/stdchat/res/2.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/3.ico b/src/core/stdchat/res/3.ico
deleted file mode 100644
index f103719b68..0000000000
--- a/src/core/stdchat/res/3.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/4.ico b/src/core/stdchat/res/4.ico
deleted file mode 100644
index 47d8f35fe2..0000000000
--- a/src/core/stdchat/res/4.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/5.ico b/src/core/stdchat/res/5.ico
deleted file mode 100644
index 7008463787..0000000000
--- a/src/core/stdchat/res/5.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/6.ico b/src/core/stdchat/res/6.ico
deleted file mode 100644
index 8a681faeb7..0000000000
--- a/src/core/stdchat/res/6.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/action.ico b/src/core/stdchat/res/action.ico
deleted file mode 100644
index ec7694b075..0000000000
--- a/src/core/stdchat/res/action.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/addmode.ico b/src/core/stdchat/res/addmode.ico
deleted file mode 100644
index fcfa03a6ad..0000000000
--- a/src/core/stdchat/res/addmode.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/bkgcolor.ico b/src/core/stdchat/res/bkgcolor.ico
deleted file mode 100644
index 8ff040dd1b..0000000000
--- a/src/core/stdchat/res/bkgcolor.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/blank.ico b/src/core/stdchat/res/blank.ico
deleted file mode 100644
index d8a5b3d80d..0000000000
--- a/src/core/stdchat/res/blank.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/bold.ico b/src/core/stdchat/res/bold.ico
deleted file mode 100644
index 63810159f9..0000000000
--- a/src/core/stdchat/res/bold.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/chat.rc b/src/core/stdchat/res/chat.rc
deleted file mode 100644
index bae7f07e5f..0000000000
--- a/src/core/stdchat/res/chat.rc
+++ /dev/null
@@ -1,390 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "..\src\resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "winres.h"
-#include "richedit.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1251)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_CHANNEL DIALOGEX 0, 0, 252, 140
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX |
- WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU |
- WS_THICKFRAME
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "",IDC_MESSAGE,"RichEdit50W",ES_MULTILINE |
- ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN |
- ES_NUMBER | WS_VSCROLL | WS_TABSTOP,0,128,127,12,
- WS_EX_STATICEDGE
- PUSHBUTTON "&Send",IDOK,136,126,115,14,WS_DISABLED
- CONTROL "&Emoticons",IDC_SMILEY,"MButtonClass",WS_DISABLED | WS_TABSTOP,112,108,15,13,0x18000000L
- CONTROL "&Bold",IDC_BOLD,"MButtonClass",WS_DISABLED | WS_TABSTOP,8,108,15,13,0x18000000L
- CONTROL "&Italic",IDC_ITALICS,"MButtonClass",WS_DISABLED | WS_TABSTOP,24,108,15,13,0x18000000L
- CONTROL "&Underline",IDC_UNDERLINE,"MButtonClass",WS_DISABLED | WS_TABSTOP,40,108,15,13,0x18000000L
- CONTROL "&Color",IDC_COLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,68,108,15,13,0x18000000L
- CONTROL "&Background color",IDC_BKGCOLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,84,108,15,13,0x18000000L
- CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,188,108,15,13,0x18000000L
- CONTROL "&Filter",IDC_FILTER,"MButtonClass",WS_TABSTOP,220,108,15,13,0x18000000L
- CONTROL "&Room settings",IDC_CHANMGR,"MButtonClass",WS_DISABLED | WS_TABSTOP,204,108,15,13,0x18000000L
- CONTROL "&Show/Hide nick list",IDC_SHOWNICKLIST,"MButtonClass",WS_TABSTOP,236,108,15,13,0x18000000L
- CONTROL "",IDC_LOG,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL |
- ES_READONLY | ES_NUMBER | WS_VSCROLL | WS_TABSTOP,8,23,
- 164,73,WS_EX_STATICEDGE
- CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
- CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
- LISTBOX IDC_LIST,182,23,69,73,LBS_OWNERDRAWFIXED |
- LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER |
- WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
- CONTROL "Tab1",IDC_TAB,"SysTabControl32",TCS_MULTILINE,0,0,231,102
- CONTROL "",IDC_CLOSE,"MButtonClass",WS_TABSTOP,236,2,15,13,0x18000000L
-END
-
-IDD_FILTER DIALOGEX 0, 0, 83, 125
-STYLE DS_FIXEDSYS | DS_SETFONT | WS_POPUP | WS_BORDER
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CTEXT "Show these events only:",IDC_TEXTO,0,0,83,13,
- SS_CENTERIMAGE
- LTEXT "",IDC_STATIC,0,13,83,112
- CONTROL "Actions",IDC_1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,13,73,10
- CONTROL "Messages",IDC_2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,23,73,10
- CONTROL "Nick changes",IDC_3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,33,73,10
- CONTROL "Users joining",IDC_4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,43,73,10
- CONTROL "Users leaving",IDC_5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,53,73,10
- CONTROL "Topic changes",IDC_6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,63,73,10
- CONTROL "Status changes",IDC_7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,73,73,10
- CONTROL "Information",IDC_8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,83,73,10
- CONTROL "Disconnects",IDC_9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,93,73,10
- CONTROL "User kicks",IDC_10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,103,73,10
- CONTROL "Notices",IDC_11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,113,73,10
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_CHANNEL, DIALOG
- BEGIN
- RIGHTMARGIN, 251
- VERTGUIDE, 8
- VERTGUIDE, 172
- VERTGUIDE, 182
- VERTGUIDE, 237
- HORZGUIDE, 8
- HORZGUIDE, 23
- HORZGUIDE, 70
- HORZGUIDE, 96
- HORZGUIDE, 102
- HORZGUIDE, 108
- HORZGUIDE, 121
- END
-
- IDD_FILTER, DIALOG
- BEGIN
- VERTGUIDE, 5
- VERTGUIDE, 78
- HORZGUIDE, 13
- HORZGUIDE, 117
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral (Default) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
-#pragma code_page(1251)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_OPTIONS1 DIALOGEX 0, 0, 300, 230
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Tree1",IDC_CHECKBOXES,"SysTreeView32",TVS_HASBUTTONS |
- TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP |
- TVS_FULLROWSELECT | WS_BORDER | WS_TABSTOP,10,12,280,205
- GROUPBOX "Options",IDC_STATIC,0,0,300,227
-END
-
-IDD_OPTIONS2 DIALOGEX 0, 0, 300, 200
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- GROUPBOX "Log options",IDC_STATIC,1,1,294,134
- EDITTEXT IDC_OUTSTAMP,10,19,35,14,ES_AUTOHSCROLL
- EDITTEXT IDC_INSTAMP,60,19,35,14,ES_AUTOHSCROLL
- LTEXT "Log timestamp",IDC_STATIC,205,11,81,8
- EDITTEXT IDC_LOGTIMESTAMP,205,19,81,14,ES_AUTOHSCROLL
- LTEXT "Timestamp",IDC_STATIC,119,11,78,8
- EDITTEXT IDC_TIMESTAMP,118,19,81,14,ES_AUTOHSCROLL
- LTEXT "Other name",IDC_STATIC,60,11,57,8
- LTEXT "Your name",IDC_STATIC,10,11,50,8
- CONTROL "Enable highlighting",IDC_HIGHLIGHT,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,10,46,118,10
- LTEXT "Limit log text to (events):",IDC_STATIC,133,46,112,8
- LTEXT "Trim to (KB)",IDC_STATIC,248,104,38,8
- EDITTEXT IDC_LOGLIMIT,248,44,38,14,ES_RIGHT | ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- UDS_NOTHOUSANDS | UDS_HOTTRACK,275,43,11,14
- LTEXT "Words to highlight (wildcards allowed)",IDC_STATIC,10,
- 58,240,8
- EDITTEXT IDC_HIGHLIGHTWORDS,10,67,276,14,ES_AUTOHSCROLL
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,10,86,275,1
- CONTROL "Enable logging to disk",IDC_LOGGING,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,10,94,211,10
- LTEXT "Log directory",IDC_STATIC,10,106,211,8
- EDITTEXT IDC_LOGDIRECTORY,10,114,211,14,ES_AUTOHSCROLL |
- ES_READONLY
- PUSHBUTTON "...",IDC_FONTCHOOSE,221,114,19,14
- EDITTEXT IDC_LIMIT,248,114,38,14,ES_RIGHT | ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "Spin1",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- UDS_NOTHOUSANDS | UDS_HOTTRACK,275,112,11,14
- GROUPBOX "Other",IDC_STATIC,1,145,294,53
- LTEXT "Add new rooms to group:",IDC_STATIC,11,159,132,8
- EDITTEXT IDC_GROUP,158,158,49,14,ES_AUTOHSCROLL
- LTEXT "Nick list row distance (pixels):",IDC_STATIC,11,180,132,
- 8
- EDITTEXT IDC_NICKROW2,158,178,29,14,ES_RIGHT | ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "",IDC_SPIN4,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- UDS_NOTHOUSANDS | UDS_HOTTRACK,183,178,11,14
-END
-
-IDD_OPTIONSPOPUP DIALOGEX 0, 0, 277, 177
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Use same style as in the message log",IDC_RADIO1,"Button",
- BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,33,29,225,10
- CONTROL "Use default colors",IDC_RADIO2,"Button",
- BS_AUTORADIOBUTTON,33,62,217,10
- CONTROL "Use custom colors",IDC_RADIO3,"Button",
- BS_AUTORADIOBUTTON,33,95,105,10
- CONTROL "Custom1",IDC_TEXT,"ColourPicker",WS_TABSTOP,141,93,50,
- 14,0x18000000L
- CONTROL "Custom2",IDC_BKG,"ColourPicker",WS_TABSTOP,201,93,50,14,
- 0x18000000L
- EDITTEXT IDC_TIMEOUT,132,134,38,14,ES_RIGHT | ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- UDS_NOTHOUSANDS | UDS_HOTTRACK,169,135,11,14
- GROUPBOX "Popups for the Chat plugin",IDC_STATIC,0,0,277,174
- LTEXT "Timeout (s)",IDC_STATIC,33,138,92,8
- LTEXT "Text",IDC_STATIC,141,83,49,8
- LTEXT "Background",IDC_STATIC,201,83,67,8
- LTEXT "(Setting timeout to 0 means default setting and -1 means indefinite time)",
- IDC_STATIC,33,151,207,17
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_OPTIONS1, DIALOG
- BEGIN
- VERTGUIDE, 10
- VERTGUIDE, 153
- VERTGUIDE, 181
- VERTGUIDE, 202
- VERTGUIDE, 290
- HORZGUIDE, 12
- HORZGUIDE, 174
- HORZGUIDE, 192
- HORZGUIDE, 213
- END
-
- IDD_OPTIONS2, DIALOG
- BEGIN
- LEFTMARGIN, 1
- RIGHTMARGIN, 295
- VERTGUIDE, 10
- VERTGUIDE, 60
- VERTGUIDE, 144
- VERTGUIDE, 158
- VERTGUIDE, 183
- VERTGUIDE, 221
- VERTGUIDE, 286
- TOPMARGIN, 1
- BOTTOMMARGIN, 198
- HORZGUIDE, 108
- HORZGUIDE, 126
- HORZGUIDE, 146
- HORZGUIDE, 158
- HORZGUIDE, 174
- END
-
- IDD_OPTIONSPOPUP, DIALOG
- BEGIN
- VERTGUIDE, 33
- VERTGUIDE, 157
- VERTGUIDE, 201
- HORZGUIDE, 49
- HORZGUIDE, 81
- HORZGUIDE, 174
- END
-END
-#endif // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_TAG1 ICON "tag1.ico"
-IDI_TAG2 ICON "tag2.ico"
-IDI_BUNDERLINE ICON "underline.ico"
-IDI_BBOLD ICON "bold.ico"
-IDI_BITALICS ICON "italics.ico"
-IDI_BSMILEY ICON "smiley.ico"
-IDI_JOIN ICON "join.ico"
-IDI_TOPIC ICON "topic.ico"
-IDI_ADDSTATUS ICON "addmode.ico"
-IDI_INFO ICON "info.ico"
-IDI_KICK ICON "kick.ico"
-IDI_MESSAGE ICON "message.ico"
-IDI_NICK ICON "nick.ico"
-IDI_NOTICE ICON "notice.ico"
-IDI_PART ICON "part.ico"
-IDI_QUIT ICON "quit.ico"
-IDI_REMSTATUS ICON "removestatus.ico"
-IDI_HIGHLIGHT ICON "highlight.ico"
-IDI_MESSAGEOUT ICON "messageout.ico"
-IDI_ACTION ICON "action.ico"
-IDI_TOPICBUT ICON "topicbut.ico"
-IDI_BKGCOLOR ICON "bkgcolor.ico"
-IDI_CHANMGR ICON "window.ico"
-IDI_COLOR ICON "color.ico"
-IDI_FILTER ICON "filter.ico"
-IDI_HISTORY ICON "history.ico"
-IDI_NICKLIST ICON "nicklist.ico"
-IDI_BLANK ICON "blank.ico"
-IDI_STATUS3 ICON "4.ico"
-IDI_STATUS2 ICON "3.ico"
-IDI_STATUS4 ICON "5.ico"
-IDI_STATUS1 ICON "2.ico"
-IDI_STATUS0 ICON "1.ico"
-IDI_STATUS5 ICON "6.ico"
-IDI_CLOSE ICON "close.ico"
-IDI_OVERLAY ICON "overlay.ico"
-IDI_NICKLIST2 ICON "nicklist2.ico"
-IDI_FILTER2 ICON "filter2.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_MENU MENU
-BEGIN
- POPUP "List"
- BEGIN
- MENUITEM "&Message", ID_MESS
- END
- POPUP "Log"
- BEGIN
- MENUITEM "Clear lo&g", ID_CLEARLOG
- MENUITEM SEPARATOR
- MENUITEM "Co&py all", ID_COPYALL
- MENUITEM SEPARATOR
- POPUP "Word lookup", GRAYED
- BEGIN
- MENUITEM "Google", ID_SEARCH_GOOGLE
- MENUITEM "Wikipedia", ID_SEARCH_WIKIPEDIA
- END
- END
- POPUP "Link"
- BEGIN
- MENUITEM "Open a &new browser window", ID_NEW
- MENUITEM "&Open in current browser window", ID_CURR
- MENUITEM "&Copy link", ID_COPY
- END
- MENUITEM "", 65535
- POPUP "Message"
- BEGIN
- MENUITEM "Undo", ID_MESSAGE_UNDO, GRAYED
- MENUITEM "Redo", ID_MESSAGE_REDO, GRAYED
- MENUITEM SEPARATOR
- MENUITEM "Copy", ID_MESSAGE_COPY, GRAYED
- MENUITEM "Cut", ID_MESSAGE_CUT, GRAYED
- MENUITEM "Paste", ID_MESSAGE_PASTE
- MENUITEM "Select all", ID_MESSAGE_SELECTALL
- MENUITEM SEPARATOR
- MENUITEM "Clear", ID_MESSAGE_CLEAR
- END
- POPUP "Tabs"
- BEGIN
- MENUITEM "&Close tab", ID_CLOSE
- MENUITEM "C&lose other tabs", ID_CLOSEOTHER
- MENUITEM SEPARATOR
- MENUITEM "&Open at this position", ID_LOCKPOSITION
- END
-END
-
-#endif // Neutral (Default) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/src/core/stdchat/res/close.ico b/src/core/stdchat/res/close.ico
deleted file mode 100644
index 6facfcffeb..0000000000
--- a/src/core/stdchat/res/close.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/color.ico b/src/core/stdchat/res/color.ico
deleted file mode 100644
index b75015154a..0000000000
--- a/src/core/stdchat/res/color.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/filter.ico b/src/core/stdchat/res/filter.ico
deleted file mode 100644
index a2edc9e60c..0000000000
--- a/src/core/stdchat/res/filter.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/filter2.ico b/src/core/stdchat/res/filter2.ico
deleted file mode 100644
index 3adc966a6c..0000000000
--- a/src/core/stdchat/res/filter2.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/highlight.ico b/src/core/stdchat/res/highlight.ico
deleted file mode 100644
index 850afb2f46..0000000000
--- a/src/core/stdchat/res/highlight.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/history.ico b/src/core/stdchat/res/history.ico
deleted file mode 100644
index 10bbd7aaf7..0000000000
--- a/src/core/stdchat/res/history.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/info.ico b/src/core/stdchat/res/info.ico
deleted file mode 100644
index 419bb1adb5..0000000000
--- a/src/core/stdchat/res/info.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/italics.ico b/src/core/stdchat/res/italics.ico
deleted file mode 100644
index 42d3fea61b..0000000000
--- a/src/core/stdchat/res/italics.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/join.ico b/src/core/stdchat/res/join.ico
deleted file mode 100644
index 1b6176d0ad..0000000000
--- a/src/core/stdchat/res/join.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/kick.ico b/src/core/stdchat/res/kick.ico
deleted file mode 100644
index f8dee5c356..0000000000
--- a/src/core/stdchat/res/kick.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/message.ico b/src/core/stdchat/res/message.ico
deleted file mode 100644
index 7d98eb94e3..0000000000
--- a/src/core/stdchat/res/message.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/messageout.ico b/src/core/stdchat/res/messageout.ico
deleted file mode 100644
index 83c8e296e5..0000000000
--- a/src/core/stdchat/res/messageout.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/nick.ico b/src/core/stdchat/res/nick.ico
deleted file mode 100644
index 27d9fea978..0000000000
--- a/src/core/stdchat/res/nick.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/nicklist.ico b/src/core/stdchat/res/nicklist.ico
deleted file mode 100644
index 460e7890a2..0000000000
--- a/src/core/stdchat/res/nicklist.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/nicklist2.ico b/src/core/stdchat/res/nicklist2.ico
deleted file mode 100644
index 236787629b..0000000000
--- a/src/core/stdchat/res/nicklist2.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/notice.ico b/src/core/stdchat/res/notice.ico
deleted file mode 100644
index 7cb1691367..0000000000
--- a/src/core/stdchat/res/notice.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/overlay.ico b/src/core/stdchat/res/overlay.ico
deleted file mode 100644
index dc9738d792..0000000000
--- a/src/core/stdchat/res/overlay.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/part.ico b/src/core/stdchat/res/part.ico
deleted file mode 100644
index 5d6e5b90df..0000000000
--- a/src/core/stdchat/res/part.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/quit.ico b/src/core/stdchat/res/quit.ico
deleted file mode 100644
index febcbecb96..0000000000
--- a/src/core/stdchat/res/quit.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/removestatus.ico b/src/core/stdchat/res/removestatus.ico
deleted file mode 100644
index b772f6a9c6..0000000000
--- a/src/core/stdchat/res/removestatus.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/smiley.ico b/src/core/stdchat/res/smiley.ico
deleted file mode 100644
index 1062805741..0000000000
--- a/src/core/stdchat/res/smiley.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/smileyc.ico b/src/core/stdchat/res/smileyc.ico
deleted file mode 100644
index 2290e97fe4..0000000000
--- a/src/core/stdchat/res/smileyc.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/tag1.ico b/src/core/stdchat/res/tag1.ico
deleted file mode 100644
index 4db0312d9d..0000000000
--- a/src/core/stdchat/res/tag1.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/tag2.ico b/src/core/stdchat/res/tag2.ico
deleted file mode 100644
index 5b5197a9cd..0000000000
--- a/src/core/stdchat/res/tag2.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/topic.ico b/src/core/stdchat/res/topic.ico
deleted file mode 100644
index 7d7fe6d402..0000000000
--- a/src/core/stdchat/res/topic.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/topicbut.ico b/src/core/stdchat/res/topicbut.ico
deleted file mode 100644
index 7c6b07c71a..0000000000
--- a/src/core/stdchat/res/topicbut.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/underline.ico b/src/core/stdchat/res/underline.ico
deleted file mode 100644
index 646d58456d..0000000000
--- a/src/core/stdchat/res/underline.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/res/version.rc b/src/core/stdchat/res/version.rc
deleted file mode 100644
index d741488c4f..0000000000
--- a/src/core/stdchat/res/version.rc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#ifdef APSTUDIO_INVOKED
-#error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-#include "afxres.h"
-#include "..\src\version.h"
-
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#endif //_WIN32
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION __FILEVERSION_STRING
- PRODUCTVERSION __FILEVERSION_STRING
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x0L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "FileDescription", __DESCRIPTION
- VALUE "InternalName", __PLUGIN_NAME
- VALUE "LegalCopyright", __COPYRIGHT
- VALUE "OriginalFilename", __FILENAME
- VALUE "ProductName", __PLUGIN_NAME
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
diff --git a/src/core/stdchat/res/window.ico b/src/core/stdchat/res/window.ico
deleted file mode 100644
index d317845d55..0000000000
--- a/src/core/stdchat/res/window.ico
+++ /dev/null
Binary files differ
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp
deleted file mode 100644
index 4f8afb0d38..0000000000
--- a/src/core/stdchat/src/log.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-
-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 "stdafx.h"
-
-// The code for streaming the text is to a large extent copied from
-// the srmm module and then modified to fit the chat module.
-
-static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-{
- LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA *) dwCookie;
- if (lstrdat) {
- // create the RTF
- if (lstrdat->buffer == NULL) {
- lstrdat->bufferOffset = 0;
- lstrdat->buffer = pci->Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer);
- }
-
- // give the RTF to the RE control
- *pcb = min(cb, lstrdat->bufferLen - lstrdat->bufferOffset);
- memcpy(pbBuff, lstrdat->buffer + lstrdat->bufferOffset, *pcb);
- lstrdat->bufferOffset += *pcb;
-
- // free stuff if the streaming operation is complete
- if (lstrdat->bufferOffset == lstrdat->bufferLen) {
- mir_free(lstrdat->buffer);
- lstrdat->buffer = NULL;
- }
- }
-
- return 0;
-}
-
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL)
-{
- CHARRANGE oldsel, sel, newsel;
- POINT point ={0};
- WPARAM wp;
-
- if (hwndDlg == 0 || lin == 0 || si == 0)
- return;
-
- HWND hwndRich = GetDlgItem(hwndDlg, IDC_LOG);
-
- LOGSTREAMDATA streamData;
- memset(&streamData, 0, sizeof(streamData));
- streamData.hwnd = hwndRich;
- streamData.si = si;
- streamData.lin = lin;
- streamData.bStripFormat = FALSE;
-
- if (bRedraw || si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags & lin->iType) != 0) {
- BOOL bFlag = FALSE;
-
- EDITSTREAM stream = { 0 };
- stream.pfnCallback = Log_StreamCallback;
- stream.dwCookie = (DWORD_PTR) & streamData;
-
- SCROLLINFO scroll;
- scroll.cbSize = sizeof(SCROLLINFO);
- scroll.fMask= SIF_RANGE | SIF_POS|SIF_PAGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &scroll);
- SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM) &point);
-
- // do not scroll to bottom if there is a selection
- SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM) &oldsel);
- if (oldsel.cpMax != oldsel.cpMin)
- SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
-
- //set the insertion point at the bottom
- sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) &sel);
-
- // fix for the indent... must be a M$ bug
- if (sel.cpMax == 0)
- bRedraw = TRUE;
-
- // should the event(s) be appended to the current log
- wp = bRedraw?SF_RTF:SFF_SELECTION|SF_RTF;
-
- //get the number of pixels per logical inch
- if (bRedraw) {
- HDC hdc = GetDC(NULL);
- pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
- ReleaseDC(NULL, hdc);
- SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
- bFlag = TRUE;
- }
-
- // stream in the event(s)
- streamData.lin = lin;
- streamData.bRedraw = bRedraw;
- SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM) & stream);
-
- // do smileys
- if (SmileyAddInstalled && (bRedraw
- || (lin->ptszText
- && lin->iType != GC_EVENT_JOIN
- && lin->iType != GC_EVENT_NICK
- && lin->iType != GC_EVENT_ADDSTATUS
- && lin->iType != GC_EVENT_REMOVESTATUS )))
- {
- SMADD_RICHEDIT3 sm = {0};
-
- newsel.cpMax = -1;
- newsel.cpMin = sel.cpMin;
- if (newsel.cpMin < 0)
- newsel.cpMin = 0;
- memset(&sm, 0, sizeof(sm));
- sm.cbSize = sizeof(sm);
- sm.hwndRichEditControl = hwndRich;
- sm.Protocolname = si->pszModule;
- sm.rangeToReplace = bRedraw?NULL:&newsel;
- sm.disableRedraw = TRUE;
- sm.hContact = si->hContact;
- CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm);
- }
-
- // scroll log to bottom if the log was previously scrolled to bottom, else restore old position
- if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax-scroll.nPage-5 || scroll.nMax-scroll.nMin-scroll.nPage < 50)
- SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0);
- else
- SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM) &point);
-
- // do we need to restore the selection
- if (oldsel.cpMax != oldsel.cpMin) {
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & oldsel);
- SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwndRich, NULL, TRUE);
- }
-
- // need to invalidate the window
- if (bFlag) {
- sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) &sel);
- SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwndRich, NULL, TRUE);
-} } }
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
deleted file mode 100644
index 581022c42c..0000000000
--- a/src/core/stdchat/src/main.cpp
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-
-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 "stdafx.h"
-
-// globals
-CLIST_INTERFACE *pcli;
-CHAT_MANAGER *pci, saveCI;
-
-SESSION_INFO g_TabSession;
-HMENU g_hMenu = NULL;
-
-HINSTANCE g_hInst;
-int hLangpack;
-
-BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE;
-HIMAGELIST hIconsList;
-
-GlobalLogSettings g_Settings;
-
-/* Missing MinGW GUIDs */
-#ifdef __MINGW32__
-const CLSID IID_IRichEditOle = { 0x00020D00, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
-const CLSID IID_IRichEditOleCallback = { 0x00020D03, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
-#endif
-
-PLUGININFOEX pluginInfo = {
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- MIRANDA_VERSION_DWORD,
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- {0x9d6c3213, 0x2b4, 0x4fe1, { 0x92, 0xe6, 0x52, 0x6d, 0xe1, 0x4f, 0x8d, 0x65 }} //{9D6C3213-02B4-4fe1-92E6-526DE14F8D65}
-};
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CHAT, MIID_LAST};
-
-int OnShutdown(WPARAM, LPARAM)
-{
- for (SESSION_INFO *si = pci->wndList; si; si = si->next)
- SendMessage(si->hWnd, WM_CLOSE, 0, 0);
-
- TabM_RemoveAll();
- ImageList_Destroy(hIconsList);
- return 0;
-}
-
-static void OnCreateModule(MODULEINFO *mi)
-{
- mi->OnlineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
- mi->hOnlineIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT);
- mi->hOnlineTalkIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(hIconsList, mi->hOnlineTalkIcon);
-
- mi->OfflineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
- mi->hOfflineIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT);
- mi->hOfflineTalkIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
-}
-
-static void OnAddLog(SESSION_INFO *si, int isOk)
-{
- if (isOk && si->hWnd) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
- }
- else if (si->hWnd) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
- }
-}
-
-static void OnClearLog(SESSION_INFO *si)
-{
- if (si->hWnd) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- }
-}
-
-static void OnDblClickSession(SESSION_INFO *si)
-{
- if (g_Settings.bTabsEnable)
- SendMessage(si->hWnd, GC_REMOVETAB, 1, (LPARAM)si);
- else
- PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
-}
-
-static void OnRemoveSession(SESSION_INFO *si)
-{
- if (!g_Settings.bTabsEnable) {
- if (si->hWnd)
- SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
- }
- else if (g_TabSession.hWnd)
- SendMessage(g_TabSession.hWnd, GC_REMOVETAB, 1, (LPARAM)si);
-
- if (si->hWnd)
- g_TabSession.nUsersInNicklist = 0;
-}
-
-static void OnRenameSession(SESSION_INFO *si)
-{
- if (g_TabSession.hWnd && g_Settings.bTabsEnable) {
- g_TabSession.ptszName = si->ptszName;
- SendMessage(g_TabSession.hWnd, GC_SESSIONNAMECHANGE, 0, (LPARAM)si);
- }
-}
-
-static void OnReplaceSession(SESSION_INFO *si)
-{
- if (si->hWnd)
- g_TabSession.nUsersInNicklist = 0;
-
- if (!g_Settings.bTabsEnable) {
- if (si->hWnd)
- RedrawWindow(GetDlgItem(si->hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
- }
- else if (g_TabSession.hWnd)
- RedrawWindow(GetDlgItem(g_TabSession.hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
-}
-
-static void OnOfflineSession(SESSION_INFO *si)
-{
- if (si->hWnd) {
- g_TabSession.nUsersInNicklist = 0;
- if (g_Settings.bTabsEnable)
- g_TabSession.pUsers = 0;
- }
-}
-
-static void OnEventBroadcast(SESSION_INFO *si, GCEVENT *gce)
-{
- if (pci->SM_AddEvent(si->ptszID, si->pszModule, gce, FALSE) && si->hWnd && si->bInitDone) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
- }
- else if (si->hWnd && si->bInitDone) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
- }
-}
-
-static void OnSetStatusBar(SESSION_INFO *si)
-{
- if (si->hWnd) {
- g_TabSession.ptszStatusbarText = si->ptszStatusbarText;
- SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
- }
-}
-
-static void OnAddUser(SESSION_INFO *si, USERINFO*)
-{
- if (si->hWnd)
- g_TabSession.nUsersInNicklist++;
-}
-
-static void OnNewUser(SESSION_INFO *si, USERINFO*)
-{
- if (si->hWnd) {
- g_TabSession.pUsers = si->pUsers;
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- }
-}
-
-static void OnRemoveUser(SESSION_INFO *si, USERINFO*)
-{
- if (si->hWnd) {
- g_TabSession.pUsers = si->pUsers;
- g_TabSession.nUsersInNicklist--;
- }
-}
-
-static void OnAddStatus(SESSION_INFO *si, STATUSINFO*)
-{
- if (g_Settings.bTabsEnable && si->hWnd)
- g_TabSession.pStatuses = si->pStatuses;
-}
-
-static void OnSetStatus(SESSION_INFO *si, int wStatus)
-{
- if (g_Settings.bTabsEnable) {
- if (si->hWnd)
- g_TabSession.wStatus = wStatus;
- if (g_TabSession.hWnd)
- PostMessage(g_TabSession.hWnd, GC_FIXTABICONS, 0, (LPARAM)si);
- }
-}
-
-static void OnSetTopic(SESSION_INFO *si)
-{
- if (si->hWnd)
- g_TabSession.ptszTopic = si->ptszTopic;
-}
-
-static void OnFlashHighlight(SESSION_INFO *si, int bInactive)
-{
- if (!bInactive)
- return;
-
- if (!g_Settings.bTabsEnable && si->hWnd && g_Settings.bFlashWindowHighlight)
- SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL);
- if (g_Settings.bTabsEnable && g_TabSession.hWnd)
- SendMessage(g_TabSession.hWnd, GC_SETMESSAGEHIGHLIGHT, 0, (LPARAM)si);
-}
-
-static void OnFlashWindow(SESSION_INFO *si, int bInactive)
-{
- if (!bInactive)
- return;
-
- if (!g_Settings.bTabsEnable && si->hWnd && g_Settings.bFlashWindow)
- SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL);
- if (g_Settings.bTabsEnable && g_TabSession.hWnd)
- SendMessage(g_TabSession.hWnd, GC_SETTABHIGHLIGHT, 0, (LPARAM)si);
-}
-
-static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
-{
- if (gce->pDest->iType & g_Settings.dwTrayIconFlags)
- return saveCI.DoTrayIcon(si, gce);
- return TRUE;
-}
-
-static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
-{
- if (gce->pDest->iType & g_Settings.dwPopupFlags)
- return saveCI.DoPopup(si, gce);
- return TRUE;
-}
-
-static void OnLoadSettings()
-{
- if (g_Settings.MessageAreaFont)
- DeleteObject(g_Settings.MessageAreaFont);
-
- LOGFONT lf;
- LoadMessageFont(&lf, &g_Settings.MessageAreaColor);
- g_Settings.MessageAreaFont = CreateFontIndirect(&lf);
-
- g_Settings.iX = db_get_dw(NULL, CHAT_MODULE, "roomx", -1);
- g_Settings.iY = db_get_dw(NULL, CHAT_MODULE, "roomy", -1);
-
- g_Settings.bTabsEnable = db_get_b(NULL, CHAT_MODULE, "Tabs", 1) != 0;
- g_Settings.TabRestore = db_get_b(NULL, CHAT_MODULE, "TabRestore", 0) != 0;
- g_Settings.TabsAtBottom = db_get_b(NULL, CHAT_MODULE, "TabBottom", 0) != 0;
- g_Settings.TabCloseOnDblClick = db_get_b(NULL, CHAT_MODULE, "TabCloseOnDblClick", 0) != 0;
-}
-
-static void RegisterFonts()
-{
- ColourIDW colourid = { sizeof(colourid) };
- strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup));
- wcsncpy(colourid.group, LPGENW("Chat module"), _countof(colourid.group));
-
- strncpy(colourid.setting, "ColorLogBG", _countof(colourid.setting));
- wcsncpy(colourid.name, LPGENW("Group chat log background"), _countof(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_WINDOW);
- Colour_RegisterW(&colourid);
-
- strncpy(colourid.setting, "ColorMessageBG", _countof(colourid.setting));
- wcsncpy(colourid.name, LPGENW("Message background"), _countof(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_WINDOW);
- Colour_RegisterW(&colourid);
-
- strncpy(colourid.setting, "ColorNicklistBG", _countof(colourid.setting));
- wcsncpy(colourid.name, LPGENW("Nick list background"), _countof(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_WINDOW);
- Colour_RegisterW(&colourid);
-
- strncpy(colourid.setting, "ColorNicklistLines", _countof(colourid.setting));
- wcsncpy(colourid.name, LPGENW("Nick list lines"), _countof(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER);
- Colour_RegisterW(&colourid);
-
- strncpy(colourid.setting, "ColorNicklistSelectedBG", _countof(colourid.setting));
- wcsncpy(colourid.name, LPGENW("Nick list background (selected)"), _countof(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
- Colour_RegisterW(&colourid);
-}
-
-static int OnCheckPlugins(WPARAM, LPARAM)
-{
- SmileyAddInstalled = ServiceExists(MS_SMILEYADD_REPLACESMILEYS);
- PopupInstalled = ServiceExists(MS_POPUP_ADDPOPUPT);
- return 0;
-}
-
-static void TabsInit()
-{
- memset(&g_TabSession, 0, sizeof(SESSION_INFO));
- g_TabSession.iType = GCW_TABROOM;
- g_TabSession.iSplitterX = g_Settings.iSplitterX;
- g_TabSession.iSplitterY = g_Settings.iSplitterY;
- g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0);
- g_TabSession.bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0);
- g_TabSession.bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1);
- g_TabSession.iFG = 4;
- g_TabSession.bFGSet = TRUE;
- g_TabSession.iBG = 2;
- g_TabSession.bBGSet = TRUE;
-}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
- pcli = Clist_GetInterface();
-
- AddIcons();
- RegisterFonts();
-
- CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Chat module"), FONTMODE_SKIP };
- pci = Chat_GetInterface(&data);
- saveCI = *pci;
-
- pci->OnAddUser = OnAddUser;
- pci->OnNewUser = OnNewUser;
- pci->OnRemoveUser = OnRemoveUser;
-
- pci->OnAddStatus = OnAddStatus;
- pci->OnSetStatus = OnSetStatus;
- pci->OnSetTopic = OnSetTopic;
-
- pci->OnAddLog = OnAddLog;
- pci->OnClearLog = OnClearLog;
-
- pci->OnCreateModule = OnCreateModule;
- pci->OnOfflineSession = OnOfflineSession;
- pci->OnRemoveSession = OnRemoveSession;
- pci->OnRenameSession = OnRenameSession;
- pci->OnReplaceSession = OnReplaceSession;
- pci->OnDblClickSession = OnDblClickSession;
-
- pci->OnEventBroadcast = OnEventBroadcast;
- pci->OnLoadSettings = OnLoadSettings;
- pci->OnSetStatusBar = OnSetStatusBar;
- pci->OnFlashWindow = OnFlashWindow;
- pci->OnFlashHighlight = OnFlashHighlight;
- pci->ShowRoom = ShowRoom;
-
- pci->DoPopup = DoPopup;
- pci->DoTrayIcon = DoTrayIcon;
- pci->ReloadSettings();
-
- g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
-
- hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
- ImageList_AddIcon(hIconsList, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
- ImageList_AddIcon(hIconsList, LoadIconEx("overlay", FALSE));
- ImageList_SetOverlayImage(hIconsList, 1, 1);
-
- TabsInit();
-
- HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
- HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
- HookEvent(ME_SYSTEM_MODULELOAD, OnCheckPlugins);
- HookEvent(ME_SYSTEM_MODULESLOADED, OnCheckPlugins);
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Unload(void)
-{
- db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX);
- db_set_w(NULL, CHAT_MODULE, "SplitterY", (WORD)g_Settings.iSplitterY);
- db_set_dw(NULL, CHAT_MODULE, "roomx", g_Settings.iX);
- db_set_dw(NULL, CHAT_MODULE, "roomy", g_Settings.iY);
- db_set_dw(NULL, CHAT_MODULE, "roomwidth", g_Settings.iWidth);
- db_set_dw(NULL, CHAT_MODULE, "roomheight", g_Settings.iHeight);
-
- if (g_Settings.MessageAreaFont)
- DeleteObject(g_Settings.MessageAreaFont);
- DestroyMenu(g_hMenu);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-CREOleCallback reOleCallback;
-
-STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)
-{
- if (IsEqualIID(riid, IID_IRichEditOleCallback)) {
- *ppvObj = this;
- AddRef();
- return S_OK;
- }
- *ppvObj = NULL;
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
-{
- if (refCount == 0)
- StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
-
- return ++refCount;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::Release()
-{
- if (--refCount == 0) {
- if (pictStg) {
- pictStg->Release();
- pictStg = NULL;
- }
- }
- return refCount;
-}
-
-STDMETHODIMP CREOleCallback::ContextSensitiveHelp(BOOL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::DeleteObject(LPOLEOBJECT)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetClipboardData(CHARRANGE*, DWORD, LPDATAOBJECT*)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CREOleCallback::GetContextMenu(WORD, LPOLEOBJECT, CHARRANGE*, HMENU*)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetDragDropEffect(BOOL, DWORD, LPDWORD)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEUIWINDOW*, LPOLEINPLACEFRAMEINFO)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg)
-{
- WCHAR szwName[64];
- char szName[64];
- mir_snprintf(szName, "s%u", nextStgId++);
- MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName));
- if (pictStg == NULL)
- return STG_E_MEDIUMFULL;
- return pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
-}
-
-STDMETHODIMP CREOleCallback::QueryAcceptData(LPDATAOBJECT, CLIPFORMAT*, DWORD, BOOL, HGLOBAL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID, LPSTORAGE, LONG)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL)
-{
- return S_OK;
-}
diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp
deleted file mode 100644
index 1132c7e875..0000000000
--- a/src/core/stdchat/src/manager.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright 2000-12 Miranda IM, 2012-16 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-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 "stdafx.h"
-
-TABLIST *g_TabList = 0;
-
-BOOL SM_SetTabbedWindowHwnd(SESSION_INFO *si, HWND hwnd)
-{
- for (SESSION_INFO *p = pci->wndList; p != NULL; p = p->next) {
- if (si && si == p)
- p->hWnd = hwnd;
- else
- p->hWnd = NULL;
- }
- return TRUE;
-}
-
-SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si)
-{
- if (!si)
- return NULL;
-
- BOOL bFound = FALSE;
- SESSION_INFO *pTemp = pci->wndList;
- while (pTemp != NULL) {
- if (si == pTemp) {
- if (bFound)
- return NULL;
- else
- bFound = TRUE;
- }
- else if (bFound == TRUE && pTemp->hWnd)
- return pTemp;
- pTemp = pTemp->next;
- if (pTemp == NULL && bFound)
- pTemp = pci->wndList;
- }
- return NULL;
-}
-
-SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si)
-{
- if (!si)
- return NULL;
-
- SESSION_INFO *pTemp = pci->wndList, *pLast = NULL;
- while (pTemp != NULL) {
- if (si == pTemp) {
- if (pLast) {
- if (pLast != pTemp)
- return pLast;
- else
- return NULL;
- }
- }
- if (pTemp->hWnd)
- pLast = pTemp;
- pTemp = pTemp->next;
- if (pTemp == NULL)
- pTemp = pci->wndList;
- }
- return NULL;
-}
-
-//---------------------------------------------------
-// Tab list manager functions
-//
-// Necessary to keep track of what tabs should
-// be restored
-//---------------------------------------------------
-
-BOOL TabM_AddTab(const wchar_t *pszID, const char* pszModule)
-{
- TABLIST *node = NULL;
- if (!pszID || !pszModule)
- return FALSE;
-
- node = (TABLIST*)mir_alloc(sizeof(TABLIST));
- memset(node, 0, sizeof(TABLIST));
- node->pszID = mir_wstrdup(pszID);
- node->pszModule = mir_strdup(pszModule);
-
- if (g_TabList == NULL) { // list is empty
- g_TabList = node;
- node->next = NULL;
- }
- else {
- node->next = g_TabList;
- g_TabList = node;
- }
- return TRUE;
-}
-
-BOOL TabM_RemoveAll(void)
-{
- while (g_TabList != NULL) {
- TABLIST *pLast = g_TabList->next;
- mir_free(g_TabList->pszModule);
- mir_free(g_TabList->pszID);
- mir_free(g_TabList);
- g_TabList = pLast;
- }
- g_TabList = NULL;
- return TRUE;
-}
diff --git a/src/core/stdchat/src/message.cpp b/src/core/stdchat/src/message.cpp
deleted file mode 100644
index c89214d373..0000000000
--- a/src/core/stdchat/src/message.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-Copyright 2003-2009 Miranda IM project,
-
-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 "stdafx.h"
-#include <math.h>
-
-static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-{
- static DWORD dwRead;
- char ** ppText = (char **)dwCookie;
-
- if (*ppText == NULL) {
- *ppText = (char *)mir_alloc(cb + 1);
- memcpy(*ppText, pbBuff, cb);
- (*ppText)[cb] = 0;
- *pcb = cb;
- dwRead = cb;
- }
- else {
- char *p = (char *)mir_alloc(dwRead + cb + 1);
- memcpy(p, *ppText, dwRead);
- memcpy(p + dwRead, pbBuff, cb);
- p[dwRead + cb] = 0;
- mir_free(*ppText);
- *ppText = p;
- *pcb = cb;
- dwRead += cb;
- }
-
- return 0;
-}
-
-char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si)
-{
- EDITSTREAM stream;
- char* pszText = NULL;
- DWORD dwFlags;
-
- if (hwndDlg == 0 || si == 0)
- return NULL;
-
- memset(&stream, 0, sizeof(stream));
- stream.pfnCallback = Message_StreamCallback;
- stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer
-
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_STREAMOUT, dwFlags, (LPARAM)& stream);
- return pszText; // pszText contains the text
-}
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp
deleted file mode 100644
index 331602ee95..0000000000
--- a/src/core/stdchat/src/options.cpp
+++ /dev/null
@@ -1,761 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-
-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 "resource.h"
-#include "stdafx.h"
-
-struct branch_t
-{
- const wchar_t* szDescr;
- const char* szDBName;
- int iMode;
- BYTE bDefault;
-};
-
-static const struct branch_t branch0[] = {
- { LPGENW("Use a tabbed interface"), "Tabs", 0, 1 },
- { LPGENW("Close tab on double click"), "TabCloseOnDblClick", 0, 0 },
- { LPGENW("Restore previously open tabs when showing the window"), "TabRestore", 0, 0 },
- { LPGENW("Show tabs at the bottom"), "TabBottom", 0, 0 },
-};
-
-static const struct branch_t branch1[] = {
- { LPGENW("Send message by pressing the 'Enter' key"), "SendOnEnter", 0, 1 },
- { LPGENW("Send message by pressing the 'Enter' key twice"), "SendOnDblEnter", 0, 0 },
- { LPGENW("Flash window when someone speaks"), "FlashWindow", 0, 0 },
- { LPGENW("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1 },
- { LPGENW("Show list of users in the chat room"), "ShowNicklist", 0, 1 },
- { LPGENW("Show button for sending messages"), "ShowSend", 0, 0 },
- { LPGENW("Show buttons for controlling the chat room"), "ShowTopButtons", 0, 1 },
- { LPGENW("Show buttons for formatting the text you are typing"), "ShowFormatButtons", 0, 1 },
- { LPGENW("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 0 },
- { LPGENW("Show new windows cascaded"), "CascadeWindows", 0, 1 },
- { LPGENW("Save the size and position of chat rooms"), "SavePosition", 0, 0 },
- { LPGENW("Show the topic of the room on your contact list (if supported)"), "TopicOnClist", 0, 0 },
- { LPGENW("Do not play sounds when the chat room is focused"), "SoundsFocus", 0, 0 },
- { LPGENW("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0 },
- { LPGENW("Toggle the visible state when double clicking in the contact list"), "ToggleVisibility", 0, 0 },
- { LPGENW("Show contact statuses if protocol supports them"), "ShowContactStatus", 0, 0 },
- { LPGENW("Display contact status icon before user role icon"), "ContactStatusFirst", 0, 0 },
-};
-
-static const struct branch_t branch2[] = {
- { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1 },
- { LPGENW("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0 },
- { LPGENW("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0 },
- { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1 },
- { LPGENW("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1 },
- { LPGENW("Add ':' to auto-completed user names"), "AddColonToAutoComplete", 0, 1 },
- { LPGENW("Strip colors from messages in the log"), "StripFormatting", 0, 0 },
- { LPGENW("Enable the 'event filter' for new rooms"), "FilterEnabled", 0, 0 }
-};
-
-static const struct branch_t branch3[] = {
- { LPGENW("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0 },
- { LPGENW("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0 },
- { LPGENW("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0 },
- { LPGENW("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1 },
- { LPGENW("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1 },
- { LPGENW("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0 },
- { LPGENW("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1 },
- { LPGENW("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1 },
- { LPGENW("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0 },
- { LPGENW("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1 },
- { LPGENW("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0 },
-};
-
-static const struct branch_t branch4[] = {
- { LPGENW("Show icon for topic changes"), "IconFlags", GC_EVENT_TOPIC, 0 },
- { LPGENW("Show icon for users joining"), "IconFlags", GC_EVENT_JOIN, 1 },
- { LPGENW("Show icon for users disconnecting"), "IconFlags", GC_EVENT_QUIT, 0 },
- { LPGENW("Show icon for messages"), "IconFlags", GC_EVENT_MESSAGE, 0 },
- { LPGENW("Show icon for actions"), "IconFlags", GC_EVENT_ACTION, 0 },
- { LPGENW("Show icon for highlights"), "IconFlags", GC_EVENT_HIGHLIGHT, 0 },
- { LPGENW("Show icon for users leaving"), "IconFlags", GC_EVENT_PART, 0 },
- { LPGENW("Show icon for users kicking other user"), "IconFlags", GC_EVENT_KICK, 0 },
- { LPGENW("Show icon for notices"), "IconFlags", GC_EVENT_NOTICE, 0 },
- { LPGENW("Show icon for name changes"), "IconFlags", GC_EVENT_NICK, 0 },
- { LPGENW("Show icon for information messages"), "IconFlags", GC_EVENT_INFORMATION, 0 },
- { LPGENW("Show icon for status changes"), "IconFlags", GC_EVENT_ADDSTATUS, 0 },
-};
-
-static const struct branch_t branch5[] = {
- { LPGENW("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1 },
- { LPGENW("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0 },
- { LPGENW("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0 },
- { LPGENW("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0 },
- { LPGENW("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0 },
- { LPGENW("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0 },
- { LPGENW("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1 },
- { LPGENW("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0 },
- { LPGENW("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0 },
- { LPGENW("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0 },
- { LPGENW("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0 },
- { LPGENW("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0 },
- { LPGENW("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0 },
-};
-
-static const struct branch_t branch6[] = {
- { LPGENW("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1 },
- { LPGENW("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0 },
- { LPGENW("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0 },
- { LPGENW("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0 },
- { LPGENW("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0 },
- { LPGENW("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0 },
- { LPGENW("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0 },
- { LPGENW("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0 },
- { LPGENW("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0 },
- { LPGENW("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0 },
- { LPGENW("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0 },
- { LPGENW("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0 },
- { LPGENW("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0 },
-};
-
-HTREEITEM hItemB0[_countof(branch0)];
-HTREEITEM hItemB1[_countof(branch1)];
-HTREEITEM hItemB2[_countof(branch2)];
-HTREEITEM hItemB3[_countof(branch3)];
-HTREEITEM hItemB4[_countof(branch4)];
-HTREEITEM hItemB5[_countof(branch5)];
-HTREEITEM hItemB6[_countof(branch6)];
-
-static HTREEITEM InsertBranch(HWND hwndTree, char* pszDescr, BOOL bExpanded)
-{
- TVINSERTSTRUCT tvis = { 0 };
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_STATE;
- tvis.item.pszText = Langpack_PcharToTchar(pszDescr);
- tvis.item.stateMask = bExpanded ? TVIS_STATEIMAGEMASK | TVIS_EXPANDED : TVIS_STATEIMAGEMASK;
- tvis.item.state = bExpanded ? INDEXTOSTATEIMAGEMASK(1) | TVIS_EXPANDED : INDEXTOSTATEIMAGEMASK(1);
- HTREEITEM res = TreeView_InsertItem(hwndTree, &tvis);
- mir_free(tvis.item.pszText);
- return res;
-}
-
-static void FillBranch(HWND hwndTree, HTREEITEM hParent, const struct branch_t *branch, HTREEITEM *hItemB, int nValues, DWORD defaultval)
-{
- int iState;
-
- if (hParent == 0)
- return;
-
- TVINSERTSTRUCT tvis;
- tvis.hParent = hParent;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_STATE;
- for (int i = 0; i < nValues; i++) {
- tvis.item.pszText = TranslateW(branch[i].szDescr);
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- if (branch[i].iMode)
- iState = ((db_get_dw(NULL, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1;
- else
- iState = db_get_b(NULL, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(iState);
- hItemB[i] = TreeView_InsertItem(hwndTree, &tvis);
- }
-}
-
-static void SaveBranch(HWND hwndTree, const struct branch_t *branch, HTREEITEM *hItemB, int nValues)
-{
- int iState = 0;
-
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- for (int i = 0; i < nValues; i++) {
- tvi.hItem = hItemB[i];
- TreeView_GetItem(hwndTree, &tvi);
- BYTE bChecked = (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 1) ? 0 : 1;
- if (branch[i].iMode) {
- if (bChecked)
- iState |= branch[i].iMode;
- if (iState & GC_EVENT_ADDSTATUS)
- iState |= GC_EVENT_REMOVESTATUS;
- db_set_dw(NULL, CHAT_MODULE, branch[i].szDBName, (DWORD)iState);
- }
- else db_set_b(NULL, CHAT_MODULE, branch[i].szDBName, bChecked);
- }
-}
-
-static void CheckHeading(HWND hwndTree, HTREEITEM hHeading)
-{
- BOOL bChecked = TRUE;
-
- if (hHeading == 0)
- return;
-
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.hItem = TreeView_GetNextItem(hwndTree, hHeading, TVGN_CHILD);
- while (tvi.hItem && bChecked) {
- if (tvi.hItem != hItemB1[0] && tvi.hItem != hItemB1[1]) {
- TreeView_GetItem(hwndTree, &tvi);
- if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 1))
- bChecked = FALSE;
- }
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
- tvi.stateMask = TVIS_STATEIMAGEMASK;
- tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 2 : 1);
- tvi.hItem = hHeading;
- TreeView_SetItem(hwndTree, &tvi);
-}
-
-static void CheckBranches(HWND hwndTree, HTREEITEM hHeading)
-{
- BOOL bChecked = TRUE;
-
- if (hHeading == 0)
- return;
-
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.hItem = hHeading;
- TreeView_GetItem(hwndTree, &tvi);
- if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
- bChecked = FALSE;
- tvi.hItem = TreeView_GetNextItem(hwndTree, hHeading, TVGN_CHILD);
- tvi.stateMask = TVIS_STATEIMAGEMASK;
- while (tvi.hItem) {
- tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 2 : 1);
- if (tvi.hItem != hItemB1[0] && tvi.hItem != hItemB1[1])
- TreeView_SetItem(hwndTree, &tvi);
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
-}
-
-static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
-{
- wchar_t szDir[MAX_PATH];
- switch (uMsg) {
- case BFFM_INITIALIZED:
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);
- break;
-
- case BFFM_SELCHANGED:
- if (SHGetPathFromIDList((LPITEMIDLIST)lp, szDir))
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
- break;
- }
- return 0;
-}
-
-// add icons to the skinning module
-
-static IconItem iconList[] =
-{
- { LPGEN("Window icon"), "chat_window", IDI_CHANMGR, 0 },
- { LPGEN("Text color"), "chat_fgcol", IDI_COLOR, 0 },
- { LPGEN("Background color"), "chat_bkgcol", IDI_BKGCOLOR, 0 },
- { LPGEN("Bold"), "chat_bold", IDI_BBOLD, 0 },
- { LPGEN("Italics"), "chat_italics", IDI_BITALICS, 0 },
- { LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE, 0 },
- { LPGEN("Smiley button"), "chat_smiley", IDI_BSMILEY, 0 },
- { LPGEN("Room history"), "chat_history", IDI_HISTORY, 0 },
- { LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT, 0 },
- { LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER, 0 },
- { LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2, 0 },
- { LPGEN("Hide nick list"), "chat_nicklist", IDI_NICKLIST, 0 },
- { LPGEN("Show nick list"), "chat_nicklist2", IDI_NICKLIST2, 0 },
- { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY, 0 },
- { LPGEN("Close"), "chat_close", IDI_CLOSE, 0 },
-
- { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0, 10 },
- { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1, 10 },
- { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2, 10 },
- { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3, 10 },
- { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4, 10 },
- { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5, 10 },
-
- { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE, 10 },
- { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT, 10 },
- { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION, 10 },
- { LPGEN("Add status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS, 10 },
- { LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS, 10 },
- { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN, 10 },
- { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART, 10 },
- { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT, 10 },
- { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK, 10 },
- { LPGEN("Nick change (10x10)"), "chat_log_nick", IDI_NICK, 10 },
- { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE, 10 },
- { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC, 10 },
- { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT, 10 },
- { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO, 10 }
-};
-
-void AddIcons(void)
-{
- Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group chats"), iconList, 21);
- Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group chats log"), iconList + 21, 14);
-}
-
-// load icons from the skinning module if available
-HICON LoadIconEx(const char *pszIcoLibName, bool big)
-{
- char szTemp[256];
- mir_snprintf(szTemp, "chat_%s", pszIcoLibName);
- return IcoLib_GetIcon(szTemp, big);
-}
-
-HANDLE GetIconHandle(const char *pszIcoLibName)
-{
- char szTemp[256];
- mir_snprintf(szTemp, "chat_%s", pszIcoLibName);
- return IcoLib_GetIconHandle(szTemp);
-}
-
-static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefault)
-{
- DBVARIANT dbv;
- if (!db_get_ws(NULL, CHAT_MODULE, pszSetting, &dbv)) {
- replaceStrW(*ppPointer, dbv.ptszVal);
- db_free(&dbv);
- }
- else replaceStrW(*ppPointer, pszDefault);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// General options
-
-#define OPT_FIXHEADINGS (WM_USER+1)
-
-static HTREEITEM hListHeading0, hListHeading1, hListHeading2, hListHeading3, hListHeading4, hListHeading5, hListHeading6;
-
-static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
-{
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(NULL, CHAT_MODULE, "Branch0Exp", 0) ? TRUE : FALSE);
- hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE);
- hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(NULL, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE);
- hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(NULL, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE);
- hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(NULL, CHAT_MODULE, "Branch4Exp", 0) ? TRUE : FALSE);
- hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE);
- if (PopupInstalled)
- hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(NULL, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, hItemB0, _countof(branch0), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, hItemB1, _countof(branch1), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, hItemB2, _countof(branch2), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, branch3, hItemB3, _countof(branch3), 0x03E0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, branch4, hItemB4, _countof(branch4), 0x0000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, branch5, hItemB5, _countof(branch5), 0x1000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, branch6, hItemB6, _countof(branch6), 0x0000);
- SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
- break;
-
- case OPT_FIXHEADINGS:
- CheckHeading(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1);
- CheckHeading(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2);
- CheckHeading(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3);
- CheckHeading(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4);
- CheckHeading(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5);
- CheckHeading(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6);
- break;
-
- case WM_COMMAND:
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_CHECKBOXES:
- if (((LPNMHDR)lParam)->code == NM_CLICK) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
- if (hti.flags & TVHT_ONITEMSTATEICON) {
- TVITEM tvi = { 0 };
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- if (tvi.hItem == hItemB1[0] && INDEXTOSTATEIMAGEMASK(1) == tvi.state)
- TreeView_SetItemState(((LPNMHDR)lParam)->hwndFrom, hItemB1[1], INDEXTOSTATEIMAGEMASK(1), TVIS_STATEIMAGEMASK);
- if (tvi.hItem == hItemB1[1] && INDEXTOSTATEIMAGEMASK(1) == tvi.state)
- TreeView_SetItemState(((LPNMHDR)lParam)->hwndFrom, hItemB1[0], INDEXTOSTATEIMAGEMASK(1), TVIS_STATEIMAGEMASK);
-
- if (tvi.hItem == hListHeading0)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0);
- else if (tvi.hItem == hListHeading1)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1);
- else if (tvi.hItem == hListHeading2)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2);
- else if (tvi.hItem == hListHeading3)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3);
- else if (tvi.hItem == hListHeading4)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4);
- else if (tvi.hItem == hListHeading5)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5);
- else if (tvi.hItem == hListHeading6)
- CheckBranches(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6);
- else
- PostMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- }
- break;
-
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- BYTE b = db_get_b(NULL, CHAT_MODULE, "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, hItemB0, _countof(branch0));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, hItemB1, _countof(branch1));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, hItemB2, _countof(branch2));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch3, hItemB3, _countof(branch3));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch4, hItemB4, _countof(branch4));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, hItemB5, _countof(branch5));
- if (PopupInstalled)
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, hItemB6, _countof(branch6));
- g_Settings.dwIconFlags = db_get_dw(NULL, CHAT_MODULE, "IconFlags", 0x0000);
- g_Settings.dwTrayIconFlags = db_get_dw(NULL, CHAT_MODULE, "TrayIconFlags", 0x1000);
- g_Settings.dwPopupFlags = db_get_dw(NULL, CHAT_MODULE, "PopupFlags", 0x0000);
- g_Settings.bStripFormat = db_get_b(NULL, CHAT_MODULE, "TrimFormatting", 0) != 0;
- g_Settings.bTrayIconInactiveOnly = db_get_b(NULL, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0;
- g_Settings.bPopupInactiveOnly = db_get_b(NULL, CHAT_MODULE, "PopupInactiveOnly", 1) != 0;
- g_Settings.bLogIndentEnabled = db_get_b(NULL, CHAT_MODULE, "LogIndentEnabled", 1) != 0;
-
- if (b != db_get_b(NULL, CHAT_MODULE, "Tabs", 1)) {
- pci->SM_BroadcastMessage(NULL, GC_CLOSEWINDOW, 0, 1, FALSE);
- g_Settings.bTabsEnable = db_get_b(NULL, CHAT_MODULE, "Tabs", 1) != 0;
- }
- else pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
-
- return TRUE;
- }
- }
- break;
-
- case WM_DESTROY:
- BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch1Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch2Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch3Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch4Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch5Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch0Exp", b);
- if (PopupInstalled) {
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch6Exp", b);
- }
- break;
- }
- return FALSE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Log & other options
-
-static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10000, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETRANGE, 0, MAKELONG(255, 10));
- SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12), 0));
- {
- wchar_t* pszGroup = NULL;
- InitSetting(&pszGroup, "AddToGroup", L"Chat rooms");
- SetDlgItemText(hwndDlg, IDC_GROUP, pszGroup);
- mir_free(pszGroup);
- }
- {
- wchar_t szTemp[MAX_PATH];
- PathToRelativeT(g_Settings.pszLogDir, szTemp);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, szTemp);
- }
- SetDlgItemText(hwndDlg, IDC_HIGHLIGHTWORDS, g_Settings.pszHighlightWords);
- SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
- SetDlgItemText(hwndDlg, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
- SetDlgItemText(hwndDlg, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
- SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
- CheckDlgButton(hwndDlg, IDC_HIGHLIGHT, g_Settings.bHighlightEnabled ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_HIGHLIGHTWORDS), g_Settings.bHighlightEnabled ? TRUE : FALSE);
- CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.bLoggingEnabled ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), g_Settings.bLoggingEnabled ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCHOOSE), g_Settings.bLoggingEnabled ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT), g_Settings.bLoggingEnabled ? TRUE : FALSE);
- break;
-
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_INSTAMP
- || LOWORD(wParam) == IDC_OUTSTAMP
- || LOWORD(wParam) == IDC_TIMESTAMP
- || LOWORD(wParam) == IDC_LOGLIMIT
- || LOWORD(wParam) == IDC_HIGHLIGHTWORDS
- || LOWORD(wParam) == IDC_LOGDIRECTORY
- || LOWORD(wParam) == IDC_LOGTIMESTAMP
- || LOWORD(wParam) == IDC_NICKROW2
- || LOWORD(wParam) == IDC_GROUP
- || LOWORD(wParam) == IDC_LIMIT)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
-
- switch (LOWORD(wParam)) {
- case IDC_LOGGING:
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCHOOSE), IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT), IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- break;
-
- case IDC_FONTCHOOSE:
- {
- wchar_t szDirectory[MAX_PATH];
- wchar_t szTemp[MAX_PATH];
-
- BROWSEINFO bi = { 0 };
- bi.hwndOwner = hwndDlg;
- bi.pszDisplayName = szDirectory;
- bi.lpszTitle = TranslateT("Select folder");
- bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
- bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)szDirectory;
- LPITEMIDLIST idList = SHBrowseForFolder(&bi);
- if (idList) {
- SHGetPathFromIDList(idList, szDirectory);
- mir_wstrcat(szDirectory, L"\\");
- PathToRelativeT(szDirectory, szTemp);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_wstrlen(szTemp) > 1 ? szTemp : L"Logs\\");
- CoTaskMemFree(idList);
- }
- }
- break;
-
- case IDC_HIGHLIGHT:
- EnableWindow(GetDlgItem(hwndDlg, IDC_HIGHLIGHTWORDS), IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED ? TRUE : FALSE);
- break;
- }
-
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
- wchar_t * pszText = NULL;
- int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_HIGHLIGHTWORDS));
- if (iLen > 0) {
- wchar_t *ptszText = (wchar_t *)mir_alloc((iLen + 2) * sizeof(wchar_t));
- wchar_t *p2 = NULL;
-
- if (ptszText) {
- GetDlgItemText(hwndDlg, IDC_HIGHLIGHTWORDS, ptszText, iLen + 1);
- p2 = wcschr(ptszText, ',');
- while (p2) {
- *p2 = ' ';
- p2 = wcschr(ptszText, ',');
- }
- db_set_ws(NULL, CHAT_MODULE, "HighlightWords", ptszText);
- mir_free(ptszText);
- }
- }
- else db_unset(NULL, CHAT_MODULE, "HighlightWords");
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
- if (iLen > 0) {
- pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText, iLen + 1);
- db_set_ws(NULL, CHAT_MODULE, "LogDirectory", pszText);
- }
- else db_unset(NULL, CHAT_MODULE, "LogDirectory");
- pci->SM_InvalidateLogDirectories();
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
- if (iLen > 0) {
- pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
- db_set_ws(NULL, CHAT_MODULE, "LogTimestamp", pszText);
- }
- else db_unset(NULL, CHAT_MODULE, "LogTimestamp");
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
- if (iLen > 0) {
- pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
- db_set_ws(NULL, CHAT_MODULE, "HeaderTime", pszText);
- }
- else db_unset(NULL, CHAT_MODULE, "HeaderTime");
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
- if (iLen > 0) {
- pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
- db_set_ws(NULL, CHAT_MODULE, "HeaderIncoming", pszText);
- }
- else db_unset(NULL, CHAT_MODULE, "HeaderIncoming");
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
- if (iLen > 0) {
- pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
- db_set_ws(NULL, CHAT_MODULE, "HeaderOutgoing", pszText);
- }
- else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing");
-
- g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED;
- db_set_b(NULL, CHAT_MODULE, "HighlightEnabled", g_Settings.bHighlightEnabled);
-
- g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED;
- db_set_b(NULL, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled);
-
- iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_GETPOS, 0, 0);
- db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen);
- iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_GETPOS, 0, 0);
- db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen);
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
- if (iLen > 0) {
- pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
- db_set_ws(NULL, CHAT_MODULE, "AddToGroup", pszText);
- }
- else db_set_s(NULL, CHAT_MODULE, "AddToGroup", "");
- mir_free(pszText);
-
- iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_GETPOS, 0, 0);
- if (iLen > 0)
- db_set_b(NULL, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
- else
- db_unset(NULL, CHAT_MODULE, "NicklistRowDist");
-
- pci->ReloadSettings();
- pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Popup options
-
-static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_SETCOLOUR, 0, g_Settings.crPUBkgColour);
- SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_SETCOLOUR, 0, g_Settings.crPUTextColour);
-
- if (g_Settings.iPopupStyle == 2)
- CheckDlgButton(hwndDlg, IDC_RADIO2, BST_CHECKED);
- else if (g_Settings.iPopupStyle == 3)
- CheckDlgButton(hwndDlg, IDC_RADIO3, BST_CHECKED);
- else
- CheckDlgButton(hwndDlg, IDC_RADIO1, BST_CHECKED);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG), IsDlgButtonChecked(hwndDlg, IDC_RADIO3) == BST_CHECKED ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TEXT), IsDlgButtonChecked(hwndDlg, IDC_RADIO3) == BST_CHECKED ? TRUE : FALSE);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(100, -1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, MAKELONG(g_Settings.iPopupTimeout, 0));
- break;
-
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_TIMEOUT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
-
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- switch (LOWORD(wParam)) {
-
- case IDC_RADIO1:
- case IDC_RADIO2:
- case IDC_RADIO3:
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG), IsDlgButtonChecked(hwndDlg, IDC_RADIO3) == BST_CHECKED ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TEXT), IsDlgButtonChecked(hwndDlg, IDC_RADIO3) == BST_CHECKED ? TRUE : FALSE);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
- int iLen;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_RADIO2) == BST_CHECKED)
- iLen = 2;
- else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO3) == BST_CHECKED)
- iLen = 3;
- else
- iLen = 1;
-
- g_Settings.iPopupStyle = iLen;
- db_set_b(NULL, CHAT_MODULE, "PopupStyle", (BYTE)iLen);
-
- iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0);
- g_Settings.iPopupTimeout = iLen;
- db_set_w(NULL, CHAT_MODULE, "PopupTimeout", (WORD)iLen);
-
- g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0));
- g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0));
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-int OptionsInitialize(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.position = 910000000;
- odp.hInstance = g_hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
- odp.szGroup.a = LPGEN("Message sessions");
- odp.szTitle.a = LPGEN("Group chats");
- odp.szTab.a = LPGEN("General");
- odp.pfnDlgProc = DlgProcOptions1;
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
-
- odp.position = 910000001;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
- odp.szTab.a = LPGEN("Chat log");
- odp.pfnDlgProc = DlgProcOptions2;
- Options_AddPage(wParam, &odp);
-
- if (PopupInstalled) {
- odp.position = 910000002;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP);
- odp.szTitle.a = LPGEN(CHAT_MODULE);
- odp.szGroup.a = LPGEN("Popups");
- odp.szTab.a = NULL;
- odp.pfnDlgProc = DlgProcOptionsPopup;
- Options_AddPage(wParam, &odp);
- }
- return 0;
-}
diff --git a/src/core/stdchat/src/resource.h b/src/core/stdchat/src/resource.h
deleted file mode 100644
index 6890e93380..0000000000
--- a/src/core/stdchat/src/resource.h
+++ /dev/null
@@ -1,137 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by chat.rc
-//
-#define IDD_CHANNEL 101
-#define IDD_OPTIONS1 102
-#define IDD_OPTIONS2 103
-#define IDD_FILTER 105
-#define IDD_OPTIONSPOPUP 106
-#define IDI_BUNDERLINE 120
-#define IDI_BBOLD 121
-#define IDI_BITALICS 122
-#define IDI_BSMILEY 123
-#define IDI_TOPICBUT 124
-#define IDI_BKGCOLOR 125
-#define IDI_CHANMGR 126
-#define IDI_COLOR 127
-#define IDI_FILTER 128
-#define IDI_HISTORY 129
-#define IDI_NICKLIST 130
-#define IDI_JOIN 131
-#define IDI_PART 132
-#define IDI_QUIT 133
-#define IDI_KICK 134
-#define IDI_NICK 135
-#define IDI_NOTICE 136
-#define IDI_MESSAGE 137
-#define IDI_MESSAGEOUT 138
-#define IDI_TOPIC 139
-#define IDI_INFO 140
-#define IDI_ADDSTATUS 141
-#define IDI_REMSTATUS 142
-#define IDI_ACTION 143
-#define IDI_HIGHLIGHT 144
-#define IDI_BLANK 146
-#define IDI_TAG1 149
-#define IDI_TAG2 150
-#define IDR_MENU 151
-#define IDI_STATUS3 153
-#define IDI_STATUS2 154
-#define IDI_STATUS4 155
-#define IDI_STATUS1 156
-#define IDI_STATUS0 157
-#define IDI_STATUS5 158
-#define IDI_CLOSE 159
-#define IDI_OVERLAY 160
-#define IDI_NICKLIST2 161
-#define IDI_FILTER2 162
-#define IDC_LOG 1005
-#define IDC_SPLITTERX 1006
-#define IDC_SMILEY 1007
-#define IDC_SPLITTERY 1008
-#define IDC_MESSAGE 1009
-#define IDC_BOLD 1010
-#define IDC_ITALICS 1011
-#define IDC_UNDERLINE 1012
-#define IDC_FILTER 1013
-#define IDC_CHANMGR 1014
-#define IDC_SHOWNICKLIST 1016
-#define IDC_COLOR 1017
-#define IDC_BKGCOLOR 1019
-#define IDC_CHECKBOXES 1021
-#define IDC_NICKLISTBKG 1021
-#define IDC_HISTORY 1022
-#define IDC_CLOSE 1023
-#define IDC_NICKROW 1024
-#define IDC_LOGLIMIT 1024
-#define IDC_NICKROW2 1025
-#define IDC_SPIN1 1028
-#define IDC_SPIN2 1029
-#define IDC_SPIN3 1030
-#define IDC_SPIN4 1031
-#define IDC_FONTLIST 1032
-#define IDC_CHOOSEFONT 1034
-#define IDC_FONTCOLOR 1035
-#define IDC_MESSAGEBKG 1036
-#define IDC_LOGBKG 1037
-#define IDC_HIGHLIGHTWORDS 1040
-#define IDC_INSTAMP 1041
-#define IDC_OUTSTAMP 1043
-#define IDC_TIMESTAMP 1046
-#define IDC_FONTCHOOSE 1047
-#define IDC_LOGDIRECTORY 1048
-#define IDC_LIMIT 1050
-#define IDC_LOGTIMESTAMP 1051
-#define IDC_GROUP 1057
-#define IDC_RADIO1 1061
-#define IDC_RADIO2 1062
-#define IDC_RADIO3 1063
-#define IDC_TEXT 1064
-#define IDC_BKG 1065
-#define IDC_TIMEOUT 1067
-#define IDC_HIGHLIGHT 1068
-#define IDC_TEXTO 1069
-#define IDC_LOGGING 1069
-#define IDC_LIST 1072
-#define IDC_TAB 1074
-#define IDC_1 1075
-#define IDC_2 1076
-#define IDC_3 1077
-#define IDC_4 1078
-#define IDC_5 1079
-#define IDC_6 1080
-#define IDC_7 1081
-#define IDC_8 1082
-#define IDC_9 1083
-#define IDC_10 1084
-#define IDC_11 1085
-#define ID_MESS 40001
-#define ID_NEW 40002
-#define ID_CURR 40003
-#define ID_COPY 40004
-#define ID_COPYALL 40006
-#define ID_CLEARLOG 40009
-#define ID_MESSAGE_UNDO 40013
-#define ID_MESSAGE_COPY 40014
-#define ID_MESSAGE_CUT 40015
-#define ID_MESSAGE_CLEAR 40017
-#define ID_MESSAGE_SELECTALL 40018
-#define ID_MESSAGE_REDO 40019
-#define ID_MESSAGE_PASTE 40020
-#define ID_CLOSE 40022
-#define ID_CLOSEOTHER 40023
-#define ID_LOCKPOSITION 40024
-#define ID_SEARCH_GOOGLE 40027
-#define ID_SEARCH_WIKIPEDIA 40028
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 163
-#define _APS_NEXT_COMMAND_VALUE 40030
-#define _APS_NEXT_CONTROL_VALUE 1076
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp
deleted file mode 100644
index 119830d217..0000000000
--- a/src/core/stdchat/src/services.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright 2000-12 Miranda IM, 2012-16 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-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 "stdafx.h"
-
-void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
-{
- if (!si)
- return;
-
- if (g_Settings.bTabsEnable) {
- // the session is not the current tab, so we copy the necessary
- // details into the SESSION_INFO for the tabbed window
- if (!si->hWnd) {
- g_TabSession.iEventCount = si->iEventCount;
- g_TabSession.iStatusCount = si->iStatusCount;
- g_TabSession.iType = si->iType;
- g_TabSession.nUsersInNicklist = si->nUsersInNicklist;
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- g_TabSession.pMe = si->pMe;
- g_TabSession.pStatuses = si->pStatuses;
- g_TabSession.ptszID = si->ptszID;
- g_TabSession.pszModule = si->pszModule;
- g_TabSession.ptszName = si->ptszName;
- g_TabSession.ptszStatusbarText = si->ptszStatusbarText;
- g_TabSession.ptszTopic = si->ptszTopic;
- g_TabSession.pUsers = si->pUsers;
- g_TabSession.hContact = si->hContact;
- g_TabSession.wStatus = si->wStatus;
- g_TabSession.lpCommands = si->lpCommands;
- g_TabSession.lpCurrentCommand = NULL;
- }
-
- // Do we need to create a tabbed window?
- if (g_TabSession.hWnd == NULL)
- g_TabSession.hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), NULL, RoomWndProc, (LPARAM)&g_TabSession);
-
- SetWindowLongPtr(g_TabSession.hWnd, GWL_EXSTYLE, GetWindowLongPtr(g_TabSession.hWnd, GWL_EXSTYLE) | WS_EX_APPWINDOW);
-
- // if the session was not the current tab we need to tell the window to
- // redraw to show the contents of the current SESSION_INFO
- if (!si->hWnd) {
- SM_SetTabbedWindowHwnd(si, g_TabSession.hWnd);
- SendMessage(g_TabSession.hWnd, GC_ADDTAB, -1, (LPARAM)si);
- SendMessage(g_TabSession.hWnd, GC_TABCHANGE, 0, (LPARAM)&g_TabSession);
- }
-
- pci->SetActiveSession(si->ptszID, si->pszModule);
-
- if (!IsWindowVisible(g_TabSession.hWnd) || wp == WINDOW_HIDDEN)
- SendMessage(g_TabSession.hWnd, GC_CONTROL_MSG, wp, 0);
- else {
- if (IsIconic(g_TabSession.hWnd))
- ShowWindow(g_TabSession.hWnd, SW_NORMAL);
-
- PostMessage(g_TabSession.hWnd, WM_SIZE, 0, 0);
- if (si->iType != GCW_SERVER)
- SendMessage(g_TabSession.hWnd, GC_UPDATENICKLIST, 0, 0);
- else
- SendMessage(g_TabSession.hWnd, GC_UPDATETITLE, 0, 0);
- SendMessage(g_TabSession.hWnd, GC_REDRAWLOG, 0, 0);
- SendMessage(g_TabSession.hWnd, GC_UPDATESTATUSBAR, 0, 0);
- ShowWindow(g_TabSession.hWnd, SW_SHOW);
- if (bSetForeground)
- SetForegroundWindow(g_TabSession.hWnd);
- }
- SendMessage(g_TabSession.hWnd, WM_MOUSEACTIVATE, 0, 0);
- SetFocus(GetDlgItem(g_TabSession.hWnd, IDC_MESSAGE));
- return;
- }
-
- // Do we need to create a window?
- if (si->hWnd == NULL)
- si->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), NULL, RoomWndProc, (LPARAM)si);
-
- SetWindowLongPtr(si->hWnd, GWL_EXSTYLE, GetWindowLongPtr(si->hWnd, GWL_EXSTYLE) | WS_EX_APPWINDOW);
- if (!IsWindowVisible(si->hWnd) || wp == WINDOW_HIDDEN)
- SendMessage(si->hWnd, GC_CONTROL_MSG, wp, 0);
- else {
- if (IsIconic(si->hWnd))
- ShowWindow(si->hWnd, SW_NORMAL);
- ShowWindow(si->hWnd, SW_SHOW);
- SetForegroundWindow(si->hWnd);
- }
-
- SendMessage(si->hWnd, WM_MOUSEACTIVATE, 0, 0);
- SetFocus(GetDlgItem(si->hWnd, IDC_MESSAGE));
-}
diff --git a/src/core/stdchat/src/stdafx.cxx b/src/core/stdchat/src/stdafx.cxx
deleted file mode 100644
index 48e982a880..0000000000
--- a/src/core/stdchat/src/stdafx.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright (C) 2012-16 Miranda NG team (http://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h" \ No newline at end of file
diff --git a/src/core/stdchat/src/stdafx.h b/src/core/stdchat/src/stdafx.h
deleted file mode 100644
index a5c90861a1..0000000000
--- a/src/core/stdchat/src/stdafx.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-
-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 _CHAT_H_
-#define _CHAT_H_
-
-#include <shlobj.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <richedit.h>
-#include <ole2.h>
-#include <richole.h>
-#include <commdlg.h>
-#include <shellapi.h>
-#include <Initguid.h>
-#include <Oleacc.h>
-#include <Uxtheme.h>
-
-#include <malloc.h>
-#include <time.h>
-
-#include <win2k.h>
-#include <newpluginapi.h>
-#include <m_system.h>
-#include <m_options.h>
-#include <m_utils.h>
-#include <m_utils.h>
-#include <m_langpack.h>
-#include <m_skin.h>
-#include <m_button.h>
-#include <m_protosvc.h>
-#include <m_clist.h>
-#include <m_message.h>
-#include <m_icolib.h>
-#include <m_popup.h>
-#include <m_chat_int.h>
-#include <m_core.h>
-#include <m_string.h>
-#include <m_fontservice.h>
-
-#include "m_ieview.h"
-#include "m_smileyadd.h"
-
-#include "resource.h"
-#include "version.h"
-
-#define EM_SUBCLASSED (WM_USER+200)
-#define EM_ACTIVATE (WM_USER+201)
-
-struct TABLIST
-{
- wchar_t *pszID;
- char *pszModule;
- TABLIST *next;
-};
-
-struct MODULEINFO : public GCModuleInfoBase
-{
- int OnlineIconIndex;
- int OfflineIconIndex;
-};
-
-struct SESSION_INFO : public GCSessionInfoBase
-{
- int iX, iY;
- IAccPropServices* pAccPropServicesForNickList;
-};
-
-struct LOGSTREAMDATA : public GCLogStreamDataBase {};
-
-struct GlobalLogSettings : public GlobalLogSettingsBase
-{
- int iX, iY;
- bool bTabsEnable, TabsAtBottom, TabCloseOnDblClick, TabRestore;
-
- HFONT MessageAreaFont;
- COLORREF MessageAreaColor;
-};
-
-extern GlobalLogSettings g_Settings;
-extern SESSION_INFO g_TabSession;
-extern CHAT_MANAGER saveCI;
-extern TABLIST *g_TabList;
-extern HMENU g_hMenu;
-extern HIMAGELIST hIconsList;
-
-extern HINSTANCE g_hInst;
-extern BOOL SmileyAddInstalled, PopupInstalled;
-
-struct CREOleCallback : public IRichEditOleCallback
-{
- CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {}
- unsigned refCount;
- IStorage *pictStg;
- int nextStgId;
-
- STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * lplpObj);
- STDMETHOD_(ULONG,AddRef) (THIS);
- STDMETHOD_(ULONG,Release) (THIS);
-
- STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
- STDMETHOD(GetNewStorage) (LPSTORAGE FAR * lplpstg);
- STDMETHOD(GetInPlaceContext) (LPOLEINPLACEFRAME FAR * lplpFrame, LPOLEINPLACEUIWINDOW FAR * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo);
- STDMETHOD(ShowContainerUI) (BOOL fShow);
- STDMETHOD(QueryInsertObject) (LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp);
- STDMETHOD(DeleteObject) (LPOLEOBJECT lpoleobj);
- STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
- STDMETHOD(GetClipboardData) (CHARRANGE FAR * lpchrg, DWORD reco, LPDATAOBJECT FAR * lplpdataobj);
- STDMETHOD(GetDragDropEffect) (BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect);
- STDMETHOD(GetContextMenu) (WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE FAR * lpchrg, HMENU FAR * lphmenu) ;
-};
-
-extern CREOleCallback reOleCallback;
-
-//main.c
-void LoadIcons(void);
-
-// log.c
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo);
-void ValidateFilename (wchar_t * filename);
-char* Log_CreateRtfHeader(MODULEINFO * mi);
-
-// window.c
-INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
-int GetTextPixelSize( wchar_t* pszText, HFONT hFont, BOOL bWidth);
-
-BOOL SM_SetTabbedWindowHwnd(SESSION_INFO *si, HWND hwnd);
-SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si);
-SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si);
-
-// options.c
-int OptionsInitialize(WPARAM wParam, LPARAM lParam);
-void AddIcons(void);
-HICON LoadIconEx(const char *pszIcoLibName, bool big);
-HANDLE GetIconHandle(const char *pszIcolibName);
-
-// services.c
-void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
-
-// tools.c
-int GetColorIndex(const char* pszModule, COLORREF cr);
-void CheckColorsInModule(const char* pszModule);
-int GetRichTextLength(HWND hwnd);
-UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText);
-void DestroyGCMenu(HMENU *hMenu, int iIndex);
-bool LoadMessageFont(LOGFONT *lf, COLORREF *colour);
-
-// message.c
-char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si);
-
-BOOL TabM_AddTab(const wchar_t *pszID, const char* pszModule);
-BOOL TabM_RemoveAll(void);
-
-#pragma comment(lib,"comctl32.lib")
-
-#endif
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp
deleted file mode 100644
index 54dd4cb3e8..0000000000
--- a/src/core/stdchat/src/tools.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright 2000-12 Miranda IM, 2012-16 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-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 "stdafx.h"
-
-bool LoadMessageFont(LOGFONT *lf, COLORREF *colour)
-{
- char str[32];
- int i = 8; // MSGFONTID_MESSAGEAREA
-
- if (colour) {
- mir_snprintf(str, "SRMFont%dCol", i);
- *colour = db_get_dw(NULL, "SRMM", str, 0);
- }
- if (lf) {
- mir_snprintf(str, "SRMFont%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, "SRMM", str, -12);
- lf->lfWidth = 0;
- lf->lfEscapement = 0;
- lf->lfOrientation = 0;
- mir_snprintf(str, "SRMFont%dSty", i);
- int style = db_get_b(NULL, "SRMM", str, 0);
- lf->lfWeight = style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL;
- lf->lfItalic = style & DBFONTF_ITALIC ? 1 : 0;
- lf->lfUnderline = 0;
- lf->lfStrikeOut = 0;
- lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf->lfQuality = DEFAULT_QUALITY;
- lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- mir_snprintf(str, "SRMFont%d", i);
-
- DBVARIANT dbv;
- if (db_get_ws(NULL, "SRMM", str, &dbv))
- mir_wstrcpy(lf->lfFaceName, L"Arial");
- else {
- mir_wstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
- db_free(&dbv);
- }
- mir_snprintf(str, "SRMFont%dSet", i);
- lf->lfCharSet = db_get_b(NULL, "SRMM", str, DEFAULT_CHARSET);
- }
- return true;
-}
-
-int GetRichTextLength(HWND hwnd)
-{
- GETTEXTLENGTHEX gtl;
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- return (int)SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
-}
-
-int GetColorIndex(const char* pszModule, COLORREF cr)
-{
- MODULEINFO * pMod = pci->MM_FindModule(pszModule);
- int i = 0;
-
- if (!pMod || pMod->nColorCount == 0)
- return -1;
-
- for (i = 0; i < pMod->nColorCount; i++)
- if (pMod->crColors[i] == cr)
- return i;
-
- return -1;
-}
-
-// obscure function that is used to make sure that any of the colors
-// passed by the protocol is used as fore- or background color
-// in the messagebox. THis is to vvercome limitations in the richedit
-// that I do not know currently how to fix
-
-void CheckColorsInModule(const char* pszModule)
-{
- MODULEINFO *pMod = pci->MM_FindModule(pszModule);
- int i = 0;
- COLORREF crBG = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
-
- if (!pMod)
- return;
-
- for (i = 0; i < pMod->nColorCount; i++) {
- if (pMod->crColors[i] == g_Settings.MessageAreaColor || pMod->crColors[i] == crBG) {
- if (pMod->crColors[i] == RGB(255, 255, 255))
- pMod->crColors[i]--;
- else
- pMod->crColors[i]++;
- }
- }
-}
-
-UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText)
-{
- HMENU hSubMenu = 0;
- *hMenu = GetSubMenu(g_hMenu, iIndex);
- TranslateMenu(*hMenu);
-
- GCMENUITEMS gcmi = { 0 };
- gcmi.pszID = si->ptszID;
- gcmi.pszModule = si->pszModule;
- gcmi.pszUID = pszUID;
-
- if (iIndex == 1) {
- int i = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
-
- EnableMenuItem(*hMenu, ID_CLEARLOG, MF_ENABLED);
- EnableMenuItem(*hMenu, ID_COPYALL, MF_ENABLED);
- ModifyMenu(*hMenu, 4, MF_GRAYED | MF_BYPOSITION, 4, NULL);
- if (!i) {
- EnableMenuItem(*hMenu, ID_COPYALL, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(*hMenu, ID_CLEARLOG, MF_BYCOMMAND | MF_GRAYED);
- if (pszWordText && pszWordText[0])
- ModifyMenu(*hMenu, 4, MF_ENABLED | MF_BYPOSITION, 4, NULL);
- }
-
- if (pszWordText && pszWordText[0]) {
- wchar_t szMenuText[4096];
- mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
- ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
- }
- else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up"));
- gcmi.Type = MENU_ON_LOG;
- }
- else if (iIndex == 0) {
- wchar_t szTemp[50];
- if (pszWordText)
- mir_snwprintf(szTemp, TranslateT("&Message %s"), pszWordText);
- else
- mir_wstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
-
- if (mir_wstrlen(szTemp) > 40)
- mir_wstrcpy(szTemp + 40, L"...");
- ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
- gcmi.Type = MENU_ON_NICKLIST;
- }
-
- NotifyEventHooks(pci->hBuildMenuEvent, 0, (WPARAM)&gcmi);
-
- if (gcmi.nItems > 0)
- AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
-
- for (int i = 0; i < gcmi.nItems; i++) {
- wchar_t* ptszText = TranslateW(gcmi.Item[i].pszDesc);
- DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0;
-
- if (gcmi.Item[i].uType == MENU_NEWPOPUP) {
- hSubMenu = CreateMenu();
- AppendMenu(*hMenu, dwState | MF_POPUP, (UINT_PTR)hSubMenu, ptszText);
- }
- else if (gcmi.Item[i].uType == MENU_POPUPHMENU)
- AppendMenu(hSubMenu == 0 ? *hMenu : hSubMenu, dwState | MF_POPUP, gcmi.Item[i].dwID, ptszText);
- else if (gcmi.Item[i].uType == MENU_POPUPITEM)
- AppendMenu(hSubMenu == 0 ? *hMenu : hSubMenu, dwState | MF_STRING, gcmi.Item[i].dwID, ptszText);
- else if (gcmi.Item[i].uType == MENU_POPUPCHECK)
- AppendMenu(hSubMenu == 0 ? *hMenu : hSubMenu, dwState | MF_CHECKED | MF_STRING, gcmi.Item[i].dwID, ptszText);
- else if (gcmi.Item[i].uType == MENU_POPUPSEPARATOR)
- AppendMenu(hSubMenu == 0 ? *hMenu : hSubMenu, MF_SEPARATOR, 0, ptszText);
- else if (gcmi.Item[i].uType == MENU_SEPARATOR)
- AppendMenu(*hMenu, MF_SEPARATOR, 0, ptszText);
- else if (gcmi.Item[i].uType == MENU_HMENU)
- AppendMenu(*hMenu, dwState | MF_POPUP, gcmi.Item[i].dwID, ptszText);
- else if (gcmi.Item[i].uType == MENU_ITEM)
- AppendMenu(*hMenu, dwState | MF_STRING, gcmi.Item[i].dwID, ptszText);
- else if (gcmi.Item[i].uType == MENU_CHECK)
- AppendMenu(*hMenu, dwState | MF_CHECKED | MF_STRING, gcmi.Item[i].dwID, ptszText);
- }
- return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
-}
-
-void DestroyGCMenu(HMENU *hMenu, int iIndex)
-{
- MENUITEMINFO mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_SUBMENU;
- while (GetMenuItemInfo(*hMenu, iIndex, TRUE, &mii)) {
- if (mii.hSubMenu != NULL)
- DestroyMenu(mii.hSubMenu);
- RemoveMenu(*hMenu, iIndex, MF_BYPOSITION);
- }
-}
-
-void ValidateFilename(wchar_t *filename)
-{
- wchar_t *p1 = filename;
- wchar_t szForbidden[] = L"\\/:*?\"<>|";
- while (*p1 != '\0') {
- if (wcschr(szForbidden, *p1))
- *p1 = '_';
- p1 += 1;
- }
-}
diff --git a/src/core/stdchat/src/version.h b/src/core/stdchat/src/version.h
deleted file mode 100644
index bdcd76aceb..0000000000
--- a/src/core/stdchat/src/version.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-#include <m_version.h>
-
-#define __FILEVERSION_STRING MIRANDA_VERSION_FILEVERSION
-#define __VERSION_STRING MIRANDA_VERSION_STRING
-
-#define __PLUGIN_NAME "Standard Chat"
-#define __FILENAME "stdchat.dll"
-#define __DESCRIPTION "Core module for providing chat rooms support."
-#define __AUTHOR "Miranda NG Development Team"
-#define __AUTHOREMAIL ""
-#define __AUTHORWEB "http://miranda-ng.org/p/StdChat/"
-#define __COPYRIGHT "© 2012-16 Miranda NG Development Team"
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
deleted file mode 100644
index 5f18af8b47..0000000000
--- a/src/core/stdchat/src/window.cpp
+++ /dev/null
@@ -1,2610 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright 2000-12 Miranda IM, 2012-16 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-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 "stdafx.h"
-
-static HKL hkl = NULL;
-
-struct MESSAGESUBDATA
-{
- time_t lastEnterTime;
- wchar_t szTabSave[20];
-};
-
-static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n";
-
-static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- RECT rc;
-
- switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
-
- case WM_SETCURSOR:
- GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? LoadCursor(NULL, IDC_SIZENS) : LoadCursor(NULL, IDC_SIZEWE));
- return TRUE;
-
- case WM_LBUTTONDOWN:
- SetCapture(hwnd);
- return 0;
-
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- GetClientRect(hwnd, &rc);
- SendMessage(GetParent(hwnd), GC_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
- }
- return 0;
-
- case WM_LBUTTONUP:
- ReleaseCapture();
- PostMessage(GetParent(hwnd), WM_SIZE, 0, 0);
- return 0;
- }
- return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
-}
-
-static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
-{
- SendDlgItemMessage(hwndDlg, IDC_SMILEY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("smiley", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("bold", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("italics", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("underline", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("fgcol", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("bkgcol", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("history", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("settings", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("close", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE));
-
- SendDlgItemMessage(hwndDlg, IDC_SMILEY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CLOSE, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_SMILEY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nick list (CTRL+N)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CLOSE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Close current tab (CTRL+F4)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
-
- MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
- if (pInfo) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOLD), pInfo->bBold);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITALICS), pInfo->bItalics);
- EnableWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), pInfo->bUnderline);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR), pInfo->bColor);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), pInfo->bBkgColor);
- if (si->iType == GCW_CHATROOM)
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), pInfo->bChanMgr);
- }
-}
-
-static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
-{
- SESSION_INFO *si = (SESSION_INFO*)lParam;
-
- BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1);
- BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1);
- BOOL bToolbar = bFormat || bControl;
- BOOL bSend = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowSend", 0);
- BOOL bNick = si->iType != GCW_SERVER && si->bNicklistEnabled;
- BOOL bTabs = g_Settings.bTabsEnable;
- BOOL bTabBottom = g_Settings.TabsAtBottom;
-
- RECT rc, rcTabs;
- GetClientRect(GetDlgItem(hwndDlg, IDC_TAB), &rcTabs);
- int TabHeight = rcTabs.bottom - rcTabs.top;
- TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_TAB), FALSE, &rcTabs);
- TabHeight -= (rcTabs.bottom - rcTabs.top);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEY), (SmileyAddInstalled && bFormat) ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_BOLD), bFormat ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), bFormat ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_ITALICS), bFormat ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_COLOR), bFormat ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), bFormat ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_HISTORY), bControl ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST), bControl ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_FILTER), bControl ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), bControl ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDOK), bSend ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), g_Settings.bTabsEnable ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_TAB), g_Settings.bTabsEnable ? SW_SHOW : SW_HIDE);
- if (si->iType != GCW_SERVER)
- ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
- else
- ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), SW_HIDE);
-
- if (si->iType == GCW_SERVER) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), FALSE);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), TRUE);
- if (si->iType == GCW_CHATROOM)
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), pci->MM_FindModule(si->pszModule)->bChanMgr);
- }
-
- switch (urc->wId) {
- case IDOK:
- GetWindowRect(si->hwndStatus, &rc);
- urc->rcItem.left = bSend ? 315 : urc->dlgNewSize.cx;
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 23;
- urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1;
- return RD_ANCHORX_RIGHT | RD_ANCHORY_CUSTOM;
-
- case IDC_TAB:
- urc->rcItem.top = 1;
- urc->rcItem.left = 0;
- urc->rcItem.right = urc->dlgNewSize.cx - 24;
- urc->rcItem.bottom = urc->dlgNewSize.cy - si->iSplitterY;
- if (!bToolbar)
- urc->rcItem.bottom += 20;
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
-
- case IDC_LOG:
- urc->rcItem.top = bTabs ? (bTabBottom ? 0 : rcTabs.top - 1) : 0;
- urc->rcItem.left = 0;
- urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx;
- LBL_CalcBottom:
- urc->rcItem.bottom = urc->dlgNewSize.cy - si->iSplitterY;
- if (bTabs && bTabBottom) urc->rcItem.bottom += 6 - TabHeight;
- if (!bToolbar) urc->rcItem.bottom += 20;
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
-
- case IDC_LIST:
- urc->rcItem.top = bTabs ? (bTabBottom ? 0 : rcTabs.top - 1) : 0;
- urc->rcItem.right = urc->dlgNewSize.cx;
- urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX + 2;
- goto LBL_CalcBottom;
-
- case IDC_SPLITTERX:
- urc->rcItem.top = bTabs ? rcTabs.top : 1;
- urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX;
- urc->rcItem.right = urc->rcItem.left + 2;
- goto LBL_CalcBottom;
-
- case IDC_SPLITTERY:
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY;
- if (!bToolbar)
- urc->rcItem.top += 20;
- urc->rcItem.bottom = urc->rcItem.top + 2;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM;
-
- case IDC_MESSAGE:
- GetWindowRect(si->hwndStatus, &rc);
- urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx;
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 22;
- urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1;
- return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
-
- case IDC_SMILEY:
- case IDC_ITALICS:
- case IDC_BOLD:
- case IDC_UNDERLINE:
- case IDC_COLOR:
- case IDC_BKGCOLOR:
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3;
- urc->rcItem.bottom = urc->rcItem.top + 16;
- return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
-
- case IDC_HISTORY:
- case IDC_CHANMGR:
- case IDC_SHOWNICKLIST:
- case IDC_FILTER:
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3;
- urc->rcItem.bottom = urc->rcItem.top + 16;
- return RD_ANCHORX_RIGHT | RD_ANCHORY_CUSTOM;
-
- case IDC_CLOSE:
- urc->rcItem.left = urc->dlgNewSize.cx - 19;
- urc->rcItem.right = urc->rcItem.left + 16;
- urc->rcItem.top = bTabBottom ? (bToolbar ? urc->dlgNewSize.cy - si->iSplitterY - 18 : urc->dlgNewSize.cy - si->iSplitterY - 18 + 20) : 3;
- urc->rcItem.bottom = urc->rcItem.top + 16;
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
- }
- return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
-}
-
-static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- SESSION_INFO *Parentsi = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- switch (msg) {
- case EM_SUBCLASSED:
- dat = (MESSAGESUBDATA*)mir_alloc(sizeof(MESSAGESUBDATA));
-
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)dat);
- dat->szTabSave[0] = '\0';
- dat->lastEnterTime = 0;
- return 0;
-
- case WM_MOUSEWHEEL:
- SendDlgItemMessage(GetParent(hwnd), IDC_LOG, WM_MOUSEWHEEL, wParam, lParam);
- dat->lastEnterTime = 0;
- return TRUE;
-
- case EM_REPLACESEL:
- PostMessage(hwnd, EM_ACTIVATE, 0, 0);
- break;
-
- case EM_ACTIVATE:
- SetActiveWindow(GetParent(hwnd));
- break;
-
- case WM_CHAR:
- {
- BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
- BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
-
- if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY)
- break;
-
- if (wParam == 9 && isCtrl && !isAlt) // ctrl-i (italics)
- return TRUE;
-
- if (wParam == VK_SPACE && isCtrl && !isAlt) // ctrl-space (paste clean text)
- return TRUE;
-
- if (wParam == '\n' || wParam == '\r') {
- if ((isCtrl != 0) ^ (0 != db_get_b(NULL, CHAT_MODULE, "SendOnEnter", 1))) {
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- if (db_get_b(NULL, CHAT_MODULE, "SendOnDblEnter", 0)) {
- if (dat->lastEnterTime + 2 < time(NULL))
- dat->lastEnterTime = time(NULL);
- else {
- SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
- SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- }
- }
- else
- dat->lastEnterTime = 0;
-
- if (wParam == 1 && isCtrl && !isAlt) { //ctrl-a
- SendMessage(hwnd, EM_SETSEL, 0, -1);
- return 0;
- }
- }
- break;
-
- case WM_KEYDOWN:
- {
- static int start, end;
- BOOL isShift = GetKeyState(VK_SHIFT) & 0x8000;
- BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
- BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- if (wParam == VK_RETURN) {
- dat->szTabSave[0] = '\0';
- if ((isCtrl != 0) ^ (0 != db_get_b(NULL, CHAT_MODULE, "SendOnEnter", 1)))
- return 0;
-
- if (db_get_b(NULL, CHAT_MODULE, "SendOnDblEnter", 0))
- if (dat->lastEnterTime + 2 >= time(NULL))
- return 0;
-
- break;
- }
-
- if (wParam == VK_TAB && isShift && !isCtrl) { // SHIFT-TAB (go to nick list)
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_LIST));
- return TRUE;
- }
-
- if (wParam == VK_TAB && isCtrl && !isShift) { // CTRL-TAB (switch tab/window)
- if (g_Settings.bTabsEnable)
- SendMessage(GetParent(hwnd), GC_SWITCHNEXTTAB, 0, 0);
- else
- pci->ShowRoom(SM_GetNextWindow(Parentsi), WINDOW_VISIBLE, TRUE);
- return TRUE;
- }
-
- if (wParam == VK_TAB && isCtrl && isShift) { // CTRL_SHIFT-TAB (switch tab/window)
- if (g_Settings.bTabsEnable)
- SendMessage(GetParent(hwnd), GC_SWITCHPREVTAB, 0, 0);
- else
- pci->ShowRoom(SM_GetPrevWindow(Parentsi), WINDOW_VISIBLE, TRUE);
- return TRUE;
- }
-
- if (wParam <= '9' && wParam >= '1' && isCtrl && !isAlt) // CTRL + 1 -> 9 (switch tab)
- if (g_Settings.bTabsEnable)
- SendMessage(GetParent(hwnd), GC_SWITCHTAB, 0, (int)wParam - (int)'1');
-
- if (wParam <= VK_NUMPAD9 && wParam >= VK_NUMPAD1 && isCtrl && !isAlt) // CTRL + 1 -> 9 (switch tab)
- if (g_Settings.bTabsEnable)
- SendMessage(GetParent(hwnd), GC_SWITCHTAB, 0, (int)wParam - (int)VK_NUMPAD1);
-
- if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
- wchar_t* pszText = NULL;
- LRESULT lResult = (LRESULT)SendMessage(hwnd, EM_GETSEL, 0, 0);
-
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- start = LOWORD(lResult);
- end = HIWORD(lResult);
- SendMessage(hwnd, EM_SETSEL, end, end);
-
- GETTEXTLENGTHEX gtl = { 0 };
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- if (iLen > 0) {
- pszText = (wchar_t *)mir_alloc(sizeof(wchar_t)*(iLen + 100));
-
- GETTEXTEX gt = { 0 };
- gt.cb = iLen + 99;
- gt.flags = GT_DEFAULT;
- gt.codepage = 1200;
-
- SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)pszText);
- while (start > 0 && pszText[start - 1] != ' ' && pszText[start - 1] != 13 && pszText[start - 1] != VK_TAB)
- start--;
- while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end - 1] != VK_TAB)
- end++;
-
- if (dat->szTabSave[0] == '\0')
- mir_wstrncpy(dat->szTabSave, pszText + start, end - start + 1);
-
- wchar_t *pszSelName = (wchar_t *)mir_alloc(sizeof(wchar_t)*(end - start + 1));
- mir_wstrncpy(pszSelName, pszText + start, end - start + 1);
-
- wchar_t *pszName = pci->UM_FindUserAutoComplete(Parentsi->pUsers, dat->szTabSave, pszSelName);
- if (pszName == NULL) {
- pszName = dat->szTabSave;
- SendMessage(hwnd, EM_SETSEL, start, end);
- if (end != start)
- SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)pszName);
- dat->szTabSave[0] = '\0';
- }
- else {
- SendMessage(hwnd, EM_SETSEL, start, end);
- if (end != start)
- SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)pszName);
- }
- mir_free(pszText);
- mir_free(pszSelName);
- }
-
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- return 0;
- }
-
- if (dat->szTabSave[0] != '\0' && wParam != VK_RIGHT && wParam != VK_LEFT && wParam != VK_SPACE && wParam != VK_RETURN && wParam != VK_BACK && wParam != VK_DELETE) {
- if (g_Settings.bAddColonToAutoComplete && start == 0)
- SendMessageA(hwnd, EM_REPLACESEL, FALSE, (LPARAM) ": ");
-
- dat->szTabSave[0] = '\0';
- }
-
- if (wParam == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab)
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CLOSE, BN_CLICKED), 0);
- return TRUE;
- }
-
- if (wParam == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics)
- CheckDlgButton(GetParent(hwnd), IDC_ITALICS, IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x42 && isCtrl && !isAlt) { // ctrl-b (bold)
- CheckDlgButton(GetParent(hwnd), IDC_BOLD, IsDlgButtonChecked(GetParent(hwnd), IDC_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x55 && isCtrl && !isAlt) { // ctrl-u (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, IsDlgButtonChecked(GetParent(hwnd), IDC_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4b && isCtrl && !isAlt) { // ctrl-k (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_COLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
- return TRUE;
- }
-
- if (wParam == VK_SPACE && isCtrl && !isAlt) { // ctrl-space (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_COLOR, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_BOLD, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_ITALICS, BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4c && isCtrl && !isAlt) { // ctrl-l (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (paste clean text)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_FILTER)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_FILTER, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4e && isCtrl && !isAlt) { // ctrl-n (nicklist)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_SHOWNICKLIST)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x48 && isCtrl && !isAlt) { // ctrl-h (history)
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_HISTORY, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4f && isCtrl && !isAlt) { // ctrl-o (options)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHANMGR)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, 0), 0);
- return TRUE;
- }
-
- if ((wParam == 45 && isShift || wParam == 0x56 && isCtrl) && !isAlt) { // ctrl-v (paste clean text)
- SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
- return TRUE;
- }
-
- if (wParam == 0x57 && isCtrl && !isAlt) { // ctrl-w (close window)
- PostMessage(GetParent(hwnd), WM_CLOSE, 0, 0);
- return TRUE;
- }
-
- if (wParam == VK_NEXT || wParam == VK_PRIOR) {
- HWND htemp = GetParent(hwnd);
- SendDlgItemMessage(htemp, IDC_LOG, msg, wParam, lParam);
- dat->lastEnterTime = 0;
- return TRUE;
- }
-
- if (wParam == VK_UP && isCtrl && !isAlt) {
- char* lpPrevCmd = pci->SM_GetPrevCommand(Parentsi->ptszID, Parentsi->pszModule);
-
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
-
- if (lpPrevCmd) {
- SETTEXTEX ste;
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- }
- else SetWindowText(hwnd, L"");
-
- GETTEXTLENGTHEX gtl = { 0 };
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- SendMessage(hwnd, EM_SETSEL, iLen, iLen);
- dat->lastEnterTime = 0;
- return TRUE;
- }
-
- if (wParam == VK_DOWN && isCtrl && !isAlt) {
- char* lpPrevCmd = pci->SM_GetNextCommand(Parentsi->ptszID, Parentsi->pszModule);
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
-
- if (lpPrevCmd) {
- SETTEXTEX ste;
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- }
- else SetWindowText(hwnd, L"");
-
- GETTEXTLENGTHEX gtl = { 0 };
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- SendMessage(hwnd, EM_SETSEL, iLen, iLen);
- dat->lastEnterTime = 0;
- return TRUE;
- }
- }
- //fall through
-
- case WM_LBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_KILLFOCUS:
- dat->lastEnterTime = 0;
- break;
-
- case WM_RBUTTONDOWN:
- {
- CHARRANGE sel, all = { 0, -1 };
- HMENU hSubMenu = GetSubMenu(g_hMenu, 4);
- TranslateMenu(hSubMenu);
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
-
- EnableMenuItem(hSubMenu, ID_MESSAGE_UNDO, SendMessage(hwnd, EM_CANUNDO, 0, 0) ? MF_ENABLED : MF_GRAYED);
- EnableMenuItem(hSubMenu, ID_MESSAGE_REDO, SendMessage(hwnd, EM_CANREDO, 0, 0) ? MF_ENABLED : MF_GRAYED);
- EnableMenuItem(hSubMenu, ID_MESSAGE_COPY, sel.cpMax != sel.cpMin ? MF_ENABLED : MF_GRAYED);
- EnableMenuItem(hSubMenu, ID_MESSAGE_CUT, sel.cpMax != sel.cpMin ? MF_ENABLED : MF_GRAYED);
-
- dat->lastEnterTime = 0;
-
- POINT pt;
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwnd, &pt);
-
- UINT uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
- switch (uID) {
- case 0:
- break;
-
- case ID_MESSAGE_UNDO:
- SendMessage(hwnd, EM_UNDO, 0, 0);
- break;
-
- case ID_MESSAGE_REDO:
- SendMessage(hwnd, EM_REDO, 0, 0);
- break;
-
- case ID_MESSAGE_COPY:
- SendMessage(hwnd, WM_COPY, 0, 0);
- break;
-
- case ID_MESSAGE_CUT:
- SendMessage(hwnd, WM_CUT, 0, 0);
- break;
-
- case ID_MESSAGE_PASTE:
- SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
- break;
-
- case ID_MESSAGE_SELECTALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all);
- break;
-
- case ID_MESSAGE_CLEAR:
- SetWindowText(hwnd, L"");
- break;
- }
- PostMessage(hwnd, WM_KEYUP, 0, 0);
- }
- break;
-
- case WM_KEYUP:
- case WM_LBUTTONUP:
- case WM_RBUTTONUP:
- case WM_MBUTTONUP:
- {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR;
- SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
-
- MODULEINFO *pmi = pci->MM_FindModule(Parentsi->pszModule);
- if (pmi && pmi->bColor) {
- int index = GetColorIndex(Parentsi->pszModule, cf.crTextColor);
- UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
-
- if (index >= 0) {
- Parentsi->bFGSet = TRUE;
- Parentsi->iFG = index;
- }
-
- if (u == BST_UNCHECKED && cf.crTextColor != g_Settings.MessageAreaColor)
- CheckDlgButton(GetParent(hwnd), IDC_COLOR, BST_CHECKED);
- else if (u == BST_CHECKED && cf.crTextColor == g_Settings.MessageAreaColor)
- CheckDlgButton(GetParent(hwnd), IDC_COLOR, BST_UNCHECKED);
- }
-
- if (pmi && pmi->bBkgColor) {
- int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
- COLORREF crB = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR);
-
- if (index >= 0) {
- Parentsi->bBGSet = TRUE;
- Parentsi->iBG = index;
- }
- if (u == BST_UNCHECKED && cf.crBackColor != crB)
- CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, BST_CHECKED);
- else if (u == BST_CHECKED && cf.crBackColor == crB)
- CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, BST_UNCHECKED);
- }
-
- if (pmi && pmi->bBold) {
- UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_BOLD);
- UINT u2 = cf.dwEffects;
- u2 &= CFE_BOLD;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(GetParent(hwnd), IDC_BOLD, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(GetParent(hwnd), IDC_BOLD, BST_UNCHECKED);
- }
-
- if (pmi && pmi->bItalics) {
- UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS);
- UINT u2 = cf.dwEffects;
- u2 &= CFE_ITALIC;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(GetParent(hwnd), IDC_ITALICS, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(GetParent(hwnd), IDC_ITALICS, BST_UNCHECKED);
- }
-
- if (pmi && pmi->bUnderline) {
- UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_UNDERLINE);
- UINT u2 = cf.dwEffects;
- u2 &= CFE_UNDERLINE;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, BST_UNCHECKED);
- }
- }
- break;
-
- case WM_DESTROY:
- mir_free(dat);
- return 0;
- }
-
- return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
-}
-
-static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- static SESSION_INFO *si = NULL;
- switch (uMsg) {
- case WM_INITDIALOG:
- si = (SESSION_INFO*)lParam;
- CheckDlgButton(hwndDlg, IDC_1, si->iLogFilterFlags & GC_EVENT_ACTION ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_2, si->iLogFilterFlags & GC_EVENT_MESSAGE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_3, si->iLogFilterFlags & GC_EVENT_NICK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_4, si->iLogFilterFlags & GC_EVENT_JOIN ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_5, si->iLogFilterFlags & GC_EVENT_PART ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_6, si->iLogFilterFlags & GC_EVENT_TOPIC ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_7, si->iLogFilterFlags & GC_EVENT_ADDSTATUS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_8, si->iLogFilterFlags & GC_EVENT_INFORMATION ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_9, si->iLogFilterFlags & GC_EVENT_QUIT ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_10, si->iLogFilterFlags & GC_EVENT_KICK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_11, si->iLogFilterFlags & GC_EVENT_NOTICE ? BST_CHECKED : BST_UNCHECKED);
- break;
-
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORSTATIC:
- SetTextColor((HDC)wParam, RGB(60, 60, 150));
- SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
- return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
-
- case WM_ACTIVATE:
- if (LOWORD(wParam) == WA_INACTIVE) {
- int iFlags = 0;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_1) == BST_CHECKED)
- iFlags |= GC_EVENT_ACTION;
- if (IsDlgButtonChecked(hwndDlg, IDC_2) == BST_CHECKED)
- iFlags |= GC_EVENT_MESSAGE;
- if (IsDlgButtonChecked(hwndDlg, IDC_3) == BST_CHECKED)
- iFlags |= GC_EVENT_NICK;
- if (IsDlgButtonChecked(hwndDlg, IDC_4) == BST_CHECKED)
- iFlags |= GC_EVENT_JOIN;
- if (IsDlgButtonChecked(hwndDlg, IDC_5) == BST_CHECKED)
- iFlags |= GC_EVENT_PART;
- if (IsDlgButtonChecked(hwndDlg, IDC_6) == BST_CHECKED)
- iFlags |= GC_EVENT_TOPIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_7) == BST_CHECKED)
- iFlags |= GC_EVENT_ADDSTATUS;
- if (IsDlgButtonChecked(hwndDlg, IDC_8) == BST_CHECKED)
- iFlags |= GC_EVENT_INFORMATION;
- if (IsDlgButtonChecked(hwndDlg, IDC_9) == BST_CHECKED)
- iFlags |= GC_EVENT_QUIT;
- if (IsDlgButtonChecked(hwndDlg, IDC_10) == BST_CHECKED)
- iFlags |= GC_EVENT_KICK;
- if (IsDlgButtonChecked(hwndDlg, IDC_11) == BST_CHECKED)
- iFlags |= GC_EVENT_NOTICE;
-
- if (iFlags&GC_EVENT_ADDSTATUS)
- iFlags |= GC_EVENT_REMOVESTATUS;
-
- SendMessage(GetParent(hwndDlg), GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags);
- if (si->bFilterEnabled)
- SendMessage(GetParent(hwndDlg), GC_REDRAWLOG, 0, 0);
- PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- }
- break;
-
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
- }
-
- return(FALSE);
-}
-
-static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_RBUTTONUP:
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) != 0) {
- if (GetDlgItem(GetParent(hwnd), IDC_FILTER) == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
- if (GetDlgItem(GetParent(hwnd), IDC_COLOR) == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
- if (GetDlgItem(GetParent(hwnd), IDC_BKGCOLOR) == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
- }
- break;
- }
-
- return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
-}
-
-static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_LBUTTONUP:
- {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax) {
- SendMessage(hwnd, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
- }
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_MESSAGE));
- }
- break;
- case WM_KEYDOWN:
- if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window)
- PostMessage(GetParent(hwnd), WM_CLOSE, 0, 0);
- return TRUE;
- }
- break;
-
- case WM_ACTIVATE:
- if (LOWORD(wParam) == WA_INACTIVE) {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax) {
- sel.cpMin = sel.cpMax;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
- }
- }
- break;
-
- case WM_CHAR:
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_MESSAGE));
- SendDlgItemMessage(GetParent(hwnd), IDC_MESSAGE, WM_CHAR, wParam, lParam);
- break;
- }
-
- return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
-}
-
-static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static BOOL bDragging = FALSE;
- static int iBeginIndex = 0;
- switch (msg) {
- case WM_LBUTTONDOWN:
- {
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1) {
- TCITEM tc;
- SESSION_INFO *s = NULL;
-
- tc.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwnd, i, &tc);
- s = (SESSION_INFO*)tc.lParam;
- if (s) {
- BOOL bOnline = db_get_w(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE ? TRUE : FALSE;
- MODULEINFO *mi = pci->MM_FindModule(s->pszModule);
- bDragging = TRUE;
- iBeginIndex = i;
- ImageList_BeginDrag(hIconsList, bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
- SetCapture(hwnd);
- }
- return TRUE;
- }
- }
- else PostMessage(GetParent(hwnd), GC_TABCLICKED, 0, 0);
- }
- break;
-
- case WM_CAPTURECHANGED:
- bDragging = FALSE;
- ImageList_DragLeave(hwnd);
- ImageList_EndDrag();
- break;
-
- case WM_MOUSEMOVE:
- if (bDragging) {
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(hwnd, &tci.pt);
- ImageList_DragMove(tci.pt.x, tci.pt.y);
- }
- break;
-
- case WM_LBUTTONUP:
- if (bDragging && ReleaseCapture()) {
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- tci.flags = TCHT_ONITEM;
- bDragging = FALSE;
- ImageList_DragLeave(hwnd);
- ImageList_EndDrag();
-
- ScreenToClient(hwnd, &tci.pt);
- int i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1 && i != iBeginIndex)
- SendMessage(GetParent(hwnd), GC_DROPPEDTAB, (WPARAM)i, (LPARAM)iBeginIndex);
- }
- break;
-
- case WM_LBUTTONDBLCLK:
- {
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- int i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1 && g_Settings.TabCloseOnDblClick)
- PostMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CLOSE, BN_CLICKED), 0);
- }
- break;
-
- case WM_MBUTTONUP:
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- int i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1) {
- TCITEM tc;
- tc.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwnd, i, &tc);
- SESSION_INFO *si = (SESSION_INFO*)tc.lParam;
- if (si)
- SendMessage(GetParent(hwnd), GC_REMOVETAB, 1, (LPARAM)si);
- }
- break;
- }
-
- return mir_callNextSubclass(hwnd, TabSubclassProc, msg, wParam, lParam);
-}
-
-static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *si)
-{
- static int currentHovered = -1;
- static HWND hwndToolTip = NULL;
- static HWND oldParent = NULL;
-
- if (hoveredItem == currentHovered)
- return;
-
- currentHovered = hoveredItem;
-
- if (oldParent != hwnd && hwndToolTip) {
- SendMessage(hwndToolTip, TTM_DELTOOL, 0, 0);
- DestroyWindow(hwndToolTip);
- hwndToolTip = NULL;
- }
- if (hoveredItem == -1) {
- SendMessage(hwndToolTip, TTM_ACTIVATE, 0, 0);
- return;
- }
-
- BOOL bNewTip = FALSE;
- if (!hwndToolTip) {
- hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hwnd, NULL, g_hInst, NULL);
- bNewTip = TRUE;
- }
-
- RECT clientRect;
- GetClientRect(hwnd, &clientRect);
- TOOLINFO ti = { sizeof(TOOLINFO) };
- ti.uFlags = TTF_SUBCLASS;
- ti.hinst = g_hInst;
- ti.hwnd = hwnd;
- ti.uId = 1;
- ti.rect = clientRect;
-
- wchar_t tszBuf[1024]; tszBuf[0] = 0;
- USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, currentHovered);
- if (ui) {
- if (ProtoServiceExists(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
- wchar_t *p = (wchar_t*)CallProtoService(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)si->ptszID, (LPARAM)ui->pszUID);
- if (p != NULL) {
- wcsncpy_s(tszBuf, p, _TRUNCATE);
- mir_free(p);
- }
- }
-
- if (tszBuf[0] == 0)
- mir_snwprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
- TranslateT("Nickname"), ui->pszNick,
- TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), pci->TM_WordToString(si->pStatuses, ui->Status));
-
- ti.lpszText = tszBuf;
- }
-
- SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
- SendMessage(hwndToolTip, TTM_ACTIVATE, ti.lpszText != NULL, 0);
- SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 400);
-}
-
-static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
-
- switch (msg) {
- case WM_ERASEBKGND:
- {
- HDC dc = (HDC)wParam;
- if (dc == NULL)
- return 0;
-
- int index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
- if (index == LB_ERR || si->nUsersInNicklist <= 0)
- return 0;
-
- int height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- if (height == LB_ERR)
- return 0;
-
- RECT rc = { 0 };
- GetClientRect(hwnd, &rc);
-
- int items = si->nUsersInNicklist - index;
- if (rc.bottom - rc.top > items * height) {
- rc.top = items * height;
- FillRect(dc, &rc, pci->hListBkgBrush);
- }
- }
- return 1;
-
- case WM_KEYDOWN:
- if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window)
- PostMessage(GetParent(hwnd), WM_CLOSE, 0, 0);
- return TRUE;
- }
- break;
-
- case WM_RBUTTONDOWN:
- SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
- break;
-
- case WM_RBUTTONUP:
- SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
- break;
-
- case WM_MEASUREITEM:
- {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
- if (mis->CtlType == ODT_MENU)
- return Menu_MeasureItem(lParam);
- }
- return FALSE;
-
- case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->CtlType == ODT_MENU)
- return Menu_DrawItem(lParam);
- }
- return FALSE;
-
- case WM_CONTEXTMENU:
- TVHITTESTINFO hti;
- {
- int height = 0;
- hti.pt.x = GET_X_LPARAM(lParam);
- hti.pt.y = GET_Y_LPARAM(lParam);
- if (hti.pt.x == -1 && hti.pt.y == -1) {
- int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
- int top = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
- height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- hti.pt.x = 4;
- hti.pt.y = (index - top)*height + 1;
- }
- else ScreenToClient(hwnd, &hti.pt);
-
- int item = LOWORD(SendDlgItemMessage(GetParent(hwnd), IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, item);
- if (ui) {
- USERINFO uinew;
- memcpy(&uinew, ui, sizeof(USERINFO));
- if (hti.pt.x == -1 && hti.pt.y == -1)
- hti.pt.y += height - 4;
- ClientToScreen(hwnd, &hti.pt);
-
- HMENU hMenu = 0;
- UINT uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, si, uinew.pszUID, uinew.pszNick);
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
-
- default:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
- }
- DestroyGCMenu(&hMenu, 1);
- return TRUE;
- }
- }
- break;
-
- case WM_MOUSEMOVE:
- POINT pt = { LOWORD(lParam), HIWORD(lParam) };
- RECT clientRect;
- GetClientRect(hwnd, &clientRect);
- BOOL bInClient = PtInRect(&clientRect, pt);
- // Mouse capturing/releasing
- if (bInClient && GetCapture() != hwnd)
- SetCapture(hwnd);
- else if (!bInClient)
- ReleaseCapture();
-
- if (bInClient) {
- // hit test item under mouse
- DWORD nItemUnderMouse = (DWORD)SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
- if (HIWORD(nItemUnderMouse) == 1)
- nItemUnderMouse = (DWORD)(-1);
- else
- nItemUnderMouse &= 0xFFFF;
-
- ProcessNickListHovering(hwnd, (int)nItemUnderMouse, si);
- }
- else ProcessNickListHovering(hwnd, -1, NULL);
- break;
- }
-
- return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
-}
-
-static int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, char * szModule, char * szNamePrefix, UINT showCmd)
-{
- WINDOWPLACEMENT wp;
- wp.length = sizeof(wp);
- GetWindowPlacement(hwnd, &wp);
-
- char szSettingName[64];
- mir_snprintf(szSettingName, "%sx", szNamePrefix);
- int x = db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, "%sy", szNamePrefix);
- int y = (int)db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, "%swidth", szNamePrefix);
- int width = db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, "%sheight", szNamePrefix);
- int height = db_get_dw(hContact, szModule, szSettingName, -1);
-
- if (x == -1)
- return 0;
-
- wp.rcNormalPosition.left = x;
- wp.rcNormalPosition.top = y;
- wp.rcNormalPosition.right = wp.rcNormalPosition.left + width;
- wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + height;
- wp.showCmd = showCmd;
- SetWindowPlacement(hwnd, &wp);
- return 1;
-}
-
-int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth)
-{
- if (!pszText || !hFont)
- return 0;
-
- HDC hdc = GetDC(NULL);
- HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
- RECT rc = { 0 };
- DrawText(hdc, pszText, -1, &rc, DT_CALCRECT);
- SelectObject(hdc, hOldFont);
- ReleaseDC(NULL, hdc);
- return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
-}
-
-static void __cdecl phase2(void * lParam)
-{
- SESSION_INFO *si = (SESSION_INFO*)lParam;
- Sleep(30);
- if (si && si->hWnd)
- PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
-}
-
-INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- RECT rc;
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- HWND hNickList = GetDlgItem(hwndDlg, IDC_LIST);
- si = (SESSION_INFO*)lParam;
- si->pAccPropServicesForNickList = NULL;
- CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, IID_IAccPropServices, (LPVOID *)si->pAccPropServicesForNickList);
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
- mir_subclassWindow(hNickList, NicklistSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_TAB), TabSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_LOG), LogSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_FILTER), ButtonSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_COLOR), ButtonSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), ButtonSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageSubclassProc);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SUBCLASSED, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, 1, 0);
- int mask = (int)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETEVENTMASK, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM)sizeof(wchar_t) * 0x7FFFFFFF, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback);
-
- si->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP | SBT_TOOLTIPS, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
- SendMessage(si->hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
- TabCtrl_SetMinTabWidth(GetDlgItem(hwndDlg, IDC_TAB), 80);
- TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TAB), hIconsList);
-
- // restore previous tabs
- if (g_Settings.bTabsEnable && g_Settings.TabRestore) {
- TABLIST *node = g_TabList;
- while (node) {
- SESSION_INFO *s = pci->SM_FindSession(node->pszID, node->pszModule);
- if (s)
- SendMessage(hwndDlg, GC_ADDTAB, -1, (LPARAM)s);
-
- node = node->next;
- }
- }
-
- TabM_RemoveAll();
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_SMILEY), TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0);
-
- SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0);
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0);
- SendMessage(hwndDlg, GC_SETWINDOWPOS, 0, 0);
- }
- break;
-
- case GC_SETWNDPROPS:
- {
- // LoadGlobalSettings(); !!!!!!!!!!!!!!!!!!!!!!
- InitButtons(hwndDlg, si);
-
- // stupid hack to make icons show. I dunno why this is needed currently
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- HICON hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
- if (!hIcon) {
- pci->MM_IconsChanged();
- hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
- }
-
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
- SendMessage(si->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon);
- Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("window"));
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground);
-
- if (g_Settings.bTabsEnable) {
- LONG_PTR mask = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TAB), GWL_STYLE);
- if (g_Settings.TabsAtBottom)
- mask |= TCS_BOTTOM;
- else
- mask &= ~TCS_BOTTOM;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TAB), GWL_STYLE, (LONG_PTR)mask);
- }
- {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR;
- cf.dwEffects = 0;
- cf.crTextColor = g_Settings.MessageAreaColor;
- cf.crBackColor = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)g_Settings.MessageAreaFont, MAKELPARAM(TRUE, 0));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&cf);
-
- // nicklist
- int ih = GetTextPixelSize(L"AQGglo", g_Settings.UserListFont, FALSE);
- int ih2 = GetTextPixelSize(L"AQGglo", g_Settings.UserListHeadingsFont, FALSE);
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
- int font = ih > ih2 ? ih : ih2;
-
- // make sure we have space for icon!
- if (g_Settings.bShowContactStatus)
- font = font > 16 ? font : 16;
-
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE);
- }
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
- }
- break;
-
- case GC_UPDATETITLE:
- {
- wchar_t szTemp[100];
- switch (si->iType) {
- case GCW_CHATROOM:
- mir_snwprintf(szTemp,
- (si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_PRIVMESS:
- mir_snwprintf(szTemp,
- (si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_snwprintf(szTemp, L"%s: Server", si->ptszName);
- break;
- }
- SetWindowText(hwndDlg, szTemp);
- }
- break;
-
- case GC_UPDATESTATUSBAR:
- {
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- wchar_t* ptszDispName = mi->ptszModDispName;
- int x = 12;
- x += GetTextPixelSize(ptszDispName, (HFONT)SendMessage(si->hwndStatus, WM_GETFONT, 0, 0), TRUE);
- x += GetSystemMetrics(SM_CXSMICON);
- int iStatusbarParts[2] = { x, -1 };
- SendMessage(si->hwndStatus, SB_SETPARTS, 2, (LPARAM)&iStatusbarParts);
-
- // stupid hack to make icons show. I dunno why this is needed currently
- HICON hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
- if (!hIcon) {
- pci->MM_IconsChanged();
- hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
- }
-
- SendMessage(si->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon);
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
-
- SendMessage(si->hwndStatus, SB_SETTEXT, 0, (LPARAM)ptszDispName);
-
- SendMessage(si->hwndStatus, SB_SETTEXT, 1, (LPARAM)(si->ptszStatusbarText ? si->ptszStatusbarText : L""));
- SendMessage(si->hwndStatus, SB_SETTIPTEXT, 1, (LPARAM)(si->ptszStatusbarText ? si->ptszStatusbarText : L""));
- }
- return TRUE;
-
- case GC_SETWINDOWPOS:
- {
- SESSION_INFO *pActive = pci->GetActiveSession();
- RECT screen;
- int savePerContact = db_get_b(NULL, CHAT_MODULE, "SavePosition", 0);
-
- WINDOWPLACEMENT wp;
- wp.length = sizeof(wp);
- GetWindowPlacement(hwndDlg, &wp);
- SystemParametersInfo(SPI_GETWORKAREA, 0, &screen, 0);
-
- if (si->iX) {
- wp.rcNormalPosition.left = si->iX;
- wp.rcNormalPosition.top = si->iY;
- wp.rcNormalPosition.right = wp.rcNormalPosition.left + si->iWidth;
- wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + si->iHeight;
- wp.showCmd = SW_HIDE;
- SetWindowPlacement(hwndDlg, &wp);
- break;
- }
- if (savePerContact) {
- if (RestoreWindowPosition(hwndDlg, g_Settings.bTabsEnable ? NULL : si->hContact, CHAT_MODULE, "room", SW_HIDE))
- break;
- SetWindowPos(hwndDlg, 0, (screen.right - screen.left) / 2 - (550) / 2, (screen.bottom - screen.top) / 2 - (400) / 2, (550), (400), SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
- }
- else SetWindowPos(hwndDlg, 0, (screen.right - screen.left) / 2 - (550) / 2, (screen.bottom - screen.top) / 2 - (400) / 2, (550), (400), SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
-
- if (!g_Settings.bTabsEnable && pActive && pActive->hWnd && db_get_b(NULL, CHAT_MODULE, "CascadeWindows", 1)) {
- RECT rcThis, rcNew;
- int dwFlag = SWP_NOZORDER | SWP_NOACTIVATE;
- if (!IsWindowVisible((HWND)wParam))
- dwFlag |= SWP_HIDEWINDOW;
-
- GetWindowRect(hwndDlg, &rcThis);
- GetWindowRect(pActive->hWnd, &rcNew);
-
- int offset = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME);
- SetWindowPos((HWND)hwndDlg, 0, rcNew.left + offset, rcNew.top + offset, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, dwFlag);
- }
- }
- break;
-
- case GC_SAVEWNDPOS:
- {
- WINDOWPLACEMENT wp = { 0 };
- wp.length = sizeof(wp);
- GetWindowPlacement(hwndDlg, &wp);
-
- g_Settings.iX = wp.rcNormalPosition.left;
- g_Settings.iY = wp.rcNormalPosition.top;
- g_Settings.iWidth = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
- g_Settings.iHeight = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
-
- if (!lParam) {
- si->iX = g_Settings.iX;
- si->iY = g_Settings.iY;
- si->iWidth = g_Settings.iWidth;
- si->iHeight = g_Settings.iHeight;
- }
- }
- break;
-
- case WM_SIZE:
- if (wParam == SIZE_MAXIMIZED)
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
-
- if (!IsIconic(hwndDlg)) {
- SendMessage(si->hwndStatus, WM_SIZE, 0, 0);
-
- Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si);
-
- InvalidateRect(si->hwndStatus, NULL, TRUE);
- RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(hwndDlg, IDOK), NULL, NULL, RDW_INVALIDATE);
- SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 1);
- }
- break;
-
- case GC_REDRAWWINDOW:
- InvalidateRect(hwndDlg, NULL, TRUE);
- break;
-
- case GC_REDRAWLOG:
- si->LastTime = 0;
- if (si->pLog) {
- LOGINFO * pLog = si->pLog;
- if (si->iEventCount > 60) {
- int index = 0;
- while (index < 59) {
- if (pLog->next == NULL)
- break;
-
- pLog = pLog->next;
- if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
- index++;
- }
- Log_StreamInEvent(hwndDlg, pLog, si, TRUE, FALSE);
- mir_forkthread(phase2, si);
- }
- else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
- }
- else SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
- break;
-
- case GC_REDRAWLOG2:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
- break;
-
- case GC_REDRAWLOG3:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, TRUE);
- break;
-
- case GC_ADDLOG:
- if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
- else
- SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
- break;
-
- case GC_SWITCHNEXTTAB:
- {
- int total = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- int i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- if (i != -1 && total != -1 && total != 1) {
- if (i < total - 1)
- i++;
- else
- i = 0;
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), i);
- PostMessage(hwndDlg, GC_TABCLICKED, 0, 0);
- }
- }
- break;
-
- case GC_SWITCHPREVTAB:
- {
- int total = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- int i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- if (i != -1 && total != -1 && total != 1) {
- if (i > 0)
- i--;
- else
- i = total - 1;
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), i);
- PostMessage(hwndDlg, GC_TABCLICKED, 0, 0);
- }
- }
- break;
-
- case GC_SWITCHTAB:
- {
- int total = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- int i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- if (i != -1 && total != -1 && total != 1 && i != lParam && total > lParam) {
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), lParam);
- PostMessage(hwndDlg, GC_TABCLICKED, 0, 0);
- }
- }
- break;
-
- case GC_REMOVETAB:
- {
- SESSION_INFO* s2;
- int i = -1;
- SESSION_INFO* s1 = (SESSION_INFO*)lParam;
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
-
- if (s1) {
- if (tabId) {
- for (i = 0; i < tabId; i++) {
- int ii;
- TCITEM tci = { 0 };
- tci.mask = TCIF_PARAM;
- ii = TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- if (ii != -1) {
- s2 = (SESSION_INFO*)tci.lParam;
- if (s1 == s2)
- goto END_REMOVETAB;
- }
- }
- }
- }
- else i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
-
- END_REMOVETAB:
- if (i != -1 && i < tabId) {
- TCITEM id = { 0 };
- SESSION_INFO *s;
- TabCtrl_DeleteItem(GetDlgItem(hwndDlg, IDC_TAB), i);
- id.mask = TCIF_PARAM;
- if (!TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id)) {
- if (!TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i - 1, &id)) {
- SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
- }
- }
-
- s = (SESSION_INFO*)id.lParam;
- if (s)
- pci->ShowRoom(s, (WPARAM)WINDOW_VISIBLE, wParam == 1 ? FALSE : TRUE);
- }
- }
- break;
-
- case GC_ADDTAB:
- {
- TCITEM tci;
- int tabId;
- WORD w = 0;
- int i = 0;
- int indexfound = -1;
- int lastlocked = -1;
- BOOL bFound = FALSE;
- SESSION_INFO* s2;
- SESSION_INFO* s1 = (SESSION_INFO*)lParam;
-
- tci.mask = TCIF_PARAM;
- tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
-
- // does the tab already exist?
- for (i = 0; i < tabId; i++) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- s2 = (SESSION_INFO*)tci.lParam;
- if (s2) {
- if (s1 == s2 && !bFound) {
- if (!bFound) {
- bFound = TRUE;
- indexfound = i;
- }
- }
-
- w = db_get_w(s2->hContact, s2->pszModule, "TabPosition", 0);
- if (w)
- lastlocked = (int)w;
- }
- }
-
- w = 0;
-
- if (!bFound) { // create a new tab
- int insertat;
- wchar_t szTemp[30];
-
- mir_wstrncpy(szTemp, s1->ptszName, 21);
- if (mir_wstrlen(s1->ptszName) > 20)
- mir_wstrncpy(szTemp + 20, L"...", 4);
-
- tci.mask = TCIF_TEXT | TCIF_PARAM;
- tci.pszText = szTemp;
- tci.lParam = lParam;
-
- // determine insert position
- w = db_get_w(s1->hContact, s1->pszModule, "TabPosition", 0);
- if (wParam == -1)
- insertat = w == 0 ? tabId : (int)w - 1;
- else
- insertat = (int)wParam;
-
- w = TabCtrl_InsertItem(GetDlgItem(hwndDlg, IDC_TAB), insertat, &tci);
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s1);
- }
-
- if (wParam == -1) {
- if (bFound)
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), indexfound);
- else
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), w);
- }
- }
- break;
-
- case GC_FIXTABICONS:
- {
- SESSION_INFO *s = (SESSION_INFO*)lParam;
- if (s) {
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- for (int i = 0; i < tabId; i++) {
- TCITEM tci;
- tci.mask = TCIF_PARAM | TCIF_IMAGE;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- SESSION_INFO *s2 = (SESSION_INFO*)tci.lParam;
- if (s2 && s == s2) {
- int image = 0;
- if (!(s2->wState & GC_EVENT_HIGHLIGHT)) {
- MODULEINFO *mi = pci->MM_FindModule(s2->pszModule);
- image = (s2->wStatus == ID_STATUS_ONLINE) ? mi->OnlineIconIndex : mi->OfflineIconIndex;
- if (s2->wState & STATE_TALK)
- image++;
- }
-
- if (tci.iImage != image) {
- tci.mask = TCIF_IMAGE;
- tci.iImage = image;
- TabCtrl_SetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- }
- }
- }
- }
- else RedrawWindow(GetDlgItem(hwndDlg, IDC_TAB), NULL, NULL, RDW_INVALIDATE);
- }
- break;
-
- case GC_SETMESSAGEHIGHLIGHT:
- {
- SESSION_INFO *s = (SESSION_INFO*)lParam;
- if (s) {
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- for (int i = 0; i < tabId; i++) {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- SESSION_INFO *s2 = (SESSION_INFO*)tci.lParam;
- if (s2 && s == s2) { // highlight
- s2->wState |= GC_EVENT_HIGHLIGHT;
- if (pci->SM_FindSession(si->ptszID, si->pszModule) == s2)
- si->wState = s2->wState;
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s2);
- if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg)
- SetTimer(hwndDlg, TIMERID_FLASHWND, 900, NULL);
- break;
- }
- }
- }
- else RedrawWindow(GetDlgItem(hwndDlg, IDC_TAB), NULL, NULL, RDW_INVALIDATE);
- }
- break;
-
- case GC_SETTABHIGHLIGHT:
- {
- SESSION_INFO *s = (SESSION_INFO*)lParam;
- if (s) {
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- for (int i = 0; i < tabId; i++) {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- SESSION_INFO *s2 = (SESSION_INFO*)tci.lParam;
- if (s2 && s == s2) { // highlight
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s2);
- if (g_Settings.bFlashWindow && GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg)
- SetTimer(hwndDlg, TIMERID_FLASHWND, 900, NULL);
- break;
- }
- }
- }
- else RedrawWindow(GetDlgItem(hwndDlg, IDC_TAB), NULL, NULL, RDW_INVALIDATE);
- }
- break;
-
- case GC_TABCHANGE:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- break;
-
- case GC_TABCLICKED:
- {
- int i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- if (i != -1) {
- TCITEM id = { 0 };
- id.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
- if (s) {
- if (s->wState & STATE_TALK) {
- s->wState &= ~STATE_TALK;
- db_set_w(s->hContact, s->pszModule, "ApparentMode", (LPARAM)0);
- }
-
- if (s->wState & GC_EVENT_HIGHLIGHT) {
- s->wState &= ~GC_EVENT_HIGHLIGHT;
-
- if (pcli->pfnGetEvent(s->hContact, 0))
- pcli->pfnRemoveEvent(s->hContact, GC_FAKE_EVENT);
- }
-
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s);
- if (!s->hWnd) {
- pci->ShowRoom(s, (WPARAM)WINDOW_VISIBLE, TRUE);
- SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- }
- }
- }
- break;
-
- case GC_DROPPEDTAB:
- {
- int begin = (int)lParam;
- int end = (int)wParam;
- if (begin == end)
- break;
-
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), begin, &tci);
- SESSION_INFO *s = (SESSION_INFO*)tci.lParam;
- if (s) {
- TabCtrl_DeleteItem(GetDlgItem(hwndDlg, IDC_TAB), begin);
-
- SendMessage(hwndDlg, GC_ADDTAB, end, (LPARAM)s);
-
- // fix the "fixed" positions
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- for (int i = 0; i < tabId; i++) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- s = (SESSION_INFO*)tci.lParam;
- if (s && s->hContact && db_get_w(s->hContact, s->pszModule, "TabPosition", 0) != 0)
- db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
- }
- }
- }
- break;
-
- case GC_SESSIONNAMECHANGE:
- {
- SESSION_INFO* s1 = (SESSION_INFO*)lParam;
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB));
- for (int i = 0; i < tabId; i++) {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- int j = TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- if (j != -1) {
- SESSION_INFO *s2 = (SESSION_INFO*)tci.lParam;
- if (s1 == s2) {
- tci.mask = TCIF_TEXT;
- tci.pszText = s1->ptszName;
- TabCtrl_SetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- }
- }
- }
- }
- break;
-
- case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
- return (INT_PTR)pci->hListBkgBrush;
-
- case WM_MEASUREITEM:
- {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
- if (mis->CtlType == ODT_MENU)
- return Menu_MeasureItem(lParam);
-
- int ih = GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, FALSE);
- int ih2 = GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, FALSE);
- int font = ih > ih2 ? ih : ih2;
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
-
- // make sure we have space for icon!
- if (g_Settings.bShowContactStatus)
- font = font > 16 ? font : 16;
-
- mis->itemHeight = height > font ? height : font;
- }
- return TRUE;
-
- case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->CtlType == ODT_MENU)
- return Menu_DrawItem(lParam);
-
- if (dis->CtlID == IDC_LIST) {
- int index = dis->itemID;
- USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
- if (ui) {
- int x_offset = 2;
-
- int height = dis->rcItem.bottom - dis->rcItem.top;
- if (height & 1)
- height++;
-
- int offset = (height == 10) ? 0 : height / 2 - 4;
- HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
-
- if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush);
- else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
-
- if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- x_offset += 18;
- }
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(si, ui), 10, 10, 0, NULL, DI_NORMAL);
- x_offset += 12;
- if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- x_offset += 18;
- }
-
- SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
-
- if (si->pAccPropServicesForNickList) {
- wchar_t *nick = mir_wstrdup(ui->pszNick);
- si->pAccPropServicesForNickList->SetHwndPropStr(GetDlgItem(hwndDlg, IDC_LIST), OBJID_CLIENT, dis->itemID + 1, PROPID_ACC_NAME, nick);
- mir_free(nick);
- }
- }
- return TRUE;
- }
- }
- break;
-
- case GC_UPDATENICKLIST:
- {
- int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETTOPINDEX, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCOUNT, si->nUsersInNicklist, 0);
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETTOPINDEX, i, 0);
- SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0);
- }
- break;
-
- case GC_CONTROL_MSG:
- switch (wParam) {
- case SESSION_OFFLINE:
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
-
- case SESSION_ONLINE:
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- return TRUE;
-
- case WINDOW_HIDDEN:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
-
- case WINDOW_CLEARLOG:
- SetDlgItemText(hwndDlg, IDC_LOG, L"");
- return TRUE;
-
- case SESSION_TERMINATE:
- SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 0);
- if (db_get_b(NULL, CHAT_MODULE, "SavePosition", 0)) {
- db_set_dw(si->hContact, CHAT_MODULE, "roomx", si->iX);
- db_set_dw(si->hContact, CHAT_MODULE, "roomy", si->iY);
- db_set_dw(si->hContact, CHAT_MODULE, "roomwidth", si->iWidth);
- db_set_dw(si->hContact, CHAT_MODULE, "roomheight", si->iHeight);
- }
- if (pcli->pfnGetEvent(si->hContact, 0))
- pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
- si->wState &= ~STATE_TALK;
- db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
-
- case WINDOW_MINIMIZE:
- ShowWindow(hwndDlg, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
-
- case WINDOW_MAXIMIZE:
- ShowWindow(hwndDlg, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
-
- case SESSION_INITDONE:
- if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(hwndDlg))
- ShowWindow(hwndDlg, SW_NORMAL);
- LABEL_SHOWWINDOW:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- ShowWindow(hwndDlg, SW_SHOW);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SetForegroundWindow(hwndDlg);
- return TRUE;
- }
- break;
-
- case GC_SPLITTERMOVED:
- {
- POINT pt;
- RECT rcLog;
- BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg, IDC_SMILEY));
-
- static int x = 0;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERX)) {
- int oldSplitterX;
- GetClientRect(hwndDlg, &rc);
- pt.x = wParam; pt.y = 0;
- ScreenToClient(hwndDlg, &pt);
-
- oldSplitterX = si->iSplitterX;
- si->iSplitterX = rc.right - pt.x + 1;
- if (si->iSplitterX < 35)
- si->iSplitterX = 35;
- if (si->iSplitterX > rc.right - rc.left - 35)
- si->iSplitterX = rc.right - rc.left - 35;
- g_Settings.iSplitterX = si->iSplitterX;
- }
- else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY)) {
- int oldSplitterY;
- GetClientRect(hwndDlg, &rc);
- pt.x = 0; pt.y = wParam;
- ScreenToClient(hwndDlg, &pt);
-
- oldSplitterY = si->iSplitterY;
- si->iSplitterY = bFormat ? rc.bottom - pt.y + 1 : rc.bottom - pt.y + 20;
- if (si->iSplitterY < 63)
- si->iSplitterY = 63;
- if (si->iSplitterY > rc.bottom - rc.top - 40)
- si->iSplitterY = rc.bottom - rc.top - 40;
- g_Settings.iSplitterY = si->iSplitterY;
- }
- if (x == 2) {
- PostMessage(hwndDlg, WM_SIZE, 0, 0);
- x = 0;
- }
- else x++;
- }
- break;
-
- case GC_FIREHOOK:
- if (lParam) {
- GCHOOK *gch = (GCHOOK *)lParam;
- NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)gch);
- if (gch->pDest) {
- mir_free((void*)gch->pDest->ptszID);
- mir_free((void*)gch->pDest->pszModule);
- mir_free(gch->pDest);
- }
- mir_free((void*)gch->ptszText);
- mir_free((void*)gch->ptszUID);
- mir_free(gch);
- }
- break;
-
- case GC_CHANGEFILTERFLAG:
- si->iLogFilterFlags = lParam;
- break;
-
- case GC_SHOWFILTERMENU:
- {
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
- TranslateDialogDefault(hwnd);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_FILTER), &rc);
- SetWindowPos(hwnd, HWND_TOP, rc.left - 85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_FILTER)) || IsWindowVisible(GetDlgItem(hwndDlg, IDC_BOLD))) ? rc.top - 206 : rc.top - 186, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
- break;
-
- case GC_SHOWCOLORCHOOSER:
- pci->ColorChooser(si, lParam == IDC_COLOR, hwndDlg, GetDlgItem(hwndDlg, IDC_MESSAGE), GetDlgItem(hwndDlg, lParam));
- break;
-
- case GC_SCROLLTOBOTTOM:
- if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_STYLE) & WS_VSCROLL) != 0) {
- SCROLLINFO scroll = { 0 };
- scroll.cbSize = sizeof(scroll);
- scroll.fMask = SIF_PAGE | SIF_RANGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &scroll);
-
- scroll.fMask = SIF_POS;
- scroll.nPos = scroll.nMax - scroll.nPage + 1;
- SetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &scroll, TRUE);
-
- CHARRANGE sel;
- sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(GetDlgItem(hwndDlg, IDC_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
- }
- break;
-
- case WM_TIMER:
- if (wParam == TIMERID_FLASHWND)
- FlashWindow(hwndDlg, TRUE);
- break;
-
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
-
- //fall through
- case WM_MOUSEACTIVATE:
- {
- WINDOWPLACEMENT wp = { 0 };
- wp.length = sizeof(wp);
- GetWindowPlacement(hwndDlg, &wp);
- g_Settings.iX = wp.rcNormalPosition.left;
- g_Settings.iY = wp.rcNormalPosition.top;
- g_Settings.iWidth = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
- g_Settings.iHeight = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
-
- if (g_Settings.bTabsEnable) {
- int i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- if (i != -1) {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- SESSION_INFO *s = (SESSION_INFO*)tci.lParam;
- if (s) {
- s->wState &= ~GC_EVENT_HIGHLIGHT;
- s->wState &= ~STATE_TALK;
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s);
- }
- }
- }
-
- if (uMsg != WM_ACTIVATE)
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
-
- pci->SetActiveSession(si->ptszID, si->pszModule);
-
- if (KillTimer(hwndDlg, TIMERID_FLASHWND))
- FlashWindow(hwndDlg, FALSE);
- if (db_get_w(si->hContact, si->pszModule, "ApparentMode", 0) != 0)
- db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)0);
- if (pcli->pfnGetEvent(si->hContact, 0))
- pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case NM_RCLICK:
- if (((LPNMHDR)lParam)->idFrom == IDC_TAB) {
- int i = TabCtrl_GetCurSel(((LPNMHDR)lParam)->hwndFrom);
- if (i == -1)
- break;
-
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- tci.flags = TCHT_ONITEM;
- ScreenToClient(GetDlgItem(hwndDlg, IDC_TAB), &tci.pt);
- if ((i = TabCtrl_HitTest(((LPNMHDR)lParam)->hwndFrom, &tci)) == -1)
- break;
-
- TCITEM id = { 0 };
- id.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
-
- ClientToScreen(GetDlgItem(hwndDlg, IDC_TAB), &tci.pt);
- HMENU hSubMenu = GetSubMenu(g_hMenu, 5);
- TranslateMenu(hSubMenu);
- if (s) {
- WORD w = db_get_w(s->hContact, s->pszModule, "TabPosition", 0);
- if (w == 0)
- CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND | MF_UNCHECKED);
- else
- CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND | MF_CHECKED);
- }
- else CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND | MF_UNCHECKED);
-
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, tci.pt.x, tci.pt.y, 0, hwndDlg, NULL)) {
- case ID_CLOSE:
- if (TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB)) == i)
- PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CLOSE, BN_CLICKED), 0);
- else
- TabCtrl_DeleteItem(GetDlgItem(hwndDlg, IDC_TAB), i);
- break;
-
- case ID_CLOSEOTHER:
- {
- int tabId = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB)) - 1;
- if (tabId > 0) {
- if (TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB)) != i)
- if (s)
- pci->ShowRoom(s, WINDOW_VISIBLE, TRUE);
-
- for (tabId; tabId >= 0; tabId--) {
- if (tabId == i)
- continue;
-
- TabCtrl_DeleteItem(GetDlgItem(hwndDlg, IDC_TAB), tabId);
- }
- }
- }
- break;
-
- case ID_LOCKPOSITION:
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
- if (s != 0) {
- if (!(GetMenuState(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND)&MF_CHECKED)) {
- if (s->hContact)
- db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
- }
- else db_unset(s->hContact, s->pszModule, "TabPosition");
- }
- break;
- }
- }
- break;
-
- case EN_MSGFILTER:
- if (((LPNMHDR)lParam)->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
- CHARRANGE sel, all = { 0, -1 };
- POINT pt;
- UINT uID = 0;
- HMENU hMenu = 0;
- wchar_t pszWord[4096];
-
- pt.x = (short)LOWORD(((ENLINK *)lParam)->lParam);
- pt.y = (short)HIWORD(((ENLINK *)lParam)->lParam);
- ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
-
- // fixing stuff for searches
- pszWord[0] = '\0';
-
- POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
- ScreenToClient(GetDlgItem(hwndDlg, IDC_LOG), (LPPOINT)&ptl);
- long iCharIndex = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl);
- if (iCharIndex < 0)
- break;
-
- long start = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
- long end = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
-
- if (end - start > 0) {
- TEXTRANGE tr;
- memset(&tr, 0, sizeof(TEXTRANGE));
-
- CHARRANGE cr;
- cr.cpMin = start;
- cr.cpMax = end;
- tr.chrg = cr;
- tr.lpstrText = pszWord;
- long iRes = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- if (iRes > 0)
- for (size_t iLen = mir_wstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--)
- pszWord[iLen] = 0;
- }
-
- uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
- switch (uID) {
- case 0:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)& all);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_CLEARLOG:
- {
- SESSION_INFO *s = pci->SM_FindSession(si->ptszID, si->pszModule);
- if (s) {
- SetDlgItemText(hwndDlg, IDC_LOG, L"");
- pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
- s->iEventCount = 0;
- s->LastTime = 0;
- si->iEventCount = 0;
- si->LastTime = 0;
- si->pLog = s->pLog;
- si->pLogEnd = s->pLogEnd;
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- }
- break;
-
- case ID_SEARCH_GOOGLE:
- if (pszWord[0])
- Utils_OpenUrlT(CMStringW(FORMAT, L"http://www.google.com/search?q=%s", pszWord));
-
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_SEARCH_WIKIPEDIA:
- if (pszWord[0])
- Utils_OpenUrlT(CMStringW(FORMAT, L"http://en.wikipedia.org/wiki/%s", pszWord));
-
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- default:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
- break;
- }
- DestroyGCMenu(&hMenu, 5);
- }
- break;
-
- case EN_LINK:
- if (((LPNMHDR)lParam)->idFrom == IDC_LOG) {
- switch (((ENLINK *)lParam)->msg) {
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_LBUTTONDBLCLK:
- {
- CHARRANGE sel;
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax)
- break;
-
- TEXTRANGE tr;
- tr.chrg = ((ENLINK *)lParam)->chrg;
- tr.lpstrText = (LPTSTR)mir_alloc(sizeof(wchar_t)*(tr.chrg.cpMax - tr.chrg.cpMin + 1));
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
-
- if (((ENLINK *)lParam)->msg == WM_RBUTTONDOWN) {
- HMENU hSubMenu;
- POINT pt;
-
- hSubMenu = GetSubMenu(g_hMenu, 2);
- TranslateMenu(hSubMenu);
- pt.x = (short)LOWORD(((ENLINK *)lParam)->lParam);
- pt.y = (short)HIWORD(((ENLINK *)lParam)->lParam);
- ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case ID_NEW:
- Utils_OpenUrlT(tr.lpstrText);
- break;
-
- case ID_CURR:
- Utils_OpenUrlT(tr.lpstrText, false);
- break;
-
- case ID_COPY:
- {
- HGLOBAL hData;
- if (!OpenClipboard(hwndDlg))
- break;
- EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(tr.lpstrText) + 1));
- mir_wstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
- GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT, hData);
- CloseClipboard();
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- break;
- }
- }
- mir_free(tr.lpstrText);
- return TRUE;
- }
-
- Utils_OpenUrlT(tr.lpstrText);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- mir_free(tr.lpstrText);
- break;
- }
- }
- }
- break;
-
- case TTN_NEEDTEXT:
- if (((LPNMHDR)lParam)->idFrom == (UINT_PTR)GetDlgItem(hwndDlg, IDC_LIST)) {
- LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lParam;
- SESSION_INFO* parentdat = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- POINT p;
- GetCursorPos(&p);
- ScreenToClient(GetDlgItem(hwndDlg, IDC_LIST), &p);
- int item = LOWORD(SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
- if (ui != NULL) {
- static wchar_t ptszBuf[1024];
- mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
- TranslateT("Nickname"), ui->pszNick,
- TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
- lpttd->lpszText = ptszBuf;
- }
- }
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_LIST:
- if (HIWORD(wParam) == LBN_DBLCLK) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(GetDlgItem(hwndDlg, IDC_LIST), &hti.pt);
-
- int item = LOWORD(SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, item);
- if (ui) {
- if (GetKeyState(VK_SHIFT) & 0x8000) {
- LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETSEL, 0, 0);
- int start = LOWORD(lResult);
- size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 3);
- wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
- if (start == 0)
- mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
- else
- mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
-
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)pszName);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- else pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- }
-
- return TRUE;
- }
-
- if (HIWORD(wParam) == LBN_KILLFOCUS)
- RedrawWindow(GetDlgItem(hwndDlg, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
- break;
-
- case IDOK:
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) {
- ptrA pszRtf(Message_GetFromStream(hwndDlg, si));
- if (pszRtf == NULL)
- break;
-
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- if (mi == NULL)
- break;
-
- pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf);
-
- CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
- pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
- ptszText.Trim();
- ptszText.Replace(L"%", L"%%");
-
- if (mi->bAckMsg) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), FALSE);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0);
- }
- else SetDlgItemText(hwndDlg, IDC_MESSAGE, L"");
-
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
-
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
-
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- }
- break;
-
- case IDC_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST)))
- break;
- if (si->iType == GCW_SERVER)
- break;
-
- si->bNicklistEnabled = !si->bNicklistEnabled;
-
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
- SendMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- break;
-
- case IDC_MESSAGE:
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- break;
-
- case IDC_SMILEY:
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEY), &rc);
-
- if (SmileyAddInstalled) {
- SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- smaddInfo.Direction = 3;
- smaddInfo.xPosition = rc.left + 3;
- smaddInfo.yPosition = rc.top - 1;
- smaddInfo.hContact = si->hContact;
- smaddInfo.hwndParent = hwndDlg;
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
- }
- break;
-
- case IDC_HISTORY:
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_HISTORY))) {
- MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
- if (pInfo) {
- wchar_t szFile[MAX_PATH], szName[MAX_PATH], szFolder[MAX_PATH];
- wcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE);
- ValidateFilename(szName);
-
- mir_snwprintf(szFolder, L"%s\\%s", g_Settings.pszLogDir, szName);
- mir_snwprintf(szName, L"%s.log", si->ptszID);
- ValidateFilename(szName);
-
- mir_snwprintf(szFile, L"%s\\%s", szFolder, szName);
- ShellExecute(hwndDlg, L"open", szFile, NULL, NULL, SW_SHOW);
- }
- }
- break;
-
- case IDC_CLOSE:
- SendMessage(hwndDlg, GC_REMOVETAB, 0, 0);
- break;
-
- case IDC_CHANMGR:
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHANMGR)))
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
- break;
-
- case IDC_FILTER:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILTER)))
- break;
-
- si->bFilterEnabled = !si->bFilterEnabled;
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE));
- if (si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) {
- SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
- break;
- }
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- break;
-
- case IDC_BKGCOLOR:
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BKGCOLOR))) {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
- else if (si->bBGSet) {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pci->MM_FindModule(si->pszModule)->crColors[si->iBG];
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- break;
-
- case IDC_COLOR:
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_COLOR))) {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_COLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
- else if (si->bFGSet) {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = pci->MM_FindModule(si->pszModule)->crColors[si->iFG];
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = g_Settings.MessageAreaColor;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- break;
-
- case IDC_BOLD:
- case IDC_ITALICS:
- case IDC_UNDERLINE:
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
- cf.dwEffects = 0;
-
- if (LOWORD(wParam) == IDC_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BOLD)))
- break;
- if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ITALICS)))
- break;
- if (LOWORD(wParam) == IDC_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_UNDERLINE)))
- break;
- if (IsDlgButtonChecked(hwndDlg, IDC_BOLD))
- cf.dwEffects |= CFE_BOLD;
- if (IsDlgButtonChecked(hwndDlg, IDC_ITALICS))
- cf.dwEffects |= CFE_ITALIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE))
- cf.dwEffects |= CFE_UNDERLINE;
-
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- break;
-
- case WM_KEYDOWN:
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- break;
-
- case WM_MOVE:
- SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 1);
- break;
-
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO* mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = si->iSplitterX + 43;
- if (mmi->ptMinTrackSize.x < 350)
- mmi->ptMinTrackSize.x = 350;
-
- mmi->ptMinTrackSize.y = si->iSplitterY + 80;
- }
- break;
-
- case WM_LBUTTONDBLCLK:
- if (LOWORD(lParam) < 30)
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- break;
-
- case WM_CLOSE:
- if (g_Settings.bTabsEnable && g_Settings.TabRestore && lParam != 1) {
- TCITEM id = { 0 };
- int j = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TAB)) - 1;
- id.mask = TCIF_PARAM;
- for (j; j >= 0; j--) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), j, &id);
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
- if (s)
- TabM_AddTab(s->ptszID, s->pszModule);
- }
- }
-
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- break;
-
- case GC_CLOSEWINDOW:
- if (g_Settings.bTabsEnable)
- SM_SetTabbedWindowHwnd(0, 0);
- DestroyWindow(hwndDlg);
- break;
-
- case WM_DESTROY:
- SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 0);
-
- si->hWnd = NULL;
- si->wState &= ~STATE_TALK;
- DestroyWindow(si->hwndStatus);
- si->hwndStatus = NULL;
-
- if (si->pAccPropServicesForNickList) si->pAccPropServicesForNickList->Release();
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
- }
- return FALSE;
-}
diff --git a/src/core/stdchat/stdchat.vcxproj b/src/core/stdchat/stdchat.vcxproj
deleted file mode 100644
index fc4c0f35e4..0000000000
--- a/src/core/stdchat/stdchat.vcxproj
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>StdChat</ProjectName>
- <ProjectGuid>{268BD296-8DD3-4715-A386-CF120398EC98}</ProjectGuid>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\..\build\vc.common\core.props" />
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/src/core/stdchat/stdchat.vcxproj.filters b/src/core/stdchat/stdchat.vcxproj.filters
deleted file mode 100644
index e39f86d5d6..0000000000
--- a/src/core/stdchat/stdchat.vcxproj.filters
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(ProjectDir)..\..\..\build\vc.common\common.filters" />
-</Project> \ No newline at end of file