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