~ubuntu-branches/ubuntu/precise/amule-adunanza/precise

« back to all changes in this revision

Viewing changes to src/amule-remote-gui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-02-18 21:16:23 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100218211623-gptwe60zx1knfkmu
Tags: 2010.1+2.2.6-0ubuntu1
* New upstream release (LP: #524697)
  - Drop manpages_spelling_fixes.diff fixed by upstream
  - Drop cryptopp-reference.diff fixed by upstream
  - Bump Standards-Version no changes required
  - Update install files (amule -> amuleadunanza)
  - debian/rules: amule.xpm -> amuleadunanza.xpm
  - Add README.Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
// This file is part of the aMule Project.
3
3
//
4
 
// Copyright (C) 2005-2008 aMule Team ( admin@amule.org / http://www.amule.org )
 
4
// Copyright (C) 2005-2009 aMule Team ( admin@amule.org / http://www.amule.org )
5
5
//
6
6
// Any parts of this program derived from the xMule, lMule or eMule project,
7
7
// or contributed by third-party developers are copyrighted by their
82
82
        wxConfig::Get()->Read(wxT("/EC/Host"), &pref_host, wxT("localhost"));
83
83
        wxConfig::Get()->Read(wxT("/EC/Port"), &pref_port, wxT("4712"));
84
84
        wxConfig::Get()->Read(wxT("/EC/Password"), &pwd_hash);
85
 
 
86
85
        
87
86
        CastChild(ID_REMOTE_HOST, wxTextCtrl)->SetValue(pref_host);
88
87
        CastChild(ID_REMOTE_PORT, wxTextCtrl)->SetValue(pref_port);
140
139
IMPLEMENT_APP(CamuleRemoteGuiApp)
141
140
 
142
141
// ADUNANZA BEGIN
 
142
// Funzione da togliere: le interf. remote NON devono scaricare adunanza.conf!
143
143
void CamuleRemoteGuiApp::OnFinishedHTTPDownload(CMuleInternalEvent& event)
144
144
{
 
145
#if !defined(CLIENT_GUI)
145
146
        if (!rm) return;
146
147
 
147
148
        switch (event.GetInt()) {
151
152
                default:
152
153
                        break;
153
154
        }
 
155
#endif
154
156
}
155
157
// ADUNANZA END
156
158
 
159
161
        StopTickTimer();
160
162
        
161
163
// ADUNANZA BEGIN
162
 
        delete rm;   rm   = NULL;
 
164
#if !defined(CLIENT_GUI)
 
165
        delete rm;
 
166
#endif  
 
167
        rm   = NULL;
163
168
        // delete acfg; acfg = NULL; Mr Hyde: tolto perche' deve essere gestito con wx
164
169
        delete pUploadSlotsMng;
165
170
        pUploadSlotsMng = NULL;
270
275
        }
271
276
 
272
277
        m_connect = new CRemoteConnect(this);
 
278
// ADUNANZA BEGIN
 
279
#if 0   
273
280
        SetAppName(wxT("aMule"));
 
281
#else
 
282
        SetAppName(wxT(ADU_APPNAME));
 
283
#endif
 
284
// ADUNANZA END
274
285
        
275
286
        // Load Preferences
276
287
        // This creates the CFG file we shall use
284
295
        wxConfig::Set(new wxFileConfig(wxEmptyString, wxEmptyString,
285
296
                ConfigDir + wxT("remote.conf")));
286
297
#endif
 
298
#if !defined(CLIENT_GUI)
287
299
        rm = new CRemoteSettings();
 
300
#endif  
288
301
 
289
302
        theApp->acfg = new wxFileConfig(wxEmptyString, wxEmptyString, 
290
303
                ConfigDir + wxT("remote.conf"));
337
350
void CamuleRemoteGuiApp::OnECConnection(wxEvent& event) {
338
351
        wxECSocketEvent& evt = *((wxECSocketEvent*)&event);
339
352
        printf("Remote GUI EC event handler\n");
340
 
        AddLogLineM(true,evt.GetServerReply());
 
353
        wxString reply = evt.GetServerReply();
 
354
        AddLogLineM(true, reply);
341
355
        if (evt.GetResult() == true) {
342
356
                // Connected - go to next init step
343
357
                glob_prefs->LoadRemote();
344
358
        } else {
345
359
                printf("Going down\n");
 
360
                wxMessageBox(
 
361
                        (CFormat(_("Connection Failed. Unable to connect to %s:%d\n")) % dialog->Host() % dialog->Port()) + reply,
 
362
                        _("ERROR"), wxOK);
346
363
                ExitMainLoop();
347
364
        }
348
365
}
469
486
 
470
487
        uri.AddField(wxT("dn"), f->GetFileName().Cleanup(false).GetPrintable());
471
488
        uri.AddField(wxT("xt"), wxString(wxT("urn:ed2k:")) + f->GetFileHash().Encode().Lower());
 
489
        uri.AddField(wxT("xt"), wxString(wxT("urn:ed2khash:")) + f->GetFileHash().Encode().Lower());
472
490
        uri.AddField(wxT("xl"), wxString::Format(wxT("%") wxLongLongFmtSpec wxT("u"), f->GetFileSize()));
473
491
 
474
492
        return uri.GetLink();
530
548
        wxString strURL = CreateED2kLink(f);
531
549
        // Append the AICH info
532
550
        if (f->HasProperAICHHashSet()) {
533
 
                strURL << wxT("|h=") << f->GetAICHMasterHash() << wxT("|/");
 
551
                strURL.RemoveLast();            // remove trailing '/'
 
552
                strURL << wxT("h=") << f->GetAICHMasterHash() << wxT("|/");
534
553
        }       
535
554
 
536
 
        // Result is "ed2k://|file|<filename>|<size>|<hash>|/|h=<AICH master hash>|/"
 
555
        // Result is "ed2k://|file|<filename>|<size>|<hash>|h=<AICH master hash>|/"
537
556
        return strURL;
538
557
}
539
558
 
656
675
        ((CEC_Prefs_Packet *)packet)->Apply();
657
676
 
658
677
        if ( packet->GetTagByName(EC_TAG_PREFS_CATEGORIES) != 0 ) {
 
678
// ADUNANZA BEGIN
 
679
// Per warning su tipo
 
680
#if 0
659
681
                for (int i = 0; i < packet->GetTagByName(EC_TAG_PREFS_CATEGORIES)->GetTagCount(); i++) {
 
682
#else
 
683
                for (size_t i = 0; i < packet->GetTagByName(EC_TAG_PREFS_CATEGORIES)->GetTagCount(); i++) {
 
684
#endif
 
685
// ADUNANZA END
660
686
                        const CECTag *cat_tag = packet->GetTagByName(EC_TAG_PREFS_CATEGORIES)->GetTagByIndex(i);
661
687
                        Category_Struct *cat = new Category_Struct;
662
688
                        cat->title = cat_tag->GetTagByName(EC_TAG_CATEGORY_TITLE)->GetStringData();
1663
1689
}
1664
1690
 
1665
1691
 
 
1692
// ADUNANZA BEGIN
 
1693
// Backport
 
1694
void CSearchListRem::StopKadSearch()
 
1695
{
 
1696
// FIXME implementation needed
 
1697
}
 
1698
// ADUNANZA END
 
1699
 
1666
1700
void CSearchListRem::HandlePacket(const CECPacket *packet)
1667
1701
{
1668
1702
        if ( packet->GetOpCode() == EC_OP_SEARCH_PROGRESS ) {