1//
2// This file is part of the aMule Project.
3//
4// Copyright (c) 2004-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5//
6// Any parts of this program derived from the xMule, lMule or eMule project,
7// or contributed by third-party developers are copyrighted by their
8// respective authors.
9//
10// This program is free software; you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation; either version 2 of the License, or
13// (at your option) any later version.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
23//
24
25#include "GuiEvents.h"
26#include "amule.h"
27#include "PartFile.h"
28#include "DownloadQueue.h"
29#include "ServerList.h"
30#include "Preferences.h"
31#include "ExternalConn.h"
32#include "SearchFile.h"
33#include "SearchList.h"
34#include "IPFilter.h"
35#include "Friend.h"
36
37#ifndef AMULE_DAEMON
38#	include "ChatWnd.h"
39#	include "amuleDlg.h"
40#	include "ServerWnd.h"
41#	include "SearchDlg.h"
42#	include "TransferWnd.h"
43#	include "SharedFilesWnd.h"
44#	include "ServerListCtrl.h"
45#	include "SourceListCtrl.h"
46#	include "SharedFilesCtrl.h"
47#	include "DownloadListCtrl.h"
48#	include "muuli_wdr.h"
49#	include "SharedFilePeersListCtrl.h"
50#	ifndef CLIENT_GUI
51#		include "PartFileConvertDlg.h"
52#		include "PartFileConvert.h"
53#	endif
54#endif
55
56#ifndef CLIENT_GUI
57#	include "UploadQueue.h"
58#endif
59
60#include <common/MacrosProgramSpecific.h>
61
62DEFINE_LOCAL_EVENT_TYPE(MULE_EVT_NOTIFY)
63
64
65namespace MuleNotify
66{
67
68	void HandleNotification(const CMuleNotiferBase& ntf)
69	{
70		if (wxThread::IsMain()) {
71#ifdef AMULE_DAEMON
72			ntf.Notify();
73#else
74			if (theApp->amuledlg) {
75				ntf.Notify();
76			}
77#endif
78		} else {
79			CMuleGUIEvent evt(ntf.Clone());
80			wxPostEvent(wxTheApp, evt);
81		}
82	}
83
84
85	void HandleNotificationAlways(const CMuleNotiferBase& ntf)
86	{
87		CMuleGUIEvent evt(ntf.Clone());
88		wxPostEvent(wxTheApp, evt);
89	}
90
91
92	void Search_Add_Download(CSearchFile* file, uint8 category)
93	{
94		theApp->downloadqueue->AddSearchToDownload(file, category);
95	}
96
97
98	void ShowUserCount(wxString NOT_ON_DAEMON(str))
99	{
100#ifndef AMULE_DAEMON
101		theApp->amuledlg->ShowUserCount(str);
102#endif
103	}
104
105
106	void Search_Update_Progress(uint32 NOT_ON_DAEMON(val))
107	{
108#ifndef AMULE_DAEMON
109		if (theApp->amuledlg->m_searchwnd) {
110			if (val == 0xffff) {
111				// Global search ended
112				theApp->amuledlg->m_searchwnd->ResetControls();
113			} else if (val == 0xfffe) {
114				// Kad search ended
115				theApp->amuledlg->m_searchwnd->KadSearchEnd(0);
116			} else {
117				theApp->amuledlg->m_searchwnd->UpdateProgress(val);
118			}
119		}
120#endif
121	}
122
123
124	void DownloadCtrlUpdateItem(const void* item)
125	{
126#ifndef CLIENT_GUI
127		theApp->ECServerHandler->m_ec_notifier->DownloadFile_SetDirty((CPartFile *)item);
128#endif
129#ifndef AMULE_DAEMON
130		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->downloadlistctrl) {
131			theApp->amuledlg->m_transferwnd->downloadlistctrl->UpdateItem(item);
132		}
133#endif
134	}
135
136
137	void DownloadCtrlDoItemSelectionChanged()
138	{
139#ifndef AMULE_DAEMON
140		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->downloadlistctrl) {
141			theApp->amuledlg->m_transferwnd->downloadlistctrl->DoItemSelectionChanged();
142		}
143#endif
144	}
145
146
147	void NodesURLChanged(wxString NOT_ON_DAEMON(url))
148	{
149#ifndef AMULE_DAEMON
150		CastByID(IDC_NODESLISTURL, NULL, wxTextCtrl)->SetValue(url);
151#endif
152	}
153
154	void ServersURLChanged(wxString NOT_ON_DAEMON(url))
155	{
156#ifndef AMULE_DAEMON
157		CastByID(IDC_SERVERLISTURL, NULL, wxTextCtrl)->SetValue(url);
158#endif
159	}
160
161	void ShowGUI()
162	{
163#ifndef AMULE_DAEMON
164		theApp->amuledlg->Iconize(false);
165#endif
166	}
167
168	void SourceCtrlUpdateSource(uint32 NOT_ON_DAEMON(source), SourceItemType NOT_ON_DAEMON(type))
169	{
170#ifndef AMULE_DAEMON
171		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->clientlistctrl) {
172			theApp->amuledlg->m_transferwnd->clientlistctrl->UpdateItem(source, type);
173		}
174#endif
175	}
176
177	void SourceCtrlAddSource(CPartFile* NOT_ON_DAEMON(owner), CClientRef NOT_ON_DAEMON(source), SourceItemType NOT_ON_DAEMON(type))
178	{
179#ifndef AMULE_DAEMON
180		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->clientlistctrl) {
181			theApp->amuledlg->m_transferwnd->clientlistctrl->AddSource(owner, source, type);
182		}
183#endif
184	}
185
186	void SourceCtrlRemoveSource(uint32 NOT_ON_DAEMON(source), const CPartFile* NOT_ON_DAEMON(owner))
187	{
188#ifndef AMULE_DAEMON
189		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->clientlistctrl) {
190			theApp->amuledlg->m_transferwnd->clientlistctrl->RemoveSource(source, owner);
191		}
192#endif
193	}
194
195	void SharedCtrlAddClient(CKnownFile* NOT_ON_DAEMON(owner), CClientRef NOT_ON_DAEMON(source), SourceItemType NOT_ON_DAEMON(type))
196	{
197#ifndef AMULE_DAEMON
198		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->peerslistctrl) {
199			theApp->amuledlg->m_sharedfileswnd->peerslistctrl->AddSource(owner, source, type);
200		}
201#endif
202	}
203
204	void SharedCtrlRefreshClient(uint32 NOT_ON_DAEMON(client), SourceItemType NOT_ON_DAEMON(type))
205	{
206#ifndef AMULE_DAEMON
207		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->peerslistctrl) {
208			theApp->amuledlg->m_sharedfileswnd->peerslistctrl->UpdateItem(client, type);
209		}
210#endif
211	}
212
213	void SharedCtrlRemoveClient(uint32 NOT_ON_DAEMON(source), const CKnownFile* NOT_ON_DAEMON(owner))
214	{
215#ifndef AMULE_DAEMON
216		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->peerslistctrl) {
217			theApp->amuledlg->m_sharedfileswnd->peerslistctrl->RemoveSource(source, owner);
218		}
219#endif
220	}
221
222	void ServerRefresh(CServer* NOT_ON_DAEMON(server))
223	{
224#ifndef AMULE_DAEMON
225		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
226			theApp->amuledlg->m_serverwnd->serverlistctrl->RefreshServer(server);
227		}
228#endif
229	}
230
231	void ChatUpdateFriend(CFriend * NOT_ON_DAEMON(toupdate))
232	{
233#ifndef AMULE_DAEMON
234		if (theApp->amuledlg->m_chatwnd) {
235			theApp->amuledlg->m_chatwnd->UpdateFriend(toupdate);
236		}
237#endif
238	}
239
240	void ChatRemoveFriend(CFriend * toremove)
241	{
242#ifndef AMULE_DAEMON
243		if (theApp->amuledlg->m_chatwnd) {
244			theApp->amuledlg->m_chatwnd->RemoveFriend(toremove);
245		}
246#endif
247		delete toremove;
248	}
249
250#ifdef CLIENT_GUI
251
252	void PartFile_Swap_A4AF(CPartFile* file)
253	{
254		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_SWAP_A4AF_THIS);
255	}
256
257	void PartFile_Swap_A4AF_Auto(CPartFile* file)
258	{
259		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_SWAP_A4AF_THIS_AUTO);
260	}
261
262	void PartFile_Swap_A4AF_Others(CPartFile* file)
263	{
264		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_SWAP_A4AF_OTHERS);
265	}
266
267	void PartFile_Pause(CPartFile* file)
268	{
269		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_PAUSE);
270	}
271
272	void PartFile_Resume(CPartFile* file)
273	{
274		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_RESUME);
275	}
276
277	void PartFile_Stop(CPartFile* file)
278	{
279		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_STOP);
280	}
281
282	void PartFile_PrioAuto(CPartFile* file, bool val)
283	{
284		theApp->downloadqueue->AutoPrio(file, val);
285	}
286
287	void PartFile_PrioSet(CPartFile* file, uint8 newDownPriority, bool)
288	{
289		theApp->downloadqueue->Prio(file, newDownPriority);
290	}
291
292	void PartFile_Delete(CPartFile* file)
293	{
294		theApp->downloadqueue->SendFileCommand(file, EC_OP_PARTFILE_DELETE);
295	}
296
297	void PartFile_SetCat(CPartFile* file, uint32 val)
298	{
299		theApp->downloadqueue->Category(file, val);
300	}
301
302	void KnownFile_Up_Prio_Set(CKnownFile* file, uint8 val)
303	{
304		theApp->sharedfiles->SetFilePrio(file, val);
305	}
306
307	void KnownFile_Up_Prio_Auto(CKnownFile* file)
308	{
309		theApp->sharedfiles->SetFilePrio(file, PR_AUTO);
310	}
311
312	void KnownFile_Comment_Set(CKnownFile* file, wxString comment, int8 rating)
313	{
314		theApp->sharedfiles->SetFileCommentRating(file, comment, rating);
315	}
316
317	void Download_Set_Cat_Prio(uint8, uint8)
318	{
319	}
320
321	void Download_Set_Cat_Status(uint8, int)
322	{
323	}
324
325	void Upload_Resort_Queue()
326	{
327	}
328
329#else
330
331	void SharedFilesShowFile(CKnownFile* NOT_ON_DAEMON(file))
332	{
333#ifndef AMULE_DAEMON
334		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl) {
335			theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl->ShowFile(file);
336		}
337#endif
338	}
339
340	void SharedFilesRemoveFile(CKnownFile* NOT_ON_DAEMON(file))
341	{
342#ifndef AMULE_DAEMON
343		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl) {
344			theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl->RemoveFile(file);
345		}
346#endif
347	}
348
349	void SharedFilesRemoveAllFiles()
350	{
351#ifndef AMULE_DAEMON
352		if (theApp->amuledlg->m_sharedfileswnd) {
353			theApp->amuledlg->m_sharedfileswnd->RemoveAllSharedFiles();
354		}
355#endif
356	}
357
358
359	void SharedFilesShowFileList()
360	{
361#ifndef AMULE_DAEMON
362		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl) {
363			theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl->ShowFileList();
364		}
365#endif
366	}
367
368
369	void SharedFilesUpdateItem(CKnownFile* NOT_ON_DAEMON(file))
370	{
371#ifndef AMULE_DAEMON
372		if (theApp->amuledlg->m_sharedfileswnd && theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl) {
373			theApp->amuledlg->m_sharedfileswnd->sharedfilesctrl->UpdateItem(file);
374		}
375#endif
376	}
377
378
379	void DownloadCtrlAddFile(CPartFile* file)
380	{
381		theApp->ECServerHandler->m_ec_notifier->DownloadFile_AddFile(file);
382#ifndef AMULE_DAEMON
383		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->downloadlistctrl ) {
384			theApp->amuledlg->m_transferwnd->downloadlistctrl->AddFile(file);
385		}
386#endif
387	}
388
389	void DownloadCtrlRemoveFile(CPartFile* file)
390	{
391		theApp->ECServerHandler->m_ec_notifier->DownloadFile_RemoveFile(file);
392#ifndef AMULE_DAEMON
393		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->downloadlistctrl) {
394			theApp->amuledlg->m_transferwnd->downloadlistctrl->RemoveFile(file);
395		}
396#endif
397	}
398
399	void DownloadCtrlSort()
400	{
401#ifndef AMULE_DAEMON
402		if (theApp->amuledlg->m_transferwnd && theApp->amuledlg->m_transferwnd->downloadlistctrl) {
403			theApp->amuledlg->m_transferwnd->downloadlistctrl->SortList();
404		}
405#endif
406	}
407
408	void ServerAdd(CServer* NOT_ON_DAEMON(server))
409	{
410#ifndef AMULE_DAEMON
411		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
412			theApp->amuledlg->m_serverwnd->serverlistctrl->AddServer(server);
413		}
414#endif
415	}
416
417	void ServerRemove(CServer* NOT_ON_DAEMON(server))
418	{
419#ifndef AMULE_DAEMON
420		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
421			theApp->amuledlg->m_serverwnd->serverlistctrl->RemoveServer(server);
422		}
423#endif
424	}
425
426	void ServerRemoveDead()
427	{
428		if (theApp->serverlist) {
429			theApp->serverlist->RemoveDeadServers();
430		}
431	}
432
433	void ServerRemoveAll()
434	{
435#ifndef AMULE_DAEMON
436		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
437			theApp->amuledlg->m_serverwnd->serverlistctrl->DeleteAllItems();
438		}
439#endif
440	}
441
442	void ServerHighlight(CServer* NOT_ON_DAEMON(server), bool NOT_ON_DAEMON(highlight))
443	{
444#ifndef AMULE_DAEMON
445		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
446			theApp->amuledlg->m_serverwnd->serverlistctrl->HighlightServer(server, highlight);
447		}
448#endif
449	}
450
451	void ServerFreeze()
452	{
453#ifndef AMULE_DAEMON
454		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
455			theApp->amuledlg->m_serverwnd->serverlistctrl->Freeze();
456		}
457#endif
458	}
459
460	void ServerThaw()
461	{
462#ifndef AMULE_DAEMON
463		if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) {
464			theApp->amuledlg->m_serverwnd->serverlistctrl->Thaw();
465		}
466#endif
467	}
468
469	void ServerUpdateED2KInfo()
470	{
471#ifndef AMULE_DAEMON
472		if (theApp->amuledlg->m_serverwnd) {
473			theApp->amuledlg->m_serverwnd->UpdateED2KInfo();
474		}
475#endif
476	}
477
478	void ServerUpdateKadKInfo()
479	{
480#ifndef AMULE_DAEMON
481		if (theApp->amuledlg->m_serverwnd) {
482			theApp->amuledlg->m_serverwnd->UpdateKadInfo();
483		}
484#endif
485	}
486
487
488	void SearchCancel()
489	{
490#ifndef AMULE_DAEMON
491		if (theApp->amuledlg->m_searchwnd) {
492			theApp->amuledlg->m_searchwnd->ResetControls();
493		}
494#endif
495	}
496
497	void SearchLocalEnd()
498	{
499#ifndef AMULE_DAEMON
500		if (theApp->amuledlg->m_searchwnd) {
501			theApp->amuledlg->m_searchwnd->LocalSearchEnd();
502		}
503#endif
504	}
505
506	void KadSearchEnd(uint32 NOT_ON_DAEMON(id))
507	{
508#ifndef AMULE_DAEMON
509		if (theApp->amuledlg->m_searchwnd) {
510			theApp->amuledlg->m_searchwnd->KadSearchEnd(id);
511		}
512#endif
513		theApp->searchlist->SetKadSearchFinished();
514	}
515
516	void Search_Update_Sources(CSearchFile* result)
517	{
518		result->SetDownloadStatus();
519#ifndef AMULE_DAEMON
520		if (theApp->amuledlg && theApp->amuledlg->m_searchwnd) {
521			theApp->amuledlg->m_searchwnd->UpdateResult(result);
522		}
523#endif
524	}
525
526	void Search_Add_Result(CSearchFile* NOT_ON_DAEMON(result))
527	{
528#ifndef AMULE_DAEMON
529		if (theApp->amuledlg && theApp->amuledlg->m_searchwnd) {
530			theApp->amuledlg->m_searchwnd->AddResult(result);
531		}
532#endif
533	}
534
535
536	void ChatConnResult(bool NOT_ON_DAEMON(success), uint64 NOT_ON_DAEMON(id), wxString NOT_ON_DAEMON(message))
537	{
538#ifndef AMULE_DAEMON
539		if (theApp->amuledlg->m_chatwnd) {
540			theApp->amuledlg->m_chatwnd->ConnectionResult(success, message, id);
541		}
542#endif
543	}
544
545	void ChatProcessMsg(uint64 NOT_ON_DAEMON(sender), wxString NOT_ON_DAEMON(message))
546	{
547#ifndef AMULE_DAEMON
548		if (theApp->amuledlg->m_chatwnd) {
549			theApp->amuledlg->m_chatwnd->ProcessMessage(sender, message);
550		}
551#endif
552	}
553
554
555	void ChatSendCaptcha(wxString NOT_ON_DAEMON(captcha), uint64 NOT_ON_DAEMON(to_id))
556	{
557#ifndef AMULE_DAEMON
558		if (theApp->amuledlg->m_chatwnd) {
559			theApp->amuledlg->m_chatwnd->SendMessage(captcha, wxEmptyString, to_id);
560		}
561#endif
562	}
563
564
565	void ShowConnState(long NOT_ON_DAEMON(forceUpdate))
566	{
567#ifndef AMULE_DAEMON
568		theApp->amuledlg->ShowConnectionState(forceUpdate != 0);
569#endif
570	}
571
572	void ShowUpdateCatTabTitles()
573	{
574#ifndef AMULE_DAEMON
575		if (theApp->amuledlg->m_transferwnd) {
576			theApp->amuledlg->m_transferwnd->UpdateCatTabTitles();
577		}
578#endif
579	}
580
581	void CategoryAdded()
582	{
583#ifndef AMULE_DAEMON
584		if (theApp->amuledlg->m_transferwnd) {
585			theApp->amuledlg->m_transferwnd->
586				AddCategory(theApp->glob_prefs->GetCategory(
587					theApp->glob_prefs->GetCatCount()-1));
588		}
589#endif
590	}
591
592	void CategoryUpdate(uint32 NOT_ON_DAEMON(cat))
593	{
594#ifndef AMULE_DAEMON
595		if (theApp->amuledlg->m_transferwnd) {
596			theApp->amuledlg->m_transferwnd->UpdateCategory(cat);
597			theApp->amuledlg->m_transferwnd->downloadlistctrl->Refresh();
598			theApp->amuledlg->m_searchwnd->UpdateCatChoice();
599		}
600#endif
601	}
602
603	void CategoryDelete(uint32 cat)
604	{
605#ifdef AMULE_DAEMON
606		if (cat > 0) {
607			theApp->downloadqueue->ResetCatParts(cat);
608			theApp->glob_prefs->RemoveCat(cat);
609			if ( theApp->glob_prefs->GetCatCount() == 1 ) {
610				thePrefs::SetAllcatFilter( acfAll );
611			}
612			theApp->glob_prefs->SaveCats();
613		}
614#else
615		if (theApp->amuledlg->m_transferwnd) {
616			theApp->amuledlg->m_transferwnd->RemoveCategory(cat);
617		}
618#endif
619	}
620
621
622	void PartFile_Swap_A4AF(CPartFile* file)
623	{
624		if ((file->GetStatus(false) == PS_READY || file->GetStatus(false) == PS_EMPTY)) {
625			CPartFile::SourceSet::const_iterator it = file->GetA4AFList().begin();
626			for ( ; it != file->GetA4AFList().end(); ) {
627				it++->SwapToAnotherFile(true, false, false, file);
628			}
629		}
630	}
631
632	void PartFile_Swap_A4AF_Auto(CPartFile* file)
633	{
634		file->SetA4AFAuto(!file->IsA4AFAuto());
635	}
636
637	void PartFile_Swap_A4AF_Others(CPartFile* file)
638	{
639		if ((file->GetStatus(false) == PS_READY) || (file->GetStatus(false) == PS_EMPTY)) {
640			CPartFile::SourceSet::const_iterator it = file->GetSourceList().begin();
641			for( ; it != file->GetSourceList().end(); ) {
642				it++->SwapToAnotherFile(false, false, false, NULL);
643			}
644		}
645	}
646
647	void PartFile_Pause(CPartFile* file)
648	{
649		file->PauseFile();
650	}
651
652	void PartFile_Resume(CPartFile* file)
653	{
654		file->ResumeFile();
655		file->SavePartFile();
656	}
657
658	void PartFile_Stop(CPartFile* file)
659	{
660		file->StopFile();
661	}
662
663	void PartFile_PrioAuto(CPartFile* file, bool val)
664	{
665		file->SetAutoDownPriority(val);
666	}
667
668	void PartFile_PrioSet(CPartFile* file, uint8 newDownPriority, bool bSave)
669	{
670		file->SetDownPriority(newDownPriority, bSave);
671	}
672
673	void PartFile_Delete(CPartFile* file)
674	{
675		file->Delete();
676	}
677
678	void PartFile_SetCat(CPartFile* file, uint32 val)
679	{
680		file->SetCategory(val);
681	}
682
683
684	void KnownFile_Up_Prio_Set(CKnownFile* file, uint8 val)
685	{
686		file->SetAutoUpPriority(false);
687		file->SetUpPriority(val);
688	}
689
690	void KnownFile_Up_Prio_Auto(CKnownFile* file)
691	{
692		file->SetAutoUpPriority(true);
693		file->UpdateAutoUpPriority();
694	}
695
696	void KnownFile_Comment_Set(CKnownFile* file, wxString comment, int8 rating)
697	{
698		file->SetFileCommentRating(comment, rating);
699		SharedFilesUpdateItem(file);
700	}
701
702
703	void Download_Set_Cat_Prio(uint8 cat, uint8 newprio)
704	{
705		theApp->downloadqueue->SetCatPrio(cat, newprio);
706	}
707
708	void Download_Set_Cat_Status(uint8 cat, int newstatus)
709	{
710		theApp->downloadqueue->SetCatStatus(cat, newstatus);
711	}
712
713	void Upload_Resort_Queue()
714	{
715		theApp->uploadqueue->ResortQueue();
716	}
717
718	void IPFilter_Reload()
719	{
720		theApp->ipfilter->Reload();
721	}
722
723	void IPFilter_Update(wxString url)
724	{
725		theApp->ipfilter->Update(url);
726	}
727
728	void Client_Delete(CClientRef client)
729	{
730		client.Safe_Delete();
731	}
732
733#ifndef AMULE_DAEMON
734	void ConvertUpdateProgress(float percent, wxString text, wxString header)
735	{
736		CPartFileConvertDlg::UpdateProgress(percent, text, header);
737	}
738
739	void ConvertUpdateJobInfo(ConvertInfo info)
740	{
741		CPartFileConvertDlg::UpdateJobInfo(info);
742	}
743
744	void ConvertRemoveJobInfo(unsigned id)
745	{
746		CPartFileConvertDlg::RemoveJobInfo(id);
747	}
748
749	void ConvertClearInfos()
750	{
751		CPartFileConvertDlg::ClearInfo();
752	}
753
754	void ConvertRemoveJob(unsigned id)
755	{
756		CPartFileConvert::RemoveJob(id);
757	}
758
759	void ConvertRetryJob(unsigned id)
760	{
761		CPartFileConvert::RetryJob(id);
762	}
763
764	void ConvertReaddAllJobs()
765	{
766		CPartFileConvert::ReaddAllJobs();
767	}
768#endif	// #ifndef AMULE_DAEMON
769
770#endif	// #ifndef CLIENT_GUI
771}
772// File_checked_for_headers
773