Changeset abe53d3 for win32


Ignore:
Timestamp:
2005-11-07T16:42:49Z (19 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
f56c491
Parents:
99318ad
Message:

More work on config manager

Location:
win32
Files:
4 added
5 deleted
1 edited
15 moved

Legend:

Unmodified
Added
Removed
  • win32/admin/MainDlg.cpp

    r99318ad rabe53d3  
    22//
    33
    4 #define BITLBEE_CORE
    5 #include "bitlbeewin.h"
    6 #include "PropUsers.h"
    74#include "PropPaths.h"
    85#include "PropAccess.h"
    9 #include "PropLog.h"
    106#include "PropConn.h"
    117#include "MainDlg.h"
     
    2622        AddPage(new CPropPaths());
    2723        AddPage(new CPropAccess());
    28         AddPage(new CPropUsers());
    29         AddPage(new CPropLog());
    3024        AddPage(new CPropertyPage(IDD_PROPPAGE_ABOUT));
    3125        AddPage(new CPropConn());
     
    7670        ShowWindow(SW_HIDE);
    7771}
    78 
  • win32/admin/MainDlg.h

    r99318ad rabe53d3  
    77// MainDlg.h : header file
    88//
     9
     10#include <afxdlgs.h>
    911
    1012/////////////////////////////////////////////////////////////////////////////
  • win32/admin/PropAccess.cpp

    r99318ad rabe53d3  
    22//
    33
    4 #define BITLBEE_CORE
    5 #include "bitlbeewin.h"
    64#include "PropAccess.h"
    75
     
    5351{
    5452        CString iface; m_interface.GetWindowText(iface);
     53        WriteProfileString("interface", iface);
     54
    5555        CString port; m_port.GetWindowText(port);
     56        WriteProfileInt("port", port);
    5657
    5758        CString password; m_password.GetWindowText(password);
    58         g_free((void *)global.conf->password);
    59         global.conf->password = g_strdup(password);
    60 
    61         if(m_auth_closed.GetCheck() == 1) global.conf->authmode = AUTHMODE_CLOSED;
    62         if(m_auth_open.GetCheck() == 1) global.conf->authmode = AUTHMODE_OPEN;
    63         if(m_auth_registered.GetCheck() == 1) global.conf->authmode = AUTHMODE_REGISTERED;
    64 
    65         if(strcmp(iface, global.conf->iface) || atol(port) != global.conf->port) {
    66                 global.conf->port = atoi(port);
    67                 g_free((void *)global.conf->iface);
    68                 global.conf->iface = g_strdup(iface);
    69                 closesocket(global.listen_socket);
    70                 bitlbee_daemon_init();
    71         }
    72 
     59        WriteProfileString("password", password);
     60       
     61        if(m_auth_closed.GetCheck() == 1) WriteProfileInt("auth_mode", 1);
     62        if(m_auth_open.GetCheck() == 1) WriteProfileInt("auth_mode", 0);
     63        if(m_auth_registered.GetCheck() == 1) WriteProfileInt("auth_mode", 2);
    7364       
    7465        CPropertyPage::OnOK();
     
    10596        CPropertyPage::OnInitDialog();
    10697
    107         m_interface.SetWindowText(global.conf->iface);
    108         m_password.SetWindowText(global.conf->password);
     98        HKEY key;
     99        RegOpenKey(HKEY_LOCAL_MACHINE, BITLBEE_KEY, &key);
     100
     101        m_interface.SetWindowText(GetProfileString("interface", "0.0.0.0"));
     102        m_password.SetWindowText(GetProfileString("password", ""));
    109103        char tmp[20];
    110         g_snprintf(tmp, sizeof(tmp), "%d", global.conf->port);
     104        sprintf(tmp, "%d", GetProfileInt("port", 6667));
    111105        m_port.SetWindowText(tmp);
    112         m_auth_open.SetCheck(0);
    113         m_auth_closed.SetCheck(0);
    114         m_auth_registered.SetCheck(0);
    115106
    116         switch(global.conf->authmode) {
    117         case AUTHMODE_OPEN: m_auth_open.SetCheck(1); m_password.EnableWindow(FALSE);break;
    118         case AUTHMODE_CLOSED: m_auth_closed.SetCheck(1); m_password.EnableWindow(TRUE);break;
    119         case AUTHMODE_REGISTERED: m_auth_registered.SetCheck(1);m_password.EnableWindow(FALSE);break;
     107        switch(GetProfileInt("auth_mode", 1)) {
     108        case 0: OnAuthOpen();break;
     109        case 1: OnAuthClosed();break;
     110        case 2: OnAuthRegistered();break;
    120111        }
    121112       
  • win32/admin/PropAccess.h

    r99318ad rabe53d3  
    77// PropAccess.h : header file
    88//
     9
     10#include <afxdlgs.h>
     11#include "Resource.h"
    912
    1013/////////////////////////////////////////////////////////////////////////////
  • win32/admin/PropConn.cpp

    r99318ad rabe53d3  
    22//
    33
    4 #define BITLBEE_CORE
    5 #include "bitlbeewin.h"
    64#include "PropConn.h"
    75
     
    5755void CPropConn::OnProxyEnabled()
    5856{
    59         // TODO: Add your control notification handler code here
    6057        m_proxyhost.EnableWindow(m_proxy_enabled.GetCheck());
    6158        m_proxytype.EnableWindow(m_proxy_enabled.GetCheck());
     
    7370void CPropConn::OnOK()
    7471{
     72        CString tmp;
     73        m_proxyhost.GetWindowText(tmp);
     74        WriteProfileString("proxy_host", tmp);
     75
     76        m_proxyport.GetWindowText(tmp);
     77        WriteProfileInt("proxy_port", atoi(tmp));
     78
    7579        if(!m_proxy_enabled.GetCheck()) {
    76                 proxytype = PROXY_NONE;
    77                 return;
     80                WriteProfileInt("proxy_type", 0);
     81        } else {
     82                WriteProfileInt("proxy_type", m_proxytype.GetCurSel()+1);
    7883        }
    7984
    80         CString tmp;
    81         m_proxyhost.GetWindowText(tmp);
    82         strcpy(proxyhost, tmp);
    83 
    84         m_proxyport.GetWindowText(tmp);
    85         proxyport = atoi(tmp);
    86 
    87         proxytype = m_proxytype.GetCurSel()+1;
    88 
    8985        if(!m_proxy_auth_enabled.GetCheck()) {
    90                 strcpy(proxyuser, "");
    91                 strcpy(proxypass, "");
    92                 return;
     86                WriteProfileString("proxy_user", "");
     87                WriteProfileString("proxy_password", "");
     88        } else {
     89                m_proxyuser.GetWindowText(tmp);
     90                WriteProfileString("proxy_user", tmp);
     91                m_proxypass.GetWindowText(tmp);
     92                WriteProfileString("proxy_password", tmp);
    9393        }
    94 
    95         m_proxyuser.GetWindowText(tmp);
    96         strcpy(proxyuser, tmp);
    97         m_proxypass.GetWindowText(tmp);
    98         strcpy(proxypass, tmp);
    9994       
    10095        CPropertyPage::OnOK();
     
    105100        char pp[20];
    106101        CPropertyPage::OnInitDialog();
     102        int proxytype;
    107103
    108         m_proxyhost.SetWindowText(proxyhost);
    109         m_proxyuser.SetWindowText(proxyuser);
    110         m_proxypass.SetWindowText(proxypass);
    111         g_snprintf(pp, 20, "%d", proxyport);
     104        m_proxyhost.SetWindowText(GetProfileString("proxy_host", ""));
     105        m_proxyuser.SetWindowText(GetProfileString("proxy_user", ""));
     106        m_proxypass.SetWindowText(GetProfileString("proxy_password", ""));
     107        sprintf(pp, "%d", GetProfileInt("proxy_port", 3128));
    112108        m_proxyport.SetWindowText(pp);
     109
     110        proxytype = GetProfileInt("proxy_type", 0);
    113111
    114112        m_proxytype.AddString("SOCKS 4");
     
    117115        m_proxytype.SetCurSel(proxytype-1);
    118116
    119         m_proxy_enabled.SetCheck(proxytype == PROXY_NONE?0:1);
    120         m_proxy_auth_enabled.SetCheck(strcmp(proxyuser, "")?1:0);
     117        m_proxy_enabled.SetCheck(proxytype == 0?0:1);
     118        m_proxy_auth_enabled.SetCheck(strcmp(GetProfileString("proxy_user", ""), "")?1:0);
    121119
    122120        OnProxyEnabled();
  • win32/admin/PropConn.h

    r99318ad rabe53d3  
    77// PropConn.h : header file
    88//
     9
     10#include <afxdlgs.h>
     11#include "Resource.h"
    912
    1013/////////////////////////////////////////////////////////////////////////////
  • win32/admin/PropLog.cpp

    r99318ad rabe53d3  
    22//
    33
    4 #define BITLBEE_CORE
    5 #include "bitlbeewin.h"
    64#include "PropLog.h"
    75
  • win32/admin/PropPaths.cpp

    r99318ad rabe53d3  
    22//
    33
    4 #define BITLBEE_CORE
    5 #include "bitlbeewin.h"
    64#include "PropPaths.h"
    75#include "shlobj.h"
     
    5351{
    5452        CString tmp;
    55         g_free((void *)global.conf->configdir);
    56         m_configdir.GetWindowText(tmp);
     53        m_configdir.GetWindowText(tmp);
    5754
    5855        if (tmp.GetLength() > 0
     
    6057                && tmp.GetAt(tmp.GetLength() - 1) != '\\')
    6158        {
    62                 global.conf->configdir = g_strdup_printf("%s\\", tmp);
    63         } else {
    64                 global.conf->configdir = g_strdup(tmp);
     59                tmp = tmp + "\\";
    6560        }
    6661
    67         g_free((void *)global.conf->motdfile);
     62        WriteProfileString("configdir", tmp);
     63
    6864        m_motdfile.GetWindowText(tmp);
    69         global.conf->motdfile = g_strdup(tmp);
    70        
     65        WriteProfileString("motdfile", tmp);
     66
    7167        CPropertyPage::OnOK();
    7268}
     
    112108{
    113109        CPropertyPage::OnInitDialog();
    114        
    115         m_configdir.SetWindowText(global.conf->configdir);
    116         m_motdfile.SetWindowText(global.conf->motdfile);
     110
     111        m_configdir.SetWindowText(GetProfileString("configdir", ""));
     112        m_motdfile.SetWindowText(GetProfileString("motdfile", ""));
    117113       
    118114        return TRUE; 
  • win32/admin/PropPaths.h

    r99318ad rabe53d3  
    77// PropPaths.h : header file
    88//
     9#include <afxdlgs.h>
     10#include "Resource.h"
    911
    1012/////////////////////////////////////////////////////////////////////////////
  • win32/admin/bitlbee.rc

    r99318ad rabe53d3  
    9595END
    9696
    97 IDD_PROPPAGE_USERS DIALOG DISCARDABLE  0, 0, 210, 154
    98 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
    99 CAPTION "Users"
    100 FONT 8, "MS Sans Serif"
    101 BEGIN
    102     GROUPBOX        "Known users",IDC_STATIC,7,7,196,68
    103     GROUPBOX        "Current users",IDC_STATIC,7,79,196,68
    104     LISTBOX         IDC_KNOWN_USERS,13,17,114,52,LBS_SORT |
    105                     LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
    106     PUSHBUTTON      "&Remove",IDC_DEL_KNOWN_USERS,133,17,32,14,WS_DISABLED
    107     LISTBOX         IDC_CURRENT_USERS,13,89,115,52,LBS_SORT |
    108                     LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
    109     PUSHBUTTON      "&Kick",IDC_KICK,135,89,19,14,WS_DISABLED
    110     PUSHBUTTON      "&Refresh",IDC_REFRESH_KNOWN_USERS,133,38,30,14
    111     PUSHBUTTON      "&Refresh",IDC_REFRESH_CURRENT_USERS,135,110,30,14
    112 END
    113 
    11497IDD_PROPPAGE_PATHS DIALOG DISCARDABLE  0, 0, 210, 154
    11598STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
     
    124107    EDITTEXT        IDC_MOTDFILE,13,51,122,13,ES_AUTOHSCROLL
    125108    PUSHBUTTON      "&Edit...",IDC_EDIT_MOTD,153,66,43,13
    126 END
    127 
    128 IDD_PHONY DIALOG DISCARDABLE  0, 0, 9, 9
    129 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    130 CAPTION "Dialog"
    131 FONT 8, "MS Sans Serif"
    132 BEGIN
    133109END
    134110
     
    150126    LTEXT           "The Bitlbee homepage is located at http://www.bitlbee.org/\n\nFor Bitlbee support, go to #bitlbee on irc.oftc.net",
    151127                    IDC_STATIC,17,100,248,39
    152 END
    153 
    154 IDD_PROPPAGE_LOG DIALOG DISCARDABLE  0, 0, 210, 154
    155 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
    156 CAPTION "Logs"
    157 FONT 8, "MS Sans Serif"
    158 BEGIN
    159     LISTBOX         IDC_LOG,7,7,196,140,LBS_SORT | LBS_NOINTEGRALHEIGHT |
    160                     WS_VSCROLL | WS_TABSTOP
    161128END
    162129
     
    184151END
    185152
     153IDD_PROPPAGE_MAIN DIALOG DISCARDABLE  0, 0, 210, 101
     154STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
     155CAPTION "Main"
     156FONT 8, "MS Sans Serif"
     157BEGIN
     158    LTEXT           "Current Status:",IDC_STATIC,13,16,66,9
     159    LTEXT           "Static",IDC_STATIC,92,16,80,12
     160    PUSHBUTTON      "&Start",IDC_STARTSERVICE,13,28,40,11
     161    PUSHBUTTON      "&Stop",IDC_STOPSERVICE,65,29,46,11
     162    CONTROL         "&Verbose",IDC_VERBOSE,"Button",BS_AUTOCHECKBOX |
     163                    WS_TABSTOP,15,43,84,12
     164    EDITTEXT        IDC_PING_INTERVAL,93,62,47,12,ES_AUTOHSCROLL
     165    LTEXT           "Ping Interval:",IDC_STATIC,13,62,60,10
     166END
     167
    186168
    187169#ifndef _MAC
     
    212194            VALUE "FileVersion", "1, 0, 0, 1\0"
    213195            VALUE "InternalName", "bitlbee\0"
    214             VALUE "LegalCopyright", "Copyright (C) 2002-2004\0"
    215             VALUE "OriginalFilename", "bitlbee.exe\0"
     196            VALUE "LegalCopyright", "Copyright (C) 2002-2005\0"
     197            VALUE "OriginalFilename", "bitlbeeadm.exe\0"
    216198            VALUE "ProductName", "Bitlbee Application\0"
    217199            VALUE "ProductVersion", "1, 0, 0, 1\0"
     
    243225    END
    244226
    245     IDD_PROPPAGE_USERS, DIALOG
     227    IDD_PROPPAGE_PATHS, DIALOG
    246228    BEGIN
    247229        LEFTMARGIN, 7
     
    251233    END
    252234
    253     IDD_PROPPAGE_PATHS, DIALOG
     235    IDD_PROPPAGE_ABOUT, DIALOG
     236    BEGIN
     237        LEFTMARGIN, 7
     238        RIGHTMARGIN, 277
     239        TOPMARGIN, 7
     240        BOTTOMMARGIN, 149
     241    END
     242
     243    IDD_PROPPAGE_CONNECTION, DIALOG
    254244    BEGIN
    255245        LEFTMARGIN, 7
     
    259249    END
    260250
    261     IDD_PHONY, DIALOG
    262     BEGIN
    263         LEFTMARGIN, 7
    264         RIGHTMARGIN, 2
    265         TOPMARGIN, 7
    266         BOTTOMMARGIN, 2
    267     END
    268 
    269     IDD_PROPPAGE_ABOUT, DIALOG
    270     BEGIN
    271         LEFTMARGIN, 7
    272         RIGHTMARGIN, 277
    273         TOPMARGIN, 7
    274         BOTTOMMARGIN, 149
    275     END
    276 
    277     IDD_PROPPAGE_LOG, DIALOG
     251    IDD_PROPPAGE_MAIN, DIALOG
    278252    BEGIN
    279253        LEFTMARGIN, 7
    280254        RIGHTMARGIN, 203
    281         TOPMARGIN, 7
    282         BOTTOMMARGIN, 147
    283     END
    284 
    285     IDD_PROPPAGE_CONNECTION, DIALOG
    286     BEGIN
    287         LEFTMARGIN, 7
    288         RIGHTMARGIN, 203
    289         TOPMARGIN, 7
    290         BOTTOMMARGIN, 147
     255        TOPMARGIN, 6
     256        BOTTOMMARGIN, 94
    291257    END
    292258END
     
    296262/////////////////////////////////////////////////////////////////////////////
    297263//
    298 // Menu
    299 //
    300 
    301 IDR_POPUP MENU DISCARDABLE
    302 BEGIN
    303     POPUP "tray"
    304     BEGIN
    305         MENUITEM "&Show",                       IDM_SHOW
    306         MENUITEM SEPARATOR
    307         MENUITEM "&Exit",                       IDM_EXIT
    308     END
    309 END
    310 
    311 
    312 /////////////////////////////////////////////////////////////////////////////
    313 //
    314264// Bitmap
    315265//
     
    325275BEGIN
    326276    IDS_ABOUTBOX            "&About bitlbee..."
    327     IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
    328277END
    329278
  • win32/admin/bitlbeewin.h

    r99318ad rabe53d3  
    1414#include "resource.h"           // main symbols
    1515
    16 class CTrayNot;
    17 extern "C" {
    18 #define BITLBEE_CORE
    19 #include "bitlbee.h"
    20 }
    21 
    2216/////////////////////////////////////////////////////////////////////////////
    2317// CBitlbeeApp:
     
    2822{
    2923public:
    30         CBitlbeeApp();
     24        CBitlbeeApp() {}
    3125
    3226// Overrides
     
    4135
    4236        //{{AFX_MSG(CBitlbeeApp)
    43         afx_msg void OnExit();
    44         afx_msg void OnShow();
    4537        //}}AFX_MSG
    4638        DECLARE_MESSAGE_MAP()
    4739        protected:
    48                 CTrayNot *not;
    4940                CPropertySheet *dlg;
    50                 GIOChannel *listen;
    5141};
    5242
  • win32/admin/resource.h

    r99318ad rabe53d3  
    2121#define IDD_PROPPAGE_CONNECTION         137
    2222#define IDI_ICON1                       138
     23#define IDD_PROPPAGE_MAIN               138
    2324#define IDC_AUTH_OPEN                   1001
    2425#define IDC_AUTH_CLOSED                 1002
     
    4647#define IDC_PROXYPORT                   1023
    4748#define IDC_PROXYTYPE                   1024
     49#define IDC_STARTSERVICE                1025
     50#define IDC_STOPSERVICE                 1026
     51#define IDC_VERBOSE                     1027
     52#define IDC_PING_INTERVAL               1028
    4853#define IDM_SHOW                        32771
    4954#define IDM_EXIT                        32773
     
    5560#define _APS_NEXT_RESOURCE_VALUE        139
    5661#define _APS_NEXT_COMMAND_VALUE         32774
    57 #define _APS_NEXT_CONTROL_VALUE         1025
     62#define _APS_NEXT_CONTROL_VALUE         1029
    5863#define _APS_NEXT_SYMED_VALUE           102
    5964#endif
  • win32/bitlbee.dsp

    r99318ad rabe53d3  
    5454LINK32=link.exe
    5555# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
    56 # 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"
    57 # SUBTRACT LINK32 /incremental:yes /nodefaultlib
     56# 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"
     57# SUBTRACT LINK32 /pdb:none
    5858
    5959!ELSEIF  "$(CFG)" == "bitlbee - Win32 Debug"
     
    7171# PROP Target_Dir ""
    7272# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
    73 # 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
     73# 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
    7474# SUBTRACT CPP /YX
    7575# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
     
    8282LINK32=link.exe
    8383# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
    84 # 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"
     84# 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"
     85# SUBTRACT LINK32 /pdb:none
    8586
    8687!ENDIF
     
    103104# Begin Source File
    104105
    105 SOURCE=.\bitlbee.rc
    106 
    107 !IF  "$(CFG)" == "bitlbee - Win32 Release"
    108 
    109 !ELSEIF  "$(CFG)" == "bitlbee - Win32 Debug"
    110 
    111 !ENDIF
    112 
    113 # End Source File
    114 # Begin Source File
    115 
    116106SOURCE=..\commands.c
    117107# End Source File
     
    254244# End Source File
    255245# End Group
    256 # Begin Group "Resource Files"
    257 
    258 # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
    259 # Begin Source File
    260 
    261 SOURCE=.\res\bitlbee.rc2
    262 # End Source File
    263 # Begin Source File
    264 
    265 SOURCE=.\res\bmp00002.bmp
    266 # End Source File
    267 # Begin Source File
    268 
    269 SOURCE=.\res\icon1.ico
    270 # End Source File
    271 # Begin Source File
    272 
    273 SOURCE=.\res\icon2.ico
    274 # End Source File
    275 # End Group
    276 # Begin Source File
    277 
    278 SOURCE=.\README.TXT
    279 # End Source File
    280246# End Target
    281247# End Project
Note: See TracChangeset for help on using the changeset viewer.