From d1d677615e12d759b6cdf7ce23a493bc055ef37f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 7 Nov 2005 17:20:37 +0100 Subject: Import win32 branch --- Makefile | 8 +- win32.c | 191 ++++++++++++++++++++++++++ win32/BUILD.TXT | 22 +++ win32/MainDlg.cpp | 78 +++++++++++ win32/MainDlg.h | 52 +++++++ win32/PropAccess.cpp | 123 +++++++++++++++++ win32/PropAccess.h | 56 ++++++++ win32/PropConn.cpp | 125 +++++++++++++++++ win32/PropConn.h | 56 ++++++++ win32/PropLog.cpp | 80 +++++++++++ win32/PropLog.h | 47 +++++++ win32/PropPaths.cpp | 119 ++++++++++++++++ win32/PropPaths.h | 55 ++++++++ win32/PropUsers.cpp | 120 ++++++++++++++++ win32/PropUsers.h | 54 ++++++++ win32/TrayNot.cpp | 106 +++++++++++++++ win32/TrayNot.h | 54 ++++++++ win32/bitlbee.dsp | 338 +++++++++++++++++++++++++++++++++++++++++++++ win32/bitlbee.dsw | 107 +++++++++++++++ win32/bitlbee.iss | 73 ++++++++++ win32/bitlbee.rc | 354 ++++++++++++++++++++++++++++++++++++++++++++++++ win32/bitlbee_ssl.dsp | 99 ++++++++++++++ win32/bitlbeewin.cpp | 210 ++++++++++++++++++++++++++++ win32/bitlbeewin.h | 59 ++++++++ win32/configure.mingw32 | 37 +++++ win32/jabber.dsp | 228 +++++++++++++++++++++++++++++++ win32/msn.dsp | 116 ++++++++++++++++ win32/oscar.dsp | 204 ++++++++++++++++++++++++++++ win32/res/bmp00002.bmp | Bin 0 -> 5830 bytes win32/res/icon2.ico | Bin 0 -> 3774 bytes win32/resource.h | 60 ++++++++ win32/yahoo.dsp | 152 +++++++++++++++++++++ 32 files changed, 3382 insertions(+), 1 deletion(-) create mode 100644 win32.c create mode 100644 win32/BUILD.TXT create mode 100644 win32/MainDlg.cpp create mode 100644 win32/MainDlg.h create mode 100644 win32/PropAccess.cpp create mode 100644 win32/PropAccess.h create mode 100644 win32/PropConn.cpp create mode 100644 win32/PropConn.h create mode 100644 win32/PropLog.cpp create mode 100644 win32/PropLog.h create mode 100644 win32/PropPaths.cpp create mode 100644 win32/PropPaths.h create mode 100644 win32/PropUsers.cpp create mode 100644 win32/PropUsers.h create mode 100644 win32/TrayNot.cpp create mode 100644 win32/TrayNot.h create mode 100644 win32/bitlbee.dsp create mode 100644 win32/bitlbee.dsw create mode 100644 win32/bitlbee.iss create mode 100644 win32/bitlbee.rc create mode 100644 win32/bitlbee_ssl.dsp create mode 100644 win32/bitlbeewin.cpp create mode 100644 win32/bitlbeewin.h create mode 100644 win32/configure.mingw32 create mode 100644 win32/jabber.dsp create mode 100644 win32/msn.dsp create mode 100644 win32/oscar.dsp create mode 100644 win32/res/bmp00002.bmp create mode 100644 win32/res/icon2.ico create mode 100644 win32/resource.h create mode 100644 win32/yahoo.dsp diff --git a/Makefile b/Makefile index 80fbbf0b..15243459 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,15 @@ -include Makefile.settings # Program variables -objects = account.o bitlbee.o commands.o conf.o crypting.o help.o ini.o irc.o log.o nick.o query.o set.o unix.o url.o user.o debug.o +objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o nick.o query.o set.o url.o user.o debug.o log.o subdirs = protocols +ifeq ($(ARCH),Windows) +objects += win32.o +else +objects += unix.o conf.o +endif + # Expansion of variables subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) CFLAGS += -Wall diff --git a/win32.c b/win32.c new file mode 100644 index 00000000..5234c046 --- /dev/null +++ b/win32.c @@ -0,0 +1,191 @@ + /********************************************************************\ + * BitlBee -- An IRC to other IM-networks gateway * + * * + * Copyright 2002-2004 Wilmer van der Gaast and others * + \********************************************************************/ + +/* Main file (Unix specific part) */ + +/* + 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 with + the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; + if not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "bitlbee.h" +#include "commands.h" +#include "crypting.h" +#include "protocols/nogaim.h" +#include "help.h" +#include +#include +#include +#include +#include + +global_t global; /* Against global namespace pollution */ + +int main( int argc, char *argv[] ) +{ + int i = -1; + memset( &global, 0, sizeof( global_t ) ); + + global.loop = g_main_new( FALSE ); + + log_init( ); + nogaim_init( ); + + global.conf = conf_load( argc, argv ); + if( global.conf == NULL ) + return( 1 ); + + if( global.conf->runmode == RUNMODE_INETD ) + { + i = bitlbee_inetd_init(); + log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); + + } + else if( global.conf->runmode == RUNMODE_DAEMON ) + { + i = bitlbee_daemon_init(); + log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); + } + else + { + log_message( LOGLVL_INFO, "No bitlbee mode specified..."); + } + + if( i != 0 ) + return( i ); + + if( access( global.conf->configdir, F_OK ) != 0 ) + log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); + else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 ) + log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); + if( help_init( &(global.help) ) == NULL ) + log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); + + g_main_run( global.loop ); + + return( 0 ); +} + +double gettime() +{ + return (GetTickCount() / 1000); +} + +void conf_get_string(HKEY section, const char *name, const char *def, char **dest) +{ + char buf[4096]; + long x; + if (RegQueryValue(section, name, buf, &x) == ERROR_SUCCESS) { + *dest = g_strdup(buf); + } else if (!def) { + *dest = NULL; + } else { + *dest = g_strdup(def); + } +} + + +void conf_get_int(HKEY section, const char *name, int def, int *dest) +{ + char buf[20]; + long x; + DWORD y; + if (RegQueryValue(section, name, buf, &x) == ERROR_SUCCESS) { + memcpy(&y, buf, sizeof(DWORD)); + *dest = y; + } else { + *dest = def; + } +} + +conf_t *conf_load( int argc, char *argv[] ) +{ + conf_t *conf; + HKEY key, key_main, key_proxy; + char *tmp; + RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee", &key); + RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee\\main", &key_main); + RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee\\proxy", &key_proxy); + + memset( &global, 0, sizeof( global_t ) ); + global.loop = g_main_new(FALSE); + nogaim_init(); + + conf = g_new0( conf_t,1 ); + global.conf = conf; + conf_get_string(key_main, "interface", "0.0.0.0", &global.conf->iface); + conf_get_int(key_main, "port", 6667, &global.conf->port); + conf_get_int(key_main, "verbose", 0, &global.conf->verbose); + conf_get_string(key_main, "password", "", &global.conf->password); + conf_get_int(key_main, "ping_interval_timeout", 60, &global.conf->ping_interval); + conf_get_string(key_main, "hostname", "localhost", &global.conf->hostname); + conf_get_string(key_main, "configdir", NULL, &global.conf->configdir); + conf_get_string(key_main, "motdfile", NULL, &global.conf->motdfile); + conf_get_string(key_main, "helpfile", NULL, &global.helpfile); + global.conf->runmode = RUNMODE_INETD; + conf_get_int(key_main, "AuthMode", AUTHMODE_CLOSED, &global.conf->authmode); + conf_get_string(key_proxy, "host", "", &tmp); strcpy(proxyhost, tmp); + conf_get_string(key_proxy, "user", "", &tmp); strcpy(proxyuser, tmp); + conf_get_string(key_proxy, "password", "", &tmp); strcpy(proxypass, tmp); + conf_get_int(key_proxy, "type", PROXY_NONE, &proxytype); + conf_get_int(key_proxy, "port", 3128, &proxyport); + + RegCloseKey(key); + RegCloseKey(key_main); + RegCloseKey(key_proxy); + + return conf; +} + +void conf_loaddefaults( irc_t *irc ) +{ + HKEY key_defaults; + int i; + char name[4096], data[4096]; + DWORD namelen = sizeof(name), datalen = sizeof(data); + DWORD type; + if (RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee\\defaults", &key_defaults) != ERROR_SUCCESS) { + return; + } + + for (i = 0; RegEnumValue(key_defaults, i, name, &namelen, NULL, &type, data, &datalen) == ERROR_SUCCESS; i++) { + set_t *s = set_find( irc, name ); + + if( s ) + { + if( s->def ) g_free( s->def ); + s->def = g_strdup( data ); + } + + namelen = sizeof(name); + datalen = sizeof(data); + } + + RegCloseKey(key_defaults); +} + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +int +inet_aton(const char *cp, struct in_addr *addr) +{ + addr->s_addr = inet_addr(cp); + return (addr->s_addr == INADDR_NONE) ? 0 : 1; +} diff --git a/win32/BUILD.TXT b/win32/BUILD.TXT new file mode 100644 index 00000000..718152b7 --- /dev/null +++ b/win32/BUILD.TXT @@ -0,0 +1,22 @@ +Instructions for building the Bitlbee Win32 port +================================================ + +1. Download the latest version using bzr (http://www.bazaar-ng.org/): + bzr branch http://jelmer.vernstok.nl/oss/bitlbee/bzr/win32 bitlbee-win32 +2. Download and install the required development files: + from http://www.ethereal.com/distribution/win32/development/: + - libiconv + - glib + - glib-dev + from http://ftp.mozilla.org/pub/mozilla.org/ + - nss + - nspr + +I've put them inside c:\dev, so you might have the most with that location. + +3. Open bitlbee.dsw in VC++ and build :-) + +4. Now you're done. When running, make sure all the required DLL's are accessible. If they can't be found, place them inside c:\winnt\system32 or the Debug or Release directories inside bitlbee-...\win32\. + +5. To build setup files, compile the bitlbee.iss file using the Inno Setup + program (available from www.jrsoftware.org). diff --git a/win32/MainDlg.cpp b/win32/MainDlg.cpp new file mode 100644 index 00000000..615a9a3b --- /dev/null +++ b/win32/MainDlg.cpp @@ -0,0 +1,78 @@ +// MainDlg.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "PropUsers.h" +#include "PropPaths.h" +#include "PropAccess.h" +#include "PropLog.h" +#include "PropConn.h" +#include "MainDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainDlg + +IMPLEMENT_DYNAMIC(CMainDlg, CPropertySheet) + +CMainDlg::CMainDlg() : CPropertySheet("Bitlbee for Windows") +{ + AddPage(new CPropPaths()); + AddPage(new CPropAccess()); + AddPage(new CPropUsers()); + AddPage(new CPropLog()); + AddPage(new CPropertyPage(IDD_PROPPAGE_ABOUT)); + AddPage(new CPropConn()); + Create(); + ShowWindow(SW_HIDE); +} + +CMainDlg::~CMainDlg() +{ +} + + +BEGIN_MESSAGE_MAP(CMainDlg, CPropertySheet) + //{{AFX_MSG_MAP(CMainDlg) + ON_WM_CLOSE() + //}}AFX_MSG_MAP + ON_BN_CLICKED(IDOK, OnOK) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMainDlg message handlers + +BOOL CMainDlg::OnInitDialog() +{ + m_bModeless = FALSE; + m_nFlags |= WF_CONTINUEMODAL; + + CPropertySheet::OnInitDialog(); + GetDlgItem(IDHELP)->ShowWindow(SW_HIDE); + GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE); + + m_bModeless = TRUE; + m_nFlags &= WF_CONTINUEMODAL; + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CMainDlg::OnOK() +{ + PressButton(PSBTN_APPLYNOW); + ShowWindow(SW_HIDE); +} + + +void CMainDlg::OnClose() +{ + ShowWindow(SW_HIDE); +} + diff --git a/win32/MainDlg.h b/win32/MainDlg.h new file mode 100644 index 00000000..7cdf612b --- /dev/null +++ b/win32/MainDlg.h @@ -0,0 +1,52 @@ +#if !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) +#define AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// MainDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CMainDlg + +class CMainDlg : public CPropertySheet +{ + DECLARE_DYNAMIC(CMainDlg) + +// Construction +public: + CMainDlg(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainDlg) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainDlg(); + + // Generated message map functions +protected: + //{{AFX_MSG(CMainDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +private: + void OnOK(); +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) diff --git a/win32/PropAccess.cpp b/win32/PropAccess.cpp new file mode 100644 index 00000000..fd787b39 --- /dev/null +++ b/win32/PropAccess.cpp @@ -0,0 +1,123 @@ +// PropAccess.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "PropAccess.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropAccess dialog + + +CPropAccess::CPropAccess() + : CPropertyPage(CPropAccess::IDD) +{ + + //{{AFX_DATA_INIT(CPropAccess) + //}}AFX_DATA_INIT +} + + +void CPropAccess::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropAccess) + DDX_Control(pDX, IDC_AUTH_REGISTERED, m_auth_registered); + DDX_Control(pDX, IDC_AUTH_OPEN, m_auth_open); + DDX_Control(pDX, IDC_AUTH_CLOSED, m_auth_closed); + DDX_Control(pDX, IDC_PASSWORD, m_password); + DDX_Control(pDX, IDC_PORT, m_port); + DDX_Control(pDX, IDC_INTERFACE, m_interface); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropAccess, CPropertyPage) + //{{AFX_MSG_MAP(CPropAccess) + ON_BN_CLICKED(IDC_AUTH_REGISTERED, OnAuthRegistered) + ON_BN_CLICKED(IDC_AUTH_OPEN, OnAuthOpen) + ON_BN_CLICKED(IDC_AUTH_CLOSED, OnAuthClosed) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropAccess message handlers + +void CPropAccess::OnOK() +{ + CString iface; m_interface.GetWindowText(iface); + CString port; m_port.GetWindowText(port); + + CString password; m_password.GetWindowText(password); + g_free((void *)global.conf->password); + global.conf->password = g_strdup(password); + + if(m_auth_closed.GetCheck() == 1) global.conf->authmode = AUTHMODE_CLOSED; + if(m_auth_open.GetCheck() == 1) global.conf->authmode = AUTHMODE_OPEN; + if(m_auth_registered.GetCheck() == 1) global.conf->authmode = AUTHMODE_REGISTERED; + + if(strcmp(iface, global.conf->iface) || atol(port) != global.conf->port) { + global.conf->port = atoi(port); + g_free((void *)global.conf->iface); + global.conf->iface = g_strdup(iface); + closesocket(global.listen_socket); + bitlbee_daemon_init(); + } + + + CPropertyPage::OnOK(); +} + +void CPropAccess::OnAuthRegistered() +{ + m_password.EnableWindow(FALSE); + m_auth_open.SetCheck(0); + m_auth_registered.SetCheck(1); + m_auth_closed.SetCheck(0); + +} + +void CPropAccess::OnAuthOpen() +{ + m_password.EnableWindow(FALSE); + m_auth_open.SetCheck(1); + m_auth_registered.SetCheck(0); + m_auth_closed.SetCheck(0); +} + +void CPropAccess::OnAuthClosed() +{ + m_password.EnableWindow(TRUE); + m_auth_open.SetCheck(0); + m_auth_registered.SetCheck(0); + m_auth_closed.SetCheck(1); + +} + +BOOL CPropAccess::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_interface.SetWindowText(global.conf->iface); + m_password.SetWindowText(global.conf->password); + char tmp[20]; + g_snprintf(tmp, sizeof(tmp), "%d", global.conf->port); + m_port.SetWindowText(tmp); + m_auth_open.SetCheck(0); + m_auth_closed.SetCheck(0); + m_auth_registered.SetCheck(0); + + switch(global.conf->authmode) { + case AUTHMODE_OPEN: m_auth_open.SetCheck(1); m_password.EnableWindow(FALSE);break; + case AUTHMODE_CLOSED: m_auth_closed.SetCheck(1); m_password.EnableWindow(TRUE);break; + case AUTHMODE_REGISTERED: m_auth_registered.SetCheck(1);m_password.EnableWindow(FALSE);break; + } + + return TRUE; +} diff --git a/win32/PropAccess.h b/win32/PropAccess.h new file mode 100644 index 00000000..bc80c648 --- /dev/null +++ b/win32/PropAccess.h @@ -0,0 +1,56 @@ +#if !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) +#define AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropAccess.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPropAccess dialog + +class CPropAccess : public CPropertyPage +{ +// Construction +public: + CPropAccess(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropAccess) + enum { IDD = IDD_PROPPAGE_ACCESS }; + CButton m_auth_registered; + CButton m_auth_open; + CButton m_auth_closed; + CEdit m_password; + CEdit m_port; + CEdit m_interface; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropAccess) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropAccess) + afx_msg void OnAuthRegistered(); + afx_msg void OnAuthOpen(); + afx_msg void OnAuthClosed(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) diff --git a/win32/PropConn.cpp b/win32/PropConn.cpp new file mode 100644 index 00000000..15d4a90a --- /dev/null +++ b/win32/PropConn.cpp @@ -0,0 +1,125 @@ +// PropConn.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "PropConn.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropConn dialog + + +CPropConn::CPropConn(CWnd* pParent /*=NULL*/) + : CPropertyPage(CPropConn::IDD) +{ + //{{AFX_DATA_INIT(CPropConn) + //}}AFX_DATA_INIT +} + + +void CPropConn::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropConn) + DDX_Control(pDX, IDC_PROXYPORT, m_proxyport); + DDX_Control(pDX, IDC_PROXYTYPE, m_proxytype); + DDX_Control(pDX, IDC_PROXY_ENABLED, m_proxy_enabled); + DDX_Control(pDX, IDC_PROXY_AUTH_ENABLED, m_proxy_auth_enabled); + DDX_Control(pDX, IDC_PROXYPASS, m_proxypass); + DDX_Control(pDX, IDC_PROXYHOST, m_proxyhost); + DDX_Control(pDX, IDC_PROXYUSER, m_proxyuser); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropConn, CPropertyPage) + //{{AFX_MSG_MAP(CPropConn) + ON_BN_CLICKED(IDC_PROXY_AUTH_ENABLED, OnProxyAuthEnabled) + ON_BN_CLICKED(IDC_PROXY_ENABLED, OnProxyEnabled) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropConn message handlers + +void CPropConn::OnProxyAuthEnabled() +{ + m_proxyuser.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); + m_proxypass.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); +} + +void CPropConn::OnProxyEnabled() +{ + // TODO: Add your control notification handler code here + m_proxyhost.EnableWindow(m_proxy_enabled.GetCheck()); + m_proxytype.EnableWindow(m_proxy_enabled.GetCheck()); + m_proxyport.EnableWindow(m_proxy_enabled.GetCheck()); + m_proxy_auth_enabled.EnableWindow(m_proxy_enabled.GetCheck()); + + if(m_proxy_enabled.GetCheck() && (m_proxytype.GetCurSel() < 0 || m_proxytype.GetCurSel() > 2)) + { + m_proxytype.SetCurSel(0); + } + + OnProxyAuthEnabled(); +} + +void CPropConn::OnOK() +{ + if(!m_proxy_enabled.GetCheck()) { + proxytype = PROXY_NONE; + return; + } + + CString tmp; + m_proxyhost.GetWindowText(tmp); + strcpy(proxyhost, tmp); + + m_proxyport.GetWindowText(tmp); + proxyport = atoi(tmp); + + proxytype = m_proxytype.GetCurSel()+1; + + if(!m_proxy_auth_enabled.GetCheck()) { + strcpy(proxyuser, ""); + strcpy(proxypass, ""); + return; + } + + m_proxyuser.GetWindowText(tmp); + strcpy(proxyuser, tmp); + m_proxypass.GetWindowText(tmp); + strcpy(proxypass, tmp); + + CPropertyPage::OnOK(); +} + +BOOL CPropConn::OnInitDialog() +{ + char pp[20]; + CPropertyPage::OnInitDialog(); + + m_proxyhost.SetWindowText(proxyhost); + m_proxyuser.SetWindowText(proxyuser); + m_proxypass.SetWindowText(proxypass); + g_snprintf(pp, 20, "%d", proxyport); + m_proxyport.SetWindowText(pp); + + m_proxytype.AddString("SOCKS 4"); + m_proxytype.AddString("SOCKS 5"); + m_proxytype.AddString("HTTP"); + m_proxytype.SetCurSel(proxytype-1); + + m_proxy_enabled.SetCheck(proxytype == PROXY_NONE?0:1); + m_proxy_auth_enabled.SetCheck(strcmp(proxyuser, "")?1:0); + + OnProxyEnabled(); + + return TRUE; +} diff --git a/win32/PropConn.h b/win32/PropConn.h new file mode 100644 index 00000000..1143912c --- /dev/null +++ b/win32/PropConn.h @@ -0,0 +1,56 @@ +#if !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) +#define AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropConn.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPropConn dialog + +class CPropConn : public CPropertyPage +{ +// Construction +public: + CPropConn(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropConn) + enum { IDD = IDD_PROPPAGE_CONNECTION }; + CEdit m_proxyport; + CListBox m_proxytype; + CButton m_proxy_enabled; + CButton m_proxy_auth_enabled; + CEdit m_proxypass; + CEdit m_proxyhost; + CEdit m_proxyuser; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropConn) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropConn) + afx_msg void OnProxyAuthEnabled(); + afx_msg void OnProxyEnabled(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) diff --git a/win32/PropLog.cpp b/win32/PropLog.cpp new file mode 100644 index 00000000..27957b07 --- /dev/null +++ b/win32/PropLog.cpp @@ -0,0 +1,80 @@ +// PropLog.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "PropLog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropLog dialog + + +CPropLog::CPropLog() + : CPropertyPage(CPropLog::IDD) +{ + //{{AFX_DATA_INIT(CPropLog) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CPropLog::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropLog) + DDX_Control(pDX, IDC_LOG, m_log); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropLog, CPropertyPage) + //{{AFX_MSG_MAP(CPropLog) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropLog message handlers + +static GList *log = NULL; + +extern "C" { +void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data) +{ + log = g_list_append(log, g_strdup_printf("%s: %s", log_domain, msg)); +} +} + +void log_message(int level, char *message, ... ) { +#define LOG_MAXLEN 300 + va_list ap; + va_start(ap, message); + char *msg = (char *)g_malloc(LOG_MAXLEN); + g_vsnprintf(msg, LOG_MAXLEN, message, ap); + va_end(ap); + log = g_list_append(log, msg); + if(level == LOGLVL_ERROR) ::MessageBox(NULL, msg, "Bitlbee", MB_OK | MB_ICONINFORMATION); + TRACE("%d: %s\n", level, msg); +} + + +BOOL CPropLog::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_log.ResetContent(); + GList *gl = log; + while(gl) { + char *d = (char *)gl->data; + m_log.AddString(d); + gl = gl->next; + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/win32/PropLog.h b/win32/PropLog.h new file mode 100644 index 00000000..1a847b19 --- /dev/null +++ b/win32/PropLog.h @@ -0,0 +1,47 @@ +#if !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) +#define AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropLog.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPropLog dialog + +class CPropLog : public CPropertyPage +{ +// Construction +public: + CPropLog(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropLog) + enum { IDD = IDD_PROPPAGE_LOG }; + CListBox m_log; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropLog) + public: + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropLog) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) diff --git a/win32/PropPaths.cpp b/win32/PropPaths.cpp new file mode 100644 index 00000000..7790e99c --- /dev/null +++ b/win32/PropPaths.cpp @@ -0,0 +1,119 @@ +// PropPaths.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "PropPaths.h" +#include "shlobj.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropPaths dialog + + +CPropPaths::CPropPaths() + : CPropertyPage(CPropPaths::IDD) +{ + //{{AFX_DATA_INIT(CPropPaths) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CPropPaths::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropPaths) + DDX_Control(pDX, IDC_MOTDFILE, m_motdfile); + DDX_Control(pDX, IDC_EDIT_MOTD, m_edit_motd); + DDX_Control(pDX, IDC_CONFIGDIR, m_configdir); + DDX_Control(pDX, IDC_BROWSE_MOTD, m_browse_motd); + DDX_Control(pDX, IDC_BROWSE_CONFIG, m_browse_config); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropPaths, CPropertyPage) + //{{AFX_MSG_MAP(CPropPaths) + ON_BN_CLICKED(IDC_BROWSE_CONFIG, OnBrowseConfig) + ON_BN_CLICKED(IDC_BROWSE_MOTD, OnBrowseMotd) + ON_BN_CLICKED(IDC_EDIT_MOTD, OnEditMotd) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropPaths message handlers + +void CPropPaths::OnOK() +{ + CString tmp; + g_free((void *)global.conf->configdir); + m_configdir.GetWindowText(tmp); + + if (tmp.GetLength() > 0 + && tmp.GetAt(tmp.GetLength() - 1) != '/' + && tmp.GetAt(tmp.GetLength() - 1) != '\\') + { + global.conf->configdir = g_strdup_printf("%s\\", tmp); + } else { + global.conf->configdir = g_strdup(tmp); + } + + g_free((void *)global.conf->motdfile); + m_motdfile.GetWindowText(tmp); + global.conf->motdfile = g_strdup(tmp); + + CPropertyPage::OnOK(); +} + +void CPropPaths::OnBrowseConfig() +{ + BROWSEINFO bi = { 0 }; + bi.lpszTitle = _T("Choose a config directory"); + LPITEMIDLIST pidl = SHBrowseForFolder(&bi); + if( pidl != 0) + { + TCHAR path[MAX_PATH]; + if( SHGetPathFromIDList (pidl, path) ) { + m_configdir.SetWindowText(path); + } + + IMalloc * imalloc = 0; + if ( SUCCEEDED (SHGetMalloc (&imalloc)) ) + { + imalloc->Free(pidl); + imalloc->Release(); + } + } +} + +void CPropPaths::OnBrowseMotd() +{ + CFileDialog f(TRUE); + + if(f.DoModal() == IDOK) { + m_motdfile.SetWindowText(f.GetPathName()); + } + +} + +void CPropPaths::OnEditMotd() +{ + CString loc;m_motdfile.GetWindowText(loc); + ShellExecute(this->GetSafeHwnd(), NULL, loc, NULL, NULL, SW_SHOWNORMAL); +} + +BOOL CPropPaths::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_configdir.SetWindowText(global.conf->configdir); + m_motdfile.SetWindowText(global.conf->motdfile); + + return TRUE; +} diff --git a/win32/PropPaths.h b/win32/PropPaths.h new file mode 100644 index 00000000..89c1c78e --- /dev/null +++ b/win32/PropPaths.h @@ -0,0 +1,55 @@ +#if !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) +#define AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropPaths.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPropPaths dialog + +class CPropPaths : public CPropertyPage +{ +// Construction +public: + CPropPaths(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropPaths) + enum { IDD = IDD_PROPPAGE_PATHS }; + CEdit m_motdfile; + CButton m_edit_motd; + CEdit m_configdir; + CButton m_browse_motd; + CButton m_browse_config; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropPaths) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropPaths) + afx_msg void OnBrowseConfig(); + afx_msg void OnBrowseMotd(); + afx_msg void OnEditMotd(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) diff --git a/win32/PropUsers.cpp b/win32/PropUsers.cpp new file mode 100644 index 00000000..7f1a2c35 --- /dev/null +++ b/win32/PropUsers.cpp @@ -0,0 +1,120 @@ +// PropUsers.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "PropUsers.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropUsers dialog + + +CPropUsers::CPropUsers() + : CPropertyPage(CPropUsers::IDD) +{ + //{{AFX_DATA_INIT(CPropUsers) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CPropUsers::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropUsers) + DDX_Control(pDX, IDC_KNOWN_USERS, m_known_users); + DDX_Control(pDX, IDC_KICK, m_kick); + DDX_Control(pDX, IDC_DEL_KNOWN_USERS, m_del_known_users); + DDX_Control(pDX, IDC_CURRENT_USERS, m_current_users); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropUsers, CPropertyPage) + //{{AFX_MSG_MAP(CPropUsers) + ON_BN_CLICKED(IDC_KICK, OnKick) + ON_BN_CLICKED(IDC_DEL_KNOWN_USERS, OnDelKnownUser) + ON_LBN_SELCHANGE(IDC_CURRENT_USERS, OnSelchangeCurrentUsers) + ON_LBN_SELCHANGE(IDC_KNOWN_USERS, OnSelchangeKnownUsers) + ON_BN_CLICKED(IDC_REFRESH_KNOWN_USERS, OnRefreshKnownUsers) + ON_BN_CLICKED(IDC_REFRESH_CURRENT_USERS, OnRefreshCurrentUsers) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropUsers message handlers + +void CPropUsers::OnKick() +{ + int idx = m_current_users.GetCurSel(); + if(idx == LB_ERR) return; + irc_t *irc = (irc_t *)m_current_users.GetItemData(idx); + irc_free(irc); + m_kick.EnableWindow(FALSE); + OnRefreshCurrentUsers(); +} + +void CPropUsers::OnDelKnownUser() +{ + CString nick; + m_known_users.GetText(m_known_users.GetCurSel(), nick); + CString accounts; accounts.Format("%s\\%s.accounts", global.conf->configdir, nick); + CString nicks; nicks.Format("%s\\%s.nicks", global.conf->configdir, nick); + CFile::Remove(accounts); + CFile::Remove(nicks); + m_del_known_users.EnableWindow(FALSE); + OnRefreshKnownUsers(); +} + +void CPropUsers::OnSelchangeCurrentUsers() +{ + m_kick.EnableWindow(m_current_users.GetCurSel() != LB_ERR); + +} + +void CPropUsers::OnSelchangeKnownUsers() +{ + m_del_known_users.EnableWindow(m_known_users.GetCurSel() != LB_ERR); + +} + +void CPropUsers::OnRefreshKnownUsers() +{ + m_known_users.ResetContent(); + GError *error = NULL; + const char *r; + GDir *d = g_dir_open(global.conf->configdir, 0, &error); + if(!d) return; + while(r = g_dir_read_name(d)) { + if(strstr(r, ".accounts")) { + CString tmp(r, strlen(r) - strlen(".accounts")); + m_known_users.AddString(tmp); + } + } + g_dir_close(d); +} + +extern "C" { + extern GSList *irc_connection_list; +} + +void CPropUsers::OnRefreshCurrentUsers() +{ + m_current_users.ResetContent(); + GSList *gl = irc_connection_list; + while(gl) { + irc_t *irc = (irc_t *)gl->data; + CString tmp; + tmp.Format("%s@%s \"%s\"", irc->nick, irc->myhost, irc->realname); + int idx = m_current_users.AddString(tmp); + m_current_users.SetItemData(idx, (unsigned long)irc); + gl = gl->next; + } +} + diff --git a/win32/PropUsers.h b/win32/PropUsers.h new file mode 100644 index 00000000..7dd028c6 --- /dev/null +++ b/win32/PropUsers.h @@ -0,0 +1,54 @@ +#if !defined(AFX_PROPUSERS_H__BA8F6624_F693_403B_B3A8_B140955A894B__INCLUDED_) +#define AFX_PROPUSERS_H__BA8F6624_F693_403B_B3A8_B140955A894B__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropUsers.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPropUsers dialog + +class CPropUsers : public CPropertyPage +{ +// Construction +public: + CPropUsers(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropUsers) + enum { IDD = IDD_PROPPAGE_USERS }; + CListBox m_known_users; + CButton m_kick; + CButton m_del_known_users; + CListBox m_current_users; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropUsers) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropUsers) + afx_msg void OnKick(); + afx_msg void OnDelKnownUser(); + afx_msg void OnSelchangeCurrentUsers(); + afx_msg void OnSelchangeKnownUsers(); + afx_msg void OnRefreshKnownUsers(); + afx_msg void OnRefreshCurrentUsers(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPUSERS_H__BA8F6624_F693_403B_B3A8_B140955A894B__INCLUDED_) diff --git a/win32/TrayNot.cpp b/win32/TrayNot.cpp new file mode 100644 index 00000000..bd6bf39a --- /dev/null +++ b/win32/TrayNot.cpp @@ -0,0 +1,106 @@ +// TrayNot.cpp : implementation file +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "TrayNot.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTrayNot dialog + + +CTrayNot::CTrayNot(CPropertySheet *s) + : CDialog(CTrayNot::IDD, NULL) +{ + Create(CTrayNot::IDD); + EnableWindow(FALSE); + + dlg = s; + + /* Traybar icon */ + NOTIFYICONDATA dat; + dat.cbSize = sizeof(NOTIFYICONDATA); + dat.hWnd = m_hWnd; + dat.uID = 1; + dat.uFlags = NIF_ICON + NIF_TIP + NIF_MESSAGE; + dat.hIcon = AfxGetApp()->LoadIcon(IDI_BEE); + dat.uCallbackMessage = BITLBEE_TRAY_ICON; + strcpy(dat.szTip, "Bitlbee manager"); + Shell_NotifyIcon(NIM_ADD, &dat); + + //{{AFX_DATA_INIT(CTrayNot) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CTrayNot::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CTrayNot) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + +///////////////////////////////////////////////////////////////////////////// +// CTrayNot message handlers + +CTrayNot::~CTrayNot() +{ + NOTIFYICONDATA dat; + dat.cbSize = sizeof(NOTIFYICONDATA); + dat.hWnd = m_hWnd; + dat.uID = 1; + Shell_NotifyIcon(NIM_DELETE, &dat); +} + + +BEGIN_MESSAGE_MAP(CTrayNot, CDialog) + //{{AFX_MSG_MAP(CTrayNot) + // NOTE - the ClassWizard will add and remove mapping macros here. + ON_MESSAGE (BITLBEE_TRAY_ICON, OnSysTrayIconClick) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CTrayNot message handlers + +afx_msg LONG CTrayNot::OnSysTrayIconClick (WPARAM wParam, LPARAM lParam) +{ + switch (lParam) + { + case WM_LBUTTONDOWN: + dlg->ShowWindow(SW_SHOW); + break; + case WM_RBUTTONDOWN: + ShowQuickMenu (); + break ; + } + return 0; +} + +void CTrayNot::ShowQuickMenu() +{ + POINT CurPos; + + CMenu qmenu; + qmenu.LoadMenu(IDR_POPUP); + + GetCursorPos (&CurPos); + + CMenu *submenu = qmenu.GetSubMenu(0); + + SetForegroundWindow(); + // Display the menu. This menu is a popup loaded elsewhere. + + submenu->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_RIGHTALIGN, + CurPos.x, + CurPos.y,this); +} diff --git a/win32/TrayNot.h b/win32/TrayNot.h new file mode 100644 index 00000000..9dbcb282 --- /dev/null +++ b/win32/TrayNot.h @@ -0,0 +1,54 @@ +#if !defined(AFX_TRAYNOT_H__C8B7E607_671B_4C97_8251_AF5AA83DF401__INCLUDED_) +#define AFX_TRAYNOT_H__C8B7E607_671B_4C97_8251_AF5AA83DF401__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// TrayNot.h : header file +// + +#include + +#define BITLBEE_TRAY_ICON WM_USER+1 + +///////////////////////////////////////////////////////////////////////////// +// CTrayNot dialog + +class CTrayNot : public CDialog +{ +// Construction +public: + virtual ~CTrayNot(); + CTrayNot(CPropertySheet *); // standard constructor + +// Dialog Data + //{{AFX_DATA(CTrayNot) + enum { IDD = IDD_PHONY }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTrayNot) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CTrayNot) + // NOTE: the ClassWizard will add member functions here + afx_msg LONG OnSysTrayIconClick (WPARAM wParam, LPARAM lParam); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + CPropertySheet *dlg; + void ShowQuickMenu(); +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TRAYNOT_H__C8B7E607_671B_4C97_8251_AF5AA83DF401__INCLUDED_) diff --git a/win32/bitlbee.dsp b/win32/bitlbee.dsp new file mode 100644 index 00000000..ef0f3ada --- /dev/null +++ b/win32/bitlbee.dsp @@ -0,0 +1,338 @@ +# Microsoft Developer Studio Project File - Name="bitlbee" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=bitlbee - Win32 Debug +!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 "bitlbee.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 "bitlbee.mak" CFG="bitlbee - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "bitlbee - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "bitlbee - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "bitlbee - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# 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 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "GLIB2" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib glib-2.0.lib gmodule-2.0.lib /nologo /subsystem:windows /machine:I386 /libpath:"release" /libpath:"deps\lib" +# SUBTRACT LINK32 /incremental:yes /nodefaultlib + +!ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "GLIB2" /FR /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 iconv.lib glib-2.0.lib gmodule-2.0.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" + +!ENDIF + +# Begin Target + +# Name "bitlbee - Win32 Release" +# Name "bitlbee - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\account.c +# End Source File +# Begin Source File + +SOURCE=..\bitlbee.c +# End Source File +# Begin Source File + +SOURCE=.\bitlbee.rc +# End Source File +# Begin Source File + +SOURCE=.\bitlbeewin.cpp +# End Source File +# Begin Source File + +SOURCE=..\commands.c +# End Source File +# Begin Source File + +SOURCE=..\crypting.c +# End Source File +# Begin Source File + +SOURCE=..\debug.c +# End Source File +# Begin Source File + +SOURCE=..\help.c +# End Source File +# Begin Source File + +SOURCE=..\irc.c +# End Source File +# Begin Source File + +SOURCE=.\MainDlg.cpp +# End Source File +# Begin Source File + +SOURCE=..\protocols\md5.c +# End Source File +# Begin Source File + +SOURCE=..\nick.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\nogaim.c +# End Source File +# Begin Source File + +SOURCE=.\PropAccess.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropConn.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropLog.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropPaths.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropUsers.cpp +# End Source File +# Begin Source File + +SOURCE=..\protocols\proxy.c +# End Source File +# Begin Source File + +SOURCE=..\query.c +# End Source File +# Begin Source File + +SOURCE=..\set.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\sha.c +# End Source File +# Begin Source File + +SOURCE=.\TrayNot.cpp +# End Source File +# Begin Source File + +SOURCE=..\user.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\util.c + +!IF "$(CFG)" == "bitlbee - Win32 Release" + +!ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" + +# PROP Intermediate_Dir "Debugx" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\account.h +# End Source File +# Begin Source File + +SOURCE=..\bitlbee.h +# End Source File +# Begin Source File + +SOURCE=.\bitlbeewin.h +# End Source File +# Begin Source File + +SOURCE=..\commands.h +# End Source File +# Begin Source File + +SOURCE=..\conf.h +# End Source File +# Begin Source File + +SOURCE=.\config.h +# End Source File +# Begin Source File + +SOURCE=..\crypting.h +# End Source File +# Begin Source File + +SOURCE=..\help.h +# End Source File +# Begin Source File + +SOURCE=..\ini.h +# End Source File +# Begin Source File + +SOURCE=..\irc.h +# End Source File +# Begin Source File + +SOURCE=..\log.h +# End Source File +# Begin Source File + +SOURCE=.\MainDlg.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\md5.h +# End Source File +# Begin Source File + +SOURCE=..\nick.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\nogaim.h +# End Source File +# Begin Source File + +SOURCE=.\PropAccess.h +# End Source File +# Begin Source File + +SOURCE=.\PropConn.h +# End Source File +# Begin Source File + +SOURCE=.\PropLog.h +# End Source File +# Begin Source File + +SOURCE=.\PropPaths.h +# End Source File +# Begin Source File + +SOURCE=.\PropUsers.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=..\set.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\sha.h +# End Source File +# Begin Source File + +SOURCE=..\sock.h +# End Source File +# Begin Source File + +SOURCE=.\TrayNot.h +# End Source File +# Begin Source File + +SOURCE=..\user.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\bitlbee.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\bmp00002.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icon1.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icon2.ico +# End Source File +# End Group +# Begin Source File + +SOURCE=.\README.TXT +# End Source File +# End Target +# End Project diff --git a/win32/bitlbee.dsw b/win32/bitlbee.dsw new file mode 100644 index 00000000..e91fea5e --- /dev/null +++ b/win32/bitlbee.dsw @@ -0,0 +1,107 @@ +Microsoft Developer Studio Workspace File, Format Version 5.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "bitlbee"=".\bitlbee.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "bitlbee_ssl"=".\bitlbee_ssl\bitlbee_ssl.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "jabber"=".\jabber.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name bitlbee + End Project Dependency + Begin Project Dependency + Project_Dep_Name bitlbee_ssl + End Project Dependency +}}} + +############################################################################### + +Project: "msn"=".\msn.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name bitlbee + End Project Dependency + Begin Project Dependency + Project_Dep_Name bitlbee_ssl + End Project Dependency +}}} + +############################################################################### + +Project: "oscar"=".\oscar.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name bitlbee + End Project Dependency +}}} + +############################################################################### + +Project: "yahoo"=".\yahoo.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name bitlbee + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/win32/bitlbee.iss b/win32/bitlbee.iss new file mode 100644 index 00000000..a9863f3b --- /dev/null +++ b/win32/bitlbee.iss @@ -0,0 +1,73 @@ +; Inno setup script for Bitlbee +; (C) 2004-2005 Jelmer Vernooij + +[Setup] +AppName=BitlBee +AppPublisher=The BitlBee Team +AppPublisherURL=http://www.bitlbee.org/ +AppSupportURL=http://win32.bitlbee.org/ +AppUpdatesURL=http://win32.bitlbee.org/ +AppCopyright=Copyright © 2002-2005 The BitlBee Team +DefaultDirName={pf}\Bitlbee +DefaultGroupName=Bitlbee +LicenseFile=..\COPYING +InfoAfterFile=README.TXT +OutputDir=. +AppVerName=Bitlbee-20050516 +OutputBaseFileName="BitlBee-setup" + +[Components] +Name: main; Description: Main executable and files; Types: full compact custom; Flags: fixed; +Name: "yahoo"; Description: Yahoo! Messenger support; Types: full; +Name: "oscar"; Description: AIM/ICQ support; Types: full; +Name: ssl; Description: SSL Support; Types: full; +Name: "ssl\msn"; Description: MSN messenger support; Types: full; +Name: "ssl\jabber"; Description: Jabber support; Types: full; +Name: docs; Description: Documentation; Types: full; + +[Tasks] +Name: startupicon; Description: "&Automatically start when the computer boots"; GroupDescription: "Other tasks:"; Flags: unchecked + +[Files] +Source: "Release\bitlbee.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "Release\libmsn.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl\msn" +Source: "Deps\lib\ssl3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\lib\nss3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\lib\nssckbi.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\lib\smime3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\lib\softokn3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\lib\libplc4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\lib\libnspr4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Release\libjabber.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl\jabber" +Source: "Release\bitlbee_ssl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" +Source: "Deps\bin\libglib-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "Deps\bin\libgmodule-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "Release\liboscar.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "oscar" +Source: "Deps\bin\intl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "Deps\bin\iconv.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "Release\libyahoo.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "yahoo" +Source: "..\motd.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "..\doc\help.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "..\COPYING"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "..\doc\TODO"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "..\doc\README"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "..\doc\FAQ"; DestDir: "{app}"; Flags: ignoreversion; Components: docs; +Source: "..\doc\CREDITS"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +; Source: "..\doc\user-guide.pdf"; DestDir: "{app}"; Flags: ignoreversion; Components: docs; +Source: "..\doc\CHANGES"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +Source: "..\doc\AUTHORS"; DestDir: "{app}"; Flags: ignoreversion; Components: main; +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{group}\Bitlbee"; Filename: "{app}\bitlbee.exe" +Name: "{commonstartup}\Bitlbee"; Filename: "{app}\bitlbee.exe"; Tasks: startupicon + + +[Run] +; NOTE: The following entry contains an English phrase ("Launch"). You are free to translate it into another language if required. +Filename: "{app}\bitlbee.exe"; Description: "Launch Bitlbee"; Flags: nowait postinstall skipifsilent + +[Registry] +Root: HKLM; Subkey: "SOFTWARE\Bitlbee"; ValueType: string; ValueName: "helpfile"; ValueData: "{app}\help.txt" +Root: HKLM; Subkey: "SOFTWARE\Bitlbee"; ValueType: string; ValueName: "motdfile"; ValueData: "{app}\motd.txt" +Root: HKLM; Subkey: "SOFTWARE\Bitlbee"; ValueType: string; ValueName: "configdir"; ValueData: "{userappdata}\Bitlbee" diff --git a/win32/bitlbee.rc b/win32/bitlbee.rc new file mode 100644 index 00000000..0762fbbd --- /dev/null +++ b/win32/bitlbee.rc @@ -0,0 +1,354 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.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 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_BEE ICON DISCARDABLE "res\\icon2.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_PROPPAGE_ACCESS DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Access" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Authentication Mode",IDC_STATIC,7,7,196,47 + CONTROL "&Open",IDC_AUTH_OPEN,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,14,15,181,13 + CONTROL "&Closed",IDC_AUTH_CLOSED,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,14,27,160,11 + CONTROL "&Registered",IDC_AUTH_REGISTERED,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,14,39,182,11 + GROUPBOX "Bind",IDC_STATIC,7,55,196,46 + LTEXT "IP to bind to:",IDC_STATIC,15,67,49,9 + LTEXT "Port:",IDC_STATIC,15,82,52,10 + EDITTEXT IDC_INTERFACE,86,67,108,11,ES_AUTOHSCROLL + EDITTEXT IDC_PORT,86,82,108,11,ES_AUTOHSCROLL + GROUPBOX "Password",IDC_STATIC,7,104,196,43 + EDITTEXT IDC_PASSWORD,14,129,115,11,ES_AUTOHSCROLL + LTEXT "Only used when authentication mode is set to closed.", + IDC_STATIC,13,113,184,11 +END + +IDD_PROPPAGE_USERS DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Users" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Known users",IDC_STATIC,7,7,196,68 + GROUPBOX "Current users",IDC_STATIC,7,79,196,68 + LISTBOX IDC_KNOWN_USERS,13,17,114,52,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Remove",IDC_DEL_KNOWN_USERS,133,17,32,14,WS_DISABLED + LISTBOX IDC_CURRENT_USERS,13,89,115,52,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Kick",IDC_KICK,135,89,19,14,WS_DISABLED + PUSHBUTTON "&Refresh",IDC_REFRESH_KNOWN_USERS,133,38,30,14 + PUSHBUTTON "&Refresh",IDC_REFRESH_CURRENT_USERS,135,110,30,14 +END + +IDD_PROPPAGE_PATHS DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Paths" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Config path",IDC_STATIC,7,7,196,30 + PUSHBUTTON "&Browse...",IDC_BROWSE_CONFIG,151,16,46,13 + EDITTEXT IDC_CONFIGDIR,13,17,122,13,ES_AUTOHSCROLL + GROUPBOX "Message of the day file",IDC_STATIC,7,42,196,40 + PUSHBUTTON "&Browse...",IDC_BROWSE_MOTD,153,51,43,13 + EDITTEXT IDC_MOTDFILE,13,51,122,13,ES_AUTOHSCROLL + PUSHBUTTON "&Edit...",IDC_EDIT_MOTD,153,66,43,13 +END + +IDD_PHONY DIALOG DISCARDABLE 0, 0, 9, 9 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN +END + +IDD_PROPPAGE_ABOUT DIALOG DISCARDABLE 0, 0, 284, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "About" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Authors",IDC_STATIC,7,7,270,79 + LTEXT "Bitlbee is written by : \n Wilmer van der Gaast \n Maurits Dijkstra \n Jelmer Vernooij ", + IDC_STATIC,13,16,180,35 + LTEXT "Windows port by Jelmer Vernooij ", + IDC_STATIC,13,55,180,12 + CONTROL 135,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN,193,14,73, + 64 + GROUPBOX "More information",IDC_STATIC,7,88,270,61 + LTEXT "See the file CREDITS for a list of contributors.", + IDC_STATIC,16,69,171,11 + LTEXT "The Bitlbee homepage is located at http://www.bitlbee.org/\n\nFor Bitlbee support, go to #bitlbee on irc.oftc.net", + IDC_STATIC,17,100,248,39 +END + +IDD_PROPPAGE_LOG DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Logs" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_LOG,7,7,196,140,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP +END + +IDD_PROPPAGE_CONNECTION DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Connection" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Proxy",IDC_STATIC,7,23,196,124 + EDITTEXT IDC_PROXYHOST,110,33,86,12,ES_AUTOHSCROLL + CONTROL "&Use Proxy",IDC_PROXY_ENABLED,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,7,196,14 + LTEXT "Proxy &Host",IDC_STATIC,13,33,82,12 + EDITTEXT IDC_PROXYUSER,110,105,86,12,ES_AUTOHSCROLL + LTEXT "Proxy &User",IDC_STATIC,13,105,82,12 + EDITTEXT IDC_PROXYPASS,110,122,86,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Proxy &Password",IDC_STATIC,13,123,82,12 + CONTROL "&Authenticate to proxy",IDC_PROXY_AUTH_ENABLED,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,85,86,14 + LTEXT "Proxy &Type",IDC_STATIC,13,63,77,8 + LISTBOX IDC_PROXYTYPE,110,62,86,31,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "&Proxy Port",IDC_STATIC,14,47,80,9 + EDITTEXT IDC_PROXYPORT,109,47,86,12,ES_AUTOHSCROLL | ES_NUMBER +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "The Bitlbee Team\0" + VALUE "FileDescription", "BitlBee for Windows\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "bitlbee\0" + VALUE "LegalCopyright", "Copyright (C) 2002-2004\0" + VALUE "OriginalFilename", "bitlbee.exe\0" + VALUE "ProductName", "Bitlbee Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PROPPAGE_ACCESS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PROPPAGE_USERS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PROPPAGE_PATHS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PHONY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 2 + TOPMARGIN, 7 + BOTTOMMARGIN, 2 + END + + IDD_PROPPAGE_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 277 + TOPMARGIN, 7 + BOTTOMMARGIN, 149 + END + + IDD_PROPPAGE_LOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PROPPAGE_CONNECTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_POPUP MENU DISCARDABLE +BEGIN + POPUP "tray" + BEGIN + MENUITEM "&Show", IDM_SHOW + MENUITEM SEPARATOR + MENUITEM "&Exit", IDM_EXIT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BEE_SMALL BITMAP DISCARDABLE "res\\bmp00002.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ABOUTBOX "&About bitlbee..." + IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/win32/bitlbee_ssl.dsp b/win32/bitlbee_ssl.dsp new file mode 100644 index 00000000..5a4e764d --- /dev/null +++ b/win32/bitlbee_ssl.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="bitlbee_ssl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=bitlbee_ssl - Win32 Debug +!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 "bitlbee_ssl.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 "bitlbee_ssl.mak" CFG="bitlbee_ssl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "bitlbee_ssl - Win32 Release" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE "bitlbee_ssl - Win32 Debug" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "bitlbee_ssl - 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 Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnspr4.lib nss3.lib ssl3.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"release" /libpath:"deps\lib" + +!ELSEIF "$(CFG)" == "bitlbee_ssl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnspr4.lib nss3.lib ssl3.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" + +!ENDIF + +# Begin Target + +# Name "bitlbee_ssl - Win32 Release" +# Name "bitlbee_ssl - Win32 Debug" +# Begin Source File + +SOURCE=..\protocols\ssl_client.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\ssl_nss.c +# End Source File +# End Target +# End Project diff --git a/win32/bitlbeewin.cpp b/win32/bitlbeewin.cpp new file mode 100644 index 00000000..e18ae3cd --- /dev/null +++ b/win32/bitlbeewin.cpp @@ -0,0 +1,210 @@ +// bitlbee.cpp : Defines the class behaviors for the application. +// + +#define BITLBEE_CORE +#include "bitlbeewin.h" +#include "traynot.h" +#include "maindlg.h" +#include +extern "C" { +#include "config.h" +#include "bitlbee.h" +#include +#include +int +inet_aton(const char *cp, struct in_addr *addr) +{ + addr->s_addr = inet_addr(cp); + return (addr->s_addr == INADDR_NONE) ? 0 : 1; +} + +void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data); + +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp + +BEGIN_MESSAGE_MAP(CBitlbeeApp, CWinApp) + //{{AFX_MSG_MAP(CBitlbeeApp) + ON_COMMAND(IDM_EXIT, OnExit) + ON_COMMAND(IDM_SHOW, OnShow) + //}}AFX_MSG_MAP + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp construction + +CBitlbeeApp::CBitlbeeApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CBitlbeeApp object + +CBitlbeeApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp initialization + +static UINT bb_loop(LPVOID data) +{ + g_main_run(global.loop); + return 0; +} + + +gboolean bitlbee_new_client(GIOChannel *src, GIOCondition cond, gpointer data); +global_t global; // Against global namespace pollution + +BOOL CBitlbeeApp::InitInstance() +{ + if (!AfxSocketInit()) + { + AfxMessageBox(IDP_SOCKETS_INIT_FAILED); + return FALSE; + } + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + HKEY key; + unsigned char databuf[256]; + DWORD len; + RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee", &key); + + memset( &global, 0, sizeof( global_t ) ); + g_log_set_handler("GLib", static_cast(G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), glib_logger, NULL); + global.loop = g_main_new(FALSE); + nogaim_init(); + + SetRegistryKey("Bitlbee"); + conf_t *conf = (conf_t *)g_new0( conf_t, 1 ); + global.conf = conf; + global.conf->iface = g_strdup(GetProfileString("main", "interface", "0.0.0.0")); + global.conf->port = GetProfileInt("main", "port", 6667); + global.conf->verbose = GetProfileInt("main", "verbose", 0); + global.conf->password = g_strdup(GetProfileString("main", "password", "")); + global.conf->ping_interval = GetProfileInt("main", "ping_interval_timeout", 60); + global.conf->hostname = g_strdup(GetProfileString("main", "hostname", "localhost")); + if(RegQueryValueEx(key, "configdir", NULL, NULL, databuf, &len) != ERROR_SUCCESS) strcpy((char *)databuf, ""); + global.conf->configdir = g_strdup(GetProfileString("main", "configdir", (char *)databuf)); + if(RegQueryValueEx(key, "motdfile", NULL, NULL, databuf, &len) != ERROR_SUCCESS) strcpy((char *)databuf, ""); + global.conf->motdfile = g_strdup(GetProfileString("main", "motdfile", (char *)databuf)); + if(RegQueryValueEx(key, "helpfile", NULL, NULL, databuf, &len) != ERROR_SUCCESS) strcpy((char *)databuf, ""); + global.helpfile = g_strdup(GetProfileString("main", "helpfile", (char *)databuf)); + global.conf->runmode = RUNMODE_DAEMON; + global.conf->authmode = (enum authmode) GetProfileInt("main", "AuthMode", AUTHMODE_CLOSED); + strcpy(proxyhost, GetProfileString("proxy", "host", "")); + strcpy(proxyuser, GetProfileString("proxy", "user", "")); + strcpy(proxypass, GetProfileString("proxy", "password", "")); + proxytype = GetProfileInt("proxy", "type", PROXY_NONE); + proxyport = GetProfileInt("proxy", "port", 3128); + + dlg = new CMainDlg(); + not = new CTrayNot(dlg); + dlg->ShowWindow(SW_HIDE); + m_pMainWnd = not; + + if(help_init(&(global.help)) == NULL) { + log_message(LOGLVL_WARNING, "Unable to initialize help"); + } + + if(bitlbee_daemon_init() != 0) { + return FALSE; + } + + AfxBeginThread(bb_loop, NULL); + + + return TRUE; +} + +void log_error(char *a) { + ::MessageBox(NULL, a, "Bitlbee error", MB_OK | MB_ICONEXCLAMATION); +} + +/* Dummy function. log output always goes to screen anyway */ +void log_link(int level, int out) {} + +void conf_loaddefaults(irc_t *irc) {} +double gettime() { + return CTime::GetCurrentTime().GetTime(); +} + +void load_protocol(char *name, char *init_function_name, struct prpl *p) { + void (*init_function) (struct prpl *); + + char *path = g_module_build_path(NULL, name); + if(!path) { + log_message(LOGLVL_WARNING, "Can't build path for %s\n", name); + return; + } + + GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY); + if(!mod) { + log_message(LOGLVL_INFO, "Can't find %s, not loading", name); + return; + } + + if(!g_module_symbol(mod,init_function_name,(void **) &init_function)) { + log_message(LOGLVL_WARNING, "Can't find function %s in %s\n", init_function_name, path); + return; + } + g_free(path); + + init_function(p); +} + +void jabber_init(struct prpl *p) { load_protocol("jabber", "jabber_init", p); } +void msn_init(struct prpl *p) { load_protocol("msn", "msn_init", p); } +void byahoo_init(struct prpl *p) { load_protocol("yahoo", "byahoo_init", p); } +void oscar_init(struct prpl *p) { load_protocol("oscar", "oscar_init", p); } + +void CBitlbeeApp::OnExit() +{ + AfxGetApp()->ExitInstance(); + exit(0); +} + +void CBitlbeeApp::OnShow() +{ + dlg->ShowWindow(SW_SHOW); +} + +int CBitlbeeApp::ExitInstance() +{ + WriteProfileString("main", "interface", global.conf->iface); + WriteProfileInt("main", "port", global.conf->port); + WriteProfileInt("main", "verbose", global.conf->verbose); + WriteProfileString("main", "password", global.conf->password); + WriteProfileString("main", "configdir", global.conf->configdir); + WriteProfileString("main", "hostname", global.conf->hostname); + WriteProfileString("main", "motdfile", global.conf->motdfile); + WriteProfileInt("main", "authmode", global.conf->authmode); + WriteProfileInt("proxy", "type", proxytype); + WriteProfileString("proxy", "host", proxyhost); + WriteProfileString("proxy", "user", proxyuser); + WriteProfileString("proxy", "password", proxypass); + WriteProfileInt("proxy", "port", proxyport); + WriteProfileInt("main", "ping_interval_timeout", global.conf->ping_interval); + delete not; + return CWinApp::ExitInstance(); +} diff --git a/win32/bitlbeewin.h b/win32/bitlbeewin.h new file mode 100644 index 00000000..1a0d0361 --- /dev/null +++ b/win32/bitlbeewin.h @@ -0,0 +1,59 @@ +// bitlbee.h : main header file for the BITLBEE application +// + +#if !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) +#define AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include +#include +#include +#include "resource.h" // main symbols + +class CTrayNot; +extern "C" { +#define BITLBEE_CORE +#include "bitlbee.h" +} + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp: +// See bitlbee.cpp for the implementation of this class +// + +class CBitlbeeApp : public CWinApp +{ +public: + CBitlbeeApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBitlbeeApp) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CBitlbeeApp) + afx_msg void OnExit(); + afx_msg void OnShow(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + protected: + CTrayNot *not; + CPropertySheet *dlg; + GIOChannel *listen; +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) + diff --git a/win32/configure.mingw32 b/win32/configure.mingw32 new file mode 100644 index 00000000..678e9243 --- /dev/null +++ b/win32/configure.mingw32 @@ -0,0 +1,37 @@ +#!/bin/sh +DEPSDIR=$1 +export PKG_CONFIG_LIBDIR=$DEPSDIR/lib/pkgconfig +export PKG_CONFIG_OPTS=--define-variable=prefix=$DEPSDIR +export PKG_CONFIG="pkg-config $PKG_CONFIG_OPTS" + +cat<config.h +/* BitlBee settings, generated by $0 + + Do *NOT* use any of these defines in your code without thinking twice, most + of them can/will be overridden at run-time */ +#define CPU "i386" +#define IPV6 +#define GLIB2 +#define ARCH "Windows" +EOF + +cat<Makefile.settings +## BitlBee settings, generated by $0 +PREFIX= +BINDIR=\$(PREFIX)/sbin/ +ETCDIR=\$(PREFIX)/etc/bitlbee/ +MANDIR=\$(PREFIX)/share/man/ +DATADIR=\$(PREFIX)/share/bitlbee/ +CONFIG=\$(PREFIX)/lib/bitlbee/ +ARCH=Windows +CPU=i386 +OUTFILE=bitlbee.exe +STRIP=i586-mingw32msvc-strip + +DESTDIR= +LFLAGS=`$PKG_CONFIG --libs glib-2.0` -L$DEPSDIR/lib -lws2_32 -liconv +CFLAGS=`$PKG_CONFIG --cflags glib-2.0` -I$DEPSDIR/include -I`pwd` -I`pwd`/protocols +CC=i586-mingw32msvc-gcc +CXX=i586-mingw32msvc-g++ +LD=i586-mingw32msvc-ld +EOF diff --git a/win32/jabber.dsp b/win32/jabber.dsp new file mode 100644 index 00000000..ce5b08c7 --- /dev/null +++ b/win32/jabber.dsp @@ -0,0 +1,228 @@ +# Microsoft Developer Studio Project File - Name="jabber" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=jabber - Win32 Debug +!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 "jabber.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 "jabber.mak" CFG="jabber - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "jabber - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "jabber - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "jabber - 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 "jabrel" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\protocols\jabber" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib iconv.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/libjabber.dll" /libpath:"release" /libpath:"deps\lib" + +!ELSEIF "$(CFG)" == "jabber - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "jabber__" +# PROP BASE Intermediate_Dir "jabber__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "jabdeb" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\protocols\jabber" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 odbc32.lib glib-2.0.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbccp32.lib ws2_32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libjabber.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" + +!ENDIF + +# Begin Target + +# Name "jabber - Win32 Release" +# Name "jabber - Win32 Debug" +# Begin Source File + +SOURCE=..\protocols\jabber\asciitab.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\expat.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\genhash.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\hashtable.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\hashtable.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\iasciitab.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\jabber.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\jabber.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\jconn.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\jid.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\jpacket.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\jutil.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\karma.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\latin1tab.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\libxode.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\log.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\log.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\nametab.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\pool.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\pproxy.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\rate.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\str.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\utf8tab.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xhash.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmldef.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmlnode.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmlparse.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmlparse.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmlrole.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmlrole.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmltok.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmltok.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xmltok_impl.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\jabber\xstream.c +# End Source File +# End Target +# End Project diff --git a/win32/msn.dsp b/win32/msn.dsp new file mode 100644 index 00000000..4c5fcfb3 --- /dev/null +++ b/win32/msn.dsp @@ -0,0 +1,116 @@ +# Microsoft Developer Studio Project File - Name="msn" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=msn - Win32 Debug +!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 "msn.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 "msn.mak" CFG="msn - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "msn - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "msn - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "msn - 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 "msnrel" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "e:\dev\include\nss" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib iconv.lib glib-2.0.lib nss3.lib libnspr4.lib ssl3.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/libmsn.dll" /libpath:"release" /libpath:"deps\lib" + +!ELSEIF "$(CFG)" == "msn - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "msn___Wi" +# PROP BASE Intermediate_Dir "msn___Wi" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "msndeb" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 odbc32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbccp32.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libmsn.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" + +!ENDIF + +# Begin Target + +# Name "msn - Win32 Release" +# Name "msn - Win32 Debug" +# Begin Source File + +SOURCE=..\protocols\msn\msn.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\msn\msn_util.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\msn\ns.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\msn\passport.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\msn\sb.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\msn\tables.c +# End Source File +# End Target +# End Project diff --git a/win32/oscar.dsp b/win32/oscar.dsp new file mode 100644 index 00000000..aa2242ba --- /dev/null +++ b/win32/oscar.dsp @@ -0,0 +1,204 @@ +# Microsoft Developer Studio Project File - Name="oscar" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=oscar - Win32 Debug +!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 "oscar.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 "oscar.mak" CFG="oscar - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "oscar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "oscar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "oscar - 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 "oscarrel" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\protocols\oscar" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/liboscar.dll" /libpath:"release" /libpath:"deps\lib" + +!ELSEIF "$(CFG)" == "oscar - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "oscar___" +# PROP BASE Intermediate_Dir "oscar___" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "oscdeb" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\protocols\oscar" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 gmodule-2.0.lib ws2_32.lib glib-2.0.lib iconv.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/liboscar.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" + +!ENDIF + +# Begin Target + +# Name "oscar - Win32 Release" +# Name "oscar - Win32 Debug" +# Begin Source File + +SOURCE=..\protocols\oscar\admin.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\aim.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\aim_cbtypes.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\aim_internal.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\auth.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\bos.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\buddylist.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\chat.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\chatnav.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\conn.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\faimconfig.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\ft.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\icq.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\im.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\info.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\misc.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\msgcookie.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\oscar.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\oscar_util.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\rxhandlers.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\rxqueue.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\search.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\service.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\snac.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\ssi.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\stats.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\tlv.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\oscar\txqueue.c +# End Source File +# End Target +# End Project diff --git a/win32/res/bmp00002.bmp b/win32/res/bmp00002.bmp new file mode 100644 index 00000000..77205cb1 Binary files /dev/null and b/win32/res/bmp00002.bmp differ diff --git a/win32/res/icon2.ico b/win32/res/icon2.ico new file mode 100644 index 00000000..5dfe084f Binary files /dev/null and b/win32/res/icon2.ico differ diff --git a/win32/resource.h b/win32/resource.h new file mode 100644 index 00000000..f655c545 --- /dev/null +++ b/win32/resource.h @@ -0,0 +1,60 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by bitlbee.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDC_OK 101 +#define IDD_BITLBEE_DIALOG 102 +#define IDP_SOCKETS_INIT_FAILED 103 +#define IDD_PROPPAGE_ACCESS 106 +#define IDD_PROPPAGE_USERS 107 +#define IDD_PROPPAGE_PATHS 108 +#define IDR_MAINFRAME 128 +#define IDI_BEE 130 +#define IDD_PHONY 131 +#define IDR_POPUP 132 +#define IDD_PROPPAGE_ABOUT 132 +#define IDD_PROPPAGE_LOG 133 +#define IDB_BEE_SMALL 135 +#define IDD_PROPPAGE_CONNECTION 137 +#define IDI_ICON1 138 +#define IDC_AUTH_OPEN 1001 +#define IDC_AUTH_CLOSED 1002 +#define IDC_AUTH_REGISTERED 1003 +#define IDC_BROWSE_CONFIG 1004 +#define IDC_CONFIGDIR 1005 +#define IDC_BROWSE_MOTD 1006 +#define IDC_KNOWN_USERS 1007 +#define IDC_MOTDFILE 1007 +#define IDC_EDIT_MOTD 1008 +#define IDC_DEL_KNOWN_USERS 1008 +#define IDC_CURRENT_USERS 1009 +#define IDC_KICK 1010 +#define IDC_INTERFACE 1011 +#define IDC_PORT 1012 +#define IDC_PASSWORD 1013 +#define IDC_REFRESH_KNOWN_USERS 1015 +#define IDC_REFRESH_CURRENT_USERS 1016 +#define IDC_LOG 1017 +#define IDC_PROXYHOST 1018 +#define IDC_PROXYUSER 1019 +#define IDC_PROXYPASS 1020 +#define IDC_PROXY_ENABLED 1021 +#define IDC_PROXY_AUTH_ENABLED 1022 +#define IDC_PROXYPORT 1023 +#define IDC_PROXYTYPE 1024 +#define IDM_SHOW 32771 +#define IDM_EXIT 32773 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 139 +#define _APS_NEXT_COMMAND_VALUE 32774 +#define _APS_NEXT_CONTROL_VALUE 1025 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/win32/yahoo.dsp b/win32/yahoo.dsp new file mode 100644 index 00000000..ebfc4eef --- /dev/null +++ b/win32/yahoo.dsp @@ -0,0 +1,152 @@ +# Microsoft Developer Studio Project File - Name="yahoo" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=yahoo - Win32 Debug +!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 "yahoo.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 "yahoo.mak" CFG="yahoo - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "yahoo - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "yahoo - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "yahoo - 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 "yahrel" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib iconv.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/libyahoo.dll" /libpath:"release" /libpath:"deps\lib" + +!ELSEIF "$(CFG)" == "yahoo - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "yahoo___" +# PROP BASE Intermediate_Dir "yahoo___" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "yahdeb" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ws2_32.lib glib-2.0.lib gmodule-2.0.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libyahoo.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" + +!ENDIF + +# Begin Target + +# Name "yahoo - Win32 Release" +# Name "yahoo - Win32 Debug" +# Begin Source File + +SOURCE=..\protocols\yahoo\crypt.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\libyahoo2.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo2.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo2_callbacks.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo2_types.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_debug.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_fn.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_fn.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_httplib.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_httplib.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_list.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_list.h +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_util.c +# End Source File +# Begin Source File + +SOURCE=..\protocols\yahoo\yahoo_util.h +# End Source File +# End Target +# End Project -- cgit v1.2.3 From 99318adcb88fa3f1dd21882ec364e682fec96c5e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 7 Nov 2005 17:32:40 +0100 Subject: Import work on services-based Win32 port --- bitlbee.c | 6 --- unix.c | 6 +++ win32.c | 122 +++++++++++++++++++++++++++++++++++++++++------- win32/BUILD.TXT | 5 +- win32/bitlbee.dsp | 85 ++++++--------------------------- win32/bitlbee.dsw | 24 +++++++--- win32/configure.mingw32 | 37 --------------- 7 files changed, 145 insertions(+), 140 deletions(-) delete mode 100644 win32/configure.mingw32 diff --git a/bitlbee.c b/bitlbee.c index 32e28541..1054a42f 100644 --- a/bitlbee.c +++ b/bitlbee.c @@ -56,9 +56,6 @@ int bitlbee_daemon_init() int i; GIOChannel *ch; - log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); - log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); - global.listen_socket = socket( AF_INET, SOCK_STREAM, 0 ); if( global.listen_socket == -1 ) { @@ -112,9 +109,6 @@ int bitlbee_inetd_init() if( !irc_new( 0 ) ) return( 1 ); - log_link( LOGLVL_ERROR, LOGOUTPUT_IRC ); - log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); - return( 0 ); } diff --git a/unix.c b/unix.c index 140be68e..159b3126 100644 --- a/unix.c +++ b/unix.c @@ -60,12 +60,18 @@ int main( int argc, char *argv[] ) if( global.conf->runmode == RUNMODE_INETD ) { + log_link( LOGLVL_ERROR, LOGOUTPUT_IRC ); + log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); + i = bitlbee_inetd_init(); log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); } else if( global.conf->runmode == RUNMODE_DAEMON ) { + log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); + log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); + i = bitlbee_daemon_init(); log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); } diff --git a/win32.c b/win32.c index 5234c046..25adb9f0 100644 --- a/win32.c +++ b/win32.c @@ -4,7 +4,7 @@ * Copyright 2002-2004 Wilmer van der Gaast and others * \********************************************************************/ -/* Main file (Unix specific part) */ +/* Main file (Windows specific part) */ /* This program is free software; you can redistribute it and/or modify @@ -22,33 +22,56 @@ if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + +#define BITLBEE_CORE #include "bitlbee.h" #include "commands.h" #include "crypting.h" #include "protocols/nogaim.h" #include "help.h" #include -#include -#include -#include -#include +#include global_t global; /* Against global namespace pollution */ -int main( int argc, char *argv[] ) +static void WINAPI service_ctrl (DWORD dwControl) +{ + switch (dwControl) + { + case SERVICE_CONTROL_STOP: + /* FIXME */ + break; + + case SERVICE_CONTROL_INTERROGATE: + break; + + default: + break; + + } +} + +void service_main (DWORD argc, LPTSTR *argv) { int i = -1; + SERVICE_STATUS_HANDLE handle; + SERVICE_STATUS status; + + handle = RegisterServiceCtrlHandler("bitlbee", service_ctrl); + + if (!handle) + return; + + status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + status.dwServiceSpecificExitCode = 0; + memset( &global, 0, sizeof( global_t ) ); global.loop = g_main_new( FALSE ); - log_init( ); - nogaim_init( ); - global.conf = conf_load( argc, argv ); if( global.conf == NULL ) - return( 1 ); + return; if( global.conf->runmode == RUNMODE_INETD ) { @@ -67,18 +90,34 @@ int main( int argc, char *argv[] ) } if( i != 0 ) - return( i ); + return; if( access( global.conf->configdir, F_OK ) != 0 ) log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); - else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 ) + else if( access( global.conf->configdir, 06 ) != 0 ) log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); if( help_init( &(global.help) ) == NULL ) log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); + + SetServiceStatus(handle, &status); g_main_run( global.loop ); - - return( 0 ); +} + +int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + SERVICE_TABLE_ENTRY dispatch_table[] = + { + { TEXT("bitlbee"), (LPSERVICE_MAIN_FUNCTION)service_main }, + { NULL, NULL } + }; + + nogaim_init( ); + + if (!StartServiceCtrlDispatcher(dispatch_table)) + log_message( LOGLVL_ERROR, "StartServiceCtrlDispatcher failed."); + + return 0; } double gettime() @@ -118,9 +157,10 @@ conf_t *conf_load( int argc, char *argv[] ) conf_t *conf; HKEY key, key_main, key_proxy; char *tmp; - RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee", &key); - RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee\\main", &key_main); - RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee\\proxy", &key_proxy); + + RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Bitlbee", &key); + RegOpenKey(key, "main", &key_main); + RegOpenKey(key, "proxy", &key_proxy); memset( &global, 0, sizeof( global_t ) ); global.loop = g_main_new(FALSE); @@ -189,3 +229,49 @@ inet_aton(const char *cp, struct in_addr *addr) addr->s_addr = inet_addr(cp); return (addr->s_addr == INADDR_NONE) ? 0 : 1; } + +void log_error(char *msg) +{ + log_message(LOGLVL_ERROR, "%s", msg); +} + +void log_message(int level, char *message, ...) +{ + HANDLE hEventSource; + LPTSTR lpszStrings[2]; + WORD elevel; + va_list ap; + + va_start(ap, message); + + hEventSource = RegisterEventSource(NULL, TEXT("bitlbee")); + + lpszStrings[0] = TEXT("bitlbee"); + lpszStrings[1] = g_strdup_vprintf(message, ap); + va_end(ap); + + switch (level) { + case LOGLVL_ERROR: elevel = EVENTLOG_ERROR_TYPE; break; + case LOGLVL_WARNING: elevel = EVENTLOG_WARNING_TYPE; break; + case LOGLVL_INFO: elevel = EVENTLOG_INFORMATION_TYPE; break; +#ifdef DEBUG + case LOGLVL_DEBUG: elevel = EVENTLOG_AUDIT_SUCCESS; break; +#endif + } + + if (hEventSource != NULL) { + ReportEvent(hEventSource, + elevel, + 0, + 0, + NULL, + 2, + 0, + lpszStrings, + NULL); + + DeregisterEventSource(hEventSource); + } + + g_free(lpszStrings[1]); +} diff --git a/win32/BUILD.TXT b/win32/BUILD.TXT index 718152b7..03e1b8d9 100644 --- a/win32/BUILD.TXT +++ b/win32/BUILD.TXT @@ -4,10 +4,11 @@ Instructions for building the Bitlbee Win32 port 1. Download the latest version using bzr (http://www.bazaar-ng.org/): bzr branch http://jelmer.vernstok.nl/oss/bitlbee/bzr/win32 bitlbee-win32 2. Download and install the required development files: - from http://www.ethereal.com/distribution/win32/development/: - - libiconv + from ftp://ftp.gtk.org/pub/gtk/v2.8/win32/ - glib - glib-dev + - libiconv + - gettext from http://ftp.mozilla.org/pub/mozilla.org/ - nss - nspr diff --git a/win32/bitlbee.dsp b/win32/bitlbee.dsp index ef0f3ada..3f26fca0 100644 --- a/win32/bitlbee.dsp +++ b/win32/bitlbee.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "GLIB2" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib glib-2.0.lib gmodule-2.0.lib /nologo /subsystem:windows /machine:I386 /libpath:"release" /libpath:"deps\lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 /libpath:"release" /libpath:"deps\lib" # SUBTRACT LINK32 /incremental:yes /nodefaultlib !ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "GLIB2" /FR /FD /c +# ADD CPP /nologo /Gd /MDd /Ze /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 @@ -81,7 +81,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 iconv.lib glib-2.0.lib gmodule-2.0.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" +# ADD LINK32 iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" !ENDIF @@ -103,10 +103,13 @@ SOURCE=..\bitlbee.c # Begin Source File SOURCE=.\bitlbee.rc -# End Source File -# Begin Source File -SOURCE=.\bitlbeewin.cpp +!IF "$(CFG)" == "bitlbee - Win32 Release" + +!ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" + +!ENDIF + # End Source File # Begin Source File @@ -130,10 +133,6 @@ SOURCE=..\irc.c # End Source File # Begin Source File -SOURCE=.\MainDlg.cpp -# End Source File -# Begin Source File - SOURCE=..\protocols\md5.c # End Source File # Begin Source File @@ -146,26 +145,6 @@ SOURCE=..\protocols\nogaim.c # End Source File # Begin Source File -SOURCE=.\PropAccess.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropConn.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropLog.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropPaths.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropUsers.cpp -# End Source File -# Begin Source File - SOURCE=..\protocols\proxy.c # End Source File # Begin Source File @@ -182,10 +161,6 @@ SOURCE=..\protocols\sha.c # End Source File # Begin Source File -SOURCE=.\TrayNot.cpp -# End Source File -# Begin Source File - SOURCE=..\user.c # End Source File # Begin Source File @@ -200,6 +175,10 @@ SOURCE=..\protocols\util.c !ENDIF +# End Source File +# Begin Source File + +SOURCE=..\win32.c # End Source File # End Group # Begin Group "Header Files" @@ -215,10 +194,6 @@ SOURCE=..\bitlbee.h # End Source File # Begin Source File -SOURCE=.\bitlbeewin.h -# End Source File -# Begin Source File - SOURCE=..\commands.h # End Source File # Begin Source File @@ -251,10 +226,6 @@ SOURCE=..\log.h # End Source File # Begin Source File -SOURCE=.\MainDlg.h -# End Source File -# Begin Source File - SOURCE=..\protocols\md5.h # End Source File # Begin Source File @@ -267,30 +238,6 @@ SOURCE=..\protocols\nogaim.h # End Source File # Begin Source File -SOURCE=.\PropAccess.h -# End Source File -# Begin Source File - -SOURCE=.\PropConn.h -# End Source File -# Begin Source File - -SOURCE=.\PropLog.h -# End Source File -# Begin Source File - -SOURCE=.\PropPaths.h -# End Source File -# Begin Source File - -SOURCE=.\PropUsers.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - SOURCE=..\set.h # End Source File # Begin Source File @@ -303,10 +250,6 @@ SOURCE=..\sock.h # End Source File # Begin Source File -SOURCE=.\TrayNot.h -# End Source File -# Begin Source File - SOURCE=..\user.h # End Source File # End Group diff --git a/win32/bitlbee.dsw b/win32/bitlbee.dsw index e91fea5e..7f446962 100644 --- a/win32/bitlbee.dsw +++ b/win32/bitlbee.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 5.00 ############################################################################### -Project: "bitlbee"=".\bitlbee.dsp" - Package Owner=<4> +Project: "admin"=.\admin1\admin.dsp - Package Owner=<4> Package=<5> {{{ @@ -15,7 +15,7 @@ Package=<4> ############################################################################### -Project: "bitlbee_ssl"=".\bitlbee_ssl\bitlbee_ssl.dsp" - Package Owner=<4> +Project: "bitlbee"=.\bitlbee.dsp - Package Owner=<4> Package=<5> {{{ @@ -27,7 +27,19 @@ Package=<4> ############################################################################### -Project: "jabber"=".\jabber.dsp" - Package Owner=<4> +Project: "bitlbee_ssl"=.\bitlbee_ssl.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "jabber"=.\jabber.dsp - Package Owner=<4> Package=<5> {{{ @@ -45,7 +57,7 @@ Package=<4> ############################################################################### -Project: "msn"=".\msn.dsp" - Package Owner=<4> +Project: "msn"=.\msn.dsp - Package Owner=<4> Package=<5> {{{ @@ -63,7 +75,7 @@ Package=<4> ############################################################################### -Project: "oscar"=".\oscar.dsp" - Package Owner=<4> +Project: "oscar"=.\oscar.dsp - Package Owner=<4> Package=<5> {{{ @@ -78,7 +90,7 @@ Package=<4> ############################################################################### -Project: "yahoo"=".\yahoo.dsp" - Package Owner=<4> +Project: "yahoo"=.\yahoo.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/win32/configure.mingw32 b/win32/configure.mingw32 deleted file mode 100644 index 678e9243..00000000 --- a/win32/configure.mingw32 +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -DEPSDIR=$1 -export PKG_CONFIG_LIBDIR=$DEPSDIR/lib/pkgconfig -export PKG_CONFIG_OPTS=--define-variable=prefix=$DEPSDIR -export PKG_CONFIG="pkg-config $PKG_CONFIG_OPTS" - -cat<config.h -/* BitlBee settings, generated by $0 - - Do *NOT* use any of these defines in your code without thinking twice, most - of them can/will be overridden at run-time */ -#define CPU "i386" -#define IPV6 -#define GLIB2 -#define ARCH "Windows" -EOF - -cat<Makefile.settings -## BitlBee settings, generated by $0 -PREFIX= -BINDIR=\$(PREFIX)/sbin/ -ETCDIR=\$(PREFIX)/etc/bitlbee/ -MANDIR=\$(PREFIX)/share/man/ -DATADIR=\$(PREFIX)/share/bitlbee/ -CONFIG=\$(PREFIX)/lib/bitlbee/ -ARCH=Windows -CPU=i386 -OUTFILE=bitlbee.exe -STRIP=i586-mingw32msvc-strip - -DESTDIR= -LFLAGS=`$PKG_CONFIG --libs glib-2.0` -L$DEPSDIR/lib -lws2_32 -liconv -CFLAGS=`$PKG_CONFIG --cflags glib-2.0` -I$DEPSDIR/include -I`pwd` -I`pwd`/protocols -CC=i586-mingw32msvc-gcc -CXX=i586-mingw32msvc-g++ -LD=i586-mingw32msvc-ld -EOF -- cgit v1.2.3 From abe53d3c48a6552e136ddc8bc554764daf255a05 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 7 Nov 2005 17:42:49 +0100 Subject: More work on config manager --- .bzrignore | 9 ++ doc/BUILD.win32 | 23 +++ win32.c | 136 +++++++++++------ win32/BUILD.TXT | 23 --- win32/MainDlg.cpp | 78 ---------- win32/MainDlg.h | 52 ------- win32/PropAccess.cpp | 123 --------------- win32/PropAccess.h | 56 ------- win32/PropConn.cpp | 125 --------------- win32/PropConn.h | 56 ------- win32/PropLog.cpp | 80 ---------- win32/PropLog.h | 47 ------ win32/PropPaths.cpp | 119 --------------- win32/PropPaths.h | 55 ------- win32/PropUsers.cpp | 120 --------------- win32/PropUsers.h | 54 ------- win32/TrayNot.cpp | 106 ------------- win32/TrayNot.h | 54 ------- win32/admin/MainDlg.cpp | 71 +++++++++ win32/admin/MainDlg.h | 54 +++++++ win32/admin/PropAccess.cpp | 114 ++++++++++++++ win32/admin/PropAccess.h | 59 ++++++++ win32/admin/PropConn.cpp | 123 +++++++++++++++ win32/admin/PropConn.h | 59 ++++++++ win32/admin/PropLog.cpp | 78 ++++++++++ win32/admin/PropLog.h | 47 ++++++ win32/admin/PropMain.cpp | 99 ++++++++++++ win32/admin/PropMain.h | 58 +++++++ win32/admin/PropPaths.cpp | 115 ++++++++++++++ win32/admin/PropPaths.h | 57 +++++++ win32/admin/admin.dsp | 175 +++++++++++++++++++++ win32/admin/bitlbee.rc | 303 ++++++++++++++++++++++++++++++++++++ win32/admin/bitlbeewin.cpp | 47 ++++++ win32/admin/bitlbeewin.h | 49 ++++++ win32/admin/res/bmp00002.bmp | Bin 0 -> 5830 bytes win32/admin/res/icon2.ico | Bin 0 -> 3774 bytes win32/admin/resource.h | 65 ++++++++ win32/bitlbee.dsp | 44 +----- win32/bitlbee.rc | 354 ------------------------------------------- win32/bitlbeewin.cpp | 210 ------------------------- win32/bitlbeewin.h | 59 -------- win32/res/bmp00002.bmp | Bin 5830 -> 0 bytes win32/res/icon2.ico | Bin 3774 -> 0 bytes win32/resource.h | 60 -------- 44 files changed, 1697 insertions(+), 1919 deletions(-) create mode 100644 doc/BUILD.win32 delete mode 100644 win32/BUILD.TXT delete mode 100644 win32/MainDlg.cpp delete mode 100644 win32/MainDlg.h delete mode 100644 win32/PropAccess.cpp delete mode 100644 win32/PropAccess.h delete mode 100644 win32/PropConn.cpp delete mode 100644 win32/PropConn.h delete mode 100644 win32/PropLog.cpp delete mode 100644 win32/PropLog.h delete mode 100644 win32/PropPaths.cpp delete mode 100644 win32/PropPaths.h delete mode 100644 win32/PropUsers.cpp delete mode 100644 win32/PropUsers.h delete mode 100644 win32/TrayNot.cpp delete mode 100644 win32/TrayNot.h create mode 100644 win32/admin/MainDlg.cpp create mode 100644 win32/admin/MainDlg.h create mode 100644 win32/admin/PropAccess.cpp create mode 100644 win32/admin/PropAccess.h create mode 100644 win32/admin/PropConn.cpp create mode 100644 win32/admin/PropConn.h create mode 100644 win32/admin/PropLog.cpp create mode 100644 win32/admin/PropLog.h create mode 100644 win32/admin/PropMain.cpp create mode 100644 win32/admin/PropMain.h create mode 100644 win32/admin/PropPaths.cpp create mode 100644 win32/admin/PropPaths.h create mode 100644 win32/admin/admin.dsp create mode 100644 win32/admin/bitlbee.rc create mode 100644 win32/admin/bitlbeewin.cpp create mode 100644 win32/admin/bitlbeewin.h create mode 100644 win32/admin/res/bmp00002.bmp create mode 100644 win32/admin/res/icon2.ico create mode 100644 win32/admin/resource.h delete mode 100644 win32/bitlbee.rc delete mode 100644 win32/bitlbeewin.cpp delete mode 100644 win32/bitlbeewin.h delete mode 100644 win32/res/bmp00002.bmp delete mode 100644 win32/res/icon2.ico delete mode 100644 win32/resource.h diff --git a/.bzrignore b/.bzrignore index 87082fd4..6a862781 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,3 +1,12 @@ Makefile.settings config.h bitlbee +Debug +Debugx +deps +admin/Debug +admin/admin.plg +bitlbee.plg +*.plg +*.aps +*.clw diff --git a/doc/BUILD.win32 b/doc/BUILD.win32 new file mode 100644 index 00000000..03e1b8d9 --- /dev/null +++ b/doc/BUILD.win32 @@ -0,0 +1,23 @@ +Instructions for building the Bitlbee Win32 port +================================================ + +1. Download the latest version using bzr (http://www.bazaar-ng.org/): + bzr branch http://jelmer.vernstok.nl/oss/bitlbee/bzr/win32 bitlbee-win32 +2. Download and install the required development files: + from ftp://ftp.gtk.org/pub/gtk/v2.8/win32/ + - glib + - glib-dev + - libiconv + - gettext + from http://ftp.mozilla.org/pub/mozilla.org/ + - nss + - nspr + +I've put them inside c:\dev, so you might have the most with that location. + +3. Open bitlbee.dsw in VC++ and build :-) + +4. Now you're done. When running, make sure all the required DLL's are accessible. If they can't be found, place them inside c:\winnt\system32 or the Debug or Release directories inside bitlbee-...\win32\. + +5. To build setup files, compile the bitlbee.iss file using the Inno Setup + program (available from www.jrsoftware.org). diff --git a/win32.c b/win32.c index 25adb9f0..63148271 100644 --- a/win32.c +++ b/win32.c @@ -50,10 +50,47 @@ static void WINAPI service_ctrl (DWORD dwControl) } } + +static void bitlbee_init(int argc, char **argv) +{ + int i = -1; + memset( &global, 0, sizeof( global_t ) ); + + global.loop = g_main_new( FALSE ); + + global.conf = conf_load( argc, argv ); + if( global.conf == NULL ) + return; + + if( global.conf->runmode == RUNMODE_INETD ) + { + i = bitlbee_inetd_init(); + log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); + + } + else if( global.conf->runmode == RUNMODE_DAEMON ) + { + i = bitlbee_daemon_init(); + log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); + } + else + { + log_message( LOGLVL_INFO, "No bitlbee mode specified..."); + } + + if( i != 0 ) + return; + + if( access( global.conf->configdir, F_OK ) != 0 ) + log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); + else if( access( global.conf->configdir, 06 ) != 0 ) + log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); + if( help_init( &(global.help) ) == NULL ) + log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); +} void service_main (DWORD argc, LPTSTR *argv) { - int i = -1; SERVICE_STATUS_HANDLE handle; SERVICE_STATUS status; @@ -64,58 +101,53 @@ void service_main (DWORD argc, LPTSTR *argv) status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; status.dwServiceSpecificExitCode = 0; - - memset( &global, 0, sizeof( global_t ) ); - - global.loop = g_main_new( FALSE ); - - global.conf = conf_load( argc, argv ); - if( global.conf == NULL ) - return; - - if( global.conf->runmode == RUNMODE_INETD ) - { - i = bitlbee_inetd_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); - - } - else if( global.conf->runmode == RUNMODE_DAEMON ) - { - i = bitlbee_daemon_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); - } - else - { - log_message( LOGLVL_INFO, "No bitlbee mode specified..."); - } - - if( i != 0 ) - return; - - if( access( global.conf->configdir, F_OK ) != 0 ) - log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); - else if( access( global.conf->configdir, 06 ) != 0 ) - log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); - if( help_init( &(global.help) ) == NULL ) - log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); + + bitlbee_init(argc, argv); SetServiceStatus(handle, &status); g_main_run( global.loop ); } -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - SERVICE_TABLE_ENTRY dispatch_table[] = - { - { TEXT("bitlbee"), (LPSERVICE_MAIN_FUNCTION)service_main }, - { NULL, NULL } - }; +SERVICE_TABLE_ENTRY dispatch_table[] = +{ + { TEXT("bitlbee"), (LPSERVICE_MAIN_FUNCTION)service_main }, + { NULL, NULL } +}; + +static int debug = 0; + +static void usage() +{ + printf("Options:\n"); + printf("-h Show this help message\n"); + printf("-d Debug mode (simple console program)\n"); +} + +int main( int argc, char **argv) +{ + int i; + WSADATA WSAData; nogaim_init( ); - - if (!StartServiceCtrlDispatcher(dispatch_table)) - log_message( LOGLVL_ERROR, "StartServiceCtrlDispatcher failed."); + + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-d")) debug = 1; + if (!strcmp(argv[i], "-h")) { + usage(); + return 0; + } + } + + WSAStartup(MAKEWORD(1,1), &WSAData); + + if (!debug) { + if (!StartServiceCtrlDispatcher(dispatch_table)) + log_message( LOGLVL_ERROR, "StartServiceCtrlDispatcher failed."); + } else { + bitlbee_init(argc, argv); + g_main_run( global.loop ); + } return 0; } @@ -164,7 +196,6 @@ conf_t *conf_load( int argc, char *argv[] ) memset( &global, 0, sizeof( global_t ) ); global.loop = g_main_new(FALSE); - nogaim_init(); conf = g_new0( conf_t,1 ); global.conf = conf; @@ -177,8 +208,8 @@ conf_t *conf_load( int argc, char *argv[] ) conf_get_string(key_main, "configdir", NULL, &global.conf->configdir); conf_get_string(key_main, "motdfile", NULL, &global.conf->motdfile); conf_get_string(key_main, "helpfile", NULL, &global.helpfile); - global.conf->runmode = RUNMODE_INETD; - conf_get_int(key_main, "AuthMode", AUTHMODE_CLOSED, &global.conf->authmode); + global.conf->runmode = RUNMODE_DAEMON; + conf_get_int(key_main, "AuthMode", AUTHMODE_OPEN, &global.conf->authmode); conf_get_string(key_proxy, "host", "", &tmp); strcpy(proxyhost, tmp); conf_get_string(key_proxy, "user", "", &tmp); strcpy(proxyuser, tmp); conf_get_string(key_proxy, "password", "", &tmp); strcpy(proxypass, tmp); @@ -242,7 +273,14 @@ void log_message(int level, char *message, ...) WORD elevel; va_list ap; - va_start(ap, message); + va_start(ap, message); + + if (debug) { + vprintf(message, ap); + putchar('\n'); + va_end(ap); + return; + } hEventSource = RegisterEventSource(NULL, TEXT("bitlbee")); diff --git a/win32/BUILD.TXT b/win32/BUILD.TXT deleted file mode 100644 index 03e1b8d9..00000000 --- a/win32/BUILD.TXT +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building the Bitlbee Win32 port -================================================ - -1. Download the latest version using bzr (http://www.bazaar-ng.org/): - bzr branch http://jelmer.vernstok.nl/oss/bitlbee/bzr/win32 bitlbee-win32 -2. Download and install the required development files: - from ftp://ftp.gtk.org/pub/gtk/v2.8/win32/ - - glib - - glib-dev - - libiconv - - gettext - from http://ftp.mozilla.org/pub/mozilla.org/ - - nss - - nspr - -I've put them inside c:\dev, so you might have the most with that location. - -3. Open bitlbee.dsw in VC++ and build :-) - -4. Now you're done. When running, make sure all the required DLL's are accessible. If they can't be found, place them inside c:\winnt\system32 or the Debug or Release directories inside bitlbee-...\win32\. - -5. To build setup files, compile the bitlbee.iss file using the Inno Setup - program (available from www.jrsoftware.org). diff --git a/win32/MainDlg.cpp b/win32/MainDlg.cpp deleted file mode 100644 index 615a9a3b..00000000 --- a/win32/MainDlg.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// MainDlg.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "PropUsers.h" -#include "PropPaths.h" -#include "PropAccess.h" -#include "PropLog.h" -#include "PropConn.h" -#include "MainDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainDlg - -IMPLEMENT_DYNAMIC(CMainDlg, CPropertySheet) - -CMainDlg::CMainDlg() : CPropertySheet("Bitlbee for Windows") -{ - AddPage(new CPropPaths()); - AddPage(new CPropAccess()); - AddPage(new CPropUsers()); - AddPage(new CPropLog()); - AddPage(new CPropertyPage(IDD_PROPPAGE_ABOUT)); - AddPage(new CPropConn()); - Create(); - ShowWindow(SW_HIDE); -} - -CMainDlg::~CMainDlg() -{ -} - - -BEGIN_MESSAGE_MAP(CMainDlg, CPropertySheet) - //{{AFX_MSG_MAP(CMainDlg) - ON_WM_CLOSE() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDOK, OnOK) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMainDlg message handlers - -BOOL CMainDlg::OnInitDialog() -{ - m_bModeless = FALSE; - m_nFlags |= WF_CONTINUEMODAL; - - CPropertySheet::OnInitDialog(); - GetDlgItem(IDHELP)->ShowWindow(SW_HIDE); - GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE); - - m_bModeless = TRUE; - m_nFlags &= WF_CONTINUEMODAL; - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CMainDlg::OnOK() -{ - PressButton(PSBTN_APPLYNOW); - ShowWindow(SW_HIDE); -} - - -void CMainDlg::OnClose() -{ - ShowWindow(SW_HIDE); -} - diff --git a/win32/MainDlg.h b/win32/MainDlg.h deleted file mode 100644 index 7cdf612b..00000000 --- a/win32/MainDlg.h +++ /dev/null @@ -1,52 +0,0 @@ -#if !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) -#define AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// MainDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CMainDlg - -class CMainDlg : public CPropertySheet -{ - DECLARE_DYNAMIC(CMainDlg) - -// Construction -public: - CMainDlg(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMainDlg) - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CMainDlg(); - - // Generated message map functions -protected: - //{{AFX_MSG(CMainDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnClose(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - void OnOK(); -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) diff --git a/win32/PropAccess.cpp b/win32/PropAccess.cpp deleted file mode 100644 index fd787b39..00000000 --- a/win32/PropAccess.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// PropAccess.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "PropAccess.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropAccess dialog - - -CPropAccess::CPropAccess() - : CPropertyPage(CPropAccess::IDD) -{ - - //{{AFX_DATA_INIT(CPropAccess) - //}}AFX_DATA_INIT -} - - -void CPropAccess::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropAccess) - DDX_Control(pDX, IDC_AUTH_REGISTERED, m_auth_registered); - DDX_Control(pDX, IDC_AUTH_OPEN, m_auth_open); - DDX_Control(pDX, IDC_AUTH_CLOSED, m_auth_closed); - DDX_Control(pDX, IDC_PASSWORD, m_password); - DDX_Control(pDX, IDC_PORT, m_port); - DDX_Control(pDX, IDC_INTERFACE, m_interface); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropAccess, CPropertyPage) - //{{AFX_MSG_MAP(CPropAccess) - ON_BN_CLICKED(IDC_AUTH_REGISTERED, OnAuthRegistered) - ON_BN_CLICKED(IDC_AUTH_OPEN, OnAuthOpen) - ON_BN_CLICKED(IDC_AUTH_CLOSED, OnAuthClosed) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropAccess message handlers - -void CPropAccess::OnOK() -{ - CString iface; m_interface.GetWindowText(iface); - CString port; m_port.GetWindowText(port); - - CString password; m_password.GetWindowText(password); - g_free((void *)global.conf->password); - global.conf->password = g_strdup(password); - - if(m_auth_closed.GetCheck() == 1) global.conf->authmode = AUTHMODE_CLOSED; - if(m_auth_open.GetCheck() == 1) global.conf->authmode = AUTHMODE_OPEN; - if(m_auth_registered.GetCheck() == 1) global.conf->authmode = AUTHMODE_REGISTERED; - - if(strcmp(iface, global.conf->iface) || atol(port) != global.conf->port) { - global.conf->port = atoi(port); - g_free((void *)global.conf->iface); - global.conf->iface = g_strdup(iface); - closesocket(global.listen_socket); - bitlbee_daemon_init(); - } - - - CPropertyPage::OnOK(); -} - -void CPropAccess::OnAuthRegistered() -{ - m_password.EnableWindow(FALSE); - m_auth_open.SetCheck(0); - m_auth_registered.SetCheck(1); - m_auth_closed.SetCheck(0); - -} - -void CPropAccess::OnAuthOpen() -{ - m_password.EnableWindow(FALSE); - m_auth_open.SetCheck(1); - m_auth_registered.SetCheck(0); - m_auth_closed.SetCheck(0); -} - -void CPropAccess::OnAuthClosed() -{ - m_password.EnableWindow(TRUE); - m_auth_open.SetCheck(0); - m_auth_registered.SetCheck(0); - m_auth_closed.SetCheck(1); - -} - -BOOL CPropAccess::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - m_interface.SetWindowText(global.conf->iface); - m_password.SetWindowText(global.conf->password); - char tmp[20]; - g_snprintf(tmp, sizeof(tmp), "%d", global.conf->port); - m_port.SetWindowText(tmp); - m_auth_open.SetCheck(0); - m_auth_closed.SetCheck(0); - m_auth_registered.SetCheck(0); - - switch(global.conf->authmode) { - case AUTHMODE_OPEN: m_auth_open.SetCheck(1); m_password.EnableWindow(FALSE);break; - case AUTHMODE_CLOSED: m_auth_closed.SetCheck(1); m_password.EnableWindow(TRUE);break; - case AUTHMODE_REGISTERED: m_auth_registered.SetCheck(1);m_password.EnableWindow(FALSE);break; - } - - return TRUE; -} diff --git a/win32/PropAccess.h b/win32/PropAccess.h deleted file mode 100644 index bc80c648..00000000 --- a/win32/PropAccess.h +++ /dev/null @@ -1,56 +0,0 @@ -#if !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) -#define AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropAccess.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPropAccess dialog - -class CPropAccess : public CPropertyPage -{ -// Construction -public: - CPropAccess(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropAccess) - enum { IDD = IDD_PROPPAGE_ACCESS }; - CButton m_auth_registered; - CButton m_auth_open; - CButton m_auth_closed; - CEdit m_password; - CEdit m_port; - CEdit m_interface; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropAccess) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropAccess) - afx_msg void OnAuthRegistered(); - afx_msg void OnAuthOpen(); - afx_msg void OnAuthClosed(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) diff --git a/win32/PropConn.cpp b/win32/PropConn.cpp deleted file mode 100644 index 15d4a90a..00000000 --- a/win32/PropConn.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// PropConn.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "PropConn.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropConn dialog - - -CPropConn::CPropConn(CWnd* pParent /*=NULL*/) - : CPropertyPage(CPropConn::IDD) -{ - //{{AFX_DATA_INIT(CPropConn) - //}}AFX_DATA_INIT -} - - -void CPropConn::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropConn) - DDX_Control(pDX, IDC_PROXYPORT, m_proxyport); - DDX_Control(pDX, IDC_PROXYTYPE, m_proxytype); - DDX_Control(pDX, IDC_PROXY_ENABLED, m_proxy_enabled); - DDX_Control(pDX, IDC_PROXY_AUTH_ENABLED, m_proxy_auth_enabled); - DDX_Control(pDX, IDC_PROXYPASS, m_proxypass); - DDX_Control(pDX, IDC_PROXYHOST, m_proxyhost); - DDX_Control(pDX, IDC_PROXYUSER, m_proxyuser); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropConn, CPropertyPage) - //{{AFX_MSG_MAP(CPropConn) - ON_BN_CLICKED(IDC_PROXY_AUTH_ENABLED, OnProxyAuthEnabled) - ON_BN_CLICKED(IDC_PROXY_ENABLED, OnProxyEnabled) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropConn message handlers - -void CPropConn::OnProxyAuthEnabled() -{ - m_proxyuser.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); - m_proxypass.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); -} - -void CPropConn::OnProxyEnabled() -{ - // TODO: Add your control notification handler code here - m_proxyhost.EnableWindow(m_proxy_enabled.GetCheck()); - m_proxytype.EnableWindow(m_proxy_enabled.GetCheck()); - m_proxyport.EnableWindow(m_proxy_enabled.GetCheck()); - m_proxy_auth_enabled.EnableWindow(m_proxy_enabled.GetCheck()); - - if(m_proxy_enabled.GetCheck() && (m_proxytype.GetCurSel() < 0 || m_proxytype.GetCurSel() > 2)) - { - m_proxytype.SetCurSel(0); - } - - OnProxyAuthEnabled(); -} - -void CPropConn::OnOK() -{ - if(!m_proxy_enabled.GetCheck()) { - proxytype = PROXY_NONE; - return; - } - - CString tmp; - m_proxyhost.GetWindowText(tmp); - strcpy(proxyhost, tmp); - - m_proxyport.GetWindowText(tmp); - proxyport = atoi(tmp); - - proxytype = m_proxytype.GetCurSel()+1; - - if(!m_proxy_auth_enabled.GetCheck()) { - strcpy(proxyuser, ""); - strcpy(proxypass, ""); - return; - } - - m_proxyuser.GetWindowText(tmp); - strcpy(proxyuser, tmp); - m_proxypass.GetWindowText(tmp); - strcpy(proxypass, tmp); - - CPropertyPage::OnOK(); -} - -BOOL CPropConn::OnInitDialog() -{ - char pp[20]; - CPropertyPage::OnInitDialog(); - - m_proxyhost.SetWindowText(proxyhost); - m_proxyuser.SetWindowText(proxyuser); - m_proxypass.SetWindowText(proxypass); - g_snprintf(pp, 20, "%d", proxyport); - m_proxyport.SetWindowText(pp); - - m_proxytype.AddString("SOCKS 4"); - m_proxytype.AddString("SOCKS 5"); - m_proxytype.AddString("HTTP"); - m_proxytype.SetCurSel(proxytype-1); - - m_proxy_enabled.SetCheck(proxytype == PROXY_NONE?0:1); - m_proxy_auth_enabled.SetCheck(strcmp(proxyuser, "")?1:0); - - OnProxyEnabled(); - - return TRUE; -} diff --git a/win32/PropConn.h b/win32/PropConn.h deleted file mode 100644 index 1143912c..00000000 --- a/win32/PropConn.h +++ /dev/null @@ -1,56 +0,0 @@ -#if !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) -#define AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropConn.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPropConn dialog - -class CPropConn : public CPropertyPage -{ -// Construction -public: - CPropConn(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropConn) - enum { IDD = IDD_PROPPAGE_CONNECTION }; - CEdit m_proxyport; - CListBox m_proxytype; - CButton m_proxy_enabled; - CButton m_proxy_auth_enabled; - CEdit m_proxypass; - CEdit m_proxyhost; - CEdit m_proxyuser; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropConn) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropConn) - afx_msg void OnProxyAuthEnabled(); - afx_msg void OnProxyEnabled(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) diff --git a/win32/PropLog.cpp b/win32/PropLog.cpp deleted file mode 100644 index 27957b07..00000000 --- a/win32/PropLog.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// PropLog.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "PropLog.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropLog dialog - - -CPropLog::CPropLog() - : CPropertyPage(CPropLog::IDD) -{ - //{{AFX_DATA_INIT(CPropLog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CPropLog::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropLog) - DDX_Control(pDX, IDC_LOG, m_log); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropLog, CPropertyPage) - //{{AFX_MSG_MAP(CPropLog) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropLog message handlers - -static GList *log = NULL; - -extern "C" { -void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data) -{ - log = g_list_append(log, g_strdup_printf("%s: %s", log_domain, msg)); -} -} - -void log_message(int level, char *message, ... ) { -#define LOG_MAXLEN 300 - va_list ap; - va_start(ap, message); - char *msg = (char *)g_malloc(LOG_MAXLEN); - g_vsnprintf(msg, LOG_MAXLEN, message, ap); - va_end(ap); - log = g_list_append(log, msg); - if(level == LOGLVL_ERROR) ::MessageBox(NULL, msg, "Bitlbee", MB_OK | MB_ICONINFORMATION); - TRACE("%d: %s\n", level, msg); -} - - -BOOL CPropLog::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - m_log.ResetContent(); - GList *gl = log; - while(gl) { - char *d = (char *)gl->data; - m_log.AddString(d); - gl = gl->next; - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/win32/PropLog.h b/win32/PropLog.h deleted file mode 100644 index 1a847b19..00000000 --- a/win32/PropLog.h +++ /dev/null @@ -1,47 +0,0 @@ -#if !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) -#define AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropLog.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPropLog dialog - -class CPropLog : public CPropertyPage -{ -// Construction -public: - CPropLog(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropLog) - enum { IDD = IDD_PROPPAGE_LOG }; - CListBox m_log; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropLog) - public: - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropLog) - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) diff --git a/win32/PropPaths.cpp b/win32/PropPaths.cpp deleted file mode 100644 index 7790e99c..00000000 --- a/win32/PropPaths.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// PropPaths.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "PropPaths.h" -#include "shlobj.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropPaths dialog - - -CPropPaths::CPropPaths() - : CPropertyPage(CPropPaths::IDD) -{ - //{{AFX_DATA_INIT(CPropPaths) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CPropPaths::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropPaths) - DDX_Control(pDX, IDC_MOTDFILE, m_motdfile); - DDX_Control(pDX, IDC_EDIT_MOTD, m_edit_motd); - DDX_Control(pDX, IDC_CONFIGDIR, m_configdir); - DDX_Control(pDX, IDC_BROWSE_MOTD, m_browse_motd); - DDX_Control(pDX, IDC_BROWSE_CONFIG, m_browse_config); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropPaths, CPropertyPage) - //{{AFX_MSG_MAP(CPropPaths) - ON_BN_CLICKED(IDC_BROWSE_CONFIG, OnBrowseConfig) - ON_BN_CLICKED(IDC_BROWSE_MOTD, OnBrowseMotd) - ON_BN_CLICKED(IDC_EDIT_MOTD, OnEditMotd) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropPaths message handlers - -void CPropPaths::OnOK() -{ - CString tmp; - g_free((void *)global.conf->configdir); - m_configdir.GetWindowText(tmp); - - if (tmp.GetLength() > 0 - && tmp.GetAt(tmp.GetLength() - 1) != '/' - && tmp.GetAt(tmp.GetLength() - 1) != '\\') - { - global.conf->configdir = g_strdup_printf("%s\\", tmp); - } else { - global.conf->configdir = g_strdup(tmp); - } - - g_free((void *)global.conf->motdfile); - m_motdfile.GetWindowText(tmp); - global.conf->motdfile = g_strdup(tmp); - - CPropertyPage::OnOK(); -} - -void CPropPaths::OnBrowseConfig() -{ - BROWSEINFO bi = { 0 }; - bi.lpszTitle = _T("Choose a config directory"); - LPITEMIDLIST pidl = SHBrowseForFolder(&bi); - if( pidl != 0) - { - TCHAR path[MAX_PATH]; - if( SHGetPathFromIDList (pidl, path) ) { - m_configdir.SetWindowText(path); - } - - IMalloc * imalloc = 0; - if ( SUCCEEDED (SHGetMalloc (&imalloc)) ) - { - imalloc->Free(pidl); - imalloc->Release(); - } - } -} - -void CPropPaths::OnBrowseMotd() -{ - CFileDialog f(TRUE); - - if(f.DoModal() == IDOK) { - m_motdfile.SetWindowText(f.GetPathName()); - } - -} - -void CPropPaths::OnEditMotd() -{ - CString loc;m_motdfile.GetWindowText(loc); - ShellExecute(this->GetSafeHwnd(), NULL, loc, NULL, NULL, SW_SHOWNORMAL); -} - -BOOL CPropPaths::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - m_configdir.SetWindowText(global.conf->configdir); - m_motdfile.SetWindowText(global.conf->motdfile); - - return TRUE; -} diff --git a/win32/PropPaths.h b/win32/PropPaths.h deleted file mode 100644 index 89c1c78e..00000000 --- a/win32/PropPaths.h +++ /dev/null @@ -1,55 +0,0 @@ -#if !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) -#define AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropPaths.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPropPaths dialog - -class CPropPaths : public CPropertyPage -{ -// Construction -public: - CPropPaths(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropPaths) - enum { IDD = IDD_PROPPAGE_PATHS }; - CEdit m_motdfile; - CButton m_edit_motd; - CEdit m_configdir; - CButton m_browse_motd; - CButton m_browse_config; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropPaths) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropPaths) - afx_msg void OnBrowseConfig(); - afx_msg void OnBrowseMotd(); - afx_msg void OnEditMotd(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) diff --git a/win32/PropUsers.cpp b/win32/PropUsers.cpp deleted file mode 100644 index 7f1a2c35..00000000 --- a/win32/PropUsers.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// PropUsers.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "PropUsers.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropUsers dialog - - -CPropUsers::CPropUsers() - : CPropertyPage(CPropUsers::IDD) -{ - //{{AFX_DATA_INIT(CPropUsers) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CPropUsers::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropUsers) - DDX_Control(pDX, IDC_KNOWN_USERS, m_known_users); - DDX_Control(pDX, IDC_KICK, m_kick); - DDX_Control(pDX, IDC_DEL_KNOWN_USERS, m_del_known_users); - DDX_Control(pDX, IDC_CURRENT_USERS, m_current_users); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropUsers, CPropertyPage) - //{{AFX_MSG_MAP(CPropUsers) - ON_BN_CLICKED(IDC_KICK, OnKick) - ON_BN_CLICKED(IDC_DEL_KNOWN_USERS, OnDelKnownUser) - ON_LBN_SELCHANGE(IDC_CURRENT_USERS, OnSelchangeCurrentUsers) - ON_LBN_SELCHANGE(IDC_KNOWN_USERS, OnSelchangeKnownUsers) - ON_BN_CLICKED(IDC_REFRESH_KNOWN_USERS, OnRefreshKnownUsers) - ON_BN_CLICKED(IDC_REFRESH_CURRENT_USERS, OnRefreshCurrentUsers) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropUsers message handlers - -void CPropUsers::OnKick() -{ - int idx = m_current_users.GetCurSel(); - if(idx == LB_ERR) return; - irc_t *irc = (irc_t *)m_current_users.GetItemData(idx); - irc_free(irc); - m_kick.EnableWindow(FALSE); - OnRefreshCurrentUsers(); -} - -void CPropUsers::OnDelKnownUser() -{ - CString nick; - m_known_users.GetText(m_known_users.GetCurSel(), nick); - CString accounts; accounts.Format("%s\\%s.accounts", global.conf->configdir, nick); - CString nicks; nicks.Format("%s\\%s.nicks", global.conf->configdir, nick); - CFile::Remove(accounts); - CFile::Remove(nicks); - m_del_known_users.EnableWindow(FALSE); - OnRefreshKnownUsers(); -} - -void CPropUsers::OnSelchangeCurrentUsers() -{ - m_kick.EnableWindow(m_current_users.GetCurSel() != LB_ERR); - -} - -void CPropUsers::OnSelchangeKnownUsers() -{ - m_del_known_users.EnableWindow(m_known_users.GetCurSel() != LB_ERR); - -} - -void CPropUsers::OnRefreshKnownUsers() -{ - m_known_users.ResetContent(); - GError *error = NULL; - const char *r; - GDir *d = g_dir_open(global.conf->configdir, 0, &error); - if(!d) return; - while(r = g_dir_read_name(d)) { - if(strstr(r, ".accounts")) { - CString tmp(r, strlen(r) - strlen(".accounts")); - m_known_users.AddString(tmp); - } - } - g_dir_close(d); -} - -extern "C" { - extern GSList *irc_connection_list; -} - -void CPropUsers::OnRefreshCurrentUsers() -{ - m_current_users.ResetContent(); - GSList *gl = irc_connection_list; - while(gl) { - irc_t *irc = (irc_t *)gl->data; - CString tmp; - tmp.Format("%s@%s \"%s\"", irc->nick, irc->myhost, irc->realname); - int idx = m_current_users.AddString(tmp); - m_current_users.SetItemData(idx, (unsigned long)irc); - gl = gl->next; - } -} - diff --git a/win32/PropUsers.h b/win32/PropUsers.h deleted file mode 100644 index 7dd028c6..00000000 --- a/win32/PropUsers.h +++ /dev/null @@ -1,54 +0,0 @@ -#if !defined(AFX_PROPUSERS_H__BA8F6624_F693_403B_B3A8_B140955A894B__INCLUDED_) -#define AFX_PROPUSERS_H__BA8F6624_F693_403B_B3A8_B140955A894B__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropUsers.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPropUsers dialog - -class CPropUsers : public CPropertyPage -{ -// Construction -public: - CPropUsers(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropUsers) - enum { IDD = IDD_PROPPAGE_USERS }; - CListBox m_known_users; - CButton m_kick; - CButton m_del_known_users; - CListBox m_current_users; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropUsers) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropUsers) - afx_msg void OnKick(); - afx_msg void OnDelKnownUser(); - afx_msg void OnSelchangeCurrentUsers(); - afx_msg void OnSelchangeKnownUsers(); - afx_msg void OnRefreshKnownUsers(); - afx_msg void OnRefreshCurrentUsers(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPUSERS_H__BA8F6624_F693_403B_B3A8_B140955A894B__INCLUDED_) diff --git a/win32/TrayNot.cpp b/win32/TrayNot.cpp deleted file mode 100644 index bd6bf39a..00000000 --- a/win32/TrayNot.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// TrayNot.cpp : implementation file -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "TrayNot.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTrayNot dialog - - -CTrayNot::CTrayNot(CPropertySheet *s) - : CDialog(CTrayNot::IDD, NULL) -{ - Create(CTrayNot::IDD); - EnableWindow(FALSE); - - dlg = s; - - /* Traybar icon */ - NOTIFYICONDATA dat; - dat.cbSize = sizeof(NOTIFYICONDATA); - dat.hWnd = m_hWnd; - dat.uID = 1; - dat.uFlags = NIF_ICON + NIF_TIP + NIF_MESSAGE; - dat.hIcon = AfxGetApp()->LoadIcon(IDI_BEE); - dat.uCallbackMessage = BITLBEE_TRAY_ICON; - strcpy(dat.szTip, "Bitlbee manager"); - Shell_NotifyIcon(NIM_ADD, &dat); - - //{{AFX_DATA_INIT(CTrayNot) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CTrayNot::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CTrayNot) - // NOTE: the ClassWizard will add DDX and DDV calls here - //}}AFX_DATA_MAP -} - -///////////////////////////////////////////////////////////////////////////// -// CTrayNot message handlers - -CTrayNot::~CTrayNot() -{ - NOTIFYICONDATA dat; - dat.cbSize = sizeof(NOTIFYICONDATA); - dat.hWnd = m_hWnd; - dat.uID = 1; - Shell_NotifyIcon(NIM_DELETE, &dat); -} - - -BEGIN_MESSAGE_MAP(CTrayNot, CDialog) - //{{AFX_MSG_MAP(CTrayNot) - // NOTE - the ClassWizard will add and remove mapping macros here. - ON_MESSAGE (BITLBEE_TRAY_ICON, OnSysTrayIconClick) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// CTrayNot message handlers - -afx_msg LONG CTrayNot::OnSysTrayIconClick (WPARAM wParam, LPARAM lParam) -{ - switch (lParam) - { - case WM_LBUTTONDOWN: - dlg->ShowWindow(SW_SHOW); - break; - case WM_RBUTTONDOWN: - ShowQuickMenu (); - break ; - } - return 0; -} - -void CTrayNot::ShowQuickMenu() -{ - POINT CurPos; - - CMenu qmenu; - qmenu.LoadMenu(IDR_POPUP); - - GetCursorPos (&CurPos); - - CMenu *submenu = qmenu.GetSubMenu(0); - - SetForegroundWindow(); - // Display the menu. This menu is a popup loaded elsewhere. - - submenu->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_RIGHTALIGN, - CurPos.x, - CurPos.y,this); -} diff --git a/win32/TrayNot.h b/win32/TrayNot.h deleted file mode 100644 index 9dbcb282..00000000 --- a/win32/TrayNot.h +++ /dev/null @@ -1,54 +0,0 @@ -#if !defined(AFX_TRAYNOT_H__C8B7E607_671B_4C97_8251_AF5AA83DF401__INCLUDED_) -#define AFX_TRAYNOT_H__C8B7E607_671B_4C97_8251_AF5AA83DF401__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// TrayNot.h : header file -// - -#include - -#define BITLBEE_TRAY_ICON WM_USER+1 - -///////////////////////////////////////////////////////////////////////////// -// CTrayNot dialog - -class CTrayNot : public CDialog -{ -// Construction -public: - virtual ~CTrayNot(); - CTrayNot(CPropertySheet *); // standard constructor - -// Dialog Data - //{{AFX_DATA(CTrayNot) - enum { IDD = IDD_PHONY }; - // NOTE: the ClassWizard will add data members here - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTrayNot) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CTrayNot) - // NOTE: the ClassWizard will add member functions here - afx_msg LONG OnSysTrayIconClick (WPARAM wParam, LPARAM lParam); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - CPropertySheet *dlg; - void ShowQuickMenu(); -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TRAYNOT_H__C8B7E607_671B_4C97_8251_AF5AA83DF401__INCLUDED_) diff --git a/win32/admin/MainDlg.cpp b/win32/admin/MainDlg.cpp new file mode 100644 index 00000000..e9ecda34 --- /dev/null +++ b/win32/admin/MainDlg.cpp @@ -0,0 +1,71 @@ +// MainDlg.cpp : implementation file +// + +#include "PropPaths.h" +#include "PropAccess.h" +#include "PropConn.h" +#include "MainDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainDlg + +IMPLEMENT_DYNAMIC(CMainDlg, CPropertySheet) + +CMainDlg::CMainDlg() : CPropertySheet("Bitlbee for Windows") +{ + AddPage(new CPropPaths()); + AddPage(new CPropAccess()); + AddPage(new CPropertyPage(IDD_PROPPAGE_ABOUT)); + AddPage(new CPropConn()); + Create(); + ShowWindow(SW_HIDE); +} + +CMainDlg::~CMainDlg() +{ +} + + +BEGIN_MESSAGE_MAP(CMainDlg, CPropertySheet) + //{{AFX_MSG_MAP(CMainDlg) + ON_WM_CLOSE() + //}}AFX_MSG_MAP + ON_BN_CLICKED(IDOK, OnOK) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMainDlg message handlers + +BOOL CMainDlg::OnInitDialog() +{ + m_bModeless = FALSE; + m_nFlags |= WF_CONTINUEMODAL; + + CPropertySheet::OnInitDialog(); + GetDlgItem(IDHELP)->ShowWindow(SW_HIDE); + GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE); + + m_bModeless = TRUE; + m_nFlags &= WF_CONTINUEMODAL; + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CMainDlg::OnOK() +{ + PressButton(PSBTN_APPLYNOW); + ShowWindow(SW_HIDE); +} + + +void CMainDlg::OnClose() +{ + ShowWindow(SW_HIDE); +} diff --git a/win32/admin/MainDlg.h b/win32/admin/MainDlg.h new file mode 100644 index 00000000..be5547fd --- /dev/null +++ b/win32/admin/MainDlg.h @@ -0,0 +1,54 @@ +#if !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) +#define AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// MainDlg.h : header file +// + +#include + +///////////////////////////////////////////////////////////////////////////// +// CMainDlg + +class CMainDlg : public CPropertySheet +{ + DECLARE_DYNAMIC(CMainDlg) + +// Construction +public: + CMainDlg(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainDlg) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainDlg(); + + // Generated message map functions +protected: + //{{AFX_MSG(CMainDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +private: + void OnOK(); +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) diff --git a/win32/admin/PropAccess.cpp b/win32/admin/PropAccess.cpp new file mode 100644 index 00000000..a09ce454 --- /dev/null +++ b/win32/admin/PropAccess.cpp @@ -0,0 +1,114 @@ +// PropAccess.cpp : implementation file +// + +#include "PropAccess.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropAccess dialog + + +CPropAccess::CPropAccess() + : CPropertyPage(CPropAccess::IDD) +{ + + //{{AFX_DATA_INIT(CPropAccess) + //}}AFX_DATA_INIT +} + + +void CPropAccess::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropAccess) + DDX_Control(pDX, IDC_AUTH_REGISTERED, m_auth_registered); + DDX_Control(pDX, IDC_AUTH_OPEN, m_auth_open); + DDX_Control(pDX, IDC_AUTH_CLOSED, m_auth_closed); + DDX_Control(pDX, IDC_PASSWORD, m_password); + DDX_Control(pDX, IDC_PORT, m_port); + DDX_Control(pDX, IDC_INTERFACE, m_interface); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropAccess, CPropertyPage) + //{{AFX_MSG_MAP(CPropAccess) + ON_BN_CLICKED(IDC_AUTH_REGISTERED, OnAuthRegistered) + ON_BN_CLICKED(IDC_AUTH_OPEN, OnAuthOpen) + ON_BN_CLICKED(IDC_AUTH_CLOSED, OnAuthClosed) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropAccess message handlers + +void CPropAccess::OnOK() +{ + CString iface; m_interface.GetWindowText(iface); + WriteProfileString("interface", iface); + + CString port; m_port.GetWindowText(port); + WriteProfileInt("port", port); + + CString password; m_password.GetWindowText(password); + WriteProfileString("password", password); + + if(m_auth_closed.GetCheck() == 1) WriteProfileInt("auth_mode", 1); + if(m_auth_open.GetCheck() == 1) WriteProfileInt("auth_mode", 0); + if(m_auth_registered.GetCheck() == 1) WriteProfileInt("auth_mode", 2); + + CPropertyPage::OnOK(); +} + +void CPropAccess::OnAuthRegistered() +{ + m_password.EnableWindow(FALSE); + m_auth_open.SetCheck(0); + m_auth_registered.SetCheck(1); + m_auth_closed.SetCheck(0); + +} + +void CPropAccess::OnAuthOpen() +{ + m_password.EnableWindow(FALSE); + m_auth_open.SetCheck(1); + m_auth_registered.SetCheck(0); + m_auth_closed.SetCheck(0); +} + +void CPropAccess::OnAuthClosed() +{ + m_password.EnableWindow(TRUE); + m_auth_open.SetCheck(0); + m_auth_registered.SetCheck(0); + m_auth_closed.SetCheck(1); + +} + +BOOL CPropAccess::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + HKEY key; + RegOpenKey(HKEY_LOCAL_MACHINE, BITLBEE_KEY, &key); + + m_interface.SetWindowText(GetProfileString("interface", "0.0.0.0")); + m_password.SetWindowText(GetProfileString("password", "")); + char tmp[20]; + sprintf(tmp, "%d", GetProfileInt("port", 6667)); + m_port.SetWindowText(tmp); + + switch(GetProfileInt("auth_mode", 1)) { + case 0: OnAuthOpen();break; + case 1: OnAuthClosed();break; + case 2: OnAuthRegistered();break; + } + + return TRUE; +} diff --git a/win32/admin/PropAccess.h b/win32/admin/PropAccess.h new file mode 100644 index 00000000..cae0241c --- /dev/null +++ b/win32/admin/PropAccess.h @@ -0,0 +1,59 @@ +#if !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) +#define AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropAccess.h : header file +// + +#include +#include "Resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CPropAccess dialog + +class CPropAccess : public CPropertyPage +{ +// Construction +public: + CPropAccess(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropAccess) + enum { IDD = IDD_PROPPAGE_ACCESS }; + CButton m_auth_registered; + CButton m_auth_open; + CButton m_auth_closed; + CEdit m_password; + CEdit m_port; + CEdit m_interface; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropAccess) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropAccess) + afx_msg void OnAuthRegistered(); + afx_msg void OnAuthOpen(); + afx_msg void OnAuthClosed(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) diff --git a/win32/admin/PropConn.cpp b/win32/admin/PropConn.cpp new file mode 100644 index 00000000..b16be0f1 --- /dev/null +++ b/win32/admin/PropConn.cpp @@ -0,0 +1,123 @@ +// PropConn.cpp : implementation file +// + +#include "PropConn.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropConn dialog + + +CPropConn::CPropConn(CWnd* pParent /*=NULL*/) + : CPropertyPage(CPropConn::IDD) +{ + //{{AFX_DATA_INIT(CPropConn) + //}}AFX_DATA_INIT +} + + +void CPropConn::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropConn) + DDX_Control(pDX, IDC_PROXYPORT, m_proxyport); + DDX_Control(pDX, IDC_PROXYTYPE, m_proxytype); + DDX_Control(pDX, IDC_PROXY_ENABLED, m_proxy_enabled); + DDX_Control(pDX, IDC_PROXY_AUTH_ENABLED, m_proxy_auth_enabled); + DDX_Control(pDX, IDC_PROXYPASS, m_proxypass); + DDX_Control(pDX, IDC_PROXYHOST, m_proxyhost); + DDX_Control(pDX, IDC_PROXYUSER, m_proxyuser); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropConn, CPropertyPage) + //{{AFX_MSG_MAP(CPropConn) + ON_BN_CLICKED(IDC_PROXY_AUTH_ENABLED, OnProxyAuthEnabled) + ON_BN_CLICKED(IDC_PROXY_ENABLED, OnProxyEnabled) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropConn message handlers + +void CPropConn::OnProxyAuthEnabled() +{ + m_proxyuser.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); + m_proxypass.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); +} + +void CPropConn::OnProxyEnabled() +{ + m_proxyhost.EnableWindow(m_proxy_enabled.GetCheck()); + m_proxytype.EnableWindow(m_proxy_enabled.GetCheck()); + m_proxyport.EnableWindow(m_proxy_enabled.GetCheck()); + m_proxy_auth_enabled.EnableWindow(m_proxy_enabled.GetCheck()); + + if(m_proxy_enabled.GetCheck() && (m_proxytype.GetCurSel() < 0 || m_proxytype.GetCurSel() > 2)) + { + m_proxytype.SetCurSel(0); + } + + OnProxyAuthEnabled(); +} + +void CPropConn::OnOK() +{ + CString tmp; + m_proxyhost.GetWindowText(tmp); + WriteProfileString("proxy_host", tmp); + + m_proxyport.GetWindowText(tmp); + WriteProfileInt("proxy_port", atoi(tmp)); + + if(!m_proxy_enabled.GetCheck()) { + WriteProfileInt("proxy_type", 0); + } else { + WriteProfileInt("proxy_type", m_proxytype.GetCurSel()+1); + } + + if(!m_proxy_auth_enabled.GetCheck()) { + WriteProfileString("proxy_user", ""); + WriteProfileString("proxy_password", ""); + } else { + m_proxyuser.GetWindowText(tmp); + WriteProfileString("proxy_user", tmp); + m_proxypass.GetWindowText(tmp); + WriteProfileString("proxy_password", tmp); + } + + CPropertyPage::OnOK(); +} + +BOOL CPropConn::OnInitDialog() +{ + char pp[20]; + CPropertyPage::OnInitDialog(); + int proxytype; + + m_proxyhost.SetWindowText(GetProfileString("proxy_host", "")); + m_proxyuser.SetWindowText(GetProfileString("proxy_user", "")); + m_proxypass.SetWindowText(GetProfileString("proxy_password", "")); + sprintf(pp, "%d", GetProfileInt("proxy_port", 3128)); + m_proxyport.SetWindowText(pp); + + proxytype = GetProfileInt("proxy_type", 0); + + m_proxytype.AddString("SOCKS 4"); + m_proxytype.AddString("SOCKS 5"); + m_proxytype.AddString("HTTP"); + m_proxytype.SetCurSel(proxytype-1); + + m_proxy_enabled.SetCheck(proxytype == 0?0:1); + m_proxy_auth_enabled.SetCheck(strcmp(GetProfileString("proxy_user", ""), "")?1:0); + + OnProxyEnabled(); + + return TRUE; +} \ No newline at end of file diff --git a/win32/admin/PropConn.h b/win32/admin/PropConn.h new file mode 100644 index 00000000..e920da3d --- /dev/null +++ b/win32/admin/PropConn.h @@ -0,0 +1,59 @@ +#if !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) +#define AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropConn.h : header file +// + +#include +#include "Resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CPropConn dialog + +class CPropConn : public CPropertyPage +{ +// Construction +public: + CPropConn(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropConn) + enum { IDD = IDD_PROPPAGE_CONNECTION }; + CEdit m_proxyport; + CListBox m_proxytype; + CButton m_proxy_enabled; + CButton m_proxy_auth_enabled; + CEdit m_proxypass; + CEdit m_proxyhost; + CEdit m_proxyuser; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropConn) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropConn) + afx_msg void OnProxyAuthEnabled(); + afx_msg void OnProxyEnabled(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) diff --git a/win32/admin/PropLog.cpp b/win32/admin/PropLog.cpp new file mode 100644 index 00000000..8b1641d9 --- /dev/null +++ b/win32/admin/PropLog.cpp @@ -0,0 +1,78 @@ +// PropLog.cpp : implementation file +// + +#include "PropLog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropLog dialog + + +CPropLog::CPropLog() + : CPropertyPage(CPropLog::IDD) +{ + //{{AFX_DATA_INIT(CPropLog) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CPropLog::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropLog) + DDX_Control(pDX, IDC_LOG, m_log); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropLog, CPropertyPage) + //{{AFX_MSG_MAP(CPropLog) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropLog message handlers + +static GList *log = NULL; + +extern "C" { +void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data) +{ + log = g_list_append(log, g_strdup_printf("%s: %s", log_domain, msg)); +} +} + +void log_message(int level, char *message, ... ) { +#define LOG_MAXLEN 300 + va_list ap; + va_start(ap, message); + char *msg = (char *)g_malloc(LOG_MAXLEN); + g_vsnprintf(msg, LOG_MAXLEN, message, ap); + va_end(ap); + log = g_list_append(log, msg); + if(level == LOGLVL_ERROR) ::MessageBox(NULL, msg, "Bitlbee", MB_OK | MB_ICONINFORMATION); + TRACE("%d: %s\n", level, msg); +} + + +BOOL CPropLog::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_log.ResetContent(); + GList *gl = log; + while(gl) { + char *d = (char *)gl->data; + m_log.AddString(d); + gl = gl->next; + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/win32/admin/PropLog.h b/win32/admin/PropLog.h new file mode 100644 index 00000000..1a847b19 --- /dev/null +++ b/win32/admin/PropLog.h @@ -0,0 +1,47 @@ +#if !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) +#define AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropLog.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPropLog dialog + +class CPropLog : public CPropertyPage +{ +// Construction +public: + CPropLog(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropLog) + enum { IDD = IDD_PROPPAGE_LOG }; + CListBox m_log; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropLog) + public: + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropLog) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) diff --git a/win32/admin/PropMain.cpp b/win32/admin/PropMain.cpp new file mode 100644 index 00000000..f15af691 --- /dev/null +++ b/win32/admin/PropMain.cpp @@ -0,0 +1,99 @@ +// PropMain.cpp : implementation file +// + +#include +#include "PropMain.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropMain property page + +IMPLEMENT_DYNCREATE(CPropMain, CPropertyPage) + +CPropMain::CPropMain() : CPropertyPage(CPropMain::IDD) +{ + //{{AFX_DATA_INIT(CPropMain) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +CPropMain::~CPropMain() +{ +} + +void CPropMain::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropMain) + DDX_Control(pDX, IDC_STOPSERVICE, m_stopservice); + DDX_Control(pDX, IDC_STARTSERVICE, m_startservice); + DDX_Control(pDX, IDC_PING_INTERVAL, m_ping_interval); + DDX_Control(pDX, IDC_VERBOSE, m_Verbose); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropMain, CPropertyPage) + //{{AFX_MSG_MAP(CPropMain) + ON_BN_CLICKED(IDC_STARTSERVICE, OnStartService) + ON_BN_CLICKED(IDC_STOPSERVICE, OnStopService) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropMain message handlers + +BOOL CPropMain::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + global.conf->verbose = GetProfileInt("verbose", 0); + global.conf->ping_interval = GetProfileInt("ping_interval_timeout", 0); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CPropMain::OnOK() +{ + CPropertyPage::OnOK(); + + WriteProfileInt("verbose", global.conf->verbose); + + WriteProfileInt("ping_interval_timeout", global.conf->ping_interval); +} + +void CPropMain::OnStartService() +{ + SC_HANDLE schService; + SC_HANDLE schSCManager; + SERVICE_STATUS status; + + schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); + schService = OpenService(schSCManager, "bitlbee", SERVICE_ALL_ACCESS); + + ControlService( schService, SERVICE_CONTROL_CONTINUE, &status ); + + CloseServiceHandle(schService); + CloseServiceHandle(schSCManager); +} + +void CPropMain::OnStopService() +{ + SC_HANDLE schService; + SC_HANDLE schSCManager; + SERVICE_STATUS status; + + schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); + schService = OpenService(schSCManager, "bitlbee", SERVICE_ALL_ACCESS); + + ControlService( schService, SERVICE_CONTROL_PAUSE, &status ); + + CloseServiceHandle(schService); + CloseServiceHandle(schSCManager); +} diff --git a/win32/admin/PropMain.h b/win32/admin/PropMain.h new file mode 100644 index 00000000..832457b2 --- /dev/null +++ b/win32/admin/PropMain.h @@ -0,0 +1,58 @@ +#if !defined(AFX_PROPMAIN_H__F3EF57A7_15AA_4F36_B6C1_2EAD91127449__INCLUDED_) +#define AFX_PROPMAIN_H__F3EF57A7_15AA_4F36_B6C1_2EAD91127449__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropMain.h : header file + +#include "Resource.h" +// + +///////////////////////////////////////////////////////////////////////////// +// CPropMain dialog + +class CPropMain : public CPropertyPage +{ + DECLARE_DYNCREATE(CPropMain) + +// Construction +public: + CPropMain(); + ~CPropMain(); + +// Dialog Data + //{{AFX_DATA(CPropMain) + enum { IDD = IDD_PROPPAGE_MAIN }; + CButton m_stopservice; + CButton m_startservice; + CEdit m_ping_interval; + CButton m_Verbose; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CPropMain) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CPropMain) + virtual BOOL OnInitDialog(); + afx_msg void OnStartService(); + afx_msg void OnStopService(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPMAIN_H__F3EF57A7_15AA_4F36_B6C1_2EAD91127449__INCLUDED_) diff --git a/win32/admin/PropPaths.cpp b/win32/admin/PropPaths.cpp new file mode 100644 index 00000000..4fb49497 --- /dev/null +++ b/win32/admin/PropPaths.cpp @@ -0,0 +1,115 @@ +// PropPaths.cpp : implementation file +// + +#include "PropPaths.h" +#include "shlobj.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPropPaths dialog + + +CPropPaths::CPropPaths() + : CPropertyPage(CPropPaths::IDD) +{ + //{{AFX_DATA_INIT(CPropPaths) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CPropPaths::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPropPaths) + DDX_Control(pDX, IDC_MOTDFILE, m_motdfile); + DDX_Control(pDX, IDC_EDIT_MOTD, m_edit_motd); + DDX_Control(pDX, IDC_CONFIGDIR, m_configdir); + DDX_Control(pDX, IDC_BROWSE_MOTD, m_browse_motd); + DDX_Control(pDX, IDC_BROWSE_CONFIG, m_browse_config); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPropPaths, CPropertyPage) + //{{AFX_MSG_MAP(CPropPaths) + ON_BN_CLICKED(IDC_BROWSE_CONFIG, OnBrowseConfig) + ON_BN_CLICKED(IDC_BROWSE_MOTD, OnBrowseMotd) + ON_BN_CLICKED(IDC_EDIT_MOTD, OnEditMotd) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPropPaths message handlers + +void CPropPaths::OnOK() +{ + CString tmp; + m_configdir.GetWindowText(tmp); + + if (tmp.GetLength() > 0 + && tmp.GetAt(tmp.GetLength() - 1) != '/' + && tmp.GetAt(tmp.GetLength() - 1) != '\\') + { + tmp = tmp + "\\"; + } + + WriteProfileString("configdir", tmp); + + m_motdfile.GetWindowText(tmp); + WriteProfileString("motdfile", tmp); + + CPropertyPage::OnOK(); +} + +void CPropPaths::OnBrowseConfig() +{ + BROWSEINFO bi = { 0 }; + bi.lpszTitle = _T("Choose a config directory"); + LPITEMIDLIST pidl = SHBrowseForFolder(&bi); + if( pidl != 0) + { + TCHAR path[MAX_PATH]; + if( SHGetPathFromIDList (pidl, path) ) { + m_configdir.SetWindowText(path); + } + + IMalloc * imalloc = 0; + if ( SUCCEEDED (SHGetMalloc (&imalloc)) ) + { + imalloc->Free(pidl); + imalloc->Release(); + } + } +} + +void CPropPaths::OnBrowseMotd() +{ + CFileDialog f(TRUE); + + if(f.DoModal() == IDOK) { + m_motdfile.SetWindowText(f.GetPathName()); + } + +} + +void CPropPaths::OnEditMotd() +{ + CString loc;m_motdfile.GetWindowText(loc); + ShellExecute(this->GetSafeHwnd(), NULL, loc, NULL, NULL, SW_SHOWNORMAL); +} + +BOOL CPropPaths::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_configdir.SetWindowText(GetProfileString("configdir", "")); + m_motdfile.SetWindowText(GetProfileString("motdfile", "")); + + return TRUE; +} diff --git a/win32/admin/PropPaths.h b/win32/admin/PropPaths.h new file mode 100644 index 00000000..733e674c --- /dev/null +++ b/win32/admin/PropPaths.h @@ -0,0 +1,57 @@ +#if !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) +#define AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PropPaths.h : header file +// +#include +#include "Resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CPropPaths dialog + +class CPropPaths : public CPropertyPage +{ +// Construction +public: + CPropPaths(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPropPaths) + enum { IDD = IDD_PROPPAGE_PATHS }; + CEdit m_motdfile; + CButton m_edit_motd; + CEdit m_configdir; + CButton m_browse_motd; + CButton m_browse_config; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPropPaths) + public: + virtual void OnOK(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPropPaths) + afx_msg void OnBrowseConfig(); + afx_msg void OnBrowseMotd(); + afx_msg void OnEditMotd(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) diff --git a/win32/admin/admin.dsp b/win32/admin/admin.dsp new file mode 100644 index 00000000..6d24af0d --- /dev/null +++ b/win32/admin/admin.dsp @@ -0,0 +1,175 @@ +# Microsoft Developer Studio Project File - Name="admin" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=admin - Win32 Debug +!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 "admin.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 "admin.mak" CFG="admin - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "admin - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "admin - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "admin - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# 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 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"Release/bitlbeeadm.exe" + +!ELSEIF "$(CFG)" == "admin - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/bitlbeeadm.exe" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "admin - Win32 Release" +# Name "admin - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\bitlbeewin.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropAccess.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropConn.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropMain.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropPaths.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\bitlbeewin.h +# End Source File +# Begin Source File + +SOURCE=.\MainDlg.h +# End Source File +# Begin Source File + +SOURCE=.\PropAccess.h +# End Source File +# Begin Source File + +SOURCE=.\PropConn.h +# End Source File +# Begin Source File + +SOURCE=.\PropMain.h +# End Source File +# Begin Source File + +SOURCE=.\PropPaths.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\bitlbee.rc + +!IF "$(CFG)" == "admin - Win32 Release" + +!ELSEIF "$(CFG)" == "admin - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\res\bmp00002.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\icon2.ico +# End Source File +# End Group +# End Target +# End Project diff --git a/win32/admin/bitlbee.rc b/win32/admin/bitlbee.rc new file mode 100644 index 00000000..5e9b5407 --- /dev/null +++ b/win32/admin/bitlbee.rc @@ -0,0 +1,303 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.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 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_BEE ICON DISCARDABLE "res\\icon2.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_PROPPAGE_ACCESS DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Access" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Authentication Mode",IDC_STATIC,7,7,196,47 + CONTROL "&Open",IDC_AUTH_OPEN,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,14,15,181,13 + CONTROL "&Closed",IDC_AUTH_CLOSED,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,14,27,160,11 + CONTROL "&Registered",IDC_AUTH_REGISTERED,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,14,39,182,11 + GROUPBOX "Bind",IDC_STATIC,7,55,196,46 + LTEXT "IP to bind to:",IDC_STATIC,15,67,49,9 + LTEXT "Port:",IDC_STATIC,15,82,52,10 + EDITTEXT IDC_INTERFACE,86,67,108,11,ES_AUTOHSCROLL + EDITTEXT IDC_PORT,86,82,108,11,ES_AUTOHSCROLL + GROUPBOX "Password",IDC_STATIC,7,104,196,43 + EDITTEXT IDC_PASSWORD,14,129,115,11,ES_AUTOHSCROLL + LTEXT "Only used when authentication mode is set to closed.", + IDC_STATIC,13,113,184,11 +END + +IDD_PROPPAGE_PATHS DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Paths" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Config path",IDC_STATIC,7,7,196,30 + PUSHBUTTON "&Browse...",IDC_BROWSE_CONFIG,151,16,46,13 + EDITTEXT IDC_CONFIGDIR,13,17,122,13,ES_AUTOHSCROLL + GROUPBOX "Message of the day file",IDC_STATIC,7,42,196,40 + PUSHBUTTON "&Browse...",IDC_BROWSE_MOTD,153,51,43,13 + EDITTEXT IDC_MOTDFILE,13,51,122,13,ES_AUTOHSCROLL + PUSHBUTTON "&Edit...",IDC_EDIT_MOTD,153,66,43,13 +END + +IDD_PROPPAGE_ABOUT DIALOG DISCARDABLE 0, 0, 284, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "About" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Authors",IDC_STATIC,7,7,270,79 + LTEXT "Bitlbee is written by : \n Wilmer van der Gaast \n Maurits Dijkstra \n Jelmer Vernooij ", + IDC_STATIC,13,16,180,35 + LTEXT "Windows port by Jelmer Vernooij ", + IDC_STATIC,13,55,180,12 + CONTROL 135,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN,193,14,73, + 64 + GROUPBOX "More information",IDC_STATIC,7,88,270,61 + LTEXT "See the file CREDITS for a list of contributors.", + IDC_STATIC,16,69,171,11 + LTEXT "The Bitlbee homepage is located at http://www.bitlbee.org/\n\nFor Bitlbee support, go to #bitlbee on irc.oftc.net", + IDC_STATIC,17,100,248,39 +END + +IDD_PROPPAGE_CONNECTION DIALOG DISCARDABLE 0, 0, 210, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Connection" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Proxy",IDC_STATIC,7,23,196,124 + EDITTEXT IDC_PROXYHOST,110,33,86,12,ES_AUTOHSCROLL + CONTROL "&Use Proxy",IDC_PROXY_ENABLED,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,7,196,14 + LTEXT "Proxy &Host",IDC_STATIC,13,33,82,12 + EDITTEXT IDC_PROXYUSER,110,105,86,12,ES_AUTOHSCROLL + LTEXT "Proxy &User",IDC_STATIC,13,105,82,12 + EDITTEXT IDC_PROXYPASS,110,122,86,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Proxy &Password",IDC_STATIC,13,123,82,12 + CONTROL "&Authenticate to proxy",IDC_PROXY_AUTH_ENABLED,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,85,86,14 + LTEXT "Proxy &Type",IDC_STATIC,13,63,77,8 + LISTBOX IDC_PROXYTYPE,110,62,86,31,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "&Proxy Port",IDC_STATIC,14,47,80,9 + EDITTEXT IDC_PROXYPORT,109,47,86,12,ES_AUTOHSCROLL | ES_NUMBER +END + +IDD_PROPPAGE_MAIN DIALOG DISCARDABLE 0, 0, 210, 101 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Main" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Current Status:",IDC_STATIC,13,16,66,9 + LTEXT "Static",IDC_STATIC,92,16,80,12 + PUSHBUTTON "&Start",IDC_STARTSERVICE,13,28,40,11 + PUSHBUTTON "&Stop",IDC_STOPSERVICE,65,29,46,11 + CONTROL "&Verbose",IDC_VERBOSE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,43,84,12 + EDITTEXT IDC_PING_INTERVAL,93,62,47,12,ES_AUTOHSCROLL + LTEXT "Ping Interval:",IDC_STATIC,13,62,60,10 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "The Bitlbee Team\0" + VALUE "FileDescription", "BitlBee for Windows\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "bitlbee\0" + VALUE "LegalCopyright", "Copyright (C) 2002-2005\0" + VALUE "OriginalFilename", "bitlbeeadm.exe\0" + VALUE "ProductName", "Bitlbee Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PROPPAGE_ACCESS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PROPPAGE_PATHS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PROPPAGE_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 277 + TOPMARGIN, 7 + BOTTOMMARGIN, 149 + END + + IDD_PROPPAGE_CONNECTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_PROPPAGE_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 6 + BOTTOMMARGIN, 94 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BEE_SMALL BITMAP DISCARDABLE "res\\bmp00002.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ABOUTBOX "&About bitlbee..." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/win32/admin/bitlbeewin.cpp b/win32/admin/bitlbeewin.cpp new file mode 100644 index 00000000..56e61c3f --- /dev/null +++ b/win32/admin/bitlbeewin.cpp @@ -0,0 +1,47 @@ +// bitlbee.cpp : Defines the class behaviors for the application. +// + +#include "maindlg.h" +#include "bitlbeewin.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp + +BEGIN_MESSAGE_MAP(CBitlbeeApp, CWinApp) + //{{AFX_MSG_MAP(CBitlbeeApp) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// The one and only CBitlbeeApp object + +CBitlbeeApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp initialization + +BOOL CBitlbeeApp::InitInstance() +{ + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + new CMainDlg(); + + return TRUE; +} diff --git a/win32/admin/bitlbeewin.h b/win32/admin/bitlbeewin.h new file mode 100644 index 00000000..73860252 --- /dev/null +++ b/win32/admin/bitlbeewin.h @@ -0,0 +1,49 @@ +// bitlbee.h : main header file for the BITLBEE application +// + +#if !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) +#define AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include +#include +#include +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CBitlbeeApp: +// See bitlbee.cpp for the implementation of this class +// + +class CBitlbeeApp : public CWinApp +{ +public: + CBitlbeeApp() {} + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBitlbeeApp) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CBitlbeeApp) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + protected: + CPropertySheet *dlg; +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) + diff --git a/win32/admin/res/bmp00002.bmp b/win32/admin/res/bmp00002.bmp new file mode 100644 index 00000000..77205cb1 Binary files /dev/null and b/win32/admin/res/bmp00002.bmp differ diff --git a/win32/admin/res/icon2.ico b/win32/admin/res/icon2.ico new file mode 100644 index 00000000..5dfe084f Binary files /dev/null and b/win32/admin/res/icon2.ico differ diff --git a/win32/admin/resource.h b/win32/admin/resource.h new file mode 100644 index 00000000..8c8fe503 --- /dev/null +++ b/win32/admin/resource.h @@ -0,0 +1,65 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by bitlbee.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDC_OK 101 +#define IDD_BITLBEE_DIALOG 102 +#define IDP_SOCKETS_INIT_FAILED 103 +#define IDD_PROPPAGE_ACCESS 106 +#define IDD_PROPPAGE_USERS 107 +#define IDD_PROPPAGE_PATHS 108 +#define IDR_MAINFRAME 128 +#define IDI_BEE 130 +#define IDD_PHONY 131 +#define IDR_POPUP 132 +#define IDD_PROPPAGE_ABOUT 132 +#define IDD_PROPPAGE_LOG 133 +#define IDB_BEE_SMALL 135 +#define IDD_PROPPAGE_CONNECTION 137 +#define IDI_ICON1 138 +#define IDD_PROPPAGE_MAIN 138 +#define IDC_AUTH_OPEN 1001 +#define IDC_AUTH_CLOSED 1002 +#define IDC_AUTH_REGISTERED 1003 +#define IDC_BROWSE_CONFIG 1004 +#define IDC_CONFIGDIR 1005 +#define IDC_BROWSE_MOTD 1006 +#define IDC_KNOWN_USERS 1007 +#define IDC_MOTDFILE 1007 +#define IDC_EDIT_MOTD 1008 +#define IDC_DEL_KNOWN_USERS 1008 +#define IDC_CURRENT_USERS 1009 +#define IDC_KICK 1010 +#define IDC_INTERFACE 1011 +#define IDC_PORT 1012 +#define IDC_PASSWORD 1013 +#define IDC_REFRESH_KNOWN_USERS 1015 +#define IDC_REFRESH_CURRENT_USERS 1016 +#define IDC_LOG 1017 +#define IDC_PROXYHOST 1018 +#define IDC_PROXYUSER 1019 +#define IDC_PROXYPASS 1020 +#define IDC_PROXY_ENABLED 1021 +#define IDC_PROXY_AUTH_ENABLED 1022 +#define IDC_PROXYPORT 1023 +#define IDC_PROXYTYPE 1024 +#define IDC_STARTSERVICE 1025 +#define IDC_STOPSERVICE 1026 +#define IDC_VERBOSE 1027 +#define IDC_PING_INTERVAL 1028 +#define IDM_SHOW 32771 +#define IDM_EXIT 32773 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 139 +#define _APS_NEXT_COMMAND_VALUE 32774 +#define _APS_NEXT_CONTROL_VALUE 1029 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/win32/bitlbee.dsp b/win32/bitlbee.dsp index 3f26fca0..f08f64a9 100644 --- a/win32/bitlbee.dsp +++ b/win32/bitlbee.dsp @@ -53,8 +53,8 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 /libpath:"release" /libpath:"deps\lib" -# SUBTRACT LINK32 /incremental:yes /nodefaultlib +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib advapi32.lib /nologo /machine:I386 /libpath:"release" /libpath:"deps\lib" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /Gd /MDd /Ze /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /FR /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 @@ -81,7 +81,8 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" +# ADD LINK32 iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib kernel32.lib user32.lib advapi32.lib /nologo /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -102,17 +103,6 @@ SOURCE=..\bitlbee.c # End Source File # Begin Source File -SOURCE=.\bitlbee.rc - -!IF "$(CFG)" == "bitlbee - Win32 Release" - -!ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=..\commands.c # End Source File # Begin Source File @@ -253,29 +243,5 @@ SOURCE=..\sock.h SOURCE=..\user.h # End Source File # End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\bitlbee.rc2 -# End Source File -# Begin Source File - -SOURCE=.\res\bmp00002.bmp -# End Source File -# Begin Source File - -SOURCE=.\res\icon1.ico -# End Source File -# Begin Source File - -SOURCE=.\res\icon2.ico -# End Source File -# End Group -# Begin Source File - -SOURCE=.\README.TXT -# End Source File # End Target # End Project diff --git a/win32/bitlbee.rc b/win32/bitlbee.rc deleted file mode 100644 index 0762fbbd..00000000 --- a/win32/bitlbee.rc +++ /dev/null @@ -1,354 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.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 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_BEE ICON DISCARDABLE "res\\icon2.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PROPPAGE_ACCESS DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Access" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Authentication Mode",IDC_STATIC,7,7,196,47 - CONTROL "&Open",IDC_AUTH_OPEN,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,14,15,181,13 - CONTROL "&Closed",IDC_AUTH_CLOSED,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,14,27,160,11 - CONTROL "&Registered",IDC_AUTH_REGISTERED,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,14,39,182,11 - GROUPBOX "Bind",IDC_STATIC,7,55,196,46 - LTEXT "IP to bind to:",IDC_STATIC,15,67,49,9 - LTEXT "Port:",IDC_STATIC,15,82,52,10 - EDITTEXT IDC_INTERFACE,86,67,108,11,ES_AUTOHSCROLL - EDITTEXT IDC_PORT,86,82,108,11,ES_AUTOHSCROLL - GROUPBOX "Password",IDC_STATIC,7,104,196,43 - EDITTEXT IDC_PASSWORD,14,129,115,11,ES_AUTOHSCROLL - LTEXT "Only used when authentication mode is set to closed.", - IDC_STATIC,13,113,184,11 -END - -IDD_PROPPAGE_USERS DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Users" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Known users",IDC_STATIC,7,7,196,68 - GROUPBOX "Current users",IDC_STATIC,7,79,196,68 - LISTBOX IDC_KNOWN_USERS,13,17,114,52,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Remove",IDC_DEL_KNOWN_USERS,133,17,32,14,WS_DISABLED - LISTBOX IDC_CURRENT_USERS,13,89,115,52,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Kick",IDC_KICK,135,89,19,14,WS_DISABLED - PUSHBUTTON "&Refresh",IDC_REFRESH_KNOWN_USERS,133,38,30,14 - PUSHBUTTON "&Refresh",IDC_REFRESH_CURRENT_USERS,135,110,30,14 -END - -IDD_PROPPAGE_PATHS DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Paths" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Config path",IDC_STATIC,7,7,196,30 - PUSHBUTTON "&Browse...",IDC_BROWSE_CONFIG,151,16,46,13 - EDITTEXT IDC_CONFIGDIR,13,17,122,13,ES_AUTOHSCROLL - GROUPBOX "Message of the day file",IDC_STATIC,7,42,196,40 - PUSHBUTTON "&Browse...",IDC_BROWSE_MOTD,153,51,43,13 - EDITTEXT IDC_MOTDFILE,13,51,122,13,ES_AUTOHSCROLL - PUSHBUTTON "&Edit...",IDC_EDIT_MOTD,153,66,43,13 -END - -IDD_PHONY DIALOG DISCARDABLE 0, 0, 9, 9 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN -END - -IDD_PROPPAGE_ABOUT DIALOG DISCARDABLE 0, 0, 284, 156 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "About" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Authors",IDC_STATIC,7,7,270,79 - LTEXT "Bitlbee is written by : \n Wilmer van der Gaast \n Maurits Dijkstra \n Jelmer Vernooij ", - IDC_STATIC,13,16,180,35 - LTEXT "Windows port by Jelmer Vernooij ", - IDC_STATIC,13,55,180,12 - CONTROL 135,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN,193,14,73, - 64 - GROUPBOX "More information",IDC_STATIC,7,88,270,61 - LTEXT "See the file CREDITS for a list of contributors.", - IDC_STATIC,16,69,171,11 - LTEXT "The Bitlbee homepage is located at http://www.bitlbee.org/\n\nFor Bitlbee support, go to #bitlbee on irc.oftc.net", - IDC_STATIC,17,100,248,39 -END - -IDD_PROPPAGE_LOG DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Logs" -FONT 8, "MS Sans Serif" -BEGIN - LISTBOX IDC_LOG,7,7,196,140,LBS_SORT | LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP -END - -IDD_PROPPAGE_CONNECTION DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Connection" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Proxy",IDC_STATIC,7,23,196,124 - EDITTEXT IDC_PROXYHOST,110,33,86,12,ES_AUTOHSCROLL - CONTROL "&Use Proxy",IDC_PROXY_ENABLED,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,7,196,14 - LTEXT "Proxy &Host",IDC_STATIC,13,33,82,12 - EDITTEXT IDC_PROXYUSER,110,105,86,12,ES_AUTOHSCROLL - LTEXT "Proxy &User",IDC_STATIC,13,105,82,12 - EDITTEXT IDC_PROXYPASS,110,122,86,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Proxy &Password",IDC_STATIC,13,123,82,12 - CONTROL "&Authenticate to proxy",IDC_PROXY_AUTH_ENABLED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,14,85,86,14 - LTEXT "Proxy &Type",IDC_STATIC,13,63,77,8 - LISTBOX IDC_PROXYTYPE,110,62,86,31,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "&Proxy Port",IDC_STATIC,14,47,80,9 - EDITTEXT IDC_PROXYPORT,109,47,86,12,ES_AUTOHSCROLL | ES_NUMBER -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "The Bitlbee Team\0" - VALUE "FileDescription", "BitlBee for Windows\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "bitlbee\0" - VALUE "LegalCopyright", "Copyright (C) 2002-2004\0" - VALUE "OriginalFilename", "bitlbee.exe\0" - VALUE "ProductName", "Bitlbee Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PROPPAGE_ACCESS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PROPPAGE_USERS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PROPPAGE_PATHS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PHONY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 2 - TOPMARGIN, 7 - BOTTOMMARGIN, 2 - END - - IDD_PROPPAGE_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 277 - TOPMARGIN, 7 - BOTTOMMARGIN, 149 - END - - IDD_PROPPAGE_LOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PROPPAGE_CONNECTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_POPUP MENU DISCARDABLE -BEGIN - POPUP "tray" - BEGIN - MENUITEM "&Show", IDM_SHOW - MENUITEM SEPARATOR - MENUITEM "&Exit", IDM_EXIT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_BEE_SMALL BITMAP DISCARDABLE "res\\bmp00002.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ABOUTBOX "&About bitlbee..." - IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/win32/bitlbeewin.cpp b/win32/bitlbeewin.cpp deleted file mode 100644 index e18ae3cd..00000000 --- a/win32/bitlbeewin.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// bitlbee.cpp : Defines the class behaviors for the application. -// - -#define BITLBEE_CORE -#include "bitlbeewin.h" -#include "traynot.h" -#include "maindlg.h" -#include -extern "C" { -#include "config.h" -#include "bitlbee.h" -#include -#include -int -inet_aton(const char *cp, struct in_addr *addr) -{ - addr->s_addr = inet_addr(cp); - return (addr->s_addr == INADDR_NONE) ? 0 : 1; -} - -void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data); - -} - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp - -BEGIN_MESSAGE_MAP(CBitlbeeApp, CWinApp) - //{{AFX_MSG_MAP(CBitlbeeApp) - ON_COMMAND(IDM_EXIT, OnExit) - ON_COMMAND(IDM_SHOW, OnShow) - //}}AFX_MSG_MAP - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp construction - -CBitlbeeApp::CBitlbeeApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CBitlbeeApp object - -CBitlbeeApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp initialization - -static UINT bb_loop(LPVOID data) -{ - g_main_run(global.loop); - return 0; -} - - -gboolean bitlbee_new_client(GIOChannel *src, GIOCondition cond, gpointer data); -global_t global; // Against global namespace pollution - -BOOL CBitlbeeApp::InitInstance() -{ - if (!AfxSocketInit()) - { - AfxMessageBox(IDP_SOCKETS_INIT_FAILED); - return FALSE; - } - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - HKEY key; - unsigned char databuf[256]; - DWORD len; - RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Bitlbee", &key); - - memset( &global, 0, sizeof( global_t ) ); - g_log_set_handler("GLib", static_cast(G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), glib_logger, NULL); - global.loop = g_main_new(FALSE); - nogaim_init(); - - SetRegistryKey("Bitlbee"); - conf_t *conf = (conf_t *)g_new0( conf_t, 1 ); - global.conf = conf; - global.conf->iface = g_strdup(GetProfileString("main", "interface", "0.0.0.0")); - global.conf->port = GetProfileInt("main", "port", 6667); - global.conf->verbose = GetProfileInt("main", "verbose", 0); - global.conf->password = g_strdup(GetProfileString("main", "password", "")); - global.conf->ping_interval = GetProfileInt("main", "ping_interval_timeout", 60); - global.conf->hostname = g_strdup(GetProfileString("main", "hostname", "localhost")); - if(RegQueryValueEx(key, "configdir", NULL, NULL, databuf, &len) != ERROR_SUCCESS) strcpy((char *)databuf, ""); - global.conf->configdir = g_strdup(GetProfileString("main", "configdir", (char *)databuf)); - if(RegQueryValueEx(key, "motdfile", NULL, NULL, databuf, &len) != ERROR_SUCCESS) strcpy((char *)databuf, ""); - global.conf->motdfile = g_strdup(GetProfileString("main", "motdfile", (char *)databuf)); - if(RegQueryValueEx(key, "helpfile", NULL, NULL, databuf, &len) != ERROR_SUCCESS) strcpy((char *)databuf, ""); - global.helpfile = g_strdup(GetProfileString("main", "helpfile", (char *)databuf)); - global.conf->runmode = RUNMODE_DAEMON; - global.conf->authmode = (enum authmode) GetProfileInt("main", "AuthMode", AUTHMODE_CLOSED); - strcpy(proxyhost, GetProfileString("proxy", "host", "")); - strcpy(proxyuser, GetProfileString("proxy", "user", "")); - strcpy(proxypass, GetProfileString("proxy", "password", "")); - proxytype = GetProfileInt("proxy", "type", PROXY_NONE); - proxyport = GetProfileInt("proxy", "port", 3128); - - dlg = new CMainDlg(); - not = new CTrayNot(dlg); - dlg->ShowWindow(SW_HIDE); - m_pMainWnd = not; - - if(help_init(&(global.help)) == NULL) { - log_message(LOGLVL_WARNING, "Unable to initialize help"); - } - - if(bitlbee_daemon_init() != 0) { - return FALSE; - } - - AfxBeginThread(bb_loop, NULL); - - - return TRUE; -} - -void log_error(char *a) { - ::MessageBox(NULL, a, "Bitlbee error", MB_OK | MB_ICONEXCLAMATION); -} - -/* Dummy function. log output always goes to screen anyway */ -void log_link(int level, int out) {} - -void conf_loaddefaults(irc_t *irc) {} -double gettime() { - return CTime::GetCurrentTime().GetTime(); -} - -void load_protocol(char *name, char *init_function_name, struct prpl *p) { - void (*init_function) (struct prpl *); - - char *path = g_module_build_path(NULL, name); - if(!path) { - log_message(LOGLVL_WARNING, "Can't build path for %s\n", name); - return; - } - - GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY); - if(!mod) { - log_message(LOGLVL_INFO, "Can't find %s, not loading", name); - return; - } - - if(!g_module_symbol(mod,init_function_name,(void **) &init_function)) { - log_message(LOGLVL_WARNING, "Can't find function %s in %s\n", init_function_name, path); - return; - } - g_free(path); - - init_function(p); -} - -void jabber_init(struct prpl *p) { load_protocol("jabber", "jabber_init", p); } -void msn_init(struct prpl *p) { load_protocol("msn", "msn_init", p); } -void byahoo_init(struct prpl *p) { load_protocol("yahoo", "byahoo_init", p); } -void oscar_init(struct prpl *p) { load_protocol("oscar", "oscar_init", p); } - -void CBitlbeeApp::OnExit() -{ - AfxGetApp()->ExitInstance(); - exit(0); -} - -void CBitlbeeApp::OnShow() -{ - dlg->ShowWindow(SW_SHOW); -} - -int CBitlbeeApp::ExitInstance() -{ - WriteProfileString("main", "interface", global.conf->iface); - WriteProfileInt("main", "port", global.conf->port); - WriteProfileInt("main", "verbose", global.conf->verbose); - WriteProfileString("main", "password", global.conf->password); - WriteProfileString("main", "configdir", global.conf->configdir); - WriteProfileString("main", "hostname", global.conf->hostname); - WriteProfileString("main", "motdfile", global.conf->motdfile); - WriteProfileInt("main", "authmode", global.conf->authmode); - WriteProfileInt("proxy", "type", proxytype); - WriteProfileString("proxy", "host", proxyhost); - WriteProfileString("proxy", "user", proxyuser); - WriteProfileString("proxy", "password", proxypass); - WriteProfileInt("proxy", "port", proxyport); - WriteProfileInt("main", "ping_interval_timeout", global.conf->ping_interval); - delete not; - return CWinApp::ExitInstance(); -} diff --git a/win32/bitlbeewin.h b/win32/bitlbeewin.h deleted file mode 100644 index 1a0d0361..00000000 --- a/win32/bitlbeewin.h +++ /dev/null @@ -1,59 +0,0 @@ -// bitlbee.h : main header file for the BITLBEE application -// - -#if !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) -#define AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#include -#include -#include -#include "resource.h" // main symbols - -class CTrayNot; -extern "C" { -#define BITLBEE_CORE -#include "bitlbee.h" -} - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp: -// See bitlbee.cpp for the implementation of this class -// - -class CBitlbeeApp : public CWinApp -{ -public: - CBitlbeeApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBitlbeeApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CBitlbeeApp) - afx_msg void OnExit(); - afx_msg void OnShow(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - protected: - CTrayNot *not; - CPropertySheet *dlg; - GIOChannel *listen; -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) - diff --git a/win32/res/bmp00002.bmp b/win32/res/bmp00002.bmp deleted file mode 100644 index 77205cb1..00000000 Binary files a/win32/res/bmp00002.bmp and /dev/null differ diff --git a/win32/res/icon2.ico b/win32/res/icon2.ico deleted file mode 100644 index 5dfe084f..00000000 Binary files a/win32/res/icon2.ico and /dev/null differ diff --git a/win32/resource.h b/win32/resource.h deleted file mode 100644 index f655c545..00000000 --- a/win32/resource.h +++ /dev/null @@ -1,60 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by bitlbee.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDC_OK 101 -#define IDD_BITLBEE_DIALOG 102 -#define IDP_SOCKETS_INIT_FAILED 103 -#define IDD_PROPPAGE_ACCESS 106 -#define IDD_PROPPAGE_USERS 107 -#define IDD_PROPPAGE_PATHS 108 -#define IDR_MAINFRAME 128 -#define IDI_BEE 130 -#define IDD_PHONY 131 -#define IDR_POPUP 132 -#define IDD_PROPPAGE_ABOUT 132 -#define IDD_PROPPAGE_LOG 133 -#define IDB_BEE_SMALL 135 -#define IDD_PROPPAGE_CONNECTION 137 -#define IDI_ICON1 138 -#define IDC_AUTH_OPEN 1001 -#define IDC_AUTH_CLOSED 1002 -#define IDC_AUTH_REGISTERED 1003 -#define IDC_BROWSE_CONFIG 1004 -#define IDC_CONFIGDIR 1005 -#define IDC_BROWSE_MOTD 1006 -#define IDC_KNOWN_USERS 1007 -#define IDC_MOTDFILE 1007 -#define IDC_EDIT_MOTD 1008 -#define IDC_DEL_KNOWN_USERS 1008 -#define IDC_CURRENT_USERS 1009 -#define IDC_KICK 1010 -#define IDC_INTERFACE 1011 -#define IDC_PORT 1012 -#define IDC_PASSWORD 1013 -#define IDC_REFRESH_KNOWN_USERS 1015 -#define IDC_REFRESH_CURRENT_USERS 1016 -#define IDC_LOG 1017 -#define IDC_PROXYHOST 1018 -#define IDC_PROXYUSER 1019 -#define IDC_PROXYPASS 1020 -#define IDC_PROXY_ENABLED 1021 -#define IDC_PROXY_AUTH_ENABLED 1022 -#define IDC_PROXYPORT 1023 -#define IDC_PROXYTYPE 1024 -#define IDM_SHOW 32771 -#define IDM_EXIT 32773 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 139 -#define _APS_NEXT_COMMAND_VALUE 32774 -#define _APS_NEXT_CONTROL_VALUE 1025 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif -- cgit v1.2.3 From cf136714caa13e2cd4bf8a69a29c08f3a1518f59 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 28 Nov 2005 02:07:56 +0100 Subject: Remove admin tool (now in a seperate branch) --- win32/admin/MainDlg.cpp | 71 ---------- win32/admin/MainDlg.h | 54 -------- win32/admin/PropAccess.cpp | 114 ---------------- win32/admin/PropAccess.h | 59 --------- win32/admin/PropConn.cpp | 123 ------------------ win32/admin/PropConn.h | 59 --------- win32/admin/PropLog.cpp | 78 ----------- win32/admin/PropLog.h | 47 ------- win32/admin/PropMain.cpp | 99 -------------- win32/admin/PropMain.h | 58 --------- win32/admin/PropPaths.cpp | 115 ---------------- win32/admin/PropPaths.h | 57 -------- win32/admin/admin.dsp | 175 ------------------------- win32/admin/bitlbee.rc | 303 ------------------------------------------- win32/admin/bitlbeewin.cpp | 47 ------- win32/admin/bitlbeewin.h | 49 ------- win32/admin/res/bmp00002.bmp | Bin 5830 -> 0 bytes win32/admin/res/icon2.ico | Bin 3774 -> 0 bytes win32/admin/resource.h | 65 ---------- 19 files changed, 1573 deletions(-) delete mode 100644 win32/admin/MainDlg.cpp delete mode 100644 win32/admin/MainDlg.h delete mode 100644 win32/admin/PropAccess.cpp delete mode 100644 win32/admin/PropAccess.h delete mode 100644 win32/admin/PropConn.cpp delete mode 100644 win32/admin/PropConn.h delete mode 100644 win32/admin/PropLog.cpp delete mode 100644 win32/admin/PropLog.h delete mode 100644 win32/admin/PropMain.cpp delete mode 100644 win32/admin/PropMain.h delete mode 100644 win32/admin/PropPaths.cpp delete mode 100644 win32/admin/PropPaths.h delete mode 100644 win32/admin/admin.dsp delete mode 100644 win32/admin/bitlbee.rc delete mode 100644 win32/admin/bitlbeewin.cpp delete mode 100644 win32/admin/bitlbeewin.h delete mode 100644 win32/admin/res/bmp00002.bmp delete mode 100644 win32/admin/res/icon2.ico delete mode 100644 win32/admin/resource.h diff --git a/win32/admin/MainDlg.cpp b/win32/admin/MainDlg.cpp deleted file mode 100644 index e9ecda34..00000000 --- a/win32/admin/MainDlg.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// MainDlg.cpp : implementation file -// - -#include "PropPaths.h" -#include "PropAccess.h" -#include "PropConn.h" -#include "MainDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainDlg - -IMPLEMENT_DYNAMIC(CMainDlg, CPropertySheet) - -CMainDlg::CMainDlg() : CPropertySheet("Bitlbee for Windows") -{ - AddPage(new CPropPaths()); - AddPage(new CPropAccess()); - AddPage(new CPropertyPage(IDD_PROPPAGE_ABOUT)); - AddPage(new CPropConn()); - Create(); - ShowWindow(SW_HIDE); -} - -CMainDlg::~CMainDlg() -{ -} - - -BEGIN_MESSAGE_MAP(CMainDlg, CPropertySheet) - //{{AFX_MSG_MAP(CMainDlg) - ON_WM_CLOSE() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDOK, OnOK) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMainDlg message handlers - -BOOL CMainDlg::OnInitDialog() -{ - m_bModeless = FALSE; - m_nFlags |= WF_CONTINUEMODAL; - - CPropertySheet::OnInitDialog(); - GetDlgItem(IDHELP)->ShowWindow(SW_HIDE); - GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE); - - m_bModeless = TRUE; - m_nFlags &= WF_CONTINUEMODAL; - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CMainDlg::OnOK() -{ - PressButton(PSBTN_APPLYNOW); - ShowWindow(SW_HIDE); -} - - -void CMainDlg::OnClose() -{ - ShowWindow(SW_HIDE); -} diff --git a/win32/admin/MainDlg.h b/win32/admin/MainDlg.h deleted file mode 100644 index be5547fd..00000000 --- a/win32/admin/MainDlg.h +++ /dev/null @@ -1,54 +0,0 @@ -#if !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) -#define AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// MainDlg.h : header file -// - -#include - -///////////////////////////////////////////////////////////////////////////// -// CMainDlg - -class CMainDlg : public CPropertySheet -{ - DECLARE_DYNAMIC(CMainDlg) - -// Construction -public: - CMainDlg(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMainDlg) - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CMainDlg(); - - // Generated message map functions -protected: - //{{AFX_MSG(CMainDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnClose(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - void OnOK(); -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MAINDLG_H__D88FFF4C_047D_4562_A041_CCDCFA52F87C__INCLUDED_) diff --git a/win32/admin/PropAccess.cpp b/win32/admin/PropAccess.cpp deleted file mode 100644 index a09ce454..00000000 --- a/win32/admin/PropAccess.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// PropAccess.cpp : implementation file -// - -#include "PropAccess.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropAccess dialog - - -CPropAccess::CPropAccess() - : CPropertyPage(CPropAccess::IDD) -{ - - //{{AFX_DATA_INIT(CPropAccess) - //}}AFX_DATA_INIT -} - - -void CPropAccess::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropAccess) - DDX_Control(pDX, IDC_AUTH_REGISTERED, m_auth_registered); - DDX_Control(pDX, IDC_AUTH_OPEN, m_auth_open); - DDX_Control(pDX, IDC_AUTH_CLOSED, m_auth_closed); - DDX_Control(pDX, IDC_PASSWORD, m_password); - DDX_Control(pDX, IDC_PORT, m_port); - DDX_Control(pDX, IDC_INTERFACE, m_interface); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropAccess, CPropertyPage) - //{{AFX_MSG_MAP(CPropAccess) - ON_BN_CLICKED(IDC_AUTH_REGISTERED, OnAuthRegistered) - ON_BN_CLICKED(IDC_AUTH_OPEN, OnAuthOpen) - ON_BN_CLICKED(IDC_AUTH_CLOSED, OnAuthClosed) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropAccess message handlers - -void CPropAccess::OnOK() -{ - CString iface; m_interface.GetWindowText(iface); - WriteProfileString("interface", iface); - - CString port; m_port.GetWindowText(port); - WriteProfileInt("port", port); - - CString password; m_password.GetWindowText(password); - WriteProfileString("password", password); - - if(m_auth_closed.GetCheck() == 1) WriteProfileInt("auth_mode", 1); - if(m_auth_open.GetCheck() == 1) WriteProfileInt("auth_mode", 0); - if(m_auth_registered.GetCheck() == 1) WriteProfileInt("auth_mode", 2); - - CPropertyPage::OnOK(); -} - -void CPropAccess::OnAuthRegistered() -{ - m_password.EnableWindow(FALSE); - m_auth_open.SetCheck(0); - m_auth_registered.SetCheck(1); - m_auth_closed.SetCheck(0); - -} - -void CPropAccess::OnAuthOpen() -{ - m_password.EnableWindow(FALSE); - m_auth_open.SetCheck(1); - m_auth_registered.SetCheck(0); - m_auth_closed.SetCheck(0); -} - -void CPropAccess::OnAuthClosed() -{ - m_password.EnableWindow(TRUE); - m_auth_open.SetCheck(0); - m_auth_registered.SetCheck(0); - m_auth_closed.SetCheck(1); - -} - -BOOL CPropAccess::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - HKEY key; - RegOpenKey(HKEY_LOCAL_MACHINE, BITLBEE_KEY, &key); - - m_interface.SetWindowText(GetProfileString("interface", "0.0.0.0")); - m_password.SetWindowText(GetProfileString("password", "")); - char tmp[20]; - sprintf(tmp, "%d", GetProfileInt("port", 6667)); - m_port.SetWindowText(tmp); - - switch(GetProfileInt("auth_mode", 1)) { - case 0: OnAuthOpen();break; - case 1: OnAuthClosed();break; - case 2: OnAuthRegistered();break; - } - - return TRUE; -} diff --git a/win32/admin/PropAccess.h b/win32/admin/PropAccess.h deleted file mode 100644 index cae0241c..00000000 --- a/win32/admin/PropAccess.h +++ /dev/null @@ -1,59 +0,0 @@ -#if !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) -#define AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropAccess.h : header file -// - -#include -#include "Resource.h" - -///////////////////////////////////////////////////////////////////////////// -// CPropAccess dialog - -class CPropAccess : public CPropertyPage -{ -// Construction -public: - CPropAccess(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropAccess) - enum { IDD = IDD_PROPPAGE_ACCESS }; - CButton m_auth_registered; - CButton m_auth_open; - CButton m_auth_closed; - CEdit m_password; - CEdit m_port; - CEdit m_interface; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropAccess) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropAccess) - afx_msg void OnAuthRegistered(); - afx_msg void OnAuthOpen(); - afx_msg void OnAuthClosed(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPACCESS_H__0AC45777_B43C_4467_91FF_391DFD582057__INCLUDED_) diff --git a/win32/admin/PropConn.cpp b/win32/admin/PropConn.cpp deleted file mode 100644 index b16be0f1..00000000 --- a/win32/admin/PropConn.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// PropConn.cpp : implementation file -// - -#include "PropConn.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropConn dialog - - -CPropConn::CPropConn(CWnd* pParent /*=NULL*/) - : CPropertyPage(CPropConn::IDD) -{ - //{{AFX_DATA_INIT(CPropConn) - //}}AFX_DATA_INIT -} - - -void CPropConn::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropConn) - DDX_Control(pDX, IDC_PROXYPORT, m_proxyport); - DDX_Control(pDX, IDC_PROXYTYPE, m_proxytype); - DDX_Control(pDX, IDC_PROXY_ENABLED, m_proxy_enabled); - DDX_Control(pDX, IDC_PROXY_AUTH_ENABLED, m_proxy_auth_enabled); - DDX_Control(pDX, IDC_PROXYPASS, m_proxypass); - DDX_Control(pDX, IDC_PROXYHOST, m_proxyhost); - DDX_Control(pDX, IDC_PROXYUSER, m_proxyuser); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropConn, CPropertyPage) - //{{AFX_MSG_MAP(CPropConn) - ON_BN_CLICKED(IDC_PROXY_AUTH_ENABLED, OnProxyAuthEnabled) - ON_BN_CLICKED(IDC_PROXY_ENABLED, OnProxyEnabled) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropConn message handlers - -void CPropConn::OnProxyAuthEnabled() -{ - m_proxyuser.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); - m_proxypass.EnableWindow(m_proxy_enabled.GetCheck() && m_proxy_auth_enabled.GetCheck()); -} - -void CPropConn::OnProxyEnabled() -{ - m_proxyhost.EnableWindow(m_proxy_enabled.GetCheck()); - m_proxytype.EnableWindow(m_proxy_enabled.GetCheck()); - m_proxyport.EnableWindow(m_proxy_enabled.GetCheck()); - m_proxy_auth_enabled.EnableWindow(m_proxy_enabled.GetCheck()); - - if(m_proxy_enabled.GetCheck() && (m_proxytype.GetCurSel() < 0 || m_proxytype.GetCurSel() > 2)) - { - m_proxytype.SetCurSel(0); - } - - OnProxyAuthEnabled(); -} - -void CPropConn::OnOK() -{ - CString tmp; - m_proxyhost.GetWindowText(tmp); - WriteProfileString("proxy_host", tmp); - - m_proxyport.GetWindowText(tmp); - WriteProfileInt("proxy_port", atoi(tmp)); - - if(!m_proxy_enabled.GetCheck()) { - WriteProfileInt("proxy_type", 0); - } else { - WriteProfileInt("proxy_type", m_proxytype.GetCurSel()+1); - } - - if(!m_proxy_auth_enabled.GetCheck()) { - WriteProfileString("proxy_user", ""); - WriteProfileString("proxy_password", ""); - } else { - m_proxyuser.GetWindowText(tmp); - WriteProfileString("proxy_user", tmp); - m_proxypass.GetWindowText(tmp); - WriteProfileString("proxy_password", tmp); - } - - CPropertyPage::OnOK(); -} - -BOOL CPropConn::OnInitDialog() -{ - char pp[20]; - CPropertyPage::OnInitDialog(); - int proxytype; - - m_proxyhost.SetWindowText(GetProfileString("proxy_host", "")); - m_proxyuser.SetWindowText(GetProfileString("proxy_user", "")); - m_proxypass.SetWindowText(GetProfileString("proxy_password", "")); - sprintf(pp, "%d", GetProfileInt("proxy_port", 3128)); - m_proxyport.SetWindowText(pp); - - proxytype = GetProfileInt("proxy_type", 0); - - m_proxytype.AddString("SOCKS 4"); - m_proxytype.AddString("SOCKS 5"); - m_proxytype.AddString("HTTP"); - m_proxytype.SetCurSel(proxytype-1); - - m_proxy_enabled.SetCheck(proxytype == 0?0:1); - m_proxy_auth_enabled.SetCheck(strcmp(GetProfileString("proxy_user", ""), "")?1:0); - - OnProxyEnabled(); - - return TRUE; -} \ No newline at end of file diff --git a/win32/admin/PropConn.h b/win32/admin/PropConn.h deleted file mode 100644 index e920da3d..00000000 --- a/win32/admin/PropConn.h +++ /dev/null @@ -1,59 +0,0 @@ -#if !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) -#define AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropConn.h : header file -// - -#include -#include "Resource.h" - -///////////////////////////////////////////////////////////////////////////// -// CPropConn dialog - -class CPropConn : public CPropertyPage -{ -// Construction -public: - CPropConn(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropConn) - enum { IDD = IDD_PROPPAGE_CONNECTION }; - CEdit m_proxyport; - CListBox m_proxytype; - CButton m_proxy_enabled; - CButton m_proxy_auth_enabled; - CEdit m_proxypass; - CEdit m_proxyhost; - CEdit m_proxyuser; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropConn) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropConn) - afx_msg void OnProxyAuthEnabled(); - afx_msg void OnProxyEnabled(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPCONN_H__8969671F_8D9F_45E9_929F_B36CFEFCBAA2__INCLUDED_) diff --git a/win32/admin/PropLog.cpp b/win32/admin/PropLog.cpp deleted file mode 100644 index 8b1641d9..00000000 --- a/win32/admin/PropLog.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// PropLog.cpp : implementation file -// - -#include "PropLog.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropLog dialog - - -CPropLog::CPropLog() - : CPropertyPage(CPropLog::IDD) -{ - //{{AFX_DATA_INIT(CPropLog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CPropLog::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropLog) - DDX_Control(pDX, IDC_LOG, m_log); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropLog, CPropertyPage) - //{{AFX_MSG_MAP(CPropLog) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropLog message handlers - -static GList *log = NULL; - -extern "C" { -void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data) -{ - log = g_list_append(log, g_strdup_printf("%s: %s", log_domain, msg)); -} -} - -void log_message(int level, char *message, ... ) { -#define LOG_MAXLEN 300 - va_list ap; - va_start(ap, message); - char *msg = (char *)g_malloc(LOG_MAXLEN); - g_vsnprintf(msg, LOG_MAXLEN, message, ap); - va_end(ap); - log = g_list_append(log, msg); - if(level == LOGLVL_ERROR) ::MessageBox(NULL, msg, "Bitlbee", MB_OK | MB_ICONINFORMATION); - TRACE("%d: %s\n", level, msg); -} - - -BOOL CPropLog::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - m_log.ResetContent(); - GList *gl = log; - while(gl) { - char *d = (char *)gl->data; - m_log.AddString(d); - gl = gl->next; - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/win32/admin/PropLog.h b/win32/admin/PropLog.h deleted file mode 100644 index 1a847b19..00000000 --- a/win32/admin/PropLog.h +++ /dev/null @@ -1,47 +0,0 @@ -#if !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) -#define AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropLog.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPropLog dialog - -class CPropLog : public CPropertyPage -{ -// Construction -public: - CPropLog(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropLog) - enum { IDD = IDD_PROPPAGE_LOG }; - CListBox m_log; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropLog) - public: - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropLog) - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPLOG_H__F56909E1_BBCC_4163_B9C2_E8D5685A34AA__INCLUDED_) diff --git a/win32/admin/PropMain.cpp b/win32/admin/PropMain.cpp deleted file mode 100644 index f15af691..00000000 --- a/win32/admin/PropMain.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// PropMain.cpp : implementation file -// - -#include -#include "PropMain.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropMain property page - -IMPLEMENT_DYNCREATE(CPropMain, CPropertyPage) - -CPropMain::CPropMain() : CPropertyPage(CPropMain::IDD) -{ - //{{AFX_DATA_INIT(CPropMain) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - -CPropMain::~CPropMain() -{ -} - -void CPropMain::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropMain) - DDX_Control(pDX, IDC_STOPSERVICE, m_stopservice); - DDX_Control(pDX, IDC_STARTSERVICE, m_startservice); - DDX_Control(pDX, IDC_PING_INTERVAL, m_ping_interval); - DDX_Control(pDX, IDC_VERBOSE, m_Verbose); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropMain, CPropertyPage) - //{{AFX_MSG_MAP(CPropMain) - ON_BN_CLICKED(IDC_STARTSERVICE, OnStartService) - ON_BN_CLICKED(IDC_STOPSERVICE, OnStopService) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropMain message handlers - -BOOL CPropMain::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - global.conf->verbose = GetProfileInt("verbose", 0); - global.conf->ping_interval = GetProfileInt("ping_interval_timeout", 0); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CPropMain::OnOK() -{ - CPropertyPage::OnOK(); - - WriteProfileInt("verbose", global.conf->verbose); - - WriteProfileInt("ping_interval_timeout", global.conf->ping_interval); -} - -void CPropMain::OnStartService() -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - SERVICE_STATUS status; - - schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); - schService = OpenService(schSCManager, "bitlbee", SERVICE_ALL_ACCESS); - - ControlService( schService, SERVICE_CONTROL_CONTINUE, &status ); - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); -} - -void CPropMain::OnStopService() -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - SERVICE_STATUS status; - - schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); - schService = OpenService(schSCManager, "bitlbee", SERVICE_ALL_ACCESS); - - ControlService( schService, SERVICE_CONTROL_PAUSE, &status ); - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); -} diff --git a/win32/admin/PropMain.h b/win32/admin/PropMain.h deleted file mode 100644 index 832457b2..00000000 --- a/win32/admin/PropMain.h +++ /dev/null @@ -1,58 +0,0 @@ -#if !defined(AFX_PROPMAIN_H__F3EF57A7_15AA_4F36_B6C1_2EAD91127449__INCLUDED_) -#define AFX_PROPMAIN_H__F3EF57A7_15AA_4F36_B6C1_2EAD91127449__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropMain.h : header file - -#include "Resource.h" -// - -///////////////////////////////////////////////////////////////////////////// -// CPropMain dialog - -class CPropMain : public CPropertyPage -{ - DECLARE_DYNCREATE(CPropMain) - -// Construction -public: - CPropMain(); - ~CPropMain(); - -// Dialog Data - //{{AFX_DATA(CPropMain) - enum { IDD = IDD_PROPPAGE_MAIN }; - CButton m_stopservice; - CButton m_startservice; - CEdit m_ping_interval; - CButton m_Verbose; - //}}AFX_DATA - - -// Overrides - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CPropMain) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - // Generated message map functions - //{{AFX_MSG(CPropMain) - virtual BOOL OnInitDialog(); - afx_msg void OnStartService(); - afx_msg void OnStopService(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPMAIN_H__F3EF57A7_15AA_4F36_B6C1_2EAD91127449__INCLUDED_) diff --git a/win32/admin/PropPaths.cpp b/win32/admin/PropPaths.cpp deleted file mode 100644 index 4fb49497..00000000 --- a/win32/admin/PropPaths.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// PropPaths.cpp : implementation file -// - -#include "PropPaths.h" -#include "shlobj.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPropPaths dialog - - -CPropPaths::CPropPaths() - : CPropertyPage(CPropPaths::IDD) -{ - //{{AFX_DATA_INIT(CPropPaths) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CPropPaths::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPropPaths) - DDX_Control(pDX, IDC_MOTDFILE, m_motdfile); - DDX_Control(pDX, IDC_EDIT_MOTD, m_edit_motd); - DDX_Control(pDX, IDC_CONFIGDIR, m_configdir); - DDX_Control(pDX, IDC_BROWSE_MOTD, m_browse_motd); - DDX_Control(pDX, IDC_BROWSE_CONFIG, m_browse_config); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPropPaths, CPropertyPage) - //{{AFX_MSG_MAP(CPropPaths) - ON_BN_CLICKED(IDC_BROWSE_CONFIG, OnBrowseConfig) - ON_BN_CLICKED(IDC_BROWSE_MOTD, OnBrowseMotd) - ON_BN_CLICKED(IDC_EDIT_MOTD, OnEditMotd) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPropPaths message handlers - -void CPropPaths::OnOK() -{ - CString tmp; - m_configdir.GetWindowText(tmp); - - if (tmp.GetLength() > 0 - && tmp.GetAt(tmp.GetLength() - 1) != '/' - && tmp.GetAt(tmp.GetLength() - 1) != '\\') - { - tmp = tmp + "\\"; - } - - WriteProfileString("configdir", tmp); - - m_motdfile.GetWindowText(tmp); - WriteProfileString("motdfile", tmp); - - CPropertyPage::OnOK(); -} - -void CPropPaths::OnBrowseConfig() -{ - BROWSEINFO bi = { 0 }; - bi.lpszTitle = _T("Choose a config directory"); - LPITEMIDLIST pidl = SHBrowseForFolder(&bi); - if( pidl != 0) - { - TCHAR path[MAX_PATH]; - if( SHGetPathFromIDList (pidl, path) ) { - m_configdir.SetWindowText(path); - } - - IMalloc * imalloc = 0; - if ( SUCCEEDED (SHGetMalloc (&imalloc)) ) - { - imalloc->Free(pidl); - imalloc->Release(); - } - } -} - -void CPropPaths::OnBrowseMotd() -{ - CFileDialog f(TRUE); - - if(f.DoModal() == IDOK) { - m_motdfile.SetWindowText(f.GetPathName()); - } - -} - -void CPropPaths::OnEditMotd() -{ - CString loc;m_motdfile.GetWindowText(loc); - ShellExecute(this->GetSafeHwnd(), NULL, loc, NULL, NULL, SW_SHOWNORMAL); -} - -BOOL CPropPaths::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - m_configdir.SetWindowText(GetProfileString("configdir", "")); - m_motdfile.SetWindowText(GetProfileString("motdfile", "")); - - return TRUE; -} diff --git a/win32/admin/PropPaths.h b/win32/admin/PropPaths.h deleted file mode 100644 index 733e674c..00000000 --- a/win32/admin/PropPaths.h +++ /dev/null @@ -1,57 +0,0 @@ -#if !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) -#define AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PropPaths.h : header file -// -#include -#include "Resource.h" - -///////////////////////////////////////////////////////////////////////////// -// CPropPaths dialog - -class CPropPaths : public CPropertyPage -{ -// Construction -public: - CPropPaths(); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPropPaths) - enum { IDD = IDD_PROPPAGE_PATHS }; - CEdit m_motdfile; - CButton m_edit_motd; - CEdit m_configdir; - CButton m_browse_motd; - CButton m_browse_config; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPropPaths) - public: - virtual void OnOK(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPropPaths) - afx_msg void OnBrowseConfig(); - afx_msg void OnBrowseMotd(); - afx_msg void OnEditMotd(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PROPPATHS_H__693C8F02_C150_45DD_99F1_F824795E98C9__INCLUDED_) diff --git a/win32/admin/admin.dsp b/win32/admin/admin.dsp deleted file mode 100644 index 6d24af0d..00000000 --- a/win32/admin/admin.dsp +++ /dev/null @@ -1,175 +0,0 @@ -# Microsoft Developer Studio Project File - Name="admin" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=admin - Win32 Debug -!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 "admin.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 "admin.mak" CFG="admin - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "admin - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "admin - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "admin - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# 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 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"Release/bitlbeeadm.exe" - -!ELSEIF "$(CFG)" == "admin - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/bitlbeeadm.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "admin - Win32 Release" -# Name "admin - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\bitlbeewin.cpp -# End Source File -# Begin Source File - -SOURCE=.\MainDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropAccess.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropConn.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropMain.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropPaths.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\bitlbeewin.h -# End Source File -# Begin Source File - -SOURCE=.\MainDlg.h -# End Source File -# Begin Source File - -SOURCE=.\PropAccess.h -# End Source File -# Begin Source File - -SOURCE=.\PropConn.h -# End Source File -# Begin Source File - -SOURCE=.\PropMain.h -# End Source File -# Begin Source File - -SOURCE=.\PropPaths.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\bitlbee.rc - -!IF "$(CFG)" == "admin - Win32 Release" - -!ELSEIF "$(CFG)" == "admin - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\res\bmp00002.bmp -# End Source File -# Begin Source File - -SOURCE=.\res\icon2.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/win32/admin/bitlbee.rc b/win32/admin/bitlbee.rc deleted file mode 100644 index 5e9b5407..00000000 --- a/win32/admin/bitlbee.rc +++ /dev/null @@ -1,303 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.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 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_BEE ICON DISCARDABLE "res\\icon2.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PROPPAGE_ACCESS DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Access" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Authentication Mode",IDC_STATIC,7,7,196,47 - CONTROL "&Open",IDC_AUTH_OPEN,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,14,15,181,13 - CONTROL "&Closed",IDC_AUTH_CLOSED,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,14,27,160,11 - CONTROL "&Registered",IDC_AUTH_REGISTERED,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,14,39,182,11 - GROUPBOX "Bind",IDC_STATIC,7,55,196,46 - LTEXT "IP to bind to:",IDC_STATIC,15,67,49,9 - LTEXT "Port:",IDC_STATIC,15,82,52,10 - EDITTEXT IDC_INTERFACE,86,67,108,11,ES_AUTOHSCROLL - EDITTEXT IDC_PORT,86,82,108,11,ES_AUTOHSCROLL - GROUPBOX "Password",IDC_STATIC,7,104,196,43 - EDITTEXT IDC_PASSWORD,14,129,115,11,ES_AUTOHSCROLL - LTEXT "Only used when authentication mode is set to closed.", - IDC_STATIC,13,113,184,11 -END - -IDD_PROPPAGE_PATHS DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Paths" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Config path",IDC_STATIC,7,7,196,30 - PUSHBUTTON "&Browse...",IDC_BROWSE_CONFIG,151,16,46,13 - EDITTEXT IDC_CONFIGDIR,13,17,122,13,ES_AUTOHSCROLL - GROUPBOX "Message of the day file",IDC_STATIC,7,42,196,40 - PUSHBUTTON "&Browse...",IDC_BROWSE_MOTD,153,51,43,13 - EDITTEXT IDC_MOTDFILE,13,51,122,13,ES_AUTOHSCROLL - PUSHBUTTON "&Edit...",IDC_EDIT_MOTD,153,66,43,13 -END - -IDD_PROPPAGE_ABOUT DIALOG DISCARDABLE 0, 0, 284, 156 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "About" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Authors",IDC_STATIC,7,7,270,79 - LTEXT "Bitlbee is written by : \n Wilmer van der Gaast \n Maurits Dijkstra \n Jelmer Vernooij ", - IDC_STATIC,13,16,180,35 - LTEXT "Windows port by Jelmer Vernooij ", - IDC_STATIC,13,55,180,12 - CONTROL 135,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN,193,14,73, - 64 - GROUPBOX "More information",IDC_STATIC,7,88,270,61 - LTEXT "See the file CREDITS for a list of contributors.", - IDC_STATIC,16,69,171,11 - LTEXT "The Bitlbee homepage is located at http://www.bitlbee.org/\n\nFor Bitlbee support, go to #bitlbee on irc.oftc.net", - IDC_STATIC,17,100,248,39 -END - -IDD_PROPPAGE_CONNECTION DIALOG DISCARDABLE 0, 0, 210, 154 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Connection" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Proxy",IDC_STATIC,7,23,196,124 - EDITTEXT IDC_PROXYHOST,110,33,86,12,ES_AUTOHSCROLL - CONTROL "&Use Proxy",IDC_PROXY_ENABLED,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,7,196,14 - LTEXT "Proxy &Host",IDC_STATIC,13,33,82,12 - EDITTEXT IDC_PROXYUSER,110,105,86,12,ES_AUTOHSCROLL - LTEXT "Proxy &User",IDC_STATIC,13,105,82,12 - EDITTEXT IDC_PROXYPASS,110,122,86,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Proxy &Password",IDC_STATIC,13,123,82,12 - CONTROL "&Authenticate to proxy",IDC_PROXY_AUTH_ENABLED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,14,85,86,14 - LTEXT "Proxy &Type",IDC_STATIC,13,63,77,8 - LISTBOX IDC_PROXYTYPE,110,62,86,31,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "&Proxy Port",IDC_STATIC,14,47,80,9 - EDITTEXT IDC_PROXYPORT,109,47,86,12,ES_AUTOHSCROLL | ES_NUMBER -END - -IDD_PROPPAGE_MAIN DIALOG DISCARDABLE 0, 0, 210, 101 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Main" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Current Status:",IDC_STATIC,13,16,66,9 - LTEXT "Static",IDC_STATIC,92,16,80,12 - PUSHBUTTON "&Start",IDC_STARTSERVICE,13,28,40,11 - PUSHBUTTON "&Stop",IDC_STOPSERVICE,65,29,46,11 - CONTROL "&Verbose",IDC_VERBOSE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,43,84,12 - EDITTEXT IDC_PING_INTERVAL,93,62,47,12,ES_AUTOHSCROLL - LTEXT "Ping Interval:",IDC_STATIC,13,62,60,10 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "The Bitlbee Team\0" - VALUE "FileDescription", "BitlBee for Windows\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "bitlbee\0" - VALUE "LegalCopyright", "Copyright (C) 2002-2005\0" - VALUE "OriginalFilename", "bitlbeeadm.exe\0" - VALUE "ProductName", "Bitlbee Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PROPPAGE_ACCESS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PROPPAGE_PATHS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PROPPAGE_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 277 - TOPMARGIN, 7 - BOTTOMMARGIN, 149 - END - - IDD_PROPPAGE_CONNECTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END - - IDD_PROPPAGE_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 6 - BOTTOMMARGIN, 94 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_BEE_SMALL BITMAP DISCARDABLE "res\\bmp00002.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ABOUTBOX "&About bitlbee..." -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/win32/admin/bitlbeewin.cpp b/win32/admin/bitlbeewin.cpp deleted file mode 100644 index 56e61c3f..00000000 --- a/win32/admin/bitlbeewin.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// bitlbee.cpp : Defines the class behaviors for the application. -// - -#include "maindlg.h" -#include "bitlbeewin.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp - -BEGIN_MESSAGE_MAP(CBitlbeeApp, CWinApp) - //{{AFX_MSG_MAP(CBitlbeeApp) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// The one and only CBitlbeeApp object - -CBitlbeeApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp initialization - -BOOL CBitlbeeApp::InitInstance() -{ - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - new CMainDlg(); - - return TRUE; -} diff --git a/win32/admin/bitlbeewin.h b/win32/admin/bitlbeewin.h deleted file mode 100644 index 73860252..00000000 --- a/win32/admin/bitlbeewin.h +++ /dev/null @@ -1,49 +0,0 @@ -// bitlbee.h : main header file for the BITLBEE application -// - -#if !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) -#define AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#include -#include -#include -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CBitlbeeApp: -// See bitlbee.cpp for the implementation of this class -// - -class CBitlbeeApp : public CWinApp -{ -public: - CBitlbeeApp() {} - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBitlbeeApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CBitlbeeApp) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - protected: - CPropertySheet *dlg; -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_BITLBEE_H__E76A1E72_2177_4477_A796_76D6AB817F80__INCLUDED_) - diff --git a/win32/admin/res/bmp00002.bmp b/win32/admin/res/bmp00002.bmp deleted file mode 100644 index 77205cb1..00000000 Binary files a/win32/admin/res/bmp00002.bmp and /dev/null differ diff --git a/win32/admin/res/icon2.ico b/win32/admin/res/icon2.ico deleted file mode 100644 index 5dfe084f..00000000 Binary files a/win32/admin/res/icon2.ico and /dev/null differ diff --git a/win32/admin/resource.h b/win32/admin/resource.h deleted file mode 100644 index 8c8fe503..00000000 --- a/win32/admin/resource.h +++ /dev/null @@ -1,65 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by bitlbee.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDC_OK 101 -#define IDD_BITLBEE_DIALOG 102 -#define IDP_SOCKETS_INIT_FAILED 103 -#define IDD_PROPPAGE_ACCESS 106 -#define IDD_PROPPAGE_USERS 107 -#define IDD_PROPPAGE_PATHS 108 -#define IDR_MAINFRAME 128 -#define IDI_BEE 130 -#define IDD_PHONY 131 -#define IDR_POPUP 132 -#define IDD_PROPPAGE_ABOUT 132 -#define IDD_PROPPAGE_LOG 133 -#define IDB_BEE_SMALL 135 -#define IDD_PROPPAGE_CONNECTION 137 -#define IDI_ICON1 138 -#define IDD_PROPPAGE_MAIN 138 -#define IDC_AUTH_OPEN 1001 -#define IDC_AUTH_CLOSED 1002 -#define IDC_AUTH_REGISTERED 1003 -#define IDC_BROWSE_CONFIG 1004 -#define IDC_CONFIGDIR 1005 -#define IDC_BROWSE_MOTD 1006 -#define IDC_KNOWN_USERS 1007 -#define IDC_MOTDFILE 1007 -#define IDC_EDIT_MOTD 1008 -#define IDC_DEL_KNOWN_USERS 1008 -#define IDC_CURRENT_USERS 1009 -#define IDC_KICK 1010 -#define IDC_INTERFACE 1011 -#define IDC_PORT 1012 -#define IDC_PASSWORD 1013 -#define IDC_REFRESH_KNOWN_USERS 1015 -#define IDC_REFRESH_CURRENT_USERS 1016 -#define IDC_LOG 1017 -#define IDC_PROXYHOST 1018 -#define IDC_PROXYUSER 1019 -#define IDC_PROXYPASS 1020 -#define IDC_PROXY_ENABLED 1021 -#define IDC_PROXY_AUTH_ENABLED 1022 -#define IDC_PROXYPORT 1023 -#define IDC_PROXYTYPE 1024 -#define IDC_STARTSERVICE 1025 -#define IDC_STOPSERVICE 1026 -#define IDC_VERBOSE 1027 -#define IDC_PING_INTERVAL 1028 -#define IDM_SHOW 32771 -#define IDM_EXIT 32773 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 139 -#define _APS_NEXT_COMMAND_VALUE 32774 -#define _APS_NEXT_CONTROL_VALUE 1029 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif -- cgit v1.2.3 From 2983f5e8c2d3046bf01337e5caefa3af55ba6bff Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 29 Nov 2005 00:32:50 +0100 Subject: Switch to using a Makefile rather then VC project files. --- doc/BUILD.win32 | 27 ++++-- win32.mk | 136 +++++++++++++++++++++++++++ win32/bitlbee.dsp | 247 -------------------------------------------------- win32/bitlbee.dsw | 119 ------------------------ win32/bitlbee_ssl.dsp | 99 -------------------- win32/jabber.dsp | 228 ---------------------------------------------- win32/msn.dsp | 116 ------------------------ win32/oscar.dsp | 204 ----------------------------------------- win32/yahoo.dsp | 152 ------------------------------- 9 files changed, 154 insertions(+), 1174 deletions(-) create mode 100644 win32.mk delete mode 100644 win32/bitlbee.dsp delete mode 100644 win32/bitlbee.dsw delete mode 100644 win32/bitlbee_ssl.dsp delete mode 100644 win32/jabber.dsp delete mode 100644 win32/msn.dsp delete mode 100644 win32/oscar.dsp delete mode 100644 win32/yahoo.dsp diff --git a/doc/BUILD.win32 b/doc/BUILD.win32 index 03e1b8d9..e21e1aaf 100644 --- a/doc/BUILD.win32 +++ b/doc/BUILD.win32 @@ -1,23 +1,32 @@ -Instructions for building the Bitlbee Win32 port +Instructions for building BitlBee on Windows ================================================ 1. Download the latest version using bzr (http://www.bazaar-ng.org/): - bzr branch http://jelmer.vernstok.nl/oss/bitlbee/bzr/win32 bitlbee-win32 + + H:\> bzr branch http://win32.bitlbee.org/bzr bitlbee-win32 + ... + 2. Download and install the required development files: from ftp://ftp.gtk.org/pub/gtk/v2.8/win32/ - glib - glib-dev - - libiconv - - gettext + - libiconv (in dependencies/) + - gettext (in dependencies/) from http://ftp.mozilla.org/pub/mozilla.org/ - - nss - - nspr + - nss (in security/nss/) + - nspr (in nspr/) + +3. Set the following variables in Makefile.settings, if you don't have the + libraries above installed in the default directories searched by MSVC: -I've put them inside c:\dev, so you might have the most with that location. + - GLIB_DIR + - NSS_DIR + - NSPR_DIR -3. Open bitlbee.dsw in VC++ and build :-) +4. Build: -4. Now you're done. When running, make sure all the required DLL's are accessible. If they can't be found, place them inside c:\winnt\system32 or the Debug or Release directories inside bitlbee-...\win32\. + H:\BitlBee> nmake /f win32.mk + ... 5. To build setup files, compile the bitlbee.iss file using the Inno Setup program (available from www.jrsoftware.org). diff --git a/win32.mk b/win32.mk new file mode 100644 index 00000000..59ca7a81 --- /dev/null +++ b/win32.mk @@ -0,0 +1,136 @@ +!INCLUDE Makefile.settings + +GLIB_CFLAGS = /I "$(GLIB_DIR)\include" \ + /I "$(GLIB_DIR)\include\glib-2.0" \ + /I "$(GLIB_DIR)\lib\glib-2.0\include" + +GLIB_LFLAGS = /libpath:"$(GLIB_DIR)\lib" + +NSS_CFLAGS = /I "$(NSS_DIR)\include" /I "$(NSPR_DIR)\include" +NSS_LFLAGS = /libpath:"$(NSS_DIR)\lib" /libpath:"$(NSPR_DIR)\lib" +NSS_LIBS = nss3.lib ssl3.lib libnspr4.lib + +COMMON_LIBS = kernel32.lib user32.lib advapi32.lib shell32.lib iconv.lib \ + glib-2.0.lib gmodule-2.0.lib wsock32.lib advapi32.lib + + +MAIN_OBJS = account.obj bitlbee.obj commands.obj crypting.obj \ + help.obj irc.obj protocols\md5.obj protocols\nogaim.obj \ + protocols\sha.obj protocols\proxy.obj query.obj nick.obj set.obj \ + user.obj protocols\util.obj win32.obj + +MAIN_LIBS = $(COMMON_LIBS) + +SSL_OBJS = protocols\ssl_nss.obj +SSL_LIBS = $(NSS_LFLAGS) $(NSS_LIBS) + +MSN_OBJS = \ + protocols\msn\msn.obj \ + protocols\msn\msn_util.obj \ + protocols\msn\ns.obj \ + protocols\msn\passport.obj \ + protocols\msn\sb.obj \ + protocols\msn\tables.obj \ + $(SSL_OBJS) + +MSN_LIBS = $(COMMON_LIBS) $(SSL_LIBS) + +OSCAR_OBJS = \ + protocols\oscar\admin.obj \ + protocols\oscar\auth.obj \ + protocols\oscar\bos.obj \ + protocols\oscar\buddylist.obj \ + protocols\oscar\chat.obj \ + protocols\oscar\chatnav.obj \ + protocols\oscar\conn.obj \ + protocols\oscar\icq.obj \ + protocols\oscar\im.obj \ + protocols\oscar\info.obj \ + protocols\oscar\misc.obj \ + protocols\oscar\msgcookie.obj \ + protocols\oscar\oscar.obj \ + protocols\oscar\oscar_util.obj \ + protocols\oscar\rxhandlers.obj \ + protocols\oscar\rxqueue.obj \ + protocols\oscar\search.obj \ + protocols\oscar\service.obj \ + protocols\oscar\snac.obj \ + protocols\oscar\ssi.obj \ + protocols\oscar\stats.obj \ + protocols\oscar\tlv.obj \ + protocols\oscar\txqueue.obj + +OSCAR_LIBS = $(COMMON_LIBS) + +JABBER_OBJS = \ + protocols\jabber\expat.obj \ + protocols\jabber\genhash.obj \ + protocols\jabber\hashtable.obj \ + protocols\jabber\jabber.obj \ + protocols\jabber\jconn.obj \ + protocols\jabber\jid.obj \ + protocols\jabber\jpacket.obj \ + protocols\jabber\jutil.obj \ + protocols\jabber\karma.obj \ + protocols\jabber\log.obj \ + protocols\jabber\pool.obj \ + protocols\jabber\pproxy.obj \ + protocols\jabber\rate.obj \ + protocols\jabber\str.obj \ + protocols\jabber\xhash.obj \ + protocols\jabber\xmlnode.obj \ + protocols\jabber\xmlparse.obj \ + protocols\jabber\xmlrole.obj \ + protocols\jabber\xmltok.obj \ + protocols\jabber\xstream.obj \ + $(SSL_OBJS) + +JABBER_LIBS = $(COMMON_LIBS) $(SSL_LIBS) + +YAHOO_OBJS = \ + protocols\yahoo\crypt.obj \ + protocols\yahoo\libyahoo2.obj \ + protocols\yahoo\vc50.idb \ + protocols\yahoo\yahoo.obj \ + protocols\yahoo\yahoo_fn.obj \ + protocols\yahoo\yahoo_httplib.obj \ + protocols\yahoo\yahoo_list.obj \ + protocols\yahoo\yahoo_util.obj + +YAHOO_LIBS = $(COMMON_LIBS) + +CC=cl.exe +CFLAGS=$(GLIB_CFLAGS) $(NSS_CFLAGS) /D NDEBUG /D WIN32 /D _WINDOWS \ + /I . /I protocols /I protocols\oscar /nologo \ + /D GLIB2 /D ARCH="\"Windows\"" /D CPU="\"x86\"" \ + /D PLUGINDIR="plugins" + +.c.obj: + $(CC) $(CFLAGS) /c /Fo$@ $< + +ALL: bitlbee.exe libmsn.dll liboscar.dll libjabber.dll libyahoo.dll + +LINK32=link.exe +LINK32_FLAGS=/nologo $(GLIB_LFLAGS) + +bitlbee.exe: $(DEF_FILE) $(MAIN_OBJS) + $(LINK32) $(MAIN_LIBS) $(LINK32_FLAGS) /out:bitlbee.exe $(MAIN_OBJS) + +libmsn.dll: $(MSN_OBJS) + $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:msn_init $(MSN_LIBS) $(LINK32_FLAGS) /out:libmsn.dll $(MSN_OBJS) + +libyahoo.dll: $(YAHOO_OBJS) + $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:yahoo_init $(YAHOO_LIBS) $(LINK32_FLAGS) /out:libyahoo.dll $(YAHOO_OBJS) + +liboscar.dll: $(OSCAR_OBJS) + $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:oscar_init $(OSCAR_LIBS) $(LINK32_FLAGS) /out:liboscar.dll $(OSCAR_OBJS) + +libjabber.dll: $(JABBER_OBJS) + $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:jabber_init $(JABBER_LIBS) $(LINK32_FLAGS) /out:libjabber.dll $(JABBER_OBJS) + +clean: + @-erase $(MAIN_OBJS) + @-erase $(MSN_OBJS) + @-erase $(JABBER_OBJS) + @-erase $(OSCAR_OBJS) + @-erase $(YAHOO_OBJS) diff --git a/win32/bitlbee.dsp b/win32/bitlbee.dsp deleted file mode 100644 index f08f64a9..00000000 --- a/win32/bitlbee.dsp +++ /dev/null @@ -1,247 +0,0 @@ -# Microsoft Developer Studio Project File - Name="bitlbee" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=bitlbee - Win32 Debug -!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 "bitlbee.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 "bitlbee.mak" CFG="bitlbee - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "bitlbee - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "bitlbee - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "bitlbee - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# 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 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib advapi32.lib /nologo /machine:I386 /libpath:"release" /libpath:"deps\lib" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 iconv.lib glib-2.0.lib gmodule-2.0.lib wsock32.lib kernel32.lib user32.lib advapi32.lib /nologo /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "bitlbee - Win32 Release" -# Name "bitlbee - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\account.c -# End Source File -# Begin Source File - -SOURCE=..\bitlbee.c -# End Source File -# Begin Source File - -SOURCE=..\commands.c -# End Source File -# Begin Source File - -SOURCE=..\crypting.c -# End Source File -# Begin Source File - -SOURCE=..\debug.c -# End Source File -# Begin Source File - -SOURCE=..\help.c -# End Source File -# Begin Source File - -SOURCE=..\irc.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\md5.c -# End Source File -# Begin Source File - -SOURCE=..\nick.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\nogaim.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\proxy.c -# End Source File -# Begin Source File - -SOURCE=..\query.c -# End Source File -# Begin Source File - -SOURCE=..\set.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\sha.c -# End Source File -# Begin Source File - -SOURCE=..\user.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\util.c - -!IF "$(CFG)" == "bitlbee - Win32 Release" - -!ELSEIF "$(CFG)" == "bitlbee - Win32 Debug" - -# PROP Intermediate_Dir "Debugx" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\win32.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\account.h -# End Source File -# Begin Source File - -SOURCE=..\bitlbee.h -# End Source File -# Begin Source File - -SOURCE=..\commands.h -# End Source File -# Begin Source File - -SOURCE=..\conf.h -# End Source File -# Begin Source File - -SOURCE=.\config.h -# End Source File -# Begin Source File - -SOURCE=..\crypting.h -# End Source File -# Begin Source File - -SOURCE=..\help.h -# End Source File -# Begin Source File - -SOURCE=..\ini.h -# End Source File -# Begin Source File - -SOURCE=..\irc.h -# End Source File -# Begin Source File - -SOURCE=..\log.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\md5.h -# End Source File -# Begin Source File - -SOURCE=..\nick.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\nogaim.h -# End Source File -# Begin Source File - -SOURCE=..\set.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\sha.h -# End Source File -# Begin Source File - -SOURCE=..\sock.h -# End Source File -# Begin Source File - -SOURCE=..\user.h -# End Source File -# End Group -# End Target -# End Project diff --git a/win32/bitlbee.dsw b/win32/bitlbee.dsw deleted file mode 100644 index 7f446962..00000000 --- a/win32/bitlbee.dsw +++ /dev/null @@ -1,119 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "admin"=.\admin1\admin.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "bitlbee"=.\bitlbee.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "bitlbee_ssl"=.\bitlbee_ssl.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "jabber"=.\jabber.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name bitlbee - End Project Dependency - Begin Project Dependency - Project_Dep_Name bitlbee_ssl - End Project Dependency -}}} - -############################################################################### - -Project: "msn"=.\msn.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name bitlbee - End Project Dependency - Begin Project Dependency - Project_Dep_Name bitlbee_ssl - End Project Dependency -}}} - -############################################################################### - -Project: "oscar"=.\oscar.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name bitlbee - End Project Dependency -}}} - -############################################################################### - -Project: "yahoo"=.\yahoo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name bitlbee - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/win32/bitlbee_ssl.dsp b/win32/bitlbee_ssl.dsp deleted file mode 100644 index 5a4e764d..00000000 --- a/win32/bitlbee_ssl.dsp +++ /dev/null @@ -1,99 +0,0 @@ -# Microsoft Developer Studio Project File - Name="bitlbee_ssl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=bitlbee_ssl - Win32 Debug -!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 "bitlbee_ssl.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 "bitlbee_ssl.mak" CFG="bitlbee_ssl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "bitlbee_ssl - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "bitlbee_ssl - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "bitlbee_ssl - 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 Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnspr4.lib nss3.lib ssl3.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"release" /libpath:"deps\lib" - -!ELSEIF "$(CFG)" == "bitlbee_ssl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnspr4.lib nss3.lib ssl3.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" - -!ENDIF - -# Begin Target - -# Name "bitlbee_ssl - Win32 Release" -# Name "bitlbee_ssl - Win32 Debug" -# Begin Source File - -SOURCE=..\protocols\ssl_client.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\ssl_nss.c -# End Source File -# End Target -# End Project diff --git a/win32/jabber.dsp b/win32/jabber.dsp deleted file mode 100644 index ce5b08c7..00000000 --- a/win32/jabber.dsp +++ /dev/null @@ -1,228 +0,0 @@ -# Microsoft Developer Studio Project File - Name="jabber" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=jabber - Win32 Debug -!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 "jabber.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 "jabber.mak" CFG="jabber - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "jabber - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "jabber - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "jabber - 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 "jabrel" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\protocols\jabber" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib iconv.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/libjabber.dll" /libpath:"release" /libpath:"deps\lib" - -!ELSEIF "$(CFG)" == "jabber - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "jabber__" -# PROP BASE Intermediate_Dir "jabber__" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "jabdeb" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\protocols\jabber" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 odbc32.lib glib-2.0.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbccp32.lib ws2_32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libjabber.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" - -!ENDIF - -# Begin Target - -# Name "jabber - Win32 Release" -# Name "jabber - Win32 Debug" -# Begin Source File - -SOURCE=..\protocols\jabber\asciitab.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\expat.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\genhash.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\jabber.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\jabber.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\jconn.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\jid.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\jpacket.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\jutil.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\karma.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\libxode.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\log.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\log.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\nametab.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\pool.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\pproxy.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\rate.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\str.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xhash.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmldef.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmlnode.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmlparse.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmltok.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmltok.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xmltok_impl.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\jabber\xstream.c -# End Source File -# End Target -# End Project diff --git a/win32/msn.dsp b/win32/msn.dsp deleted file mode 100644 index 4c5fcfb3..00000000 --- a/win32/msn.dsp +++ /dev/null @@ -1,116 +0,0 @@ -# Microsoft Developer Studio Project File - Name="msn" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=msn - Win32 Debug -!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 "msn.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 "msn.mak" CFG="msn - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "msn - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "msn - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "msn - 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 "msnrel" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "e:\dev\include\nss" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib iconv.lib glib-2.0.lib nss3.lib libnspr4.lib ssl3.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/libmsn.dll" /libpath:"release" /libpath:"deps\lib" - -!ELSEIF "$(CFG)" == "msn - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "msn___Wi" -# PROP BASE Intermediate_Dir "msn___Wi" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "msndeb" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 odbc32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbccp32.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libmsn.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" - -!ENDIF - -# Begin Target - -# Name "msn - Win32 Release" -# Name "msn - Win32 Debug" -# Begin Source File - -SOURCE=..\protocols\msn\msn.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\msn\msn_util.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\msn\ns.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\msn\passport.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\msn\sb.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\msn\tables.c -# End Source File -# End Target -# End Project diff --git a/win32/oscar.dsp b/win32/oscar.dsp deleted file mode 100644 index aa2242ba..00000000 --- a/win32/oscar.dsp +++ /dev/null @@ -1,204 +0,0 @@ -# Microsoft Developer Studio Project File - Name="oscar" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=oscar - Win32 Debug -!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 "oscar.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 "oscar.mak" CFG="oscar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "oscar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "oscar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "oscar - 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 "oscarrel" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\protocols\oscar" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib iconv.lib ws2_32.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/liboscar.dll" /libpath:"release" /libpath:"deps\lib" - -!ELSEIF "$(CFG)" == "oscar - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "oscar___" -# PROP BASE Intermediate_Dir "oscar___" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "oscdeb" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\protocols\oscar" /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 gmodule-2.0.lib ws2_32.lib glib-2.0.lib iconv.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/liboscar.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" - -!ENDIF - -# Begin Target - -# Name "oscar - Win32 Release" -# Name "oscar - Win32 Debug" -# Begin Source File - -SOURCE=..\protocols\oscar\admin.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\aim.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\aim_cbtypes.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\aim_internal.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\auth.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\bos.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\buddylist.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\chat.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\chatnav.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\conn.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\faimconfig.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\ft.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\icq.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\im.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\info.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\misc.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\msgcookie.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\oscar.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\oscar_util.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\rxhandlers.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\rxqueue.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\search.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\service.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\snac.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\ssi.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\stats.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\tlv.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\oscar\txqueue.c -# End Source File -# End Target -# End Project diff --git a/win32/yahoo.dsp b/win32/yahoo.dsp deleted file mode 100644 index ebfc4eef..00000000 --- a/win32/yahoo.dsp +++ /dev/null @@ -1,152 +0,0 @@ -# Microsoft Developer Studio Project File - Name="yahoo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=yahoo - Win32 Debug -!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 "yahoo.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 "yahoo.mak" CFG="yahoo - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "yahoo - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "yahoo - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "yahoo - 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 "yahrel" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib iconv.lib glib-2.0.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/libyahoo.dll" /libpath:"release" /libpath:"deps\lib" - -!ELSEIF "$(CFG)" == "yahoo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "yahoo___" -# PROP BASE Intermediate_Dir "yahoo___" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "yahdeb" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\protocols" /I ".." /I "deps\include" /I "deps\include\glib-2.0" /I "deps\lib\glib-2.0\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ws2_32.lib glib-2.0.lib gmodule-2.0.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libyahoo.dll" /pdbtype:sept /libpath:"debug" /libpath:"deps\lib" - -!ENDIF - -# Begin Target - -# Name "yahoo - Win32 Release" -# Name "yahoo - Win32 Debug" -# Begin Source File - -SOURCE=..\protocols\yahoo\crypt.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\libyahoo2.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo2.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo2_callbacks.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo2_types.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_debug.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_fn.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_fn.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_httplib.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_httplib.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_list.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_list.h -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_util.c -# End Source File -# Begin Source File - -SOURCE=..\protocols\yahoo\yahoo_util.h -# End Source File -# End Target -# End Project -- cgit v1.2.3 From 4146a07de5f44f3ea00a3ef0026098b28e7451de Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Dec 2005 02:25:32 +0100 Subject: Fix win32 build using mingw32 on linux (no ssl and yahoo yet though) --- Makefile | 4 ++-- bitlbee.h | 7 ++----- doc/BUILD.win32 | 3 +++ sock.h | 5 ----- storage_text.c | 8 ++++++++ 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index ae86fcf1..762457bf 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,13 @@ -include Makefile.settings # Program variables -objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o log.o nick.o query.o set.o url.o user.o storage_text.o storage.o +objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o nick.o query.o set.o url.o user.o storage_text.o storage.o subdirs = protocols ifeq ($(ARCH),Windows) objects += win32.o else -objects += unix.o conf.o +objects += unix.o conf.o log.o endif # Expansion of variables diff --git a/bitlbee.h b/bitlbee.h index 41247270..fdde4b6f 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -47,9 +47,10 @@ #include #include #include +#include + #ifndef _WIN32 #include -#include #endif #include @@ -75,10 +76,6 @@ #undef strncasecmp #define strncasecmp __PLEASE_USE_G_STRNCASECMP_INSTEAD__ -#ifndef F_OK -#define F_OK 0 -#endif - #define _( x ) x #define ROOT_NICK "root" diff --git a/doc/BUILD.win32 b/doc/BUILD.win32 index e21e1aaf..e00cfdda 100644 --- a/doc/BUILD.win32 +++ b/doc/BUILD.win32 @@ -16,6 +16,9 @@ Instructions for building BitlBee on Windows - nss (in security/nss/) - nspr (in nspr/) + glib and gettext are only required for actually running BitlBee - building + should work fine without them. + 3. Set the following variables in Makefile.settings, if you don't have the libraries above installed in the default directories searched by MSVC: diff --git a/sock.h b/sock.h index 3e74bf96..3878cff1 100644 --- a/sock.h +++ b/sock.h @@ -9,17 +9,12 @@ #define closesocket(a) close(a) #else # include -# ifndef _MSC_VER -# include -# endif # if !defined(BITLBEE_CORE) && defined(_MSC_VER) # pragma comment(lib,"bitlbee.lib") # endif # include # define read(a,b,c) recv(a,b,c,0) # define write(a,b,c) send(a,b,c,0) -# define umask _umask -# define mode_t int # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } # define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK) # define ETIMEDOUT WSAETIMEDOUT diff --git a/storage_text.c b/storage_text.c index ed32b73f..d3823cac 100644 --- a/storage_text.c +++ b/storage_text.c @@ -26,6 +26,14 @@ #define BITLBEE_CORE #include "bitlbee.h" #include "crypting.h" +#ifdef _WIN32 +# define umask _umask +# define mode_t int +#endif + +#ifndef F_OK +#define F_OK 0 +#endif /* DO NOT USE THIS FUNCTION IN NEW CODE. This * function is here merely because the save/load code still uses -- cgit v1.2.3 From e3fb6789b0004c7162efde679632bf094b7b0eec Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 Dec 2005 17:10:24 +0100 Subject: Initial work on a SSPI SSL backend --- configure | 4 +- protocols/ssl_sspi.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 protocols/ssl_sspi.c diff --git a/configure b/configure index 37915a07..d8f3187b 100755 --- a/configure +++ b/configure @@ -58,7 +58,7 @@ Option Description Default --ipv6=0/1 IPv6 socket support $ipv6 ---ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) +--ssl=... SSL library to use (gnutls, nss, openssl, sspi, bogus, auto) $ssl EOF exit; @@ -216,6 +216,8 @@ if [ "$msn" = 1 -o "$jabber" = 1 ]; then detect_gnutls; elif [ "$ssl" = "nss" ]; then detect_nss; + elif [ "$ssl" = "sspi" ]; then + echo elif [ "$ssl" = "openssl" ]; then echo echo 'No detection code exists for OpenSSL. Make sure that you have a complete' diff --git a/protocols/ssl_sspi.c b/protocols/ssl_sspi.c new file mode 100644 index 00000000..2129f07b --- /dev/null +++ b/protocols/ssl_sspi.c @@ -0,0 +1,210 @@ + /********************************************************************\ + * BitlBee -- An IRC to other IM-networks gateway * + * * + * Copyright 2002-2004 Wilmer van der Gaast and others * + \********************************************************************/ + +/* SSL module - SSPI backend */ + +/* Copyright (C) 2005 Jelmer Vernooij */ + +/* + 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 with + the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; + if not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "ssl_client.h" +#include +#define SECURITY_WIN32 +#include +#include +#include + +static gboolean initialized = FALSE; +int ssl_errno; + +struct scd +{ + int fd; + SslInputFunction func; + gpointer data; + gboolean established; + int inpa; + CredHandle cred; /* SSL credentials */ + CtxtHandle context; /* SSL context */ + SecPkgContext_StreamSizes sizes; +}; + +static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ); + +void sspi_global_init( void ) +{ + /* FIXME */ +} + +void sspi_global_deinit( void ) +{ + /* FIXME */ +} + +void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) +{ + struct scd *conn = g_new0( struct scd, 1 ); + SCHANNEL_CRED ssl_cred; + TimeStamp timestamp; + + conn->fd = proxy_connect( host, port, ssl_connected, conn ); + conn->func = func; + conn->data = data; + conn->inpa = -1; + + if( conn->fd < 0 ) + { + g_free( conn ); + return( NULL ); + } + + if( !initialized ) + { + sspi_global_init(); + initialized = TRUE; + atexit( sspi_global_deinit ); + } + + conn->context = NULL; + + memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED)); + ssl_cred.dwVersion = SCHANNEL_CRED_VERSION; + ssl_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT; + + SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, ×tamp); + + InitializeSecurityContext(&conn->cred, &conn->context, host, FIXME, 1, FIXME); + + QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); + + + return( conn ); +} + +int ssl_read( void *conn, char *retdata, int len ) +{ + struct scd *scd = conn; + SecBufferDesc msg; + SecBuffer buf[4]; + int ret = -1, i; + char *data = g_malloc(scd->sizes.cbHeader + scd->sizes.cbMaximumMessage + scd->sizes.cbTrailer); + + /* FIXME: Try to read some data */ + + msg.ulVersion = SECBUFFER_VERSION; + msg.cBuffers = 4; + msg.pBuffers = buf; + + buf[0].BufferType = SECBUFFER_DATA; + buf[0].cbBuffer = len; + buf[0].pvBuffer = data; + + buf[1].BufferType = SECBUFFER_EMPTY; + buf[2].BufferType = SECBUFFER_EMPTY; + buf[3].BufferType = SECBUFFER_EMPTY; + + SECURITY_STATUS st = DecryptMessage(&scd->context, &msg, 0, NULL); + + for (i = 0; i < 4; i++) { + if (buf[i].BufferType == SECBUFFER_DATA) { + memcpy(retdata, buf[i].pvBuffer, len); + ret = len; + } + } + + g_free(data); + return( -1 ); +} + +int ssl_write( void *conn, const char *userdata, int len ) +{ + struct scd *scd = conn; + SecBuffer buf[4]; + SecBufferDesc msg; + char *data; + int ret; + + msg.ulVersion = SECBUFFER_VERSION; + msg.cBuffers = 4; + msg.pBuffers = buf; + + data = g_malloc(scd->sizes.cbHeader + scd->sizes.cbMaximumMessage + scd->sizes.cbTrailer); + memcpy(data + scd->sizes.cbHeader, userdata, len); + + buf[0].BufferType = SECBUFFER_STREAM_HEADER; + buf[0].cbBuffer = scd->sizes.cbHeader; + buf[0].pvBuffer = data; + + buf[1].BufferType = SECBUFFER_DATA; + buf[1].cbBuffer = len; + buf[1].pvBuffer = data + scd->sizes.cbHeader; + + buf[2].BufferType = SECBUFFER_STREAM_TRAILER; + buf[2].cbBuffer = scd->sizes.cbTrailer; + buf[2].pvBuffer = data + scd->sizes.cbHeader + len; + buf[3].BufferType = SECBUFFER_EMPTY; + + SECURITY_STATUS st = EncryptMessage(&scd->context, 0, &msg, 0); + + ret = send(scd->fd, data, + buf[0].cbBuffer + buf[1].cbBuffer + buf[2].cbBuffer, 0); + + g_free(data); + + return ret; +} + +void ssl_disconnect( void *conn ) +{ + struct scd *scd = conn; + + SecBufferDesc msg; + SecBuffer buf; + DWORD dw; + + dw = SCHANNEL_SHUTDOWN; + buf.cbBuffer = sizeof(dw); + buf.BufferType = SECBUFFER_TOKEN; + buf.pvBuffer = &dw; + + msg.ulVersion = SECBUFFER_VERSION; + msg.cBuffers = 1; + msg.pBuffers = &buf; + + SECURITY_STATUS st = ApplyControlToken(&scd->context, &msg); + + if (st != SEC_E_OK) { + /* FIXME */ + } + + /* FIXME: call InitializeSecurityContext(Schannel), passing + * in empty buffers*/ + + DeleteSecurityContext(&scd->context); + + closesocket( scd->fd ); + g_free(scd); +} + +int ssl_getfd( void *conn ) +{ + return( ((struct scd*)conn)->fd ); +} -- cgit v1.2.3 From 3e91c3ec7d6426c4c2819e78275f935e1a7fce2c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jan 2006 22:32:56 +0100 Subject: emove traditional setup file --- win32/bitlbee.iss | 73 ------------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 win32/bitlbee.iss diff --git a/win32/bitlbee.iss b/win32/bitlbee.iss deleted file mode 100644 index a9863f3b..00000000 --- a/win32/bitlbee.iss +++ /dev/null @@ -1,73 +0,0 @@ -; Inno setup script for Bitlbee -; (C) 2004-2005 Jelmer Vernooij - -[Setup] -AppName=BitlBee -AppPublisher=The BitlBee Team -AppPublisherURL=http://www.bitlbee.org/ -AppSupportURL=http://win32.bitlbee.org/ -AppUpdatesURL=http://win32.bitlbee.org/ -AppCopyright=Copyright © 2002-2005 The BitlBee Team -DefaultDirName={pf}\Bitlbee -DefaultGroupName=Bitlbee -LicenseFile=..\COPYING -InfoAfterFile=README.TXT -OutputDir=. -AppVerName=Bitlbee-20050516 -OutputBaseFileName="BitlBee-setup" - -[Components] -Name: main; Description: Main executable and files; Types: full compact custom; Flags: fixed; -Name: "yahoo"; Description: Yahoo! Messenger support; Types: full; -Name: "oscar"; Description: AIM/ICQ support; Types: full; -Name: ssl; Description: SSL Support; Types: full; -Name: "ssl\msn"; Description: MSN messenger support; Types: full; -Name: "ssl\jabber"; Description: Jabber support; Types: full; -Name: docs; Description: Documentation; Types: full; - -[Tasks] -Name: startupicon; Description: "&Automatically start when the computer boots"; GroupDescription: "Other tasks:"; Flags: unchecked - -[Files] -Source: "Release\bitlbee.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "Release\libmsn.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl\msn" -Source: "Deps\lib\ssl3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\lib\nss3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\lib\nssckbi.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\lib\smime3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\lib\softokn3.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\lib\libplc4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\lib\libnspr4.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Release\libjabber.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl\jabber" -Source: "Release\bitlbee_ssl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "ssl" -Source: "Deps\bin\libglib-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "Deps\bin\libgmodule-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "Release\liboscar.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "oscar" -Source: "Deps\bin\intl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "Deps\bin\iconv.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "Release\libyahoo.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: "yahoo" -Source: "..\motd.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "..\doc\help.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "..\COPYING"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "..\doc\TODO"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "..\doc\README"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "..\doc\FAQ"; DestDir: "{app}"; Flags: ignoreversion; Components: docs; -Source: "..\doc\CREDITS"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -; Source: "..\doc\user-guide.pdf"; DestDir: "{app}"; Flags: ignoreversion; Components: docs; -Source: "..\doc\CHANGES"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -Source: "..\doc\AUTHORS"; DestDir: "{app}"; Flags: ignoreversion; Components: main; -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -[Icons] -Name: "{group}\Bitlbee"; Filename: "{app}\bitlbee.exe" -Name: "{commonstartup}\Bitlbee"; Filename: "{app}\bitlbee.exe"; Tasks: startupicon - - -[Run] -; NOTE: The following entry contains an English phrase ("Launch"). You are free to translate it into another language if required. -Filename: "{app}\bitlbee.exe"; Description: "Launch Bitlbee"; Flags: nowait postinstall skipifsilent - -[Registry] -Root: HKLM; Subkey: "SOFTWARE\Bitlbee"; ValueType: string; ValueName: "helpfile"; ValueData: "{app}\help.txt" -Root: HKLM; Subkey: "SOFTWARE\Bitlbee"; ValueType: string; ValueName: "motdfile"; ValueData: "{app}\motd.txt" -Root: HKLM; Subkey: "SOFTWARE\Bitlbee"; ValueType: string; ValueName: "configdir"; ValueData: "{userappdata}\Bitlbee" -- cgit v1.2.3 From 46ad029950221205d1eb6201ec2f01c7231876c2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 2 Mar 2006 12:12:40 +0100 Subject: Fix password change --- win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win32.c b/win32.c index 63148271..cf36e772 100644 --- a/win32.c +++ b/win32.c @@ -202,7 +202,8 @@ conf_t *conf_load( int argc, char *argv[] ) conf_get_string(key_main, "interface", "0.0.0.0", &global.conf->iface); conf_get_int(key_main, "port", 6667, &global.conf->port); conf_get_int(key_main, "verbose", 0, &global.conf->verbose); - conf_get_string(key_main, "password", "", &global.conf->password); + conf_get_string(key_main, "auth_pass", "", &global.conf->auth_pass); + conf_get_string(key_main, "oper_pass", "", &global.conf->oper_pass); conf_get_int(key_main, "ping_interval_timeout", 60, &global.conf->ping_interval); conf_get_string(key_main, "hostname", "localhost", &global.conf->hostname); conf_get_string(key_main, "configdir", NULL, &global.conf->configdir); -- cgit v1.2.3 From 80c1e4d9e8c82a83499d6b66cdf3a95d15bf0fa1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 25 May 2006 01:31:20 +0200 Subject: #ifdef out some Win32-incompatible code blocks --- bitlbee.c | 6 +++++- ipc.c | 2 +- protocols/ssl_sspi.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bitlbee.c b/bitlbee.c index cca14916..30167fea 100644 --- a/bitlbee.c +++ b/bitlbee.c @@ -122,6 +122,7 @@ int bitlbee_daemon_init() global.conf->runmode == RUNMODE_FORKDAEMON ) ipc_master_listen_socket(); +#ifndef _WIN32 if( ( fp = fopen( global.conf->pidfile, "w" ) ) ) { fprintf( fp, "%d\n", (int) getpid() ); @@ -131,6 +132,7 @@ int bitlbee_daemon_init() { log_message( LOGLVL_WARNING, "Warning: Couldn't write PID to `%s'", global.conf->pidfile ); } +#endif return( 0 ); } @@ -252,7 +254,6 @@ gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpoi size_t size = sizeof( struct sockaddr_in ); struct sockaddr_in conn_info; int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, &size ); - pid_t client_pid = 0; if( new_socket == -1 ) { @@ -260,8 +261,10 @@ gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpoi return TRUE; } +#ifndef _WIN32 if( global.conf->runmode == RUNMODE_FORKDAEMON ) { + pid_t client_pid = 0; int fds[2]; if( socketpair( AF_UNIX, SOCK_STREAM, 0, fds ) == -1 ) @@ -312,6 +315,7 @@ gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpoi } } else +#endif { log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket ); irc_new( new_socket ); diff --git a/ipc.c b/ipc.c index 18d3284e..a9f3ea34 100644 --- a/ipc.c +++ b/ipc.c @@ -416,6 +416,7 @@ void ipc_master_free_all() child_list = NULL; } +#ifndef _WIN32 char *ipc_master_save_state() { char *fn = g_strdup( "/tmp/bee-restart.XXXXXX" ); @@ -483,7 +484,6 @@ static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer dat return TRUE; } -#ifndef _WIN32 int ipc_master_listen_socket() { struct sockaddr_un un_addr; diff --git a/protocols/ssl_sspi.c b/protocols/ssl_sspi.c index 2129f07b..0529b4ec 100644 --- a/protocols/ssl_sspi.c +++ b/protocols/ssl_sspi.c @@ -38,7 +38,7 @@ int ssl_errno; struct scd { int fd; - SslInputFunction func; + ssl_input_function func; gpointer data; gboolean established; int inpa; @@ -59,7 +59,7 @@ void sspi_global_deinit( void ) /* FIXME */ } -void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) +void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) { struct scd *conn = g_new0( struct scd, 1 ); SCHANNEL_CRED ssl_cred; -- cgit v1.2.3 From 51a4ffb83d6fbe23f1c2b8499cc78584e7213812 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 25 May 2006 11:55:00 +0200 Subject: Some more work on SSL on Windows --- protocols/ssl_sspi.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/protocols/ssl_sspi.c b/protocols/ssl_sspi.c index 0529b4ec..c6d7def9 100644 --- a/protocols/ssl_sspi.c +++ b/protocols/ssl_sspi.c @@ -64,6 +64,13 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data struct scd *conn = g_new0( struct scd, 1 ); SCHANNEL_CRED ssl_cred; TimeStamp timestamp; + SecBuffer ibuf[2],obuf[1]; + SecBufferDesc ibufs,obufs; + ULONG req = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | + ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY | + ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR | + ISC_REQ_MANUAL_CRED_VALIDATION; + ULONG a; conn->fd = proxy_connect( host, port, ssl_connected, conn ); conn->func = func; @@ -83,17 +90,42 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data atexit( sspi_global_deinit ); } - conn->context = NULL; - memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED)); ssl_cred.dwVersion = SCHANNEL_CRED_VERSION; ssl_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT; SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, ×tamp); + + if (st != SEC_E_OK) + return NULL; + + do { + /* initialize buffers */ + ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = buf; + ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NIL; + obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NIL; + ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN; + ibuf[1].BufferType = SECBUFFER_EMPTY; + + /* initialize buffer descriptors */ + ibufs.ulVersion = obufs.ulVersion = SECBUFFER_VERSION; + ibufs.cBuffers = 2; obufs.cBuffers = 1; + ibufs.pBuffers = ibuf; obufs.pBuffers = obuf; + + st = InitializeSecurityContext(&conn->cred, size?&conn->context:NULL, host, req, 0, SECURITY_NETWORK_DREP, size?&ibufs:NULL, 0, &conn->context, &obufs, &a, ×tamp); + if (obuf[0].pvBuffer && obuf[0].cbBuffer) { + send(conn->fd, obuf[0].pvBuffer, obuf[0].cbBuffer, 0); + } + + switch (st) { + case SEC_I_INCOMPLETE_CREDENTIALS: + break; + case SEC_I_CONTINUE_NEEDED: + + } - InitializeSecurityContext(&conn->cred, &conn->context, host, FIXME, 1, FIXME); - QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); + QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); return( conn ); @@ -200,6 +232,8 @@ void ssl_disconnect( void *conn ) DeleteSecurityContext(&scd->context); + FreeCredentialHandle(&scd->cred); + closesocket( scd->fd ); g_free(scd); } -- cgit v1.2.3 From 1705ec3724462b1ceac91aefb5bef24d7c8def54 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 25 May 2006 18:10:39 +0200 Subject: Add tool for cross compiling for Windows --- utils/cross-compile.win32 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 utils/cross-compile.win32 diff --git a/utils/cross-compile.win32 b/utils/cross-compile.win32 new file mode 100755 index 00000000..21f3551c --- /dev/null +++ b/utils/cross-compile.win32 @@ -0,0 +1,23 @@ +#!/bin/sh +# Simple cross compilation script for BitlBee using mingw32 +# (C) Jelmer Vernooij 2005-2006 + +GTK_SITE=ftp://ftp.gtk.org/pub/gtk/v2.8/win32 + +GLIB_VERSION=2.10.1 +LIBICONV_VERSION=1.9.1 + +wget -c $GTK_SITE/glib-dev-$GLIB_VERSION.zip +wget -c $GTK_SITE/dependencies/libiconv-$LIBICONV_VERSION.bin.woe32.zip + +DEPSDIR=`pwd`/win32 +mkdir $DEPSDIR + +unzip -d $DEPSDIR -o libiconv-$LIBICONV_VERSION.bin.woe32.zip +unzip -d $DEPSDIR -o glib-dev-$GLIB_VERSION.zip + +LD=i586-mingw32msvc-ld CC=i586-mingw32msvc-gcc STRIP=i586-mingw32msvc-strip PKG_CONFIG_PATH="$DEPSDIR" PKG_CONFIG="pkg-config --define-variable=prefix=\"$DEPSDIR\"" ./configure --ssl=sspi --ipv6=0 --yahoo=0 +echo OUTFILE=bitlbee.exe >> Makefile.settings +echo ARCH=Windows >> Makefile.settings +echo LFLAGS+=-lwsock32 >> Makefile.settings +$MAKE -- cgit v1.2.3 From eecccf1230639dc883c5687b442a89df89040ae2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 May 2006 01:08:15 +0200 Subject: Add replacement functions for log_link(), inet_pton() and inet_ntop() --- win32.c | 575 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 471 insertions(+), 104 deletions(-) diff --git a/win32.c b/win32.c index cf36e772..511deb23 100644 --- a/win32.c +++ b/win32.c @@ -22,7 +22,7 @@ if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #define BITLBEE_CORE #include "bitlbee.h" #include "commands.h" @@ -50,48 +50,48 @@ static void WINAPI service_ctrl (DWORD dwControl) } } - -static void bitlbee_init(int argc, char **argv) -{ - int i = -1; - memset( &global, 0, sizeof( global_t ) ); - - global.loop = g_main_new( FALSE ); - - global.conf = conf_load( argc, argv ); - if( global.conf == NULL ) - return; - - if( global.conf->runmode == RUNMODE_INETD ) - { - i = bitlbee_inetd_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); - - } - else if( global.conf->runmode == RUNMODE_DAEMON ) - { - i = bitlbee_daemon_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); - } - else - { - log_message( LOGLVL_INFO, "No bitlbee mode specified..."); - } - - if( i != 0 ) - return; - - if( access( global.conf->configdir, F_OK ) != 0 ) - log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); - else if( access( global.conf->configdir, 06 ) != 0 ) - log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); - if( help_init( &(global.help) ) == NULL ) - log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); -} + +static void bitlbee_init(int argc, char **argv) +{ + int i = -1; + memset( &global, 0, sizeof( global_t ) ); + + global.loop = g_main_new( FALSE ); + + global.conf = conf_load( argc, argv ); + if( global.conf == NULL ) + return; + + if( global.conf->runmode == RUNMODE_INETD ) + { + i = bitlbee_inetd_init(); + log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); + + } + else if( global.conf->runmode == RUNMODE_DAEMON ) + { + i = bitlbee_daemon_init(); + log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); + } + else + { + log_message( LOGLVL_INFO, "No bitlbee mode specified..."); + } + + if( i != 0 ) + return; + + if( access( global.conf->configdir, F_OK ) != 0 ) + log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); + else if( access( global.conf->configdir, 06 ) != 0 ) + log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); + if( help_init( &(global.help) ) == NULL ) + log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); +} void service_main (DWORD argc, LPTSTR *argv) { - SERVICE_STATUS_HANDLE handle; + SERVICE_STATUS_HANDLE handle; SERVICE_STATUS status; handle = RegisterServiceCtrlHandler("bitlbee", service_ctrl); @@ -101,55 +101,55 @@ void service_main (DWORD argc, LPTSTR *argv) status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; status.dwServiceSpecificExitCode = 0; - + bitlbee_init(argc, argv); SetServiceStatus(handle, &status); g_main_run( global.loop ); } - -SERVICE_TABLE_ENTRY dispatch_table[] = -{ - { TEXT("bitlbee"), (LPSERVICE_MAIN_FUNCTION)service_main }, - { NULL, NULL } -}; - -static int debug = 0; - -static void usage() -{ - printf("Options:\n"); - printf("-h Show this help message\n"); - printf("-d Debug mode (simple console program)\n"); -} - + +SERVICE_TABLE_ENTRY dispatch_table[] = +{ + { TEXT("bitlbee"), (LPSERVICE_MAIN_FUNCTION)service_main }, + { NULL, NULL } +}; + +static int debug = 0; + +static void usage() +{ + printf("Options:\n"); + printf("-h Show this help message\n"); + printf("-d Debug mode (simple console program)\n"); +} + int main( int argc, char **argv) -{ - int i; - WSADATA WSAData; - - nogaim_init( ); - - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-d")) debug = 1; - if (!strcmp(argv[i], "-h")) { - usage(); - return 0; - } - } - - WSAStartup(MAKEWORD(1,1), &WSAData); - +{ + int i; + WSADATA WSAData; + + nogaim_init( ); + + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-d")) debug = 1; + if (!strcmp(argv[i], "-h")) { + usage(); + return 0; + } + } + + WSAStartup(MAKEWORD(1,1), &WSAData); + if (!debug) { if (!StartServiceCtrlDispatcher(dispatch_table)) - log_message( LOGLVL_ERROR, "StartServiceCtrlDispatcher failed."); - } else { - bitlbee_init(argc, argv); - g_main_run( global.loop ); + log_message( LOGLVL_ERROR, "StartServiceCtrlDispatcher failed."); + } else { + bitlbee_init(argc, argv); + g_main_run( global.loop ); } - - return 0; + + return 0; } double gettime() @@ -261,42 +261,42 @@ inet_aton(const char *cp, struct in_addr *addr) addr->s_addr = inet_addr(cp); return (addr->s_addr == INADDR_NONE) ? 0 : 1; } - -void log_error(char *msg) -{ - log_message(LOGLVL_ERROR, "%s", msg); -} + +void log_error(char *msg) +{ + log_message(LOGLVL_ERROR, "%s", msg); +} void log_message(int level, char *message, ...) { HANDLE hEventSource; - LPTSTR lpszStrings[2]; + LPTSTR lpszStrings[2]; WORD elevel; va_list ap; - va_start(ap, message); - - if (debug) { - vprintf(message, ap); - putchar('\n'); - va_end(ap); - return; + va_start(ap, message); + + if (debug) { + vprintf(message, ap); + putchar('\n'); + va_end(ap); + return; } hEventSource = RegisterEventSource(NULL, TEXT("bitlbee")); lpszStrings[0] = TEXT("bitlbee"); lpszStrings[1] = g_strdup_vprintf(message, ap); - va_end(ap); - - switch (level) { - case LOGLVL_ERROR: elevel = EVENTLOG_ERROR_TYPE; break; - case LOGLVL_WARNING: elevel = EVENTLOG_WARNING_TYPE; break; - case LOGLVL_INFO: elevel = EVENTLOG_INFORMATION_TYPE; break; -#ifdef DEBUG - case LOGLVL_DEBUG: elevel = EVENTLOG_AUDIT_SUCCESS; break; -#endif - } + va_end(ap); + + switch (level) { + case LOGLVL_ERROR: elevel = EVENTLOG_ERROR_TYPE; break; + case LOGLVL_WARNING: elevel = EVENTLOG_WARNING_TYPE; break; + case LOGLVL_INFO: elevel = EVENTLOG_INFORMATION_TYPE; break; +#ifdef DEBUG + case LOGLVL_DEBUG: elevel = EVENTLOG_AUDIT_SUCCESS; break; +#endif + } if (hEventSource != NULL) { ReportEvent(hEventSource, @@ -310,7 +310,374 @@ void log_message(int level, char *message, ...) NULL); DeregisterEventSource(hEventSource); - } - + } + g_free(lpszStrings[1]); } + +void log_link(int level, int output) { /* FIXME */ } + +#ifndef NS_INADDRSZ +#define NS_INADDRSZ 4 +#endif +#ifndef NS_IN6ADDRSZ +#define NS_IN6ADDRSZ 16 +#endif +#ifndef NS_INT16SZ +#define NS_INT16SZ 2 +#endif + +static const char *inet_ntop4(const guchar *src, char *dst, size_t size); +static const char *inet_ntop6(const guchar *src, char *dst, size_t size); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +const char * +inet_ntop(af, src, dst, size) + int af; + const void *src; + char *dst; + size_t size; +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + errno = WSAEAFNOSUPPORT; + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + int nprinted; + + nprinted = g_snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); + if (nprinted < 0) + return (NULL); /* we assume "errno" was set by "g_snprintf()" */ + if ((size_t)nprinted > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + struct { int base, len; } best, cur; + guint words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + cur.base = -1; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += g_snprintf(tp, sizeof tmp - (tp - tmp), "%x", words[i]); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +#ifdef AF_INET +static int inet_pton4(const char *src, u_char *dst); +#endif +#ifdef AF_INET6 +static int inet_pton6(const char *src, u_char *dst); +#endif + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton(af, src, dst) + int af; + const char *src; + void *dst; +{ + switch (af) { +#ifdef AF_INET + case AF_INET: + return (inet_pton4(src, dst)); +#endif +#ifdef AF_INET6 + case AF_INET6: + return (inet_pton6(src, dst)); +#endif + default: + errno = WSAEAFNOSUPPORT; + return (-1); + } + /* NOTREACHED */ +} + +#ifdef AF_INET +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(src, dst) + const char *src; + u_char *dst; +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + u_char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (new > 255) + return (0); + *tp = new; + if (! saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} +#endif + +#ifdef AF_INET6 +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(src, dst) + const char *src; + u_char *dst; +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + u_int val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) + return (0); + saw_xdigit = 1; + continue; + } + if (ch == ':') { + curtok = src; + if (!saw_xdigit) { + if (colonp) + return (0); + colonp = tp; + continue; + } else if (*src == '\0') { + return (0); + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (saw_xdigit) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return (0); + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} +#endif -- cgit v1.2.3 From 1cda4f348372a755d99b291e6f4f9973a949f441 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 May 2006 17:02:09 +0200 Subject: Fix some unresolved symbols. --- ipc.c | 4 +++ irc_commands.c | 2 ++ protocols/oscar/AUTHORS | 2 -- protocols/ssl_sspi.c | 81 ++++++++++++++++++++++++++++++++----------------- 4 files changed, 59 insertions(+), 30 deletions(-) diff --git a/ipc.c b/ipc.c index a9f3ea34..c926197f 100644 --- a/ipc.c +++ b/ipc.c @@ -527,7 +527,11 @@ int ipc_master_listen_socket() return 1; } #else +int ipc_master_listen_socket() +{ /* FIXME: Open named pipe \\.\BITLBEE */ + return 0; +} #endif int ipc_master_load_state() diff --git a/irc_commands.c b/irc_commands.c index fe67a534..b33601be 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -543,7 +543,9 @@ static void irc_cmd_rehash( irc_t *irc, char **cmd ) else ipc_to_master( cmd ); +#ifndef _WIN32 irc_reply( irc, 382, "%s :Rehashing", CONF_FILE ); +#endif } static const command_t irc_commands[] = { diff --git a/protocols/oscar/AUTHORS b/protocols/oscar/AUTHORS index 5ca13988..51e8768d 100644 --- a/protocols/oscar/AUTHORS +++ b/protocols/oscar/AUTHORS @@ -27,5 +27,3 @@ N: Brock Wilcox H: awwaiid E: awwaiid@auk.cx D: Figured out original password roasting - - diff --git a/protocols/ssl_sspi.c b/protocols/ssl_sspi.c index 110f0af2..a16423b1 100644 --- a/protocols/ssl_sspi.c +++ b/protocols/ssl_sspi.c @@ -31,6 +31,7 @@ #include #include #include +#include "sock.h" static gboolean initialized = FALSE; int ssl_errno; @@ -41,52 +42,59 @@ struct scd ssl_input_function func; gpointer data; gboolean established; - int inpa; CredHandle cred; /* SSL credentials */ CtxtHandle context; /* SSL context */ SecPkgContext_StreamSizes sizes; + + char *host; + + char *pending_raw_data; + gsize pending_raw_data_len; + char *pending_data; + gsize pending_data_len; }; static void ssl_connected(gpointer, gint, GaimInputCondition); -void sspi_global_init( void ) +void sspi_global_init(void) { /* FIXME */ } -void sspi_global_deinit( void ) +void sspi_global_deinit(void) { /* FIXME */ } -void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) +void *ssl_connect(char *host, int port, ssl_input_function func, gpointer data) { - struct scd *conn = g_new0( struct scd, 1 ); + struct scd *conn = g_new0(struct scd, 1); - conn->fd = proxy_connect( host, port, ssl_connected, conn ); + conn->fd = proxy_connect(host, port, ssl_connected, conn); + sock_make_nonblocking(conn->fd); conn->func = func; conn->data = data; - conn->inpa = -1; + conn->host = g_strdup(host); - if( conn->fd < 0 ) + if (conn->fd < 0) { - g_free( conn ); - return( NULL ); + g_free(conn); + return NULL; } - if( !initialized ) + if (!initialized) { sspi_global_init(); initialized = TRUE; - atexit( sspi_global_deinit ); + atexit(sspi_global_deinit); } return conn; } -static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond) +static void ssl_connected(gpointer _conn, gint fd, GaimInputCondition cond) { - struct scd *conn = data; + struct scd *conn = _conn; SCHANNEL_CRED ssl_cred; TimeStamp timestamp; SecBuffer ibuf[2],obuf[1]; @@ -96,6 +104,8 @@ static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond) ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR | ISC_REQ_MANUAL_CRED_VALIDATION; ULONG a; + gsize size = 0; + gchar *data = NULL; memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED)); ssl_cred.dwVersion = SCHANNEL_CRED_VERSION; @@ -104,13 +114,13 @@ static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond) SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, ×tamp); if (st != SEC_E_OK) { - conn->func( conn->data, NULL, cond ); + conn->func(conn->data, NULL, cond); return; - + } do { /* initialize buffers */ - ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = buf; + ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = data; ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NULL; obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NULL; ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN; @@ -121,8 +131,9 @@ static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond) ibufs.cBuffers = 2; obufs.cBuffers = 1; ibufs.pBuffers = ibuf; obufs.pBuffers = obuf; - st = InitializeSecurityContext(&conn->cred, size?&conn->context:NULL, host, req, 0, SECURITY_NETWORK_DREP, size?&ibufs:NULL, 0, &conn->context, &obufs, &a, ×tamp); + st = InitializeSecurityContext(&conn->cred, size?&conn->context:NULL, conn->host, req, 0, SECURITY_NETWORK_DREP, size?&ibufs:NULL, 0, &conn->context, &obufs, &a, ×tamp); if (obuf[0].pvBuffer && obuf[0].cbBuffer) { + /* FIXME: Check return value */ send(conn->fd, obuf[0].pvBuffer, obuf[0].cbBuffer, 0); } @@ -130,17 +141,20 @@ static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond) case SEC_I_INCOMPLETE_CREDENTIALS: break; case SEC_I_CONTINUE_NEEDED: - + break; + case SEC_E_INCOMPLETE_MESSAGE: + break; + case SEC_E_OK: + break; } - QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); } while (1); - conn->func( conn->data, conn, cond ); + conn->func(conn->data, conn, cond); } -int ssl_read( void *conn, char *retdata, int len ) +int ssl_read(void *conn, char *retdata, int len) { struct scd *scd = conn; SecBufferDesc msg; @@ -164,6 +178,11 @@ int ssl_read( void *conn, char *retdata, int len ) SECURITY_STATUS st = DecryptMessage(&scd->context, &msg, 0, NULL); + if (st != SEC_E_OK) { + /* FIXME */ + return -1; + } + for (i = 0; i < 4; i++) { if (buf[i].BufferType == SECBUFFER_DATA) { memcpy(retdata, buf[i].pvBuffer, len); @@ -172,10 +191,10 @@ int ssl_read( void *conn, char *retdata, int len ) } g_free(data); - return( -1 ); + return -1; } -int ssl_write( void *conn, const char *userdata, int len ) +int ssl_write(void *conn, const char *userdata, int len) { struct scd *scd = conn; SecBuffer buf[4]; @@ -213,7 +232,7 @@ int ssl_write( void *conn, const char *userdata, int len ) return ret; } -void ssl_disconnect( void *conn ) +void ssl_disconnect(void *conn) { struct scd *scd = conn; @@ -243,11 +262,17 @@ void ssl_disconnect( void *conn ) FreeCredentialsHandle(&scd->cred); - closesocket( scd->fd ); + closesocket(scd->fd); + g_free(scd->host); g_free(scd); } -int ssl_getfd( void *conn ) +int ssl_getfd(void *conn) +{ + return ((struct scd*)conn)->fd; +} + +GaimInputCondition ssl_getdirection( void *conn ) { - return( ((struct scd*)conn)->fd ); + return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */ } -- cgit v1.2.3 From 84eddeefb197efe9a44d5a866bca209156b52257 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 May 2006 17:45:58 +0200 Subject: Use right pkgconfig location, trim the amount of magic. --- utils/cross-compile.win32 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/cross-compile.win32 b/utils/cross-compile.win32 index 21f3551c..d4f581a0 100755 --- a/utils/cross-compile.win32 +++ b/utils/cross-compile.win32 @@ -6,18 +6,17 @@ GTK_SITE=ftp://ftp.gtk.org/pub/gtk/v2.8/win32 GLIB_VERSION=2.10.1 LIBICONV_VERSION=1.9.1 +GETTEXT_VERSION=0.14.5 wget -c $GTK_SITE/glib-dev-$GLIB_VERSION.zip wget -c $GTK_SITE/dependencies/libiconv-$LIBICONV_VERSION.bin.woe32.zip +wget -c $GTK_SITE/dependencies/gettext-dev-$GETTEXT_VERSION.zip DEPSDIR=`pwd`/win32 mkdir $DEPSDIR unzip -d $DEPSDIR -o libiconv-$LIBICONV_VERSION.bin.woe32.zip unzip -d $DEPSDIR -o glib-dev-$GLIB_VERSION.zip +unzip -d $DEPSDIR -o gettext-dev-$GETTEXT_VERSION.zip -LD=i586-mingw32msvc-ld CC=i586-mingw32msvc-gcc STRIP=i586-mingw32msvc-strip PKG_CONFIG_PATH="$DEPSDIR" PKG_CONFIG="pkg-config --define-variable=prefix=\"$DEPSDIR\"" ./configure --ssl=sspi --ipv6=0 --yahoo=0 -echo OUTFILE=bitlbee.exe >> Makefile.settings -echo ARCH=Windows >> Makefile.settings -echo LFLAGS+=-lwsock32 >> Makefile.settings -$MAKE +LD=i586-mingw32msvc-ld CC=i586-mingw32msvc-gcc STRIP=i586-mingw32msvc-strip PKG_CONFIG_PATH="$DEPSDIR/lib/pkgconfig" PKG_CONFIG="pkg-config --define-variable=prefix=\"$DEPSDIR\"" ./configure --ssl=sspi --arch=Windows -- cgit v1.2.3 From aec56b0acf7965e7ec484b76ec1902603b8b3ea5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 May 2006 17:46:23 +0200 Subject: Allow overriding --arch, support --arch=Windows --- configure | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configure b/configure index cda7d8a6..2a4e3ce3 100755 --- a/configure +++ b/configure @@ -65,6 +65,8 @@ Option Description Default --ssl=... SSL library to use (gnutls, nss, openssl, sspi, bogus, auto) $ssl +--arch=... Override target architecture $arch + EOF exit; fi @@ -406,6 +408,11 @@ IRIX ) CYGWIN* ) echo 'Cygwin is not officially supported.' ;; +Windows ) + echo OUTFILE=bitlbee.exe >> Makefile.settings + echo LFLAGS+=-lwsock32 >> Makefile.settings + echo EFLAGS+=-lsecur32 >> Makefile.settings +;; * ) echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' echo 'Please report any problems at http://bugs.bitlbee.org/.' -- cgit v1.2.3 From fcc2da97bcfa5e0d704179fae9c4ed59cbaf79c5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 May 2006 17:46:51 +0200 Subject: Remove unnecessary Windows-specific code. --- protocols/yahoo/libyahoo2.c | 2 -- protocols/yahoo/yahoo_httplib.c | 2 -- sock.h | 5 +++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index c691f18b..967ba681 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -68,8 +68,6 @@ char *strchr (), *strrchr (); #ifdef __MINGW32__ # include -# define write(a,b,c) send(a,b,c,0) -# define read(a,b,c) recv(a,b,c,0) #endif #include diff --git a/protocols/yahoo/yahoo_httplib.c b/protocols/yahoo/yahoo_httplib.c index dbbe2a84..1b084992 100644 --- a/protocols/yahoo/yahoo_httplib.c +++ b/protocols/yahoo/yahoo_httplib.c @@ -50,8 +50,6 @@ char *strchr (), *strrchr (); #include "yahoo_debug.h" #ifdef __MINGW32__ # include -# define write(a,b,c) send(a,b,c,0) -# define read(a,b,c) recv(a,b,c,0) # define snprintf _snprintf #endif diff --git a/sock.h b/sock.h index a005bb5a..22b09306 100644 --- a/sock.h +++ b/sock.h @@ -20,12 +20,13 @@ #define closesocket(a) close(a) #else # include +# ifdef IPV6 +# include +# endif # if !defined(BITLBEE_CORE) && defined(_MSC_VER) # pragma comment(lib,"bitlbee.lib") # endif # include -# define read(a,b,c) recv(a,b,c,0) -# define write(a,b,c) send(a,b,c,0) # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } # define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK) -- cgit v1.2.3 From 875ad4201402b1a8f80ba22a6cdcdb152c6e5510 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 27 May 2006 17:02:22 +0200 Subject: Install glib, gettext and iconv in temporary directory --- utils/cross-compile.win32 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/cross-compile.win32 b/utils/cross-compile.win32 index d4f581a0..c90ebc1b 100755 --- a/utils/cross-compile.win32 +++ b/utils/cross-compile.win32 @@ -12,8 +12,7 @@ wget -c $GTK_SITE/glib-dev-$GLIB_VERSION.zip wget -c $GTK_SITE/dependencies/libiconv-$LIBICONV_VERSION.bin.woe32.zip wget -c $GTK_SITE/dependencies/gettext-dev-$GETTEXT_VERSION.zip -DEPSDIR=`pwd`/win32 -mkdir $DEPSDIR +DEPSDIR=`mktemp -d` unzip -d $DEPSDIR -o libiconv-$LIBICONV_VERSION.bin.woe32.zip unzip -d $DEPSDIR -o glib-dev-$GLIB_VERSION.zip -- cgit v1.2.3 From add23a26034a7368f4fdc0707488719048322e89 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 16 Feb 2008 22:07:14 +0000 Subject: Moved xmltree to lib/ because I want to use it from more than just the Jabber module. --- lib/Makefile | 2 +- lib/xmltree.c | 589 +++++++++++++++++++++++++++++++++++++++++++++ lib/xmltree.h | 97 ++++++++ protocols/jabber/Makefile | 2 +- protocols/jabber/xmltree.c | 589 --------------------------------------------- protocols/jabber/xmltree.h | 97 -------- 6 files changed, 688 insertions(+), 688 deletions(-) create mode 100644 lib/xmltree.c create mode 100644 lib/xmltree.h delete mode 100644 protocols/jabber/xmltree.c delete mode 100644 protocols/jabber/xmltree.h diff --git a/lib/Makefile b/lib/Makefile index 975deceb..03fef1ab 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -9,7 +9,7 @@ -include ../Makefile.settings # [SH] Program variables -objects = arc.o base64.o $(EVENT_HANDLER) http_client.o ini.o md5.o misc.o proxy.o sha1.o $(SSL_CLIENT) url.o +objects = arc.o base64.o $(EVENT_HANDLER) http_client.o ini.o md5.o misc.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o CFLAGS += -Wall LFLAGS += -r diff --git a/lib/xmltree.c b/lib/xmltree.c new file mode 100644 index 00000000..62549eb5 --- /dev/null +++ b/lib/xmltree.c @@ -0,0 +1,589 @@ +/***************************************************************************\ +* * +* BitlBee - An IRC to IM gateway * +* Simple XML (stream) parse tree handling code (Jabber/XMPP, mainly) * +* * +* Copyright 2006 Wilmer van der Gaast * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Lesser General Public * +* License as published by the Free Software Foundation, version * +* 2.1. * +* * +* This library 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 * +* Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * +* * +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "xmltree.h" + +static void xt_start_element( GMarkupParseContext *ctx, const gchar *element_name, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error ) +{ + struct xt_parser *xt = data; + struct xt_node *node = g_new0( struct xt_node, 1 ), *nt; + int i; + + node->parent = xt->cur; + node->name = g_strdup( element_name ); + + /* First count the number of attributes */ + for( i = 0; attr_names[i]; i ++ ); + + /* Then allocate a NULL-terminated array. */ + node->attr = g_new0( struct xt_attr, i + 1 ); + + /* And fill it, saving one variable by starting at the end. */ + for( i --; i >= 0; i -- ) + { + node->attr[i].key = g_strdup( attr_names[i] ); + node->attr[i].value = g_strdup( attr_values[i] ); + } + + /* Add it to the linked list of children nodes, if we have a current + node yet. */ + if( xt->cur ) + { + if( xt->cur->children ) + { + for( nt = xt->cur->children; nt->next; nt = nt->next ); + nt->next = node; + } + else + { + xt->cur->children = node; + } + } + else if( xt->root ) + { + /* ERROR situation: A second root-element??? */ + } + + /* Now this node will be the new current node. */ + xt->cur = node; + /* And maybe this is the root? */ + if( xt->root == NULL ) + xt->root = node; +} + +static void xt_text( GMarkupParseContext *ctx, const gchar *text, gsize text_len, gpointer data, GError **error ) +{ + struct xt_parser *xt = data; + struct xt_node *node = xt->cur; + + if( node == NULL ) + return; + + /* FIXME: Does g_renew also OFFICIALLY accept NULL arguments? */ + node->text = g_renew( char, node->text, node->text_len + text_len + 1 ); + memcpy( node->text + node->text_len, text, text_len ); + node->text_len += text_len; + /* Zero termination is always nice to have. */ + node->text[node->text_len] = 0; +} + +static void xt_end_element( GMarkupParseContext *ctx, const gchar *element_name, gpointer data, GError **error ) +{ + struct xt_parser *xt = data; + + xt->cur->flags |= XT_COMPLETE; + xt->cur = xt->cur->parent; +} + +GMarkupParser xt_parser_funcs = +{ + xt_start_element, + xt_end_element, + xt_text, + NULL, + NULL +}; + +struct xt_parser *xt_new( gpointer data ) +{ + struct xt_parser *xt = g_new0( struct xt_parser, 1 ); + + xt->data = data; + xt_reset( xt ); + + return xt; +} + +/* Reset the parser, flush everything we have so far. For example, we need + this for XMPP when doing TLS/SASL to restart the stream. */ +void xt_reset( struct xt_parser *xt ) +{ + if( xt->parser ) + g_markup_parse_context_free( xt->parser ); + + xt->parser = g_markup_parse_context_new( &xt_parser_funcs, 0, xt, NULL ); + + if( xt->root ) + { + xt_free_node( xt->root ); + xt->root = NULL; + xt->cur = NULL; + } +} + +/* Feed the parser, don't execute any handler. Returns -1 on errors, 0 on + end-of-stream and 1 otherwise. */ +int xt_feed( struct xt_parser *xt, char *text, int text_len ) +{ + if( !g_markup_parse_context_parse( xt->parser, text, text_len, &xt->gerr ) ) + { + return -1; + } + + return !( xt->root && xt->root->flags & XT_COMPLETE ); +} + +/* Find completed nodes and see if a handler has to be called. Passing + a node isn't necessary if you want to start at the root, just pass + NULL. This second argument is needed for recursive calls. */ +int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ) +{ + struct xt_node *c; + xt_status st; + int i; + + /* Just in case someone likes infinite loops... */ + if( xt->root == NULL ) + return 0; + + if( node == NULL ) + return xt_handle( xt, xt->root, depth ); + + if( depth != 0 ) + for( c = node->children; c; c = c->next ) + if( !xt_handle( xt, c, depth > 0 ? depth - 1 : depth ) ) + return 0; + + if( node->flags & XT_COMPLETE && !( node->flags & XT_SEEN ) ) + { + for( i = 0; xt->handlers[i].func; i ++ ) + { + /* This one is fun! \o/ */ + + /* If handler.name == NULL it means it should always match. */ + if( ( xt->handlers[i].name == NULL || + /* If it's not, compare. There should always be a name. */ + g_strcasecmp( xt->handlers[i].name, node->name ) == 0 ) && + /* If handler.parent == NULL, it's a match. */ + ( xt->handlers[i].parent == NULL || + /* If there's a parent node, see if the name matches. */ + ( node->parent ? g_strcasecmp( xt->handlers[i].parent, node->parent->name ) == 0 : + /* If there's no parent, the handler should mention as a parent. */ + g_strcasecmp( xt->handlers[i].parent, "" ) == 0 ) ) ) + { + st = xt->handlers[i].func( node, xt->data ); + + if( st == XT_ABORT ) + return 0; + else if( st != XT_NEXT ) + break; + } + } + + node->flags |= XT_SEEN; + } + + return 1; +} + +/* Garbage collection: Cleans up all nodes that are handled. Useful for + streams because there's no reason to keep a complete packet history + in memory. */ +void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) +{ + struct xt_node *c, *prev; + + if( !xt || !xt->root ) + return; + + if( node == NULL ) + return xt_cleanup( xt, xt->root, depth ); + + if( node->flags & XT_SEEN && node == xt->root ) + { + xt_free_node( xt->root ); + xt->root = xt->cur = NULL; + /* xt->cur should be NULL already, BTW... */ + + return; + } + + /* c contains the current node, prev the previous node (or NULL). + I admit, this one's pretty horrible. */ + for( c = node->children, prev = NULL; c; prev = c, c = c ? c->next : node->children ) + { + if( c->flags & XT_SEEN ) + { + /* Remove the node from the linked list. */ + if( prev ) + prev->next = c->next; + else + node->children = c->next; + + xt_free_node( c ); + + /* Since the for loop wants to get c->next, make sure + c points at something that exists (and that c->next + will actually be the next item we should check). c + can be NULL now, if we just removed the first item. + That explains the ? thing in for(). */ + c = prev; + } + else + { + /* This node can't be cleaned up yet, but maybe a + subnode can. */ + if( depth != 0 ) + xt_cleanup( xt, c, depth > 0 ? depth - 1 : depth ); + } + } +} + +static void xt_to_string_real( struct xt_node *node, GString *str ) +{ + char *buf; + struct xt_node *c; + int i; + + g_string_append_printf( str, "<%s", node->name ); + + for( i = 0; node->attr[i].key; i ++ ) + { + buf = g_markup_printf_escaped( " %s=\"%s\"", node->attr[i].key, node->attr[i].value ); + g_string_append( str, buf ); + g_free( buf ); + } + + if( node->text == NULL && node->children == NULL ) + { + g_string_append( str, "/>" ); + return; + } + + g_string_append( str, ">" ); + if( node->text_len > 0 ) + { + buf = g_markup_escape_text( node->text, node->text_len ); + g_string_append( str, buf ); + g_free( buf ); + } + + for( c = node->children; c; c = c->next ) + xt_to_string_real( c, str ); + + g_string_append_printf( str, "", node->name ); +} + +char *xt_to_string( struct xt_node *node ) +{ + GString *ret; + char *real; + + ret = g_string_new( "" ); + xt_to_string_real( node, ret ); + + real = ret->str; + g_string_free( ret, FALSE ); + + return real; +} + +#ifdef DEBUG +void xt_print( struct xt_node *node ) +{ + int i; + struct xt_node *c; + + /* Indentation */ + for( c = node; c->parent; c = c->parent ) + printf( "\t" ); + + /* Start the tag */ + printf( "<%s", node->name ); + + /* Print the attributes */ + for( i = 0; node->attr[i].key; i ++ ) + printf( " %s=\"%s\"", node->attr[i].key, g_markup_escape_text( node->attr[i].value, -1 ) ); + + /* /> in case there's really *nothing* inside this tag, otherwise + just >. */ + /* If this tag doesn't have any content at all... */ + if( node->text == NULL && node->children == NULL ) + { + printf( "/>\n" ); + return; + /* Then we're finished! */ + } + + /* Otherwise... */ + printf( ">" ); + + /* Only print the text if it contains more than whitespace (TEST). */ + if( node->text_len > 0 ) + { + for( i = 0; node->text[i] && isspace( node->text[i] ); i ++ ); + if( node->text[i] ) + printf( "%s", g_markup_escape_text( node->text, -1 ) ); + } + + if( node->children ) + printf( "\n" ); + + for( c = node->children; c; c = c->next ) + xt_print( c ); + + if( node->children ) + for( c = node; c->parent; c = c->parent ) + printf( "\t" ); + + /* Non-empty tag is now finished. */ + printf( "\n", node->name ); +} +#endif + +struct xt_node *xt_dup( struct xt_node *node ) +{ + struct xt_node *dup = g_new0( struct xt_node, 1 ); + struct xt_node *c, *dc = NULL; + int i; + + /* Let's NOT copy the parent element here BTW! Only do it for children. */ + + dup->name = g_strdup( node->name ); + dup->flags = node->flags; + if( node->text ) + { + dup->text = g_memdup( node->text, node->text_len + 1 ); + dup->text_len = node->text_len; + } + + /* Count the number of attributes and allocate the new array. */ + for( i = 0; node->attr[i].key; i ++ ); + dup->attr = g_new0( struct xt_attr, i + 1 ); + + /* Copy them all! */ + for( i --; i >= 0; i -- ) + { + dup->attr[i].key = g_strdup( node->attr[i].key ); + dup->attr[i].value = g_strdup( node->attr[i].value ); + } + + /* This nice mysterious loop takes care of the children. */ + for( c = node->children; c; c = c->next ) + { + if( dc == NULL ) + dc = dup->children = xt_dup( c ); + else + dc = ( dc->next = xt_dup( c ) ); + + dc->parent = dup; + } + + return dup; +} + +/* Frees a node. This doesn't clean up references to itself from parents! */ +void xt_free_node( struct xt_node *node ) +{ + int i; + + if( !node ) + return; + + g_free( node->name ); + g_free( node->text ); + + for( i = 0; node->attr[i].key; i ++ ) + { + g_free( node->attr[i].key ); + g_free( node->attr[i].value ); + } + g_free( node->attr ); + + while( node->children ) + { + struct xt_node *next = node->children->next; + + xt_free_node( node->children ); + node->children = next; + } + + g_free( node ); +} + +void xt_free( struct xt_parser *xt ) +{ + if( !xt ) + return; + + if( xt->root ) + xt_free_node( xt->root ); + + g_markup_parse_context_free( xt->parser ); + + g_free( xt ); +} + +/* To find a node's child with a specific name, pass the node's children + list, not the node itself! The reason you have to do this by hand: So + that you can also use this function as a find-next. */ +struct xt_node *xt_find_node( struct xt_node *node, const char *name ) +{ + while( node ) + { + if( g_strcasecmp( node->name, name ) == 0 ) + break; + + node = node->next; + } + + return node; +} + +char *xt_find_attr( struct xt_node *node, const char *key ) +{ + int i; + + if( !node ) + return NULL; + + for( i = 0; node->attr[i].key; i ++ ) + if( g_strcasecmp( node->attr[i].key, key ) == 0 ) + break; + + return node->attr[i].value; +} + +struct xt_node *xt_new_node( char *name, char *text, struct xt_node *children ) +{ + struct xt_node *node, *c; + + node = g_new0( struct xt_node, 1 ); + node->name = g_strdup( name ); + node->children = children; + node->attr = g_new0( struct xt_attr, 1 ); + + if( text ) + { + node->text_len = strlen( text ); + node->text = g_memdup( text, node->text_len + 1 ); + } + + for( c = children; c; c = c->next ) + { + if( c->parent != NULL ) + { + /* ERROR CONDITION: They seem to have a parent already??? */ + } + + c->parent = node; + } + + return node; +} + +void xt_add_child( struct xt_node *parent, struct xt_node *child ) +{ + struct xt_node *node; + + /* This function can actually be used to add more than one child, so + do handle this properly. */ + for( node = child; node; node = node->next ) + { + if( node->parent != NULL ) + { + /* ERROR CONDITION: They seem to have a parent already??? */ + } + + node->parent = parent; + } + + if( parent->children == NULL ) + { + parent->children = child; + } + else + { + for( node = parent->children; node->next; node = node->next ); + node->next = child; + } +} + +void xt_add_attr( struct xt_node *node, const char *key, const char *value ) +{ + int i; + + /* Now actually it'd be nice if we can also change existing attributes + (which actually means this function doesn't have the right name). + So let's find out if we have this attribute already... */ + for( i = 0; node->attr[i].key; i ++ ) + if( strcmp( node->attr[i].key, key ) == 0 ) + break; + + if( node->attr[i].key == NULL ) + { + /* If not, allocate space for a new attribute. */ + node->attr = g_renew( struct xt_attr, node->attr, i + 2 ); + node->attr[i].key = g_strdup( key ); + node->attr[i+1].key = NULL; + } + else + { + /* Otherwise, free the old value before setting the new one. */ + g_free( node->attr[i].value ); + } + + node->attr[i].value = g_strdup( value ); +} + +int xt_remove_attr( struct xt_node *node, const char *key ) +{ + int i, last; + + for( i = 0; node->attr[i].key; i ++ ) + if( strcmp( node->attr[i].key, key ) == 0 ) + break; + + /* If we didn't find the attribute... */ + if( node->attr[i].key == NULL ) + return 0; + + g_free( node->attr[i].key ); + g_free( node->attr[i].value ); + + /* If it's the last, this is easy: */ + if( node->attr[i+1].key == NULL ) + { + node->attr[i].key = node->attr[i].value = NULL; + } + else /* It's also pretty easy, actually. */ + { + /* Find the last item. */ + for( last = i + 1; node->attr[last+1].key; last ++ ); + + node->attr[i] = node->attr[last]; + node->attr[last].key = NULL; + node->attr[last].value = NULL; + } + + /* Let's not bother with reallocating memory here. It takes time and + most packets don't stay in memory for long anyway. */ + + return 1; +} diff --git a/lib/xmltree.h b/lib/xmltree.h new file mode 100644 index 00000000..b8b61641 --- /dev/null +++ b/lib/xmltree.h @@ -0,0 +1,97 @@ +/***************************************************************************\ +* * +* BitlBee - An IRC to IM gateway * +* Simple XML (stream) parse tree handling code (Jabber/XMPP, mainly) * +* * +* Copyright 2006 Wilmer van der Gaast * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Lesser General Public * +* License as published by the Free Software Foundation, version * +* 2.1. * +* * +* This library 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 * +* Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * +* * +****************************************************************************/ + +#ifndef _XMLTREE_H +#define _XMLTREE_H + +typedef enum +{ + XT_COMPLETE = 1, /* reached */ + XT_SEEN = 2, /* Handler called (or not defined) */ +} xt_flags; + +typedef enum +{ + XT_ABORT, /* Abort, don't handle the rest anymore */ + XT_HANDLED, /* Handled this tag properly, go to the next one */ + XT_NEXT /* Try if there's another matching handler */ +} xt_status; + +struct xt_attr +{ + char *key, *value; +}; + +struct xt_node +{ + struct xt_node *parent; + struct xt_node *children; + + char *name; + struct xt_attr *attr; + char *text; + int text_len; + + struct xt_node *next; + xt_flags flags; +}; + +typedef xt_status (*xt_handler_func) ( struct xt_node *node, gpointer data ); + +struct xt_handler_entry +{ + char *name, *parent; + xt_handler_func func; +}; + +struct xt_parser +{ + GMarkupParseContext *parser; + struct xt_node *root; + struct xt_node *cur; + + struct xt_handler_entry *handlers; + gpointer data; + + GError *gerr; +}; + +struct xt_parser *xt_new( gpointer data ); +void xt_reset( struct xt_parser *xt ); +int xt_feed( struct xt_parser *xt, char *text, int text_len ); +int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ); +void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ); +char *xt_to_string( struct xt_node *node ); +void xt_print( struct xt_node *node ); +struct xt_node *xt_dup( struct xt_node *node ); +void xt_free_node( struct xt_node *node ); +void xt_free( struct xt_parser *xt ); +struct xt_node *xt_find_node( struct xt_node *node, const char *name ); +char *xt_find_attr( struct xt_node *node, const char *key ); + +struct xt_node *xt_new_node( char *name, char *text, struct xt_node *children ); +void xt_add_child( struct xt_node *parent, struct xt_node *child ); +void xt_add_attr( struct xt_node *node, const char *key, const char *value ); +int xt_remove_attr( struct xt_node *node, const char *key ); + +#endif diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile index 3ce78127..e7a505ba 100644 --- a/protocols/jabber/Makefile +++ b/protocols/jabber/Makefile @@ -9,7 +9,7 @@ -include ../../Makefile.settings # [SH] Program variables -objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o +objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o CFLAGS += -Wall LFLAGS += -r diff --git a/protocols/jabber/xmltree.c b/protocols/jabber/xmltree.c deleted file mode 100644 index 62549eb5..00000000 --- a/protocols/jabber/xmltree.c +++ /dev/null @@ -1,589 +0,0 @@ -/***************************************************************************\ -* * -* BitlBee - An IRC to IM gateway * -* Simple XML (stream) parse tree handling code (Jabber/XMPP, mainly) * -* * -* Copyright 2006 Wilmer van der Gaast * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Lesser General Public * -* License as published by the Free Software Foundation, version * -* 2.1. * -* * -* This library 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 * -* Lesser General Public License for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * -* * -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "xmltree.h" - -static void xt_start_element( GMarkupParseContext *ctx, const gchar *element_name, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error ) -{ - struct xt_parser *xt = data; - struct xt_node *node = g_new0( struct xt_node, 1 ), *nt; - int i; - - node->parent = xt->cur; - node->name = g_strdup( element_name ); - - /* First count the number of attributes */ - for( i = 0; attr_names[i]; i ++ ); - - /* Then allocate a NULL-terminated array. */ - node->attr = g_new0( struct xt_attr, i + 1 ); - - /* And fill it, saving one variable by starting at the end. */ - for( i --; i >= 0; i -- ) - { - node->attr[i].key = g_strdup( attr_names[i] ); - node->attr[i].value = g_strdup( attr_values[i] ); - } - - /* Add it to the linked list of children nodes, if we have a current - node yet. */ - if( xt->cur ) - { - if( xt->cur->children ) - { - for( nt = xt->cur->children; nt->next; nt = nt->next ); - nt->next = node; - } - else - { - xt->cur->children = node; - } - } - else if( xt->root ) - { - /* ERROR situation: A second root-element??? */ - } - - /* Now this node will be the new current node. */ - xt->cur = node; - /* And maybe this is the root? */ - if( xt->root == NULL ) - xt->root = node; -} - -static void xt_text( GMarkupParseContext *ctx, const gchar *text, gsize text_len, gpointer data, GError **error ) -{ - struct xt_parser *xt = data; - struct xt_node *node = xt->cur; - - if( node == NULL ) - return; - - /* FIXME: Does g_renew also OFFICIALLY accept NULL arguments? */ - node->text = g_renew( char, node->text, node->text_len + text_len + 1 ); - memcpy( node->text + node->text_len, text, text_len ); - node->text_len += text_len; - /* Zero termination is always nice to have. */ - node->text[node->text_len] = 0; -} - -static void xt_end_element( GMarkupParseContext *ctx, const gchar *element_name, gpointer data, GError **error ) -{ - struct xt_parser *xt = data; - - xt->cur->flags |= XT_COMPLETE; - xt->cur = xt->cur->parent; -} - -GMarkupParser xt_parser_funcs = -{ - xt_start_element, - xt_end_element, - xt_text, - NULL, - NULL -}; - -struct xt_parser *xt_new( gpointer data ) -{ - struct xt_parser *xt = g_new0( struct xt_parser, 1 ); - - xt->data = data; - xt_reset( xt ); - - return xt; -} - -/* Reset the parser, flush everything we have so far. For example, we need - this for XMPP when doing TLS/SASL to restart the stream. */ -void xt_reset( struct xt_parser *xt ) -{ - if( xt->parser ) - g_markup_parse_context_free( xt->parser ); - - xt->parser = g_markup_parse_context_new( &xt_parser_funcs, 0, xt, NULL ); - - if( xt->root ) - { - xt_free_node( xt->root ); - xt->root = NULL; - xt->cur = NULL; - } -} - -/* Feed the parser, don't execute any handler. Returns -1 on errors, 0 on - end-of-stream and 1 otherwise. */ -int xt_feed( struct xt_parser *xt, char *text, int text_len ) -{ - if( !g_markup_parse_context_parse( xt->parser, text, text_len, &xt->gerr ) ) - { - return -1; - } - - return !( xt->root && xt->root->flags & XT_COMPLETE ); -} - -/* Find completed nodes and see if a handler has to be called. Passing - a node isn't necessary if you want to start at the root, just pass - NULL. This second argument is needed for recursive calls. */ -int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ) -{ - struct xt_node *c; - xt_status st; - int i; - - /* Just in case someone likes infinite loops... */ - if( xt->root == NULL ) - return 0; - - if( node == NULL ) - return xt_handle( xt, xt->root, depth ); - - if( depth != 0 ) - for( c = node->children; c; c = c->next ) - if( !xt_handle( xt, c, depth > 0 ? depth - 1 : depth ) ) - return 0; - - if( node->flags & XT_COMPLETE && !( node->flags & XT_SEEN ) ) - { - for( i = 0; xt->handlers[i].func; i ++ ) - { - /* This one is fun! \o/ */ - - /* If handler.name == NULL it means it should always match. */ - if( ( xt->handlers[i].name == NULL || - /* If it's not, compare. There should always be a name. */ - g_strcasecmp( xt->handlers[i].name, node->name ) == 0 ) && - /* If handler.parent == NULL, it's a match. */ - ( xt->handlers[i].parent == NULL || - /* If there's a parent node, see if the name matches. */ - ( node->parent ? g_strcasecmp( xt->handlers[i].parent, node->parent->name ) == 0 : - /* If there's no parent, the handler should mention as a parent. */ - g_strcasecmp( xt->handlers[i].parent, "" ) == 0 ) ) ) - { - st = xt->handlers[i].func( node, xt->data ); - - if( st == XT_ABORT ) - return 0; - else if( st != XT_NEXT ) - break; - } - } - - node->flags |= XT_SEEN; - } - - return 1; -} - -/* Garbage collection: Cleans up all nodes that are handled. Useful for - streams because there's no reason to keep a complete packet history - in memory. */ -void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) -{ - struct xt_node *c, *prev; - - if( !xt || !xt->root ) - return; - - if( node == NULL ) - return xt_cleanup( xt, xt->root, depth ); - - if( node->flags & XT_SEEN && node == xt->root ) - { - xt_free_node( xt->root ); - xt->root = xt->cur = NULL; - /* xt->cur should be NULL already, BTW... */ - - return; - } - - /* c contains the current node, prev the previous node (or NULL). - I admit, this one's pretty horrible. */ - for( c = node->children, prev = NULL; c; prev = c, c = c ? c->next : node->children ) - { - if( c->flags & XT_SEEN ) - { - /* Remove the node from the linked list. */ - if( prev ) - prev->next = c->next; - else - node->children = c->next; - - xt_free_node( c ); - - /* Since the for loop wants to get c->next, make sure - c points at something that exists (and that c->next - will actually be the next item we should check). c - can be NULL now, if we just removed the first item. - That explains the ? thing in for(). */ - c = prev; - } - else - { - /* This node can't be cleaned up yet, but maybe a - subnode can. */ - if( depth != 0 ) - xt_cleanup( xt, c, depth > 0 ? depth - 1 : depth ); - } - } -} - -static void xt_to_string_real( struct xt_node *node, GString *str ) -{ - char *buf; - struct xt_node *c; - int i; - - g_string_append_printf( str, "<%s", node->name ); - - for( i = 0; node->attr[i].key; i ++ ) - { - buf = g_markup_printf_escaped( " %s=\"%s\"", node->attr[i].key, node->attr[i].value ); - g_string_append( str, buf ); - g_free( buf ); - } - - if( node->text == NULL && node->children == NULL ) - { - g_string_append( str, "/>" ); - return; - } - - g_string_append( str, ">" ); - if( node->text_len > 0 ) - { - buf = g_markup_escape_text( node->text, node->text_len ); - g_string_append( str, buf ); - g_free( buf ); - } - - for( c = node->children; c; c = c->next ) - xt_to_string_real( c, str ); - - g_string_append_printf( str, "", node->name ); -} - -char *xt_to_string( struct xt_node *node ) -{ - GString *ret; - char *real; - - ret = g_string_new( "" ); - xt_to_string_real( node, ret ); - - real = ret->str; - g_string_free( ret, FALSE ); - - return real; -} - -#ifdef DEBUG -void xt_print( struct xt_node *node ) -{ - int i; - struct xt_node *c; - - /* Indentation */ - for( c = node; c->parent; c = c->parent ) - printf( "\t" ); - - /* Start the tag */ - printf( "<%s", node->name ); - - /* Print the attributes */ - for( i = 0; node->attr[i].key; i ++ ) - printf( " %s=\"%s\"", node->attr[i].key, g_markup_escape_text( node->attr[i].value, -1 ) ); - - /* /> in case there's really *nothing* inside this tag, otherwise - just >. */ - /* If this tag doesn't have any content at all... */ - if( node->text == NULL && node->children == NULL ) - { - printf( "/>\n" ); - return; - /* Then we're finished! */ - } - - /* Otherwise... */ - printf( ">" ); - - /* Only print the text if it contains more than whitespace (TEST). */ - if( node->text_len > 0 ) - { - for( i = 0; node->text[i] && isspace( node->text[i] ); i ++ ); - if( node->text[i] ) - printf( "%s", g_markup_escape_text( node->text, -1 ) ); - } - - if( node->children ) - printf( "\n" ); - - for( c = node->children; c; c = c->next ) - xt_print( c ); - - if( node->children ) - for( c = node; c->parent; c = c->parent ) - printf( "\t" ); - - /* Non-empty tag is now finished. */ - printf( "\n", node->name ); -} -#endif - -struct xt_node *xt_dup( struct xt_node *node ) -{ - struct xt_node *dup = g_new0( struct xt_node, 1 ); - struct xt_node *c, *dc = NULL; - int i; - - /* Let's NOT copy the parent element here BTW! Only do it for children. */ - - dup->name = g_strdup( node->name ); - dup->flags = node->flags; - if( node->text ) - { - dup->text = g_memdup( node->text, node->text_len + 1 ); - dup->text_len = node->text_len; - } - - /* Count the number of attributes and allocate the new array. */ - for( i = 0; node->attr[i].key; i ++ ); - dup->attr = g_new0( struct xt_attr, i + 1 ); - - /* Copy them all! */ - for( i --; i >= 0; i -- ) - { - dup->attr[i].key = g_strdup( node->attr[i].key ); - dup->attr[i].value = g_strdup( node->attr[i].value ); - } - - /* This nice mysterious loop takes care of the children. */ - for( c = node->children; c; c = c->next ) - { - if( dc == NULL ) - dc = dup->children = xt_dup( c ); - else - dc = ( dc->next = xt_dup( c ) ); - - dc->parent = dup; - } - - return dup; -} - -/* Frees a node. This doesn't clean up references to itself from parents! */ -void xt_free_node( struct xt_node *node ) -{ - int i; - - if( !node ) - return; - - g_free( node->name ); - g_free( node->text ); - - for( i = 0; node->attr[i].key; i ++ ) - { - g_free( node->attr[i].key ); - g_free( node->attr[i].value ); - } - g_free( node->attr ); - - while( node->children ) - { - struct xt_node *next = node->children->next; - - xt_free_node( node->children ); - node->children = next; - } - - g_free( node ); -} - -void xt_free( struct xt_parser *xt ) -{ - if( !xt ) - return; - - if( xt->root ) - xt_free_node( xt->root ); - - g_markup_parse_context_free( xt->parser ); - - g_free( xt ); -} - -/* To find a node's child with a specific name, pass the node's children - list, not the node itself! The reason you have to do this by hand: So - that you can also use this function as a find-next. */ -struct xt_node *xt_find_node( struct xt_node *node, const char *name ) -{ - while( node ) - { - if( g_strcasecmp( node->name, name ) == 0 ) - break; - - node = node->next; - } - - return node; -} - -char *xt_find_attr( struct xt_node *node, const char *key ) -{ - int i; - - if( !node ) - return NULL; - - for( i = 0; node->attr[i].key; i ++ ) - if( g_strcasecmp( node->attr[i].key, key ) == 0 ) - break; - - return node->attr[i].value; -} - -struct xt_node *xt_new_node( char *name, char *text, struct xt_node *children ) -{ - struct xt_node *node, *c; - - node = g_new0( struct xt_node, 1 ); - node->name = g_strdup( name ); - node->children = children; - node->attr = g_new0( struct xt_attr, 1 ); - - if( text ) - { - node->text_len = strlen( text ); - node->text = g_memdup( text, node->text_len + 1 ); - } - - for( c = children; c; c = c->next ) - { - if( c->parent != NULL ) - { - /* ERROR CONDITION: They seem to have a parent already??? */ - } - - c->parent = node; - } - - return node; -} - -void xt_add_child( struct xt_node *parent, struct xt_node *child ) -{ - struct xt_node *node; - - /* This function can actually be used to add more than one child, so - do handle this properly. */ - for( node = child; node; node = node->next ) - { - if( node->parent != NULL ) - { - /* ERROR CONDITION: They seem to have a parent already??? */ - } - - node->parent = parent; - } - - if( parent->children == NULL ) - { - parent->children = child; - } - else - { - for( node = parent->children; node->next; node = node->next ); - node->next = child; - } -} - -void xt_add_attr( struct xt_node *node, const char *key, const char *value ) -{ - int i; - - /* Now actually it'd be nice if we can also change existing attributes - (which actually means this function doesn't have the right name). - So let's find out if we have this attribute already... */ - for( i = 0; node->attr[i].key; i ++ ) - if( strcmp( node->attr[i].key, key ) == 0 ) - break; - - if( node->attr[i].key == NULL ) - { - /* If not, allocate space for a new attribute. */ - node->attr = g_renew( struct xt_attr, node->attr, i + 2 ); - node->attr[i].key = g_strdup( key ); - node->attr[i+1].key = NULL; - } - else - { - /* Otherwise, free the old value before setting the new one. */ - g_free( node->attr[i].value ); - } - - node->attr[i].value = g_strdup( value ); -} - -int xt_remove_attr( struct xt_node *node, const char *key ) -{ - int i, last; - - for( i = 0; node->attr[i].key; i ++ ) - if( strcmp( node->attr[i].key, key ) == 0 ) - break; - - /* If we didn't find the attribute... */ - if( node->attr[i].key == NULL ) - return 0; - - g_free( node->attr[i].key ); - g_free( node->attr[i].value ); - - /* If it's the last, this is easy: */ - if( node->attr[i+1].key == NULL ) - { - node->attr[i].key = node->attr[i].value = NULL; - } - else /* It's also pretty easy, actually. */ - { - /* Find the last item. */ - for( last = i + 1; node->attr[last+1].key; last ++ ); - - node->attr[i] = node->attr[last]; - node->attr[last].key = NULL; - node->attr[last].value = NULL; - } - - /* Let's not bother with reallocating memory here. It takes time and - most packets don't stay in memory for long anyway. */ - - return 1; -} diff --git a/protocols/jabber/xmltree.h b/protocols/jabber/xmltree.h deleted file mode 100644 index b8b61641..00000000 --- a/protocols/jabber/xmltree.h +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************\ -* * -* BitlBee - An IRC to IM gateway * -* Simple XML (stream) parse tree handling code (Jabber/XMPP, mainly) * -* * -* Copyright 2006 Wilmer van der Gaast * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Lesser General Public * -* License as published by the Free Software Foundation, version * -* 2.1. * -* * -* This library 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 * -* Lesser General Public License for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * -* * -****************************************************************************/ - -#ifndef _XMLTREE_H -#define _XMLTREE_H - -typedef enum -{ - XT_COMPLETE = 1, /* reached */ - XT_SEEN = 2, /* Handler called (or not defined) */ -} xt_flags; - -typedef enum -{ - XT_ABORT, /* Abort, don't handle the rest anymore */ - XT_HANDLED, /* Handled this tag properly, go to the next one */ - XT_NEXT /* Try if there's another matching handler */ -} xt_status; - -struct xt_attr -{ - char *key, *value; -}; - -struct xt_node -{ - struct xt_node *parent; - struct xt_node *children; - - char *name; - struct xt_attr *attr; - char *text; - int text_len; - - struct xt_node *next; - xt_flags flags; -}; - -typedef xt_status (*xt_handler_func) ( struct xt_node *node, gpointer data ); - -struct xt_handler_entry -{ - char *name, *parent; - xt_handler_func func; -}; - -struct xt_parser -{ - GMarkupParseContext *parser; - struct xt_node *root; - struct xt_node *cur; - - struct xt_handler_entry *handlers; - gpointer data; - - GError *gerr; -}; - -struct xt_parser *xt_new( gpointer data ); -void xt_reset( struct xt_parser *xt ); -int xt_feed( struct xt_parser *xt, char *text, int text_len ); -int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ); -void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ); -char *xt_to_string( struct xt_node *node ); -void xt_print( struct xt_node *node ); -struct xt_node *xt_dup( struct xt_node *node ); -void xt_free_node( struct xt_node *node ); -void xt_free( struct xt_parser *xt ); -struct xt_node *xt_find_node( struct xt_node *node, const char *name ); -char *xt_find_attr( struct xt_node *node, const char *key ); - -struct xt_node *xt_new_node( char *name, char *text, struct xt_node *children ); -void xt_add_child( struct xt_node *parent, struct xt_node *child ); -void xt_add_attr( struct xt_node *node, const char *key, const char *value ); -int xt_remove_attr( struct xt_node *node, const char *key ); - -#endif -- cgit v1.2.3 From 4bbcba32aca2948f66c484ab074264fdb67609ae Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 16 Feb 2008 22:40:38 +0000 Subject: Moved xmltree handlers initialization to xt_new(). --- lib/xmltree.c | 3 ++- lib/xmltree.h | 4 ++-- protocols/jabber/io.c | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/xmltree.c b/lib/xmltree.c index 62549eb5..e65b4f41 100644 --- a/lib/xmltree.c +++ b/lib/xmltree.c @@ -110,11 +110,12 @@ GMarkupParser xt_parser_funcs = NULL }; -struct xt_parser *xt_new( gpointer data ) +struct xt_parser *xt_new( const struct xt_handler_entry *handlers, gpointer data ) { struct xt_parser *xt = g_new0( struct xt_parser, 1 ); xt->data = data; + xt->handlers = handlers; xt_reset( xt ); return xt; diff --git a/lib/xmltree.h b/lib/xmltree.h index b8b61641..10677412 100644 --- a/lib/xmltree.h +++ b/lib/xmltree.h @@ -70,13 +70,13 @@ struct xt_parser struct xt_node *root; struct xt_node *cur; - struct xt_handler_entry *handlers; + const struct xt_handler_entry *handlers; gpointer data; GError *gerr; }; -struct xt_parser *xt_new( gpointer data ); +struct xt_parser *xt_new( const struct xt_handler_entry *handlers, gpointer data ); void xt_reset( struct xt_parser *xt ); int xt_feed( struct xt_parser *xt, char *text, int text_len ); int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ); diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index 86c216ef..9980dc8e 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -520,8 +520,7 @@ gboolean jabber_start_stream( struct im_connection *ic ) /* We'll start our stream now, so prepare everything to receive one from the server too. */ xt_free( jd->xt ); /* In case we're RE-starting. */ - jd->xt = xt_new( ic ); - jd->xt->handlers = (struct xt_handler_entry*) jabber_handlers; + jd->xt = xt_new( jabber_handlers, ic ); if( jd->r_inpa <= 0 ) jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic ); -- cgit v1.2.3 From e6648bf3b821ae40c0640857aae069bc0f5d90c4 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 17 Feb 2008 11:16:01 +0000 Subject: Replaced old MSN Passport (v1.4) authentication code with what's described on http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener . This was an attempt to fix bug #360, but it didn't. However, this change may make BitlBee a little bit more future-proof. Plus, the code is tidier and sometimes faster than the old mechanism. --- protocols/msn/ns.c | 30 +++--- protocols/msn/passport.c | 275 ++++++++++++++++++----------------------------- protocols/msn/passport.h | 91 +++++++++++++--- 3 files changed, 200 insertions(+), 196 deletions(-) diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 0bb84a74..ff7da6ed 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -33,7 +33,7 @@ static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition c static int msn_ns_command( gpointer data, char **cmd, int num_parts ); static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); -static void msn_auth_got_passport_id( struct passport_reply *rep ); +static void msn_auth_got_passport_token( struct msn_auth_data *mad ); gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) { @@ -213,7 +213,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts == 5 && strcmp( cmd[2], "TWN" ) == 0 && strcmp( cmd[3], "S" ) == 0 ) { /* Time for some Passport black magic... */ - if( !passport_get_id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) ) + if( !passport_get_token( msn_auth_got_passport_token, ic, ic->acc->user, ic->acc->pass, cmd[4] ) ) { imcb_error( ic, "Error while contacting Passport server" ); imc_logout( ic, TRUE ); @@ -673,22 +673,26 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int return( 1 ); } -static void msn_auth_got_passport_id( struct passport_reply *rep ) +static void msn_auth_got_passport_token( struct msn_auth_data *mad ) { - struct im_connection *ic = rep->data; - struct msn_data *md = ic->proto_data; - char *key = rep->result; - char buf[1024]; + struct im_connection *ic = mad->data; + struct msn_data *md; - if( key == NULL ) + /* Dead connection? */ + if( g_slist_find( msn_connections, ic ) == NULL ) + return; + + md = ic->proto_data; + if( mad->token ) { - imcb_error( ic, "Error during Passport authentication (%s)", - rep->error_string ? rep->error_string : "Unknown error" ); - imc_logout( ic, TRUE ); + char buf[1024]; + + g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token ); + msn_write( ic, buf, strlen( buf ) ); } else { - g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key ); - msn_write( ic, buf, strlen( buf ) ); + imcb_error( ic, "Error during Passport authentication: %s", mad->error ); + imc_logout( ic, TRUE ); } } diff --git a/protocols/msn/passport.c b/protocols/msn/passport.c index 9fe6a174..7a15c3fe 100644 --- a/protocols/msn/passport.c +++ b/protocols/msn/passport.c @@ -1,8 +1,7 @@ -/* passport.c +/** passport.c * - * Functions to login to microsoft passport service for Messenger - * Copyright (C) 2004 Wouter Paesen - * Copyright (C) 2004 Wilmer van der Gaast + * Functions to login to Microsoft Passport service for Messenger + * Copyright (C) 2004-2008 Wilmer van der Gaast * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -23,208 +22,144 @@ #include "passport.h" #include "msn.h" #include "bitlbee.h" +#include "url.h" +#include "misc.h" +#include "xmltree.h" #include #include -#define MSN_BUF_LEN 8192 +static int passport_get_token_real( struct msn_auth_data *mad ); +static void passport_get_token_ready( struct http_request *req ); -static char *prd_cached = NULL; - -static int passport_get_id_real( gpointer func, gpointer data, char *header ); -static void passport_get_id_ready( struct http_request *req ); - -static int passport_retrieve_dalogin( gpointer data, gpointer func, char *header ); -static void passport_retrieve_dalogin_ready( struct http_request *req ); - -static char *passport_create_header( char *cookie, char *email, char *pwd ); -static void destroy_reply( struct passport_reply *rep ); - -int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie ) +int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie ) { - char *header = passport_create_header( cookie, username, password ); + struct msn_auth_data *mad = g_new0( struct msn_auth_data, 1 ); + int i; - if( prd_cached == NULL ) - return passport_retrieve_dalogin( func, data, header ); - else - return passport_get_id_real( func, data, header ); + mad->username = g_strdup( username ); + mad->password = g_strdup( password ); + mad->cookie = g_strdup( cookie ); + + mad->callback = func; + mad->data = data; + + mad->url = g_strdup( SOAP_AUTHENTICATION_URL ); + mad->ttl = 3; /* Max. # of redirects. */ + + /* HTTP-escape stuff and s/,/&/ */ + http_decode( mad->cookie ); + for( i = 0; mad->cookie[i]; i ++ ) + if( mad->cookie[i] == ',' ) + mad->cookie[i] = '&'; + + return passport_get_token_real( mad ); } -static int passport_get_id_real( gpointer func, gpointer data, char *header ) +static int passport_get_token_real( struct msn_auth_data *mad ) { - struct passport_reply *rep; - char *server, *dummy, *reqs; + char *post_payload, *post_request; struct http_request *req; + url_t url; - rep = g_new0( struct passport_reply, 1 ); - rep->data = data; - rep->func = func; - rep->header = header; - - server = g_strdup( prd_cached ); - dummy = strchr( server, '/' ); - - if( dummy == NULL ) - { - destroy_reply( rep ); - return( 0 ); - } - - reqs = g_strdup_printf( "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header ); + url_set( &url, mad->url ); - *dummy = 0; - req = http_dorequest( server, 443, 1, reqs, passport_get_id_ready, rep ); + post_payload = g_markup_printf_escaped( SOAP_AUTHENTICATION_PAYLOAD, + mad->username, + mad->password, + mad->cookie ); - g_free( server ); - g_free( reqs ); + post_request = g_strdup_printf( SOAP_AUTHENTICATION_REQUEST, + url.file, url.host, + (int) strlen( post_payload ), + post_payload ); + + req = http_dorequest( url.host, url.port, 1, post_request, + passport_get_token_ready, mad ); - if( req == NULL ) - destroy_reply( rep ); + g_free( post_request ); + g_free( post_payload ); - return( req != NULL ); + return req != NULL; } -static void passport_get_id_ready( struct http_request *req ) +static xt_status passport_xt_extract_token( struct xt_node *node, gpointer data ); +static xt_status passport_xt_handle_fault( struct xt_node *node, gpointer data ); + +static const struct xt_handler_entry passport_xt_handlers[] = { + { "wsse:BinarySecurityToken", "wst:RequestedSecurityToken", passport_xt_extract_token }, + { "S:Fault", "S:Envelope", passport_xt_handle_fault }, + { NULL, NULL, NULL } +}; + +static void passport_get_token_ready( struct http_request *req ) { - struct passport_reply *rep = req->data; + struct msn_auth_data *mad = req->data; + struct xt_parser *parser; - if( !g_slist_find( msn_connections, rep->data ) ) - { - destroy_reply( rep ); - return; - } + g_free( mad->url ); + g_free( mad->error ); + mad->url = mad->error = NULL; - if( req->finished && req->reply_headers && req->status_code == 200 ) + if( req->status_code == 200 ) { - char *dummy; - - if( ( dummy = strstr( req->reply_headers, "from-PP='" ) ) ) - { - char *responseend; - - dummy += strlen( "from-PP='" ); - responseend = strchr( dummy, '\'' ); - if( responseend ) - *responseend = 0; - - rep->result = g_strdup( dummy ); - } - else - { - rep->error_string = g_strdup( "Could not parse Passport server response" ); - } + parser = xt_new( passport_xt_handlers, mad ); + xt_feed( parser, req->reply_body, req->body_size ); + xt_handle( parser, NULL, -1 ); + xt_free( parser ); } else { - rep->error_string = g_strdup_printf( "HTTP error: %s", - req->status_string ? req->status_string : "Unknown error" ); + mad->error = g_strdup_printf( "HTTP error %d (%s)", req->status_code, + req->status_string ? req->status_string : "unknown" ); } - rep->func( rep ); - destroy_reply( rep ); -} - -static char *passport_create_header( char *cookie, char *email, char *pwd ) -{ - char *buffer; - char *currenttoken; - char *email_enc, *pwd_enc; - - currenttoken = strstr( cookie, "lc=" ); - if( currenttoken == NULL ) - return NULL; - - email_enc = g_new0( char, strlen( email ) * 3 + 1 ); - strcpy( email_enc, email ); - http_encode( email_enc ); - - pwd_enc = g_new0( char, strlen( pwd ) * 3 + 1 ); - strcpy( pwd_enc, pwd ); - http_encode( pwd_enc ); - - buffer = g_strdup_printf( "Authorization: Passport1.4 OrgVerb=GET," - "OrgURL=http%%3A%%2F%%2Fmessenger%%2Emsn%%2Ecom," - "sign-in=%s,pwd=%s,%s", email_enc, pwd_enc, - currenttoken ); - - g_free( email_enc ); - g_free( pwd_enc ); + if( mad->error == NULL && mad->token == NULL ) + mad->error = g_strdup( "Could not parse Passport server response" ); - return buffer; + if( mad->url && mad->token == NULL ) + { + passport_get_token_real( mad ); + } + else + { + mad->callback( mad ); + + g_free( mad->url ); + g_free( mad->username ); + g_free( mad->password ); + g_free( mad->cookie ); + g_free( mad->token ); + g_free( mad->error ); + g_free( mad ); + } } -static int passport_retrieve_dalogin( gpointer func, gpointer data, char *header ) +static xt_status passport_xt_extract_token( struct xt_node *node, gpointer data ) { - struct passport_reply *rep = g_new0( struct passport_reply, 1 ); - struct http_request *req; + struct msn_auth_data *mad = data; + char *s; - rep->data = data; - rep->func = func; - rep->header = header; + if( ( s = xt_find_attr( node, "Id" ) ) && strcmp( s, "PPToken1" ) == 0 ) + mad->token = g_memdup( node->text, node->text_len + 1 ); - req = http_dorequest_url( "https://nexus.passport.com/rdr/pprdr.asp", passport_retrieve_dalogin_ready, rep ); - - if( !req ) - destroy_reply( rep ); - - return( req != NULL ); + return XT_HANDLED; } -static void passport_retrieve_dalogin_ready( struct http_request *req ) +static xt_status passport_xt_handle_fault( struct xt_node *node, gpointer data ) { - struct passport_reply *rep = req->data; - char *dalogin; - char *urlend; + struct msn_auth_data *mad = data; + struct xt_node *code = xt_find_node( node->children, "faultcode" ); + struct xt_node *string = xt_find_node( node->children, "faultstring" ); + struct xt_node *redirect = xt_find_node( node->children, "psf:redirectUrl" ); - if( !g_slist_find( msn_connections, rep->data ) ) - { - destroy_reply( rep ); - return; - } - - if( !req->finished || !req->reply_headers || req->status_code != 200 ) - { - rep->error_string = g_strdup_printf( "HTTP error while fetching DALogin: %s", - req->status_string ? req->status_string : "Unknown error" ); - goto failure; - } + if( redirect && redirect->text_len && mad->ttl-- > 0 ) + mad->url = g_memdup( redirect->text, redirect->text_len + 1 ); - dalogin = strstr( req->reply_headers, "DALogin=" ); - - if( !dalogin ) - { - rep->error_string = g_strdup( "Parse error while fetching DALogin" ); - goto failure; - } - - dalogin += strlen( "DALogin=" ); - urlend = strchr( dalogin, ',' ); - if( urlend ) - *urlend = 0; - - /* strip the http(s):// part from the url */ - urlend = strstr( urlend, "://" ); - if( urlend ) - dalogin = urlend + strlen( "://" ); - - if( prd_cached == NULL ) - prd_cached = g_strdup( dalogin ); - - if( passport_get_id_real( rep->func, rep->data, rep->header ) ) - { - rep->header = NULL; - destroy_reply( rep ); - return; - } + if( code == NULL || code->text_len == 0 ) + mad->error = g_strdup( "Unknown error" ); + else + mad->error = g_strdup_printf( "%s (%s)", code->text, string && string->text_len ? + string->text : "no description available" ); -failure: - rep->func( rep ); - destroy_reply( rep ); -} - -static void destroy_reply( struct passport_reply *rep ) -{ - g_free( rep->result ); - g_free( rep->header ); - g_free( rep->error_string ); - g_free( rep ); + return XT_HANDLED; } diff --git a/protocols/msn/passport.h b/protocols/msn/passport.h index 9fd81a82..1d0c6edc 100644 --- a/protocols/msn/passport.h +++ b/protocols/msn/passport.h @@ -1,10 +1,7 @@ -#ifndef __PASSPORT_H__ -#define __PASSPORT_H__ /* passport.h * - * Functions to login to Microsoft Passport Service for Messenger - * Copyright (C) 2004 Wouter Paesen , - * Wilmer van der Gaast + * Functions to login to Microsoft Passport service for Messenger + * Copyright (C) 2004-2008 Wilmer van der Gaast * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -17,9 +14,15 @@ * * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* Thanks to http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener + for the specs! */ + +#ifndef __PASSPORT_H__ +#define __PASSPORT_H__ + #include #include #include @@ -32,15 +35,77 @@ #endif #include "nogaim.h" -struct passport_reply +struct msn_auth_data { - void (*func)( struct passport_reply * ); - void *data; - char *result; - char *header; - char *error_string; + char *url; + int ttl; + + char *username; + char *password; + char *cookie; + + /* The end result, the only thing we'll really be interested in + once finished. */ + char *token; + char *error; /* Yeah, or that... */ + + void (*callback)( struct msn_auth_data *mad ); + gpointer data; }; -int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie ); +#define SOAP_AUTHENTICATION_URL "https://loginnet.passport.com/RST.srf" + +#define SOAP_AUTHENTICATION_REQUEST \ +"POST %s HTTP/1.0\r\n" \ +"Accept: text/*\r\n" \ +"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \ +"Host: %s\r\n" \ +"Content-Length: %d\r\n" \ +"Cache-Control: no-cache\r\n" \ +"\r\n" \ +"%s" + +#define SOAP_AUTHENTICATION_PAYLOAD \ +"" \ +"" \ + "
" \ + "" \ + "{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}" \ + "4" \ + "1" \ + "" \ + "AQAAAAIAAABsYwQAAAAzMDg0" \ + "" \ + "" \ + "" \ + "%s" \ + "%s" \ + "" \ + "" \ + "
" \ + "" \ + "" \ + "" \ + "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue" \ + "" \ + "" \ + "http://Passport.NET/tb" \ + "" \ + "" \ + "" \ + "" \ + "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue" \ + "" \ + "" \ + "messenger.msn.com" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ +"
" + +int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie ); #endif /* __PASSPORT_H__ */ -- cgit v1.2.3 From 9186d15356a46576fb5b306f49a6acdb64fb7622 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 17 Feb 2008 11:26:44 +0000 Subject: Automatically truncate MSN passports to 16 characters because that's the maximum supported by MSN and giving a longer password will make the authentication fail. --- protocols/msn/passport.c | 5 +++++ protocols/msn/passport.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/protocols/msn/passport.c b/protocols/msn/passport.c index 7a15c3fe..565d15f3 100644 --- a/protocols/msn/passport.c +++ b/protocols/msn/passport.c @@ -52,6 +52,11 @@ int passport_get_token( gpointer func, gpointer data, char *username, char *pass if( mad->cookie[i] == ',' ) mad->cookie[i] = '&'; + /* Microsoft doesn't allow password longer than 16 chars and silently + fails authentication if you give the "full version" of your passwd. */ + if( strlen( mad->password ) > MAX_PASSPORT_PWLEN ) + mad->password[MAX_PASSPORT_PWLEN] = 0; + return passport_get_token_real( mad ); } diff --git a/protocols/msn/passport.h b/protocols/msn/passport.h index 1d0c6edc..517d2e91 100644 --- a/protocols/msn/passport.h +++ b/protocols/msn/passport.h @@ -35,6 +35,8 @@ #endif #include "nogaim.h" +#define MAX_PASSPORT_PWLEN 16 + struct msn_auth_data { char *url; -- cgit v1.2.3 From d5bd9c078ae2fb4d2e9354e943e06e017e878776 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 28 Feb 2008 22:39:37 +0000 Subject: My fix for semi-PEBKAC bug #353: Add a warning if someone seems to be using the wrong command, and fixing "help nick" example to show how it should be done now. --- doc/user-guide/commands.xml | 4 ++-- root_commands.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 5a1e398c..3402cfd7 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -842,8 +842,8 @@ - nick 1 "Wouter Paesen" - Setting your name on connection 1 to `Wouter Paesen' + account set 1/display_name "The majestik møøse" + display_name = `The majestik møøse' diff --git a/root_commands.c b/root_commands.c index 8e315bd4..2f542826 100644 --- a/root_commands.c +++ b/root_commands.c @@ -768,6 +768,9 @@ static void cmd_set( irc_t *irc, char **cmd ) irc_usermsg( irc, "%s = `%s'", set_name, s ); else irc_usermsg( irc, "%s is empty", set_name ); + + if( strchr( set_name, '/' ) ) + irc_usermsg( irc, "Warning: / found in setting name, you're probably looking for the `account set' command." ); } else { -- cgit v1.2.3 From 7bb3afbf24aaae0df9cd2e0e0cc9ebaf8e19f228 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 2 Mar 2008 17:13:32 +0000 Subject: Oops, even GMail got out of beta quicker than this. ;-) --- doc/user-guide/Support.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/user-guide/Support.xml b/doc/user-guide/Support.xml index 401a4295..c9f50a5f 100644 --- a/doc/user-guide/Support.xml +++ b/doc/user-guide/Support.xml @@ -3,12 +3,13 @@ Support -BitlBee is beta software +Disclaimer -Although BitlBee has quite some functionality it is still beta. That means it -can crash at any time, corrupt your data or whatever. Don't use it in -any production environment and don't rely on it. +BitlBee doesn't come with a warranty and is still (and will probably always +be) under development. That means it can crash at any time, corrupt your +data or whatever. Don't use it in any production environment and don't rely +on it, or at least don't blame us if things blow up. :-) -- cgit v1.2.3 From 064e47c5927e1711fc45263d971998a7afca547b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 2 Mar 2008 17:58:21 +0000 Subject: Some very late quickstart updates: ICQ supports server-side contact lists for ages already and private is set to true by default for quite some time as well. --- doc/user-guide/quickstart.xml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/user-guide/quickstart.xml b/doc/user-guide/quickstart.xml index 7735a8d7..0539a7c7 100644 --- a/doc/user-guide/quickstart.xml +++ b/doc/user-guide/quickstart.xml @@ -60,11 +60,11 @@ When you are finished adding your account(s) use the account on -For most protocols (currently MSN, Jabber, Yahoo and AOL) BitlBee can download the contact list automatically from the IM server and all the on-line users should appear in the control channel when you log in. +Now BitlBee logs in and downloads the contact list from the IM server. In a few seconds, all your on-line buddies should show up in the control channel. -BitlBee will convert names into irc-friendly form (for instance: tux@example.com will be given the nickname tux). If you have more than one person who would have the same name by this logic (for instance: tux@example.com and tux@bitlbee.org) the second one to log on will be tux_. The same is true if you have a tux log on to AOL and a tux log on from Yahoo. +BitlBee will convert names into IRC-friendly form (for instance: tux@example.com will be given the nickname tux). If you have more than one person who would have the same name by this logic (for instance: tux@example.com and tux@bitlbee.org) the second one to log on will be tux_. The same is true if you have a tux log on to AOL and a tux log on from Yahoo. @@ -126,11 +126,15 @@ First of all, a person must be on your contact list for you to chat with them (u tux: hey, how's the weather down there? - you: a bit chilly! + you: a bit chilly! -If you'd rather chat with them in a separate window use the /msg or /query command, just like you would for a private message in IRC. If you want to have messages automatically come up in private messages rather than in the &bitlbee channel, use the set private command: set private true (set private false to change back). +Note that, although all contacts are in the &bitlbee channel, only tux will actually receive this message. The &bitlbee channel shouldn't be confused with a real IRC channel. + + + +If you prefer chatting in a separate window, use the /msg or /query command, just like on real IRC. BitlBee will remember how you talk to someone and show his/her responses the same way. If you want to change the default behaviour (for people you haven't talked to yet), see help set private. -- cgit v1.2.3 From b27557b2d23f3cbc0801bc628de24a2a6adcfca9 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 2 Mar 2008 22:12:06 +0000 Subject: More documentation fixes: Cleaned up dead links, removed more outdated information (like the "set charset" default, which is UTF-8 for ages already). --- doc/user-guide/commands.xml | 22 +++++++--------------- doc/user-guide/misc.xml | 28 ++++------------------------ 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 3402cfd7..c45727b9 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -162,11 +162,7 @@ - If you want, you can also tell BitlBee what nick to give the new contact. Of course you can also use the rename command for that, but sometimes this might be more convenient. - - - - Adding -tmp adds the buddy to the internal BitlBee structures only, not to the real contact list (like done by set handle_unknown add). This allows you to talk to people who are not in your contact list. + If you want, you can also tell BitlBee what nick to give the new contact. The -tmp option adds the buddy to the internal BitlBee structures only, not to the real contact list (like done by set handle_unknown add). This allows you to talk to people who are not in your contact list. This normally won't show you any presence notifications. @@ -382,16 +378,16 @@ - iso8859-1 + utf-8 you can get a list of all possible values by doing 'iconv -l' in a shell - The charset setting enables you to use different character sets in BitlBee. These get converted to UTF-8 before sending and from UTF-8 when receiving. + This setting tells BitlBee what your IRC client sends and expects. It should be equal to the charset setting of your IRC client if you want to be able to send and receive non-ASCII text properly. - If you don't know what's the best value for this, at least iso8859-1 is the best choice for most Western countries. You can try to find what works best for you on http://czyborra.com/charsets/iso8859.html + Most systems use UTF-8 these days. On older systems, an iso8859 charset may work better. For example, iso8859-1 is the best choice for most Western countries. You can try to find what works best for you on http://www.unicodecharacter.com/charsets/iso8859.html @@ -676,7 +672,7 @@ - Sends you a /notice when a user starts typing a message (if the protocol supports it, MSN for example). This is a bug, not a feature. (But please don't report it.. ;-) You don't want to use it. Really. In fact the typing-notification is just one of the least useful 'innovations' ever. It's just there because some guy will probably ask me about it anyway. ;-) + Sends you a /notice when a user starts typing a message (if supported by the IM protocol and the user's client). To use this, you most likely want to use a script in your IRC client to show this information in a more sensible way. @@ -829,15 +825,11 @@ Change friendly name, nick nick <connection> [<new nick>] - nick + nick <connection> - This command allows to set the friendly name of an im account. If no new name is specified the command will report the current name. When the name contains spaces, don't forget to quote the whole nick in double quotes. Currently this command is only supported by the MSN protocol. - - - - It is recommended to use the per-account display_name setting to read and change this information. The nick command is deprecated. + Deprecated: Use the per-account display_name setting to read and change this information. diff --git a/doc/user-guide/misc.xml b/doc/user-guide/misc.xml index d387d4b3..b55a8915 100644 --- a/doc/user-guide/misc.xml +++ b/doc/user-guide/misc.xml @@ -46,16 +46,12 @@ All MSN smileys (except one) are case insensitive and work without the nose too. (O)Clock - -This list was extracted from http://help.msn.com/!data/en_us/data/messengerv50.its51/$content$/EMOTICONS.HTM?H_APP=. - - Groupchats -Since version 0.8x, BitlBee supports groupchats on the MSN and Yahoo! networks. This text will try to explain you how they work. +BitlBee now supports groupchats on all IM networks. This text will try to explain you how they work. @@ -72,7 +68,7 @@ Of course you can also create your own groupchats. Type help groupchat Creating groupchats -If you want to start a groupchat with the person jim_msn in it, just join the channel #jim_msn. BitlBee will refuse to join you to the channel with that name, but it will create a new virtual channel with root, you and jim_msn in it. +If you want to start a groupchat with the person lisa_msn in it, just join the channel #lisa_msn. BitlBee will refuse to join you to the channel with that name, but it will create a new virtual channel with root, you and lisa_msn in it. @@ -83,23 +79,6 @@ Of course a channel with only two people isn't really exciting yet. So the next Some protocols (like Jabber) also support named groupchats. BitlBee now supports these too. You can use the join_chat command to join them. See help join_chat for more information. - -This is all you'll probably need to know. If you have any problems, please read help groupchats3. - - - - - -Groupchat channel names - - -Obviously the (numbered) channel names don't make a lot of sense. Problem is that groupchats usually don't have names at all in the IM-world, while IRC insists on a name. So BitlBee just generates something random, just don't pay attention to it. :-) - - - -Please also note that BitlBee doesn't support groupchats for all protocols yet. BitlBee will tell you so. Support for other protocols will hopefully come later. - - @@ -120,6 +99,7 @@ Not all away states are supported by all protocols, and some protocols have diff Be right back, BRB On the phone, Phone, On phone Out to lunch, Lunch, Food + Invisible, Hidden @@ -127,7 +107,7 @@ So /away Food will set your state to "Out to lunch" on your -You can also add more information to your away message. Setting it to "Busy - Fixing BitlBee bugs" will set your IM-away-states to Busy, but your away message will be more descriptive for people on IRC. Protocols like Yahoo! and Jabber will also show this complete away message to your buddies. +You can also add more information to your away message. Setting it to "Busy - Fixing BitlBee bugs" will set your IM-away-states to Busy, but your away message will be more descriptive for people on IRC. Most IM-protocols can also show this additional information to your buddies. -- cgit v1.2.3 From 171ef85781e08ccbd8a6a018e88b1ad3cb802f78 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 2 Mar 2008 23:17:15 +0000 Subject: Some saner error handling in ipc.c. One of the things I wanted to do for 1.2. --- ipc.c | 60 +++++++++++++++++++++++++++++++++++++++--------------------- ipc.h | 3 +++ 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/ipc.c b/ipc.c index 384a9c33..54f026ac 100644 --- a/ipc.c +++ b/ipc.c @@ -257,19 +257,7 @@ gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ) } else { - GSList *l; - struct bitlbee_child *c; - - for( l = child_list; l; l = l->next ) - { - c = l->data; - if( c->ipc_fd == source ) - { - ipc_master_free_one( c ); - child_list = g_slist_remove( child_list, c ); - break; - } - } + ipc_master_free_fd( source ); } return TRUE; @@ -287,10 +275,7 @@ gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ) } else { - b_event_remove( global.listen_watch_source_id ); - close( global.listen_socket ); - - global.listen_socket = -1; + ipc_child_disable(); } return TRUE; @@ -325,7 +310,9 @@ void ipc_to_master_str( char *format, ... ) } else if( global.conf->runmode == RUNMODE_FORKDAEMON ) { - write( global.listen_socket, msg_buf, strlen( msg_buf ) ); + if( global.listen_socket >= 0 ) + if( write( global.listen_socket, msg_buf, strlen( msg_buf ) ) <= 0 ) + ipc_child_disable(); } else if( global.conf->runmode == RUNMODE_DAEMON ) { @@ -375,12 +362,18 @@ void ipc_to_children_str( char *format, ... ) else if( global.conf->runmode == RUNMODE_FORKDAEMON ) { int msg_len = strlen( msg_buf ); - GSList *l; + GSList *l, *next; - for( l = child_list; l; l = l->next ) + for( l = child_list; l; l = next ) { struct bitlbee_child *c = l->data; - write( c->ipc_fd, msg_buf, msg_len ); + + next = l->next; + if( write( c->ipc_fd, msg_buf, msg_len ) <= 0 ) + { + ipc_master_free_one( c ); + child_list = g_slist_remove( child_list, c ); + } } } else if( global.conf->runmode == RUNMODE_DAEMON ) @@ -409,6 +402,23 @@ void ipc_master_free_one( struct bitlbee_child *c ) g_free( c ); } +void ipc_master_free_fd( int fd ) +{ + GSList *l; + struct bitlbee_child *c; + + for( l = child_list; l; l = l->next ) + { + c = l->data; + if( c->ipc_fd == fd ) + { + ipc_master_free_one( c ); + child_list = g_slist_remove( child_list, c ); + break; + } + } +} + void ipc_master_free_all() { GSList *l; @@ -420,6 +430,14 @@ void ipc_master_free_all() child_list = NULL; } +void ipc_child_disable() +{ + b_event_remove( global.listen_watch_source_id ); + close( global.listen_socket ); + + global.listen_socket = -1; +} + char *ipc_master_save_state() { char *fn = g_strdup( "/tmp/bee-restart.XXXXXX" ); diff --git a/ipc.h b/ipc.h index 68926dfd..f3d24614 100644 --- a/ipc.h +++ b/ipc.h @@ -43,8 +43,11 @@ gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ); gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ); void ipc_master_free_one( struct bitlbee_child *child ); +void ipc_master_free_fd( int fd ); void ipc_master_free_all(); +void ipc_child_disable(); + void ipc_to_master( char **cmd ); void ipc_to_master_str( char *format, ... ) G_GNUC_PRINTF( 1, 2 ); void ipc_to_children( char **cmd ); -- cgit v1.2.3 From ed3ae7e7d41f91917fc2ae92051c7c77c357fbab Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 3 Mar 2008 00:08:49 +0000 Subject: Added note about daemon mode to doc/README --- doc/README | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/README b/doc/README index bb6596ba..ca392573 100644 --- a/doc/README +++ b/doc/README @@ -41,6 +41,20 @@ Also, don't forget to create the configuration directory (/var/lib/bitlbee/ by default) and chown it to the UID BitlBee is running as. Make sure this directory is read-/writable by this user only. +--- (Fork)Daemon mode + +If you don't want to run any inetd daemon, you can run BitlBee in Daemon +mode. Right now, daemon mode may be a bad idea on servers with multiple +users, since possible fatal BitlBee bugs will crash the BitlBee process and +disconnect all connected users at once. Instead, you can use ForkDaemon +mode, which serves every user from a separate process, without depending on +an inetd daemon. + +To use BitlBee in daemon mode, just start it with the right flags or enable +it in bitlbee.conf. You probably want to write an init script to start +BitlBee automatically after a reboot. (This is where you realise using +a package from your distro would've been a better idea. :-P) + DEPENDENCIES ============ -- cgit v1.2.3 From 7f421d6b922837857d6aca342da314225023eb46 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 3 Mar 2008 23:18:36 +0000 Subject: BitlBee <= 1.0 didn't have "account set" and allowed one to delete an account and re-create it with new login settings if necessary, without losing custom nicknames. Now, nicknames are connected to an account instead of just the protocol, and they're flushed together with the account. So I added a warning to make sure nobody accidentally loses any settings while just changing the password. This will probably go after a few releases, since it's slightly annoying. --- query.c | 10 ++++++++-- root_commands.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/query.c b/query.c index 99be2bee..6f9eb77f 100644 --- a/query.c +++ b/query.c @@ -139,12 +139,18 @@ void query_answer( irc_t *irc, query_t *q, int ans ) } if( ans ) { - imcb_log( q->ic, "Accepted: %s", q->question ); + if( q->ic ) + imcb_log( q->ic, "Accepted: %s", q->question ); + else + irc_usermsg( irc, "Accepted: %s", q->question ); q->yes( NULL, q->data ); } else { - imcb_log( q->ic, "Rejected: %s", q->question ); + if( q->ic ) + imcb_log( q->ic, "Rejected: %s", q->question ); + else + irc_usermsg( irc, "Rejected: %s", q->question ); q->no( NULL, q->data ); } q->data = NULL; diff --git a/root_commands.c b/root_commands.c index 2f542826..9a60b5af 100644 --- a/root_commands.c +++ b/root_commands.c @@ -203,6 +203,26 @@ static void cmd_drop( irc_t *irc, char **cmd ) } } +void cmd_account_del_yes( gpointer w, void *data ) +{ + account_t *a = data; + irc_t *irc = a->irc; + + if( a->ic ) + { + irc_usermsg( irc, "Account is still logged in, can't delete" ); + } + else + { + account_del( irc, a ); + irc_usermsg( irc, "Account deleted" ); + } +} + +void cmd_account_del_no( gpointer w, void *data ) +{ +} + static void cmd_account( irc_t *irc, char **cmd ) { account_t *a; @@ -257,8 +277,15 @@ static void cmd_account( irc_t *irc, char **cmd ) } else { - account_del( irc, a ); - irc_usermsg( irc, "Account deleted" ); + char *msg; + + msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will " + "also forget all your saved nicknames. If you want " + "to change your username/password, use the `account " + "set' command. Are you sure you want to delete this " + "account?", a->prpl->name, a->user ); + query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, a ); + g_free( msg ); } } else if( g_strcasecmp( cmd[1], "list" ) == 0 ) -- cgit v1.2.3 From 9ad86bb22e53a40b3ad5bbc57f33d819d2748b0c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 15 Mar 2008 16:09:50 +0000 Subject: Fixed issues with "long" URLs in url.c. Reusing code from 2001 wasn't a good idea... --- bitlbee.h | 2 +- lib/url.c | 24 +++++++++++++----------- lib/url.h | 18 +++++++++--------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/bitlbee.h b/bitlbee.h index c118d7fc..4a1c8b6d 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -32,7 +32,7 @@ #define BITLBEE_VERSION "1.1.1dev" #define VERSION BITLBEE_VERSION -#define MAX_STRING 128 +#define MAX_STRING 511 #if HAVE_CONFIG_H #include "config.h" diff --git a/lib/url.c b/lib/url.c index c6fdc4c8..de9966b4 100644 --- a/lib/url.c +++ b/lib/url.c @@ -25,13 +25,16 @@ #include "url.h" -/* Convert an URL to a url_t structure */ +/* Convert an URL to a url_t structure */ int url_set( url_t *url, char *set_url ) { - char s[MAX_STRING]; + char s[MAX_STRING+1]; char *i; - /* protocol:// */ + memset( url, 0, sizeof( url_t ) ); + memset( s, 0, sizeof( s ) ); + + /* protocol:// */ if( ( i = strstr( set_url, "://" ) ) == NULL ) { url->proto = PROTO_DEFAULT; @@ -48,13 +51,12 @@ int url_set( url_t *url, char *set_url ) else if( g_strncasecmp( set_url, "socks5", i - set_url ) == 0 ) url->proto = PROTO_SOCKS5; else - { - return( 0 ); - } + return 0; + strncpy( s, i + 3, MAX_STRING ); } - /* Split */ + /* Split */ if( ( i = strchr( s, '/' ) ) == NULL ) { strcpy( url->file, "/" ); @@ -66,7 +68,7 @@ int url_set( url_t *url, char *set_url ) } strncpy( url->host, s, MAX_STRING ); - /* Check for username in host field */ + /* Check for username in host field */ if( strrchr( url->host, '@' ) != NULL ) { strncpy( url->user, url->host, MAX_STRING ); @@ -75,19 +77,19 @@ int url_set( url_t *url, char *set_url ) strcpy( url->host, i + 1 ); *url->pass = 0; } - /* If not: Fill in defaults */ + /* If not: Fill in defaults */ else { *url->user = *url->pass = 0; } - /* Password? */ + /* Password? */ if( ( i = strchr( url->user, ':' ) ) != NULL ) { *i = 0; strcpy( url->pass, i + 1 ); } - /* Port number? */ + /* Port number? */ if( ( i = strchr( url->host, ':' ) ) != NULL ) { *i = 0; diff --git a/lib/url.h b/lib/url.h index e9e1ecfe..8c038c91 100644 --- a/lib/url.h +++ b/lib/url.h @@ -25,20 +25,20 @@ #include "bitlbee.h" -#define PROTO_HTTP 2 -#define PROTO_HTTPS 5 -#define PROTO_SOCKS4 3 -#define PROTO_SOCKS5 4 -#define PROTO_DEFAULT PROTO_HTTP +#define PROTO_HTTP 2 +#define PROTO_HTTPS 5 +#define PROTO_SOCKS4 3 +#define PROTO_SOCKS5 4 +#define PROTO_DEFAULT PROTO_HTTP typedef struct url { int proto; int port; - char host[MAX_STRING]; - char file[MAX_STRING]; - char user[MAX_STRING]; - char pass[MAX_STRING]; + char host[MAX_STRING+1]; + char file[MAX_STRING+1]; + char user[MAX_STRING+1]; + char pass[MAX_STRING+1]; } url_t; int url_set( url_t *url, char *set_url ); -- cgit v1.2.3 From a869d9147584de96a0ac341416e551953167800f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 15 Mar 2008 17:44:21 +0000 Subject: Indicate that we support YMSG protocol version 12, this should hopefully keep BitlBee working after 2008-04-02 . --- protocols/yahoo/libyahoo2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index ce38bc73..4e93449e 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -736,7 +736,7 @@ static void yahoo_send_packet(struct yahoo_input_data *yid, struct yahoo_packet data = y_new0(unsigned char, len + 1); memcpy(data + pos, "YMSG", 4); pos += 4; - pos += yahoo_put16(data + pos, 0x0a00); + pos += yahoo_put16(data + pos, 0x000c); pos += yahoo_put16(data + pos, 0x0000); pos += yahoo_put16(data + pos, pktlen + extra_pad); pos += yahoo_put16(data + pos, pkt->service); -- cgit v1.2.3 From 79eae4a9edb343eaad30425289f7737467a535bb Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 15 Mar 2008 21:05:39 +0000 Subject: Inviting someone to a Yahoo! chatroom with msg=NULL is bad. I wonder if /invite ever worked in the Yahoo! module... --- protocols/yahoo/yahoo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index 9f9ffcf7..36579d66 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -314,7 +314,7 @@ static void byahoo_chat_invite( struct groupchat *c, char *who, char *msg ) { struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data; - yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg ); + yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg ? msg : "" ); } static void byahoo_chat_leave( struct groupchat *c ) -- cgit v1.2.3 From 4bb50efd1015a04d44c301961710fa08e0eda162 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 15 Mar 2008 23:53:54 +0000 Subject: Although I have no idea what the author meant with code like `if(cp != "\005")', I'm sure he feels homesick to QuickBasic. Since BitlBee doesn't use this function anyway, it doesn't really matter if my fix works. As long as it keeps the compiler quiet. --- protocols/yahoo/libyahoo2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 4e93449e..80d88a85 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -3350,7 +3350,7 @@ static void yahoo_process_search_connection(struct yahoo_input_data *yid, int ov yct->age = atoi(cp); break; case 5: - if(cp != "\005") + if(strcmp(cp, "5") != 0) yct->location = cp; k = 0; break; -- cgit v1.2.3 From d07c3a8cde47096ad69db7139d410dfee29e509b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 00:40:20 +0000 Subject: No idea what's holding back 1.2 anymore so at least I'll make sure bitlbee.h is correct. Also updated the changelog. Just remembered 1 or 2 things left to do before 1.2, maybe do them tomorrow? --- bitlbee.h | 2 +- doc/CHANGES | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/bitlbee.h b/bitlbee.h index 4a1c8b6d..420ab70a 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -29,7 +29,7 @@ #define _GNU_SOURCE /* Stupid GNU :-P */ #define PACKAGE "BitlBee" -#define BITLBEE_VERSION "1.1.1dev" +#define BITLBEE_VERSION "1.2" #define VERSION BITLBEE_VERSION #define MAX_STRING 511 diff --git a/doc/CHANGES b/doc/CHANGES index ee4cde69..959c11fd 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,7 +1,4 @@ Version 1.2: -- First BitlBee development/testing RELEASE. This should be quite stable - though (and for most people more stable than 1.0.x). It just has a couple - of rough edges and needs a bit more testing. - Added ForkDaemon mode next to the existing Daemon- and inetd modes. With ForkDaemon you can run BitlBee as a stand-alone daemon and every connection will run in its own process. No more need to configure inetd, and still you @@ -20,9 +17,16 @@ Version 1.2: This allows us to use more GLib features (like the XML parser). By now GLib 1.x is so old that supporting it really isn't necessary anymore. - Many, many, MANY little changes, improvements, fixes. Using non-blocking - I/O as much as possible, fixed lots of little bugs (including bugs that - affected daemon mode stability). See the bzr logs for more information. -- Added units tests, will have to add some more before the real release. + I/O as much as possible, replaced the Gaim (0.59, IOW heavily outdated) + API, fixed lots of little bugs (including bugs that affected daemon mode + stability). See the bzr logs for more information. +- One of the user-visible changes from the API change: You can finally see + all away states/messages properly. +- Added units tests. Test coverage is very minimal for now. +- Better charset handling: Everything is just converted from/to UTF-8 right + in the IRC core, and charset mismatches are detected (if possible) and the + user is asked to resolve this before continuing. Also, UTF-8 is the default + setting now, since that's how the world seems to work these days. - Most important change: New file format for user data (accounts, nicks and settings). Migration to the new format should happen transparently, BitlBee will read the old files and once you quit/save it will save in the @@ -68,6 +72,11 @@ Version 1.2: buddy is in your contact list.) * An XML console (add xmlconsole to your contact list or see "help set xmlconsole" if you want it permanently). +- The Yahoo! module now says it supports YMSG protocol version 12, which will + hopefully keep the Yahoo module working after 2008-04-02 (when Yahoo! is + dropping support for version 6.x of their client). +- MSN switchboard handling changes. Hopefully less messages will get lost now, + although things are still not perfect. Finished ??? -- cgit v1.2.3 From ddcf491fa460fea612c240589c50da864dad6668 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 14:18:22 +0000 Subject: Adding padding to encrypted IM-passwords so the exact password length can't be guessed from the encrypted data anymore. --- lib/arc.c | 27 +++++++++++++++++++++++++-- lib/arc.h | 4 ++-- storage_xml.c | 2 +- tests/check_arc.c | 35 ++++++++++++++++++++++------------- 4 files changed, 50 insertions(+), 18 deletions(-) diff --git a/lib/arc.c b/lib/arc.c index 617f6b96..fd498454 100644 --- a/lib/arc.c +++ b/lib/arc.c @@ -130,18 +130,40 @@ unsigned char arc_getbyte( struct arc_state *st ) don't need it anymore. Both functions return the number of bytes in the result string. + + Note that if you use the pad_to argument, you will need zero-termi- + nation to find back the original string length after decryption. So + it shouldn't be used if your string contains \0s by itself! */ -int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *password ) +int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *password, int pad_to ) { struct arc_state *st; unsigned char *key; - int key_len, i; + char *padded = NULL; + int key_len, i, padded_len; key_len = strlen( password ) + ARC_IV_LEN; if( clear_len <= 0 ) clear_len = strlen( clear ); + /* Pad the string to the closest multiple of pad_to. This makes it + impossible to see the exact length of the password. */ + if( pad_to > 0 && ( clear_len % pad_to ) > 0 ) + { + padded_len = clear_len + pad_to - ( clear_len % pad_to ); + padded = g_malloc( padded_len ); + memcpy( padded, clear, clear_len ); + + /* First a \0 and then random data, so we don't have to do + anything special when decrypting. */ + padded[clear_len] = 0; + random_bytes( (unsigned char*) padded + clear_len + 1, padded_len - clear_len - 1 ); + + clear = padded; + clear_len = padded_len; + } + /* Prepare buffers and the key + IV */ *crypt = g_malloc( clear_len + ARC_IV_LEN ); key = g_malloc( key_len ); @@ -160,6 +182,7 @@ int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *passwor crypt[0][i+ARC_IV_LEN] = clear[i] ^ arc_getbyte( st ); g_free( st ); + g_free( padded ); return clear_len + ARC_IV_LEN; } diff --git a/lib/arc.h b/lib/arc.h index 882372ed..58f30d3d 100644 --- a/lib/arc.h +++ b/lib/arc.h @@ -30,7 +30,7 @@ struct arc_state unsigned char i, j; }; -struct arc_state *arc_keymaker( unsigned char *key, int kl, int cycles ); +G_GNUC_MALLOC struct arc_state *arc_keymaker( unsigned char *key, int kl, int cycles ); unsigned char arc_getbyte( struct arc_state *st ); -int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *password ); +int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *password, int pad_to ); int arc_decode( unsigned char *crypt, int crypt_len, char **clear, char *password ); diff --git a/storage_xml.c b/storage_xml.c index 19070a74..6ea4d442 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -427,7 +427,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite ) char *pass_b64; int pass_len; - pass_len = arc_encode( acc->pass, strlen( acc->pass ), (unsigned char**) &pass_cr, irc->password ); + pass_len = arc_encode( acc->pass, strlen( acc->pass ), (unsigned char**) &pass_cr, irc->password, 12 ); pass_b64 = base64_encode( pass_cr, pass_len ); g_free( pass_cr ); diff --git a/tests/check_arc.c b/tests/check_arc.c index a430f899..9d913dcd 100644 --- a/tests/check_arc.c +++ b/tests/check_arc.c @@ -6,13 +6,14 @@ #include #include "arc.h" -char *password = "TotT"; +char *password = "ArcVier"; char *clear_tests[] = { "Wie dit leest is gek :-)", "ItllBeBitlBee", "One more boring password", + "Hoi hoi", NULL }; @@ -27,7 +28,7 @@ static void check_codec(int l) char *decrypted; int len; - len = arc_encode( clear_tests[i], 0, &crypted, password ); + len = arc_encode( clear_tests[i], 0, &crypted, password, 12 ); len = arc_decode( crypted, len, &decrypted, password ); fail_if( strcmp( clear_tests[i], decrypted ) != 0, @@ -40,27 +41,35 @@ static void check_codec(int l) struct { - unsigned char crypted[24]; + unsigned char crypted[30]; int len; char *decrypted; } decrypt_tests[] = { + /* One block with padding. */ { { - 0xc3, 0x0d, 0x43, 0xc3, 0xee, 0x80, 0xe2, 0x8c, 0x0b, 0x29, 0x32, 0x7e, - 0x38, 0x05, 0x82, 0x10, 0x21, 0x1c, 0x4a, 0x00, 0x2c - }, 21, "Debugging sucks" + 0x3f, 0x79, 0xb0, 0xf5, 0x91, 0x56, 0xd2, 0x1b, 0xd1, 0x4b, 0x67, 0xac, + 0xb1, 0x31, 0xc9, 0xdb, 0xf9, 0xaa + }, 18, "short pass" }, + + /* Two blocks with padding. */ { { - 0xb0, 0x00, 0x57, 0x0d, 0x0d, 0x0d, 0x70, 0xe1, 0xc0, 0x00, 0xa4, 0x25, - 0x7d, 0xbe, 0x03, 0xcc, 0x24, 0xd1, 0x0c - }, 19, "Testing rocks" + 0xf9, 0xa6, 0xec, 0x5d, 0xc7, 0x06, 0xb8, 0x6b, 0x63, 0x9f, 0x2d, 0xb5, + 0x7d, 0xaa, 0x32, 0xbb, 0xd8, 0x08, 0xfd, 0x81, 0x2e, 0xca, 0xb4, 0xd7, + 0x2f, 0x36, 0x9c, 0xac, 0xa0, 0xbc + }, 30, "longer password" }, + + /* This string is exactly two "blocks" long, to make sure unpadded strings also decrypt + properly. */ { { - 0xb6, 0x92, 0x59, 0xe4, 0xf9, 0xc1, 0x7a, 0xf6, 0xf3, 0x18, 0xea, 0x28, - 0x73, 0x6d, 0xb3, 0x0a, 0x6f, 0x0a, 0x2b, 0x43, 0x57, 0xe9, 0x3e, 0x63 - }, 24, "OSCAR is creepy..." + 0x95, 0x4d, 0xcf, 0x4d, 0x5e, 0x6c, 0xcf, 0xef, 0xb9, 0x80, 0x00, 0xef, + 0x25, 0xe9, 0x17, 0xf6, 0x29, 0x6a, 0x82, 0x79, 0x1c, 0xca, 0x68, 0xb5, + 0x4e, 0xd0, 0xc1, 0x41, 0x8e, 0xe6 + }, 30, "OSCAR is really creepy.." }, { "", 0, NULL } }; @@ -79,7 +88,7 @@ static void check_decod(int l) &decrypted, password ); fail_if( strcmp( decrypt_tests[i].decrypted, decrypted ) != 0, - "%s didn't decrypt properly", clear_tests[i] ); + "`%s' didn't decrypt properly", decrypt_tests[i].decrypted ); g_free( decrypted ); } -- cgit v1.2.3 From e960a523f587a83bd22d000b4451c5a21b2951e8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 14:39:34 +0000 Subject: Fixed cached_id_prefix memory leak. --- protocols/jabber/jabber.c | 1 + 1 file changed, 1 insertion(+) diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 243ed7fd..0e23b4d4 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -266,6 +266,7 @@ static void jabber_logout( struct im_connection *ic ) xt_free( jd->xt ); + g_free( jd->cached_id_prefix ); g_free( jd->away_message ); g_free( jd->username ); g_free( jd ); -- cgit v1.2.3 From 50d26f33935aadc556dd3e79829b1ca01bbceab9 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 15:28:37 +0000 Subject: Fixed base64_decode() to not barf on corrupted Base64 strings. --- lib/base64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base64.c b/lib/base64.c index 64e9692a..ea0db6b9 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -117,7 +117,7 @@ int base64_decode_real(const unsigned char *in, unsigned char *out, char *b64rev { int i, outlen = 0; - for( i = 0; in[i]; i += 4 ) + for( i = 0; in[i] && in[i+1] && in[i+2] && in[i+3]; i += 4 ) { int sx; -- cgit v1.2.3 From 4e8db1c0141f74dc6156a57739613483344b358d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 16:03:52 +0000 Subject: Moved password hash verification to md5_verify_password() so this can be reused for IRC/OPER passwords (to have encrypted in bitlbee.conf). --- lib/misc.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/misc.h | 2 ++ storage_xml.c | 41 +++++++++++------------------------------ 3 files changed, 54 insertions(+), 30 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index 18d98f9e..ccf208b5 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -32,6 +32,7 @@ #define BITLBEE_CORE #include "nogaim.h" +#include "base64.h" #include #include #include @@ -596,3 +597,43 @@ gboolean ssl_sockerr_again( void *ssl ) else return sockerr_again(); } + +/* Returns values: -1 == Failure (base64-decoded to something unexpected) + 0 == Okay + 1 == Password doesn't match the hash. */ +int md5_verify_password( char *password, char *hash ) +{ + md5_byte_t *pass_dec = NULL; + md5_byte_t pass_md5[16]; + md5_state_t md5_state; + int ret, i; + + if( base64_decode( hash, &pass_dec ) != 21 ) + { + ret = -1; + } + else + { + md5_init( &md5_state ); + md5_append( &md5_state, (md5_byte_t*) password, strlen( password ) ); + md5_append( &md5_state, (md5_byte_t*) pass_dec + 16, 5 ); /* Hmmm, salt! */ + md5_finish( &md5_state, pass_md5 ); + + for( i = 0; i < 16; i ++ ) + { + if( pass_dec[i] != pass_md5[i] ) + { + ret = 1; + break; + } + } + + /* If we reached the end of the loop, it was a match! */ + if( i == 16 ) + ret = 0; + } + + g_free( pass_dec ); + + return ret; +} diff --git a/lib/misc.h b/lib/misc.h index 7804bfb1..a2acada6 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -66,4 +66,6 @@ G_MODULE_EXPORT char *word_wrap( char *msg, int line_len ); G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl ); +G_MODULE_EXPORT int md5_verify_password( char *password, char *hash ); + #endif diff --git a/storage_xml.c b/storage_xml.c index 6ea4d442..f37fce44 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -79,49 +79,30 @@ static void xml_start_element( GMarkupParseContext *ctx, const gchar *element_na { char *nick = xml_attr( attr_names, attr_values, "nick" ); char *pass = xml_attr( attr_names, attr_values, "password" ); - md5_byte_t *pass_dec = NULL; + int st; if( !nick || !pass ) { g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, "Missing attributes for %s element", element_name ); } - else if( base64_decode( pass, &pass_dec ) != 21 ) + else if( ( st = md5_verify_password( xd->given_pass, pass ) ) == -1 ) { + xd->pass_st = XML_PASS_WRONG; g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, "Error while decoding password attribute" ); } + else if( st == 0 ) + { + if( xd->pass_st != XML_PASS_CHECK_ONLY ) + xd->pass_st = XML_PASS_OK; + } else { - md5_byte_t pass_md5[16]; - md5_state_t md5_state; - int i; - - md5_init( &md5_state ); - md5_append( &md5_state, (md5_byte_t*) xd->given_pass, strlen( xd->given_pass ) ); - md5_append( &md5_state, (md5_byte_t*) pass_dec + 16, 5 ); /* Hmmm, salt! */ - md5_finish( &md5_state, pass_md5 ); - - for( i = 0; i < 16; i ++ ) - { - if( pass_dec[i] != pass_md5[i] ) - { - xd->pass_st = XML_PASS_WRONG; - g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Password mismatch" ); - break; - } - } - - /* If we reached the end of the loop, it was a match! */ - if( i == 16 ) - { - if( xd->pass_st != XML_PASS_CHECK_ONLY ) - xd->pass_st = XML_PASS_OK; - } + xd->pass_st = XML_PASS_WRONG; + g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Password mismatch" ); } - - g_free( pass_dec ); } else if( xd->pass_st < XML_PASS_OK ) { -- cgit v1.2.3 From ec0355f6998eb5dee254e4bc60a3207bb661c854 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 16:31:27 +0000 Subject: Passwords in bitlbee.conf can now be (properly salted) MD5 hashes, for just that little bit extra security. --- bitlbee.conf | 7 +++++++ doc/CHANGES | 2 ++ irc_commands.c | 10 ++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bitlbee.conf b/bitlbee.conf index d9f878c8..99e8106d 100644 --- a/bitlbee.conf +++ b/bitlbee.conf @@ -48,14 +48,21 @@ ## AuthPassword ## ## Password the user should enter when logging into a closed BitlBee server. +## You can also have an MD5-encrypted password here. Format: "md5:", followed +## by a hash as generated for the attribute in a BitlBee +## XML file (for now there's no easier way to generate the hash). ## # AuthPassword = ItllBeBitlBee ## Heh.. Our slogan. ;-) +## or +# AuthPassword = md5:gzkK0Ox/1xh+1XTsQjXxBJ571Vgl ## OperPassword ## ## Password that unlocks access to special operator commands. ## # OperPassword = ChangeMe! +## or +# OperPassword = md5:I0mnZbn1t4R731zzRdDN2/pK7lRX ## HostName ## diff --git a/doc/CHANGES b/doc/CHANGES index 959c11fd..b3c3b711 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -27,6 +27,8 @@ Version 1.2: in the IRC core, and charset mismatches are detected (if possible) and the user is asked to resolve this before continuing. Also, UTF-8 is the default setting now, since that's how the world seems to work these days. +- One can now keep hashed passwords in bitlbee.conf instead of the cleartext + version. - Most important change: New file format for user data (accounts, nicks and settings). Migration to the new format should happen transparently, BitlBee will read the old files and once you quit/save it will save in the diff --git a/irc_commands.c b/irc_commands.c index 68db4617..14209732 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -29,7 +29,10 @@ static void irc_cmd_pass( irc_t *irc, char **cmd ) { - if( global.conf->auth_pass && strcmp( cmd[1], global.conf->auth_pass ) == 0 ) + if( global.conf->auth_pass && + strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? + md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : + strcmp( cmd[1], global.conf->auth_pass ) == 0 ) { irc->status |= USTATUS_AUTHORIZED; irc_check_login( irc ); @@ -87,7 +90,10 @@ static void irc_cmd_ping( irc_t *irc, char **cmd ) static void irc_cmd_oper( irc_t *irc, char **cmd ) { - if( global.conf->oper_pass && strcmp( cmd[2], global.conf->oper_pass ) == 0 ) + if( global.conf->oper_pass && + strncmp( global.conf->oper_pass, "md5:", 4 ) == 0 ? + md5_verify_password( cmd[2], global.conf->oper_pass + 4 ) == 0 : + strcmp( cmd[2], global.conf->oper_pass ) == 0 ) { irc_umode_set( irc, "+o", 1 ); irc_reply( irc, 381, ":Password accepted" ); -- cgit v1.2.3 From c029350d962d95c2d5e9854ca4d82e597addf76d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 16 Mar 2008 17:17:23 +0000 Subject: Added some brackets in irc_cmd_(pass|oper) to prevent crashes when no passwords were set. --- irc_commands.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/irc_commands.c b/irc_commands.c index 14209732..b8bae541 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -30,9 +30,9 @@ static void irc_cmd_pass( irc_t *irc, char **cmd ) { if( global.conf->auth_pass && - strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? - md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : - strcmp( cmd[1], global.conf->auth_pass ) == 0 ) + ( strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? + md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : + strcmp( cmd[1], global.conf->auth_pass ) == 0 ) ) { irc->status |= USTATUS_AUTHORIZED; irc_check_login( irc ); @@ -91,9 +91,9 @@ static void irc_cmd_ping( irc_t *irc, char **cmd ) static void irc_cmd_oper( irc_t *irc, char **cmd ) { if( global.conf->oper_pass && - strncmp( global.conf->oper_pass, "md5:", 4 ) == 0 ? - md5_verify_password( cmd[2], global.conf->oper_pass + 4 ) == 0 : - strcmp( cmd[2], global.conf->oper_pass ) == 0 ) + ( strncmp( global.conf->oper_pass, "md5:", 4 ) == 0 ? + md5_verify_password( cmd[2], global.conf->oper_pass + 4 ) == 0 : + strcmp( cmd[2], global.conf->oper_pass ) == 0 ) ) { irc_umode_set( irc, "+o", 1 ); irc_reply( irc, 381, ":Password accepted" ); -- cgit v1.2.3 From 6612cc9dd32475569875030f5acc7cc4b0374ba6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 17 Mar 2008 22:35:24 +0000 Subject: Release 1.2 should now be ready. --- doc/CHANGES | 2 +- doc/RELEASE-SPEECH-1.2 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 doc/RELEASE-SPEECH-1.2 diff --git a/doc/CHANGES b/doc/CHANGES index b3c3b711..65947617 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -80,7 +80,7 @@ Version 1.2: - MSN switchboard handling changes. Hopefully less messages will get lost now, although things are still not perfect. -Finished ??? +Finished 17 Mar 2008 Version 1.0.4: - Removed sethostent(), which causes problems for many people, especially on diff --git a/doc/RELEASE-SPEECH-1.2 b/doc/RELEASE-SPEECH-1.2 new file mode 100644 index 00000000..ec7c48b4 --- /dev/null +++ b/doc/RELEASE-SPEECH-1.2 @@ -0,0 +1,57 @@ +BitlBee ... is Bitl +------------------- + +"I CAN HAS SPEEECH?" This is how Wilmer announced to me that he was going to do +another BitlBee release. I was as surprised as you are. I thought he had given +up on this whole releasing business. + +There is some humor in using a LOLcats reference to announce a new Bee +release. The last major BitlBee release (1.0) was done a long time before the +hype even begun. Between then and now we've celebrated BitlBee's fifth birthday +and had a handful of releases, but nothing big happened. As a user this lax +release planning worries me. What if this means that later releases will take +even longer? I don't think we should fear this. Let us explore why this release +took so long. + +Personally, I blame Google. + +There, I've said it. Google. The guys who are so big on "Do No Evil" and all +that jazz. They caused this release to be so late. Let me explain why. + +They made Wilmer an offer. Wilmer, being the sillily naive guy he is, couldn't +refuse. There were no decapitated horses involved, but he couldn't refuse +nonetheless. That's not a big problem of course. Lots of guys (and gals, sure) +work for Google. It wouldn't have become a problem if they hadn't shipped him of +to Ireland. That's where the trouble starts. + +Ireland. Home of the leprechauns. These rascals joined forces with aliens and +LOLcats to abduct Wilmer. The aliens had been trying for years to kidnap him, +but they were on his turf and his trusty sidekicks Jelmer and Maurits were there +to help him. All that changed when he moved to Ireland. + +But it wasn't just that Wilmer was all alone in some strange place. It was also +that the aliens had created the LOLcats and made an alliance with the +leprechauns--the real rulers of Ireland. Wilmer is cool, but he's not that +cool. So they abducted him for a few years. When he finally came back, he +regathered his mad coding skills and hacked a new release together. + +By now you're thinking, what has happened to Jelmer and Maurits? Well, they're +still here and they worked on the Bee while Wilmer was absent. But, like open +source, they are very Bitl--they're cool, but they're ready when they're +ready. + +Well, whatever you may think of my little theory, they did take forever to +launch this release. We're not mad at them, because it shows. They have +added some cool new features and made plenty of changes under the hood. Let me +give you a sneak preview of some of the new features: Jabber groupchats are +supported. Configuration files are stored encrypted. You can now use +ForkDaemon mode, which gives better stability over normal daemon mode, but +doesn't require inetd. Also, server owners can now use the /OPER command to +spy on their users. And--as I was specifically asked to mention--this is the +first stable release that supports plugins. That's some Bitl changes for ya. + +BitlBee is cool, but ready when it's ready. Very Bitl. + +Sjoerd. LOL. + +(LOLBee by Erik Bosman.) -- cgit v1.2.3 From 379c08a27e637dbcbbe3f39a8723daa765ad0e48 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 21 Mar 2008 00:27:24 +0000 Subject: Updated/Fixed Debian package. --- debian/README.Debian | 4 ++-- debian/changelog | 25 +++++++++++++++++++++++-- debian/control | 2 +- debian/po/it.po | 36 ++++++++++++++++++++++++++++++++++++ debian/postinst | 9 ++++++++- debian/postrm | 3 ++- debian/rules | 9 ++++++--- 7 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 debian/po/it.po diff --git a/debian/README.Debian b/debian/README.Debian index e2102fc8..6056f488 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,6 +1,6 @@ - *** NEWS (Version 1.1 and later) *** + *** NEWS (Version 1.2 and later) *** -Starting from version 1.1, BitlBee has a forking daemon mode. The Debian +Starting from version 1.2, BitlBee has a forking daemon mode. The Debian package now uses this mode by default, instead of inetd mode. If you don't want to use this, you can disable the init scripts (best way to do this is by editing /etc/default/bitlbee) and restore the inetd.conf entry. This diff --git a/debian/changelog b/debian/changelog index ae524f73..2cf6510c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,33 @@ -bitlbee (1.1.1dev-0pre) unstable; urgency=low +bitlbee (1.2-1) unstable; urgency=low + * New upstream release. (Closes: #325017, #386914, #437515) + * With hopefully completely sane charset handling (Closes: #296145) * Switched to the new forking daemon mode. Added /etc/default/bitlbee file, an init script. People who want to stick with inetd can do so, see the defaults file. + (Closes: #460741, #466171, #294585, #345038, #306452, #392682) * Got rid of debconf Woody compatibility stuff. * No more MPL code in BitlBee, thanks to the Jabber module rewrite! + * Added Italian translation, sorry for taking so long! (Closes: #448238) + * Added libevent dependency (more reliable event handling). + * Removed GLib 1.x dependency because BitlBee really requires GLib >=2.4. - -- Wilmer van der Gaast Fri, 06 Jul 2007 09:09:36 +0100 + -- Wilmer van der Gaast Tue, 18 Mar 2008 23:44:19 +0000 + +bitlbee (1.0.4-2) unstable; urgency=low + + * Removed $DEB_BUILD_OPTIONS because apparently buildds fill it with crap. + (Closes: #458717) + + -- Wilmer van der Gaast Mon, 11 Feb 2008 19:15:33 +0000 + +bitlbee (1.0.4-1) unstable; urgency=low + + * New upstream release. + * Changed libnss-dev dependency. (Closes: #370442) + * Added build-indep rule to debian/rules. (Closes: #395673) + + -- Wilmer van der Gaast Wed, 29 Aug 2007 20:24:28 +0100 bitlbee (1.0.3-1.3) unstable; urgency=low diff --git a/debian/control b/debian/control index 139174a6..8383391b 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Wilmer van der Gaast Standards-Version: 3.5.9 -Build-Depends: libglib2.0-dev | libglib-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf +Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf Package: bitlbee Architecture: any diff --git a/debian/po/it.po b/debian/po/it.po new file mode 100644 index 00000000..e149e61a --- /dev/null +++ b/debian/po/it.po @@ -0,0 +1,36 @@ +# Italian translation of the bitlbee debconf template +# This file is distributed under the same license as the bitlbee package +# Copyright (C) 2007 Free Software Foundation, Inc. +# Luca Monducci , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: bitlbee\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-08-30 04:31+0200\n" +"PO-Revision-Date: 2007-10-27 11:52+0200\n" +"Last-Translator: Luca Monducci \n" +"Language-Team: Italian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../bitlbee.templates.master:1001 +msgid "On what TCP port should BitlBee listen for connections?" +msgstr "Su quale porta TCP si deve mettere in ascolto BitlBee?" + +#. Type: string +#. Description +#: ../bitlbee.templates.master:1001 +msgid "" +"BitlBee normally listens on the regular IRC port, 6667. This might not be a " +"very good idea when you're running a real IRC daemon as well. 6668 might be " +"a good alternative. Leaving this value blank means that BitlBee will not be " +"run automatically." +msgstr "" +"Normalmente BitlBee si mette in ascolto sulla consueta porta IRC, la 6667. " +"Questa potrebbe non essere una buona idea se è in esecuzione anche un reale " +"demone IRC. La porta 6668 potrebbe essere una valida alternativa. Lasciando " +"vuoto questo valore BitlBee non viene avviato automaticamente." diff --git a/debian/postinst b/debian/postinst index 37608e47..c4edb8e8 100755 --- a/debian/postinst +++ b/debian/postinst @@ -15,9 +15,16 @@ BITLBEE_DISABLED=0 BITLBEE_UPGRADE_DONT_RESTART=0 [ -r /etc/default/bitlbee ] && source /etc/default/bitlbee -if [ "$BITLBEE_DISABLED" = "0" ]; then +if [ "$BITLBEE_DISABLED" = "0" ] && expr "$2" : '0\..*' > /dev/null || expr "$2" : '1\.0\..*' > /dev/null; then ## In case it's still there (if we're upgrading right now) update-inetd --remove '.*/usr/sbin/bitlbee' + if grep -q /usr/sbin/bitlbee /etc/inetd.conf 2> /dev/null; then + # Thanks for breaking update-inetd! (bugs.debian.org/311111) + # I hope that it works at least with xinetd, because this + # emergency hack doesn't: + perl -pi -e 's:^[^#].*/usr/sbin/bitlbee$:## Now using daemon mode\: # $&:' /etc/inetd.conf + killall -HUP inetd + fi fi cat</etc/default/bitlbee diff --git a/debian/postrm b/debian/postrm index cef99f13..f7686e7b 100755 --- a/debian/postrm +++ b/debian/postrm @@ -8,4 +8,5 @@ if [ -e /usr/share/debconf/confmodule ]; then fi update-rc.d bitlbee remove > /dev/null 2>&1 || true -deluser --remove-home bitlbee || true +deluser --system --remove-home bitlbee || true +rm -f /etc/default/bitlbee diff --git a/debian/rules b/debian/rules index 8d6bd4fa..0c757899 100755 --- a/debian/rules +++ b/debian/rules @@ -2,15 +2,18 @@ DEBUG ?= 0 +ifdef BITLBEE_VERSION +BITLBEE_FORCE_VERSION=1 +else # Want to use the full package version number instead of just the release. BITLBEE_VERSION ?= "$(shell dpkg-parsechangelog | grep ^Version: | awk '{print $$2}')" export BITLBEE_VERSION - +endif build-arch: build-arch-stamp build-arch-stamp: if [ ! -d debian ]; then exit 1; fi - ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee $(DEB_BUILD_OPTIONS) + ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent $(DEB_BUILD_OPTIONS) $(MAKE) # $(MAKE) -C doc/ all touch build-arch-stamp @@ -65,7 +68,7 @@ binary-arch: build-arch install-arch cd debian/bitlbee; \ find usr -type f -exec md5sum {} \; > DEBIAN/md5sums dpkg-shlibdeps -Tdebian/bitlbee.substvars -dDepends debian/bitlbee/usr/sbin/bitlbee -ifdef BITLBEE_VERSION +ifdef BITLBEE_FORCE_VERSION dpkg-gencontrol -ldebian/changelog -isp -pbitlbee -Tdebian/bitlbee.substvars -Pdebian/bitlbee -v1:$(BITLBEE_VERSION)-0 -V'debconf-depends=debconf (>= 1.2.0) | debconf-2.0' else dpkg-gencontrol -ldebian/changelog -isp -pbitlbee -Tdebian/bitlbee.substvars -Pdebian/bitlbee -V'debconf-depends=debconf (>= 1.2.0) | debconf-2.0' -- cgit v1.2.3 From a83442a7c4dbf99937e9e5397e5665c671694161 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 21 Mar 2008 00:39:16 +0000 Subject: Fixed handling of "set charset none". Fixes bug #373. --- irc.c | 7 ++++--- set.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/irc.c b/irc.c index 3a09f684..3589256e 100644 --- a/irc.c +++ b/irc.c @@ -308,7 +308,7 @@ void irc_process( irc_t *irc ) break; } - if( ( cs = set_getstr( &irc->set, "charset" ) ) ) + if( ( cs = set_getstr( &irc->set, "charset" ) ) && g_strcasecmp( cs, "none" ) != 0 ) { conv[IRC_MAX_LINE] = 0; if( do_iconv( cs, "UTF-8", lines[i], conv, 0, IRC_MAX_LINE - 2 ) == -1 ) @@ -329,7 +329,7 @@ void irc_process( irc_t *irc ) else { irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, - "Warning: invalid (non-UTF8) characters received at login time." ); + "Warning: invalid characters received at login time." ); strncpy( conv, lines[i], IRC_MAX_LINE ); for( temp = conv; *temp; temp ++ ) @@ -553,7 +553,8 @@ void irc_vawrite( irc_t *irc, char *format, va_list params ) g_vsnprintf( line, IRC_MAX_LINE - 2, format, params ); strip_newlines( line ); - if( ( cs = set_getstr( &irc->set, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) ) + if( ( cs = set_getstr( &irc->set, "charset" ) ) && + g_strcasecmp( cs, "none" ) != 0 && g_strcasecmp( cs, "utf-8" ) != 0 ) { char conv[IRC_MAX_LINE+1]; diff --git a/set.c b/set.c index 6f09843b..90b29f91 100644 --- a/set.c +++ b/set.c @@ -234,7 +234,7 @@ char *set_eval_charset( set_t *set, char *value ) { GIConv cd; - if ( g_strncasecmp( value, "none", 4 ) == 0 ) + if( g_strcasecmp( value, "none" ) == 0 ) return value; cd = g_iconv_open( "UTF-8", value ); -- cgit v1.2.3 From 851a8c29c681cdc3c9838ed99486822cba927f60 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 22 Mar 2008 12:02:50 +0000 Subject: Taught GLib-mode subprocesses how to die. (Closes: #374) --- lib/events_glib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/events_glib.c b/lib/events_glib.c index 1198dba6..3e194e98 100644 --- a/lib/events_glib.c +++ b/lib/events_glib.c @@ -50,11 +50,12 @@ typedef struct _GaimIOClosure { gpointer data; } GaimIOClosure; -static GMainLoop *loop; +static GMainLoop *loop = NULL; void b_main_init() { - loop = g_main_new( FALSE ); + if( loop == NULL ) + loop = g_main_new( FALSE ); } void b_main_run() -- cgit v1.2.3 From 8a2221a79b177a5c6d0b55dafebd39414d7fe10a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 23 Mar 2008 14:29:19 +0000 Subject: Fixed stalling issue with OpenSSL and Jabber (#368). --- lib/ssl_client.h | 3 +++ lib/ssl_gnutls.c | 6 ++++++ lib/ssl_nss.c | 6 ++++++ lib/ssl_openssl.c | 23 +++++++++++++++++++---- protocols/jabber/io.c | 9 +++++++-- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/lib/ssl_client.h b/lib/ssl_client.h index dcbf9a01..f91d0d70 100644 --- a/lib/ssl_client.h +++ b/lib/ssl_client.h @@ -59,6 +59,9 @@ G_MODULE_EXPORT void *ssl_starttls( int fd, ssl_input_function func, gpointer da G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len ); G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len ); +/* See ssl_openssl.c for an explanation. */ +G_MODULE_EXPORT int ssl_pending( void *conn ); + /* Abort the SSL connection and disconnect the socket. Do not use close() directly, both the SSL library and the peer will be unhappy! */ G_MODULE_EXPORT void ssl_disconnect( void *conn_ ); diff --git a/lib/ssl_gnutls.c b/lib/ssl_gnutls.c index b964ab49..f5945442 100644 --- a/lib/ssl_gnutls.c +++ b/lib/ssl_gnutls.c @@ -210,6 +210,12 @@ int ssl_write( void *conn, const char *buf, int len ) return st; } +/* See ssl_openssl.c for an explanation. */ +int ssl_pending( void *conn ) +{ + return 0; +} + void ssl_disconnect( void *conn_ ) { struct scd *conn = conn_; diff --git a/lib/ssl_nss.c b/lib/ssl_nss.c index 218b3a80..eba3c441 100644 --- a/lib/ssl_nss.c +++ b/lib/ssl_nss.c @@ -168,6 +168,12 @@ int ssl_write( void *conn, const char *buf, int len ) return( PR_Write ( ((struct scd*)conn)->prfd, buf, len ) ); } +/* See ssl_openssl.c for an explanation. */ +int ssl_pending( void *conn ) +{ + return 0; +} + void ssl_disconnect( void *conn_ ) { struct scd *conn = conn_; diff --git a/lib/ssl_openssl.c b/lib/ssl_openssl.c index b1ba1db9..fc6d433e 100644 --- a/lib/ssl_openssl.c +++ b/lib/ssl_openssl.c @@ -61,16 +61,16 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data struct scd *conn = g_new0( struct scd, 1 ); conn->fd = proxy_connect( host, port, ssl_connected, conn ); - conn->func = func; - conn->data = data; - conn->inpa = -1; - if( conn->fd < 0 ) { g_free( conn ); return NULL; } + conn->func = func; + conn->data = data; + conn->inpa = -1; + return conn; } @@ -230,6 +230,21 @@ int ssl_write( void *conn, const char *buf, int len ) return st; } +/* Only OpenSSL *really* needs this (and well, maybe NSS). See for more info: + http://www.gnu.org/software/gnutls/manual/gnutls.html#index-gnutls_005frecord_005fcheck_005fpending-209 + http://www.openssl.org/docs/ssl/SSL_pending.html + + Required because OpenSSL empties the TCP buffer completely but doesn't + necessarily give us all the unencrypted data. + + Returns 0 if there's nothing left or if we don't have to care (GnuTLS), + 1 if there's more data. */ +int ssl_pending( void *conn ) +{ + return ( ((struct scd*)conn) && ((struct scd*)conn)->established ) ? + SSL_pending( ((struct scd*)conn)->ssl ) > 0 : 0; +} + void ssl_disconnect( void *conn_ ) { struct scd *conn = conn_; diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index 9980dc8e..10efad37 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -240,8 +240,13 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition return FALSE; } - /* EAGAIN/etc or a successful read. */ - return TRUE; + if( ssl_pending( jd->ssl ) ) + /* OpenSSL empties the TCP buffers completely but may keep some + data in its internap buffers. select() won't see that, but + ssl_pending() does. */ + return jabber_read_callback( data, fd, cond ); + else + return TRUE; } gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond ) -- cgit v1.2.3 From dd14ecc29b87b9aefa97b6838f5a8595557d46d1 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 23 Mar 2008 15:02:42 +0000 Subject: s/g_strsplit/g_strsplit_set/, thanks to misc@mandriva.org (Bug #380). --- conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.c b/conf.c index 57902826..339af618 100644 --- a/conf.c +++ b/conf.c @@ -251,7 +251,7 @@ static int conf_loadini( conf_t *conf, char *file ) else if( g_strcasecmp( ini->key, "account_storage_migrate" ) == 0 ) { g_strfreev( conf->migrate_storage ); - conf->migrate_storage = g_strsplit( ini->value, " \t,;", -1 ); + conf->migrate_storage = g_strsplit_set( ini->value, " \t,;", -1 ); } else if( g_strcasecmp( ini->key, "pinginterval" ) == 0 ) { -- cgit v1.2.3 From fcd5003bd6c10f176f63df459e8ca479c5292dc1 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 23 Mar 2008 21:53:53 +0000 Subject: Some Debian package fixes. If nothing else comes up, this will be 1.2-2. (Not sure if I will roll back the non-Debian changes...) --- debian/README.Debian | 16 +++++++++++++++- debian/changelog | 7 +++++++ debian/conffiles | 1 + debian/postinst | 10 ++++++---- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index 6056f488..b5a514c0 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -6,7 +6,21 @@ want to use this, you can disable the init scripts (best way to do this is by editing /etc/default/bitlbee) and restore the inetd.conf entry. This should be necessary only once, it won't be touched during upgrades. --------------------------------------------------------------------------- +Another important change in BitlBee 1.2 is the file format used for your +personal settings. Everything's now saved in a single .xml (per account, +of course) file instead of $nick.accounts and $nick.nicks. One advantage +of this new format is that the passwords are actually encrypted instead of +just vaguely obfuscated. BitlBee can still read the old files, and will +save things in the new format when you save/disconnect. After that, you +can safely remove the old-style files (this is recommended). + +I tried making this transition (the new file format but especially, in this +case, the inetd->forkdaemon mode change) as smooth as possible, but I'm +aware that many BitlBee users will have their own hacks already to run the +program. I hope the package won't break any of this for anyone. 1.2-2 +should fix at least some of the issues. + +--------------------------------------------------------------------------- Debconf should have asked you on what port you want BitlBee to run. If it did not, the port number should be 6667 or 6668. (6668 if you already got diff --git a/debian/changelog b/debian/changelog index 2cf6510c..0eb05525 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +bitlbee (1.2-2) unstable; urgency=low + + * Fixed some packaging issues reported by IRC and e-mail. (Closes: #472373) + * Not ready yet. + + -- Wilmer van der Gaast Sun, 23 Mar 2008 21:51:57 +0000 + bitlbee (1.2-1) unstable; urgency=low * New upstream release. (Closes: #325017, #386914, #437515) diff --git a/debian/conffiles b/debian/conffiles index 2ccc958d..dcb4078e 100644 --- a/debian/conffiles +++ b/debian/conffiles @@ -1,2 +1,3 @@ /etc/bitlbee/motd.txt /etc/bitlbee/bitlbee.conf +/etc/init.d/bitlbee diff --git a/debian/postinst b/debian/postinst index c4edb8e8..1a906474 100755 --- a/debian/postinst +++ b/debian/postinst @@ -13,17 +13,19 @@ update-rc.d bitlbee defaults > /dev/null 2>&1 BITLBEE_OPTS=-F BITLBEE_DISABLED=0 BITLBEE_UPGRADE_DONT_RESTART=0 -[ -r /etc/default/bitlbee ] && source /etc/default/bitlbee +[ -r /etc/default/bitlbee ] && . /etc/default/bitlbee -if [ "$BITLBEE_DISABLED" = "0" ] && expr "$2" : '0\..*' > /dev/null || expr "$2" : '1\.0\..*' > /dev/null; then - ## In case it's still there (if we're upgrading right now) +if [ "$BITLBEE_DISABLED" = "0" ] && type update-inetd > /dev/null 2> /dev/null && + ( expr "$2" : '0\..*' > /dev/null || expr "$2" : '1\.0\..*' > /dev/null ); then + ## Make sure the inetd entry is gone (can still be there from a + ## previous version. update-inetd --remove '.*/usr/sbin/bitlbee' if grep -q /usr/sbin/bitlbee /etc/inetd.conf 2> /dev/null; then # Thanks for breaking update-inetd! (bugs.debian.org/311111) # I hope that it works at least with xinetd, because this # emergency hack doesn't: perl -pi -e 's:^[^#].*/usr/sbin/bitlbee$:## Now using daemon mode\: # $&:' /etc/inetd.conf - killall -HUP inetd + killall -HUP inetd || true fi fi -- cgit v1.2.3 From 58a1449166ebc9c2913bf47a4bf05c4cf3e258b0 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 24 Mar 2008 11:01:02 +0000 Subject: Fixed a broken check in lib/proxy.c, this restores proxy support. Thanks to Miles Bader for reporting this in the Debian BTS. Apparently not many people use this functionality, it was broken in bzr for more than a year already... --- debian/changelog | 1 + lib/proxy.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0eb05525..6c725964 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ bitlbee (1.2-2) unstable; urgency=low * Fixed some packaging issues reported by IRC and e-mail. (Closes: #472373) + * Fixed proxy support. (Closes: #472395) * Not ready yet. -- Wilmer van der Gaast Sun, 23 Mar 2008 21:51:57 +0000 diff --git a/lib/proxy.c b/lib/proxy.c index 0e1c8f07..53b89d64 100644 --- a/lib/proxy.c +++ b/lib/proxy.c @@ -529,7 +529,7 @@ int proxy_connect(const char *host, int port, b_event_handler func, gpointer dat { struct PHB *phb; - if (!host || !port || (port == -1) || !func || strlen(host) > 128) { + if (!host || port <= 0 || !func || strlen(host) > 128) { return -1; } @@ -537,7 +537,7 @@ int proxy_connect(const char *host, int port, b_event_handler func, gpointer dat phb->func = func; phb->data = data; - if ((proxytype == PROXY_NONE) || strlen(proxyhost) > 0 || !proxyport || (proxyport == -1)) + if (proxytype == PROXY_NONE || !proxyhost[0] || proxyport <= 0) return proxy_connect_none(host, port, phb); else if (proxytype == PROXY_HTTP) return proxy_connect_http(host, port, phb); -- cgit v1.2.3 From bfe7caaa8f7ec37506668b375bfa026b3349a6a6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 24 Mar 2008 13:55:25 +0000 Subject: Updated doc/CHANGES. --- doc/CHANGES | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/CHANGES b/doc/CHANGES index 65947617..4e9f72ab 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,14 @@ +Version 1.2.1: +- Fixed proxy support. +- Fixed stalling issues while connecting to Jabber when using the OpenSSL + module. +- Fixed problem with GLib and ForkDaemon where processes didn't die when + the client disconnects. +- Fixed handling of "set charset none". (Which pretty much breaks the account + completely in 1.2.) + +Finished ... + Version 1.2: - Added ForkDaemon mode next to the existing Daemon- and inetd modes. With ForkDaemon you can run BitlBee as a stand-alone daemon and every connection -- cgit v1.2.3 From 66c51bbf19a599e3fffd2e3dbb5aae829e15af59 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 24 Mar 2008 19:11:29 +0000 Subject: Updated debian/changelog, I hope this will be a good 1.2-2 package. --- debian/changelog | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6c725964..ba68e0e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,9 +2,8 @@ bitlbee (1.2-2) unstable; urgency=low * Fixed some packaging issues reported by IRC and e-mail. (Closes: #472373) * Fixed proxy support. (Closes: #472395) - * Not ready yet. - -- Wilmer van der Gaast Sun, 23 Mar 2008 21:51:57 +0000 + -- Wilmer van der Gaast Mon, 24 Mar 2008 19:10:46 +0000 bitlbee (1.2-1) unstable; urgency=low -- cgit v1.2.3 From 628e6018a8387603e67f4ce1c8b3b67126408726 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 24 Mar 2008 19:48:36 +0000 Subject: Some more changes for 1.2-2: Adding a bitlbee group for extra security and small stuff. --- debian/bitlbee.init | 2 +- debian/changelog | 6 +++++- debian/postinst | 16 ++++++++++++---- debian/postrm | 4 +++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/debian/bitlbee.init b/debian/bitlbee.init index baf1a0c6..51b807f5 100755 --- a/debian/bitlbee.init +++ b/debian/bitlbee.init @@ -36,7 +36,7 @@ d_start() { chown bitlbee /var/run/bitlbee.pid start-stop-daemon --start --quiet --pidfile $PIDFILE \ - -c bitlbee -g nogroup \ + -c bitlbee: \ --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $DAEMON_OPT } diff --git a/debian/changelog b/debian/changelog index ba68e0e4..b043c13a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,12 @@ bitlbee (1.2-2) unstable; urgency=low * Fixed some packaging issues reported by IRC and e-mail. (Closes: #472373) * Fixed proxy support. (Closes: #472395) + * Added a BitlBee group so only root can edit the configs and BitlBee can + just *read* it. + * Manually deleting /var/lib/bitlbee/ when purging, deluser doesn't want to + do it. - -- Wilmer van der Gaast Mon, 24 Mar 2008 19:10:46 +0000 + -- Wilmer van der Gaast Mon, 24 Mar 2008 19:48:24 +0000 bitlbee (1.2-1) unstable; urgency=low diff --git a/debian/postinst b/debian/postinst index 1a906474..80249bfe 100755 --- a/debian/postinst +++ b/debian/postinst @@ -73,13 +73,21 @@ if [ -d $CONFDIR ] && chown -R bitlbee $CONFDIR; then exit 0 fi -adduser --system --home /var/lib/bitlbee/ --disabled-login --disabled-password bitlbee +adduser --system --group --disabled-login --disabled-password --home /var/lib/bitlbee/ bitlbee chmod 700 /var/lib/bitlbee/ ## Can't do this in packaging phase: Don't know the UID yet. Access to -## the file should be limited, now that it stores passwords. -chmod 600 /etc/bitlbee/bitlbee.conf -chown bitlbee /etc/bitlbee/bitlbee.conf +## the file should be limited, now that it stores passwords. Added +## --group later for a little more security, but have to see if I can +## apply this change to existing installations on upgrades. Will think +## about that later. +if getent group bitlbee > /dev/null; then + chmod 640 /etc/bitlbee/bitlbee.conf + chown root:bitlbee /etc/bitlbee/bitlbee.conf +else + chmod 600 /etc/bitlbee/bitlbee.conf + chown bitlbee /etc/bitlbee/bitlbee.conf +fi if [ -z "$2" ]; then /etc/init.d/bitlbee start diff --git a/debian/postrm b/debian/postrm index f7686e7b..5c3b4b2e 100755 --- a/debian/postrm +++ b/debian/postrm @@ -8,5 +8,7 @@ if [ -e /usr/share/debconf/confmodule ]; then fi update-rc.d bitlbee remove > /dev/null 2>&1 || true -deluser --system --remove-home bitlbee || true rm -f /etc/default/bitlbee + +deluser --system --remove-home bitlbee || true +rm -rf /var/lib/bitlbee ## deluser doesn't seem to do this for homedirs in /var -- cgit v1.2.3 From 483f8dd1042e89e02a0eb736f65885e9f74a344d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 24 Mar 2008 21:13:23 +0000 Subject: Removed DEB_BUILD_OPTIONS because it turns out this isn't just some string I can pass through to configure, there's an official policy on what can be in there exactly. (Or at least I found a suggested policy on the debian- policy mailing list.) 1.2-3, because I just uploaded -2 already. :-( --- debian/changelog | 8 ++++++++ debian/rules | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index b043c13a..1d266c0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +bitlbee (1.2-3) unstable; urgency=low + + * Removed DEB_BUILD_OPTIONS again (forgot to apply that change to the 1.2 + branch when I finished 1.0.4-2, things diverged too much anyway.) + Closes: #472540. + + -- Wilmer van der Gaast Mon, 24 Mar 2008 21:10:14 +0000 + bitlbee (1.2-2) unstable; urgency=low * Fixed some packaging issues reported by IRC and e-mail. (Closes: #472373) diff --git a/debian/rules b/debian/rules index 0c757899..252fb742 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ endif build-arch: build-arch-stamp build-arch-stamp: if [ ! -d debian ]; then exit 1; fi - ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent $(DEB_BUILD_OPTIONS) + ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent $(MAKE) # $(MAKE) -C doc/ all touch build-arch-stamp -- cgit v1.2.3 From 0281c4598b396e837342c6fa6465bc709fc068a3 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 29 Mar 2008 21:01:09 +0000 Subject: s/DAEMON_OPT/BITLBEE_OPTS/ so the init script will actually pick up flags from /etc/default/bitlbee. --- debian/bitlbee.init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/bitlbee.init b/debian/bitlbee.init index 51b807f5..62b57b13 100755 --- a/debian/bitlbee.init +++ b/debian/bitlbee.init @@ -17,7 +17,7 @@ SCRIPTNAME=/etc/init.d/$NAME # Default value BITLBEE_PORT=6667 -DAEMON_OPT=-F +BITLBEE_OPTS=-F # Read config file if it is present. if [ -r /etc/default/$NAME ]; then @@ -37,7 +37,7 @@ d_start() { start-stop-daemon --start --quiet --pidfile $PIDFILE \ -c bitlbee: \ - --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $DAEMON_OPT + --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS } # -- cgit v1.2.3 From e74c7fe11099e45da9a17b4d791162d57d2768f8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 29 Mar 2008 21:11:23 +0000 Subject: Added dependency information to the init script, and updated changelog. --- debian/bitlbee.init | 7 +++++++ debian/changelog | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/debian/bitlbee.init b/debian/bitlbee.init index 62b57b13..904ae5ea 100755 --- a/debian/bitlbee.init +++ b/debian/bitlbee.init @@ -1,4 +1,11 @@ #! /bin/sh +### BEGIN INIT INFO +# Provides: bitlbee +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +### END INIT INFO # # Init script for BitlBee Debian package. Based on skeleton init script: # diff --git a/debian/changelog b/debian/changelog index 1d266c0c..b964ee0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +bitlbee (1.2-4) unstable; urgency=low + + * Not a real release, just a placeholder for the changelog. + * Fixed init script to use the BITLBEE_OPTS variable, not an undefined + DAEMON_OPT. + * Added dependency information to the init script. (Closes: #472567) + + -- Wilmer van der Gaast Sat, 29 Mar 2008 21:10:33 +0000 + bitlbee (1.2-3) unstable; urgency=low * Removed DEB_BUILD_OPTIONS again (forgot to apply that change to the 1.2 -- cgit v1.2.3 From a199d33ed818820ffba328f718799bbd77392f6a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 29 Mar 2008 22:19:17 +0000 Subject: Closing bug #209: The PASS command can now be used to identify yourself to BitlBee. The advantage: No more messing with NickServ hooks. Just set a server password. --- irc.c | 17 ++++++++++++++++- irc.h | 4 +++- irc_commands.c | 24 +++++++++++++++++++++--- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/irc.c b/irc.c index 3589256e..fa0c03fe 100644 --- a/irc.c +++ b/irc.c @@ -735,12 +735,27 @@ void irc_login( irc_t *irc ) u->online = 1; irc_spawn( irc, u ); - irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQs are answered there." ); + irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n" + "If you've never used BitlBee before, please do read the help " + "information using the \x02help\x02 command. Lots of FAQs are " + "answered there.\n" + "If you already have an account on this server, just use the " + "\x02identify\x02 command to identify yourself." ); if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON ) ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname ); irc->status |= USTATUS_LOGGED_IN; + + /* This is for bug #209 (use PASS to identify to NickServ). */ + if( irc->password != NULL ) + { + char *send_cmd[] = { "identify", g_strdup( irc->password ), NULL }; + + irc_setpass( irc, NULL ); + root_command( irc, send_cmd ); + g_free( send_cmd[1] ); + } } void irc_motd( irc_t *irc ) diff --git a/irc.h b/irc.h index eb70ad1c..eaf531b7 100644 --- a/irc.h +++ b/irc.h @@ -68,7 +68,9 @@ typedef struct irc char *user; char *host; char *realname; - char *password; + char *password; /* HACK: Used to save the user's password, but before + logging in, this may contain a password we should + send to identify after USER/NICK are received. */ char umode[8]; diff --git a/irc_commands.c b/irc_commands.c index b8bae541..61517614 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -29,7 +29,19 @@ static void irc_cmd_pass( irc_t *irc, char **cmd ) { - if( global.conf->auth_pass && + if( irc->status & USTATUS_LOGGED_IN ) + { + char *send_cmd[] = { "identify", cmd[1], NULL }; + + /* We're already logged in, this client seems to send the PASS + command last. (Possibly it won't send it at all if it turns + out we don't require it, which will break this feature.) + Try to identify using the given password. */ + return root_command( irc, send_cmd ); + } + /* Handling in pre-logged-in state, first see if this server is + password-protected: */ + else if( global.conf->auth_pass && ( strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : strcmp( cmd[1], global.conf->auth_pass ) == 0 ) ) @@ -37,10 +49,16 @@ static void irc_cmd_pass( irc_t *irc, char **cmd ) irc->status |= USTATUS_AUTHORIZED; irc_check_login( irc ); } - else + else if( global.conf->auth_pass ) { irc_reply( irc, 464, ":Incorrect password" ); } + else + { + /* Remember the password and try to identify after USER/NICK. */ + irc_setpass( irc, cmd[1] ); + irc_check_login( irc ); + } } static void irc_cmd_user( irc_t *irc, char **cmd ) @@ -580,7 +598,7 @@ static void irc_cmd_rehash( irc_t *irc, char **cmd ) } static const command_t irc_commands[] = { - { "pass", 1, irc_cmd_pass, IRC_CMD_PRE_LOGIN }, + { "pass", 1, irc_cmd_pass, 0 }, { "user", 4, irc_cmd_user, IRC_CMD_PRE_LOGIN }, { "nick", 1, irc_cmd_nick, 0 }, { "quit", 0, irc_cmd_quit, 0 }, -- cgit v1.2.3 From 18ff38fad0d6d47853fb43ec5a99b29ba031a8ca Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 29 Mar 2008 23:15:04 +0000 Subject: Be more liberal with accepted line endings. ERC on Windows likes to use "\r\r\n", for example, and until now BitlBee only chopped off the \r\n, leaving the first \r as part of the command, which means it couldn't log in to BitlBee at all. (Bad character in nickname.) --- irc.c | 54 ++++++++++++++++++++++++++---------------------------- tests/check_irc.c | 4 ++-- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/irc.c b/irc.c index fa0c03fe..99f0de9a 100644 --- a/irc.c +++ b/irc.c @@ -296,9 +296,8 @@ void irc_process( irc_t *irc ) { char conv[IRC_MAX_LINE+1]; - /* [WvG] Because irc_tokenize splits at every newline, the lines[] list - should end with an empty string. This is why this actually works. - Took me a while to figure out, Maurits. :-P */ + /* [WvG] If the last line isn't empty, it's an incomplete line and we + should wait for the rest to come in before processing it. */ if( lines[i+1] == NULL ) { temp = g_strdup( lines[i] ); @@ -368,42 +367,41 @@ void irc_process( irc_t *irc ) contains an incomplete line at the end, ends with an empty string. */ char **irc_tokenize( char *buffer ) { - int i, j; + int i, j, n = 3; char **lines; - /* Count the number of elements we're gonna need. */ - for( i = 0, j = 1; buffer[i] != '\0'; i ++ ) - { - if( buffer[i] == '\n' ) - if( buffer[i+1] != '\r' && buffer[i+1] != '\n' ) - j ++; - } - - /* Allocate j+1 elements. */ - lines = g_new( char *, j + 1 ); - - /* NULL terminate our list. */ - lines[j] = NULL; + /* Allocate n+1 elements. */ + lines = g_new( char *, n + 1 ); lines[0] = buffer; - /* Split the buffer in several strings, using \r\n as our seperator, where \r is optional. - * Although this is not in the RFC, some braindead ircds (newnet's) use this, so some clients might too. - */ - for( i = 0, j = 0; buffer[i] != '\0'; i ++) + /* Split the buffer in several strings, and accept any kind of line endings, + * knowing that ERC on Windows may send something interesting like \r\r\n, + * and surely there must be clients that think just \n is enough... */ + for( i = 0, j = 0; buffer[i] != '\0'; i ++ ) { - if( buffer[i] == '\n' ) + if( buffer[i] == '\r' || buffer[i] == '\n' ) { - buffer[i] = '\0'; + while( buffer[i] == '\r' || buffer[i] == '\n' ) + buffer[i++] = '\0'; - if( i > 0 && buffer[i-1] == '\r' ) - buffer[i-1] = '\0'; - if( buffer[i+1] != '\r' && buffer[i+1] != '\n' ) - lines[++j] = buffer + i + 1; + lines[++j] = buffer + i; + + if( j >= n ) + { + n *= 2; + lines = g_renew( char *, lines, n + 1 ); + } + + if( buffer[i] == '\0' ) + break; } } - return( lines ); + /* NULL terminate our list. */ + lines[++j] = NULL; + + return lines; } /* Split an IRC-style line into little parts/arguments. */ diff --git a/tests/check_irc.c b/tests/check_irc.c index c1cf05a5..66fe0021 100644 --- a/tests/check_irc.c +++ b/tests/check_irc.c @@ -36,8 +36,8 @@ START_TEST(test_login) irc = irc_new(g_io_channel_unix_get_fd(ch1)); - fail_unless(g_io_channel_write_chars(ch2, "NICK bla\r\n" - "USER a a a a\r\n", -1, NULL, NULL) == G_IO_STATUS_NORMAL); + fail_unless(g_io_channel_write_chars(ch2, "NICK bla\r\r\n" + "USER a a a a\n", -1, NULL, NULL) == G_IO_STATUS_NORMAL); fail_unless(g_io_channel_flush(ch2, NULL) == G_IO_STATUS_NORMAL); g_main_iteration(FALSE); -- cgit v1.2.3 From 5ecf96b935c6f6c0fba00d84cf7616ee04b06aed Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 30 Mar 2008 17:15:15 +0100 Subject: Updated doc/CHANGES again. --- doc/CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/CHANGES b/doc/CHANGES index 4e9f72ab..93ad35e2 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -6,6 +6,9 @@ Version 1.2.1: the client disconnects. - Fixed handling of "set charset none". (Which pretty much breaks the account completely in 1.2.) +- You can now automatically identify yourself to BitlBee by setting a server + password in your IRC client. +- Compatible with all crazy kinds of line endings that clients can send. Finished ... -- cgit v1.2.3 From f9756bd2e2711d58e06ad2a33ad3292ff10fc6da Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 30 Mar 2008 22:26:16 +0100 Subject: Changed charset handling: irc_t keeps two iconv structures, which are just used for every line sent and received, so now there's no need to use g_iconv_open() every time a message comes in/out. Also, fixed a small memory leak that was there for a long time but somehow never caught my attention. --- irc.c | 102 ++++++++++++++++++++++++++++++++++++++++++++------------- irc.h | 1 + irc_commands.c | 3 +- set.c | 15 --------- set.h | 1 - 5 files changed, 81 insertions(+), 41 deletions(-) diff --git a/irc.c b/irc.c index 99f0de9a..2faa2bc1 100644 --- a/irc.c +++ b/irc.c @@ -41,6 +41,35 @@ static char *passchange( set_t *set, char *value ) return NULL; } +static char *set_eval_charset( set_t *set, char *value ) +{ + irc_t *irc = set->data; + GIConv ic, oc; + + if( g_strcasecmp( value, "none" ) == 0 ) + value = g_strdup( "utf-8" ); + + if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 ) + { + return NULL; + } + if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 ) + { + g_iconv_close( ic ); + return NULL; + } + + if( irc->iconv != (GIConv) -1 ) + g_iconv_close( irc->iconv ); + if( irc->oconv != (GIConv) -1 ) + g_iconv_close( irc->oconv ); + + irc->iconv = ic; + irc->oconv = oc; + + return value; +} + irc_t *irc_new( int fd ) { irc_t *irc; @@ -64,6 +93,9 @@ irc_t *irc_new( int fd ) irc->mynick = g_strdup( ROOT_NICK ); irc->channel = g_strdup( ROOT_CHAN ); + irc->iconv = (GIConv) -1; + irc->oconv = (GIConv) -1; + if( global.conf->hostname ) { irc->myhost = g_strdup( global.conf->hostname ); @@ -126,6 +158,9 @@ irc_t *irc_new( int fd ) conf_loaddefaults( irc ); + /* Evaluator sets the iconv/oconv structures. */ + set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) ); + return( irc ); } @@ -264,6 +299,13 @@ void irc_free(irc_t * irc) g_hash_table_foreach_remove(irc->watches, irc_free_hashkey, NULL); g_hash_table_destroy(irc->watches); + if( irc->iconv != (GIConv) -1 ) + g_iconv_close( irc->iconv ); + if( irc->oconv != (GIConv) -1 ) + g_iconv_close( irc->oconv ); + + g_free( irc->last_target ); + g_free(irc); if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) @@ -285,7 +327,7 @@ void irc_setpass (irc_t *irc, const char *pass) void irc_process( irc_t *irc ) { - char **lines, *temp, **cmd, *cs; + char **lines, *temp, **cmd; int i; if( irc->readbuffer != NULL ) @@ -294,7 +336,7 @@ void irc_process( irc_t *irc ) for( i = 0; *lines[i] != '\0'; i ++ ) { - char conv[IRC_MAX_LINE+1]; + char *conv = NULL; /* [WvG] If the last line isn't empty, it's an incomplete line and we should wait for the rest to come in before processing it. */ @@ -307,10 +349,14 @@ void irc_process( irc_t *irc ) break; } - if( ( cs = set_getstr( &irc->set, "charset" ) ) && g_strcasecmp( cs, "none" ) != 0 ) + if( irc->iconv != (GIConv) -1 ) { - conv[IRC_MAX_LINE] = 0; - if( do_iconv( cs, "UTF-8", lines[i], conv, 0, IRC_MAX_LINE - 2 ) == -1 ) + gsize bytes_read, bytes_written; + + conv = g_convert_with_iconv( lines[i], -1, irc->iconv, + &bytes_read, &bytes_written, NULL ); + + if( conv == NULL || bytes_read != strlen( lines[i] ) ) { /* GLib can do strange things if things are not in the expected charset, so let's be a little bit paranoid here: */ @@ -322,15 +368,18 @@ void irc_process( irc_t *irc ) "that charset, or tell BitlBee which charset to " "expect by changing the charset setting. See " "`help set charset' for more information. Your " - "message was ignored.", cs ); - *conv = 0; + "message was ignored.", + set_getstr( &irc->set, "charset" ) ); + + g_free( conv ); + conv = NULL; } else { irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, "Warning: invalid characters received at login time." ); - strncpy( conv, lines[i], IRC_MAX_LINE ); + conv = g_strdup( lines[i] ); for( temp = conv; *temp; temp ++ ) if( *temp & 0x80 ) *temp = '?'; @@ -339,11 +388,15 @@ void irc_process( irc_t *irc ) lines[i] = conv; } - if( ( cmd = irc_parse_line( lines[i] ) ) == NULL ) - continue; - irc_exec( irc, cmd ); + if( lines[i] ) + { + if( ( cmd = irc_parse_line( lines[i] ) ) == NULL ) + continue; + irc_exec( irc, cmd ); + g_free( cmd ); + } - g_free( cmd ); + g_free( conv ); /* Shouldn't really happen, but just in case... */ if( !g_slist_find( irc_connection_list, irc ) ) @@ -535,32 +588,35 @@ void irc_write( irc_t *irc, char *format, ... ) va_end( params ); return; - } void irc_vawrite( irc_t *irc, char *format, va_list params ) { int size; - char line[IRC_MAX_LINE+1], *cs; + char line[IRC_MAX_LINE+1]; /* Don't try to write anything new anymore when shutting down. */ if( irc->status & USTATUS_SHUTDOWN ) return; - line[IRC_MAX_LINE] = 0; + memset( line, 0, sizeof( line ) ); g_vsnprintf( line, IRC_MAX_LINE - 2, format, params ); - strip_newlines( line ); - if( ( cs = set_getstr( &irc->set, "charset" ) ) && - g_strcasecmp( cs, "none" ) != 0 && g_strcasecmp( cs, "utf-8" ) != 0 ) + + if( irc->oconv != (GIConv) -1 ) { - char conv[IRC_MAX_LINE+1]; + gsize bytes_read, bytes_written; + char *conv; + + conv = g_convert_with_iconv( line, -1, irc->oconv, + &bytes_read, &bytes_written, NULL ); + + if( bytes_read == strlen( line ) ) + strncpy( line, conv, IRC_MAX_LINE - 2 ); - conv[IRC_MAX_LINE] = 0; - if( do_iconv( "UTF-8", cs, line, conv, 0, IRC_MAX_LINE - 2 ) != -1 ) - strcpy( line, conv ); + g_free( conv ); } - strcat( line, "\r\n" ); + g_strlcat( line, "\r\n", IRC_MAX_LINE + 1 ); if( irc->sendbuffer != NULL ) { diff --git a/irc.h b/irc.h index eaf531b7..b8c52925 100644 --- a/irc.h +++ b/irc.h @@ -60,6 +60,7 @@ typedef struct irc int pinging; char *sendbuffer; char *readbuffer; + GIConv iconv, oconv; int sentbytes; time_t oldtime; diff --git a/irc_commands.c b/irc_commands.c index 61517614..6a47007a 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -277,8 +277,7 @@ static void irc_cmd_privmsg( irc_t *irc, char **cmd ) if( cmd[1] != irc->last_target ) { - if( irc->last_target ) - g_free( irc->last_target ); + g_free( irc->last_target ); irc->last_target = g_strdup( cmd[1] ); } } diff --git a/set.c b/set.c index 90b29f91..112e6937 100644 --- a/set.c +++ b/set.c @@ -229,18 +229,3 @@ char *set_eval_ops( set_t *set, char *value ) return value; } - -char *set_eval_charset( set_t *set, char *value ) -{ - GIConv cd; - - if( g_strcasecmp( value, "none" ) == 0 ) - return value; - - cd = g_iconv_open( "UTF-8", value ); - if( cd == (GIConv) -1 ) - return NULL; - - g_iconv_close( cd ); - return value; -} diff --git a/set.h b/set.h index 7dcbb869..8c722877 100644 --- a/set.h +++ b/set.h @@ -96,6 +96,5 @@ char *set_eval_bool( set_t *set, char *value ); /* Some not very generic evaluators that really shouldn't be here... */ char *set_eval_to_char( set_t *set, char *value ); char *set_eval_ops( set_t *set, char *value ); -char *set_eval_charset( set_t *set, char *value ); #endif /* __SET_H__ */ -- cgit v1.2.3 From ddba0aea68f90b06bb6278cada982eb88889c31c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 30 Mar 2008 22:28:39 +0100 Subject: Removing speech, in case I forget before 1.2.1. --- doc/RELEASE-SPEECH-1.2 | 57 -------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 doc/RELEASE-SPEECH-1.2 diff --git a/doc/RELEASE-SPEECH-1.2 b/doc/RELEASE-SPEECH-1.2 deleted file mode 100644 index ec7c48b4..00000000 --- a/doc/RELEASE-SPEECH-1.2 +++ /dev/null @@ -1,57 +0,0 @@ -BitlBee ... is Bitl -------------------- - -"I CAN HAS SPEEECH?" This is how Wilmer announced to me that he was going to do -another BitlBee release. I was as surprised as you are. I thought he had given -up on this whole releasing business. - -There is some humor in using a LOLcats reference to announce a new Bee -release. The last major BitlBee release (1.0) was done a long time before the -hype even begun. Between then and now we've celebrated BitlBee's fifth birthday -and had a handful of releases, but nothing big happened. As a user this lax -release planning worries me. What if this means that later releases will take -even longer? I don't think we should fear this. Let us explore why this release -took so long. - -Personally, I blame Google. - -There, I've said it. Google. The guys who are so big on "Do No Evil" and all -that jazz. They caused this release to be so late. Let me explain why. - -They made Wilmer an offer. Wilmer, being the sillily naive guy he is, couldn't -refuse. There were no decapitated horses involved, but he couldn't refuse -nonetheless. That's not a big problem of course. Lots of guys (and gals, sure) -work for Google. It wouldn't have become a problem if they hadn't shipped him of -to Ireland. That's where the trouble starts. - -Ireland. Home of the leprechauns. These rascals joined forces with aliens and -LOLcats to abduct Wilmer. The aliens had been trying for years to kidnap him, -but they were on his turf and his trusty sidekicks Jelmer and Maurits were there -to help him. All that changed when he moved to Ireland. - -But it wasn't just that Wilmer was all alone in some strange place. It was also -that the aliens had created the LOLcats and made an alliance with the -leprechauns--the real rulers of Ireland. Wilmer is cool, but he's not that -cool. So they abducted him for a few years. When he finally came back, he -regathered his mad coding skills and hacked a new release together. - -By now you're thinking, what has happened to Jelmer and Maurits? Well, they're -still here and they worked on the Bee while Wilmer was absent. But, like open -source, they are very Bitl--they're cool, but they're ready when they're -ready. - -Well, whatever you may think of my little theory, they did take forever to -launch this release. We're not mad at them, because it shows. They have -added some cool new features and made plenty of changes under the hood. Let me -give you a sneak preview of some of the new features: Jabber groupchats are -supported. Configuration files are stored encrypted. You can now use -ForkDaemon mode, which gives better stability over normal daemon mode, but -doesn't require inetd. Also, server owners can now use the /OPER command to -spy on their users. And--as I was specifically asked to mention--this is the -first stable release that supports plugins. That's some Bitl changes for ya. - -BitlBee is cool, but ready when it's ready. Very Bitl. - -Sjoerd. LOL. - -(LOLBee by Erik Bosman.) -- cgit v1.2.3 From fa75134008bd9206ca02380927c27581feb65c3e Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 2 Apr 2008 00:07:21 +0100 Subject: Reordered irc_free() a little bit, hoping that this will fix a crash-on-quit bug I can't figure out. The previous order wasn't optimal. --- account.c | 12 +++---- irc.c | 111 +++++++++++++++++++++++++++++++------------------------------- 2 files changed, 61 insertions(+), 62 deletions(-) diff --git a/account.c b/account.c index 4eb78faa..2c6e1069 100644 --- a/account.c +++ b/account.c @@ -181,19 +181,17 @@ void account_del( irc_t *irc, account_t *acc ) { account_t *a, *l = NULL; + if( acc->ic ) + /* Caller should have checked, accounts still in use can't be deleted. */ + return; + for( a = irc->accounts; a; a = (l=a)->next ) if( a == acc ) { - if( a->ic ) return; /* Caller should have checked, accounts still in use can't be deleted. */ - if( l ) - { l->next = a->next; - } else - { irc->accounts = a->next; - } while( a->set ) set_del( &a->set, a->set->key ); @@ -202,7 +200,7 @@ void account_del( irc_t *irc, account_t *acc ) g_free( a->user ); g_free( a->pass ); - if( a->server ) g_free( a->server ); + g_free( a->server ); if( a->reconnect ) /* This prevents any reconnect still queued to happen */ cancel_auto_reconnect( a ); g_free( a ); diff --git a/irc.c b/irc.c index 2faa2bc1..585cf232 100644 --- a/irc.c +++ b/irc.c @@ -219,9 +219,8 @@ static gboolean irc_free_hashkey( gpointer key, gpointer value, gpointer data ) } /* Because we have no garbage collection, this is quite annoying */ -void irc_free(irc_t * irc) +void irc_free( irc_t * irc ) { - account_t *account; user_t *user, *usertmp; log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd ); @@ -230,83 +229,85 @@ void irc_free(irc_t * irc) if( storage_save( irc, TRUE ) != STORAGE_OK ) irc_usermsg( irc, "Error while saving settings!" ); - closesocket( irc->fd ); - - if( irc->ping_source_id > 0 ) - b_event_remove( irc->ping_source_id ); - b_event_remove( irc->r_watch_source_id ); - if( irc->w_watch_source_id > 0 ) - b_event_remove( irc->w_watch_source_id ); - irc_connection_list = g_slist_remove( irc_connection_list, irc ); - for (account = irc->accounts; account; account = account->next) { - if (account->ic) { - imc_logout(account->ic, TRUE); - } else if (account->reconnect) { - cancel_auto_reconnect(account); - } - } - - g_free(irc->sendbuffer); - g_free(irc->readbuffer); - - g_free(irc->nick); - g_free(irc->user); - g_free(irc->host); - g_free(irc->realname); - g_free(irc->password); - - g_free(irc->myhost); - g_free(irc->mynick); - - g_free(irc->channel); - - while (irc->queries != NULL) - query_del(irc, irc->queries); - - while (irc->accounts) - if (irc->accounts->ic == NULL) - account_del(irc, irc->accounts); + while( irc->accounts ) + { + if( irc->accounts->ic ) + imc_logout( irc->accounts->ic, FALSE ); + else if( irc->accounts->reconnect ) + cancel_auto_reconnect( irc->accounts ); + + if( irc->accounts->ic == NULL ) + account_del( irc, irc->accounts ); else /* Nasty hack, but account_del() doesn't work in this case and we don't want infinite loops, do we? ;-) */ irc->accounts = irc->accounts->next; + } + + while( irc->queries != NULL ) + query_del( irc, irc->queries ); - while (irc->set) - set_del(&irc->set, irc->set->key); + while( irc->set ) + set_del( &irc->set, irc->set->key ); - if (irc->users != NULL) { + if (irc->users != NULL) + { user = irc->users; - while (user != NULL) { - g_free(user->nick); - g_free(user->away); - g_free(user->handle); - if(user->user!=user->nick) g_free(user->user); - if(user->host!=user->nick) g_free(user->host); - if(user->realname!=user->nick) g_free(user->realname); - b_event_remove(user->sendbuf_timer); + while( user != NULL ) + { + g_free( user->nick ); + g_free( user->away ); + g_free( user->handle ); + if( user->user != user->nick ) g_free( user->user ); + if( user->host != user->nick ) g_free( user->host ); + if( user->realname != user->nick ) g_free( user->realname ); + b_event_remove( user->sendbuf_timer ); usertmp = user; user = user->next; - g_free(usertmp); + g_free( usertmp ); } } - g_hash_table_foreach_remove(irc->userhash, irc_free_hashkey, NULL); - g_hash_table_destroy(irc->userhash); + if( irc->ping_source_id > 0 ) + b_event_remove( irc->ping_source_id ); + b_event_remove( irc->r_watch_source_id ); + if( irc->w_watch_source_id > 0 ) + b_event_remove( irc->w_watch_source_id ); + + closesocket( irc->fd ); + irc->fd = -1; + + g_hash_table_foreach_remove( irc->userhash, irc_free_hashkey, NULL ); + g_hash_table_destroy( irc->userhash ); - g_hash_table_foreach_remove(irc->watches, irc_free_hashkey, NULL); - g_hash_table_destroy(irc->watches); + g_hash_table_foreach_remove( irc->watches, irc_free_hashkey, NULL ); + g_hash_table_destroy( irc->watches ); if( irc->iconv != (GIConv) -1 ) g_iconv_close( irc->iconv ); if( irc->oconv != (GIConv) -1 ) g_iconv_close( irc->oconv ); + g_free( irc->sendbuffer ); + g_free( irc->readbuffer ); + + g_free( irc->nick ); + g_free( irc->user ); + g_free( irc->host ); + g_free( irc->realname ); + g_free( irc->password ); + + g_free( irc->myhost ); + g_free( irc->mynick ); + + g_free( irc->channel ); + g_free( irc->last_target ); - g_free(irc); + g_free( irc ); if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) b_main_quit(); -- cgit v1.2.3 From 31fc3970e53409f71ed7d09e277e0e33461ad571 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 27 Dec 2025 03:21:03 +0100 Subject: Use simpler flags for gcov. --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 22989f60..02f01225 100755 --- a/configure +++ b/configure @@ -374,8 +374,8 @@ else fi if [ "$gcov" = "1" ]; then - echo "CFLAGS+=-ftest-coverage -fprofile-arcs" >> Makefile.settings - echo "EFLAGS+=-lgcov" >> Makefile.settings + echo "CFLAGS+=--coverage" >> Makefile.settings + echo "EFLAGS+=--coverage" >> Makefile.settings fi if [ "$plugins" = 0 ]; then -- cgit v1.2.3 From e942df125bf47b2cb0f20bed2d5cd6c18b330118 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 27 Dec 2025 03:22:45 +0100 Subject: Ignore coverage output dir. --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 12dd9c10..7f9796b9 100644 --- a/.bzrignore +++ b/.bzrignore @@ -16,3 +16,4 @@ tests/check *.gcov *.gcno *.o +coverage -- cgit v1.2.3 From 0db75ad966458610427dacdd31ecbaddbca18935 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 27 Dec 2025 03:25:31 +0100 Subject: Ignore lcov output data. --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 7f9796b9..7d0ad548 100644 --- a/.bzrignore +++ b/.bzrignore @@ -17,3 +17,4 @@ tests/check *.gcno *.o coverage +bitlbee.info -- cgit v1.2.3 From 5f5d433900a0eaec54edcd64ab8be0fc2384aa94 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 16:17:37 +0200 Subject: Use GLib functions to check whether files exist, for extra portability. --- bitlbee.h | 4 ---- storage_xml.c | 7 ++++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bitlbee.h b/bitlbee.h index 420ab70a..87fe4fac 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -94,10 +94,6 @@ #undef g_main_quit #define g_main_quit __PLEASE_USE_B_MAIN_QUIT__ -#ifndef F_OK -#define F_OK 0 -#endif - #ifndef G_GNUC_MALLOC /* Doesn't exist in GLib <=2.4 while everything else in BitlBee should work with it, so let's fake this one. */ diff --git a/storage_xml.c b/storage_xml.c index f37fce44..ab7da6e3 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -28,6 +28,7 @@ #include "base64.h" #include "arc.h" #include "md5.h" +#include typedef enum { @@ -242,9 +243,9 @@ GMarkupParser xml_parser = static void xml_init( void ) { - if( access( global.conf->configdir, F_OK ) != 0 ) + if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) ) log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); - else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 ) + else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || g_access( global.conf->configdir, W_OK ) != 0 ) log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); } @@ -371,7 +372,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite ) g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, path2, ".xml" ); g_free( path2 ); - if( !overwrite && access( path, F_OK ) != -1 ) + if( !overwrite && g_file_test( path, G_FILE_TEST_EXISTS ) ) return STORAGE_ALREADY_EXISTS; strcat( path, "~" ); -- cgit v1.2.3 From 4af7b4fa9b0cc85ea8b7a00f748c324d5f56b47b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 16:34:57 +0200 Subject: Use pkg-config file for gnutls if possible. This allows building against a gnutls built for a an architecture other than the host architecture. --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 22989f60..9b393156 100755 --- a/configure +++ b/configure @@ -212,7 +212,14 @@ echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings detect_gnutls() { - if libgnutls-config --version > /dev/null 2> /dev/null; then + if $PKG_CONFIG --exists gnutls; then + cat <>Makefile.settings +EFLAGS+=`$PKG_CONFIG --libs gnutls` +CFLAGS+=`$PKG_CONFIG --cflags gnutls` +EOF + ssl=gnutls + ret=1 + elif libgnutls-config --version > /dev/null 2> /dev/null; then cat <>Makefile.settings EFLAGS+=`libgnutls-config --libs` CFLAGS+=`libgnutls-config --cflags` -- cgit v1.2.3 From 5be87b2e736962dce2576012b7f1cf215f169f34 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 17:03:02 +0200 Subject: Move unix-specific random_bytes() implementation to unix.c. --- lib/misc.c | 65 ------------------------------------------------------------ unix.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 65 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index ccf208b5..1670b91d 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -391,71 +391,6 @@ signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t si return( outbuf - dst ); } -/* A pretty reliable random number generator. Tries to use the /dev/random - devices first, and falls back to the random number generator from libc - when it fails. Opens randomizer devices with O_NONBLOCK to make sure a - lack of entropy won't halt BitlBee. */ -void random_bytes( unsigned char *buf, int count ) -{ - static int use_dev = -1; - - /* Actually this probing code isn't really necessary, is it? */ - if( use_dev == -1 ) - { - if( access( "/dev/random", R_OK ) == 0 || access( "/dev/urandom", R_OK ) == 0 ) - use_dev = 1; - else - { - use_dev = 0; - srand( ( getpid() << 16 ) ^ time( NULL ) ); - } - } - - if( use_dev ) - { - int fd; - - /* At least on Linux, /dev/random can block if there's not - enough entropy. We really don't want that, so if it can't - give anything, use /dev/urandom instead. */ - if( ( fd = open( "/dev/random", O_RDONLY | O_NONBLOCK ) ) >= 0 ) - if( read( fd, buf, count ) == count ) - { - close( fd ); - return; - } - close( fd ); - - /* urandom isn't supposed to block at all, but just to be - sure. If it blocks, we'll disable use_dev and use the libc - randomizer instead. */ - if( ( fd = open( "/dev/urandom", O_RDONLY | O_NONBLOCK ) ) >= 0 ) - if( read( fd, buf, count ) == count ) - { - close( fd ); - return; - } - close( fd ); - - /* If /dev/random blocks once, we'll still try to use it - again next time. If /dev/urandom also fails for some - reason, stick with libc during this session. */ - - use_dev = 0; - srand( ( getpid() << 16 ) ^ time( NULL ) ); - } - - if( !use_dev ) - { - int i; - - /* Possibly the LSB of rand() isn't very random on some - platforms. Seems okay on at least Linux and OSX though. */ - for( i = 0; i < count; i ++ ) - buf[i] = rand() & 0xff; - } -} - int is_bool( char *value ) { if( *value == 0 ) diff --git a/unix.c b/unix.c index d25aeb2e..39ca5732 100644 --- a/unix.c +++ b/unix.c @@ -218,3 +218,70 @@ double gettime() gettimeofday( time, 0 ); return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); } + +/* A pretty reliable random number generator. Tries to use the /dev/random + devices first, and falls back to the random number generator from libc + when it fails. Opens randomizer devices with O_NONBLOCK to make sure a + lack of entropy won't halt BitlBee. */ +void random_bytes( unsigned char *buf, int count ) +{ + static int use_dev = -1; + + /* Actually this probing code isn't really necessary, is it? */ + if( use_dev == -1 ) + { + if( access( "/dev/random", R_OK ) == 0 || access( "/dev/urandom", R_OK ) == 0 ) + use_dev = 1; + else + { + use_dev = 0; + srand( ( getpid() << 16 ) ^ time( NULL ) ); + } + } + + if( use_dev ) + { + int fd; + + /* At least on Linux, /dev/random can block if there's not + enough entropy. We really don't want that, so if it can't + give anything, use /dev/urandom instead. */ + if( ( fd = open( "/dev/random", O_RDONLY | O_NONBLOCK ) ) >= 0 ) + if( read( fd, buf, count ) == count ) + { + close( fd ); + return; + } + close( fd ); + + /* urandom isn't supposed to block at all, but just to be + sure. If it blocks, we'll disable use_dev and use the libc + randomizer instead. */ + if( ( fd = open( "/dev/urandom", O_RDONLY | O_NONBLOCK ) ) >= 0 ) + if( read( fd, buf, count ) == count ) + { + close( fd ); + return; + } + close( fd ); + + /* If /dev/random blocks once, we'll still try to use it + again next time. If /dev/urandom also fails for some + reason, stick with libc during this session. */ + + use_dev = 0; + srand( ( getpid() << 16 ) ^ time( NULL ) ); + } + + if( !use_dev ) + { + int i; + + /* Possibly the LSB of rand() isn't very random on some + platforms. Seems okay on at least Linux and OSX though. */ + for( i = 0; i < count; i ++ ) + buf[i] = rand() & 0xff; + } +} + + -- cgit v1.2.3 From 0a14b8cb44e199e39e04e04d0be1b74b660e7447 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 17:03:37 +0200 Subject: Remove no longer needed functions. --- sock.h | 4 +- win32.c | 381 ++-------------------------------------------------------------- 2 files changed, 9 insertions(+), 376 deletions(-) diff --git a/sock.h b/sock.h index 744099d0..848dc466 100644 --- a/sock.h +++ b/sock.h @@ -15,9 +15,7 @@ #endif #else # include -# ifdef IPV6 -# include -# endif +# include # if !defined(BITLBEE_CORE) && defined(_MSC_VER) # pragma comment(lib,"bitlbee.lib") # endif diff --git a/win32.c b/win32.c index 511deb23..d741e294 100644 --- a/win32.c +++ b/win32.c @@ -55,8 +55,8 @@ static void bitlbee_init(int argc, char **argv) { int i = -1; memset( &global, 0, sizeof( global_t ) ); - - global.loop = g_main_new( FALSE ); + + b_main_init(); global.conf = conf_load( argc, argv ); if( global.conf == NULL ) @@ -85,7 +85,7 @@ static void bitlbee_init(int argc, char **argv) log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir ); else if( access( global.conf->configdir, 06 ) != 0 ) log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir ); - if( help_init( &(global.help) ) == NULL ) + if( help_init( &(global.help), HELP_FILE ) == NULL ) log_message( LOGLVL_WARNING, "Error opening helpfile %s.", global.helpfile ); } @@ -106,7 +106,7 @@ void service_main (DWORD argc, LPTSTR *argv) SetServiceStatus(handle, &status); - g_main_run( global.loop ); + b_main_run( ); } SERVICE_TABLE_ENTRY dispatch_table[] = @@ -146,7 +146,7 @@ int main( int argc, char **argv) log_message( LOGLVL_ERROR, "StartServiceCtrlDispatcher failed."); } else { bitlbee_init(argc, argv); - g_main_run( global.loop ); + b_main_run(); } return 0; @@ -195,12 +195,12 @@ conf_t *conf_load( int argc, char *argv[] ) RegOpenKey(key, "proxy", &key_proxy); memset( &global, 0, sizeof( global_t ) ); - global.loop = g_main_new(FALSE); + b_main_init(); conf = g_new0( conf_t,1 ); global.conf = conf; conf_get_string(key_main, "interface", "0.0.0.0", &global.conf->iface); - conf_get_int(key_main, "port", 6667, &global.conf->port); + conf_get_string(key_main, "port", "6667", &global.conf->port); conf_get_int(key_main, "verbose", 0, &global.conf->verbose); conf_get_string(key_main, "auth_pass", "", &global.conf->auth_pass); conf_get_string(key_main, "oper_pass", "", &global.conf->oper_pass); @@ -236,7 +236,7 @@ void conf_loaddefaults( irc_t *irc ) } for (i = 0; RegEnumValue(key_defaults, i, name, &namelen, NULL, &type, data, &datalen) == ERROR_SUCCESS; i++) { - set_t *s = set_find( irc, name ); + set_t *s = set_find( &irc->set, name ); if( s ) { @@ -316,368 +316,3 @@ void log_message(int level, char *message, ...) } void log_link(int level, int output) { /* FIXME */ } - -#ifndef NS_INADDRSZ -#define NS_INADDRSZ 4 -#endif -#ifndef NS_IN6ADDRSZ -#define NS_IN6ADDRSZ 16 -#endif -#ifndef NS_INT16SZ -#define NS_INT16SZ 2 -#endif - -static const char *inet_ntop4(const guchar *src, char *dst, size_t size); -static const char *inet_ntop6(const guchar *src, char *dst, size_t size); - -/* char * - * inet_ntop(af, src, dst, size) - * convert a network format address to presentation format. - * return: - * pointer to presentation format address (`dst'), or NULL (see errno). - * author: - * Paul Vixie, 1996. - */ -const char * -inet_ntop(af, src, dst, size) - int af; - const void *src; - char *dst; - size_t size; -{ - switch (af) { - case AF_INET: - return (inet_ntop4(src, dst, size)); - case AF_INET6: - return (inet_ntop6(src, dst, size)); - default: - errno = WSAEAFNOSUPPORT; - return (NULL); - } - /* NOTREACHED */ -} - -/* const char * - * inet_ntop4(src, dst, size) - * format an IPv4 address - * return: - * `dst' (as a const) - * notes: - * (1) uses no statics - * (2) takes a u_char* not an in_addr as input - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop4(src, dst, size) - const u_char *src; - char *dst; - size_t size; -{ - static const char fmt[] = "%u.%u.%u.%u"; - char tmp[sizeof "255.255.255.255"]; - int nprinted; - - nprinted = g_snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); - if (nprinted < 0) - return (NULL); /* we assume "errno" was set by "g_snprintf()" */ - if ((size_t)nprinted > size) { - errno = ENOSPC; - return (NULL); - } - strcpy(dst, tmp); - return (dst); -} - -/* const char * - * inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop6(src, dst, size) - const u_char *src; - char *dst; - size_t size; -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; - struct { int base, len; } best, cur; - guint words[NS_IN6ADDRSZ / NS_INT16SZ]; - int i; - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof words); - for (i = 0; i < NS_IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - best.base = -1; - cur.base = -1; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - if (words[i] == 0) { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) - *tp++ = ':'; - continue; - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *tp++ = ':'; - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) - return (NULL); - tp += strlen(tp); - break; - } - tp += g_snprintf(tp, sizeof tmp - (tp - tmp), "%x", words[i]); - } - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == - (NS_IN6ADDRSZ / NS_INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { - errno = ENOSPC; - return (NULL); - } - strcpy(dst, tmp); - return (dst); -} - -#ifdef AF_INET -static int inet_pton4(const char *src, u_char *dst); -#endif -#ifdef AF_INET6 -static int inet_pton6(const char *src, u_char *dst); -#endif - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * author: - * Paul Vixie, 1996. - */ -int -inet_pton(af, src, dst) - int af; - const char *src; - void *dst; -{ - switch (af) { -#ifdef AF_INET - case AF_INET: - return (inet_pton4(src, dst)); -#endif -#ifdef AF_INET6 - case AF_INET6: - return (inet_pton6(src, dst)); -#endif - default: - errno = WSAEAFNOSUPPORT; - return (-1); - } - /* NOTREACHED */ -} - -#ifdef AF_INET -/* int - * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal and shorthand. - * return: - * 1 if `src' is a valid dotted quad, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4(src, dst) - const char *src; - u_char *dst; -{ - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - u_char tmp[NS_INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr(digits, ch)) != NULL) { - u_int new = *tp * 10 + (pch - digits); - - if (new > 255) - return (0); - *tp = new; - if (! saw_digit) { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } else if (ch == '.' && saw_digit) { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } else - return (0); - } - if (octets < 4) - return (0); - memcpy(dst, tmp, NS_INADDRSZ); - return (1); -} -#endif - -#ifdef AF_INET6 -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6(src, dst) - const char *src; - u_char *dst; -{ - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - u_int val; - - memset((tp = tmp), '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') { - curtok = src; - if (!saw_xdigit) { - if (colonp) - return (0); - colonp = tp; - continue; - } else if (*src == '\0') { - return (0); - } - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += NS_INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (saw_xdigit) { - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - } - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - if (tp == endp) - return (0); - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - memcpy(dst, tmp, NS_IN6ADDRSZ); - return (1); -} -#endif -- cgit v1.2.3 From f1e74072b7a69c8ac9dd80c0ca53af72b893b08a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 17:38:34 +0200 Subject: Add --target argument to configure to allow cross-compilation. --- configure | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 22989f60..20a39520 100755 --- a/configure +++ b/configure @@ -73,6 +73,8 @@ Option Description Default --events=... Event handler (glib, libevent) $events --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) $ssl + +--target=... Cross compilation target same as host EOF exit; fi @@ -131,6 +133,13 @@ cat<config.h #define CPU "$cpu" EOF +if [ -n "$target" ]; then + PKG_CONFIG_PATH=/usr/$target/lib/pkgconfig + PATH=/usr/$target/bin:$PATH + CC=$target-cc + LD=$target-ld +fi + if [ "$debug" = "1" ]; then [ -z "$CFLAGS" ] && CFLAGS=-g echo 'DEBUG=1' >> Makefile.settings @@ -157,15 +166,17 @@ fi echo "CC=$CC" >> Makefile.settings; -if [ -n "$LD" ]; then - echo "LD=$LD" >> Makefile.settings; -elif type ld > /dev/null 2> /dev/null; then - echo "LD=ld" >> Makefile.settings; -else - echo 'Cannot find ld, aborting.' - exit 1; +if [ -z "$LD" ]; then + if type ld > /dev/null 2> /dev/null; then + LD=ld + else + echo 'Cannot find ld, aborting.' + exit 1; + fi fi +echo "LD=$LD" >> Makefile.settings + if [ -z "$PKG_CONFIG" ]; then PKG_CONFIG=pkg-config fi @@ -488,6 +499,10 @@ CYGWIN* ) ;; esac +if [ -n "$target" ]; then + echo "Cross-compiling for: $target" +fi + echo echo 'Configuration done:' -- cgit v1.2.3 From 883a398f059f98cb31da77dd6e632e4152dcf87e Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 2 Apr 2008 22:36:02 +0100 Subject: Rearranged some event handling code. --- bitlbee.c | 12 ++++++++---- irc.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bitlbee.c b/bitlbee.c index 59a417f0..230b8ce8 100644 --- a/bitlbee.c +++ b/bitlbee.c @@ -225,12 +225,16 @@ gboolean bitlbee_io_current_client_write( gpointer data, gint fd, b_input_condit if( st == size ) { - g_free( irc->sendbuffer ); - irc->sendbuffer = NULL; - irc->w_watch_source_id = 0; - if( irc->status & USTATUS_SHUTDOWN ) + { irc_free( irc ); + } + else + { + g_free( irc->sendbuffer ); + irc->sendbuffer = NULL; + irc->w_watch_source_id = 0; + } return FALSE; } diff --git a/irc.c b/irc.c index 585cf232..c929d68b 100644 --- a/irc.c +++ b/irc.c @@ -198,12 +198,14 @@ void irc_abort( irc_t *irc, int immed, char *format, ... ) irc->status |= USTATUS_SHUTDOWN; if( irc->sendbuffer && !immed ) { - /* We won't read from this socket anymore. Instead, we'll connect a timer - to it that should shut down the connection in a second, just in case - bitlbee_.._write doesn't do it first. */ + /* Set up a timeout event that should shut down the connection + in a second, just in case ..._write doesn't do it first. */ b_event_remove( irc->r_watch_source_id ); - irc->r_watch_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc ); + irc->r_watch_source_id = 0; + + b_event_remove( irc->ping_source_id ); + irc->ping_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc ); } else { @@ -273,7 +275,8 @@ void irc_free( irc_t * irc ) if( irc->ping_source_id > 0 ) b_event_remove( irc->ping_source_id ); - b_event_remove( irc->r_watch_source_id ); + if( irc->r_watch_source_id > 0 ) + b_event_remove( irc->r_watch_source_id ); if( irc->w_watch_source_id > 0 ) b_event_remove( irc->w_watch_source_id ); -- cgit v1.2.3 From 8dbe021fab08902eb202da8da26d183cb0832fca Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Apr 2008 00:13:07 +0100 Subject: Don't pass an account_t pointer directly to query_add() since query_del() wants to free it! Passing an indirect pointer instead. --- root_commands.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/root_commands.c b/root_commands.c index 9a60b5af..2bccc465 100644 --- a/root_commands.c +++ b/root_commands.c @@ -205,22 +205,24 @@ static void cmd_drop( irc_t *irc, char **cmd ) void cmd_account_del_yes( gpointer w, void *data ) { - account_t *a = data; - irc_t *irc = a->irc; + account_t **aptr = data; + irc_t *irc = (*aptr)->irc; - if( a->ic ) + if( (*aptr)->ic ) { irc_usermsg( irc, "Account is still logged in, can't delete" ); } else { - account_del( irc, a ); + account_del( irc, (*aptr) ); irc_usermsg( irc, "Account deleted" ); } + g_free( aptr ); } void cmd_account_del_no( gpointer w, void *data ) { + g_free( data ); } static void cmd_account( irc_t *irc, char **cmd ) @@ -277,14 +279,18 @@ static void cmd_account( irc_t *irc, char **cmd ) } else { + account_t **aptr; char *msg; + aptr = g_malloc( sizeof( aptr ) ); + *aptr = a; + msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will " "also forget all your saved nicknames. If you want " "to change your username/password, use the `account " "set' command. Are you sure you want to delete this " "account?", a->prpl->name, a->user ); - query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, a ); + query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, aptr ); g_free( msg ); } } -- cgit v1.2.3 From f3351f0ae5c6014e36e529684b81e78cad9a66ce Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Apr 2008 12:54:31 +0100 Subject: Fixed GLib <2.6 compatibility issue in arc.h. (G_GNUC_MALLOC) --- lib/arc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/arc.h b/lib/arc.h index 58f30d3d..816fa612 100644 --- a/lib/arc.h +++ b/lib/arc.h @@ -30,6 +30,10 @@ struct arc_state unsigned char i, j; }; +#ifndef G_GNUC_MALLOC +#define G_GNUC_MALLOC +#endif + G_GNUC_MALLOC struct arc_state *arc_keymaker( unsigned char *key, int kl, int cycles ); unsigned char arc_getbyte( struct arc_state *st ); int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *password, int pad_to ); -- cgit v1.2.3 From 9143aeb969697e05953b0f60a2fff2581fa0f18c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Apr 2008 13:26:04 +0100 Subject: query.h now defines a callback function type, not using void* for it anymore. Got rid of the bogus window handler pointer as the first argument to the callback. --- protocols/jabber/jabber_util.c | 8 ++++++-- protocols/msn/msn_util.c | 8 ++++++-- protocols/nogaim.c | 17 ++++++++++------- protocols/nogaim.h | 3 ++- protocols/oscar/oscar.c | 18 ++++++++++++------ protocols/yahoo/yahoo.c | 8 ++++++-- query.c | 7 ++++--- query.h | 8 +++++--- 8 files changed, 51 insertions(+), 26 deletions(-) diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 6e872040..518624f6 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -245,8 +245,10 @@ struct jabber_buddy_ask_data char *realname; }; -static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla ) +static void jabber_buddy_ask_yes( void *data ) { + struct jabber_buddy_ask_data *bla = data; + presence_send_request( bla->ic, bla->handle, "subscribed" ); if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) @@ -256,8 +258,10 @@ static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla g_free( bla ); } -static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla ) +static void jabber_buddy_ask_no( void *data ) { + struct jabber_buddy_ask_data *bla = data; + presence_send_request( bla->ic, bla->handle, "subscribed" ); g_free( bla->handle ); diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index fae2877d..58ad22f8 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -89,8 +89,10 @@ struct msn_buddy_ask_data char *realname; }; -static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla ) +static void msn_buddy_ask_yes( void *data ) { + struct msn_buddy_ask_data *bla = data; + msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) @@ -101,8 +103,10 @@ static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla ) g_free( bla ); } -static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla ) +static void msn_buddy_ask_no( void *data ) { + struct msn_buddy_ask_data *bla = data; + msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname ); g_free( bla->handle ); diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 3ce15166..7466e93a 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -342,7 +342,8 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) /* dialogs.c */ -void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ) +void imcb_ask( struct im_connection *ic, char *msg, void *data, + query_callback doit, query_callback dont ) { query_add( ic->irc, ic, msg, doit, dont, data ); } @@ -494,18 +495,20 @@ struct show_got_added_data char *handle; }; -void show_got_added_no( gpointer w, struct show_got_added_data *data ) +void show_got_added_no( void *data ) { - g_free( data->handle ); + g_free( ((struct show_got_added_data*)data)->handle ); g_free( data ); } -void show_got_added_yes( gpointer w, struct show_got_added_data *data ) +void show_got_added_yes( void *data ) { - data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL ); - /* imcb_add_buddy( data->ic, NULL, data->handle, data->handle ); */ + struct show_got_added_data *sga = data; - return show_got_added_no( w, data ); + sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); + /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ + + return show_got_added_no( data ); } void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 7d391edd..bdd8bae2 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -41,6 +41,7 @@ #include "bitlbee.h" #include "account.h" #include "proxy.h" +#include "query.h" #include "md5.h" #define BUF_LEN MSG_LEN @@ -260,7 +261,7 @@ G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G * - 'data' can be your custom struct - it will be passed to the callbacks. * - 'doit' or 'dont' will be called depending of the answer of the user. */ -G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ); +G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); /* Buddy management */ diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 9e5de70a..7738c31f 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1083,8 +1083,8 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ return 1; } -void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv); -void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv); +void oscar_accept_chat(void *data); +void oscar_reject_chat(void *data); static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { struct im_connection *ic = sess->aux_data; @@ -1118,7 +1118,8 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ return 1; } -static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { +static void gaim_icq_authgrant(void *data_) { + struct icq_auth *data = data_; char *uin, message; struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; @@ -1133,7 +1134,8 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { g_free(data); } -static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { +static void gaim_icq_authdeny(void *data_) { + struct icq_auth *data = data_; char *uin, *message; struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; @@ -2587,15 +2589,19 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) return NULL; } -void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) +void oscar_accept_chat(void *data) { + struct aim_chat_invitation * inv = data; + oscar_chat_join(inv->ic, inv->name, NULL, NULL); g_free(inv->name); g_free(inv); } -void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv) +void oscar_reject_chat(void *data) { + struct aim_chat_invitation * inv = data; + g_free(inv->name); g_free(inv); } diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index 36579d66..ab30df4d 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -796,16 +796,20 @@ int ext_yahoo_connect(const char *host, int port) return -1; } -static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv ) +static void byahoo_accept_conf( void *data ) { + struct byahoo_conf_invitation *inv = data; + yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name ); imcb_chat_add_buddy( inv->c, inv->ic->acc->user ); g_free( inv->name ); g_free( inv ); } -static void byahoo_reject_conf( gpointer w, struct byahoo_conf_invitation *inv ) +static void byahoo_reject_conf( void *data ) { + struct byahoo_conf_invitation *inv = data; + yahoo_conference_decline( inv->yid, NULL, inv->members, inv->name, "User rejected groupchat" ); imcb_chat_free( inv->c ); g_free( inv->name ); diff --git a/query.c b/query.c index 6f9eb77f..e8f69572 100644 --- a/query.c +++ b/query.c @@ -29,7 +29,8 @@ static void query_display( irc_t *irc, query_t *q ); static query_t *query_default( irc_t *irc ); -query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data ) +query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, + query_callback yes, query_callback no, void *data ) { query_t *q = g_new0( query_t, 1 ); @@ -143,7 +144,7 @@ void query_answer( irc_t *irc, query_t *q, int ans ) imcb_log( q->ic, "Accepted: %s", q->question ); else irc_usermsg( irc, "Accepted: %s", q->question ); - q->yes( NULL, q->data ); + q->yes( q->data ); } else { @@ -151,7 +152,7 @@ void query_answer( irc_t *irc, query_t *q, int ans ) imcb_log( q->ic, "Rejected: %s", q->question ); else irc_usermsg( irc, "Rejected: %s", q->question ); - q->no( NULL, q->data ); + q->no( q->data ); } q->data = NULL; diff --git a/query.h b/query.h index b64642c2..e0ca32ec 100644 --- a/query.h +++ b/query.h @@ -26,17 +26,19 @@ #ifndef _QUERY_H #define _QUERY_H +typedef void (*query_callback) ( void *data ); + typedef struct query { struct im_connection *ic; char *question; - void (* yes) ( gpointer w, void *data ); - void (* no) ( gpointer w, void *data ); + query_callback yes, no; void *data; struct query *next; } query_t; -query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data ); +query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, + query_callback yes, query_callback no, void *data ); void query_del( irc_t *irc, query_t *q ); void query_del_by_conn( irc_t *irc, struct im_connection *ic ); void query_answer( irc_t *irc, query_t *q, int ans ); -- cgit v1.2.3 From f35aee7fdfc66138d0525a0a7b9e02ccb1aaaec7 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Apr 2008 13:36:13 +0100 Subject: Fixed #386. --- root_commands.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/root_commands.c b/root_commands.c index 2bccc465..aec91455 100644 --- a/root_commands.c +++ b/root_commands.c @@ -203,24 +203,36 @@ static void cmd_drop( irc_t *irc, char **cmd ) } } -void cmd_account_del_yes( gpointer w, void *data ) +struct cmd_account_del_data { - account_t **aptr = data; - irc_t *irc = (*aptr)->irc; + account_t *a; + irc_t *irc; +}; + +void cmd_account_del_yes( void *data ) +{ + struct cmd_account_del_data *cad = data; + account_t *a; - if( (*aptr)->ic ) + for( a = cad->irc->accounts; a && a != cad->a; a = a->next ); + + if( a == NULL ) + { + irc_usermsg( cad->irc, "Account already deleted" ); + } + else if( a->ic ) { - irc_usermsg( irc, "Account is still logged in, can't delete" ); + irc_usermsg( cad->irc, "Account is still logged in, can't delete" ); } else { - account_del( irc, (*aptr) ); - irc_usermsg( irc, "Account deleted" ); + account_del( cad->irc, a ); + irc_usermsg( cad->irc, "Account deleted" ); } - g_free( aptr ); + g_free( data ); } -void cmd_account_del_no( gpointer w, void *data ) +void cmd_account_del_no( void *data ) { g_free( data ); } @@ -279,18 +291,19 @@ static void cmd_account( irc_t *irc, char **cmd ) } else { - account_t **aptr; + struct cmd_account_del_data *cad; char *msg; - aptr = g_malloc( sizeof( aptr ) ); - *aptr = a; + cad = g_malloc( sizeof( struct cmd_account_del_data ) ); + cad->a = a; + cad->irc = irc; msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will " "also forget all your saved nicknames. If you want " "to change your username/password, use the `account " "set' command. Are you sure you want to delete this " "account?", a->prpl->name, a->user ); - query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, aptr ); + query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad ); g_free( msg ); } } -- cgit v1.2.3 From 1195cecc99315c9c38e05c8dd0981792e7663583 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Apr 2008 14:03:31 +0100 Subject: Changed root nicknames are now saved. (Bug #378) --- bitlbee.h | 2 ++ doc/user-guide/commands.xml | 10 ++++++++++ irc.c | 1 + root_commands.c | 17 +++++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/bitlbee.h b/bitlbee.h index 420ab70a..60694a2a 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -159,6 +159,8 @@ void root_command_string( irc_t *irc, user_t *u, char *command, int flags ); void root_command( irc_t *irc, char *command[] ); gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ); +char *set_eval_root_nick( set_t *set, char *new_nick ); + extern global_t global; #endif diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index c45727b9..6d77f8cd 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -588,6 +588,16 @@ + + root + + + + Normally the "bot" that takes all your BitlBee commands is called "root". If you don't like this name, you can rename it to anything else using the rename command, or by changing this setting. + + + + true diff --git a/irc.c b/irc.c index c929d68b..a6220140 100644 --- a/irc.c +++ b/irc.c @@ -150,6 +150,7 @@ irc_t *irc_new( int fd ) set_add( &irc->set, "password", NULL, passchange, irc ); set_add( &irc->set, "private", "true", set_eval_bool, irc ); set_add( &irc->set, "query_order", "lifo", NULL, irc ); + set_add( &irc->set, "root_nick", irc->mynick, set_eval_root_nick, irc ); set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc ); set_add( &irc->set, "strip_html", "true", NULL, irc ); diff --git a/root_commands.c b/root_commands.c index aec91455..4b27afe3 100644 --- a/root_commands.c +++ b/root_commands.c @@ -602,6 +602,9 @@ static void cmd_rename( irc_t *irc, char **cmd ) { g_free( irc->mynick ); irc->mynick = g_strdup( cmd[2] ); + + if( strcmp( cmd[0], "set_rename" ) != 0 ) + set_setstr( &irc->set, "root_nick", cmd[2] ); } else if( u->send_handler == buddy_send_handler ) { @@ -612,6 +615,20 @@ static void cmd_rename( irc_t *irc, char **cmd ) } } +char *set_eval_root_nick( set_t *set, char *new_nick ) +{ + irc_t *irc = set->data; + + if( strcmp( irc->mynick, new_nick ) != 0 ) + { + char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL }; + + cmd_rename( irc, cmd ); + } + + return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : NULL; +} + static void cmd_remove( irc_t *irc, char **cmd ) { user_t *u; -- cgit v1.2.3 From aa311173a85020bcbbbf61135a5451e171d422f5 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 8 Apr 2008 21:44:34 +0100 Subject: Don't automatically enable MSN debugging messages for debugging builds. --- protocols/msn/msn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h index c8f4f4c6..63759303 100644 --- a/protocols/msn/msn.h +++ b/protocols/msn/msn.h @@ -28,7 +28,7 @@ #define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r" #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r" -#ifdef DEBUG +#ifdef DEBUG_MSN #define debug( text... ) imcb_log( ic, text ); #else #define debug( text... ) -- cgit v1.2.3 From aefaac3a5d44537bdf804d1f42e491cc2b931889 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 6 Apr 2008 16:34:25 +0100 Subject: Added ClientInterface configuration option to make BitlBee bind() to a specific interface before connecting to a remote host. --- bitlbee.c | 4 ++-- bitlbee.conf | 7 +++++++ conf.c | 14 ++++++++++---- conf.h | 2 +- lib/proxy.c | 11 +++++++++++ 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/bitlbee.c b/bitlbee.c index 230b8ce8..17431546 100644 --- a/bitlbee.c +++ b/bitlbee.c @@ -53,11 +53,11 @@ int bitlbee_daemon_init() #endif ; - i = getaddrinfo( global.conf->iface, global.conf->port, &hints, &addrinfo_bind ); + i = getaddrinfo( global.conf->iface_in, global.conf->port, &hints, &addrinfo_bind ); if( i ) { log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s", - global.conf->iface, gai_strerror(i) ); + global.conf->iface_in, gai_strerror(i) ); return -1; } diff --git a/bitlbee.conf b/bitlbee.conf index 99e8106d..c03a564f 100644 --- a/bitlbee.conf +++ b/bitlbee.conf @@ -34,6 +34,13 @@ # DaemonInterface = 0.0.0.0 # DaemonPort = 6667 +## ClientInterface: +## +## If for any reason, you want BitlBee to use a specific address/interface +## for outgoing traffic (IM connections, HTTP(S), etc.), set it here. +## +# ClientInterface = 0.0.0.0 + ## AuthMode ## ## Open -- Accept connections from anyone, use NickServ for user authentication. diff --git a/conf.c b/conf.c index 339af618..8d6291ff 100644 --- a/conf.c +++ b/conf.c @@ -44,7 +44,8 @@ conf_t *conf_load( int argc, char *argv[] ) conf = g_new0( conf_t, 1 ); - conf->iface = NULL; + conf->iface_in = NULL; + conf->iface_out = NULL; conf->port = g_strdup( "6667" ); conf->nofork = 0; conf->verbose = 0; @@ -81,7 +82,7 @@ conf_t *conf_load( int argc, char *argv[] ) { if( opt == 'i' ) { - conf->iface = g_strdup( optarg ); + conf->iface_in = g_strdup( optarg ); } else if( opt == 'p' ) { @@ -201,14 +202,19 @@ static int conf_loadini( conf_t *conf, char *file ) } else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 ) { - g_free( conf->iface ); - conf->iface = g_strdup( ini->value ); + g_free( conf->iface_in ); + conf->iface_in = g_strdup( ini->value ); } else if( g_strcasecmp( ini->key, "daemonport" ) == 0 ) { g_free( conf->port ); conf->port = g_strdup( ini->value ); } + else if( g_strcasecmp( ini->key, "clientinterface" ) == 0 ) + { + g_free( conf->iface_out ); + conf->iface_out = g_strdup( ini->value ); + } else if( g_strcasecmp( ini->key, "authmode" ) == 0 ) { if( g_strcasecmp( ini->value, "registered" ) == 0 ) diff --git a/conf.h b/conf.h index d21ec577..c41fd096 100644 --- a/conf.h +++ b/conf.h @@ -31,7 +31,7 @@ typedef enum authmode { AUTHMODE_OPEN, AUTHMODE_CLOSED, AUTHMODE_REGISTERED } au typedef struct conf { - char *iface; + char *iface_in, *iface_out; char *port; int nofork; int verbose; diff --git a/lib/proxy.c b/lib/proxy.c index 53b89d64..91493557 100644 --- a/lib/proxy.c +++ b/lib/proxy.c @@ -113,6 +113,7 @@ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb) { struct sockaddr_in *sin; + struct sockaddr_in me; int fd = -1; if (!(sin = gaim_gethostbyname(host, port))) { @@ -127,6 +128,16 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB sock_make_nonblocking(fd); + if( global.conf->iface_out ) + { + me.sin_family = AF_INET; + me.sin_port = 0; + me.sin_addr.s_addr = inet_addr( global.conf->iface_out ); + + if( bind( fd, (struct sockaddr *) &me, sizeof( me ) ) != 0 ) + event_debug( "bind( %d, \"%s\" ) failure\n", fd, global.conf->iface_out ); + } + event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd); if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0 && !sockerr_again()) { -- cgit v1.2.3 From 99f929cb5faca663969361e4a142d0c309af1725 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 21 Apr 2008 22:53:15 +0100 Subject: Now checking if msn_sb_create() returns NULL. This is very unlikely, but can happen if we run out of file descriptors, for example. --- protocols/msn/ns.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index ff7da6ed..ffaa90a7 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -177,7 +177,15 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) } debug( "Connecting to a new switchboard with key %s", cmd[5] ); - sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ); + + if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL ) + { + /* Although this isn't strictly fatal for the NS connection, it's + definitely something serious (we ran out of file descriptors?). */ + imcb_error( ic, "Could not create new switchboard" ); + imc_logout( ic, TRUE ); + return( 0 ); + } if( md->msgq ) { @@ -467,8 +475,18 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] ); - sb = msn_sb_create( ic, server, port, cmd[4], session ); - sb->who = g_strdup( cmd[5] ); + if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL ) + { + /* Although this isn't strictly fatal for the NS connection, it's + definitely something serious (we ran out of file descriptors?). */ + imcb_error( ic, "Could not create new switchboard" ); + imc_logout( ic, TRUE ); + return( 0 ); + } + else + { + sb->who = g_strdup( cmd[5] ); + } } else if( strcmp( cmd[0], "ADD" ) == 0 ) { -- cgit v1.2.3 From 46d42308ee9a1120e39923dd38652681f2242665 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 7 May 2008 22:43:53 -0700 Subject: Added bitlbee-dev package, finalized 1.2-4 package. --- debian/changelog | 7 ++++--- debian/control | 9 +++++++++ debian/rules | 44 +++++++++++++++++++++++++++++++++----------- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index b964ee0e..f4b71762 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,12 @@ bitlbee (1.2-4) unstable; urgency=low - * Not a real release, just a placeholder for the changelog. * Fixed init script to use the BITLBEE_OPTS variable, not an undefined - DAEMON_OPT. + DAEMON_OPT. (Closes: #474583) * Added dependency information to the init script. (Closes: #472567) + * Added bitlbee-dev package. Patch from RISKO Gergely + with some small modifications. (Closes: #473480) - -- Wilmer van der Gaast Sat, 29 Mar 2008 21:10:33 +0000 + -- Wilmer van der Gaast Wed, 07 May 2008 22:40:40 -0700 bitlbee (1.2-3) unstable; urgency=low diff --git a/debian/control b/debian/control index 8383391b..8faa27b8 100644 --- a/debian/control +++ b/debian/control @@ -11,3 +11,12 @@ Depends: ${shlibs:Depends}, adduser, net-tools, ${debconf-depends}, debianutils Description: An IRC to other chat networks gateway This program can be used as an IRC server which forwards everything you say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo. + +Package: bitlbee-dev +Architecture: all +Depends: bitlbee (= ${binary:Version}) +Description: An IRC to other chat networks gateway + This program can be used as an IRC server which forwards everything you + say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo. + . + This package holds development stuff for compiling plug-ins. diff --git a/debian/rules b/debian/rules index 252fb742..67cb79a3 100755 --- a/debian/rules +++ b/debian/rules @@ -12,21 +12,21 @@ endif build-arch: build-arch-stamp build-arch-stamp: - if [ ! -d debian ]; then exit 1; fi + [ -d debian ] ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent $(MAKE) # $(MAKE) -C doc/ all touch build-arch-stamp clean: - if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi - rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files + [ "`whoami`" = "root" -a -d debian ] + rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files debian/bitlbee-dev -$(MAKE) distclean # -$(MAKE) -C doc/ clean install-arch: build-arch - if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi + [ "`whoami`" = "root" -a -d debian ] mkdir -p debian/bitlbee/DEBIAN/ $(MAKE) install install-etc DESTDIR=`pwd`/debian/bitlbee @@ -34,8 +34,15 @@ install-arch: build-arch cp doc/user-guide/user-guide.txt debian/bitlbee/usr/share/doc/bitlbee/ cp doc/user-guide/user-guide.html debian/bitlbee/usr/share/doc/bitlbee/ +install-indep: install-arch + [ "`whoami`" = "root" -a -d debian ] + mkdir -p debian/bitlbee-dev/DEBIAN/ + $(MAKE) install-dev DESTDIR=`pwd`/debian/bitlbee-dev + + mkdir -p debian/bitlbee-dev/usr/share/doc/bitlbee-dev/ + binary-arch: build-arch install-arch - if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi + [ "`whoami`" = "root" -a -d debian ] chmod 755 debian/post* debian/pre* debian/config debian/bitlbee.init @@ -51,7 +58,7 @@ binary-arch: build-arch install-arch gzip -9 doc/bitlbee/changelog.Debian doc/bitlbee/changelog doc/bitlbee/user-guide.txt \ doc/bitlbee/examples/* man/man8/bitlbee.8 man/man5/bitlbee.conf.5 - chown -R root.root debian/bitlbee/ + chown -R root:root debian/bitlbee/ find debian/bitlbee/usr/share/ -type d -exec chmod 755 {} \; find debian/bitlbee/usr/share/ -type f -exec chmod 644 {} \; @@ -76,11 +83,26 @@ endif dpkg --build debian/bitlbee .. -debug-build: - BITLBEE_VERSION=\"`date +%Y%m%d`-`hostname`-debug\" debian/rules clean binary DEBUG=1 +binary-indep: install-indep + [ "`whoami`" = "root" -a -d debian ] + + chown -R root.root debian/bitlbee-dev/ + find debian/bitlbee-dev/usr/share/ -type d -exec chmod 755 {} \; + find debian/bitlbee-dev/usr/share/ -type f -exec chmod 644 {} \; + + cp debian/changelog debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian + gzip -9 debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian + cp debian/copyright debian/bitlbee-dev/usr/share/doc/bitlbee-dev/copyright + + cd debian/bitlbee-dev; \ + find usr -type f -exec md5sum {} \; > DEBIAN/md5sums + + dpkg-gencontrol -ldebian/changelog -isp -pbitlbee-dev -Pdebian/bitlbee-dev + + dpkg --build debian/bitlbee-dev .. -binary: binary-arch +binary: binary-arch binary-indep build: build-arch -install: install-arch +install: install-arch install-indep -.PHONY: build-arch build clean binary-arch binary install-arch install +.PHONY: build-arch build clean binary-arch binary install-arch install binary-indep install-indep -- cgit v1.2.3 From a8d28d95e748b5402178c643c4c6e4657e695ce0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 May 2008 14:19:09 +0200 Subject: Add homepage and vcs-bzr fields in Debian package. --- debian/changelog | 6 ++++++ debian/control | 2 ++ 2 files changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index b964ee0e..5099a35b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bitlbee (1.2-5) UNRELEASED; urgency=low + + * Add Homepage and Vcs-Bzr fields. + + -- Jelmer Vernooij Sun, 11 May 2008 14:18:16 +0200 + bitlbee (1.2-4) unstable; urgency=low * Not a real release, just a placeholder for the changelog. diff --git a/debian/control b/debian/control index 8383391b..fb1dec91 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,8 @@ Priority: optional Maintainer: Wilmer van der Gaast Standards-Version: 3.5.9 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf +Homepage: http://www.bitlbee.org/ +Vcs-Bzr: http://code.bitlbee.org/bitlbee/ Package: bitlbee Architecture: any -- cgit v1.2.3 From 23c4e648e3d38336f949498d0b93e5b399087e44 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 May 2008 12:37:34 -0700 Subject: Fixed NULL point dereference in "account set -del" code. --- root_commands.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/root_commands.c b/root_commands.c index 4b27afe3..f55c4b5e 100644 --- a/root_commands.c +++ b/root_commands.c @@ -422,6 +422,12 @@ static void cmd_account( irc_t *irc, char **cmd ) else acc_handle = g_strdup( cmd[2] ); + if( !acc_handle ) + { + irc_usermsg( irc, "Not enough parameters given (need %d)", 3 ); + return; + } + if( ( tmp = strchr( acc_handle, '/' ) ) ) { *tmp = 0; -- cgit v1.2.3 From 51bbec0b0e280be629f7b1086160b7730ebfdb74 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 May 2008 12:27:28 +0200 Subject: Revert move of random_bytes() to unix.c --- lib/misc.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ unix.c | 67 -------------------------------------------------------------- 2 files changed, 65 insertions(+), 67 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index 1670b91d..ccf208b5 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -391,6 +391,71 @@ signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t si return( outbuf - dst ); } +/* A pretty reliable random number generator. Tries to use the /dev/random + devices first, and falls back to the random number generator from libc + when it fails. Opens randomizer devices with O_NONBLOCK to make sure a + lack of entropy won't halt BitlBee. */ +void random_bytes( unsigned char *buf, int count ) +{ + static int use_dev = -1; + + /* Actually this probing code isn't really necessary, is it? */ + if( use_dev == -1 ) + { + if( access( "/dev/random", R_OK ) == 0 || access( "/dev/urandom", R_OK ) == 0 ) + use_dev = 1; + else + { + use_dev = 0; + srand( ( getpid() << 16 ) ^ time( NULL ) ); + } + } + + if( use_dev ) + { + int fd; + + /* At least on Linux, /dev/random can block if there's not + enough entropy. We really don't want that, so if it can't + give anything, use /dev/urandom instead. */ + if( ( fd = open( "/dev/random", O_RDONLY | O_NONBLOCK ) ) >= 0 ) + if( read( fd, buf, count ) == count ) + { + close( fd ); + return; + } + close( fd ); + + /* urandom isn't supposed to block at all, but just to be + sure. If it blocks, we'll disable use_dev and use the libc + randomizer instead. */ + if( ( fd = open( "/dev/urandom", O_RDONLY | O_NONBLOCK ) ) >= 0 ) + if( read( fd, buf, count ) == count ) + { + close( fd ); + return; + } + close( fd ); + + /* If /dev/random blocks once, we'll still try to use it + again next time. If /dev/urandom also fails for some + reason, stick with libc during this session. */ + + use_dev = 0; + srand( ( getpid() << 16 ) ^ time( NULL ) ); + } + + if( !use_dev ) + { + int i; + + /* Possibly the LSB of rand() isn't very random on some + platforms. Seems okay on at least Linux and OSX though. */ + for( i = 0; i < count; i ++ ) + buf[i] = rand() & 0xff; + } +} + int is_bool( char *value ) { if( *value == 0 ) diff --git a/unix.c b/unix.c index 39ca5732..d25aeb2e 100644 --- a/unix.c +++ b/unix.c @@ -218,70 +218,3 @@ double gettime() gettimeofday( time, 0 ); return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); } - -/* A pretty reliable random number generator. Tries to use the /dev/random - devices first, and falls back to the random number generator from libc - when it fails. Opens randomizer devices with O_NONBLOCK to make sure a - lack of entropy won't halt BitlBee. */ -void random_bytes( unsigned char *buf, int count ) -{ - static int use_dev = -1; - - /* Actually this probing code isn't really necessary, is it? */ - if( use_dev == -1 ) - { - if( access( "/dev/random", R_OK ) == 0 || access( "/dev/urandom", R_OK ) == 0 ) - use_dev = 1; - else - { - use_dev = 0; - srand( ( getpid() << 16 ) ^ time( NULL ) ); - } - } - - if( use_dev ) - { - int fd; - - /* At least on Linux, /dev/random can block if there's not - enough entropy. We really don't want that, so if it can't - give anything, use /dev/urandom instead. */ - if( ( fd = open( "/dev/random", O_RDONLY | O_NONBLOCK ) ) >= 0 ) - if( read( fd, buf, count ) == count ) - { - close( fd ); - return; - } - close( fd ); - - /* urandom isn't supposed to block at all, but just to be - sure. If it blocks, we'll disable use_dev and use the libc - randomizer instead. */ - if( ( fd = open( "/dev/urandom", O_RDONLY | O_NONBLOCK ) ) >= 0 ) - if( read( fd, buf, count ) == count ) - { - close( fd ); - return; - } - close( fd ); - - /* If /dev/random blocks once, we'll still try to use it - again next time. If /dev/urandom also fails for some - reason, stick with libc during this session. */ - - use_dev = 0; - srand( ( getpid() << 16 ) ^ time( NULL ) ); - } - - if( !use_dev ) - { - int i; - - /* Possibly the LSB of rand() isn't very random on some - platforms. Seems okay on at least Linux and OSX though. */ - for( i = 0; i < count; i ++ ) - buf[i] = rand() & 0xff; - } -} - - -- cgit v1.2.3 From de8e584d7f4fea214934af094a4df2672d7e0be8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 24 May 2008 12:57:47 -0700 Subject: Daemon mode is not an experiment anymore, it's running on testing.bitlbee.org for two weeks already with >30 active connections and not a single crash. --- bitlbee.conf | 7 +++---- conf.c | 2 +- doc/README | 33 +++++---------------------------- doc/bitlbee.8 | 12 +++--------- 4 files changed, 12 insertions(+), 42 deletions(-) diff --git a/bitlbee.conf b/bitlbee.conf index c03a564f..5fce2820 100644 --- a/bitlbee.conf +++ b/bitlbee.conf @@ -9,10 +9,9 @@ ## RunMode: ## ## Inetd -- Run from inetd (default) -## Daemon -- Run as a stand-alone daemon -- EXPERIMENTAL! BitlBee is not yet -## stable enough to serve lots of users from one process. Because of this -## and other reasons, the use of daemon-mode is *STRONGLY* discouraged, -## don't even *think* of reporting bugs when you use this. +## Daemon -- Run as a stand-alone daemon, serving all users from one process. +## This saves memory if there are more users, the downside is that when one +## user hits a crash-bug, all other users will also lose their connection. ## ForkDaemon -- Run as a stand-alone daemon, but keep all clients in separate ## child processes. This should be pretty safe and reliable to use instead ## of inetd mode. diff --git a/conf.c b/conf.c index 8d6291ff..2bdead65 100644 --- a/conf.c +++ b/conf.c @@ -131,7 +131,7 @@ conf_t *conf_load( int argc, char *argv[] ) "An IRC-to-other-chat-networks gateway\n" "\n" " -I Classic/InetD mode. (Default)\n" - " -D Daemon mode. (Still EXPERIMENTAL!)\n" + " -D Daemon mode. (one process serves all)\n" " -F Forking daemon. (one process per client)\n" " -u Run daemon as specified user.\n" " -P Specify PID-file (not for inetd mode)\n" diff --git a/doc/README b/doc/README index ca392573..9e681625 100644 --- a/doc/README +++ b/doc/README @@ -55,6 +55,11 @@ it in bitlbee.conf. You probably want to write an init script to start BitlBee automatically after a reboot. (This is where you realise using a package from your distro would've been a better idea. :-P) +Note that the BitlBee code is getting stable enough for daemon mode to be +useful. Some public servers use it, and it saves a lot of memory by serving +tens of users from a single process. One crash affects all users, but these +are becoming quite rare. + DEPENDENCIES ============ @@ -99,34 +104,6 @@ versions of make, we'd love to hear it, but it seems this just isn't possible. -RUNNING ON SERVERS WITH MANY USERS -================================== - -BitlBee is not yet bug-free. Sometimes a bug causes the program to get into -an infinite loop. Something you really don't want on a public server, -especially when that machine is also used for other (mission-critical) things. -For now we can't do much about it. We haven't seen that happen for a long -time already on our own machines, but some people still manage to get -themselves in nasty situations we haven't seen before. - -For now the best we can offer against this problem is bitlbeed, which allows -you to setrlimit() the child processes to use no more than a specified -number of CPU seconds. Not the best solution (not really a solution anyway), -but certainly trashing one busy daemon process is better than trashing your -whole machine. - -We don't believe adding a limit for bitlbee to /etc/security/limits.conf will -work, because that file is only read by PAM (ie just for real login users, -not daemons). - -See utils/bitlbeed.c for more information about the program. - -Just a little note: Now that we reach version 1.0, this shouldn't be that -much of an issue anymore. However, on a public server, especially if you -also use it for other things, it can't hurt to protect yourself against -possible problems. - - USAGE ===== diff --git a/doc/bitlbee.8 b/doc/bitlbee.8 index ae1cfb05..9e634844 100644 --- a/doc/bitlbee.8 +++ b/doc/bitlbee.8 @@ -43,13 +43,8 @@ protocol plugins. BitlBee currently supports Oscar (aim and icq), MSN, Jabber and Yahoo. \fBbitlbee\fP should be called by -.BR inetd (8). -(Or \fBbitlbeed\fP, -if you can't run and/or configure \fBinetd\fP.) There is an experimental -daemon mode too, in which BitlBee will serve all clients in one process -(and does not require inetd), but this mode is still experimental. -There are still some bugs left in BitlBee, and if they cause a crash, -that would terminate the BitlBee connection for all clients. +.BR inetd (8), +or you can run it as a stand-alone daemon. .PP .SH OPTIONS .PP @@ -61,10 +56,9 @@ option. .IP "-D" Run in daemon mode. In this mode, BitlBee forks to the background and waits for new connections. All clients will be served from one process. -This is still experimental. See the note above for more information. .IP "-F" Run in ForkDaemon mode. This is similar to ordinary daemon mode, but every -client gets its own process. Easier to set up than inetd mode, but without +client gets its own process. Easier to set up than inetd mode, and without the possible stability issues. .IP "-i \fIaddress\fP" Only useful when running in daemon mode, to specify the network interface -- cgit v1.2.3 From 12ebe748ad292e10c7680f65222c5c145db8a9b3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 9 Jun 2008 04:18:15 +0200 Subject: Deal with changes in configuration struct. --- win32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/win32.c b/win32.c index d741e294..7808ac2e 100644 --- a/win32.c +++ b/win32.c @@ -199,7 +199,8 @@ conf_t *conf_load( int argc, char *argv[] ) conf = g_new0( conf_t,1 ); global.conf = conf; - conf_get_string(key_main, "interface", "0.0.0.0", &global.conf->iface); + conf_get_string(key_main, "interface_in", "0.0.0.0", &global.conf->iface_in); + conf_get_string(key_main, "interface_out", "0.0.0.0", &global.conf->iface_out); conf_get_string(key_main, "port", "6667", &global.conf->port); conf_get_int(key_main, "verbose", 0, &global.conf->verbose); conf_get_string(key_main, "auth_pass", "", &global.conf->auth_pass); @@ -210,7 +211,7 @@ conf_t *conf_load( int argc, char *argv[] ) conf_get_string(key_main, "motdfile", NULL, &global.conf->motdfile); conf_get_string(key_main, "helpfile", NULL, &global.helpfile); global.conf->runmode = RUNMODE_DAEMON; - conf_get_int(key_main, "AuthMode", AUTHMODE_OPEN, &global.conf->authmode); + conf_get_int(key_main, "AuthMode", AUTHMODE_OPEN, (int *)&global.conf->authmode); conf_get_string(key_proxy, "host", "", &tmp); strcpy(proxyhost, tmp); conf_get_string(key_proxy, "user", "", &tmp); strcpy(proxyuser, tmp); conf_get_string(key_proxy, "password", "", &tmp); strcpy(proxypass, tmp); -- cgit v1.2.3 From 1bf94924d6ae35c4369006ddbb6405ff0af74fe8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 9 Jun 2008 04:18:34 +0200 Subject: Use system lib directories and pkg-config directory from target when specified. --- Makefile | 2 +- configure | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 014b8450..d8b40237 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ objects = account.o bitlbee.o crypting.o help.o ipc.o irc.o irc_commands.o nick. headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h subdirs = lib protocols -ifeq ($(ARCH),Windows) +ifeq ($(TARGET),i586-mingw32msvc) objects += win32.o else objects += unix.o conf.o log.o diff --git a/configure b/configure index a83bd94d..23e0a5c3 100755 --- a/configure +++ b/configure @@ -19,6 +19,7 @@ libevent='/usr/' pidfile='/var/run/bitlbee.pid' ipcsocket='/var/run/bitlbee.sock' pcdir='$prefix/lib/pkgconfig' +systemlibdirs="/lib /usr/lib /usr/local/lib" msn=1 jabber=1 @@ -108,6 +109,7 @@ CONFIG=$config INCLUDEDIR=$includedir PCDIR=$pcdir +TARGET=$target ARCH=$arch CPU=$cpu OUTFILE=bitlbee @@ -133,13 +135,18 @@ cat<config.h #define CPU "$cpu" EOF + + if [ -n "$target" ]; then - PKG_CONFIG_PATH=/usr/$target/lib/pkgconfig + PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig + export PKG_CONFIG_LIBDIR PATH=/usr/$target/bin:$PATH CC=$target-cc LD=$target-ld + systemlibdirs="/usr/$target/lib" fi + if [ "$debug" = "1" ]; then [ -z "$CFLAGS" ] && CFLAGS=-g echo 'DEBUG=1' >> Makefile.settings @@ -342,7 +349,7 @@ fi; echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings -for i in /lib /usr/lib /usr/local/lib; do +for i in $systemlibdirs; do if [ -f $i/libresolv.a ]; then echo '#define HAVE_RESOLV_A' >> config.h echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings -- cgit v1.2.3 From 7d3ef7bbfd09ce0a8d8dbdb651fdaa862f75af21 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:04:44 +0200 Subject: Fix undefined references. --- bitlbee.h | 2 ++ configure | 2 +- irc.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bitlbee.h b/bitlbee.h index d1722377..37f9a1c1 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -28,6 +28,8 @@ #define _GNU_SOURCE /* Stupid GNU :-P */ +#define _WIN32_WINNT 0x0501 + #define PACKAGE "BitlBee" #define BITLBEE_VERSION "1.2" #define VERSION BITLBEE_VERSION diff --git a/configure b/configure index 23e0a5c3..d92a2fc6 100755 --- a/configure +++ b/configure @@ -511,7 +511,7 @@ CYGWIN* ) ;; Windows ) echo OUTFILE=bitlbee.exe >> Makefile.settings - echo LFLAGS+=-lwsock32 >> Makefile.settings + echo LFLAGS+=-lws2_32 >> Makefile.settings echo EFLAGS+=-lsecur32 >> Makefile.settings ;; * ) diff --git a/irc.c b/irc.c index a6220140..c850b65c 100644 --- a/irc.c +++ b/irc.c @@ -25,6 +25,7 @@ #define BITLBEE_CORE #include "bitlbee.h" +#include "sock.h" #include "crypting.h" #include "ipc.h" -- cgit v1.2.3 From 55eda086dc21a5ed7f4e13a3b129b817d151df86 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:09:33 +0200 Subject: Provide thread-unsafe replacement for gmtime_r on Windows. --- win32.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/win32.c b/win32.c index 7808ac2e..fc73b611 100644 --- a/win32.c +++ b/win32.c @@ -317,3 +317,16 @@ void log_message(int level, char *message, ...) } void log_link(int level, int output) { /* FIXME */ } + +struct tm * +gmtime_r (const time_t *timer, struct tm *result) +{ + struct tm *local_result; + local_result = gmtime (timer); + + if (local_result == NULL || result == NULL) + return NULL; + + memcpy (result, local_result, sizeof (result)); + return result; +} -- cgit v1.2.3 From 7f49a8642e162611cf20ab95955098597d1f4472 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:09:49 +0200 Subject: Move random_bytes() back to lib/ --- lib/misc.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ unix.c | 65 ------------------------------------------------------------ 2 files changed, 67 insertions(+), 65 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index 1670b91d..0998b7e2 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -391,6 +391,73 @@ signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t si return( outbuf - dst ); } +/* A pretty reliable random number generator. Tries to use the /dev/random + devices first, and falls back to the random number generator from libc + when it fails. Opens randomizer devices with O_NONBLOCK to make sure a + lack of entropy won't halt BitlBee. */ +void random_bytes( unsigned char *buf, int count ) +{ +#ifndef _WIN32 + static int use_dev = -1; + + /* Actually this probing code isn't really necessary, is it? */ + if( use_dev == -1 ) + { + if( access( "/dev/random", R_OK ) == 0 || access( "/dev/urandom", R_OK ) == 0 ) + use_dev = 1; + else + { + use_dev = 0; + srand( ( getpid() << 16 ) ^ time( NULL ) ); + } + } + + if( use_dev ) + { + int fd; + + /* At least on Linux, /dev/random can block if there's not + enough entropy. We really don't want that, so if it can't + give anything, use /dev/urandom instead. */ + if( ( fd = open( "/dev/random", O_RDONLY | O_NONBLOCK ) ) >= 0 ) + if( read( fd, buf, count ) == count ) + { + close( fd ); + return; + } + close( fd ); + + /* urandom isn't supposed to block at all, but just to be + sure. If it blocks, we'll disable use_dev and use the libc + randomizer instead. */ + if( ( fd = open( "/dev/urandom", O_RDONLY | O_NONBLOCK ) ) >= 0 ) + if( read( fd, buf, count ) == count ) + { + close( fd ); + return; + } + close( fd ); + + /* If /dev/random blocks once, we'll still try to use it + again next time. If /dev/urandom also fails for some + reason, stick with libc during this session. */ + + use_dev = 0; + srand( ( getpid() << 16 ) ^ time( NULL ) ); + } + + if( !use_dev ) +#endif + { + int i; + + /* Possibly the LSB of rand() isn't very random on some + platforms. Seems okay on at least Linux and OSX though. */ + for( i = 0; i < count; i ++ ) + buf[i] = rand() & 0xff; + } +} + int is_bool( char *value ) { if( *value == 0 ) diff --git a/unix.c b/unix.c index f90f03b9..0566fa56 100644 --- a/unix.c +++ b/unix.c @@ -225,69 +225,4 @@ double gettime() return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); } -/* A pretty reliable random number generator. Tries to use the /dev/random - devices first, and falls back to the random number generator from libc - when it fails. Opens randomizer devices with O_NONBLOCK to make sure a - lack of entropy won't halt BitlBee. */ -void random_bytes( unsigned char *buf, int count ) -{ - static int use_dev = -1; - - /* Actually this probing code isn't really necessary, is it? */ - if( use_dev == -1 ) - { - if( access( "/dev/random", R_OK ) == 0 || access( "/dev/urandom", R_OK ) == 0 ) - use_dev = 1; - else - { - use_dev = 0; - srand( ( getpid() << 16 ) ^ time( NULL ) ); - } - } - - if( use_dev ) - { - int fd; - - /* At least on Linux, /dev/random can block if there's not - enough entropy. We really don't want that, so if it can't - give anything, use /dev/urandom instead. */ - if( ( fd = open( "/dev/random", O_RDONLY | O_NONBLOCK ) ) >= 0 ) - if( read( fd, buf, count ) == count ) - { - close( fd ); - return; - } - close( fd ); - - /* urandom isn't supposed to block at all, but just to be - sure. If it blocks, we'll disable use_dev and use the libc - randomizer instead. */ - if( ( fd = open( "/dev/urandom", O_RDONLY | O_NONBLOCK ) ) >= 0 ) - if( read( fd, buf, count ) == count ) - { - close( fd ); - return; - } - close( fd ); - - /* If /dev/random blocks once, we'll still try to use it - again next time. If /dev/urandom also fails for some - reason, stick with libc during this session. */ - - use_dev = 0; - srand( ( getpid() << 16 ) ^ time( NULL ) ); - } - - if( !use_dev ) - { - int i; - - /* Possibly the LSB of rand() isn't very random on some - platforms. Seems okay on at least Linux and OSX though. */ - for( i = 0; i < count; i ++ ) - buf[i] = rand() & 0xff; - } -} - -- cgit v1.2.3 From fde7b91536d2d0f5bc8e3e2226fba2188f038fb4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:10:03 +0200 Subject: Implement ssl_pending() in bogus ssl backend. --- lib/ssl_bogus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ssl_bogus.c b/lib/ssl_bogus.c index 5bae3496..a07ea752 100644 --- a/lib/ssl_bogus.c +++ b/lib/ssl_bogus.c @@ -60,3 +60,8 @@ b_input_condition ssl_getdirection( void *conn ) { return GAIM_INPUT_READ; } + +int ssl_pending( void *conn ) +{ + return 0; +} -- cgit v1.2.3 From 8a4ae0da867a142dff6f5c96b6c460b725199ba0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:13:21 +0200 Subject: Ignore windows executable. --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 77270c00..71ec8c68 100644 --- a/.bzrignore +++ b/.bzrignore @@ -27,3 +27,4 @@ tests/check *.o coverage bitlbee.info +bitlbee.exe -- cgit v1.2.3 From 21e5d4981de057bae5261720021757d893061652 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:16:15 +0200 Subject: Move SSPI SSL implementation to same directory as other SSL backends. --- lib/ssl_sspi.c | 278 +++++++++++++++++++++++++++++++++++++++++++++++++++ protocols/ssl_sspi.c | 278 --------------------------------------------------- 2 files changed, 278 insertions(+), 278 deletions(-) create mode 100644 lib/ssl_sspi.c delete mode 100644 protocols/ssl_sspi.c diff --git a/lib/ssl_sspi.c b/lib/ssl_sspi.c new file mode 100644 index 00000000..a16423b1 --- /dev/null +++ b/lib/ssl_sspi.c @@ -0,0 +1,278 @@ + /********************************************************************\ + * BitlBee -- An IRC to other IM-networks gateway * + * * + * Copyright 2002-2004 Wilmer van der Gaast and others * + \********************************************************************/ + +/* SSL module - SSPI backend */ + +/* Copyright (C) 2005 Jelmer Vernooij */ + +/* + 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 with + the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; + if not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "ssl_client.h" +#include +#define SECURITY_WIN32 +#include +#include +#include +#include "sock.h" + +static gboolean initialized = FALSE; +int ssl_errno; + +struct scd +{ + int fd; + ssl_input_function func; + gpointer data; + gboolean established; + CredHandle cred; /* SSL credentials */ + CtxtHandle context; /* SSL context */ + SecPkgContext_StreamSizes sizes; + + char *host; + + char *pending_raw_data; + gsize pending_raw_data_len; + char *pending_data; + gsize pending_data_len; +}; + +static void ssl_connected(gpointer, gint, GaimInputCondition); + +void sspi_global_init(void) +{ + /* FIXME */ +} + +void sspi_global_deinit(void) +{ + /* FIXME */ +} + +void *ssl_connect(char *host, int port, ssl_input_function func, gpointer data) +{ + struct scd *conn = g_new0(struct scd, 1); + + conn->fd = proxy_connect(host, port, ssl_connected, conn); + sock_make_nonblocking(conn->fd); + conn->func = func; + conn->data = data; + conn->host = g_strdup(host); + + if (conn->fd < 0) + { + g_free(conn); + return NULL; + } + + if (!initialized) + { + sspi_global_init(); + initialized = TRUE; + atexit(sspi_global_deinit); + } + + return conn; +} + +static void ssl_connected(gpointer _conn, gint fd, GaimInputCondition cond) +{ + struct scd *conn = _conn; + SCHANNEL_CRED ssl_cred; + TimeStamp timestamp; + SecBuffer ibuf[2],obuf[1]; + SecBufferDesc ibufs,obufs; + ULONG req = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | + ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY | + ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR | + ISC_REQ_MANUAL_CRED_VALIDATION; + ULONG a; + gsize size = 0; + gchar *data = NULL; + + memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED)); + ssl_cred.dwVersion = SCHANNEL_CRED_VERSION; + ssl_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT; + + SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, ×tamp); + + if (st != SEC_E_OK) { + conn->func(conn->data, NULL, cond); + return; + } + + do { + /* initialize buffers */ + ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = data; + ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NULL; + obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NULL; + ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN; + ibuf[1].BufferType = SECBUFFER_EMPTY; + + /* initialize buffer descriptors */ + ibufs.ulVersion = obufs.ulVersion = SECBUFFER_VERSION; + ibufs.cBuffers = 2; obufs.cBuffers = 1; + ibufs.pBuffers = ibuf; obufs.pBuffers = obuf; + + st = InitializeSecurityContext(&conn->cred, size?&conn->context:NULL, conn->host, req, 0, SECURITY_NETWORK_DREP, size?&ibufs:NULL, 0, &conn->context, &obufs, &a, ×tamp); + if (obuf[0].pvBuffer && obuf[0].cbBuffer) { + /* FIXME: Check return value */ + send(conn->fd, obuf[0].pvBuffer, obuf[0].cbBuffer, 0); + } + + switch (st) { + case SEC_I_INCOMPLETE_CREDENTIALS: + break; + case SEC_I_CONTINUE_NEEDED: + break; + case SEC_E_INCOMPLETE_MESSAGE: + break; + case SEC_E_OK: + break; + } + + QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); + } while (1); + + conn->func(conn->data, conn, cond); +} + +int ssl_read(void *conn, char *retdata, int len) +{ + struct scd *scd = conn; + SecBufferDesc msg; + SecBuffer buf[4]; + int ret = -1, i; + char *data = g_malloc(scd->sizes.cbHeader + scd->sizes.cbMaximumMessage + scd->sizes.cbTrailer); + + /* FIXME: Try to read some data */ + + msg.ulVersion = SECBUFFER_VERSION; + msg.cBuffers = 4; + msg.pBuffers = buf; + + buf[0].BufferType = SECBUFFER_DATA; + buf[0].cbBuffer = len; + buf[0].pvBuffer = data; + + buf[1].BufferType = SECBUFFER_EMPTY; + buf[2].BufferType = SECBUFFER_EMPTY; + buf[3].BufferType = SECBUFFER_EMPTY; + + SECURITY_STATUS st = DecryptMessage(&scd->context, &msg, 0, NULL); + + if (st != SEC_E_OK) { + /* FIXME */ + return -1; + } + + for (i = 0; i < 4; i++) { + if (buf[i].BufferType == SECBUFFER_DATA) { + memcpy(retdata, buf[i].pvBuffer, len); + ret = len; + } + } + + g_free(data); + return -1; +} + +int ssl_write(void *conn, const char *userdata, int len) +{ + struct scd *scd = conn; + SecBuffer buf[4]; + SecBufferDesc msg; + char *data; + int ret; + + msg.ulVersion = SECBUFFER_VERSION; + msg.cBuffers = 4; + msg.pBuffers = buf; + + data = g_malloc(scd->sizes.cbHeader + scd->sizes.cbMaximumMessage + scd->sizes.cbTrailer); + memcpy(data + scd->sizes.cbHeader, userdata, len); + + buf[0].BufferType = SECBUFFER_STREAM_HEADER; + buf[0].cbBuffer = scd->sizes.cbHeader; + buf[0].pvBuffer = data; + + buf[1].BufferType = SECBUFFER_DATA; + buf[1].cbBuffer = len; + buf[1].pvBuffer = data + scd->sizes.cbHeader; + + buf[2].BufferType = SECBUFFER_STREAM_TRAILER; + buf[2].cbBuffer = scd->sizes.cbTrailer; + buf[2].pvBuffer = data + scd->sizes.cbHeader + len; + buf[3].BufferType = SECBUFFER_EMPTY; + + SECURITY_STATUS st = EncryptMessage(&scd->context, 0, &msg, 0); + + ret = send(scd->fd, data, + buf[0].cbBuffer + buf[1].cbBuffer + buf[2].cbBuffer, 0); + + g_free(data); + + return ret; +} + +void ssl_disconnect(void *conn) +{ + struct scd *scd = conn; + + SecBufferDesc msg; + SecBuffer buf; + DWORD dw; + + dw = SCHANNEL_SHUTDOWN; + buf.cbBuffer = sizeof(dw); + buf.BufferType = SECBUFFER_TOKEN; + buf.pvBuffer = &dw; + + msg.ulVersion = SECBUFFER_VERSION; + msg.cBuffers = 1; + msg.pBuffers = &buf; + + SECURITY_STATUS st = ApplyControlToken(&scd->context, &msg); + + if (st != SEC_E_OK) { + /* FIXME */ + } + + /* FIXME: call InitializeSecurityContext(Schannel), passing + * in empty buffers*/ + + DeleteSecurityContext(&scd->context); + + FreeCredentialsHandle(&scd->cred); + + closesocket(scd->fd); + g_free(scd->host); + g_free(scd); +} + +int ssl_getfd(void *conn) +{ + return ((struct scd*)conn)->fd; +} + +GaimInputCondition ssl_getdirection( void *conn ) +{ + return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */ +} diff --git a/protocols/ssl_sspi.c b/protocols/ssl_sspi.c deleted file mode 100644 index a16423b1..00000000 --- a/protocols/ssl_sspi.c +++ /dev/null @@ -1,278 +0,0 @@ - /********************************************************************\ - * BitlBee -- An IRC to other IM-networks gateway * - * * - * Copyright 2002-2004 Wilmer van der Gaast and others * - \********************************************************************/ - -/* SSL module - SSPI backend */ - -/* Copyright (C) 2005 Jelmer Vernooij */ - -/* - 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 with - the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; - if not, write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "ssl_client.h" -#include -#define SECURITY_WIN32 -#include -#include -#include -#include "sock.h" - -static gboolean initialized = FALSE; -int ssl_errno; - -struct scd -{ - int fd; - ssl_input_function func; - gpointer data; - gboolean established; - CredHandle cred; /* SSL credentials */ - CtxtHandle context; /* SSL context */ - SecPkgContext_StreamSizes sizes; - - char *host; - - char *pending_raw_data; - gsize pending_raw_data_len; - char *pending_data; - gsize pending_data_len; -}; - -static void ssl_connected(gpointer, gint, GaimInputCondition); - -void sspi_global_init(void) -{ - /* FIXME */ -} - -void sspi_global_deinit(void) -{ - /* FIXME */ -} - -void *ssl_connect(char *host, int port, ssl_input_function func, gpointer data) -{ - struct scd *conn = g_new0(struct scd, 1); - - conn->fd = proxy_connect(host, port, ssl_connected, conn); - sock_make_nonblocking(conn->fd); - conn->func = func; - conn->data = data; - conn->host = g_strdup(host); - - if (conn->fd < 0) - { - g_free(conn); - return NULL; - } - - if (!initialized) - { - sspi_global_init(); - initialized = TRUE; - atexit(sspi_global_deinit); - } - - return conn; -} - -static void ssl_connected(gpointer _conn, gint fd, GaimInputCondition cond) -{ - struct scd *conn = _conn; - SCHANNEL_CRED ssl_cred; - TimeStamp timestamp; - SecBuffer ibuf[2],obuf[1]; - SecBufferDesc ibufs,obufs; - ULONG req = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | - ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY | - ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR | - ISC_REQ_MANUAL_CRED_VALIDATION; - ULONG a; - gsize size = 0; - gchar *data = NULL; - - memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED)); - ssl_cred.dwVersion = SCHANNEL_CRED_VERSION; - ssl_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT; - - SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, ×tamp); - - if (st != SEC_E_OK) { - conn->func(conn->data, NULL, cond); - return; - } - - do { - /* initialize buffers */ - ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = data; - ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NULL; - obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NULL; - ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN; - ibuf[1].BufferType = SECBUFFER_EMPTY; - - /* initialize buffer descriptors */ - ibufs.ulVersion = obufs.ulVersion = SECBUFFER_VERSION; - ibufs.cBuffers = 2; obufs.cBuffers = 1; - ibufs.pBuffers = ibuf; obufs.pBuffers = obuf; - - st = InitializeSecurityContext(&conn->cred, size?&conn->context:NULL, conn->host, req, 0, SECURITY_NETWORK_DREP, size?&ibufs:NULL, 0, &conn->context, &obufs, &a, ×tamp); - if (obuf[0].pvBuffer && obuf[0].cbBuffer) { - /* FIXME: Check return value */ - send(conn->fd, obuf[0].pvBuffer, obuf[0].cbBuffer, 0); - } - - switch (st) { - case SEC_I_INCOMPLETE_CREDENTIALS: - break; - case SEC_I_CONTINUE_NEEDED: - break; - case SEC_E_INCOMPLETE_MESSAGE: - break; - case SEC_E_OK: - break; - } - - QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); - } while (1); - - conn->func(conn->data, conn, cond); -} - -int ssl_read(void *conn, char *retdata, int len) -{ - struct scd *scd = conn; - SecBufferDesc msg; - SecBuffer buf[4]; - int ret = -1, i; - char *data = g_malloc(scd->sizes.cbHeader + scd->sizes.cbMaximumMessage + scd->sizes.cbTrailer); - - /* FIXME: Try to read some data */ - - msg.ulVersion = SECBUFFER_VERSION; - msg.cBuffers = 4; - msg.pBuffers = buf; - - buf[0].BufferType = SECBUFFER_DATA; - buf[0].cbBuffer = len; - buf[0].pvBuffer = data; - - buf[1].BufferType = SECBUFFER_EMPTY; - buf[2].BufferType = SECBUFFER_EMPTY; - buf[3].BufferType = SECBUFFER_EMPTY; - - SECURITY_STATUS st = DecryptMessage(&scd->context, &msg, 0, NULL); - - if (st != SEC_E_OK) { - /* FIXME */ - return -1; - } - - for (i = 0; i < 4; i++) { - if (buf[i].BufferType == SECBUFFER_DATA) { - memcpy(retdata, buf[i].pvBuffer, len); - ret = len; - } - } - - g_free(data); - return -1; -} - -int ssl_write(void *conn, const char *userdata, int len) -{ - struct scd *scd = conn; - SecBuffer buf[4]; - SecBufferDesc msg; - char *data; - int ret; - - msg.ulVersion = SECBUFFER_VERSION; - msg.cBuffers = 4; - msg.pBuffers = buf; - - data = g_malloc(scd->sizes.cbHeader + scd->sizes.cbMaximumMessage + scd->sizes.cbTrailer); - memcpy(data + scd->sizes.cbHeader, userdata, len); - - buf[0].BufferType = SECBUFFER_STREAM_HEADER; - buf[0].cbBuffer = scd->sizes.cbHeader; - buf[0].pvBuffer = data; - - buf[1].BufferType = SECBUFFER_DATA; - buf[1].cbBuffer = len; - buf[1].pvBuffer = data + scd->sizes.cbHeader; - - buf[2].BufferType = SECBUFFER_STREAM_TRAILER; - buf[2].cbBuffer = scd->sizes.cbTrailer; - buf[2].pvBuffer = data + scd->sizes.cbHeader + len; - buf[3].BufferType = SECBUFFER_EMPTY; - - SECURITY_STATUS st = EncryptMessage(&scd->context, 0, &msg, 0); - - ret = send(scd->fd, data, - buf[0].cbBuffer + buf[1].cbBuffer + buf[2].cbBuffer, 0); - - g_free(data); - - return ret; -} - -void ssl_disconnect(void *conn) -{ - struct scd *scd = conn; - - SecBufferDesc msg; - SecBuffer buf; - DWORD dw; - - dw = SCHANNEL_SHUTDOWN; - buf.cbBuffer = sizeof(dw); - buf.BufferType = SECBUFFER_TOKEN; - buf.pvBuffer = &dw; - - msg.ulVersion = SECBUFFER_VERSION; - msg.cBuffers = 1; - msg.pBuffers = &buf; - - SECURITY_STATUS st = ApplyControlToken(&scd->context, &msg); - - if (st != SEC_E_OK) { - /* FIXME */ - } - - /* FIXME: call InitializeSecurityContext(Schannel), passing - * in empty buffers*/ - - DeleteSecurityContext(&scd->context); - - FreeCredentialsHandle(&scd->cred); - - closesocket(scd->fd); - g_free(scd->host); - g_free(scd); -} - -int ssl_getfd(void *conn) -{ - return ((struct scd*)conn)->fd; -} - -GaimInputCondition ssl_getdirection( void *conn ) -{ - return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */ -} -- cgit v1.2.3 From 73c2dce8961e937e97c78f0b8b0ee4abd347756b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:21:13 +0200 Subject: Update docs, remove obsolete win32-related utilities. --- .bzrignore | 9 --- Makefile | 2 + configure | 2 - doc/BUILD.win32 | 37 ++----------- utils/cross-compile.win32 | 21 ------- win32.mk | 136 ---------------------------------------------- 6 files changed, 8 insertions(+), 199 deletions(-) delete mode 100755 utils/cross-compile.win32 delete mode 100644 win32.mk diff --git a/.bzrignore b/.bzrignore index 71ec8c68..0312b204 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,15 +1,6 @@ Makefile.settings config.h bitlbee -Debug -Debugx -deps -admin/Debug -admin/admin.plg -bitlbee.plg -*.plg -*.aps -*.clw user-guide.txt user-guide.html help.txt diff --git a/Makefile b/Makefile index d8b40237..fa202ef1 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ subdirs = lib protocols ifeq ($(TARGET),i586-mingw32msvc) objects += win32.o +LFLAGS+=-lws2_32 +EFLAGS+=-lsecur32 else objects += unix.o conf.o log.o endif diff --git a/configure b/configure index d92a2fc6..62f0f5d9 100755 --- a/configure +++ b/configure @@ -511,8 +511,6 @@ CYGWIN* ) ;; Windows ) echo OUTFILE=bitlbee.exe >> Makefile.settings - echo LFLAGS+=-lws2_32 >> Makefile.settings - echo EFLAGS+=-lsecur32 >> Makefile.settings ;; * ) echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' diff --git a/doc/BUILD.win32 b/doc/BUILD.win32 index e00cfdda..e1afe600 100644 --- a/doc/BUILD.win32 +++ b/doc/BUILD.win32 @@ -1,35 +1,10 @@ -Instructions for building BitlBee on Windows -================================================ +Instructions for building BitlBee for Windows +============================================= -1. Download the latest version using bzr (http://www.bazaar-ng.org/): +1) Install the mingw32 compiler - H:\> bzr branch http://win32.bitlbee.org/bzr bitlbee-win32 - ... +2) Compile GLib2 for the target i586-mingw32msvc -2. Download and install the required development files: - from ftp://ftp.gtk.org/pub/gtk/v2.8/win32/ - - glib - - glib-dev - - libiconv (in dependencies/) - - gettext (in dependencies/) - from http://ftp.mozilla.org/pub/mozilla.org/ - - nss (in security/nss/) - - nspr (in nspr/) +3) Cross-compile BitlBee: - glib and gettext are only required for actually running BitlBee - building - should work fine without them. - -3. Set the following variables in Makefile.settings, if you don't have the - libraries above installed in the default directories searched by MSVC: - - - GLIB_DIR - - NSS_DIR - - NSPR_DIR - -4. Build: - - H:\BitlBee> nmake /f win32.mk - ... - -5. To build setup files, compile the bitlbee.iss file using the Inno Setup - program (available from www.jrsoftware.org). +$ ./configure --target=i586-mingw32msvc --ssl=bogus --arch=Windows diff --git a/utils/cross-compile.win32 b/utils/cross-compile.win32 deleted file mode 100755 index c90ebc1b..00000000 --- a/utils/cross-compile.win32 +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Simple cross compilation script for BitlBee using mingw32 -# (C) Jelmer Vernooij 2005-2006 - -GTK_SITE=ftp://ftp.gtk.org/pub/gtk/v2.8/win32 - -GLIB_VERSION=2.10.1 -LIBICONV_VERSION=1.9.1 -GETTEXT_VERSION=0.14.5 - -wget -c $GTK_SITE/glib-dev-$GLIB_VERSION.zip -wget -c $GTK_SITE/dependencies/libiconv-$LIBICONV_VERSION.bin.woe32.zip -wget -c $GTK_SITE/dependencies/gettext-dev-$GETTEXT_VERSION.zip - -DEPSDIR=`mktemp -d` - -unzip -d $DEPSDIR -o libiconv-$LIBICONV_VERSION.bin.woe32.zip -unzip -d $DEPSDIR -o glib-dev-$GLIB_VERSION.zip -unzip -d $DEPSDIR -o gettext-dev-$GETTEXT_VERSION.zip - -LD=i586-mingw32msvc-ld CC=i586-mingw32msvc-gcc STRIP=i586-mingw32msvc-strip PKG_CONFIG_PATH="$DEPSDIR/lib/pkgconfig" PKG_CONFIG="pkg-config --define-variable=prefix=\"$DEPSDIR\"" ./configure --ssl=sspi --arch=Windows diff --git a/win32.mk b/win32.mk deleted file mode 100644 index 59ca7a81..00000000 --- a/win32.mk +++ /dev/null @@ -1,136 +0,0 @@ -!INCLUDE Makefile.settings - -GLIB_CFLAGS = /I "$(GLIB_DIR)\include" \ - /I "$(GLIB_DIR)\include\glib-2.0" \ - /I "$(GLIB_DIR)\lib\glib-2.0\include" - -GLIB_LFLAGS = /libpath:"$(GLIB_DIR)\lib" - -NSS_CFLAGS = /I "$(NSS_DIR)\include" /I "$(NSPR_DIR)\include" -NSS_LFLAGS = /libpath:"$(NSS_DIR)\lib" /libpath:"$(NSPR_DIR)\lib" -NSS_LIBS = nss3.lib ssl3.lib libnspr4.lib - -COMMON_LIBS = kernel32.lib user32.lib advapi32.lib shell32.lib iconv.lib \ - glib-2.0.lib gmodule-2.0.lib wsock32.lib advapi32.lib - - -MAIN_OBJS = account.obj bitlbee.obj commands.obj crypting.obj \ - help.obj irc.obj protocols\md5.obj protocols\nogaim.obj \ - protocols\sha.obj protocols\proxy.obj query.obj nick.obj set.obj \ - user.obj protocols\util.obj win32.obj - -MAIN_LIBS = $(COMMON_LIBS) - -SSL_OBJS = protocols\ssl_nss.obj -SSL_LIBS = $(NSS_LFLAGS) $(NSS_LIBS) - -MSN_OBJS = \ - protocols\msn\msn.obj \ - protocols\msn\msn_util.obj \ - protocols\msn\ns.obj \ - protocols\msn\passport.obj \ - protocols\msn\sb.obj \ - protocols\msn\tables.obj \ - $(SSL_OBJS) - -MSN_LIBS = $(COMMON_LIBS) $(SSL_LIBS) - -OSCAR_OBJS = \ - protocols\oscar\admin.obj \ - protocols\oscar\auth.obj \ - protocols\oscar\bos.obj \ - protocols\oscar\buddylist.obj \ - protocols\oscar\chat.obj \ - protocols\oscar\chatnav.obj \ - protocols\oscar\conn.obj \ - protocols\oscar\icq.obj \ - protocols\oscar\im.obj \ - protocols\oscar\info.obj \ - protocols\oscar\misc.obj \ - protocols\oscar\msgcookie.obj \ - protocols\oscar\oscar.obj \ - protocols\oscar\oscar_util.obj \ - protocols\oscar\rxhandlers.obj \ - protocols\oscar\rxqueue.obj \ - protocols\oscar\search.obj \ - protocols\oscar\service.obj \ - protocols\oscar\snac.obj \ - protocols\oscar\ssi.obj \ - protocols\oscar\stats.obj \ - protocols\oscar\tlv.obj \ - protocols\oscar\txqueue.obj - -OSCAR_LIBS = $(COMMON_LIBS) - -JABBER_OBJS = \ - protocols\jabber\expat.obj \ - protocols\jabber\genhash.obj \ - protocols\jabber\hashtable.obj \ - protocols\jabber\jabber.obj \ - protocols\jabber\jconn.obj \ - protocols\jabber\jid.obj \ - protocols\jabber\jpacket.obj \ - protocols\jabber\jutil.obj \ - protocols\jabber\karma.obj \ - protocols\jabber\log.obj \ - protocols\jabber\pool.obj \ - protocols\jabber\pproxy.obj \ - protocols\jabber\rate.obj \ - protocols\jabber\str.obj \ - protocols\jabber\xhash.obj \ - protocols\jabber\xmlnode.obj \ - protocols\jabber\xmlparse.obj \ - protocols\jabber\xmlrole.obj \ - protocols\jabber\xmltok.obj \ - protocols\jabber\xstream.obj \ - $(SSL_OBJS) - -JABBER_LIBS = $(COMMON_LIBS) $(SSL_LIBS) - -YAHOO_OBJS = \ - protocols\yahoo\crypt.obj \ - protocols\yahoo\libyahoo2.obj \ - protocols\yahoo\vc50.idb \ - protocols\yahoo\yahoo.obj \ - protocols\yahoo\yahoo_fn.obj \ - protocols\yahoo\yahoo_httplib.obj \ - protocols\yahoo\yahoo_list.obj \ - protocols\yahoo\yahoo_util.obj - -YAHOO_LIBS = $(COMMON_LIBS) - -CC=cl.exe -CFLAGS=$(GLIB_CFLAGS) $(NSS_CFLAGS) /D NDEBUG /D WIN32 /D _WINDOWS \ - /I . /I protocols /I protocols\oscar /nologo \ - /D GLIB2 /D ARCH="\"Windows\"" /D CPU="\"x86\"" \ - /D PLUGINDIR="plugins" - -.c.obj: - $(CC) $(CFLAGS) /c /Fo$@ $< - -ALL: bitlbee.exe libmsn.dll liboscar.dll libjabber.dll libyahoo.dll - -LINK32=link.exe -LINK32_FLAGS=/nologo $(GLIB_LFLAGS) - -bitlbee.exe: $(DEF_FILE) $(MAIN_OBJS) - $(LINK32) $(MAIN_LIBS) $(LINK32_FLAGS) /out:bitlbee.exe $(MAIN_OBJS) - -libmsn.dll: $(MSN_OBJS) - $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:msn_init $(MSN_LIBS) $(LINK32_FLAGS) /out:libmsn.dll $(MSN_OBJS) - -libyahoo.dll: $(YAHOO_OBJS) - $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:yahoo_init $(YAHOO_LIBS) $(LINK32_FLAGS) /out:libyahoo.dll $(YAHOO_OBJS) - -liboscar.dll: $(OSCAR_OBJS) - $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:oscar_init $(OSCAR_LIBS) $(LINK32_FLAGS) /out:liboscar.dll $(OSCAR_OBJS) - -libjabber.dll: $(JABBER_OBJS) - $(LINK32) /DLL /SUBSYSTEM:WINDOWS /ENTRY:jabber_init $(JABBER_LIBS) $(LINK32_FLAGS) /out:libjabber.dll $(JABBER_OBJS) - -clean: - @-erase $(MAIN_OBJS) - @-erase $(MSN_OBJS) - @-erase $(JABBER_OBJS) - @-erase $(OSCAR_OBJS) - @-erase $(YAHOO_OBJS) -- cgit v1.2.3 From 6a72a574df321683ee51f7cef14255cbb4cdbeba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 10 Jun 2008 05:43:46 +0200 Subject: Move OUTFILE determination to Makefile rather than configure. --- Makefile | 2 ++ configure | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fa202ef1..5309adf4 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,10 @@ ifeq ($(TARGET),i586-mingw32msvc) objects += win32.o LFLAGS+=-lws2_32 EFLAGS+=-lsecur32 +OUTFILE=bitlbee.exe else objects += unix.o conf.o log.o +OUTFILE=bitlbee endif # Expansion of variables diff --git a/configure b/configure index 62f0f5d9..b3a98086 100755 --- a/configure +++ b/configure @@ -112,7 +112,6 @@ PCDIR=$pcdir TARGET=$target ARCH=$arch CPU=$cpu -OUTFILE=bitlbee DESTDIR= LFLAGS= @@ -510,7 +509,6 @@ CYGWIN* ) echo 'Cygwin is not officially supported.' ;; Windows ) - echo OUTFILE=bitlbee.exe >> Makefile.settings ;; * ) echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' -- cgit v1.2.3 From 52df5dfbe4761c26326083bef9daa80af9716858 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 14 Jun 2008 02:19:12 +0100 Subject: This seems to fix the Yahoo! logoff code. I have no idea why this was broken (on purpose) in libyahoo2, but this fix seems to work and at least Valgrind is still happy. And I actually see myself log off now, and the fd is actually cleaned up properly. --- protocols/yahoo/libyahoo2.c | 11 ++++------- protocols/yahoo/yahoo.c | 4 ---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 80d88a85..897ba27b 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -380,7 +380,6 @@ static void del_from_list(struct yahoo_data *yd) } /* call repeatedly to get the next one */ -/* static struct yahoo_input_data * find_input_by_id(int id) { YList *l; @@ -391,7 +390,6 @@ static struct yahoo_input_data * find_input_by_id(int id) } return NULL; } -*/ static struct yahoo_input_data * find_input_by_id_and_webcam_user(int id, const char * who) { @@ -796,6 +794,7 @@ static int yahoo_send_data(int fd, void *data, int len) void yahoo_close(int id) { struct yahoo_data *yd = find_conn_by_id(id); + if(!yd) return; @@ -3165,7 +3164,7 @@ int yahoo_write_ready(int id, int fd, void *data) struct data_queue *tx; LOG(("write callback: id=%d fd=%d data=%p", id, fd, data)); - if(!yid || !yid->txqueues) + if(!yid || !yid->txqueues || !find_conn_by_id(id)) return -2; tx = yid->txqueues->data; @@ -3841,11 +3840,9 @@ void yahoo_logoff(int id) } } - -/* do { + do { yahoo_input_close(yid); - } while((yid = find_input_by_id(id)));*/ - + } while((yid = find_input_by_id(id))); } void yahoo_get_list(int id) diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index ab30df4d..c84685e9 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -453,10 +453,6 @@ gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condit { struct byahoo_write_ready_data *d = data; - if( !byahoo_get_ic_by_id( d->id ) ) - /* WTF doesn't libyahoo clean this up? */ - return FALSE; - yahoo_write_ready( d->id, d->fd, d->data ); return FALSE; -- cgit v1.2.3 From 5ec4129afd5d47d7cea5d9cb455a364c17c8a8fa Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Jun 2008 01:04:27 +0100 Subject: Added parsing of Jabber chatroom invitations. --- protocols/jabber/message.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index fab62a91..6cb67d42 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -48,6 +48,23 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) else /* "chat", "normal", "headline", no-type or whatever. Should all be pretty similar. */ { GString *fullmsg = g_string_new( "" ); + + for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) + { + char *ns = xt_find_attr( c, "xmlns" ), *room; + struct xt_node *inv, *reason; + + if( strcmp( ns, XMLNS_MUC_USER ) == 0 && + ( inv = xt_find_node( c->children, "invite" ) ) ) + { + room = from; + from = xt_find_attr( inv, "from" ) ? : from; + + g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); + if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) + g_string_append( fullmsg, reason->text ); + } + } if( ( s = strchr( from, '/' ) ) ) { -- cgit v1.2.3 From 7f697401c8261459ce60c985ae1423db7b22c79b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Jun 2008 19:11:47 +0100 Subject: Using a port list instead of a single range for the allowed Jabber port numbers, adding 80 and 443. Partially closes #265. --- protocols/jabber/jabber.c | 32 +++++++++++++++++++++++++++----- protocols/jabber/jabber.h | 4 ---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 0e23b4d4..52a87d5d 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -36,11 +36,30 @@ GSList *jabber_connections; +/* First enty is the default */ +static const int jabber_port_list[] = { + 5222, + 5223, + 5220, + 5221, + 5224, + 5225, + 5226, + 5227, + 5228, + 5229, + 80, + 443, + 0 +}; + static void jabber_init( account_t *acc ) { set_t *s; + char str[16]; - s = set_add( &acc->set, "port", JABBER_PORT_DEFAULT, set_eval_int, acc ); + g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] ); + s = set_add( &acc->set, "port", str, set_eval_int, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; s = set_add( &acc->set, "priority", "0", set_eval_priority, acc ); @@ -71,6 +90,7 @@ static void jabber_login( account_t *acc ) struct jabber_data *jd = g_new0( struct jabber_data, 1 ); struct ns_srv_reply *srv = NULL; char *connect_to, *s; + int i; /* For now this is needed in the _connected() handlers if using GLib event handling, to make sure we're not handling events @@ -176,11 +196,13 @@ static void jabber_login( account_t *acc ) imcb_log( ic, "Connecting" ); - if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN || - set_getint( &acc->set, "port" ) > JABBER_PORT_MAX ) + for( i = 0; jabber_port_list[i] > 0; i ++ ) + if( set_getint( &acc->set, "port" ) == jabber_port_list[i] ) + break; + + if( jabber_port_list[i] == 0 ) { - imcb_log( ic, "Incorrect port number, must be in the %d-%d range", - JABBER_PORT_MIN, JABBER_PORT_MAX ); + imcb_log( ic, "Illegal port number" ); imc_logout( ic, FALSE ); return; } diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 1ff0e8dd..023cf0f9 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -134,10 +134,6 @@ struct jabber_chat #define JABBER_XMLCONSOLE_HANDLE "xmlconsole" -#define JABBER_PORT_DEFAULT "5222" -#define JABBER_PORT_MIN 5220 -#define JABBER_PORT_MAX 5229 - /* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the first one should be used, but when storing a packet in the cache, a "special" kind of ID is assigned to make it easier later to figure out -- cgit v1.2.3 From 945eb1ee5b118669387f415d1a45d766c6f79640 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 15 Jun 2008 23:20:20 +0200 Subject: Add myself to uploaders, bump standards version to 3.8.0. --- debian/changelog | 7 +++++++ debian/control | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f4b71762..074b2af8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +bitlbee (1.2-5) unstable; urgency=low + + * Add myself to uploaders. + * Bump standards version to 3.8.0. + + -- Jelmer Vernooij Sun, 15 Jun 2008 23:19:14 +0200 + bitlbee (1.2-4) unstable; urgency=low * Fixed init script to use the BITLBEE_OPTS variable, not an undefined diff --git a/debian/control b/debian/control index 8faa27b8..199df0a6 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,10 @@ Source: bitlbee Section: net Priority: optional Maintainer: Wilmer van der Gaast -Standards-Version: 3.5.9 +Uploaders: Jelmer Vernooij +Standards-Version: 3.8.0 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf +DM-Upload-Allowed: yes Package: bitlbee Architecture: any -- cgit v1.2.3 From 7601353f20781f1fb9bba7e61697bc984ed0fd20 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 15 Jun 2008 23:49:15 +0200 Subject: Fix FSF address. --- debian/changelog | 3 ++- debian/copyright | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 074b2af8..fc55b537 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ bitlbee (1.2-5) unstable; urgency=low * Add myself to uploaders. * Bump standards version to 3.8.0. + * Fix FSF address. - -- Jelmer Vernooij Sun, 15 Jun 2008 23:19:14 +0200 + -- Jelmer Vernooij Sun, 15 Jun 2008 23:48:54 +0200 bitlbee (1.2-4) unstable; urgency=low diff --git a/debian/copyright b/debian/copyright index 40a777a9..03db5c7a 100644 --- a/debian/copyright +++ b/debian/copyright @@ -25,8 +25,8 @@ BitlBee License: You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; - if not, write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA + if not, write to the Free Software Foundation, Inc., 51 Franklin St, + Fifth Floor, Boston, MA 02110-1301, USA. ============================================================================ @@ -39,7 +39,7 @@ The SGML-formatted documentation is written by Jelmer Vernooij Version 1.1, March 2000 Copyright (C) 2000 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin St, 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. -- cgit v1.2.3 From e565ce246909cbb2aea9a4aa21377a8c0f5246fa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 16 Jun 2008 00:30:08 +0200 Subject: Stop ignoring distclean exit code. --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 67cb79a3..661cf30e 100755 --- a/debian/rules +++ b/debian/rules @@ -21,7 +21,7 @@ build-arch-stamp: clean: [ "`whoami`" = "root" -a -d debian ] rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files debian/bitlbee-dev - -$(MAKE) distclean + $(MAKE) distclean # -$(MAKE) -C doc/ clean -- cgit v1.2.3 From f00e3ad082f84bd3e513bffa6ebe6800c4f66282 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 16 Jun 2008 02:26:47 +0200 Subject: Avoid changing UID from init script (already done by BitlBee itself). --- debian/bitlbee.init | 1 - debian/changelog | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/bitlbee.init b/debian/bitlbee.init index 904ae5ea..f8fac49c 100755 --- a/debian/bitlbee.init +++ b/debian/bitlbee.init @@ -43,7 +43,6 @@ d_start() { chown bitlbee /var/run/bitlbee.pid start-stop-daemon --start --quiet --pidfile $PIDFILE \ - -c bitlbee: \ --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS } diff --git a/debian/changelog b/debian/changelog index fc55b537..ff2b4071 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ bitlbee (1.2-5) unstable; urgency=low * Add myself to uploaders. * Bump standards version to 3.8.0. * Fix FSF address. + * Avoid changing uid from init script. (Closes: #474589) - -- Jelmer Vernooij Sun, 15 Jun 2008 23:48:54 +0200 + -- Jelmer Vernooij Mon, 16 Jun 2008 00:53:20 +0200 bitlbee (1.2-4) unstable; urgency=low -- cgit v1.2.3 From da7b4847f5561dcf9b4aefa2968d3d27327e5183 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 21 Jun 2008 18:09:20 +0100 Subject: Fixed memory leaking ipc_readline(). --- ipc.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ipc.c b/ipc.c index 54f026ac..06618695 100644 --- a/ipc.c +++ b/ipc.c @@ -208,19 +208,19 @@ static void ipc_command_exec( void *data, char **cmd, const command_t *commands } } +/* Return just one line. Returns NULL if something broke, an empty string + on temporary "errors" (EAGAIN and friends). */ static char *ipc_readline( int fd ) { - char *buf, *eol; + char buf[513], *eol; int size; - buf = g_new0( char, 513 ); - /* Because this is internal communication, it should be pretty safe to just peek at the message, find its length (by searching for the end-of-line) and then just read that message. With internal sockets and limites message length, messages should always be complete. Saves us quite a lot of code and buffering. */ - size = recv( fd, buf, 512, MSG_PEEK ); + size = recv( fd, buf, sizeof( buf ) - 1, MSG_PEEK ); if( size == 0 || ( size < 0 && !sockerr_again() ) ) return NULL; else if( size < 0 ) /* && sockerr_again() */ @@ -228,21 +228,15 @@ static char *ipc_readline( int fd ) else buf[size] = 0; - eol = strstr( buf, "\r\n" ); - if( eol == NULL ) + if( ( eol = strstr( buf, "\r\n" ) ) == NULL ) return NULL; else size = eol - buf + 2; - g_free( buf ); - buf = g_new0( char, size + 1 ); - if( recv( fd, buf, size, 0 ) != size ) return NULL; else - buf[size-2] = 0; - - return buf; + return g_strndup( buf, size - 2 ); } gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ) -- cgit v1.2.3 From edc767b8781d7c56ab3cfe67e2c816694722f5d0 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 21 Jun 2008 18:19:27 +0100 Subject: Fixed two more embarassing memory leaks. --- ipc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ipc.c b/ipc.c index 06618695..f853a18f 100644 --- a/ipc.c +++ b/ipc.c @@ -247,7 +247,11 @@ gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ) { cmd = irc_parse_line( buf ); if( cmd ) + { ipc_command_exec( data, cmd, ipc_master_commands ); + g_free( cmd ); + } + g_free( buf ); } else { @@ -265,7 +269,11 @@ gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ) { cmd = irc_parse_line( buf ); if( cmd ) + { ipc_command_exec( data, cmd, ipc_child_commands ); + g_free( cmd ); + } + g_free( buf ); } else { -- cgit v1.2.3 From 3e6764ab9c8ebd99683fd3c153161d96b32e05de Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 00:34:11 +0100 Subject: Added jabber_util unittests (buddy_add/_by_jid only ATM). --- protocols/jabber/jabber_util.c | 4 ++- tests/Makefile | 2 +- tests/check.c | 4 +++ tests/check_jabber_sasl.c | 1 - tests/check_jabber_util.c | 77 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 tests/check_jabber_util.c diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 518624f6..78d1009c 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -524,7 +524,9 @@ int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ ) /* If there's only one item in the list (and if the resource matches), removing it is simple. (And the hash reference should be removed too!) */ - if( bud->next == NULL && ( ( s == NULL || bud->resource == NULL ) || g_strcasecmp( bud->resource, s + 1 ) == 0 ) ) + if( bud->next == NULL && + ( ( s == NULL && bud->resource == NULL ) || + ( bud->resource && s && g_strcasecmp( bud->resource, s + 1 ) == 0 ) ) ) { g_hash_table_remove( jd->buddies, bud->bare_jid ); g_free( bud->bare_jid ); diff --git a/tests/Makefile b/tests/Makefile index ae76fef5..db145503 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -12,7 +12,7 @@ distclean: clean main_objs = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_xml.o storage_text.o user.o -test_objs = check.o check_util.o check_nick.o check_md5.o check_arc.o check_irc.o check_help.o check_user.o check_crypting.o check_set.o check_jabber_sasl.o +test_objs = check.o check_util.o check_nick.o check_md5.o check_arc.o check_irc.o check_help.o check_user.o check_crypting.o check_set.o check_jabber_sasl.o check_jabber_util.o check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o @echo '*' Linking $@ diff --git a/tests/check.c b/tests/check.c index b3ffb957..874acdd2 100644 --- a/tests/check.c +++ b/tests/check.c @@ -68,6 +68,9 @@ Suite *set_suite(void); /* From check_jabber_sasl.c */ Suite *jabber_sasl_suite(void); +/* From check_jabber_sasl.c */ +Suite *jabber_util_suite(void); + int main (int argc, char **argv) { int nf; @@ -114,6 +117,7 @@ int main (int argc, char **argv) srunner_add_suite(sr, crypting_suite()); srunner_add_suite(sr, set_suite()); srunner_add_suite(sr, jabber_sasl_suite()); + srunner_add_suite(sr, jabber_util_suite()); if (no_fork) srunner_set_fork_status(sr, CK_NOFORK); srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL); diff --git a/tests/check_jabber_sasl.c b/tests/check_jabber_sasl.c index 6bceeb88..63118d39 100644 --- a/tests/check_jabber_sasl.c +++ b/tests/check_jabber_sasl.c @@ -4,7 +4,6 @@ #include #include #include -#include "arc.h" char *sasl_get_part( char *data, char *field ); diff --git a/tests/check_jabber_util.c b/tests/check_jabber_util.c new file mode 100644 index 00000000..2d54ed23 --- /dev/null +++ b/tests/check_jabber_util.c @@ -0,0 +1,77 @@ +#include +#include +#include +#include +#include +#include +#include "jabber/jabber.h" + +static struct im_connection *ic; + +static void check_buddy_add(int l) +{ + struct jabber_buddy *budw1, *budw2, *budw3, *budw4, *budn; + int i; + + budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" ); + budw1->last_act = time( NULL ) - 100; + budw2 = jabber_buddy_add( ic, "wilmer@gaast.net/Telepathy" ); + budw2->priority = 2; + budw2->last_act = time( NULL ); + budw3 = jabber_buddy_add( ic, "wilmer@gaast.net/Druif" ); + budw3->last_act = time( NULL ) - 200; + budw3->priority = 4; + /* TODO(wilmer): Shouldn't this just return budw3? */ + fail_if( jabber_buddy_add( ic, "wilmer@gaast.net/druif" ) != NULL ); + + budn = jabber_buddy_add( ic, "nekkid@lamejab.net" ); + /* Shouldn't be allowed if there's already a bare JID. */ + fail_if( jabber_buddy_add( ic, "nekkid@lamejab.net/Illegal" ) ); + + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", 0 ) == budw1 ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/bitlbee", GET_BUDDY_EXACT ) == budw1 ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", GET_BUDDY_CREAT ) == budw1 ); + + fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_EXACT ) ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_FIRST ) == budw1 ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw3 ); + + set_setstr( &ic->acc->set, "resource_select", "activity" ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw2 ); + + fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net/Illegal", 0 ) ); + fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net/Illegal", GET_BUDDY_CREAT ) ); + fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) == budn ); + fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", GET_BUDDY_EXACT ) == budn ); + fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", GET_BUDDY_CREAT ) == budn ); + + jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); + + fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); + + fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) ); + fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) ); + + fail_if( jabber_buddy_remove( ic, "nekkid@lamejab.net/Illegal" ) ); + fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) ); + fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) ); +} + +Suite *jabber_util_suite (void) +{ + Suite *s = suite_create("jabber/util"); + TCase *tc_core = tcase_create("Buddy"); + struct jabber_data *jd; + + ic = g_new0( struct im_connection, 1 ); + ic->acc = g_new0( account_t, 1 ); + ic->proto_data = jd = g_new0( struct jabber_data, 1 ); + jd->buddies = g_hash_table_new( g_str_hash, g_str_equal ); + set_add( &ic->acc->set, "resource_select", "priority", NULL, ic->acc ); + + suite_add_tcase (s, tc_core); + tcase_add_test (tc_core, check_buddy_add); + return s; +} -- cgit v1.2.3 From 98de2cca016d458ad2980c59f334fae10164b3bb Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 00:51:18 +0100 Subject: Now preserving case in JID resources, and handling them with case sensitivity since apparently that's how the RFC wants it. (While the rest of the JID should be case IN-sensitive. Consistency is hard to find these days...) Also extended the unittests a little bit. Closes #422. --- protocols/jabber/jabber_util.c | 33 ++++++++++++++++++--------------- tests/check_jabber_util.c | 42 ++++++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 78d1009c..44dc5984 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -289,8 +289,13 @@ char *jabber_normalize( const char *orig ) len = strlen( orig ); new = g_new( char, len + 1 ); - for( i = 0; i < len; i ++ ) + + /* So it turns out the /resource part is case sensitive. Yeah, and + it's Unicode but feck Unicode. :-P So stop once we see a slash. */ + for( i = 0; i < len && orig[i] != '/' ; i ++ ) new[i] = tolower( orig[i] ); + for( ; orig[i]; i ++ ) + new[i] = orig[i]; new[i] = 0; return new; @@ -333,7 +338,7 @@ struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid_ for( bi = bud; bi; bi = bi->next ) { /* Check for dupes. */ - if( g_strcasecmp( bi->resource, s + 1 ) == 0 ) + if( strcmp( bi->resource, s + 1 ) == 0 ) { *s = '/'; g_free( new ); @@ -386,7 +391,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, if( ( s = strchr( jid, '/' ) ) ) { - int none_found = 0; + int bare_exists = 0; *s = 0; if( ( bud = g_hash_table_lookup( jd->buddies, jid ) ) ) @@ -409,21 +414,19 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, /* See if there's an exact match. */ for( ; bud; bud = bud->next ) - if( g_strcasecmp( bud->resource, s + 1 ) == 0 ) + if( strcmp( bud->resource, s + 1 ) == 0 ) break; } else { - /* This hack is there to make sure that O_CREAT will - work if there's already another resouce present - for this JID, even if it's an unknown buddy. This - is done to handle conferences properly. */ - none_found = 1; - /* TODO(wilmer): Find out what I was thinking when I - wrote this??? And then fix it. This makes me sad... */ + /* This variable tells the if down here that the bare + JID already exists and we should feel free to add + more resources, if the caller asked for that. */ + bare_exists = 1; } - if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && ( imcb_find_buddy( ic, jid ) || !none_found ) ) + if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && + ( !bare_exists || imcb_find_buddy( ic, jid ) ) ) { *s = '/'; bud = jabber_buddy_add( ic, jid ); @@ -448,7 +451,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, else if( bud->resource && ( flags & GET_BUDDY_EXACT ) ) /* We want an exact match, so in thise case there shouldn't be a /resource. */ return NULL; - else if( ( bud->resource == NULL || bud->next == NULL ) ) + else if( bud->resource == NULL || bud->next == NULL ) /* No need for selection if there's only one option. */ return bud; else if( flags & GET_BUDDY_FIRST ) @@ -526,7 +529,7 @@ int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ ) should be removed too!) */ if( bud->next == NULL && ( ( s == NULL && bud->resource == NULL ) || - ( bud->resource && s && g_strcasecmp( bud->resource, s + 1 ) == 0 ) ) ) + ( bud->resource && s && strcmp( bud->resource, s + 1 ) == 0 ) ) ) { g_hash_table_remove( jd->buddies, bud->bare_jid ); g_free( bud->bare_jid ); @@ -549,7 +552,7 @@ int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ ) else { for( bi = bud, prev = NULL; bi; bi = (prev=bi)->next ) - if( g_strcasecmp( bi->resource, s + 1 ) == 0 ) + if( strcmp( bi->resource, s + 1 ) == 0 ) break; g_free( full_jid ); diff --git a/tests/check_jabber_util.c b/tests/check_jabber_util.c index 2d54ed23..4728c5ee 100644 --- a/tests/check_jabber_util.c +++ b/tests/check_jabber_util.c @@ -10,47 +10,61 @@ static struct im_connection *ic; static void check_buddy_add(int l) { - struct jabber_buddy *budw1, *budw2, *budw3, *budw4, *budn; - int i; + struct jabber_buddy *budw1, *budw2, *budw3, *budn, *bud; budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" ); budw1->last_act = time( NULL ) - 100; - budw2 = jabber_buddy_add( ic, "wilmer@gaast.net/Telepathy" ); + budw2 = jabber_buddy_add( ic, "WILMER@gaast.net/Telepathy" ); budw2->priority = 2; budw2->last_act = time( NULL ); - budw3 = jabber_buddy_add( ic, "wilmer@gaast.net/Druif" ); + budw3 = jabber_buddy_add( ic, "wilmer@GAAST.NET/bitlbee" ); budw3->last_act = time( NULL ) - 200; budw3->priority = 4; /* TODO(wilmer): Shouldn't this just return budw3? */ - fail_if( jabber_buddy_add( ic, "wilmer@gaast.net/druif" ) != NULL ); + fail_if( jabber_buddy_add( ic, "wilmer@gaast.net/Telepathy" ) != NULL ); budn = jabber_buddy_add( ic, "nekkid@lamejab.net" ); /* Shouldn't be allowed if there's already a bare JID. */ fail_if( jabber_buddy_add( ic, "nekkid@lamejab.net/Illegal" ) ); + /* Case sensitivity: Case only matters after the / */ + fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", 0 ) == + jabber_buddy_by_jid( ic, "wilmer@gaast.net/bitlbee", 0 ) ); + fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net/telepathy", 0 ) ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", 0 ) == budw1 ); - fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/bitlbee", GET_BUDDY_EXACT ) == budw1 ); - fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", GET_BUDDY_CREAT ) == budw1 ); + fail_unless( jabber_buddy_by_jid( ic, "WILMER@GAAST.NET/BitlBee", GET_BUDDY_EXACT ) == budw1 ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET/BitlBee", GET_BUDDY_CREAT ) == budw1 ); fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_EXACT ) ); - fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_FIRST ) == budw1 ); - fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw3 ); + fail_unless( jabber_buddy_by_jid( ic, "WILMER@gaast.net", 0 ) == budw3 ); + + /* Check O_FIRST and see if it's indeed the first item from the list. */ + fail_unless( ( bud = jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_FIRST ) ) == budw1 ); + fail_unless( bud->next == budw2 && bud->next->next == budw3 && bud->next->next->next == NULL ); + /* Change the resource_select setting, now we should get a different resource. */ set_setstr( &ic->acc->set, "resource_select", "activity" ); - fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw2 ); + fail_unless( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET", 0 ) == budw2 ); + /* Some testing of bare JID handling (which is horrible). */ fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net/Illegal", 0 ) ); - fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net/Illegal", GET_BUDDY_CREAT ) ); + fail_if( jabber_buddy_by_jid( ic, "NEKKID@LAMEJAB.NET/Illegal", GET_BUDDY_CREAT ) ); fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) == budn ); - fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", GET_BUDDY_EXACT ) == budn ); - fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", GET_BUDDY_CREAT ) == budn ); + fail_unless( jabber_buddy_by_jid( ic, "NEKKID@lamejab.net", GET_BUDDY_EXACT ) == budn ); + fail_unless( jabber_buddy_by_jid( ic, "nekkid@LAMEJAB.NET", GET_BUDDY_CREAT ) == budn ); - jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ); + /* More case sensitivity testing, and see if remove works properly. */ + fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) ); + fail_if( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET/telepathy", GET_BUDDY_CREAT ) == budw2 ); + fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/Telepathy" ) ); + fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) ); fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) ); fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); + /* Check if remove_bare() indeed gets rid of all. */ fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) ); fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) ); -- cgit v1.2.3 From 424e66361e985d05e47a7af42e81cd32b09dd6e2 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 10:32:46 +0100 Subject: Partial fix for #419: Moved normalize() and some other stuff to OSCAR becuase it's the only place where it's used, and using this to strip spaces from all screennames before sending them to BitlBee. --- lib/misc.c | 25 ---------------- lib/misc.h | 1 - protocols/nogaim.h | 5 ---- protocols/oscar/oscar.c | 80 ++++++++++++++++++++++++++++++++++--------------- 4 files changed, 56 insertions(+), 55 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index ccf208b5..1ecb5181 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -61,31 +61,6 @@ void strip_linefeed(gchar *text) g_free(text2); } -char *normalize(const char *s) -{ - static char buf[BUF_LEN]; - char *t, *u; - int x = 0; - - g_return_val_if_fail((s != NULL), NULL); - - u = t = g_strdup(s); - - strcpy(t, s); - g_strdown(t); - - while (*t && (x < BUF_LEN - 1)) { - if (*t != ' ') { - buf[x] = *t; - x++; - } - t++; - } - buf[x] = '\0'; - g_free(u); - return buf; -} - time_t get_time(int year, int month, int day, int hour, int min, int sec) { struct tm tm; diff --git a/lib/misc.h b/lib/misc.h index a2acada6..5376cd22 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -40,7 +40,6 @@ struct ns_srv_reply G_MODULE_EXPORT void strip_linefeed( gchar *text ); G_MODULE_EXPORT char *add_cr( char *text ); G_MODULE_EXPORT char *strip_newlines(char *source); -G_MODULE_EXPORT char *normalize( const char *s ); G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec ); double gettime( void ); diff --git a/protocols/nogaim.h b/protocols/nogaim.h index bdd8bae2..9fe843b5 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -44,11 +44,6 @@ #include "query.h" #include "md5.h" -#define BUF_LEN MSG_LEN -#define BUF_LONG ( BUF_LEN * 2 ) -#define MSG_LEN 2048 -#define BUF_LEN MSG_LEN - #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ #define WEBSITE "http://www.bitlbee.org/" diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 7738c31f..819ec27d 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -60,6 +60,9 @@ #define OSCAR_GROUP "Friends" +#define BUF_LEN 2048 +#define BUF_LONG ( BUF_LEN * 2 ) + /* Don't know if support for UTF8 is really working. For now it's UTF16 here. static int gaim_caps = AIM_CAPS_UTF8; */ @@ -240,6 +243,32 @@ static char *msgerrreason[] = { }; static int msgerrreasonlen = 25; +/* Hurray, this function is NOT thread-safe \o/ */ +static char *normalize(const char *s) +{ + static char buf[BUF_LEN]; + char *t, *u; + int x = 0; + + g_return_val_if_fail((s != NULL), NULL); + + u = t = g_strdup(s); + + strcpy(t, s); + g_strdown(t); + + while (*t && (x < BUF_LEN - 1)) { + if (*t != ' ' && *t != '!') { + buf[x] = *t; + x++; + } + t++; + } + buf[x] = '\0'; + g_free(u); + return buf; +} + static gboolean oscar_callback(gpointer data, gint source, b_input_condition condition) { aim_conn_t *conn = (aim_conn_t *)data; @@ -1001,13 +1030,13 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { g_hash_table_insert(od->ips, uin, (gpointer) (long) info->icqinfo.ipaddr); } - tmp = g_strdup(normalize(ic->acc->user)); - if (!strcmp(tmp, normalize(info->sn))) + if (!aim_sncmp(tmp, normalize(info->sn))) g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); - g_free(tmp); - imcb_buddy_status(ic, info->sn, flags, state_string, NULL); - /* imcb_buddy_times(ic, info->sn, signon, time_idle); */ + tmp = normalize(info->sn); + imcb_buddy_status(ic, tmp, flags, state_string, NULL); + /* imcb_buddy_times(ic, tmp, signon, time_idle); */ + return 1; } @@ -1021,7 +1050,7 @@ static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { info = va_arg(ap, aim_userinfo_t *); va_end(ap); - imcb_buddy_status(ic, info->sn, 0, NULL, NULL ); + imcb_buddy_status(ic, normalize(info->sn), 0, NULL, NULL ); return 1; } @@ -1077,7 +1106,7 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } strip_linefeed(tmp); - imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0); + imcb_buddy_msg(ic, normalize(userinfo->sn), tmp, flags, 0); g_free(tmp); return 1; @@ -1176,7 +1205,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ uin = g_strdup_printf("%u", args->uin); message = g_strdup(args->msg); strip_linefeed(message); - imcb_buddy_msg(ic, uin, message, 0, 0); + imcb_buddy_msg(ic, normalize(uin), message, 0, 0); g_free(uin); g_free(message); } break; @@ -1195,7 +1224,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } strip_linefeed(message); - imcb_buddy_msg(ic, uin, message, 0, 0); + imcb_buddy_msg(ic, normalize(uin), message, 0, 0); g_free(uin); g_free(m); g_free(message); @@ -1470,7 +1499,7 @@ static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; for (i = 0; i < count; i++) - imcb_chat_add_buddy(c->cnv, info[i].sn); + imcb_chat_add_buddy(c->cnv, normalize(info[i].sn)); return 1; } @@ -1493,7 +1522,7 @@ static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; for (i = 0; i < count; i++) - imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL); + imcb_chat_remove_buddy(c->cnv, normalize(info[i].sn), NULL); return 1; } @@ -1544,7 +1573,7 @@ static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { tmp = g_malloc(BUF_LONG); g_snprintf(tmp, BUF_LONG, "%s", msg); - imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0); + imcb_chat_msg(ccon->cnv, normalize(info->sn), tmp, 0, 0); g_free(tmp); return 1; @@ -1757,7 +1786,7 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); g_snprintf(sender, sizeof(sender), "%u", msg->sender); strip_linefeed(dialog_msg); - imcb_buddy_msg(ic, sender, dialog_msg, 0, t); + imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t); g_free(dialog_msg); } break; @@ -1778,7 +1807,7 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { } strip_linefeed(dialog_msg); - imcb_buddy_msg(ic, sender, dialog_msg, 0, t); + imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t); g_free(dialog_msg); g_free(m); } break; @@ -2016,23 +2045,26 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { struct im_connection *ic = sess->aux_data; struct aim_ssi_item *curitem; int tmp; + char *nrm; /* Add from server list to local list */ tmp = 0; for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { switch (curitem->type) { case 0x0000: /* Buddy */ - if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) { + nrm = normalize(curitem->name); + + if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) { char *realname = NULL; if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1)) realname = aim_gettlv_str(curitem->data, 0x0131, 1); - imcb_add_buddy(ic, curitem->name, NULL); + imcb_add_buddy(ic, nrm, NULL); if (realname) { - imcb_buddy_nick_hint(ic, curitem->name, realname); - imcb_rename_buddy(ic, curitem->name, realname); + imcb_buddy_nick_hint(ic, nrm, realname); + imcb_rename_buddy(ic, nrm, realname); g_free(realname); } } @@ -2044,7 +2076,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); if (!list) { char *name; - name = g_strdup(normalize(curitem->name)); + name = g_strdup(nrm); ic->permit = g_slist_append(ic->permit, name); tmp++; } @@ -2057,7 +2089,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); if (!list) { char *name; - name = g_strdup(normalize(curitem->name)); + name = g_strdup(nrm); ic->deny = g_slist_append(ic->deny, name); tmp++; } @@ -2119,7 +2151,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) st = aimbs_get16( &fr->data ); if( st == 0x00 ) { - imcb_add_buddy( sess->aux_data, list, NULL ); + imcb_add_buddy( sess->aux_data, normalize(list), NULL ); } else if( st == 0x0E ) { @@ -2449,15 +2481,15 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) if(type2 == 0x0002) { /* User is typing */ - imcb_buddy_typing(ic, sn, OPT_TYPING); + imcb_buddy_typing(ic, normalize(sn), OPT_TYPING); } else if (type2 == 0x0001) { /* User has typed something, but is not actively typing (stale) */ - imcb_buddy_typing(ic, sn, OPT_THINKING); + imcb_buddy_typing(ic, normalize(sn), OPT_THINKING); } else { /* User has stopped typing */ - imcb_buddy_typing(ic, sn, 0); + imcb_buddy_typing(ic, normalize(sn), 0); } return 1; -- cgit v1.2.3 From fb4e9a3f0edbabf932c310374b9eb5121c0dab7d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 10:53:56 +0100 Subject: Updated change log, also added a pointer to bugs.b.o's timeline page for people who want more details. --- doc/CHANGES | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/CHANGES b/doc/CHANGES index 93ad35e2..944d9c04 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,8 @@ +This ChangeLog mostly lists changes relevant to users. A full log can be +found in the bzr commit logs, for example you can try: + +http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on + Version 1.2.1: - Fixed proxy support. - Fixed stalling issues while connecting to Jabber when using the OpenSSL @@ -9,6 +14,20 @@ Version 1.2.1: - You can now automatically identify yourself to BitlBee by setting a server password in your IRC client. - Compatible with all crazy kinds of line endings that clients can send. +- Changed root nicknames are now saved. +- Added ClientInterface setting to bind() outgoing connections to a specific + network interface. +- Support for receiving Jabber chatroom invitations. +- Relaxed port restriction of the Jabber module: added ports 80 and 443. +- Preserving case in Jabber resources of buddies, since these should + officially be treated as case sensitive. +- Fully stripping spaces from AIM screennames, this didn't happen completely + which severly breaks the IRC protocol. +- Removed all the yellow tape around daemon mode, it's pretty mature by now: + testing.bitlbee.org serves all (~30) SSL users from one daemon mode + process without any serious stability issues. +- Fixed GLib <2.6 compatibility issue. +- Misc. memory leak/crash fixes. Finished ... -- cgit v1.2.3 From c801d25cc574279566b35c3a9fce96962521670a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 11:05:33 +0100 Subject: Fixed bug in [devel,394]. --- protocols/oscar/oscar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 819ec27d..1bd221b4 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1030,7 +1030,7 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { g_hash_table_insert(od->ips, uin, (gpointer) (long) info->icqinfo.ipaddr); } - if (!aim_sncmp(tmp, normalize(info->sn))) + if (!aim_sncmp(ic->acc->user, info->sn)) g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); tmp = normalize(info->sn); -- cgit v1.2.3 From de823359bee02853be86b75ddc8272812502ff5d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 13:26:19 +0100 Subject: Another fixup after [devel,394]. Clearly I'm not a morning person. --- protocols/oscar/oscar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 1bd221b4..a3b4a071 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2050,10 +2050,10 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { /* Add from server list to local list */ tmp = 0; for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { + nrm = normalize(curitem->name); + switch (curitem->type) { case 0x0000: /* Buddy */ - nrm = normalize(curitem->name); - if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) { char *realname = NULL; -- cgit v1.2.3 From fab3d2d497e2819c142859a3698e85372e58df14 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 14:02:15 +0100 Subject: Shut up a "mostly harmless" warning (this NULL would never actually be dereferenced as far as I can see). --- protocols/oscar/oscar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index a3b4a071..36e03166 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2050,7 +2050,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { /* Add from server list to local list */ tmp = 0; for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { - nrm = normalize(curitem->name); + nrm = curitem->name ? normalize(curitem->name) : NULL; switch (curitem->type) { case 0x0000: /* Buddy */ -- cgit v1.2.3 From 89d736a169cbff4520dcbb475aa7269b2cf4b837 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Jun 2008 20:21:06 +0100 Subject: From the department of over-engineering, now cached packet IDs are full MD5 hashes instead of a known MD5 hash with a number. Just to make it harder to confuse BitlBee by sending it faked responses to packets. --- protocols/jabber/jabber.c | 24 +++++++++--------------- protocols/jabber/jabber.h | 2 +- protocols/jabber/jabber_util.c | 24 +++++++++++++++++++++--- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 52a87d5d..c9c1d0a0 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -32,7 +32,6 @@ #include "bitlbee.h" #include "jabber.h" #include "md5.h" -#include "base64.h" GSList *jabber_connections; @@ -240,24 +239,20 @@ static void jabber_login( account_t *acc ) jabber_generate_id_hash( jd ); } +/* This generates an unfinished md5_state_t variable. Every time we generate + an ID, we finish the state by adding a sequence number and take the hash. */ static void jabber_generate_id_hash( struct jabber_data *jd ) { - md5_state_t id_hash; - md5_byte_t binbuf[16]; + md5_byte_t binbuf[4]; char *s; - md5_init( &id_hash ); - md5_append( &id_hash, (unsigned char *) jd->username, strlen( jd->username ) ); - md5_append( &id_hash, (unsigned char *) jd->server, strlen( jd->server ) ); + md5_init( &jd->cached_id_prefix ); + md5_append( &jd->cached_id_prefix, (unsigned char *) jd->username, strlen( jd->username ) ); + md5_append( &jd->cached_id_prefix, (unsigned char *) jd->server, strlen( jd->server ) ); s = set_getstr( &jd->ic->acc->set, "resource" ); - md5_append( &id_hash, (unsigned char *) s, strlen( s ) ); - random_bytes( binbuf, 16 ); - md5_append( &id_hash, binbuf, 16 ); - md5_finish( &id_hash, binbuf ); - - s = base64_encode( binbuf, 9 ); - jd->cached_id_prefix = g_strdup_printf( "%s%s", JABBER_CACHED_ID, s ); - g_free( s ); + md5_append( &jd->cached_id_prefix, (unsigned char *) s, strlen( s ) ); + random_bytes( binbuf, 4 ); + md5_append( &jd->cached_id_prefix, binbuf, 4 ); } static void jabber_logout( struct im_connection *ic ) @@ -288,7 +283,6 @@ static void jabber_logout( struct im_connection *ic ) xt_free( jd->xt ); - g_free( jd->cached_id_prefix ); g_free( jd->away_message ); g_free( jd->username ); g_free( jd ); diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 023cf0f9..904bf0c4 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -85,7 +85,7 @@ struct jabber_data struct jabber_away_state *away_state; char *away_message; - char *cached_id_prefix; + md5_state_t cached_id_prefix; GHashTable *node_cache; GHashTable *buddies; }; diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 44dc5984..1bee5009 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -22,6 +22,8 @@ \***************************************************************************/ #include "jabber.h" +#include "md5.h" +#include "base64.h" static unsigned int next_id = 1; @@ -133,11 +135,21 @@ void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_ca { struct jabber_data *jd = ic->proto_data; struct jabber_cache_entry *entry = g_new0( struct jabber_cache_entry, 1 ); - char *id; + md5_state_t id_hash; + md5_byte_t id_sum[16]; + char *id, *asc_hash; - id = g_strdup_printf( "%s%05x", jd->cached_id_prefix, ( next_id++ ) & 0xfffff ); + next_id ++; + + id_hash = jd->cached_id_prefix; + md5_append( &id_hash, (md5_byte_t*) &next_id, sizeof( next_id ) ); + md5_finish( &id_hash, id_sum ); + asc_hash = base64_encode( id_sum, 12 ); + + id = g_strdup_printf( "%s%s", JABBER_CACHED_ID, asc_hash ); xt_add_attr( node, "id", id ); g_free( id ); + g_free( asc_hash ); entry->node = node; entry->func = func; @@ -183,7 +195,7 @@ xt_status jabber_cache_handle_packet( struct im_connection *ic, struct xt_node * char *s; if( ( s = xt_find_attr( node, "id" ) ) == NULL || - strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix ) ) != 0 ) + strncmp( s, JABBER_CACHED_ID, strlen( JABBER_CACHED_ID ) ) != 0 ) { /* Silently ignore it, without an ID (or a non-cache ID) we don't know how to handle the packet and we @@ -195,8 +207,14 @@ xt_status jabber_cache_handle_packet( struct im_connection *ic, struct xt_node * if( entry == NULL ) { + /* + There's no longer an easy way to see if we generated this + one or someone else, and there's a ten-minute timeout anyway, + so meh. + imcb_log( ic, "Warning: Received %s-%s packet with unknown/expired ID %s!", node->name, xt_find_attr( node, "type" ) ? : "(no type)", s ); + */ } else if( entry->func ) { -- cgit v1.2.3 From dfbb0563ac250c65f74b7bb3f49ca8d2ccc9e9c8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 24 Jun 2008 10:01:29 +0100 Subject: Never use yahoo_close() directly, always use yahoo_logoff(). --- protocols/yahoo/yahoo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index c84685e9..197d76a1 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -162,10 +162,7 @@ static void byahoo_logout( struct im_connection *ic ) } g_slist_free( yd->buddygroups ); - if( yd->logged_in ) - yahoo_logoff( yd->y2_id ); - else - yahoo_close( yd->y2_id ); + yahoo_logoff( yd->y2_id ); g_free( yd ); } -- cgit v1.2.3 From 05b44da70c6a133676ded338a707465f32c09e09 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 24 Jun 2008 10:15:47 +0100 Subject: Fixed a bug with nickname handling. I really should kill all fixed-length strings in BitlBee... --- nick.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nick.c b/nick.c index 52f9e5ad..5d7dc8a9 100644 --- a/nick.c +++ b/nick.c @@ -46,6 +46,7 @@ void nick_set( account_t *acc, const char *handle, const char *nick ) char *store_handle, *store_nick = g_malloc( MAX_NICK_LENGTH + 1 ); store_handle = clean_handle( handle ); + store_nick[MAX_NICK_LENGTH] = 0; strncpy( store_nick, nick, MAX_NICK_LENGTH ); nick_strip( store_nick ); -- cgit v1.2.3 From d048ffce031ff9f674f20be37f6bfbb18047004f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 24 Jun 2008 23:06:32 +0100 Subject: Finalizing BitlBee 1.2.1. --- bitlbee.h | 2 +- doc/CHANGES | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bitlbee.h b/bitlbee.h index f10e66d2..ba74defe 100644 --- a/bitlbee.h +++ b/bitlbee.h @@ -29,7 +29,7 @@ #define _GNU_SOURCE /* Stupid GNU :-P */ #define PACKAGE "BitlBee" -#define BITLBEE_VERSION "1.2" +#define BITLBEE_VERSION "1.2.1" #define VERSION BITLBEE_VERSION #define MAX_STRING 511 diff --git a/doc/CHANGES b/doc/CHANGES index 944d9c04..ac1f1f02 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -29,7 +29,7 @@ Version 1.2.1: - Fixed GLib <2.6 compatibility issue. - Misc. memory leak/crash fixes. -Finished ... +Finished 24 Jun 2008 Version 1.2: - Added ForkDaemon mode next to the existing Daemon- and inetd modes. With -- cgit v1.2.3 From e0f9170849e9c4aaa679f86703a60686d36607bb Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 27 Jun 2008 00:18:31 +0100 Subject: xml_remove() didn't convert nicknames to lowercase so it caused some confusing errors sometimes. This should close #395. --- storage_xml.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage_xml.c b/storage_xml.c index ab7da6e3..ca82a9d1 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -480,14 +480,18 @@ static gboolean xml_save_nick( gpointer key, gpointer value, gpointer data ) static storage_status_t xml_remove( const char *nick, const char *password ) { - char s[512]; + char s[512], *lc; storage_status_t status; status = xml_check_pass( nick, password ); if( status != STORAGE_OK ) return status; - g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".xml" ); + lc = g_strdup( nick ); + nick_lc( lc ); + g_snprintf( s, 511, "%s%s%s", global.conf->configdir, lc, ".xml" ); + g_free( lc ); + if( unlink( s ) == -1 ) return STORAGE_OTHER_ERROR; -- cgit v1.2.3 From 47b571d306a3da9932bc2616ab954ee342ec6519 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 28 Jun 2008 19:35:34 +0200 Subject: Avoid g_access on GLib < 2.8.0. --- storage_xml.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage_xml.c b/storage_xml.c index ca82a9d1..cb92135c 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -30,6 +30,11 @@ #include "md5.h" #include +#if !GLIB_CHECK_VERSION(2,8,0) +/* GLib < 2.8.0 doesn't have g_access, so just use the system access(). */ +#define g_access access +#endif + typedef enum { XML_PASS_CHECK_ONLY = -1, @@ -245,7 +250,8 @@ static void xml_init( void ) { if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) ) log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); - else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || g_access( global.conf->configdir, W_OK ) != 0 ) + else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || + g_access( global.conf->configdir, W_OK ) != 0 ) log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); } -- cgit v1.2.3 From 913545e54123296fb8229ecad2c77a6e899e0242 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 28 Jun 2008 20:38:52 +0200 Subject: Fix indentation. --- win32.c | 76 ++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/win32.c b/win32.c index fc73b611..4ab1d522 100644 --- a/win32.c +++ b/win32.c @@ -1,10 +1,10 @@ /********************************************************************\ - * BitlBee -- An IRC to other IM-networks gateway * - * * - * Copyright 2002-2004 Wilmer van der Gaast and others * + * BitlBee -- An IRC to other IM-networks gateway * + * * + * Copyright 2002-2004 Wilmer van der Gaast and others * \********************************************************************/ -/* Main file (Windows specific part) */ +/* Main file (Windows specific part) */ /* This program is free software; you can redistribute it and/or modify @@ -38,17 +38,17 @@ static void WINAPI service_ctrl (DWORD dwControl) { switch (dwControl) { - case SERVICE_CONTROL_STOP: + case SERVICE_CONTROL_STOP: /* FIXME */ - break; + break; - case SERVICE_CONTROL_INTERROGATE: - break; + case SERVICE_CONTROL_INTERROGATE: + break; - default: - break; + default: + break; - } + } } static void bitlbee_init(int argc, char **argv) @@ -94,13 +94,13 @@ void service_main (DWORD argc, LPTSTR *argv) SERVICE_STATUS_HANDLE handle; SERVICE_STATUS status; - handle = RegisterServiceCtrlHandler("bitlbee", service_ctrl); + handle = RegisterServiceCtrlHandler("bitlbee", service_ctrl); - if (!handle) + if (!handle) return; - status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - status.dwServiceSpecificExitCode = 0; + status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + status.dwServiceSpecificExitCode = 0; bitlbee_init(argc, argv); @@ -125,7 +125,7 @@ static void usage() } int main( int argc, char **argv) -{ +{ int i; WSADATA WSAData; @@ -139,7 +139,7 @@ int main( int argc, char **argv) } } - WSAStartup(MAKEWORD(1,1), &WSAData); + WSAStartup(MAKEWORD(1,1), &WSAData); if (!debug) { if (!StartServiceCtrlDispatcher(dispatch_table)) @@ -270,12 +270,12 @@ void log_error(char *msg) void log_message(int level, char *message, ...) { - HANDLE hEventSource; - LPTSTR lpszStrings[2]; + HANDLE hEventSource; + LPTSTR lpszStrings[2]; WORD elevel; - va_list ap; + va_list ap; - va_start(ap, message); + va_start(ap, message); if (debug) { vprintf(message, ap); @@ -284,11 +284,11 @@ void log_message(int level, char *message, ...) return; } - hEventSource = RegisterEventSource(NULL, TEXT("bitlbee")); + hEventSource = RegisterEventSource(NULL, TEXT("bitlbee")); - lpszStrings[0] = TEXT("bitlbee"); - lpszStrings[1] = g_strdup_vprintf(message, ap); - va_end(ap); + lpszStrings[0] = TEXT("bitlbee"); + lpszStrings[1] = g_strdup_vprintf(message, ap); + va_end(ap); switch (level) { case LOGLVL_ERROR: elevel = EVENTLOG_ERROR_TYPE; break; @@ -299,19 +299,19 @@ void log_message(int level, char *message, ...) #endif } - if (hEventSource != NULL) { - ReportEvent(hEventSource, - elevel, - 0, - 0, - NULL, - 2, - 0, - lpszStrings, - NULL); - - DeregisterEventSource(hEventSource); - } + if (hEventSource != NULL) { + ReportEvent(hEventSource, + elevel, + 0, + 0, + NULL, + 2, + 0, + lpszStrings, + NULL); + + DeregisterEventSource(hEventSource); + } g_free(lpszStrings[1]); } -- cgit v1.2.3 From 565a1eaa8b36ca64a7806e6ad74a9a26495c0c6e Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 29 Jun 2008 10:35:41 +0100 Subject: Added the DEAF command, which makes the daemon stop listening for new connections. This makes it easier to upgrade a BitlBee without having to disconnect all current users immediately. Closes #428. --- ipc.c | 20 ++++++++++++++++++++ irc.c | 6 +++++- irc_commands.c | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ipc.c b/ipc.c index f853a18f..9121026a 100644 --- a/ipc.c +++ b/ipc.c @@ -62,6 +62,25 @@ static void ipc_master_cmd_die( irc_t *data, char **cmd ) bitlbee_shutdown( NULL, -1, 0 ); } +static void ipc_master_cmd_deaf( irc_t *data, char **cmd ) +{ + if( global.conf->runmode == RUNMODE_DAEMON ) + { + b_event_remove( global.listen_watch_source_id ); + close( global.listen_socket ); + + global.listen_socket = global.listen_watch_source_id = -1; + + ipc_to_children_str( "OPERMSG :Closed listening socket, waiting " + "for all users to disconnect." ); + } + else + { + ipc_to_children_str( "OPERMSG :The DEAF command only works in " + "normal daemon mode. Try DIE instead." ); + } +} + void ipc_master_cmd_rehash( irc_t *data, char **cmd ) { runmode_t oldmode; @@ -97,6 +116,7 @@ static const command_t ipc_master_commands[] = { { "client", 3, ipc_master_cmd_client, 0 }, { "hello", 0, ipc_master_cmd_client, 0 }, { "die", 0, ipc_master_cmd_die, 0 }, + { "deaf", 0, ipc_master_cmd_deaf, 0 }, { "wallops", 1, NULL, IPC_CMD_TO_CHILDREN }, { "wall", 1, NULL, IPC_CMD_TO_CHILDREN }, { "opermsg", 1, NULL, IPC_CMD_TO_CHILDREN }, diff --git a/irc.c b/irc.c index a6220140..b98f7048 100644 --- a/irc.c +++ b/irc.c @@ -313,7 +313,11 @@ void irc_free( irc_t * irc ) g_free( irc ); - if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) + if( global.conf->runmode == RUNMODE_INETD || + global.conf->runmode == RUNMODE_FORKDAEMON || + ( global.conf->runmode == RUNMODE_DAEMON && + global.listen_socket == -1 && + irc_connection_list == NULL ) ) b_main_quit(); } diff --git a/irc_commands.c b/irc_commands.c index 6a47007a..fb2bc7cf 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -625,6 +625,7 @@ static const command_t irc_commands[] = { { "version", 0, irc_cmd_version, IRC_CMD_LOGGED_IN }, { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN }, { "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, + { "deaf", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, { "wallops", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, { "wall", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, { "rehash", 0, irc_cmd_rehash, IRC_CMD_OPER_ONLY }, -- cgit v1.2.3 From 1145964911d0d7dd5145de6f7b9d4ed8aeeacd79 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 29 Jun 2008 12:11:50 +0100 Subject: Fixed two memory leaks in the MSN module. --- protocols/msn/ns.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index ffaa90a7..fe48f96d 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -277,11 +277,25 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) { if( num_parts == 5 ) { - md->buddycount = atoi( cmd[3] ); - md->groupcount = atoi( cmd[4] ); - if( md->groupcount > 0 ) + int i, groupcount; + + groupcount = atoi( cmd[4] ); + if( groupcount > 0 ) + { + /* valgrind says this is leaking memory, I'm guessing + that this happens during server redirects. */ + if( md->grouplist ) + { + for( i = 0; i < md->groupcount; i ++ ) + g_free( md->grouplist[i] ); + g_free( md->grouplist ); + } + + md->groupcount = groupcount; md->grouplist = g_new0( char *, md->groupcount ); + } + md->buddycount = atoi( cmd[3] ); if( !*cmd[3] || md->buddycount == 0 ) msn_logged_in( ic ); } @@ -664,6 +678,9 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int { imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); } + + g_free( inbox ); + g_free( folders ); } else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) { -- cgit v1.2.3 From cd63d5822e76a6126bb3017567c9ce2869a44e0b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 29 Jun 2008 13:47:39 +0100 Subject: Now using an environment variable instead of a flag to pass state info when restarting the ForkDaemon. Preparing for a proper fallback when execv() fails. (Bug #425) --- bitlbee.c | 2 +- conf.c | 10 +--------- ipc.c | 9 ++------- ipc.h | 3 +-- unix.c | 27 ++++++++------------------- 5 files changed, 13 insertions(+), 38 deletions(-) diff --git a/bitlbee.c b/bitlbee.c index 17431546..d8a6a5a7 100644 --- a/bitlbee.c +++ b/bitlbee.c @@ -117,7 +117,7 @@ int bitlbee_daemon_init() #endif if( global.conf->runmode == RUNMODE_FORKDAEMON ) - ipc_master_load_state(); + ipc_master_load_state( getenv( "_BITLBEE_RESTART_STATE" ) ); if( global.conf->runmode == RUNMODE_DAEMON || global.conf->runmode == RUNMODE_FORKDAEMON ) ipc_master_listen_socket(); diff --git a/conf.c b/conf.c index 2bdead65..909d331a 100644 --- a/conf.c +++ b/conf.c @@ -77,7 +77,7 @@ conf_t *conf_load( int argc, char *argv[] ) at a *valid* configuration file. */ } - while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 ) + while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hu:" ) ) >= 0 ) /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ { if( opt == 'i' ) @@ -145,14 +145,6 @@ conf_t *conf_load( int argc, char *argv[] ) " -h Show this help page.\n" ); return NULL; } - else if( opt == 'R' ) - { - /* We can't load the statefile yet (and should make very sure we do this - only once), so set the filename here and load the state information - when initializing ForkDaemon. (This option only makes sense in that - mode anyway!) */ - ipc_master_set_statefile( optarg ); - } else if( opt == 'u' ) { g_free( conf->user ); diff --git a/ipc.c b/ipc.c index 9121026a..5232832e 100644 --- a/ipc.c +++ b/ipc.c @@ -32,7 +32,6 @@ #endif GSList *child_list = NULL; -static char *statefile = NULL; static void ipc_master_cmd_client( irc_t *data, char **cmd ) { @@ -500,11 +499,6 @@ char *ipc_master_save_state() } } -void ipc_master_set_statefile( char *fn ) -{ - statefile = g_strdup( fn ); -} - static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) { @@ -565,7 +559,7 @@ int ipc_master_listen_socket() /* FIXME: Open named pipe \\.\BITLBEE */ #endif -int ipc_master_load_state() +int ipc_master_load_state( char *statefile ) { struct bitlbee_child *child; FILE *fp; @@ -573,6 +567,7 @@ int ipc_master_load_state() if( statefile == NULL ) return 0; + fp = fopen( statefile, "r" ); unlink( statefile ); /* Why do it later? :-) */ if( fp == NULL ) diff --git a/ipc.h b/ipc.h index f3d24614..0e71c520 100644 --- a/ipc.h +++ b/ipc.h @@ -57,8 +57,7 @@ void ipc_to_children_str( char *format, ... ) G_GNUC_PRINTF( 1, 2 ); void ipc_master_cmd_rehash( irc_t *data, char **cmd ); char *ipc_master_save_state(); -void ipc_master_set_statefile( char *fn ); -int ipc_master_load_state(); +int ipc_master_load_state( char *statefile ); int ipc_master_listen_socket(); extern GSList *child_list; diff --git a/unix.c b/unix.c index d25aeb2e..336b49c4 100644 --- a/unix.c +++ b/unix.c @@ -39,7 +39,7 @@ global_t global; /* Against global namespace pollution */ static void sighandler( int signal ); -int main( int argc, char *argv[], char **envp ) +int main( int argc, char *argv[] ) { int i = 0; char *old_cwd = NULL; @@ -134,30 +134,19 @@ int main( int argc, char *argv[], char **envp ) if( global.restart ) { char *fn = ipc_master_save_state(); - char **args; - int n, i; chdir( old_cwd ); - n = 0; - args = g_new0( char *, argc + 3 ); - args[n++] = argv[0]; - if( fn ) - { - args[n++] = "-R"; - args[n++] = fn; - } - for( i = 1; argv[i] && i < argc; i ++ ) - { - if( strcmp( argv[i], "-R" ) == 0 ) - i += 2; - - args[n++] = argv[i]; - } + setenv( "_BITLBEE_RESTART_STATE", fn, 1 ); + g_free( fn ); close( global.listen_socket ); - execve( args[0], args, envp ); + if( execv( argv[0], argv ) == -1 ) + /* Apparently the execve() failed, so let's just + jump back into our own/current main(). */ + /* Need more cleanup code to make this work. */ + return 1; /* main( argc, argv ); */ } return( 0 ); -- cgit v1.2.3 From dfd442b384ff04de537b399fd7e42ed01b62cf10 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 30 Jun 2008 00:45:11 +0100 Subject: Just use g_access() everywhere instead of a mix of that and g_file_test(). g_file_test() can't test for writability, and g_access() doesn't exist in older GLibs. :-/ --- storage_xml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage_xml.c b/storage_xml.c index cb92135c..240206f1 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -248,10 +248,10 @@ GMarkupParser xml_parser = static void xml_init( void ) { - if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) ) + if( g_access( global.conf->configdir, F_OK ) != 0 ) log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); - else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || - g_access( global.conf->configdir, W_OK ) != 0 ) + else if( g_access( global.conf->configdir, F_OK ) != 0 || + g_access( global.conf->configdir, W_OK ) != 0 ) log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); } @@ -378,7 +378,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite ) g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, path2, ".xml" ); g_free( path2 ); - if( !overwrite && g_file_test( path, G_FILE_TEST_EXISTS ) ) + if( !overwrite && g_access( path, F_OK ) == 0 ) return STORAGE_ALREADY_EXISTS; strcat( path, "~" ); -- cgit v1.2.3 From 6a78c0eed44820a2fefe1e96516e335eddc9c70b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 30 Jun 2008 16:37:12 +0100 Subject: Silenced a compiler warning - I don't think there's any way the unitialized version of ret could actually be returned. --- lib/misc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index c087f6a5..9d504b75 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -583,13 +583,9 @@ int md5_verify_password( char *password, char *hash ) md5_byte_t *pass_dec = NULL; md5_byte_t pass_md5[16]; md5_state_t md5_state; - int ret, i; + int ret = -1, i; - if( base64_decode( hash, &pass_dec ) != 21 ) - { - ret = -1; - } - else + if( base64_decode( hash, &pass_dec ) == 21 ) { md5_init( &md5_state ); md5_append( &md5_state, (md5_byte_t*) password, strlen( password ) ); -- cgit v1.2.3