19ac4c6e8SJérôme Duval/*
259b0036eSAxel Dörfler * Copyright 2001-2016, Haiku.
39ac4c6e8SJérôme Duval * Distributed under the terms of the MIT License.
49ac4c6e8SJérôme Duval *
59ac4c6e8SJérôme Duval * Authors:
69ac4c6e8SJérôme Duval *		Michael Pfeiffer
79ac4c6e8SJérôme Duval */
89ac4c6e8SJérôme Duval
9af09bc0aSMichael Pfeiffer
1052a38012Sejakowatz#include "Globals.h"
119ac4c6e8SJérôme Duval
129ac4c6e8SJérôme Duval#include <stdio.h>
1352a38012Sejakowatz
1452a38012Sejakowatz#include <Roster.h>
1552a38012Sejakowatz
169ac4c6e8SJérôme Duval#include "pr_server.h"
179ac4c6e8SJérôme Duval
18247c4fa5SMichael Pfeiffer
194aa5d966SKarsten HeimrichBString
204aa5d966SKarsten HeimrichActivePrinterName()
2152a38012Sejakowatz{
224aa5d966SKarsten Heimrich	BMessenger msgr;
234aa5d966SKarsten Heimrich	if (GetPrinterServerMessenger(msgr) != B_OK)
244aa5d966SKarsten Heimrich		return BString();
254aa5d966SKarsten Heimrich
264aa5d966SKarsten Heimrich	BMessage getNameOfActivePrinter(B_GET_PROPERTY);
274aa5d966SKarsten Heimrich	getNameOfActivePrinter.AddSpecifier("ActivePrinter");
284aa5d966SKarsten Heimrich
294aa5d966SKarsten Heimrich	BMessage reply;
304aa5d966SKarsten Heimrich	msgr.SendMessage(&getNameOfActivePrinter, &reply);
314aa5d966SKarsten Heimrich
324aa5d966SKarsten Heimrich	BString activePrinterName;
334aa5d966SKarsten Heimrich	reply.FindString("result", &activePrinterName);
344aa5d966SKarsten Heimrich
354aa5d966SKarsten Heimrich	return activePrinterName;
364aa5d966SKarsten Heimrich}
374aa5d966SKarsten Heimrich
384aa5d966SKarsten Heimrich
394aa5d966SKarsten Heimrichstatus_t
404aa5d966SKarsten HeimrichGetPrinterServerMessenger(BMessenger& msgr)
414aa5d966SKarsten Heimrich{
4252a38012Sejakowatz	msgr = BMessenger(PSRV_SIGNATURE_TYPE);
4352a38012Sejakowatz	return msgr.IsValid() ? B_OK : B_ERROR;
4452a38012Sejakowatz}
45