Просмотр исходного кода

apt-pkg/acquire-worker.cc: Introduce 104 Warning message

This can be used by workers to send warnings to the main
program. The messages will be passed to _error->Warning()
by APT with the URI prepended.

We are not going to make that really public now, as the
interface might change a bit.
Julian Andres Klode лет назад: 10
Родитель
Сommit
8c9b7725c3
2 измененных файлов с 12 добавлено и 0 удалено
  1. 4 0
      apt-pkg/acquire-worker.cc
  2. 8 0
      methods/aptmethod.h

+ 4 - 0
apt-pkg/acquire-worker.cc

@@ -277,6 +277,10 @@ bool pkgAcquire::Worker::RunMessages()
 	    }
             break;
          }
+	 // 104 Warning
+	 case 104:
+	    _error->Warning("%s: %s", Itm->URI.c_str(), LookupTag(Message,"Message").c_str());
+	    break;
 
 	 // 200 URI Start
 	 case 200:

+ 8 - 0
methods/aptmethod.h

@@ -34,6 +34,14 @@ public:
       return true;
    }
 
+   void Warning(const char *Format,...)
+   {
+      va_list args;
+      va_start(args,Format);
+      PrintStatus("104 Warning", Format, args);
+      va_end(args);
+   }
+
    aptMethod(char const * const Binary, char const * const Ver, unsigned long const Flags) :
       pkgAcqMethod(Ver, Flags), Binary(Binary)
    {}