Пример #1
0
void
AddPrinterDialog::_FillTransportMenu(BMenu* menu)
{
	BMessenger msgr;
	if (GetPrinterServerMessenger(msgr) != B_OK)
		return;

	for (long idx = 0; ; idx++) {
		BMessage reply, msg(B_GET_PROPERTY);
		msg.AddSpecifier("Transport", idx);
		if (msgr.SendMessage(&msg, &reply) != B_OK)
			break;

		BMessenger transport;
		if (reply.FindMessenger("result", &transport) != B_OK)
			break;

		// Got messenger to transport now
		msg.MakeEmpty();
		msg.what = B_GET_PROPERTY;
		msg.AddSpecifier("Name");
		if (transport.SendMessage(&msg, &reply) != B_OK)
			continue;

		BString transportName;
		if (reply.FindString("result", &transportName) != B_OK)
			continue;

		// Now get ports...
		BString portId, portName;
		int32 error;
		msg.MakeEmpty();
		msg.what = B_GET_PROPERTY;
		msg.AddSpecifier("Ports");
		if (transport.SendMessage(&msg, &reply) != B_OK
				|| reply.FindInt32("error", &error) != B_OK
				|| error != B_OK
				|| (transportName == "IPP"
						&& reply.FindString("port_id", &portId) != B_OK)) {
			// Transport does not provide list of ports
			BMessage* menuMsg = new BMessage(kTransportSelectedMsg);
			menuMsg->AddString("name", transportName);
			menu->AddItem(new BMenuItem(transportName.String(), menuMsg));
			continue;
		}

		// Create submenu
		BMenu* transportMenu = new TransportMenu(transportName.String(),
			kTransportSelectedMsg, transport, transportName);
		menu->AddItem(transportMenu);
		transportMenu->SetRadioMode(true);
		menu->ItemAt(menu->IndexOf(transportMenu))->
			SetMessage(new BMessage(kTransportSelectedMsg));
	}
}
// main
int
main(int argc, char **argv)
{
	// find app file and get signature from resources
	char path[B_PATH_NAME_LENGTH];
	status_t error = get_app_path(path);
	char signature[B_MIME_TYPE_LENGTH];
	if (error == B_OK) {
		// init app file
		BFile file;
		error = file.SetTo(path, B_READ_ONLY);
		// get signature
		BString signatureString;
		if (error == B_OK) {
			if (file.ReadAttrString("signature", &signatureString) == B_OK
				&& signatureString.Length() > 0) {
				strcpy(signature, signatureString.String());
			} else
				strcpy(signature, kDefaultTestAppSignature);
		} else
			printf("ERROR: Couldn't init app file: %s\n", strerror(error));
	} else
		printf("ERROR: Couldn't get app ref: %s\n", strerror(error));
	// create the app
	TestApp *app = NULL;
	if (error == B_OK) {
		app = new TestApp(signature);
//		unitTesterMessenger = BMessenger(kUnitTesterSignature);
		error = init_unit_tester_messenger();
		if (error != B_OK)
			printf("ERROR: Couldn't init messenger: %s\n", strerror(error));
		// send started message
		BMessage message(MSG_STARTED);
		message.AddString("path", path);
		unitTesterMessenger.SendMessage(&message);
		// send main() args message
		BMessage argsMessage(MSG_MAIN_ARGS);
		argsMessage.AddInt32("argc", argc);
		for (int i = 0; i < argc; i++)
			argsMessage.AddString("argv", argv[i]);
		unitTesterMessenger.SendMessage(&argsMessage);
		// run the app
		app->Run();
		delete app;
		// send terminated message
		unitTesterMessenger.SendMessage(MSG_TERMINATED);
	}
	return 0;
}
int32 CAsynchronousPopUpMenu::ThreadFunc(void *data)
{
	wait_thread_info *info = reinterpret_cast<wait_thread_info *>(data);

	BMessenger *messenger = info->popupMenu->notifyTarget;

	// send notification message, before menu is displayed.
	if(messenger) {
		BMessage openNotify(MSG_MENU_BEGINNING);

		AddTime(&openNotify, "when", system_time());
		openNotify.AddPointer("source", info->popupMenu);
	
		messenger->SendMessage(&openNotify);
	}

	BMenuItem *item = NULL;

	// call SYNCHRONOUS version of Go() and wait until the 
	// the function returns.
	if(info->clickToOpenRect == BRect(-1,-1,-1,-1)) {
		// No clickToOpenRect supplied.
		item = info->popupMenu->Go(info->screenPoint, true, 
				info->openAnyway, false);
	} else {
		item = info->popupMenu->Go(info->screenPoint, true, 
				info->openAnyway, info->clickToOpenRect, false);
	}
	
	// Menu was closed. Send notification message.
	if(messenger) {
		BMessage closeNotify(MSG_MENU_ENDED);

		AddTime(&closeNotify, "when", system_time());
		closeNotify.AddPointer("source", info->popupMenu);
		closeNotify.AddPointer("sel_item", item);
	
		messenger->SendMessage(&closeNotify);
	}
	
	// If autoDelete flag is set delete popup menu.
	if(info->autoDelete) {
		delete info->popupMenu;
	}
	
	delete info;
	
	return 0;
}
Пример #4
0
status_t
PrintServerMessenger::MessengerThread(void* data)
{
	PrintServerMessenger* messenger = static_cast<PrintServerMessenger*>(data);

	BMessenger printServer;
	if (messenger->GetPrintServerMessenger(printServer) != B_OK) {
		ShowError("Print Server is not responding.");
		messenger->SetResult(NULL);
		return B_ERROR;
	}

	BMessage* request = messenger->Request();
	if (request == NULL) {
		messenger->SetResult(NULL);
		return B_ERROR;
	}


	BMessage reply;
	if (printServer.SendMessage(request, &reply) != B_OK
		|| reply.what != 'okok' ) {
		messenger->SetResult(NULL);
		return B_ERROR;
	}

	messenger->SetResult(new BMessage(reply));
	return B_OK;
}
Пример #5
0
void
Win::CreateTabView()
{
	//cout << "Win::CreateTabView()" << endl;
	BRect rect = Bounds();
	
	tabview = new ThemisTabView(
		BRect(
			rect.left,
			rect.top + menubar->Bounds().Height() + 1 + navview->Bounds().Height() + 1,
			rect.right,
			rect.bottom - statusview->Bounds().Height() - 1 ),
		"THEMISTABVIEW", B_WIDTH_AS_USUAL, B_FOLLOW_ALL,
		B_FULL_UPDATE_ON_RESIZE |
		B_WILL_DRAW |
		B_NAVIGABLE_JUMP |
		B_FRAME_EVENTS |
		B_NAVIGABLE );
	AddChild( tabview );
	
	// add the first tab
	BMessenger* target = new BMessenger( this );
	target->SendMessage( TAB_ADD );
	delete target;
}
Пример #6
0
void
CaptureView::_SendMovedOutNotification()
{
	BMessage movedOut(fMovedOutWhat);
	fMovedOutMessenger.SendMessage(&movedOut);
	fMovedOutWhat = 0;
}
Пример #7
0
// sends M_OBSERVER_ADDED to the newly-added observer
void ObservableHandler::observerAdded(
	const BMessenger&				observer) {
	
	BMessage m(M_OBSERVER_ADDED);
	m.AddMessenger("target", BMessenger(this));
	observer.SendMessage(&m);
}
void MonthWindow::MessageReceived(BMessage *msg)
{
 if(msg->what=='MVME')
 {
  // Is date correct?
  int32 day, month, year;
  if(msg->FindInt32("day",&day)!=B_OK) return;
  if(msg->FindInt32("month",&month)!=B_OK) return;
  if(msg->FindInt32("year",&year)!=B_OK) return;
  
  if(year<first_year || year>last_year) return;
  if(month<1 || month>12) return;
  int32 tmp;
  
  tmp=31;
  if(month==4 || month==6 || month==9 || month==11) tmp=30;
  else if(month==2)
  {
   if(year%4==0)
   {
    if(year%100==0 && year%400!=0) tmp=28;
    else tmp=29;
   }
   else tmp=28;
  }
  if(day<1 || day>tmp) return;
  msng->SendMessage(msg);
  Quit();
 }
 else BWindow::MessageReceived(msg);
}
void
AutomountSettingsPanel::_SendSettings(bool rescan)
{
	BMessage message(kSetAutomounterParams);

	message.AddBool("autoMountAll", (bool)fAutoMountAllCheck->Value());
	message.AddBool("autoMountAllBFS", (bool)fAutoMountAllBFSCheck->Value());
	if (fAutoMountAllBFSCheck->Value())
		message.AddBool("autoMountAllHFS", false);

	message.AddBool("suspended", (bool)fScanningDisabledCheck->Value());
	message.AddBool("rescanNow", rescan);

	message.AddBool("initialMountAll", (bool)fInitialMountAllCheck->Value());
	message.AddBool("initialMountAllBFS",
		(bool)fInitialMountAllBFSCheck->Value());
	message.AddBool("initialMountRestore",
		(bool)fInitialMountRestoreCheck->Value());
	if (fInitialDontMountCheck->Value())
		message.AddBool("initialMountAllHFS", false);

	message.AddBool("ejectWhenUnmounting",
		(bool)fEjectWhenUnmountingCheckBox->Value());

	fTarget.SendMessage(&message);
}
Пример #10
0
static void
listener_output(syslog_message &message)
{
	// compose the message to be sent to all listeners; just convert
	// the syslog_message into a BMessage
	BMessage output(SYSLOG_MESSAGE);

	output.AddInt32("from", message.from);
	output.AddInt32("when", message.when);
	output.AddString("ident", message.ident);
	output.AddString("message", message.message);
	output.AddInt32("options", message.options);
	output.AddInt32("priority", message.priority);

	sLocker.Lock();

	for (int32 i = sListeners.CountItems(); i-- > 0;) {
		BMessenger *target = (BMessenger *)sListeners.ItemAt(i);

		status_t status = target->SendMessage(&output);
		if (status < B_OK) {
			// remove targets once they can't be reached anymore
			sListeners.RemoveItem(target);
		}
	}

	sLocker.Unlock();
}
Пример #11
0
void DCCConnect::UpdateStatus(const BMessenger& msgr, const char* text)
{
	BMessage msg(M_DCC_UPDATE_STATUS);

	msg.AddString("text", text);
	msgr.SendMessage(&msg);
}
Пример #12
0
	virtual void MessageReceived(BMessage *_message)
	{
		BMessage message(MSG_MESSAGE_RECEIVED);
		message.AddMessage("message", _message);
		message.AddInt32("sender", _message->ReturnAddress().Team());
		unitTesterMessenger.SendMessage(&message);
	}
Пример #13
0
// sends M_OBSERVER_REMOVED to the newly-removed observer
void ObservableLooper::observerRemoved(
    const BMessenger&				observer) {

    BMessage m(M_OBSERVER_REMOVED);
    m.AddMessenger("target", BMessenger(this));
    observer.SendMessage(&m);
}
Пример #14
0
status_t
AddOnManager::_GetReplicantView(BMessenger target, int32 uid,
	BMessage* reply) const
{
	// We send a message to the target shelf, asking it for the Name of the
	// replicant with the given unique id.

	BMessage request(B_GET_PROPERTY);
	BMessage uid_specifier(B_ID_SPECIFIER);
		// specifying via ID
	status_t err;
	status_t e;

	request.AddSpecifier("View");
		// ask for the Name of the replicant

	// IDs are specified using code like the following 3 lines:
	uid_specifier.AddInt32("id", uid);
	uid_specifier.AddString("property", "Replicant");
	request.AddSpecifier(&uid_specifier);

	if ((err = target.SendMessage(&request, reply)) != B_OK)
		return err;

	if (((err = reply->FindInt32("error", &e)) != B_OK) || (e != B_OK))
		return err ? err : e;

	return B_OK;
}
Пример #15
0
pointer seld_notes() {
  amc_found=tst_alive_amc();
  if (!amc_found && !find_amc()) 
    return Error_0("STOP! amc not running");
  BMessage mes(STORE_SEL),
           reply;
  StoredNote *notes;
  Settings *settings;
  ssize_t bytes=0;
  int n,
      items=0;
  amc_application.SendMessage(&mes,&reply);
  puts("amc did reply");
  switch (reply.what) {
    case CONTENTS_SEL:
      reply.FindData(SELD_NOTES,B_OBJECT_TYPE,(const void**)(&notes),&bytes);
      items=bytes/sizeof(StoredNote);
      reply.FindData(SETTINGS,B_OBJECT_TYPE,(const void**)(&settings),&bytes);
      break;
    default: return Error_0("seld notes: unknown reply");
  } 
  pointer ptr,
          out=nil_pointer();
  for (n=0;n<items;++n) {
    ptr=cons(mk_integer(notes[n].lnr),
         cons(mk_integer(notes[n].snr),
          cons(mk_integer(notes[n].sign),
           cons(mk_integer(notes[n].dur),nil_pointer()))));
    out=cons(ptr,out);
  }
  ptr=cons(mk_integer(settings->meter),nil_pointer());
  ptr=cons(mk_symbol("meter"),ptr);
  ptr=cons(ptr,nil_pointer());
  return cons(ptr,out);
}
Пример #16
0
void
LaunchDaemon::_StopJob(Job* job, bool force)
{
	// TODO: find out which jobs require this job, and don't stop if any,
	// unless force, and then stop them all.
	job->SetEnabled(false);

	if (!job->IsRunning())
		return;

	// Be nice first, and send a simple quit message
	BMessenger messenger;
	if (job->GetMessenger(messenger) == B_OK) {
		BMessage request(B_QUIT_REQUESTED);
		messenger.SendMessage(&request);

		// TODO: wait a bit before going further
		return;
	}
	// TODO: allow custom shutdown

	send_signal(-job->Team(), SIGINT);
	// TODO: this would be the next step, again, after a delay
	//send_signal(job->Team(), SIGKILL);
}
Пример #17
0
void
NotificationManager::RequestNotifications(BMessage *msg)
{
	BMessenger messenger;
	const media_node *node;
	ssize_t nodeSize;
	team_id team;
	int32 what;

	msg->FindMessenger(NOTIFICATION_PARAM_MESSENGER, &messenger);
	msg->FindInt32(NOTIFICATION_PARAM_TEAM, &team);
	msg->FindInt32(NOTIFICATION_PARAM_WHAT, &what);
	msg->FindData("node", B_RAW_TYPE, reinterpret_cast<const void **>(&node),
		&nodeSize);
	ASSERT(nodeSize == sizeof(media_node));

	Notification n;
	n.messenger = messenger;
	n.node = *node;
	n.what = what;
	n.team = team;

	TRACE("NotificationManager::RequestNotifications node %ld, team %ld, "
		"what %#lx\n",node->node, team, what);

	fLocker.Lock();
	fNotificationList.Insert(n);
	fLocker.Unlock();

	// send the initial B_MEDIA_NODE_CREATED containing all existing live nodes
	BMessage initmsg(B_MEDIA_NODE_CREATED);
	if (gNodeManager->GetLiveNodes(&initmsg) == B_OK)
		messenger.SendMessage(&initmsg, static_cast<BHandler *>(NULL), TIMEOUT);
}
Пример #18
0
void
PromptWindow::MessageReceived (BMessage *msg)
{
	switch (msg->what)
	{
		case M_PROMPT_DONE:

			if (field->TextView()->TextLength() || blanks)
			{
				if (!validate
				||   validate->Validate (field->TextView()->Text()))
				{
					BMessenger msgr (handler);

					invoked->AddString ("text", field->TextView()->Text());
					msgr.SendMessage (invoked);
				}
				else break;
			}

		case M_PROMPT_CANCEL:

			PostMessage (B_QUIT_REQUESTED);
			break;

		default:
			BWindow::MessageReceived (msg);
	}
}
Пример #19
0
void
TBarApp::RemoveTeam(team_id team)
{
	BAutolock autolock(sSubscriberLock);
	if (!autolock.IsLocked())
		return;

	int32 teamCount = sBarTeamInfoList.CountItems();
	for (int32 i = 0; i < teamCount; i++) {
		BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i);
		if (barInfo->teams->HasItem((void*)(addr_t)team)) {
			int32 subsCount = sSubscribers.CountItems();
			if (subsCount > 0) {
				BMessage message((barInfo->teams->CountItems() == 1)
					? B_SOME_APP_QUIT : kRemoveTeam);

				message.AddInt32("team", team);
				for (int32 i = 0; i < subsCount; i++) {
					BMessenger* messenger = (BMessenger*)sSubscribers.ItemAt(i);
					messenger->SendMessage(&message);
				}
			}

			barInfo->teams->RemoveItem((void*)(addr_t)team);
			if (barInfo->teams->CountItems() < 1) {
				delete (BarTeamInfo*)sBarTeamInfoList.RemoveItem(i);
				return;
			}
		}
	}
}
	virtual void ArgvReceived(int32 argc, char **argv)
	{
		BMessage message(MSG_ARGV_RECEIVED);
		message.AddInt32("argc", argc);
		for (int32 i = 0; i < argc; i++)
			message.AddString("argv", argv[i]);
		unitTesterMessenger.SendMessage(&message);
	}
Пример #21
0
void PrefWindow::signal_app()
{
  //signal pref save to app if running...
  BMessenger *msgr = new BMessenger("application/x-vnd.StrokeIt.ME");
  if (msgr->IsValid())
    msgr->SendMessage( new BMessage('srlD') ); 
  delete msgr;
}
Пример #22
0
void
AGMSBayesianSpamFilterConfig::ShowSpamServerConfigurationWindow () {
	status_t    errorCode = B_OK;
	BMessage    maximizeCommand;
	BMessenger	messengerToServer;
	BMessage    replyMessage;

	// Make sure the server is running.
	if (!be_roster->IsRunning (kServerSignature)) {
			errorCode = be_roster->Launch (kServerSignature);
			if (errorCode != B_OK) {
				BPath path;
				entry_ref ref;
				directory_which places[] = {
					B_SYSTEM_NONPACKAGED_BIN_DIRECTORY,
					B_SYSTEM_BIN_DIRECTORY
				};
				for (int32 i = 0; i < 2; i++) {
					find_directory(places[i],&path);
					path.Append("spamdbm");
					if (!BEntry(path.Path()).Exists())
						continue;
					get_ref_for_path(path.Path(),&ref);
					if ((errorCode =  be_roster->Launch (&ref)) == B_OK)
						break;
				}
				if (errorCode != B_OK)
					goto ErrorExit;
			}
		}
	
	// Set up the messenger to the database server.
	messengerToServer =
		BMessenger (kServerSignature);
	if (!messengerToServer.IsValid ())
		goto ErrorExit;

	// Wait for the server to finish starting up, and for it to create the window.
	snooze (2000000);

	// Tell it to show its main window, in case it is hidden in server mode.
	maximizeCommand.what = B_SET_PROPERTY;
	maximizeCommand.AddBool ("data", false);
	maximizeCommand.AddSpecifier ("Minimize");
	maximizeCommand.AddSpecifier ("Window", (int32)0);
	errorCode = messengerToServer.SendMessage (&maximizeCommand, &replyMessage);
	if (errorCode != B_OK)
		goto ErrorExit;
	return; // Successful.

ErrorExit:
	BAlert* alert = new BAlert ("SpamFilterConfig Error", B_TRANSLATE("Sorry, "
		"unable to launch the spamdbm program to let you edit the server "
		"settings."), B_TRANSLATE("Close"));
	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	alert->Go ();
	return;
}
Пример #23
0
status_t
BHandler::StopWatching(BMessenger target, uint32 what)
{
	BMessage message(kMsgStopObserving);
	message.AddMessenger(kObserveTarget, this);
	message.AddInt32(B_OBSERVE_WHAT_CHANGE, what);

	return target.SendMessage(&message);
}
Пример #24
0
void
InboundProtocolThread::MessageReceived(BMessage* message)
{
    switch (message->what) {
    case kMsgSyncMessages:
    {
        status_t status = fProtocol->SyncMessages();
        _NotiyMailboxSynced(status);
        break;
    }

    case kMsgFetchBody:
    {
        entry_ref ref;
        message->FindRef("ref", &ref);
        status_t status = fProtocol->FetchBody(ref);

        BMessenger target;
        if (message->FindMessenger("target", &target) != B_OK)
            break;

        BMessage message(kMsgBodyFetched);
        message.AddInt32("status", status);
        message.AddRef("ref", &ref);
        target.SendMessage(&message);
        break;
    }

    case kMsgMarkMessageAsRead:
    {
        entry_ref ref;
        message->FindRef("ref", &ref);
        read_flags read = (read_flags)message->FindInt32("read");
        fProtocol->MarkMessageAsRead(ref, read);
        break;
    }

    case kMsgDeleteMessage:
    {
        entry_ref ref;
        message->FindRef("ref", &ref);
        fProtocol->DeleteMessage(ref);
        break;
    }

    case kMsgAppendMessage:
    {
        entry_ref ref;
        message->FindRef("ref", &ref);
        fProtocol->AppendMessage(ref);
        break;
    }

    default:
        MailProtocolThread::MessageReceived(message);
    }
}
Пример #25
0
void
BInboundMailProtocol::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kMsgSyncMessages:
		{
			NotiyMailboxSynchronized(SyncMessages());
			break;
		}

		case kMsgFetchBody:
		{
			entry_ref ref;
			message->FindRef("ref", &ref);
			status_t status = FetchBody(ref);

			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				break;

			BMessage message(B_MAIL_BODY_FETCHED);
			message.AddInt32("status", status);
			message.AddRef("ref", &ref);
			target.SendMessage(&message);
			break;
		}

		case kMsgMarkMessageAsRead:
		{
			entry_ref ref;
			message->FindRef("ref", &ref);
			read_flags read = (read_flags)message->FindInt32("read");
			MarkMessageAsRead(ref, read);
			break;
		}

		case kMsgDeleteMessage:
		{
			entry_ref ref;
			message->FindRef("ref", &ref);
			DeleteMessage(ref);
			break;
		}

		case kMsgAppendMessage:
		{
			entry_ref ref;
			message->FindRef("ref", &ref);
			AppendMessage(ref);
			break;
		}

		default:
			BMailProtocol::MessageReceived(message);
			break;
	}
}
Пример #26
0
void
ClientWindowDock::AllAttached (void)
{
	if (vision_app->GetBool ("notifyExpanded"))
	{
		BMessenger dockMsgr (this);
		dockMsgr.SendMessage(M_NOTIFYLIST_RESIZE);
	}
}
Пример #27
0
//--------------------------------------------------------------------
void PrefWindow::SetAndWriteAttributes()
{
	// Send message to main window
	BMessenger *msng = new BMessenger(mainWin);
	msng->SendMessage(new BMessage(MSG_CFG_MODIFIED));
	delete msng;

	((InterApp*)be_app)->prefs->Write();
}
Пример #28
0
void
SudokuGenerator::_Progress(BMessenger progress, const char* text,
                           float percent)
{
    BMessage update(kMsgProgressStatusUpdate);
    if (text)
        update.AddString("message", text);
    update.AddFloat("percent", percent);
    progress.SendMessage(&update);
}
Пример #29
0
void
BPrintJob::CommitJob()
{
	if (fSpoolFile == NULL)
		return;

	if (fSpoolFileHeader.page_count == 0) {
		ShowError("No Pages to print!");
		CancelJob();
		return;
	}

	// update spool file
	_EndLastPage();

	// write spool file header
	fSpoolFile->Seek(0, SEEK_SET);
	fSpoolFile->Write(&fSpoolFileHeader, sizeof(print_file_header));

	// set file attributes
	app_info appInfo;
	be_app->GetAppInfo(&appInfo);
	const char* printerName = "";
	fSetupMessage->FindString(PSRV_FIELD_CURRENT_PRINTER, &printerName);

	BNodeInfo info(fSpoolFile);
	info.SetType(PSRV_SPOOL_FILETYPE);

	fSpoolFile->WriteAttr(PSRV_SPOOL_ATTR_PAGECOUNT, B_INT32_TYPE, 0,
		&fSpoolFileHeader.page_count, sizeof(int32));
	fSpoolFile->WriteAttr(PSRV_SPOOL_ATTR_DESCRIPTION, B_STRING_TYPE, 0,
		fPrintJobName, strlen(fPrintJobName) + 1);
	fSpoolFile->WriteAttr(PSRV_SPOOL_ATTR_PRINTER, B_STRING_TYPE, 0,
		printerName, strlen(printerName) + 1);
	fSpoolFile->WriteAttr(PSRV_SPOOL_ATTR_STATUS, B_STRING_TYPE, 0,
		PSRV_JOB_STATUS_WAITING, strlen(PSRV_JOB_STATUS_WAITING) + 1);
	fSpoolFile->WriteAttr(PSRV_SPOOL_ATTR_MIMETYPE, B_STRING_TYPE, 0,
		appInfo.signature, strlen(appInfo.signature) + 1);

	delete fSpoolFile;
	fSpoolFile = NULL;
	fError = B_ERROR;

	// notify print server
	BMessenger printServer;
	if (PrintServerMessenger::GetPrintServerMessenger(printServer) != B_OK)
		return;

	BMessage request(PSRV_PRINT_SPOOLED_JOB);
	request.AddString("JobName", fPrintJobName);
	request.AddString("Spool File", fSpoolFileName);

	BMessage reply;
	printServer.SendMessage(&request, &reply);
}
Пример #30
0
//! BMessage based data exchange with the media_server
status_t
SendToServer(BMessage* msg)
{
	status_t status = sMediaServerMessenger.SendMessage(msg,
		static_cast<BHandler*>(NULL), TIMEOUT);
	if (status != B_OK) {
		ERROR("SendToServer: SendMessage failed: %s\n", strerror(status));
		DEBUG_ONLY(msg->PrintToStream());
	}
	return status;
}