summaryrefslogtreecommitdiff
path: root/Plugins/smcnotify
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/smcnotify')
-rw-r--r--Plugins/smcnotify/commonheaders.h90
-rw-r--r--Plugins/smcnotify/docs/smcnotify_license.txt340
-rw-r--r--Plugins/smcnotify/docs/smcnotify_readme.txt177
-rw-r--r--Plugins/smcnotify/docs/smcnotify_translation.txt113
-rw-r--r--Plugins/smcnotify/docs/version.txt1
-rw-r--r--Plugins/smcnotify/history.c233
-rw-r--r--Plugins/smcnotify/ignore.c265
-rw-r--r--Plugins/smcnotify/list.c445
-rw-r--r--Plugins/smcnotify/m_smcnotify.h59
-rw-r--r--Plugins/smcnotify/menu.c192
-rw-r--r--Plugins/smcnotify/menu.h42
-rw-r--r--Plugins/smcnotify/options.c496
-rw-r--r--Plugins/smcnotify/options.h104
-rw-r--r--Plugins/smcnotify/popup.c203
-rw-r--r--Plugins/smcnotify/popup.h37
-rw-r--r--Plugins/smcnotify/res/history.icobin0 -> 2550 bytes
-rw-r--r--Plugins/smcnotify/res/list.icobin0 -> 2550 bytes
-rw-r--r--Plugins/smcnotify/res/log.icobin0 -> 2550 bytes
-rw-r--r--Plugins/smcnotify/res/popup.icobin0 -> 2550 bytes
-rw-r--r--Plugins/smcnotify/res/popup_no.icobin0 -> 2550 bytes
-rw-r--r--Plugins/smcnotify/res/url.icobin0 -> 2550 bytes
-rw-r--r--Plugins/smcnotify/resource.h91
-rw-r--r--Plugins/smcnotify/resource.rc303
-rw-r--r--Plugins/smcnotify/smc.c401
-rw-r--r--Plugins/smcnotify/smc.h46
-rw-r--r--Plugins/smcnotify/smcn.dsp194
-rw-r--r--Plugins/smcnotify/smcn.dsw29
-rw-r--r--Plugins/smcnotify/smcn.sln23
-rw-r--r--Plugins/smcnotify/smcn.vcproj569
-rw-r--r--Plugins/smcnotify/smcnotify.c165
-rw-r--r--Plugins/smcnotify/smcnotify.vcproj582
-rw-r--r--Plugins/smcnotify/utils.c238
32 files changed, 5438 insertions, 0 deletions
diff --git a/Plugins/smcnotify/commonheaders.h b/Plugins/smcnotify/commonheaders.h
new file mode 100644
index 0000000..b3b7de0
--- /dev/null
+++ b/Plugins/smcnotify/commonheaders.h
@@ -0,0 +1,90 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 __SMCNOTIFY_COMMONHEADERS_H
+#define __SMCNOTIFY_COMMONHEADERS_H
+
+#include <windows.h>
+#include <tchar.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include <time.h>
+
+#define MIRANDA_VER 0x0670
+
+//Miranda headers
+#include "newpluginapi.h"
+#include "m_system.h"
+#include "m_protocols.h"
+#include "m_protosvc.h"
+#include "m_clist.h"
+#include "m_ignore.h"
+#include "m_contacts.h"
+#include "m_message.h"
+#include "m_userinfo.h"
+#include "m_skin.h"
+#include "m_icolib.h"
+#include "m_langpack.h"
+#include "m_history.h"
+#include "m_database.h"
+#include "m_options.h"
+#include "m_utils.h"
+#include "m_button.h"
+#include "m_clc.h"
+#include "m_popup.h"
+#include "statusmodes.h"
+
+#include "m_toptoolbar.h"
+#include "m_updater.h"
+
+#include "../utils/mir_memory.h"
+#include "../utils/mir_options.h"
+
+#include "resource.h"
+#include "m_smcnotify.h"
+#include "options.h"
+#include "smc.h"
+#include "menu.h"
+#include "popup.h"
+
+
+#define MODULE_NAME "SMCNotify"
+#define PLUGIN_NAME "Status Message Change Notify"
+
+
+// Global Variables
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+void ShowList(void);
+HWND hListDlg;
+
+TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt);
+char* BuildSetting(WORD index, char *suffix);
+BOOL FreeSmiStr(STATUSMSGINFO *smi);
+WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage);
+TCHAR* MyDBGetContactSettingTString_dup(HANDLE hContact, const char *szModule, const char *szSetting, TCHAR *out);
+
+//#define CUSTOMBUILD_CATCHICQSTATUSMSG
+//#define CUSTOMBUILD_OSDSUPPORT
+//#define CUSTOMBUILD_COLORHISTORY
+
+#endif // __SMCNOTIFY_COMMONHEADERS_H
diff --git a/Plugins/smcnotify/docs/smcnotify_license.txt b/Plugins/smcnotify/docs/smcnotify_license.txt
new file mode 100644
index 0000000..7a8e8ab
--- /dev/null
+++ b/Plugins/smcnotify/docs/smcnotify_license.txt
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/Plugins/smcnotify/docs/smcnotify_readme.txt b/Plugins/smcnotify/docs/smcnotify_readme.txt
new file mode 100644
index 0000000..8adf1ee
--- /dev/null
+++ b/Plugins/smcnotify/docs/smcnotify_readme.txt
@@ -0,0 +1,177 @@
+Status Message Change Notify plugin for Miranda IM
+==================================================
+
+This plugin checks if any contact on your list changes his/her status message. Then it can
+perform some action:
+- notify you about the change via popup (PopUp plugin required),
+- store old status message to keep history of all the changes ( accesable through User
+ Details dialog),
+- if the message window is open show the change in there by adding an event to database,
+- log changes to a file.
+
+You can customize the text of every notification using some variables (see below).
+
+Other features:
+- a customizable window listing all the contacts that have status message set,
+- an item in contact menu 'Go To URL in Status Message' if the status message contains
+ a link,
+- Unicode support,
+- Updater support,
+- Translation support,
+
+Variables
+=========
+You can use those with any customizable template in SMCNotify options.
+Note that variables are case sensitive.
+
+ %n New status message
+ %o Old status message
+ %c Custom nickname
+ \n line break
+ \t tab stop
+
+ %Y Year
+ %M Month
+ %D Day
+ %H Hour (in 24h format)
+ %h Hour (in 12h format)
+ %a AM/PM
+ %m Minutes
+ %s Seconds
+
+List Contacts with Status Message
+=================================
+You can change the color of the text and background and choose an image to be dsplayed in
+the back of the list. Columns are sortable.
+The list doesn't refresh. You have to close it and open again, sorry.
+The first column (Protocol) is sortable in 4 ways:
+- contacts are sorted by status and then grouped by protocol they use,
+- reversed order of the previous one,
+- contacts are sorted by status only,
+- reversed order of the previous one.
+
+Upgrading from version 0.0.3.5 or below
+=======================================
+Because the code was rewritten and all the setting names in db were changed you have to
+configure the plugin from the begining. If you feel comfortable with using DBEditor plugin
+there are some ways to reuse old data:
+
+[Setting/StatusMsgChangeNotify]
+This module is not used any more. You can note down some setting (like colors, templates)
+and use them while configuring pluging through options page. Than delate this module.
+
+Reuse old per-contact settings
+Choose 'Actions->Search and Replace' from the top menu; in the dialogbox do the following:
+Serch For/Text: put 'smcn'; check only those options: Case Sensitive, Exact Match,
+Setting Name; Replace With/Text: put 'SMCNotify'; hit Replace.
+
+Reuse old per-contact status message history
+Choose 'Actions->Search and Replace' from the top menu; in the dialogbox do the following:
+Serch For/Text: put 'StatusMsgChangeNotify'; check only those options: Case Sensitive,
+Exact Match, Module Name; Replace With/Text: put 'SMCNotify'; hit Replace.
+
+Hidden settings
+===============
+[Settings/SMCNotify/IgnoreAfterStatusChange]
+BYTE set it to 1 if you're using NesStatusMessage plugin with option
+'Read status message' checked. This eliminates some double popups for the same contact.
+Note that this doesn't always work because the notifications come in random order.
+
+[Settings/SMCNotify/IgnoreTlenAway]
+BYTE oroginal Tlen client adds timestamp in the format '[hh:mm DD.MM]' when going Away.
+If you set this key to 1 it will ignore those changes.
+
+[<contact>/SMCNotify/HistoryMax]
+DWORD set per-contact max number of status messages it should keep in history.
+
+Development
+===========
+The project was started by daniel who simply changed some code of NickChangeNotify plugin
+by noname. The it was carried on by slotwin with a lot of help from pescuma.
+
+Source code
+===========
+If the source code wasn't published with the plugin you can find it in SVN repository on
+mgoodies project page:
+http://mgoodies.berlios.de
+
+Copyright and license
+=====================
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+History
+=======
+Version 0.0.3.17 beta
+
+[+] You can use %c with log filename to append nicknames
+[+] New option: Log in Ascii
+
+Version 0.0.3.15 beta
+
+[*] Code rewritten almost from scratch
+[+] Unicode support
+[+] Updater support
+[*] Options rearrange
+
+[I've never kept track of the changes and new features I inplement, sorry.]
+
+Version 0.0.1.7
+
+[+] OSD plugin support
+[+] contact item menu to quick disable/enable PopUps for this contact
+[*] better parsing of URL in status message, it can be surrounded with text
+ i.e. "blah blah www.myhomepage.com blah"
+
+
+Version 0.0.1.6 mod by slotwin
+
+[*] hell lot of changes, here are major ones:
+[+] 2 option windows - in 'PopUps' and 'Status' group
+[+] main menu item and toptoolbar button to list all contacts with status messages
+ in a new window:
+ - customizable (text colour, background colour or image)
+ - you can sort results by nick or proto/status
+ - double-left click to open message window
+ - right click for contact menu
+ - store size, columns width and last sorting after closing
+[+] "Go To URL in Status Message" contact menu item
+
+
+Version 0.0.1.1 mod by slotwin
+
+[+] empty status message displayed as "<empty>" (it's translatable)
+[!] minor options window glitches
+
+Version 0.0.1.0 mod by slotwin
+
+[+] new option: Show PopUps when I connect
+[+] new option: Show status message changes in message window (thanks TheLeech)
+[+] new variable: \t tab stop
+[*] some fixes with formatting log and PopUp text, multiline status messages
+[*] new translatable strings
+
+
+Version 0.0.0.2-0.0.0.4 mod by slotwin
+
+[+] GG (Gadu-Gadu) and Yahoo support
+[+] new variable: \n line break
+[*] no PopUps when disconnecting
+[!] bugfix: wrong data read when contact was clearing his/her status message
+[!] bugfix: sound when PopUps disabled
+
+
+Version 0.0.2.7 2005/05/28
+
+ - First version, completely bases on NickChangeNotify 0.0.2.7
diff --git a/Plugins/smcnotify/docs/smcnotify_translation.txt b/Plugins/smcnotify/docs/smcnotify_translation.txt
new file mode 100644
index 0000000..81b384e
--- /dev/null
+++ b/Plugins/smcnotify/docs/smcnotify_translation.txt
@@ -0,0 +1,113 @@
+; plugin name
+[Status Message Change Notify]
+
+; default templates
+[changed his/her status message to %n]
+[removes his/her status message]
+[changes his/her status message to %n]
+[<no status message>]
+
+; main menu items
+[PopUps]
+[Enable status message change notification]
+[Disable status message change notification]
+[List Contacts with Status Message]
+[Go To URL in Status Message]
+
+; skin sound option
+[Status Notify]
+[User has changed status message]
+
+; popup preview
+[Contact]
+[Old status message]
+[New status message]
+
+; IcoLib icons descriptions
+[PopUps Enabled]
+[PopUps Disabled]
+[List Contacts]
+[Go To URL]
+[Status Message History]
+[Log To File]
+
+; contacts with status message list
+[Protocol]
+[Nick]
+[Status Message]
+
+; status message history
+[Status Message History]
+[Clear history]
+; tooltips
+[Enable/Disable popups for this contact]
+[Enable/Disable history for this contact]
+[Enable/Disable logging to file for this contact]
+
+; options
+[Popups]
+[History]
+[General]
+[Advanced]
+[Ignore]
+
+; options page - popups
+[General]
+[Enable PopUps]
+[Show PopUps when I connect]
+[Only if status message has changed]
+[Ignore empty status messages]
+[Use OSD Plugin instead]
+[Colours]
+[From PopUp plugin]
+[Use Windows colours]
+[Custom]
+[Background]
+[Text]
+[Delay]
+[Permanent]
+[Actions]
+[Left click]
+[Right click]
+[Preview]
+
+; options page - general
+[Do not log empty status messages]
+[List]
+[Refresh list automatically]
+[Text colour]
+[Background colour]
+[Use background image]
+[Protocols]
+[Disable protocols which you don't wish to be notified for]
+
+; options page - advanced
+[History]
+[Keep history of up to]
+[status messages]
+[History template]
+[Clear status messages history for all contacts]
+[Message Window]
+[Show status message changes in message window]
+[Message removed]
+[Message changed]
+[Logging]
+[Log to]
+[Log in Ascii]
+;[Use %c in filename if you want to append Contact Custom Nickname]
+[You can use %c with log filename to append nicknames]
+[Log template]
+[Variables]
+
+; options page - ignore
+[Show PopUps]
+[Keep History]
+[Log To File]
+
+; options page - mouse click action select menu
+[Do nothing]
+[Close popup]
+[Open message window]
+[Open contact menu]
+[Open contact details]
+[View status message history]
diff --git a/Plugins/smcnotify/docs/version.txt b/Plugins/smcnotify/docs/version.txt
new file mode 100644
index 0000000..bfb35c7
--- /dev/null
+++ b/Plugins/smcnotify/docs/version.txt
@@ -0,0 +1 @@
+Status Message Change Notify 0.0.3.17
diff --git a/Plugins/smcnotify/history.c b/Plugins/smcnotify/history.c
new file mode 100644
index 0000000..66e19e0
--- /dev/null
+++ b/Plugins/smcnotify/history.c
@@ -0,0 +1,233 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+static void LoadHistory(HANDLE hContact, HWND hwnd, int nList) {
+ WORD historyFirst, historyLast, historyMax;
+ short i;
+ //size_t size;
+ TCHAR *str, *tempstr;
+ DBVARIANT dbv;
+ STATUSMSGINFO smi;
+
+ historyMax = DBGetContactSettingWord(hContact, MODULE_NAME, "HistoryMax", opts.dHistoryMax);
+ if (historyMax <= 0)
+ return;
+ else if (historyMax > 99)
+ historyMax = 99;
+
+ historyFirst = DBGetContactSettingWord(hContact, MODULE_NAME, "HistoryFirst",0);
+ if (historyFirst >= historyMax)
+ historyFirst = 0;
+ historyLast = DBGetContactSettingWord(hContact, MODULE_NAME, "HistoryLast",0);
+ if (historyLast >= historyMax)
+ historyLast = historyMax - 1;
+
+ ZeroMemory(&smi, sizeof(smi));
+
+ //str = (TCHAR*)mir_alloc(3 * sizeof(TCHAR));
+ str = (TCHAR*)mir_alloc(historyMax * 1024 * sizeof(TCHAR));
+ str[0] = _T('\0');
+ tempstr = NULL;
+
+ i = historyLast;
+ while (i != historyFirst)
+ {
+ i = (i - 1 + historyMax) % historyMax;
+
+ if (!DBGetContactSettingTString(hContact, MODULE_NAME, BuildSetting(i, NULL), &dbv))
+ {
+#ifdef UNICODE
+ if (dbv.type == DBVT_ASCIIZ)
+ {
+ smi.newstatusmsg = mir_dupToUnicodeEx(dbv.pszVal, CP_ACP);
+ }
+ else if (dbv.type == DBVT_UTF8)
+ {
+ smi.newstatusmsg = mir_dupToUnicodeEx(dbv.pszVal, CP_UTF8);
+ }
+ else if (dbv.type == DBVT_WCHAR)
+ {
+ smi.newstatusmsg = dbv.pwszVal;
+ }
+#else
+ if (dbv.type == DBVT_ASCIIZ)
+ {
+ smi.newstatusmsg = dbv.pszVal;
+ }
+#endif
+ else
+ {
+ smi.newstatusmsg = NULL;
+ }
+
+ smi.dTimeStamp = DBGetContactSettingDword(hContact, MODULE_NAME, BuildSetting(i, "_ts"), 0);
+ tempstr = GetStr(&smi, opts.history);
+ mir_free(smi.newstatusmsg);
+ DBFreeVariant(&dbv);
+ }
+
+ if ((tempstr != NULL) && (tempstr[0] != _T('\0')))
+ {
+ //size = (lstrlen(str) + lstrlen(tempstr) + 2) * sizeof(TCHAR);
+ //str = (TCHAR*)mir_realloc(str, size);
+ lstrcat(str, tempstr);
+ lstrcat(str, _T("\r\n"));
+ }
+ mir_free(tempstr);
+ }
+ SetDlgItemText(hwnd, nList, str);
+
+ mir_free(str);
+ return;
+}
+
+static void ClearHistory(HANDLE hContact) {
+ int i;
+ BOOL bSettingExists = TRUE;
+ for (i = 0; /*i < (int)options.dHistMax && */bSettingExists; i++)
+ {
+ bSettingExists = !DBDeleteContactSetting(hContact, MODULE_NAME, BuildSetting(i, NULL));
+ DBDeleteContactSetting(hContact, MODULE_NAME, BuildSetting(i, "_ts"));
+ }
+ DBDeleteContactSetting(hContact, MODULE_NAME, "HistoryFirst");
+ DBDeleteContactSetting(hContact, MODULE_NAME, "HistoryLast");
+}
+
+void ClearAllHistory() {
+ HANDLE hContact;
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ while (hContact)
+ {
+ ClearHistory(hContact);
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ }
+}
+
+static BOOL CALLBACK HistoryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ {
+ DWORD ignore;
+ SetWindowLong(hwndDlg, GWL_USERDATA, lParam);
+
+ TranslateDialogDefault(hwndDlg);
+
+ // set icons on buttons
+ SendDlgItemMessage(hwndDlg,IDC_CPOPUP,BM_SETIMAGE,IMAGE_ICON, CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_POPUP_E));
+ SendDlgItemMessage(hwndDlg,IDC_CHISTORY,BM_SETIMAGE,IMAGE_ICON, CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_HISTORY));
+ SendDlgItemMessage(hwndDlg,IDC_CLOG,BM_SETIMAGE,IMAGE_ICON, CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_LOG));
+
+ SendMessage(GetDlgItem(hwndDlg,IDC_CPOPUP), BUTTONSETASFLATBTN, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg,IDC_CPOPUP), BUTTONSETASPUSHBTN, 0, 0);
+
+ SendMessage(GetDlgItem(hwndDlg,IDC_CHISTORY), BUTTONSETASFLATBTN, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg,IDC_CHISTORY), BUTTONSETASPUSHBTN, 0, 0);
+
+ SendMessage(GetDlgItem(hwndDlg,IDC_CLOG), BUTTONSETASFLATBTN, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg,IDC_CLOG), BUTTONSETASPUSHBTN, 0, 0);
+
+ ignore = DBGetContactSettingDword((HANDLE)lParam, "Ignore", MODULE_NAME, 0);
+ CheckDlgButton(hwndDlg, IDC_CPOPUP, !(ignore & SMII_POPUP));
+ CheckDlgButton(hwndDlg, IDC_CHISTORY, !(ignore & SMII_HISTORY));
+ CheckDlgButton(hwndDlg, IDC_CLOG, !(ignore & SMII_LOG));
+
+ SendMessage(GetDlgItem(hwndDlg,IDC_CPOPUP), BUTTONADDTOOLTIP, (WPARAM)Translate("Enable/Disable popups for this contact"), 0);
+ SendMessage(GetDlgItem(hwndDlg,IDC_CHISTORY), BUTTONADDTOOLTIP, (WPARAM)Translate("Enable/Disable history for this contact"), 0);
+ SendMessage(GetDlgItem(hwndDlg,IDC_CLOG), BUTTONADDTOOLTIP, (WPARAM)Translate("Enable/Disable logging to file for this contact"), 0);
+
+ //make dialog bigger if UserInfoEx in use [222x132 dlus/340x170 dlus]
+ if (ServiceExists("UserInfo/Reminder/AggrassiveBackup"))
+ {
+ RECT rc, rc0, rcp;
+ rc0.left = 2;rc0.top = 155;rc0.right = 298;rc0.bottom = 148;
+ MapDialogRect(hwndDlg, &rc0);
+ MoveWindow(GetDlgItem(hwndDlg, IDC_HISTORYLIST), rc0.left, 2 * rc0.left, rc0.right, rc0.bottom, TRUE);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_CHISTORYCLEAR), &rc);
+ MoveWindow(GetDlgItem(hwndDlg, IDC_CHISTORYCLEAR), rc0.left, rc0.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
+ rcp.left = 170;rcp.top = 188;rcp.right = 18;rcp.bottom = 148;MapDialogRect(hwndDlg, &rcp);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_CPOPUP), &rc);
+ MoveWindow(GetDlgItem(hwndDlg, IDC_CPOPUP), rcp.left, rc0.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_CHISTORY), &rc);
+ MoveWindow(GetDlgItem(hwndDlg, IDC_CHISTORY), rcp.left + rcp.right, rc0.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_CLOG), &rc);
+ MoveWindow(GetDlgItem(hwndDlg, IDC_CLOG), rcp.left + rcp.right + rcp.right, rc0.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
+ }
+
+ LoadHistory((HANDLE)lParam, hwndDlg, IDC_HISTORYLIST);
+ break;
+ }
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_CHISTORYCLEAR:
+ ClearHistory((HANDLE)GetWindowLong(hwndDlg, GWL_USERDATA));
+ SetDlgItemText(hwndDlg, IDC_HISTORYLIST, _T(""));
+ break;
+ case IDC_CPOPUP:
+ case IDC_CLOG:
+ case IDC_CHISTORY:
+ {
+ DWORD ignore = IsDlgButtonChecked(hwndDlg, IDC_CPOPUP)?0:SMII_POPUP;
+ ignore = IsDlgButtonChecked(hwndDlg, IDC_CHISTORY)?ignore:ignore | SMII_HISTORY;
+ ignore = IsDlgButtonChecked(hwndDlg, IDC_CLOG)?ignore:ignore | SMII_LOG;
+ DBWriteContactSettingDword((HANDLE)GetWindowLong(hwndDlg, GWL_USERDATA), "Ignore", MODULE_NAME, ignore);
+ break;
+ }
+ }
+ break;
+#ifdef CUSTOMBUILD_COLORHISTORY
+ case WM_CTLCOLORSTATIC:
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_HISTORYLIST))
+ {
+ //SetBkMode((HDC)wParam, OPAQUE/*TRANSPARENT*/);
+ SetBkColor((HDC)wParam, 0x00000000/*GetSysColor(COLOR_WINDOW)*/);
+ SetTextColor((HDC)wParam, 0x00FFFFFF/*GetSysColor(COLOR_WINDOWTEXT)*/);
+ //return (BOOL)GetSysColorBrush(COLOR_WINDOW);
+ break;
+ }
+#endif
+ }
+
+ return 0;
+}
+
+extern int UserInfoInit(WPARAM wParam, LPARAM lParam) {
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp, sizeof(odp));
+
+ if ((HANDLE)lParam == NULL) return 0;
+
+ odp.cbSize = sizeof(odp);
+ odp.position = 100000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_HISTORY);
+ odp.ptszTitle = TranslateT("Status Message History");
+ odp.flags = ODPF_TCHAR;
+ odp.pfnDlgProc = HistoryDlgProc;
+ CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+
+ return 0;
+}
diff --git a/Plugins/smcnotify/ignore.c b/Plugins/smcnotify/ignore.c
new file mode 100644
index 0000000..50917ea
--- /dev/null
+++ b/Plugins/smcnotify/ignore.c
@@ -0,0 +1,265 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
+
+
+static void SetListGroupIcons(HWND hwndList,HANDLE hFirstItem,HANDLE hParentItem,int *groupChildCount)
+{
+ int typeOfFirst;
+ int iconOn[3]={1,1,1};
+ int childCount[3]={0,0,0},i;
+ int iImage;
+ HANDLE hItem,hChildItem;
+
+ typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0);
+ //check groups
+ if(typeOfFirst==CLCIT_GROUP) hItem=hFirstItem;
+ else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem);
+ while(hItem) {
+ hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
+ if(hChildItem) SetListGroupIcons(hwndList,hChildItem,hItem,childCount);
+ for( i=0; i < SIZEOF(iconOn); i++)
+ if(iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i)==0) iconOn[i]=0;
+ hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
+ }
+ //check contacts
+ if(typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem;
+ else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem);
+ while(hItem) {
+ for ( i=0; i < SIZEOF(iconOn); i++) {
+ iImage=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i);
+ if(iconOn[i] && iImage==0) iconOn[i]=0;
+ if(iImage!=0xFF) childCount[i]++;
+ }
+ hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem);
+ }
+ //set icons
+ for( i=0; i < SIZEOF(iconOn); i++) {
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hParentItem,MAKELPARAM(i,childCount[i]?(iconOn[i]?i+1:0):0xFF));
+ if(groupChildCount) groupChildCount[i]+=childCount[i];
+ }
+}
+
+static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iImage)
+{
+ int typeOfFirst,iOldIcon;
+ HANDLE hItem,hChildItem;
+
+ typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0);
+ //check groups
+ if(typeOfFirst==CLCIT_GROUP) hItem=hFirstItem;
+ else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem);
+ while(hItem) {
+ hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
+ if(hChildItem) SetAllChildIcons(hwndList,hChildItem,iColumn,iImage);
+ hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
+ }
+ //check contacts
+ if(typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem;
+ else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem);
+ while(hItem) {
+ iOldIcon=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
+ if(iOldIcon!=0xFF && iOldIcon!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
+ hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem);
+ }
+}
+
+static void SetAllContactIcons(HWND hwndList)
+{
+ HANDLE hContact,hItem;
+ DWORD ignore;
+
+ hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ do {
+ hItem=(HANDLE)SendMessage(hwndList,CLM_FINDCONTACT,(WPARAM)hContact,0);
+ if(hItem) {
+ ignore=DBGetContactSettingDword(hContact,"Ignore",MODULE_NAME,0);
+ if(SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,0))==0xFF)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,(ignore&SMII_POPUP)?0:1));
+ if(SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,0))==0xFF)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,(ignore&SMII_HISTORY)?0:2));
+ if(SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(2,0))==0xFF)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(2,(ignore&SMII_LOG)?0:3));
+ }
+ } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+}
+
+static void ResetListOptions(HWND hwndList)
+{
+ int i;
+
+ SendMessage(hwndList,CLM_SETBKBITMAP,0,(LPARAM)(HBITMAP)NULL);
+ SendMessage(hwndList,CLM_SETBKCOLOR,GetSysColor(COLOR_WINDOW),0);
+ SendMessage(hwndList,CLM_SETGREYOUTFLAGS,0,0);
+ SendMessage(hwndList,CLM_SETLEFTMARGIN,2,0);
+ SendMessage(hwndList,CLM_SETINDENT,10,0);
+ for(i=0;i<=FONTID_MAX;i++)
+ SendMessage(hwndList,CLM_SETTEXTCOLOR,i,GetSysColor(COLOR_WINDOWTEXT));
+ SetWindowLong(hwndList,GWL_STYLE,GetWindowLong(hwndList,GWL_STYLE)|CLS_SHOWHIDDEN);
+}
+
+extern BOOL CALLBACK IgnoreDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ static HICON hIcons[3];
+ static HANDLE hItemAll;
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ { HIMAGELIST hIml;
+ hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),
+ ((LOBYTE(LOWORD(GetVersion()))>=5 && LOWORD(GetVersion())!=5) ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 4, 4);
+ ImageList_AddIcon(hIml, LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
+ ImageList_AddIcon(hIml, (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_POPUP_E));
+ ImageList_AddIcon(hIml, (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_HISTORY));
+ ImageList_AddIcon(hIml, (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_LOG));
+ SendDlgItemMessage(hwndDlg, IDC_IGNORELIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
+ hIcons[0] = ImageList_GetIcon(hIml, 1, ILD_NORMAL);
+ SendDlgItemMessage(hwndDlg, IDC_IGNOREPOPUP, STM_SETICON, (WPARAM)hIcons[0], 0);
+ hIcons[1] = ImageList_GetIcon(hIml, 2, ILD_NORMAL);
+ SendDlgItemMessage(hwndDlg, IDC_IGNOREHISTORY, STM_SETICON, (WPARAM)hIcons[1],0);
+ hIcons[2] = ImageList_GetIcon(hIml, 3, ILD_NORMAL);
+ SendDlgItemMessage(hwndDlg, IDC_IGNORELOG, STM_SETICON, (WPARAM)hIcons[2],0);
+ }
+
+ ResetListOptions(GetDlgItem(hwndDlg, IDC_IGNORELIST));
+ SendDlgItemMessage(hwndDlg, IDC_IGNORELIST, CLM_SETEXTRACOLUMNS, 3, 0);
+
+ { CLCINFOITEM cii = {0};
+ cii.cbSize = sizeof(cii);
+ cii.flags = CLCIIF_GROUPFONT;
+ cii.pszText = TranslateT("** All contacts **");
+ hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_IGNORELIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
+ }
+
+ SetAllContactIcons(GetDlgItem(hwndDlg, IDC_IGNORELIST));
+ SetListGroupIcons(GetDlgItem(hwndDlg,IDC_IGNORELIST),
+ (HANDLE)SendDlgItemMessage(hwndDlg, IDC_IGNORELIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ return TRUE;
+ case WM_SETFOCUS:
+ SetFocus(GetDlgItem(hwndDlg,IDC_IGNORELIST));
+ break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case IDC_LIST:
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case CLN_NEWCONTACT:
+ case CLN_LISTREBUILT:
+ SetAllContactIcons(GetDlgItem(hwndDlg,IDC_LIST));
+ //fall through
+ case CLN_CONTACTMOVED:
+ SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL);
+ break;
+ case CLN_OPTIONSCHANGED:
+ ResetListOptions(GetDlgItem(hwndDlg,IDC_LIST));
+ break;
+ case NM_CLICK:
+ { HANDLE hItem;
+ NMCLISTCONTROL *nm=(NMCLISTCONTROL*)lParam;
+ DWORD hitFlags;
+ int iImage;
+ int itemType;
+
+ // Make sure we have an extra column
+ if (nm->iColumn == -1)
+ break;
+
+ // Find clicked item
+ hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x,nm->pt.y));
+ // Nothing was clicked
+ if (hItem == NULL) break;
+ // It was not a visbility icon
+ if (!(hitFlags & CLCHT_ONITEMEXTRA)) break;
+
+ // Get image in clicked column (0=none, 1=popups, 2=history, 3=log to file)
+ iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
+ if (iImage == 0)
+ iImage=nm->iColumn + 1;
+ else
+ if (iImage == 1 || iImage == 2 || iImage == 3)
+ iImage = 0;
+
+ // Get item type (contact, group, etc...)
+ itemType = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
+
+ // Update list
+ if (itemType == CLCIT_CONTACT) { // A contact
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
+ }
+ else if (itemType == CLCIT_INFO) { // All Contacts
+ SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
+ }
+ else if (itemType == CLCIT_GROUP) { // A group
+ hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ if (hItem) {
+ SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
+ }
+ }
+ // Update the all/none icons
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+
+ // Activate Apply button
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ }
+ break;
+ case 0:
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case PSN_APPLY:
+ { HANDLE hContact,hItem;
+ int set,i,iImage;
+
+ hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ do {
+ hItem=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_FINDCONTACT,(WPARAM)hContact,0);
+ if(hItem) {
+ set=0;
+ for(i=0;i<3;i++) {
+ iImage=SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0));
+ if(iImage==0) set = set | (1<<i);
+ }
+ DBWriteContactSettingDword(hContact,"Ignore",MODULE_NAME,set);
+ }
+ } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ return TRUE;
+ }
+ }
+ break;
+ }
+ break;
+ case WM_DESTROY:
+ DestroyIcon(hIcons[0]);
+ DestroyIcon(hIcons[1]);
+ DestroyIcon(hIcons[2]);
+ { HIMAGELIST hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGELIST,0,0);
+ ImageList_Destroy(hIml);
+ }
+ break;
+ }
+ return FALSE;
+}
diff --git a/Plugins/smcnotify/list.c b/Plugins/smcnotify/list.c
new file mode 100644
index 0000000..bc40ecc
--- /dev/null
+++ b/Plugins/smcnotify/list.c
@@ -0,0 +1,445 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+typedef struct {
+ int bSortAscending;
+ int iProtoSort;
+ int iLastColumnSortIndex;
+} LVDLGDAT;
+
+typedef struct {
+ HANDLE hContact;
+ int iiProto;
+ int iStatus;
+} LVITEMDAT;
+
+
+static int GetStatusOnlineness(int status) {
+ switch (status) {
+ case ID_STATUS_FREECHAT:
+ return 110;
+ case ID_STATUS_ONLINE:
+ return 100;
+ case ID_STATUS_OCCUPIED:
+ return 60;
+ case ID_STATUS_ONTHEPHONE:
+ return 50;
+ case ID_STATUS_DND:
+ return 40;
+ case ID_STATUS_AWAY:
+ return 30;
+ case ID_STATUS_OUTTOLUNCH:
+ return 20;
+ case ID_STATUS_NA:
+ return 10;
+ case ID_STATUS_INVISIBLE:
+ return 5;
+ }
+ return 0;
+}
+
+static BOOL CheckStatusMessage(HANDLE hContact, TCHAR* str) {
+ if (DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) return 0;
+
+ MyDBGetContactSettingTString_dup(hContact, "CList", "StatusMsg", str);
+
+ if (str != NULL && str[0] != _T('\0')) return 1;
+
+ return 0;
+}
+
+static BOOL ListOpenContact(HWND hList, int item) {
+ if (item != -1)
+ {
+ LVITEM lvi;
+ LVITEMDAT *lvidat;
+ ZeroMemory(&lvi, sizeof(lvi));
+ lvi.mask = LVIF_PARAM;
+ lvi.lParam = (LONG)NULL;
+ lvi.iItem = item;
+ lvi.iSubItem = 0;
+ ListView_GetItem(hList, &lvi);
+ lvidat = (LVITEMDAT*)lvi.lParam;
+ if(lvidat->hContact != NULL)
+ {
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)lvidat->hContact, (LONG)NULL);
+ CallService("SRMsg/LaunchMessageWindow", (WPARAM)lvidat->hContact, (LONG)NULL);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static BOOL ListOpenContactMenu(HWND hDlg, HWND hList, int item) {
+ if (item != -1)
+ {
+ LVITEM lvi;
+ LVITEMDAT *lvidat;
+ ZeroMemory(&lvi, sizeof(lvi));
+ lvi.mask = LVIF_PARAM;
+ lvi.lParam = (LONG)NULL;
+ lvi.iItem = item;
+ lvi.iSubItem = 0;
+ ListView_GetItem(hList, &lvi);
+ lvidat = (LVITEMDAT*)lvi.lParam;
+ if (lvidat->hContact != NULL)
+ {
+ HMENU hCMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)lvidat->hContact, 0);
+ if (hCMenu != NULL)
+ {
+ POINT p;
+ int ret;
+ GetCursorPos(&p);
+ ret = TrackPopupMenu(hCMenu, TPM_NONOTIFY | TPM_RETURNCMD, p.x, p.y, 0, hDlg, NULL);
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(ret, MPCF_CONTACTMENU), (LPARAM)lvidat->hContact);
+ DestroyMenu(hCMenu);
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+static int CALLBACK ListSortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) {
+ LVDLGDAT *dat = (LVDLGDAT*)lParamSort;
+ HWND hList = GetDlgItem(hListDlg, IDC_LIST);
+ int result = 0;
+
+ const int maxSize = 128;
+ TCHAR text1[128];
+ TCHAR text2[128];
+ ListView_GetItemText(hList, (int)lParam1, dat->iLastColumnSortIndex, text1, maxSize);
+ ListView_GetItemText(hList, (int)lParam2, dat->iLastColumnSortIndex, text2, maxSize);
+
+ switch (dat->iLastColumnSortIndex)
+ {
+ case 0:
+ {
+ LVITEM lvi;
+ LVITEMDAT *lvid1, *lvid2;
+ ZeroMemory(&lvi, sizeof(lvi));
+ lvi.mask = LVIF_PARAM;
+ lvi.lParam = (LONG)NULL;
+ lvi.iSubItem = 0;
+
+ lvi.iItem = (int)lParam1;
+ ListView_GetItem(hList, &lvi);
+ lvid1 = (LVITEMDAT*)lvi.lParam;
+
+ lvi.iItem = (int)lParam2;
+ ListView_GetItem(hList, &lvi);
+ lvid2 = (LVITEMDAT*)lvi.lParam;
+
+ if ((lvid1 == NULL) || (lvid2 == NULL)) return 0;
+
+ if (dat->iProtoSort == 1)
+ {
+ if (lvid1->iStatus == lvid2->iStatus) break;
+ else
+ {
+ result = (lvid1->iStatus < lvid2->iStatus) ? 1 : -1;
+ }
+ }
+ else if (dat->iProtoSort == 0)
+ {
+ result = lstrcmp(text1, text2);
+ if (result == 0)
+ {
+ if (lvid1->iStatus == lvid2->iStatus) break;
+ else
+ {
+ result = (lvid1->iStatus < lvid2->iStatus) ? 1 : -1;
+ }
+ }
+ }
+ break;
+ }
+ case 1:
+ case 2:
+ result = lstrcmpi(text1, text2);
+ break;
+ }
+
+ return dat->bSortAscending ? result : -result;
+}
+
+static void AddColumns(HWND hList) {
+ HIMAGELIST hImgList;
+ LVCOLUMN lvc;
+
+ ListView_SetExtendedListViewStyle(hList,
+ LVS_EX_FULLROWSELECT
+ | LVS_EX_INFOTIP
+ | LVS_EX_LABELTIP
+ | LVS_EX_BORDERSELECT
+ | LVS_EX_GRIDLINES
+ );
+
+ hImgList = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
+ if (hImgList != NULL)
+ ListView_SetImageList(hList, hImgList, LVSIL_SMALL);
+
+ ZeroMemory(&lvc, sizeof(lvc));
+ lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
+ lvc.fmt = LVCFMT_IMAGE;
+ lvc.pszText = TranslateT("Protocol");
+ lvc.cx = DBGetContactSettingWord(NULL, MODULE_NAME, "ListColWidth0", 30);
+ ListView_InsertColumn(hList, 0, &lvc);
+ lvc.mask = LVCF_TEXT | LVCF_WIDTH;
+// lvc.fmt = LVCFMT_LEFT;
+ lvc.pszText = TranslateT("Nick");
+ lvc.cx = DBGetContactSettingWord(NULL, MODULE_NAME, "ListColWidth1", 70);
+ ListView_InsertColumn(hList, 1, &lvc);
+ lvc.pszText = TranslateT("Status Message");
+ lvc.cx = DBGetContactSettingWord(NULL, MODULE_NAME, "ListColWidth2", 250);
+ ListView_InsertColumn(hList, 2, &lvc);
+
+ ListView_SetTextColor(hList, opts.colListText);
+ if (opts.bListUseBkImage && lstrcmp(opts.listbkimage, _T("")))
+ {
+ LVBKIMAGE lvbi;
+ ZeroMemory(&lvbi, sizeof(lvbi));
+ lvbi.ulFlags = LVBKIF_SOURCE_URL | LVBKIF_STYLE_TILE;
+ lvbi.pszImage = opts.listbkimage;
+ ListView_SetBkImage(hList, &lvbi);
+ ListView_SetBkColor(hList, GetSysColor(COLOR_HIGHLIGHT));
+ ListView_SetTextBkColor(hList, CLR_NONE);
+ }
+ else
+ {
+ ListView_SetBkColor(hList, opts.colListBack);
+ ListView_SetTextBkColor(hList, opts.colListBack);
+ }
+}
+
+static void LoadContacts(HWND hList) {
+ HANDLE hContact;
+ LVITEM lvi;
+ LVITEMDAT *lvidat;
+ int i = 0;
+ TCHAR *proto = NULL;
+ TCHAR *smsg = NULL;
+
+ ZeroMemory(&lvi, sizeof(lvi));
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ while (hContact)
+ {
+// if (DBGetContactSettingByte(hContact, "CList", "Hidden", 0));
+ smsg = MyDBGetContactSettingTString_dup(hContact, "CList", "StatusMsg", smsg);
+ if (smsg != NULL && smsg[0] != _T('\0'))
+ {
+ lvidat = (LVITEMDAT*)mir_alloc(sizeof(LVITEMDAT));
+ lvidat->iiProto = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0);
+ lvidat->iStatus = GetStatusOnlineness(DBGetContactSettingWord(hContact, (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), "Status", 0));
+ lvidat->hContact = hContact;
+ lvi.mask = LVIF_PARAM | LVIF_IMAGE | LVIF_TEXT;
+ lvi.iItem = i;
+ lvi.iSubItem = 0;
+ lvi.lParam = (LPARAM)lvidat;
+ lvi.iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0);
+ proto = MyDBGetContactSettingTString_dup(hContact, "Protocol", "p", proto);
+ lvi.pszText = proto;
+ ListView_InsertItem(hList, &lvi);
+ ListView_SetItemText(hList, i, 1, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ ListView_SetItemText(hList, i, 2, smsg);
+ i++;
+ mir_free(smsg);
+ mir_free(proto);
+ }
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ }
+}
+
+static BOOL CALLBACK ListDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ HWND hList = GetDlgItem(hwndDlg, IDC_LIST);
+ LVDLGDAT *lvdat;
+ lvdat = (LVDLGDAT*)GetWindowLong(hwndDlg, GWL_USERDATA);
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ DWORD sort;
+ TranslateDialogDefault(hwndDlg);
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_BIG, CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_LIST));
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_SMALL, CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)ICO_LIST));
+ Utils_RestoreWindowPosition(hwndDlg, NULL, MODULE_NAME, "List");
+
+ lvdat = (LVDLGDAT*)mir_alloc(sizeof(LVDLGDAT));
+ sort = DBGetContactSettingDword(NULL, MODULE_NAME, "ListColumnSort", 9);
+ lvdat->iLastColumnSortIndex = sort >> 2;
+ lvdat->bSortAscending = (sort & 1) ? 1 : 0;
+ lvdat->iProtoSort = (sort & 2) ? 1 : 0;
+ SetWindowLong(hwndDlg, GWL_USERDATA, (LONG)lvdat);
+
+ AddColumns(hList);
+
+ LoadContacts(hList);
+
+ ListView_SortItemsEx(hList, ListSortFunc, (LPARAM)lvdat);
+// SendMessage(hwndDlg, WM_SIZE, 0, 0);
+// ShowWindow(hwndDlg, SW_SHOW);
+ break;
+ }
+ case WM_NOTIFY:
+ {
+ if (((LPNMHDR)lParam)->idFrom == IDC_LIST)
+ {
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case NM_DBLCLK:
+ {
+ LVHITTESTINFO lvh;
+ POINT p;
+ GetCursorPos(&p);
+ ZeroMemory(&lvh, sizeof(lvh));
+ lvh.pt = p;
+ ScreenToClient(hList, &lvh.pt);
+ ListView_HitTest(hList, &lvh);
+ if ((lvh.flags & (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)) && lvh.iItem != -1)
+ ListOpenContact(hList, lvh.iItem);
+ break;
+ }
+ case NM_RCLICK:
+ {
+ LVHITTESTINFO lvh;
+ POINT p;
+ GetCursorPos(&p);
+ ZeroMemory(&lvh, sizeof(lvh));
+ lvh.pt = p;
+ ScreenToClient(hList, &lvh.pt);
+ ListView_HitTest(hList, &lvh);
+ if ((lvh.flags & (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)) && lvh.iItem != -1)
+ ListOpenContactMenu(hwndDlg, hList, lvh.iItem);
+ break;
+ }
+ case LVN_COLUMNCLICK:
+ {
+ LPNMLISTVIEW nmlv = (LPNMLISTVIEW)lParam;
+// if (nmlv->iSubItem == 2) {
+// SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+// break;
+// }
+ if (nmlv->iSubItem != lvdat->iLastColumnSortIndex)
+ {
+ lvdat->bSortAscending = 1;
+ lvdat->iLastColumnSortIndex = nmlv->iSubItem;
+ lvdat->iProtoSort = 0;
+ }
+ else
+ {
+ lvdat->bSortAscending = !lvdat->bSortAscending;
+ if (lvdat->bSortAscending == 1) lvdat->iProtoSort = !lvdat->iProtoSort;
+ }
+ ListView_SortItemsEx(hList, ListSortFunc, (LPARAM)lvdat);
+ break;
+ }
+ }
+ }
+ break;
+ }
+ case WM_MEASUREITEM:
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+ case WM_DRAWITEM:
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+ case WM_COMMAND:
+ {
+ switch (wParam)
+ {
+ case IDOK:
+ ListOpenContact(hList, ListView_GetNextItem(hList, -1, LVIS_SELECTED));
+ break;
+ case IDCANCEL:
+ SendMessage(hwndDlg, WM_CLOSE, 0, 0);
+ break;
+ }
+ break;
+ }
+// case WM_USER + 10: // refresh
+// ListView_DeleteAllItems(hList);
+// LoadContactsStatusMsgList(hList);
+// ListView_SortItems(hList, ListSortFunc, (LPARAM)lvdat);
+// return 0;
+ case WM_SIZE:
+ {
+ RECT rc;
+ POINT p;
+ GetWindowRect(hwndDlg, &rc);
+ p.x = rc.right - GetSystemMetrics(SM_CYDLGFRAME);
+ p.y = rc.bottom - GetSystemMetrics(SM_CXDLGFRAME);
+ ScreenToClient(hwndDlg, &p);
+ MoveWindow(hList, 0, 0, p.x, p.y, TRUE);
+ break;
+ }
+ case WM_CLOSE:
+ {
+ DestroyWindow(hwndDlg);
+// KillTimer(hwndDlg, TIMERID_LISTAUTOREFRESH);
+ break;
+ }
+ case WM_DESTROY:
+ {
+ DWORD sort;
+ int i;
+ Utils_SaveWindowPosition(hwndDlg, NULL, MODULE_NAME, "List");
+ DBWriteContactSettingWord(NULL, MODULE_NAME, "ListColWidth0", (WORD)ListView_GetColumnWidth(hList, 0));
+ DBWriteContactSettingWord(NULL, MODULE_NAME, "ListColWidth1", (WORD)ListView_GetColumnWidth(hList, 1));
+ DBWriteContactSettingWord(NULL, MODULE_NAME, "ListColWidth2", (WORD)ListView_GetColumnWidth(hList, 2));
+
+// sort = lvdat->iLastColumnSortIndex<<2;
+ sort = lvdat->iLastColumnSortIndex * 4;
+ sort = lvdat->bSortAscending ? sort | 1 : sort;
+ sort = lvdat->iProtoSort ? sort | 2 : sort;
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "ListColumnSort", sort);
+
+ for (i = 0; i < ListView_GetItemCount(hList); i++)
+ {
+ LVITEM lvi;
+ ZeroMemory(&lvi, sizeof(lvi));
+ lvi.mask = LVIF_PARAM;
+ lvi.lParam = (LONG)NULL;
+ lvi.iItem = i;
+ lvi.iSubItem = 0;
+ ListView_GetItem(hList, &lvi);
+ mir_free((LVITEMDAT*)lvi.lParam);
+ }
+ mir_free(lvdat);
+ hListDlg = NULL;
+ break;
+ }
+ }
+ return FALSE;
+}
+
+extern void ShowList() {
+ if (hListDlg == NULL)
+ {
+ hListDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LIST), NULL, ListDlgProc);
+ //ShowWindow(hListDlg, SW_SHOW);
+ }
+ else
+ {
+ SetForegroundWindow(hListDlg);
+ SetFocus(hListDlg);
+ }
+}
diff --git a/Plugins/smcnotify/m_smcnotify.h b/Plugins/smcnotify/m_smcnotify.h
new file mode 100644
index 0000000..88a0c18
--- /dev/null
+++ b/Plugins/smcnotify/m_smcnotify.h
@@ -0,0 +1,59 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2007 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 __SMCNOTIFY_M_SMCNOTIFY_H
+#define __SMCNOTIFY_M_SMCNOTIFY_H
+
+
+#define EVENTTYPE_STATUSMESSAGE_CHANGE 9002
+
+/*
+Enable/Disable status message change notification
+
+wParam=
+0 - used internaly, toggle popups, lParam is ignored
+1 - enable/disable popups from within other plugins, see lParam
+lParam=0
+0 - disable popups
+1 - enable popups
+*/
+#define MS_SMCNOTIFY_POPUPS "SMCNotify/Popups"
+
+
+/*
+Show List with all the contact that have a status message set
+
+wParam=lParam=ignored
+*/
+#define MS_SMCNOTIFY_LIST "SMCNotify/ShowList"
+
+
+/*
+Go To URL in Status Message
+used just internaly for now
+
+wParam=lParam=ignored
+*/
+#define MS_SMCNOTIFY_GOTOURL "SMCNotify/GoToURL"
+
+
+
+#endif // __SMCNOTIFY_M_SMCNOTIFY_H
diff --git a/Plugins/smcnotify/menu.c b/Plugins/smcnotify/menu.c
new file mode 100644
index 0000000..ae74ea8
--- /dev/null
+++ b/Plugins/smcnotify/menu.c
@@ -0,0 +1,192 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+int hmPopups;
+int hmShowList;
+int hmGoToURL;
+
+char *pszStatusMsgURL;
+
+char *pszIconId[ICONCOUNT] = {"smcnotify_pope", "smcnotify_popd", "smcnotify_list", "smcnotify_url", "smcnotify_history", "smcnotify_log"};
+
+extern void LoadIcons(void) {
+ SKINICONDESC sid;
+
+ TCHAR *ptszIconName[ICONCOUNT] = {
+ TranslateT("PopUps Enabled"),
+ TranslateT("PopUps Disabled"),
+ TranslateT("List Contacts"),
+ TranslateT("Go To URL"),
+ TranslateT("Status Message History"),
+ TranslateT("Log To File")
+ };
+ int iIconId[ICONCOUNT] = {IDI_POPUP, IDI_NOPOPUP, IDI_LIST, IDI_URL, IDI_HISTORY, IDI_LOG};
+ int i;
+ ZeroMemory(&sid, sizeof(sid));
+ sid.cbSize = sizeof(sid);
+ sid.flags = SIDF_TCHAR;
+ sid.ptszSection = TranslateT(PLUGIN_NAME);
+ for (i = 0; i < ICONCOUNT; i++)
+ {
+ sid.pszName = pszIconId[i];
+ sid.ptszDescription = ptszIconName[i];
+ sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(iIconId[i]));
+ hLibIcons[i] = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ }
+
+ return;
+}
+
+static void UpdateMenuItems(BOOL set) {
+ CLISTMENUITEM mi;
+
+ ZeroMemory(&mi, sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ if (set)
+ {
+ mi.pszName = Translate("Disable status message change notification");
+ mi.hIcon = ICO_POPUP_E;
+ }
+ else
+ {
+ mi.pszName = Translate("Enable status message change notification");
+ mi.hIcon = ICO_POPUP_D;
+ }
+ puopts.bEnable = set;
+ mi.flags = CMIM_NAME | CMIM_ICON;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmPopups, (LPARAM)&mi);
+
+ return;
+}
+
+extern void InitMenuItems(void) {
+ CLISTMENUITEM mi;
+
+ ZeroMemory(&mi, sizeof(mi));
+ mi.cbSize = sizeof(mi);
+// mi.flags = CMIF_ICONFROMICOLIB;
+
+ if (PopupActive)
+ {
+ //Disable/Enable status message change notification
+ mi.position = 0;
+// mi.icolibItem = ICO_POPUP_E;
+ mi.pszPopupName = Translate("PopUps");
+ mi.pszService = MS_SMCNOTIFY_POPUPS;
+ hmPopups = CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+
+ mi.ptszPopupName = NULL;
+ }
+
+ mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB;
+
+ //List Contacts with Status Message - main menu
+ mi.position = 500021000;
+ mi.icolibItem = ICO_LIST;
+ mi.ptszName = TranslateT("List Contacts with Status Message");
+ mi.pszService = MS_SMCNOTIFY_LIST;
+ hmShowList = CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+
+ mi.pszContactOwner = NULL;
+
+ //Go To URL in Status Message - contact menu
+ mi.position = -2000004000;
+ mi.icolibItem = ICO_URL;
+ mi.ptszName = TranslateT("Go To URL in Status Message");
+ mi.pszService = MS_SMCNOTIFY_GOTOURL;
+ hmGoToURL = CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+
+ UpdateMenuItems(puopts.bEnable);
+ return;
+}
+
+int MenuItemCmd_PopUps(WPARAM wParam, LPARAM lParam) {
+ UpdateMenuItems(wParam ? lParam : !puopts.bEnable);
+ return 0;
+}
+
+int MenuItemCmd_ShowList(WPARAM wParam, LPARAM lParam) {
+ ShowList();
+ return 0;
+}
+
+int MenuItemCmd_GoToURL(WPARAM wParam, LPARAM lParam) {
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)pszStatusMsgURL);
+ MIR_FREE(pszStatusMsgURL);
+
+ return 0;
+}
+
+extern int PreBuildCMenu(WPARAM wParam, LPARAM lParam) {
+ DBVARIANT dbv;
+ CLISTMENUITEM clmi;
+ char *str, *p;
+ int c;
+ str = NULL;
+
+ ZeroMemory(&clmi, sizeof(clmi));
+ clmi.cbSize = sizeof(clmi);
+ clmi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+ if (!DBGetContactSettingTString((HANDLE)wParam, "CList", "StatusMsg", &dbv))
+ {
+#ifdef UNICODE
+ if ((dbv.type == DBVT_ASCIIZ) || (dbv.type == DBVT_UTF8))
+ {
+ str = dbv.pszVal;
+ }
+ else if (dbv.type == DBVT_WCHAR)
+ {
+ str = mir_dupToAscii(dbv.pwszVal);
+ }
+#else
+ if (dbv.type == DBVT_ASCIIZ)
+ {
+ str = dbv.pszVal;
+ }
+#endif
+
+ if (lstrcmpA(str, ""))
+ {
+ p = strstr(str, "www.");
+ if (p == NULL) p = strstr(str, "http://");
+ if (p != NULL)
+ {
+ for (c = 0; p[c] != '\n' && p[c] != '\r' && p[c] != '\t' && p[c] != ' ' && p[c] != '\0'; c++);
+
+ lstrcpynA(str, p, c + 1);
+ mir_free(pszStatusMsgURL);
+ pszStatusMsgURL = mir_strdup(str);
+
+ clmi.flags = CMIM_FLAGS;
+ }
+ }
+ DBFreeVariant(&dbv);
+ }
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmGoToURL, (LPARAM)&clmi);
+
+ mir_free(str);
+ mir_free(p);
+
+ return 0;
+} \ No newline at end of file
diff --git a/Plugins/smcnotify/menu.h b/Plugins/smcnotify/menu.h
new file mode 100644
index 0000000..7b60839
--- /dev/null
+++ b/Plugins/smcnotify/menu.h
@@ -0,0 +1,42 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 __SMCNOTIFY_MENU_H
+#define __SMCNOTIFY_MENU_H
+
+void LoadIcons();
+void InitMenuItems();
+int PreBuildCMenu(WPARAM wParam, LPARAM lParam);
+
+int MenuItemCmd_PopUps(WPARAM wParam, LPARAM lParam);
+int MenuItemCmd_ShowList(WPARAM wParam, LPARAM lParam);
+int MenuItemCmd_GoToURL(WPARAM wParam, LPARAM lParam);
+
+#define ICONCOUNT 6
+HANDLE hLibIcons[ICONCOUNT];
+#define ICO_POPUP_E hLibIcons[0]
+#define ICO_POPUP_D hLibIcons[1]
+#define ICO_LIST hLibIcons[2]
+#define ICO_URL hLibIcons[3]
+#define ICO_HISTORY hLibIcons[4]
+#define ICO_LOG hLibIcons[5]
+
+#endif // __SMCNOTIFY_MENU_H
diff --git a/Plugins/smcnotify/options.c b/Plugins/smcnotify/options.c
new file mode 100644
index 0000000..ef690a8
--- /dev/null
+++ b/Plugins/smcnotify/options.c
@@ -0,0 +1,496 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+BOOL AllowProtocol(const char *proto) {
+ if ((CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) == 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+static OptPageControl optionsControls[] = {
+ {&opts.bIgnoreRemove, CONTROL_CHECKBOX, IDC_IGNOREREMOVE, "IgnoreRemove", FALSE},
+ {&opts.bListUseBkImage, CONTROL_CHECKBOX, IDC_USEBGIMG, "ListUseBkImage", FALSE},
+ {&opts.colListBack, CONTROL_COLOR, IDC_LISTBGCOLOR, "ListBkColor", RGB(255,255,255)},
+ {&opts.colListText, CONTROL_COLOR, IDC_LISTTEXTCOLOR, "ListTextColor", RGB(0,0,0)},
+ {NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE, (int)AllowProtocol}
+};
+
+static OptPageControl advancedControls[] = {
+ {&opts.bHistoryEnable, CONTROL_CHECKBOX, IDC_HISTORY, "HistoryEnable", TRUE},
+ {&opts.dHistoryMax, CONTROL_SPIN, IDC_HISTORYMAX, "HistoryMax", 20, IDC_HISTORYMAX_SPIN, (WORD)1, (WORD)100},
+ {&opts.history, CONTROL_TEXT, IDC_HISTORYTEXT, "HistoryTemplate", (DWORD)_T(DEFAULT_TEMPLATE_HISTORY)},
+ {&opts.bDBEnable, CONTROL_CHECKBOX, IDC_MESSAGEWND, "DBEnable", TRUE},
+// {&opts.history_only_ansi_if_possible, CONTROL_CHECKBOX, IDC_ANSI, "HistoryOnlyANSIIfPossible", TRUE},
+ {&opts.msgchanged, CONTROL_TEXT, IDC_MSGCHANGED, "TemplateChanged", (DWORD)_T(DEFAULT_TEMPLATE_CHANGED)},
+ {&opts.msgremoved, CONTROL_TEXT, IDC_MSGREMOVED, "TemplateRemoved", (DWORD)_T(DEFAULT_TEMPLATE_REMOVED)},
+ {&opts.bLogEnable, CONTROL_CHECKBOX, IDC_LOG, "LogEnable", FALSE},
+#ifdef UNICODE
+ {&opts.bLogAscii, CONTROL_CHECKBOX, IDC_LOGASCII, "LogAscii", FALSE},
+#endif
+ {&opts.log, CONTROL_TEXT, IDC_LOGTEXT, "LogTemplate", (DWORD)_T(DEFAULT_TEMPLATE_LOG)}
+};
+
+static OptPageControl popupsControls[] = {
+ {&puopts.bEnable, CONTROL_CHECKBOX, IDC_POPUPS, "PopupsEnable", TRUE},
+ {&puopts.bOnConnect, CONTROL_CHECKBOX, IDC_ONCONNECT, "PopupsOnConnect", FALSE},
+ {&puopts.bIfChanged, CONTROL_CHECKBOX, IDC_IFCHANGED, "PopupsIfChanged", TRUE},
+ {&puopts.bIgnoreRemove, CONTROL_CHECKBOX, IDC_PUIGNOREREMOVE, "PopupsIgnoreRemove", FALSE},
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ {&puopts.bUseOSD, CONTROL_CHECKBOX, IDC_USEOSD, "PopupsUseOSD", TRUE},
+#endif
+ {&puopts.bColorType, CONTROL_RADIO, IDC_COLORFROMPU, "PopupsColorType", POPUP_COLOR_DEFAULT, POPUP_COLOR_DEFAULT},
+ {NULL, CONTROL_RADIO, IDC_COLORWINDOWS, "PopupsColorType", POPUP_COLOR_DEFAULT, POPUP_COLOR_WINDOWS},
+ {NULL, CONTROL_RADIO, IDC_COLORCUSTOM, "PopupsColorType", POPUP_COLOR_DEFAULT, POPUP_COLOR_CUSTOM},
+ {&puopts.colBack, CONTROL_COLOR, IDC_PUBGCOLOR, "PopupsBkColor", RGB(201,125,234)},
+ {&puopts.colText, CONTROL_COLOR, IDC_PUTEXTCOLOR, "PopupsTextColor", RGB(0,0,0)},
+ {&puopts.bDelayType, CONTROL_RADIO, IDC_DELAYFROMPU, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_DEFAULT},
+ {NULL, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM},
+ {NULL, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT},
+ {&puopts.dDelay, CONTROL_SPIN, IDC_DELAY, "PopupsDelay", 10, IDC_DELAY_SPIN, (WORD)1, (WORD)255},
+ {&puopts.LeftClickAction, CONTROL_COMBO, IDC_LEFTACTION, "PopupsLeftClick", POPUP_ACTION_INFO},
+ {&puopts.RightClickAction, CONTROL_COMBO, IDC_RIGHTACTION, "PopupsRightClick", POPUP_ACTION_CLOSE},
+ {&puopts.text, CONTROL_TEXT, IDC_POPUPTEXT, "PopupsTemplate", (DWORD)_T(DEFAULT_TEMPLATE_POPUP)}
+};
+/*
+static UINT popupsExpertControls[] = {
+ IDC_ONCONNECT, IDC_IFCHANGED, IDC_PUIGNOREREMOVE,
+ IDC_EXPERT, IDC_PUBGCOLOR, IDC_PUTEXTCOLOR, IDC_COLORTYPE,
+ IDC_DELAYFROMPU, IDC_DELAYCUSTOM, IDC_DELAYPERMANENT, IDC_DELAY, IDC_DELAY_SPIN,
+ IDC_RIGHTACTION, IDC_LEFTACTION,
+ IDC_POPUPTEXT, IDC_PREVIEW
+};
+*/
+static OptPageControl fileControls[] = {
+ {&opts.logfile, CONTROL_TEXT, IDC_LOGFILE, "LogFile", (DWORD)_T(DEFAULT_LOG_FILENAME), 0, 0, MAX_PATH},
+ {&opts.listbkimage, CONTROL_TEXT, IDC_BGIMGFILE, "ListBkImage", (DWORD)_T(DEFAULT_BGIMAGE_FILENAME), 0, 0, MAX_PATH}
+};
+
+#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) )
+
+void LoadOptions() {
+ TCHAR temp[MAX_PATH];
+
+ LoadOpts(optionsControls, MAX_REGS(optionsControls), MODULE_NAME);
+ LoadOpts(advancedControls, MAX_REGS(advancedControls), MODULE_NAME);
+ LoadOpts(popupsControls, MAX_REGS(popupsControls), MODULE_NAME);
+
+ LoadOpts(fileControls, MAX_REGS(fileControls), MODULE_NAME);
+ if (opts.listbkimage != NULL && opts.listbkimage[0] != _T('\0'))
+ {
+ CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)opts.listbkimage, (LPARAM)temp);
+ lstrcpyn(opts.listbkimage, temp, MAX_PATH);
+ }
+ if (opts.logfile != NULL && opts.logfile[0] != _T('\0'))
+ {
+ CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)opts.logfile, (LPARAM)temp);
+ lstrcpyn(opts.logfile, temp, MAX_PATH);
+ }
+}
+
+static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ BOOL ret = SaveOptsDlgProc(optionsControls, MAX_REGS(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ SetDlgItemText(hwndDlg, IDC_BGIMGFILE, opts.listbkimage);
+ SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ break;
+ case WM_USER + 10:
+ {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_USEBGIMG);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LISTBGCOLOR), !enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BGIMGFILE), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BGIMGBROWSE), enabled);
+ break;
+ }
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_USEBGIMG:
+ SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ break;
+ case IDC_BGIMGBROWSE:
+ {
+ OPENFILENAME ofn;
+ TCHAR filepath[MAX_PATH] = _T("");
+ char filter[512] = "";
+#ifdef UNICODE
+ WCHAR filterW[512] = L"";
+ int i;
+#endif
+
+ GetDlgItemText(hwndDlg, IDC_BGIMGFILE, filepath, sizeof(filepath));
+ CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter);
+#ifdef UNICODE
+ for (i = 0; i < 512; i++)
+ filterW[i] = filter[i];
+#endif
+
+ ZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);//OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = hwndDlg;
+#ifdef UNICODE
+ ofn.lpstrFilter = filterW;
+#else
+ ofn.lpstrFilter = filter;
+#endif
+ ofn.lpstrFile = filepath;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.lpstrDefExt = _T("bmp");
+
+ if (GetOpenFileName(&ofn))
+ {
+ SetDlgItemText(hwndDlg, IDC_BGIMGFILE, filepath);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+
+ break;
+ }
+ case IDC_BGIMGFILE:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
+ return 0;
+// else
+// SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+
+ if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY)
+ {
+ TCHAR temp[MAX_PATH]; temp[0] = _T('\0');
+ GetDlgItemText(hwndDlg, IDC_BGIMGFILE, opts.listbkimage, MAX_PATH);
+ if (opts.listbkimage != NULL && opts.listbkimage[0] != _T('\0'))
+ CallService(MS_UTILS_PATHTORELATIVET, (WPARAM)opts.listbkimage, (LPARAM)temp);
+ DBWriteContactSettingTString(NULL, MODULE_NAME, "ListBkImage", temp);
+ }
+ break;
+ }
+ }
+ return ret;
+}
+
+static BOOL CALLBACK AdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ BOOL ret = SaveOptsDlgProc(advancedControls, MAX_REGS(advancedControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TCHAR str[1024];str[0] = _T('\0');
+
+ SetDlgItemText(hwndDlg, IDC_LOGFILE, opts.logfile);
+#ifdef UNICODE
+ ShowWindow(GetDlgItem(hwndDlg, IDC_LOGASCII), SW_HIDE);
+#endif
+ SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ SendMessage(hwndDlg, WM_USER + 11, 0, 0);
+ SendMessage(hwndDlg, WM_USER + 12, 0, 0);
+
+ lstrcpy(str, _T("%n\tNew Status Message\r\n%o\tOld Status Message\r\n%c\tCustom Nickname\r\n\\n\tline break\r\n\\t\ttab stop"));
+ SetDlgItemText(hwndDlg, IDC_VARS1, str);
+ lstrcpy(str, _T("%D/%M/%Y\tDay/Month/Year\r\n%H:%m:%s\tTime (in 24h format)\r\n%h:%m:%s %a\t(in 12h format)"));
+ SetDlgItemText(hwndDlg, IDC_VARS2, str);
+ break;
+ }
+ case WM_USER + 10:
+ {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_MESSAGEWND);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MSGCHANGED), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MSGREMOVED), enabled);
+ break;
+ }
+ case WM_USER + 11:
+ {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_HISTORY);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HISTORYMAX), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HISTORYMAX_SPIN), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HISTORYTEXT), enabled);
+ break;
+ }
+ case WM_USER + 12:
+ {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LOG);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGTEXT), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGFILE), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGFILEBROWSE), enabled);
+#ifdef UNICODE
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGASCII), enabled);
+#endif
+ break;
+ }
+ case WM_COMMAND:
+ if ((LOWORD(wParam) == IDC_LOGFILE
+ || LOWORD(wParam) == IDC_VARS1
+ || LOWORD(wParam) == IDC_VARS2)
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ return 0;
+ switch (LOWORD(wParam))
+ {
+ case IDC_MESSAGEWND:
+ SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ break;
+ case IDC_HISTORY:
+ SendMessage(hwndDlg, WM_USER + 11, 0, 0);
+ break;
+ case IDC_LOG:
+ SendMessage(hwndDlg, WM_USER + 12, 0, 0);
+ break;
+ case IDC_HISTORYCLEAR:
+ ClearAllHistory();
+ return 0;
+ case IDC_LOGFILEBROWSE:
+ {
+ OPENFILENAME ofn;
+ TCHAR filepath[MAX_PATH] = _T("");
+
+ GetDlgItemText(hwndDlg, IDC_LOGFILE, filepath, sizeof(filepath));
+
+ ZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);//OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = hwndDlg;
+ ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0Log Files (*.log)\0*.log\0All Files (*.*)\0*.*\0");
+ ofn.lpstrFile = filepath;
+ ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.lpstrDefExt = _T("txt");
+
+ if (GetSaveFileName(&ofn))
+ {
+ SetDlgItemText(hwndDlg, IDC_LOGFILE, filepath);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+
+ break;
+ }
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+
+ if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY)
+ {
+ TCHAR temp[MAX_PATH]; temp[0] = _T('\0');
+ GetDlgItemText(hwndDlg, IDC_LOGFILE, opts.logfile, MAX_PATH);
+ if (opts.logfile != NULL && opts.logfile[0] != _T('\0'))
+ CallService(MS_UTILS_PATHTORELATIVET, (WPARAM)opts.logfile, (LPARAM)temp);
+ DBWriteContactSettingTString(NULL, MODULE_NAME, "LogFile", temp);
+ }
+ break;
+ }
+ }
+
+ return ret;
+}
+
+static BOOL CALLBACK PopupOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ BOOL ret;
+
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Do nothing"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Close popup"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Open message window"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Open contact menu"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Open contact details"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("View status message history"));
+
+ SendDlgItemMessage(hwndDlg, IDC_LEFTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Do nothing"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Close popup"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Open message window"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Open contact menu"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("Open contact details"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFTACTION, CB_ADDSTRING, 0, (LONG) TranslateT("View status message history"));
+
+ // Needs to be called here in this case
+ ret = SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+
+ SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ SendMessage(hwndDlg, WM_USER + 11, 0, 0);
+ SendMessage(hwndDlg, WM_USER + 12, 0, 0);
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ SendMessage(hwndDlg, WM_USER + 13, 0, 0);
+#endif
+
+ return ret;
+ }
+ case WM_USER + 10:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PUBGCOLOR), IsDlgButtonChecked(hwndDlg, IDC_COLORCUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PUTEXTCOLOR), IsDlgButtonChecked(hwndDlg, IDC_COLORCUSTOM));
+ break;
+ case WM_USER + 11:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_SPIN), IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM));
+ break;
+ case WM_USER + 12:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IFCHANGED), IsDlgButtonChecked(hwndDlg, IDC_ONCONNECT));
+ break;
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ case WM_USER + 13:
+ {
+ BOOL state = !IsDlgButtonChecked(hwndDlg, IDC_USEOSD);
+ if (state) SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PUBGCOLOR), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PUTEXTCOLOR), state);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORTYPE), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LEFTCLICK), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTCLICK), state);
+ break;
+ }
+#endif
+ case WM_COMMAND:
+ {
+ if ((LOWORD(wParam) == IDC_POPUPTEXT || LOWORD(wParam) == IDC_DELAY)
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ return 0;
+ switch (LOWORD(wParam)) //(HIWORD(wParam) == BN_CLICKED)
+ {
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ case IDC_USEOSD:
+ SendMessage(hwndDlg, WM_USER + 13, 0, 0);
+ break;
+#endif
+ case IDC_COLORFROMPU:
+ case IDC_COLORWINDOWS:
+ case IDC_COLORCUSTOM:
+ SendMessage(hwndDlg, WM_USER + 10, 0, 0);
+ break;
+ case IDC_DELAYFROMPU:
+ case IDC_DELAYPERMANENT:
+ case IDC_DELAYCUSTOM:
+ SendMessage(hwndDlg, WM_USER + 11, 0, 0);
+ break;
+ case IDC_ONCONNECT:
+ SendMessage(hwndDlg, WM_USER + 12, 0, 0);
+ break;
+ case IDC_PREVIEW:
+ {
+ STATUSMSGINFO temp_smi;
+ SMCNOTIFY_PUOPTIONS temp_puo;
+
+ ZeroMemory(&temp_smi, sizeof(temp_smi));
+ temp_smi.hContact = NULL;
+ temp_smi.cust = (TCHAR*)mir_alloc0(8 * sizeof(TCHAR));
+ lstrcpy(temp_smi.cust, TranslateT("Contact"));
+ temp_smi.oldstatusmsg = (TCHAR*)mir_alloc0(19 * sizeof(TCHAR));
+ lstrcpy(temp_smi.oldstatusmsg, TranslateT("Old status message"));
+ temp_smi.newstatusmsg = (TCHAR*)mir_alloc0(19 * sizeof(TCHAR));
+ lstrcpy(temp_smi.newstatusmsg, TranslateT("New status message"));
+
+ ZeroMemory(&temp_puo, sizeof(temp_puo));
+ if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
+ temp_puo.bDelayType = POPUP_DELAY_DEFAULT;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM))
+ {
+ temp_puo.bDelayType = POPUP_DELAY_CUSTOM;
+ temp_puo.dDelay = GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE);
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
+ temp_puo.bDelayType = POPUP_DELAY_PERMANENT;
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORFROMPU))
+ temp_puo.bColorType = POPUP_COLOR_DEFAULT;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_COLORWINDOWS))
+ temp_puo.bColorType = POPUP_COLOR_WINDOWS;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_COLORCUSTOM))
+ {
+ temp_puo.bColorType = POPUP_COLOR_CUSTOM;
+ temp_puo.colBack = SendDlgItemMessage(hwndDlg,IDC_PUBGCOLOR,CPM_GETCOLOUR,0,0);
+ temp_puo.colText = SendDlgItemMessage(hwndDlg,IDC_PUTEXTCOLOR,CPM_GETCOLOUR,0,0);
+ }
+ GetDlgItemText(hwndDlg, IDC_POPUPTEXT, temp_puo.text, TEMPLATEMAXLEN);
+
+ PopupNotify(&temp_smi, &temp_puo);
+ MIR_FREE(temp_smi.cust);
+ MIR_FREE(temp_smi.oldstatusmsg);
+ MIR_FREE(temp_smi.newstatusmsg);
+ return 0;
+ }
+ }
+ break;
+ }
+ }
+
+ return SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+}
+
+extern int OptionsInit(WPARAM wParam, LPARAM lParam) {
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp, sizeof(odp));
+ odp.cbSize = sizeof(odp);
+ odp.position = 0;
+ odp.hInstance = hInst;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+
+ if(ServiceExists(MS_POPUP_ADDPOPUPEX)
+#ifdef UNICODE
+ || ServiceExists(MS_POPUP_ADDPOPUPW)
+#endif
+ )
+ {
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
+ odp.ptszGroup = TranslateT("Popups");
+ odp.ptszTitle = TranslateT(PLUGIN_NAME);
+ odp.pfnDlgProc = PopupOptionsDlgProc;
+// odp.expertOnlyControls = popupsExpertControls;
+// odp.nExpertOnlyControls = sizeof(popupsExpertControls);
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ }
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.ptszGroup = TranslateT("History");
+ odp.ptszTitle = TranslateT(PLUGIN_NAME);
+ odp.ptszTab = TranslateT("General");
+ odp.pfnDlgProc = OptionsDlgProc;
+// odp.expertOnlyControls = optionsExpertControls;
+// odp.nExpertOnlyControls = sizeof(optionsExpertControls);
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_EXPERTONLY;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADVANCED);
+ odp.ptszTab = TranslateT("Advanced");
+ odp.pfnDlgProc = AdvancedDlgProc;
+// odp.expertOnlyControls = optionsExpertControls;
+// odp.nExpertOnlyControls = sizeof(optionsExpertControls);
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_IGNORE);
+ odp.ptszTab = TranslateT("Ignore");
+ odp.pfnDlgProc = IgnoreDlgProc;
+// odp.expertOnlyControls = optionsExpertControls;
+// odp.nExpertOnlyControls = sizeof(optionsExpertControls);
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ return 0;
+}
diff --git a/Plugins/smcnotify/options.h b/Plugins/smcnotify/options.h
new file mode 100644
index 0000000..c08ab68
--- /dev/null
+++ b/Plugins/smcnotify/options.h
@@ -0,0 +1,104 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 __SMCNOTIFY_OPTIONS_H
+#define __SMCNOTIFY_OPTIONS_H
+
+#define TEMPLATEMAXLEN 1024
+
+typedef struct {
+ BYTE bIgnoreRemove;
+ BYTE bLogEnable;
+#ifdef UNICODE
+ BYTE bLogAscii;
+#endif
+ BYTE bHistoryEnable;
+ WORD dHistoryMax;
+ BYTE bDBEnable;
+ BYTE bListUseBkImage;
+ COLORREF colListBack;
+ COLORREF colListText;
+ //strings
+ TCHAR msgremoved[TEMPLATEMAXLEN];
+ TCHAR msgchanged[TEMPLATEMAXLEN];
+ TCHAR history[TEMPLATEMAXLEN];
+ TCHAR log[TEMPLATEMAXLEN];
+ TCHAR logfile[MAX_PATH];
+ TCHAR listbkimage[MAX_PATH];
+} SMCNOTIFY_OPTIONS;
+
+SMCNOTIFY_OPTIONS opts;
+
+typedef struct {
+ BYTE bEnable;
+ BYTE bOnConnect;
+ BYTE bIfChanged;
+ BYTE bIgnoreRemove;
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ BYTE bUseOSD;
+#endif
+ WORD bColorType;
+ COLORREF colBack;
+ COLORREF colText;
+ WORD dDelay;
+ WORD bDelayType;
+ WORD LeftClickAction;
+ WORD RightClickAction;
+ TCHAR text[TEMPLATEMAXLEN];
+} SMCNOTIFY_PUOPTIONS;
+
+SMCNOTIFY_PUOPTIONS puopts;
+
+void ClearAllHistory();
+
+BOOL AllowProtocol(const char *proto);
+
+void LoadOptions(void);
+int OptionsInit(WPARAM wParam, LPARAM lParam);
+int UserInfoInit(WPARAM wParam, LPARAM lParam);
+
+BOOL CALLBACK IgnoreDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+#define POPUP_DELAY_DEFAULT 0
+#define POPUP_DELAY_CUSTOM 1
+#define POPUP_DELAY_PERMANENT 2
+
+#define POPUP_COLOR_DEFAULT 0
+#define POPUP_COLOR_WINDOWS 1
+#define POPUP_COLOR_CUSTOM 2
+
+#define POPUP_ACTION_NOTHING 0
+#define POPUP_ACTION_CLOSE 1
+#define POPUP_ACTION_MESSAGE 2
+#define POPUP_ACTION_MENU 3
+#define POPUP_ACTION_INFO 4
+#define POPUP_ACTION_HISTORY 5
+
+#define DEFAULT_TEMPLATE_POPUP "changed his/her status message to %n"
+#define DEFAULT_TEMPLATE_HISTORY "[%Y/%M/%D %h:%m %a]\\n%n"
+#define DEFAULT_TEMPLATE_REMOVED "removes his/her status message"
+#define DEFAULT_TEMPLATE_CHANGED "changes his/her status message to %n"
+#define DEFAULT_TEMPLATE_LOG "[%Y/%M/%D %h:%m %a] %c: %n"
+
+#define DEFAULT_BGIMAGE_FILENAME "SMCNotify.bmp"
+#define DEFAULT_LOG_FILENAME "SMCNotify.txt"
+
+#endif // __SMCNOTIFY_OPTIONS_H
diff --git a/Plugins/smcnotify/popup.c b/Plugins/smcnotify/popup.c
new file mode 100644
index 0000000..d9eef61
--- /dev/null
+++ b/Plugins/smcnotify/popup.c
@@ -0,0 +1,203 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+
+void PopupNotify(STATUSMSGINFO *smi, SMCNOTIFY_PUOPTIONS *puo) {
+ POPUPDATAT ppd;
+ TCHAR *str = GetStr(smi, puo->text);
+
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ if (ServiceExists("OSD/Announce") && puo->bUseOSD)
+ {
+ int timerOSD = options.bInfiniteDelay ? 2147483647 : (int)(options.dSec * 1000);
+ //char *szOSDText = (char*)smi->cust;
+ //lstrcat(szOSDText, options.popuptext);
+ CallService("OSD/Announce", (WPARAM)str, timerOSD);
+ MIR_FREE(str);
+ return;
+ }
+#endif
+
+ ZeroMemory(&ppd, sizeof(ppd));
+ ppd.lchContact = smi->hContact;
+ ppd.lchIcon = LoadSkinnedProtoIcon(smi->proto, DBGetContactSettingWord(smi->hContact, smi->proto, "Status", ID_STATUS_ONLINE));
+ lstrcpyn(ppd.lptzContactName, smi->cust, MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, str, MAX_SECONDLINE);
+ if (puo->bColorType == POPUP_COLOR_DEFAULT)
+ {
+ ppd.colorBack = 0;
+ ppd.colorText = 0;
+ }
+ else if (puo->bColorType == POPUP_COLOR_WINDOWS)
+ {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else if (puo->bColorType == POPUP_COLOR_CUSTOM)
+ {
+ ppd.colorBack = puo->colBack;
+ ppd.colorText = puo->colText;
+ }
+ ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ ppd.PluginData = NULL;
+ if (puo->bDelayType == POPUP_DELAY_DEFAULT)
+ ppd.iSeconds = 0;
+ else if (puo->bDelayType == POPUP_DELAY_CUSTOM)
+ ppd.iSeconds = puo->dDelay;
+ else if (puo->bDelayType == POPUP_DELAY_PERMANENT)
+ ppd.iSeconds = -1;
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+
+ MIR_FREE(str);
+ return;
+}
+
+// return TRUE if timeout is over
+static BOOL TimeoutCheck(HANDLE hContact, const char *module, const char *setting) {
+ if (DBGetContactSettingDword(hContact, module, setting, 0) == 1) return TRUE;
+ if ((GetTickCount() - DBGetContactSettingDword(hContact, module, setting, 0)) > TMR_CONNECTIONTIMEOUT)
+ {
+ DBWriteContactSettingDword(hContact, module, setting, 1);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void PopupCheck(STATUSMSGINFO *smi) {
+ BOOL ret = TRUE;
+
+ if (puopts.bOnConnect && !puopts.bIfChanged && (smi->compare == 0))
+ smi->ignore = SMII_ALL;
+
+ if (puopts.bIgnoreRemove && (smi->compare == 2))
+ ret = FALSE;
+
+ else if (!TimeoutCheck(NULL, MODULE_NAME, smi->proto))
+ ret = (puopts.bOnConnect && (smi->compare || !puopts.bIfChanged));
+
+ else if ((BOOL)DBGetContactSettingByte(NULL, MODULE_NAME, "IgnoreAfterStatusChange", 0))
+ ret = TimeoutCheck(smi->hContact, "UserOnline", "LastStatusChange");
+
+ if (ret)
+ {
+ PopupNotify(smi, &puopts);
+ SkinPlaySound("smcnotify");
+ }
+
+ return;
+}
+
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+ DWORD ID;
+ HANDLE hContact;
+ hContact = PUGetContact(hWnd);
+ switch (msg)
+ {
+ case WM_COMMAND:
+ case WM_CONTEXTMENU:
+ if (msg == WM_COMMAND) // left click
+ ID = puopts.LeftClickAction;
+ else if (msg == WM_CONTEXTMENU) // right click
+ ID = puopts.RightClickAction;
+
+ if (ID == POPUP_ACTION_CLOSE) PUDeletePopUp(hWnd);
+ SendMessage(hPopupWindow, WM_USER + 10 + ID, (WPARAM)hContact, 0);
+ break;
+ }
+
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+}
+
+static LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+ if ((HANDLE)wParam != NULL)
+ {
+ switch (msg - WM_USER - 10)
+ {
+ case POPUP_ACTION_MESSAGE: // open message window
+ CallService(MS_MSG_SENDMESSAGE, wParam, 0);
+ CallService("SRMsg/LaunchMessageWindow", wParam, (LONG)NULL);
+ break;
+ case POPUP_ACTION_MENU: // display contact menu
+ {
+ int retcmd;
+ POINT pt;
+ HMENU hMenu;
+ hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, wParam, 0);
+ GetCursorPos(&pt);
+ retcmd = TrackPopupMenu(hMenu, TPM_NONOTIFY | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(retcmd, MPCF_CONTACTMENU), (LPARAM)wParam);
+ DestroyMenu(hMenu);
+ break;
+ }
+ case POPUP_ACTION_INFO: // display contact detail
+ CallService(MS_USERINFO_SHOWDIALOG, wParam, 0);
+ break;
+ case POPUP_ACTION_HISTORY: // view status message history
+ if (ServiceExists("UserInfo/Reminder/AggrassiveBackup"))
+ DBWriteContactSettingTString(NULL, "UserInfoEx", "LastItem", TranslateT("Status Message History"));
+ else
+ DBWriteContactSettingTString(NULL, "UserInfo", "LastTab", TranslateT("Status Message History"));
+ CallService(MS_USERINFO_SHOWDIALOG, wParam, 0);
+ break;
+ }
+ }
+ if (msg == WM_MEASUREITEM) // Needed by the contact's context menu
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+ else if (msg == WM_DRAWITEM) // Needed by the contact's context menu
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+}
+
+extern void InitPopups(void) {
+ if(ServiceExists(MS_POPUP_ADDPOPUPEX)
+#ifdef UNICODE
+ || ServiceExists(MS_POPUP_ADDPOPUPW)
+#endif
+ )
+ {
+ PopupActive = TRUE;
+
+ //Window needed for popup commands
+ hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), _T(MODULE_NAME) _T("_PopupWindow"),
+ 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
+ NULL, hInst, NULL);
+ SetWindowLong(hPopupWindow, GWL_WNDPROC, (LONG)(WNDPROC)PopupWndProc);
+
+ }
+ else PopupActive = FALSE;
+
+ return;
+}
+
+extern void DeinitPopups(void) {
+ if (hPopupWindow)
+ {
+ SendMessage(hPopupWindow, WM_CLOSE, 0, 0);
+ }
+
+ return;
+}
diff --git a/Plugins/smcnotify/popup.h b/Plugins/smcnotify/popup.h
new file mode 100644
index 0000000..7a7b100
--- /dev/null
+++ b/Plugins/smcnotify/popup.h
@@ -0,0 +1,37 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 __SMCNOTIFY_POPUP_H
+#define __SMCNOTIFY_POPUP_H
+
+
+BOOL PopupActive;
+HANDLE hPopupWindow;
+
+void PopupNotify(STATUSMSGINFO *smi, SMCNOTIFY_PUOPTIONS *puo);
+void PopupCheck(STATUSMSGINFO *smi);
+
+void InitPopups(void);
+void DeinitPopups(void);
+
+#define TMR_CONNECTIONTIMEOUT 6000
+
+#endif // __SMCNOTIFY_POPUP_H
diff --git a/Plugins/smcnotify/res/history.ico b/Plugins/smcnotify/res/history.ico
new file mode 100644
index 0000000..d5be5c7
--- /dev/null
+++ b/Plugins/smcnotify/res/history.ico
Binary files differ
diff --git a/Plugins/smcnotify/res/list.ico b/Plugins/smcnotify/res/list.ico
new file mode 100644
index 0000000..208563a
--- /dev/null
+++ b/Plugins/smcnotify/res/list.ico
Binary files differ
diff --git a/Plugins/smcnotify/res/log.ico b/Plugins/smcnotify/res/log.ico
new file mode 100644
index 0000000..035e779
--- /dev/null
+++ b/Plugins/smcnotify/res/log.ico
Binary files differ
diff --git a/Plugins/smcnotify/res/popup.ico b/Plugins/smcnotify/res/popup.ico
new file mode 100644
index 0000000..57a1a25
--- /dev/null
+++ b/Plugins/smcnotify/res/popup.ico
Binary files differ
diff --git a/Plugins/smcnotify/res/popup_no.ico b/Plugins/smcnotify/res/popup_no.ico
new file mode 100644
index 0000000..16bef45
--- /dev/null
+++ b/Plugins/smcnotify/res/popup_no.ico
Binary files differ
diff --git a/Plugins/smcnotify/res/url.ico b/Plugins/smcnotify/res/url.ico
new file mode 100644
index 0000000..a0fcf7b
--- /dev/null
+++ b/Plugins/smcnotify/res/url.ico
Binary files differ
diff --git a/Plugins/smcnotify/resource.h b/Plugins/smcnotify/resource.h
new file mode 100644
index 0000000..dcbb99f
--- /dev/null
+++ b/Plugins/smcnotify/resource.h
@@ -0,0 +1,91 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+#define IDI_POPUP 101
+#define IDI_NOPOPUP 102
+#define IDI_LIST 103
+#define IDI_URL 104
+#define IDI_HISTORY 105
+#define IDI_LOG 106
+
+#define IDD_HISTORY 110
+#define IDD_POPUP 111
+#define IDD_OPTIONS 113
+#define IDD_ADVANCED 114
+#define IDD_IGNORE 115
+#define IDD_LIST 116
+
+#define IDR_PMENU 200
+
+#define IDC_HISTORYLIST 1000
+#define IDC_CHISTORYCLEAR 1001
+#define IDC_CPOPUP 1002
+#define IDC_CLOG 1003
+#define IDC_CHISTORY 1004
+
+#define IDC_POPUPS 1100
+#define IDC_ONCONNECT 1101
+#define IDC_IFCHANGED 1102
+#define IDC_PUIGNOREREMOVE 1103
+//#define IDC_USEOSD 1104
+#define IDC_PUBGCOLOR 1105
+#define IDC_PUTEXTCOLOR 1106
+#define IDC_COLORFROMPU 1107
+#define IDC_COLORWINDOWS 1108
+#define IDC_COLORCUSTOM 1109
+#define IDC_DELAYFROMPU 1110
+#define IDC_DELAYCUSTOM 1111
+#define IDC_DELAY 1112
+#define IDC_DELAY_SPIN 1113
+#define IDC_DELAYPERMANENT 1114
+#define IDC_POPUPTEXT 1115
+#define IDC_LEFTACTION 1116
+#define IDC_RIGHTACTION 1117
+#define IDC_PREVIEW 1118
+
+#define IDC_IGNOREREMOVE 1200
+#define IDC_LISTAUTOREFRESH 1201
+#define IDC_LISTTEXTCOLOR 1202
+#define IDC_LISTBGCOLOR 1203
+#define IDC_USEBGIMG 1204
+#define IDC_BGIMGFILE 1205
+#define IDC_BGIMGBROWSE 1206
+#define IDC_PROTOCOLS 1207
+
+#define IDC_HISTORY 1300
+#define IDC_HISTORYMAX 1301
+#define IDC_HISTORYMAX_SPIN 1302
+#define IDC_HISTORYTEXT 1303
+#define IDC_HISTORYCLEAR 1304
+#define IDC_MESSAGEWND 1305
+#define IDC_MSGREMOVED 1316
+#define IDC_MSGCHANGED 1317
+#define IDC_LOG 1308
+#define IDC_LOGFILE 1309
+#define IDC_LOGFILEBROWSE 1313
+#define IDC_LOGASCII 1314
+#define IDC_LOGTEXT 1310
+#define IDC_VARS1 1311
+#define IDC_VARS2 1312
+
+#define IDC_IGNORELIST IDC_LIST//1400
+#define IDC_IGNOREPOPUP 1401
+#define IDC_IGNOREHISTORY 1402
+#define IDC_IGNORELOG 1403
+
+#define IDC_LIST 1500
+
+#define IDC_STATIC -1
+#define IDC_EXPERT 2000
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 117
+#define _APS_NEXT_COMMAND_VALUE 40004
+#define _APS_NEXT_CONTROL_VALUE 1049
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/Plugins/smcnotify/resource.rc b/Plugins/smcnotify/resource.rc
new file mode 100644
index 0000000..6fa5b74
--- /dev/null
+++ b/Plugins/smcnotify/resource.rc
@@ -0,0 +1,303 @@
+//Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "resource.h"
+#include "winresrc.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_POPUP ICON DISCARDABLE "res\\popup.ico"
+IDI_NOPOPUP ICON DISCARDABLE "res\\popup_no.ico"
+IDI_LIST ICON DISCARDABLE "res\\list.ico"
+IDI_URL ICON DISCARDABLE "res\\url.ico"
+IDI_HISTORY ICON DISCARDABLE "res\\history.ico"
+IDI_LOG ICON DISCARDABLE "res\\log.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_HISTORY DIALOGEX 0, 0, 224, 154
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ PUSHBUTTON "Clear history",IDC_CHISTORYCLEAR,2,138,50,14
+ EDITTEXT IDC_HISTORYLIST,2,4,220,131,ES_MULTILINE | ES_READONLY |
+ WS_VSCROLL | WS_BORDER//,WS_EX_STATICEDGE
+ CONTROL "&P",IDC_CPOPUP,"MButtonClass",WS_TABSTOP,170,138,16,14,
+ 0x18000000L
+ CONTROL "&H",IDC_CHISTORY,"MButtonClass",WS_TABSTOP,188,138,16,14,
+ 0x18000000L
+ CONTROL "&L",IDC_CLOG,"MButtonClass",WS_TABSTOP,206,138,16,14,
+ 0x18000000L
+END
+
+IDD_POPUP DIALOGEX 0, 0, 314, 240
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "General",IDC_STATIC,0,0,314,70
+ CONTROL "Enable PopUps",IDC_POPUPS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,6,12,202,8
+// CONTROL "Use OSD Plugin instead",IDC_USEOSD,"Button",
+// BS_AUTOCHECKBOX | WS_TABSTOP,200,12,100,8
+ CONTROL "Show PopUps when I connect",IDC_ONCONNECT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,6,26,202,8
+ CONTROL "Only if status message has changed",IDC_IFCHANGED,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,18,40,190,8
+ CONTROL "Ignore empty status messages",IDC_PUIGNOREREMOVE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,6,54,202,8
+ GROUPBOX "Colours",IDC_STATIC,0,86,152,70
+ CONTROL "From PopUp plugin",IDC_COLORFROMPU,"Button",BS_AUTORADIOBUTTON | WS_GROUP,6,98,140,10
+ CONTROL "Use Windows colours",IDC_COLORWINDOWS,"Button",BS_AUTORADIOBUTTON,6,112,140,10
+ CONTROL "Custom",IDC_COLORCUSTOM,"Button",BS_AUTORADIOBUTTON,6,126,140,10
+ CONTROL "",IDC_PUBGCOLOR,"ColourPicker",WS_TABSTOP,6,140,20,12
+ LTEXT "Background",IDC_STATIC,30,142,45,8
+ CONTROL "",IDC_PUTEXTCOLOR,"ColourPicker",WS_TABSTOP,76,140,20,12
+ LTEXT "Text",IDC_STATIC,100,142,45,8
+ GROUPBOX "Delay",IDC_STATIC,155,86,158,56
+ CONTROL "From PopUp plugin",IDC_DELAYFROMPU,"Button",BS_AUTORADIOBUTTON | WS_GROUP,161,98,71,10
+ CONTROL "Custom",IDC_DELAYCUSTOM,"Button",BS_AUTORADIOBUTTON,161,112,48,10
+ EDITTEXT IDC_DELAY,230,110,30,12,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER | NOT WS_BORDER,WS_EX_STATICEDGE
+ CONTROL "",IDC_DELAY_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS |
+ UDS_HOTTRACK,260,111,10,11
+ CONTROL "Permanent",IDC_DELAYPERMANENT,"Button",
+ BS_AUTORADIOBUTTON,161,126,127,8
+ GROUPBOX "Text",IDC_STATIC,0,158,152,34
+ EDITTEXT IDC_POPUPTEXT,6,168,140,20,ES_MULTILINE | ES_AUTOHSCROLL |
+ NOT WS_BORDER,WS_EX_STATICEDGE
+ GROUPBOX "Actions",IDC_STATIC,155,146,158,46
+ LTEXT "Left click",IDC_STATIC,161,160,50,8
+ COMBOBOX IDC_LEFTACTION,213,158,95,60,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ LTEXT "Right click",IDC_STATIC,161,176,50,8
+ COMBOBOX IDC_RIGHTACTION,213,174,95,60,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Preview",IDC_PREVIEW,135,210,44,12
+END
+
+IDD_OPTIONS DIALOGEX 0, 0, 311, 231
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "Status Message Change Notify",IDC_STATIC,4,4,302,28
+ CONTROL "Do not log empty status messages",
+ IDC_IGNOREREMOVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,18,
+ 200,10
+ GROUPBOX "List",IDC_STATIC,4,33,302,56
+ CONTROL "Refresh list automatically",IDC_LISTAUTOREFRESH,"Button",
+ BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,10,44,200,10
+ CONTROL "",IDC_LISTTEXTCOLOR,"ColourPicker",WS_TABSTOP,9,44,18,12
+ CONTROL "",IDC_LISTBGCOLOR,"ColourPicker",WS_TABSTOP,155,44,18,12
+ LTEXT "Text colour",IDC_STATIC,30,46,65,10
+ LTEXT "Background colour",IDC_STATIC,176,46,65,10
+ CONTROL "Use background image",IDC_USEBGIMG,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,58,200,10
+ EDITTEXT IDC_BGIMGFILE,10,72,270,12,ES_AUTOHSCROLL | ES_READONLY | WS_BORDER,
+ PUSHBUTTON "...",IDC_BGIMGBROWSE,284,72,16,12,BS_CENTER
+ GROUPBOX "Protocols",IDC_STATIC,4,89,302,94
+ CTEXT "Disable protocols which you don't wish to be notified for",IDC_STATIC,10,100,290,10
+ CONTROL "",IDC_PROTOCOLS,"SysListView32",LVS_REPORT |
+ LVS_SINGLESEL | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER |
+ LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,100,114,110,64
+END
+
+IDD_ADVANCED DIALOGEX 0, 0, 311, 231
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "History",IDC_STATIC,4,2,302,56
+ CONTROL "Keep history of up to",IDC_HISTORY."Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,15,100,10
+ EDITTEXT IDC_HISTORYMAX,112,14,30,12,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER | NOT WS_BORDER,WS_EX_STATICEDGE
+ CONTROL "",IDC_HISTORYMAX_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS |
+ UDS_HOTTRACK,142,14,10,11
+ LTEXT "status messages",IDC_STATIC,156,15,60,10
+ LTEXT "History template",IDC_STATIC,10,29,50,10
+ EDITTEXT IDC_HISTORYTEXT,75,28,138,24,ES_AUTOHSCROLL | NOT WS_BORDER,
+ WS_EX_STATICEDGE
+ PUSHBUTTON "Clear status messages history for all contacts",IDC_HISTORYCLEAR,
+ 220,14,80,36,BS_MULTILINE
+ GROUPBOX "Message Window",IDC_STATIC,4,58,302,58
+ CONTROL "Show status message changes in message window",
+ IDC_MESSAGEWND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,70,
+ 190,10
+ LTEXT "Message removed",IDC_STATIC,10,85,64,10
+ EDITTEXT IDC_MSGREMOVED,75,84,225,12,ES_AUTOHSCROLL | NOT
+ WS_BORDER,WS_EX_STATICEDGE
+ LTEXT "Message changed",IDC_STATIC,10,99,64,10
+ EDITTEXT IDC_MSGCHANGED,75,98,225,12,ES_AUTOHSCROLL | NOT
+ WS_BORDER,WS_EX_STATICEDGE
+ GROUPBOX "Logging",IDC_STATIC,4,116,302,58
+ CONTROL "Log to",IDC_LOG,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,10,130,64,8
+ EDITTEXT IDC_LOGFILE,75,128,205,12,ES_AUTOHSCROLL | ES_READONLY | WS_BORDER,
+ PUSHBUTTON "...",IDC_LOGFILEBROWSE,284,128,16,12,BS_CENTER
+ CTEXT "You can use %c with log filename to append nicknames",IDC_STATIC,75,144,225,8
+// CTEXT "Use %c in filename if you want to append Contact Custom Nickname",IDC_STATIC,18,144,284,8
+ CONTROL "Log in Ascii",IDC_LOGASCII,"Button",BS_AUTOCHECKBOX | WS_TABSTOP | NOT WS_VISIBLE,18,144,64,8
+ LTEXT "Log template",IDC_STATIC,10,158,50,10
+ EDITTEXT IDC_LOGTEXT,75,156,225,12,ES_AUTOHSCROLL | NOT WS_BORDER,
+ WS_EX_STATICEDGE
+ GROUPBOX "Variables",IDC_STATIC,4,175,302,52
+ EDITTEXT IDC_VARS1,10,184,144,40,ES_MULTILINE | ES_READONLY |
+ NOT WS_BORDER
+ EDITTEXT IDC_VARS2,156,184,144,40,ES_MULTILINE | ES_READONLY |
+ NOT WS_BORDER
+END
+
+IDD_IGNORE DIALOGEX 0, 0, 310, 230
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "",IDC_IGNORELIST,"CListControl",WS_TABSTOP | 0x1d2,4,4,302,170,
+ WS_EX_CLIENTEDGE
+ ICON IDI_POPUP,IDC_IGNOREPOPUP,256,178,12,12,SS_CENTERIMAGE | SS_REALSIZEIMAGE
+ RTEXT "Show PopUps",IDC_STATIC,4,180,238,8
+ ICON IDI_HISTORY,IDC_IGNOREHISTORY,268,192,12,12,SS_CENTERIMAGE | SS_REALSIZEIMAGE
+ RTEXT "Keep History",IDC_STATIC,4,194,238,8
+ ICON IDI_LOG,IDC_IGNORELOG,280,206,12,12,SS_CENTERIMAGE | SS_REALSIZEIMAGE
+ RTEXT "Log To File",IDC_STATIC,4,208,238,8
+END
+
+IDD_LIST DIALOGEX 0, 0, 200, 300
+STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX |
+ WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_CONTROLPARENT
+CAPTION "List Contacts with Status Message"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "List Contacts",IDC_LIST,"SysListView32",LVS_REPORT |
+ LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS |
+ LVS_ALIGNLEFT | WS_TABSTOP,0,0,200,300
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_HISTORY, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 239
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 146
+ END
+
+ IDD_OPT, DIALOG
+ BEGIN
+ VERTGUIDE, 8
+ VERTGUIDE, 72
+ VERTGUIDE, 79
+ VERTGUIDE, 210
+ END
+
+ IDD_OPT_NTF, DIALOG
+ BEGIN
+ LEFTMARGIN, 2
+ RIGHTMARGIN, 312
+ VERTGUIDE, 8
+ VERTGUIDE, 58
+ VERTGUIDE, 63
+ VERTGUIDE, 72
+ VERTGUIDE, 77
+ VERTGUIDE, 181
+ VERTGUIDE, 198
+ VERTGUIDE, 215
+ VERTGUIDE, 306
+ TOPMARGIN, 1
+ BOTTOMMARGIN, 239
+ END
+
+ IDD_OPT_PROTOCOLS, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 216
+ VERTGUIDE, 10
+ VERTGUIDE, 209
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 186
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""resource.h""\r\n"
+ "#include ""winresrc.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Plugins/smcnotify/smc.c b/Plugins/smcnotify/smc.c
new file mode 100644
index 0000000..9af94a7
--- /dev/null
+++ b/Plugins/smcnotify/smc.c
@@ -0,0 +1,401 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+static void LogToFile(STATUSMSGINFO *smi) {
+ HANDLE hFile;
+ TCHAR filename[MAX_PATH] = _T("");
+ TCHAR *p = NULL;
+
+ p = _tcsstr(opts.logfile, _T("%c"));
+ if (p != NULL)
+ {
+ p[1] = _T('s');
+ mir_sntprintf(filename, MAX_PATH, opts.logfile, smi->cust);
+ p[1] = _T('c');
+ }
+ else
+ lstrcpyn(filename, opts.logfile, MAX_PATH);
+
+ hFile = CreateFile(filename/*opts.logfile*/, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ TCHAR *buffer = GetStr(smi, opts.log);
+
+ if (buffer != NULL && buffer[0] != _T('\0'))
+ {
+ DWORD dwWritten;
+
+ SetFilePointer(hFile, 0, 0, FILE_END);
+#ifdef UNICODE
+ if (opts.bLogAscii)
+ {
+ char *bufferA = mir_dupToAscii(buffer);
+ WriteFile(hFile, bufferA, lstrlenA(bufferA), &dwWritten, NULL);
+ WriteFile(hFile, "\r\n", 2, &dwWritten, NULL);
+ mir_free(bufferA);
+ }
+ else
+#endif
+ {
+ WriteFile(hFile, buffer, lstrlen(buffer) * sizeof(TCHAR), &dwWritten, NULL);
+ WriteFile(hFile, _T("\r\n"), 2 * sizeof(TCHAR), &dwWritten, NULL);
+ }
+
+ mir_free(buffer);
+ }
+ CloseHandle(hFile);
+ }
+
+ return;
+}
+
+static void AddToHistory(STATUSMSGINFO *smi) {
+ WORD historyFirst, historyLast, historyMax;
+// TCHAR *p;
+
+ historyMax = DBGetContactSettingWord(smi->hContact, MODULE_NAME, "HistoryMax", opts.dHistoryMax);
+ if (historyMax <= 0)
+ return;
+ else if (historyMax > 99)
+ historyMax = 99;
+
+ historyFirst = DBGetContactSettingWord(smi->hContact, MODULE_NAME, "HistoryFirst", 0);
+ if (historyFirst >= historyMax)
+ historyFirst = 0;
+ historyLast = DBGetContactSettingWord(smi->hContact, MODULE_NAME, "HistoryLast", 0);
+ if (historyLast >= historyMax)
+ historyLast = historyMax - 1;
+
+ //fix CR/LF from SimpleAway
+// p = &smi->newstatusmsg[0];
+// while (p = _tcsstr(p, _T("\n")))
+// {
+// if (p == &smi->newstatusmsg[0] || p[-1] != _T('\r'))
+// p[0] = _T('\r');
+// }
+
+ //write old status message and its timestamp seperately
+ DBWriteContactSettingTString(smi->hContact, MODULE_NAME, BuildSetting(historyLast, NULL), smi->newstatusmsg);
+ DBWriteContactSettingDword(smi->hContact, MODULE_NAME, BuildSetting(historyLast, "_ts"), smi->dTimeStamp);
+
+ historyLast = (historyLast + 1) % historyMax;
+ DBWriteContactSettingWord(smi->hContact, MODULE_NAME, "HistoryLast", historyLast);
+ if (historyLast == historyFirst)
+ DBWriteContactSettingWord(smi->hContact, MODULE_NAME, "HistoryFirst", (WORD)((historyFirst + 1) % historyMax));
+
+ return;
+}
+
+//return values:
+// 0 - No window found
+// 1 - Window found
+static BOOL MsgWindowCheck(HANDLE hContact) {
+ MessageWindowData mwd;
+ MessageWindowInputData mwid;
+ mwid.cbSize = sizeof(MessageWindowInputData);
+ mwid.hContact = hContact;
+ mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
+ mwd.cbSize = sizeof(MessageWindowData);
+ mwd.hContact = hContact;
+ if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd))
+ {
+ if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS)) return 1;
+ }
+ return 0;
+}
+
+// Returns true if the unicode buffer only contains 7-bit characters.
+static BOOL IsUnicodeAscii(const WCHAR * pBuffer, int nSize) {
+ BOOL bResult = TRUE;
+ int nIndex;
+
+ for (nIndex = 0; nIndex < nSize; nIndex++) {
+ if (pBuffer[nIndex] > 0x7F) {
+ bResult = FALSE;
+ break;
+ }
+ }
+ return bResult;
+}
+
+static void AddToDB(STATUSMSGINFO *smi) {
+ TCHAR *buffer = NULL;
+
+ if (smi->compare == 2)
+ buffer = GetStr(smi, opts.msgremoved);
+ else if (smi->compare == 1)
+ buffer = GetStr(smi, opts.msgchanged);
+
+ if (buffer != NULL && buffer[0] != _T('\0'))
+ {
+ DBEVENTINFO dbei = {0};
+#ifdef UNICODE
+ size_t needed, len, size;
+ BYTE *tmp = NULL;
+
+ needed = WideCharToMultiByte(CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL);
+ len = lstrlen(buffer);
+
+ if (/*opts.history_only_ansi_if_possible && */IsUnicodeAscii(buffer, len))
+ size = needed;
+ else
+ size = needed + (len + 1) * sizeof(WCHAR);
+
+ tmp = (BYTE*)mir_alloc0(size);
+
+ WideCharToMultiByte(CP_ACP, 0, buffer, -1, (char*)tmp, needed, NULL, NULL);
+
+ if (size > needed)
+ lstrcpyn((WCHAR*)&tmp[needed], buffer, len + 1);
+
+ //ZeroMemory(&dbei, sizeof(dbei));
+ dbei.cbSize = sizeof(dbei);
+ dbei.pBlob = tmp;
+ dbei.cbBlob = size;
+#else
+ dbei.pBlob = (PBYTE)buffer;
+ dbei.cbBlob = lstrlen(buffer) + 1;
+#endif
+
+ dbei.eventType = EVENTTYPE_STATUSCHANGE;
+ dbei.flags = 0;
+ dbei.timestamp = smi->dTimeStamp;
+ dbei.szModule = smi->proto;
+ CallService(MS_DB_EVENT_ADD, (WPARAM)smi->hContact, (LPARAM)&dbei);
+#ifdef UNICODE
+ mir_free(tmp);
+#endif
+ }
+ mir_free(buffer);
+
+ return;
+}
+
+static int __inline CheckStr(char *str, int not_empty, int empty) {
+ if (str == NULL || str[0] == '\0')
+ return empty;
+ else
+ return not_empty;
+}
+
+#ifdef UNICODE
+
+static int __inline CheckStrW(WCHAR *str, int not_empty, int empty) {
+ if (str == NULL || str[0] == L'\0')
+ return empty;
+ else
+ return not_empty;
+}
+
+#endif
+
+static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) {
+ DBVARIANT dbv_old;
+ int ret;
+
+ switch (cws_new->value.type)
+ {
+ case DBVT_DELETED:
+ smi->newstatusmsg = NULL;
+ break;
+ case DBVT_ASCIIZ:
+#ifdef UNICODE
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(cws_new->value.pszVal, CP_ACP));
+ break;
+ case DBVT_UTF8:
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(cws_new->value.pszVal, CP_UTF8));
+ break;
+ case DBVT_WCHAR:
+ smi->newstatusmsg = (CheckStrW(cws_new->value.pwszVal, 0, 1) ? NULL : mir_wstrdup(cws_new->value.pwszVal));
+#else
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_strdup(cws_new->value.pszVal));
+#endif
+ break;
+ default:
+ smi->newstatusmsg = NULL;
+ break;
+ }
+
+ if (!
+#ifdef UNICODE
+ DBGetContactSettingW(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old)
+#else
+ DBGetContactSetting(smi->hContact, "UserOnline", "OldStatusMsg", &dbv_old)
+#endif
+ )
+ {
+ switch (dbv_old.type)
+ {
+ case DBVT_ASCIIZ:
+#ifdef UNICODE
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(dbv_old.pszVal, CP_ACP));
+ break;
+ case DBVT_UTF8:
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_dupToUnicodeEx(dbv_old.pszVal, CP_UTF8));
+ break;
+ case DBVT_WCHAR:
+ smi->oldstatusmsg = (CheckStrW(dbv_old.pwszVal, 0, 1) ? NULL : mir_wstrdup(dbv_old.pwszVal));
+#else
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_strdup(dbv_old.pszVal));
+#endif
+ break;
+ default:
+ smi->oldstatusmsg = NULL;
+ break;
+ }
+
+ if (cws_new->value.type == DBVT_DELETED)
+ if (
+#ifdef UNICODE
+ dbv_old.type == DBVT_WCHAR)
+ ret = CheckStrW(dbv_old.pwszVal, 2, 0);
+ else if (dbv_old.type == DBVT_UTF8 ||
+#endif
+ dbv_old.type == DBVT_ASCIIZ)
+ ret = CheckStr(dbv_old.pszVal, 2, 0);
+ else
+ ret = 2;
+ else if (dbv_old.type != cws_new->value.type)
+#ifdef UNICODE
+ ret = (lstrcmpW(smi->newstatusmsg, smi->oldstatusmsg) ? CheckStrW(smi->newstatusmsg, 1, 2) : 0);
+#else
+ ret = 1;
+#endif;
+ else if (dbv_old.type == DBVT_ASCIIZ)
+ ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0);
+#ifdef UNICODE
+ else if (dbv_old.type == DBVT_UTF8)
+ ret = (lstrcmpA(cws_new->value.pszVal, dbv_old.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0);
+ else if (dbv_old.type == DBVT_WCHAR)
+ ret = (lstrcmpW(cws_new->value.pwszVal, dbv_old.pwszVal) ? CheckStrW(cws_new->value.pwszVal, 1, 2) : 0);
+#endif
+ DBFreeVariant(&dbv_old);
+ }
+ else
+ {
+ if (cws_new->value.type == DBVT_DELETED)
+ ret = 0;
+ else if (
+#ifdef UNICODE
+ cws_new->value.type == DBVT_WCHAR)
+ ret = CheckStrW(cws_new->value.pwszVal, 1, 0);
+ else if (cws_new->value.type == DBVT_UTF8 ||
+#endif
+ cws_new->value.type == DBVT_ASCIIZ)
+ ret = CheckStr(cws_new->value.pszVal, 1, 0);
+ else
+ ret = 1;
+
+ smi->oldstatusmsg = NULL;
+ }
+
+ return ret;
+}
+
+static BOOL ProtocolEnabled(const char *proto) {
+ char setting[256];
+
+ if (proto == NULL)
+ return FALSE;
+
+ if (!AllowProtocol(proto))
+ return FALSE;
+
+ mir_snprintf(setting, sizeof(setting), "%sEnabled", proto);
+ return (BOOL)DBGetContactSettingByte(NULL, MODULE_NAME, setting, TRUE);
+}
+
+extern int ContactSettingChanged(WPARAM wParam, LPARAM lParam) {
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
+ STATUSMSGINFO smi;
+
+ if ((HANDLE)wParam == NULL) return 0;
+
+ ZeroMemory(&smi, sizeof(smi));
+ smi.proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if (!ProtocolEnabled(smi.proto)) return 0;
+
+ if (!lstrcmpA(cws->szModule, "CList") && !lstrcmpA(cws->szSetting, "StatusMsg"))
+ {
+ if (smi.proto != NULL && CallProtoService(smi.proto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE)
+ {
+ smi.hContact = (HANDLE)wParam;
+ smi.ignore = DBGetContactSettingDword(smi.hContact, "Ignore", MODULE_NAME, 0);
+ if (smi.ignore == SMII_ALL) return 0;
+
+ smi.compare = CompareStatusMsg(&smi, cws);
+ if ((smi.compare == 0) || (opts.bIgnoreRemove && puopts.bIgnoreRemove && (smi.compare == 2)))
+ return FreeSmiStr(&smi);
+
+ if (DBGetContactSettingByte(NULL, MODULE_NAME, "IgnoreTlenAway", 0))
+ {
+ int len = lstrlen(smi.newstatusmsg);
+ if (smi.newstatusmsg[len-13] == _T('[') && smi.newstatusmsg[len-10] == _T(':') && smi.newstatusmsg[len-7] == _T(' ') &&
+ smi.newstatusmsg[len-4] == _T('.') && smi.newstatusmsg[len-1] == _T(']'))
+ return FreeSmiStr(&smi);
+ }
+
+ if (cws->value.type == DBVT_DELETED)
+ {
+ DBDeleteContactSetting(smi.hContact, "UserOnline", "OldStatusMsg");
+ }
+ else
+ {
+ DBCONTACTWRITESETTING cws_old;
+ cws_old.szModule = "UserOnline";
+ cws_old.szSetting = "OldStatusMsg";
+ cws_old.value = cws->value;
+ CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)smi.hContact, (LPARAM)&cws_old);
+ }
+ smi.cust = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR);
+ smi.dTimeStamp = (DWORD)time(NULL);
+
+ if (puopts.bEnable && !(smi.ignore & SMII_POPUP))
+ PopupCheck(&smi);
+
+ if (opts.bIgnoreRemove && (smi.ignore == 2))
+ smi.ignore = SMII_ALL;
+
+ if (opts.bDBEnable && MsgWindowCheck(smi.hContact))
+ AddToDB(&smi);
+
+ if (opts.bHistoryEnable && !(smi.ignore & SMII_HISTORY))
+ AddToHistory(&smi);
+
+ if (opts.bLogEnable && !(smi.ignore & SMII_LOG))
+ LogToFile(&smi);
+
+ FreeSmiStr(&smi);
+ }
+ }
+ else
+ {
+ if (!lstrcmpA(cws->szSetting, "Status") && !lstrcmpA(cws->szModule, smi.proto))
+ {
+ DBWriteContactSettingDword((HANDLE)wParam, "UserOnline", "LastStatusChange", GetTickCount());
+ }
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/Plugins/smcnotify/smc.h b/Plugins/smcnotify/smc.h
new file mode 100644
index 0000000..e40d717
--- /dev/null
+++ b/Plugins/smcnotify/smc.h
@@ -0,0 +1,46 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 __SMCNOTIFY_SMC_H
+#define __SMCNOTIFY_SMC_H
+
+
+typedef struct {
+ HANDLE hContact;
+ TCHAR *cust;
+ TCHAR *oldstatusmsg;
+ TCHAR *newstatusmsg;
+ char *proto;
+ int compare;
+ DWORD ignore;
+ DWORD dTimeStamp;
+} STATUSMSGINFO;
+
+#define EVENTTYPE_STATUSCHANGE 25368
+
+#define SMII_POPUP 1
+#define SMII_HISTORY 2
+#define SMII_LOG 4
+#define SMII_ALL 7
+
+int ContactSettingChanged(WPARAM wParam, LPARAM lParam);
+
+#endif // __SMCNOTIFY_SMC_H
diff --git a/Plugins/smcnotify/smcn.dsp b/Plugins/smcnotify/smcn.dsp
new file mode 100644
index 0000000..cb6753d
--- /dev/null
+++ b/Plugins/smcnotify/smcn.dsp
@@ -0,0 +1,194 @@
+# Microsoft Developer Studio Project File - Name="smcn" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=smcn - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "smcn.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "smcn.mak" CFG="smcn - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "smcn - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "smcn - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "smcn - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O1 /YX /FD /c
+# SUBTRACT BASE CPP /Fr
+# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /YX /FD /c
+# SUBTRACT CPP /Fr
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 user32.lib shell32.lib wininet.lib gdi32.lib /nologo /base:"0x67100000" /dll /machine:I386 /filealign:0x200
+# SUBTRACT BASE LINK32 /pdb:none /map
+# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x32100000" /dll /map /machine:I386 /out:"..\..\bin\release\Plugins\smcn.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "smcn - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "smcn___Win32_Debug"
+# PROP BASE Intermediate_Dir "smcn___Win32_Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /FR /YX /FD /c
+# ADD CPP /nologo /G4 /MTd /W3 /GX /ZI /Od /I "../../include" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..bin\release\Plugins\smcn.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x32100000" /dll /debug /machine:I386 /out:"..\..\bin\debug\Plugins\smcn.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "smcn - Win32 Release"
+# Name "smcn - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\dblists.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\history.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\icqsmsg.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\list.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\popup.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\smc.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\dblists.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\smcn.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\resources\hist.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\list.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\list.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\log.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\popup.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\popup_no.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\rename.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\resources\url.ico
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/Plugins/smcnotify/smcn.dsw b/Plugins/smcnotify/smcn.dsw
new file mode 100644
index 0000000..49a03e6
--- /dev/null
+++ b/Plugins/smcnotify/smcn.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "nsn"=".\smcn.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Plugins/smcnotify/smcn.sln b/Plugins/smcnotify/smcn.sln
new file mode 100644
index 0000000..ec2c580
--- /dev/null
+++ b/Plugins/smcnotify/smcn.sln
@@ -0,0 +1,23 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smcn", "smcn.vcproj", "{04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ Unicode Release|Win32 = Unicode Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}.Debug|Win32.Build.0 = Debug|Win32
+ {04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}.Release|Win32.ActiveCfg = Release|Win32
+ {04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}.Release|Win32.Build.0 = Release|Win32
+ {04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
+ {04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Plugins/smcnotify/smcn.vcproj b/Plugins/smcnotify/smcn.vcproj
new file mode 100644
index 0000000..b2e2c9d
--- /dev/null
+++ b/Plugins/smcnotify/smcn.vcproj
@@ -0,0 +1,569 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="smcn"
+ ProjectGUID="{04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}"
+ RootNamespace="smcn"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/smcn.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="0"
+ AdditionalIncludeDirectories="..\..\include;.\include"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Unicode_Release/smcn.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="comctl32.lib"
+ OutputFile="..\..\bin\release\Plugins\smcn.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/smcn.pdb"
+ GenerateMapFile="true"
+ MapFileName=".\Release/smcn.map"
+ BaseAddress="0x32100000"
+ ImportLibrary=".\Release/smcn.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/smcn.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/smcn.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include;include"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/smcn.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="comctl32.lib"
+ OutputFile="c:\tools\Miranda_test\plugins\smcn.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/smcn.pdb"
+ BaseAddress="0x32100000"
+ ImportLibrary=".\Debug/smcn.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/smcn.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Release|Win32"
+ OutputDirectory=".\Unicode_Release"
+ IntermediateDirectory=".\Unicode_Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/smcn.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="0"
+ AdditionalIncludeDirectories="..\..\include;.\include"
+ PreprocessorDefinitions="_UNICODE;UNICODE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Unicode_Release/smcn.pch"
+ AssemblerListingLocation=".\Unicode_Release/"
+ ObjectFile=".\Unicode_Release/"
+ ProgramDataBaseFileName=".\Unicode_Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="comctl32.lib"
+ OutputFile="..\..\bin\release\Plugins\smcnW.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Unicode_Release/smcn.pdb"
+ GenerateMapFile="true"
+ MapFileName=".\Unicode_Release/smcn.map"
+ BaseAddress="0x32100000"
+ ImportLibrary=".\Unicode_Release/smcn.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Unicode_Release/smcn.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="history.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="list.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="main.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="options.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="popup.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="smc.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\utils.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="main.h"
+ >
+ </File>
+ <File
+ RelativePath="resource.h"
+ >
+ </File>
+ <File
+ RelativePath="smcn.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="resources\hist.ico"
+ >
+ </File>
+ <File
+ RelativePath="resources\list.ico"
+ >
+ </File>
+ <File
+ RelativePath="resources\log.ico"
+ >
+ </File>
+ <File
+ RelativePath="resources\popup.ico"
+ >
+ </File>
+ <File
+ RelativePath="resources\popup_no.ico"
+ >
+ </File>
+ <File
+ RelativePath="resource.rc"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="resources\url.ico"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Plugins/smcnotify/smcnotify.c b/Plugins/smcnotify/smcnotify.c
new file mode 100644
index 0000000..bb810a6
--- /dev/null
+++ b/Plugins/smcnotify/smcnotify.c
@@ -0,0 +1,165 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2007 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+// Prototypes ///////////////////////////////////////////////////////////////////////////
+
+PLUGININFO pluginInfo = {
+ sizeof(PLUGININFO),
+ PLUGIN_NAME
+#ifdef CUSTOMBUILD_CATCHICQSTATUSMSG
+ " +ICQ"
+#endif
+#ifdef CUSTOMBUILD_OSDSUPPORT
+ " +OSD"
+#endif
+#ifdef _UNICODE
+ " (Unicode)"
+#endif
+ ,
+ PLUGIN_MAKE_VERSION(0,0,3,17),
+ "Notifies, logs and stores history of your contacts' status messages changes",
+ "Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci",
+ "slotwin@users.berlios.de",
+ "",
+ "http://developer.berlios.de/projects/mgoodies",
+ UNICODE_AWARE,
+ 0
+};
+
+int ProtoAck(WPARAM wParam, LPARAM lParam);
+
+HANDLE heModulesLoaded;
+HANDLE heOptionsInit;
+HANDLE heProtoAck;
+HANDLE hePreBuildCMenu;
+HANDLE heContactSettingChanged;
+HANDLE heUserInfoInit;
+
+// Functions ////////////////////////////////////////////////////////////////////////////
+
+extern BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) {
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+extern __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) {
+/* if (mirandaVersion < PLUGIN_MAKE_VERSION(0,6,6,0))
+ {
+ //not translatable
+ MessageBox(NULL, "Plugin requires Miranda 0.6.6.0 or later to run.", PLUGIN_NAME, MB_OK|MB_ICONERROR);
+ return NULL;
+ }
+*/ return &pluginInfo;
+}
+
+static int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
+
+ CreateServiceFunction(MS_SMCNOTIFY_POPUPS, MenuItemCmd_PopUps);
+ CreateServiceFunction(MS_SMCNOTIFY_LIST, MenuItemCmd_ShowList);
+ CreateServiceFunction(MS_SMCNOTIFY_GOTOURL, MenuItemCmd_GoToURL);
+ hListDlg = NULL;
+
+ InitPopups();
+ LoadIcons();
+ InitMenuItems();
+
+ heContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
+ heUserInfoInit = HookEvent(ME_USERINFO_INITIALISE, UserInfoInit);
+
+ //Register with Updater plugin
+ if (ServiceExists(MS_UPDATE_REGISTER))
+ {
+ Update upd;
+ char szCurrentVersion[30];
+
+ ZeroMemory(&upd, sizeof(upd));
+ upd.cbSize = sizeof(upd);
+ upd.szComponentName = pluginInfo.shortName;
+
+ upd.szUpdateURL = UPDATER_AUTOREGISTER;
+
+ upd.szBetaVersionURL = "http://www.torun.mm.pl/~slotwin/smcnotify/version.txt";
+ upd.szBetaChangelogURL = "http://www.torun.mm.pl/~slotwin/smcnotify/changelog.txt";
+ upd.pbBetaVersionPrefix = (BYTE *)"Status Message Change Notify ";
+ upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix);
+#ifdef UNICODE
+ upd.szBetaUpdateURL = "http://www.torun.mm.pl/~slotwin/smcnotify/smcnotifyW.zip";
+#else
+ upd.szBetaUpdateURL = "http://www.torun.mm.pl/~slotwin/smcnotify/smcnotify.zip";
+#endif
+
+ upd.pbVersion = (BYTE *)CreateVersionStringPlugin(&pluginInfo, szCurrentVersion);
+ upd.cpbVersion = strlen((char *)upd.pbVersion);
+
+ CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd);
+ }
+
+ //Add sound event
+ SkinAddNewSoundEx("smcnotify", Translate("Status Notify"), Translate("User has changed status message"));
+
+ //Add our module to the KnownModules list
+ CallService("DBEditorpp/RegisterSingleModule", (WPARAM)MODULE_NAME, 0);
+
+ return 0;
+}
+
+extern int __declspec(dllexport) Load(PLUGINLINK *link) {
+ INITCOMMONCONTROLSEX icex;
+
+ //Ensure that the common control DLL is loaded.
+ ZeroMemory(&icex, sizeof(icex));
+ icex.dwSize = sizeof(icex);
+ icex.dwICC = ICC_LISTVIEW_CLASSES;
+ InitCommonControlsEx(&icex);
+
+ pluginLink = link;
+
+ init_mir_malloc();
+ LoadOptions();
+
+ //Hooks
+ heModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ heOptionsInit = HookEvent(ME_OPT_INITIALISE, OptionsInit);
+ heProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck); // needed for "show popups when i connect"
+ hePreBuildCMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildCMenu);
+
+ return 0;
+}
+
+extern int __declspec(dllexport) Unload(void) {
+
+ UnhookEvent(heModulesLoaded);
+ UnhookEvent(heOptionsInit);
+ UnhookEvent(heProtoAck);
+ UnhookEvent(hePreBuildCMenu);
+ UnhookEvent(heUserInfoInit);
+ UnhookEvent(heContactSettingChanged);
+
+ DeinitPopups();
+
+ if (hListDlg != NULL)
+ SendMessage(hListDlg, WM_CLOSE, 0, 0);
+
+ return 0;
+}
diff --git a/Plugins/smcnotify/smcnotify.vcproj b/Plugins/smcnotify/smcnotify.vcproj
new file mode 100644
index 0000000..162d0d0
--- /dev/null
+++ b/Plugins/smcnotify/smcnotify.vcproj
@@ -0,0 +1,582 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="smcnotify"
+ ProjectGUID="{04B7DEDD-2BE2-4DA1-8B4A-BDA94CFC74E9}"
+ RootNamespace="smcnotify"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug\smcnotify.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include;.\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SMCNOTIFY_EXPORTS"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ BrowseInformationFile="$(IntDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="comctl32.lib"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ GenerateMapFile="true"
+ BaseAddress="0x32100000"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release\smcnotify.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ AdditionalIncludeDirectories="..\..\include;.\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SMCNOTIFY_EXPORTS"
+ StringPooling="true"
+ ExceptionHandling="0"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderThrough="commonheaders.h"
+ AssemblerOutput="3"
+ BrowseInformationFile="$(IntDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ IgnoreImportLibrary="true"
+ AdditionalDependencies="comctl32.lib"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ GenerateMapFile="true"
+ MapFileName="$(OutDir)/$(ProjectName).map"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ BaseAddress="0x32100000"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug Unicode\smcnotify.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include;.\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;SMCNOTIFY_EXPORTS"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="comctl32.lib"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ BaseAddress="0x32100000"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release Unicode\smcnotify.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="..\..\include;.\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;SMCNOTIFY_EXPORTS"
+ StringPooling="true"
+ ExceptionHandling="0"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile=""
+ AssemblerOutput="3"
+ BrowseInformationFile="$(IntDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ IgnoreImportLibrary="true"
+ AdditionalDependencies="comctl32.lib"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ GenerateMapFile="true"
+ MapFileName="$(OutDir)/$(ProjectName).map"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ BaseAddress="0x32100000"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\history.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ignore.c"
+ >
+ </File>
+ <File
+ RelativePath=".\list.c"
+ >
+ </File>
+ <File
+ RelativePath=".\menu.c"
+ >
+ </File>
+ <File
+ RelativePath="..\utils\mir_memory.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\utils\mir_options.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\options.c"
+ >
+ </File>
+ <File
+ RelativePath=".\popup.c"
+ >
+ </File>
+ <File
+ RelativePath=".\smc.c"
+ >
+ </File>
+ <File
+ RelativePath=".\smcnotify.c"
+ >
+ </File>
+ <File
+ RelativePath=".\utils.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\commonheaders.h"
+ >
+ </File>
+ <File
+ RelativePath=".\m_smcnotify.h"
+ >
+ </File>
+ <File
+ RelativePath=".\menu.h"
+ >
+ </File>
+ <File
+ RelativePath="..\utils\mir_memory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\utils\mir_options.h"
+ >
+ </File>
+ <File
+ RelativePath=".\options.h"
+ >
+ </File>
+ <File
+ RelativePath=".\popup.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\smc.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\resource.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Plugins/smcnotify/utils.c b/Plugins/smcnotify/utils.c
new file mode 100644
index 0000000..01f8834
--- /dev/null
+++ b/Plugins/smcnotify/utils.c
@@ -0,0 +1,238 @@
+/*
+Status Message Change Notify plugin for Miranda IM.
+
+Copyright © 2004-2005 NoName
+Copyright © 2005-2006 Daniel Vijge, Tomasz Słotwiński, Ricardo Pescuma Domenecci
+
+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 "commonheaders.h"
+
+
+#define TMPMAX 1024
+TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) {
+ TCHAR tmp[TMPMAX];
+ TCHAR *str;
+ int i;
+ int len;
+ time_t timestamp;
+ struct tm smsgtime;
+
+ if (tmplt == NULL || tmplt[0] == _T('\0'))
+ return NULL;
+
+ str = (TCHAR*)mir_alloc0(2048 * sizeof(TCHAR));
+ str[0] = _T('\0');
+ len = lstrlen(tmplt);
+
+ if (n->dTimeStamp != 0)
+ timestamp = n->dTimeStamp;
+ else
+ timestamp = time(NULL);
+ ZeroMemory(&smsgtime, sizeof(smsgtime));
+ localtime_s(&smsgtime, &timestamp);
+
+ for (i = 0; i < len; i++)
+ {
+ tmp[0] = _T('\0');
+
+ if (tmplt[i] == _T('%'))
+ {
+ i++;
+ switch (tmplt[i])
+ {
+ case 'n':
+ if (n->compare == 2) lstrcpyn(tmp, TranslateT("<no status message>"), TMPMAX);
+ else lstrcpyn(tmp, n->newstatusmsg, TMPMAX);
+ break;
+ case 'o':
+ if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == _T('\0')) lstrcpyn(tmp, TranslateT("<no status message>"), TMPMAX);
+ else lstrcpyn(tmp, n->oldstatusmsg, TMPMAX);
+ break;
+ case 'c':
+ if (n->cust == NULL || n->cust[0] == _T('\0')) lstrcpyn(tmp, TranslateT("Contact"), TMPMAX);
+ else lstrcpyn(tmp, n->cust, TMPMAX);
+ break;
+ case 'D':
+ mir_sntprintf(tmp, 1024, _T("%02i"), smsgtime.tm_mday);
+ break;
+ case 'M':
+ mir_sntprintf(tmp, TMPMAX, _T("%02i"), smsgtime.tm_mon + 1);
+ break;
+ case 'Y':
+ mir_sntprintf(tmp, TMPMAX, _T("%i"), smsgtime.tm_year + 1900);
+ break;
+ case 'H':
+ mir_sntprintf(tmp, TMPMAX, _T("%i"), smsgtime.tm_hour);
+ break;
+ case 'h':
+ mir_sntprintf(tmp, TMPMAX, _T("%i"), smsgtime.tm_hour%12 == 0 ? 12 : smsgtime.tm_hour%12);
+ break;
+ case 'm':
+ mir_sntprintf(tmp, TMPMAX, _T("%02i"), smsgtime.tm_min);
+ break;
+ case 's':
+ mir_sntprintf(tmp, TMPMAX, _T("%02i"), smsgtime.tm_sec);
+ break;
+ case 'a':
+ if (smsgtime.tm_hour > 11) lstrcpyn(tmp, _T("PM"), TMPMAX);
+ if (smsgtime.tm_hour < 12) lstrcpyn(tmp, _T("AM"), TMPMAX);
+ break;
+ default:
+ //lstrcpyn(tmp, _T("%"), TMPMAX);
+ i--;
+ tmp[0] = tmplt[i]; tmp[1] = _T('\0');
+ break;
+ }
+ }
+ else if (tmplt[i] == _T('\\'))
+ {
+ i++;
+ switch (tmplt[i])
+ {
+ case 'n':
+ //_tcscat_s(tmp, TMPMAX, _T("\r\n"));
+ tmp[0] = _T('\r'); tmp[1] = _T('\n'); tmp[2] = _T('\0');
+ break;
+ case 't':
+ //_tcscat_s(tmp, TMPMAX, _T("\t"));
+ tmp[0] = _T('\t'); tmp[1] = _T('\0');
+ break;
+ default:
+ //lstrcpyn(tmp, _T("\\"), TMPMAX);
+ i--;
+ tmp[0] = tmplt[i]; tmp[1] = _T('\0');
+ break;
+ }
+ }
+ else
+ {
+ tmp[0] = tmplt[i]; tmp[1] = _T('\0');
+ }
+
+ if (tmp[0] != _T('\0'))
+ {
+ if (lstrlen(tmp) + lstrlen(str) < 2044)
+ {
+ lstrcat(str, tmp);
+ }
+ else
+ {
+ lstrcat(str, _T("..."));
+ break;
+ }
+ }
+ }
+ return str;
+}
+
+char* BuildSetting(WORD index, char *suffix) {
+ static char setting[16];
+ mir_snprintf(setting, sizeof(setting), "History_%i%s", index, (suffix == NULL)?"":suffix);
+ return setting;
+}
+
+extern BOOL FreeSmiStr(STATUSMSGINFO *smi) {
+ mir_free(smi->newstatusmsg);
+ mir_free(smi->oldstatusmsg);
+ return 0;
+}
+
+extern WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage)
+{
+ size_t size;
+ WCHAR *tmp;
+
+ if (ptr == NULL)
+ return NULL;
+
+ size = strlen(ptr) + 1;
+ tmp = (WCHAR *) mir_alloc0(size * sizeof(WCHAR));
+
+ MultiByteToWideChar(CodePage, 0, ptr, -1, tmp, size * sizeof(WCHAR));
+
+ return tmp;
+}
+
+extern TCHAR* MyDBGetContactSettingTString_dup(HANDLE hContact, const char *szModule, const char *szSetting, TCHAR *out) {
+ DBVARIANT dbv;
+
+ if (!DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
+ {
+ switch (dbv.type)
+ {
+ case DBVT_ASCIIZ:
+#ifdef UNICODE
+ out = mir_dupToUnicodeEx(dbv.pszVal, CP_ACP);
+ break;
+ case DBVT_UTF8:
+ out = mir_dupToUnicodeEx(dbv.pszVal, CP_UTF8);
+ break;
+ case DBVT_WCHAR:
+ out = mir_wstrdup(dbv.pwszVal);
+#else
+ out = mir_strdup(dbv.pszVal);
+#endif
+ break;
+ default:
+ out = NULL;
+ break;
+ }
+ DBFreeVariant(&dbv);
+ }
+ else
+ {
+ out = NULL;
+ }
+
+ return out;
+}
+
+extern ProtoAck(WPARAM wParam, LPARAM lParam) {
+ ACKDATA *ack = (ACKDATA*)lParam;
+
+ if (ack->type == ACKTYPE_STATUS)
+ {
+ WORD newStatus = (WORD)ack->lParam;
+ WORD oldStatus = (WORD)ack->hProcess;
+ char *proto = (char*)ack->szModule;
+
+ if (oldStatus == newStatus) return 0;
+ if (newStatus == ID_STATUS_OFFLINE)
+ {
+ DBWriteContactSettingDword(NULL, MODULE_NAME, proto, 0);
+ }
+ else if ((oldStatus < ID_STATUS_ONLINE) && (newStatus >= ID_STATUS_ONLINE))
+ {
+ DBWriteContactSettingDword(NULL, MODULE_NAME, proto, GetTickCount());
+ }
+
+ return 0;
+ }
+
+#ifdef CUSTOMBUILD_CATCHICQSTATUSMSG
+ if (ack->type == ACKTYPE_AWAYMSG && !lstrcmpA(ack->szModule, "ICQ"))
+ {
+ if (ack->result == ACKRESULT_SUCCESS && !ServiceExists("SMR/MsgRetrievalEnabledForProtocol"))
+ {
+ DBWriteContactSettingString(ack->hContact, "CList", "StatusMsg", (const char*)ack->lParam);
+ }
+ return 0;
+ }
+#endif
+
+ return 0;
+}