Esempio n. 1
0
int GoogleAppsMailbox::loginRequest()
{
    //const QRegExp moorhuntHashRegex("(<<a[a-h].*>>)");


    page = doGet("https://www.google.com/a/"+getMailbox());
    int pos = 0;
    QRegExp re3("GALX\\\".*value=\\\"(.*)\\\"./>");
    re3.setMinimal(true);
    if (re3.indexIn(page, pos) == -1)
        return 1;

    //LOG(Log::Info, page);
    const QString vars = QString("ltmpl=default&ltmplcache=2&continue=")
                + escape("https://mail.google.com/a/"+getMailbox()+"/")
                +"&service=mail&GALX="
                + escape(re3.cap(1))
                +"&rm=false&hl=pl&Email="+escape(getUser())
                +"&Passwd="+escape(getPassword())
                +"&rmShown=1";
    page = doPost("https://www.google.com/a/"+getMailbox()+"/LoginAction2?service=mail",vars, true);

    QString username = getUser();

    QRegExp re(username);
    QRegExp re2("&amp;");
    QRegExp authre("auth=([\\w\\d-]+)"); // To Do

    if (re.indexIn(page, pos) != -1)
    {
        QString url = re.cap(1);

        LOG(Log::Info, page + " <f");
        if(url.indexOf("answer=40695") != -1)
        {
            LOG(Log::Info, "Niestety, konto zostało wyłączone. - " + getMailbox());
            return 1;
        }
        url.replace(re2, "&");
        url = unescape(url);
        if (authre.indexIn(page, pos) != -1)
            auth = authre.cap(1);
            LOG(Log::Info, auth + " <s");
        return 0;
    }
    else
        return 1;
}
Esempio n. 2
0
bool SignalHandler::waitingForCallback() {
    // Processing... well, if we're waiting on a callback, then we're not processing. 
    // Previously we set wait_flag inside the call to waitForEvent, but that was called
    // after this was checked. Whoopsie.

    return (wait_cb != NULL);
#if 0

    CallbackBase *cb = getMailbox()->runningInsideCallback();

    signal_printf("%s[%d]: running inside callback: %p... \n",
                  FILE__, __LINE__, cb);
    if (cb == NULL) return false;

    if (wait_cb == cb) {
        signal_printf("%s[%d]: signal handler %s waiting on callback\n",
                      FILE__, __LINE__, getThreadStr(getThreadID()));
        return true;
    }
    else {
        signal_printf("%s[%d]: running inside callback %p different from stored %p, odd case\n",
                      FILE__, __LINE__, cb, wait_cb);
    }

    return false;
#endif
}
Esempio n. 3
0
void Tile::postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t link /*= LINK_OWNER*/)
{
	SpectatorVec list;
	g_game.map.getSpectators(list, getPosition(), true, true);
	for (Creature* spectator : list) {
		spectator->getPlayer()->postAddNotification(thing, oldParent, index, LINK_NEAR);
	}

	//add a reference to this item, it may be deleted after being added (mailbox for example)
	Creature* creature = thing->getCreature();
	Item* item;
	if (creature) {
		creature->incrementReferenceCounter();
		item = nullptr;
	} else {
		item = thing->getItem();
		if (item) {
			item->incrementReferenceCounter();
		}
	}

	if (link == LINK_OWNER) {
		if (hasFlag(TILESTATE_TELEPORT)) {
			Teleport* teleport = getTeleportItem();
			if (teleport) {
				teleport->addThing(thing);
			}
		} else if (hasFlag(TILESTATE_TRASHHOLDER)) {
			TrashHolder* trashholder = getTrashHolder();
			if (trashholder) {
				trashholder->addThing(thing);
			}
		} else if (hasFlag(TILESTATE_MAILBOX)) {
			Mailbox* mailbox = getMailbox();
			if (mailbox) {
				mailbox->addThing(thing);
			}
		}

		//calling movement scripts
		Creature* creature = thing->getCreature();
		if (creature) {
			g_moveEvents->onCreatureMove(creature, this, oldParent ? oldParent->getPosition() : getPosition(), MOVE_EVENT_STEP_IN);
		} else if (item) {
			g_moveEvents->onItemMove(item, this, true);
		}
	}

	//release the reference to this item onces we are finished
	if (creature) {
		g_game.ReleaseCreature(creature);
	} else if (item) {
		g_game.ReleaseItem(item);
	}
}
Esempio n. 4
0
bool UPTCreateCallback::operator()(pid_t pid)
{
  lock->_Lock(FILE__, __LINE__);
  pid_ = pid;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 5
0
bool DestroyUnwindAddressSpaceCallback::operator()(unw_addr_space *as)
{
  lock->_Lock(FILE__, __LINE__);
  as_ = as;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 6
0
bool IsSignalFrameCallback::operator()(unw_cursor_t *cp)
{
  lock->_Lock(FILE__, __LINE__);
  cp_ = cp;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 7
0
bool UPTDestroyCallback::operator()(void *handle)
{
  lock->_Lock(FILE__, __LINE__);
  handle_ = handle;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 8
0
void Tile::postAddNotification(Creature* actor, Thing* thing, const Cylinder* oldParent,
	int32_t index, CylinderLink_t link/* = LINK_OWNER*/)
{
	const SpectatorVec& list = g_game.getSpectators(pos);
	SpectatorVec::const_iterator it;

	Player* tmpPlayer = NULL;
	for(it = list.begin(); it != list.end(); ++it)
	{
		if((tmpPlayer = (*it)->getPlayer()))
			tmpPlayer->postAddNotification(actor, thing, oldParent, index, LINK_NEAR);
	}

	//add a reference to this item, it may be deleted after being added (mailbox for example)
	thing->addRef();
	if(link == LINK_OWNER)
	{
		//calling movement scripts
		if(Creature* creature = thing->getCreature())
		{
			const Tile* fromTile = NULL;
			if(oldParent)
				fromTile = oldParent->getTile();

			g_moveEvents->onCreatureMove(actor, creature, fromTile, this, true);
		}
		else if(Item* item = thing->getItem())
		{
			g_moveEvents->onAddTileItem(this, item);
			g_moveEvents->onItemMove(actor, item, this, true);
		}

		if(hasFlag(TILESTATE_TELEPORT))
		{
			if(Teleport* teleport = getTeleportItem())
				teleport->__addThing(actor, thing);
		}
		else if(hasFlag(TILESTATE_TRASHHOLDER))
		{
			if(TrashHolder* trashHolder = getTrashHolder())
				trashHolder->__addThing(actor, thing);
		}
		else if(hasFlag(TILESTATE_MAILBOX))
		{
			if(Mailbox* mailbox = getMailbox())
				mailbox->__addThing(actor, thing);
		}
	}

	//release the reference to this item onces we are finished
	g_game.freeThing(thing);
}
Esempio n. 9
0
void Tile::postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t link /*= LINK_OWNER*/)
{
	const Position& cylinderMapPos = getPosition();

	SpectatorVec list;
	g_game.getSpectators(list, cylinderMapPos, true, true);

	for (SpectatorVec::const_iterator it = list.begin(), end = list.end(); it != end; ++it) {
		(*it)->getPlayer()->postAddNotification(thing, oldParent, index, LINK_NEAR);
	}

	//add a reference to this item, it may be deleted after being added (mailbox for example)
	thing->useThing2();

	if (link == LINK_OWNER) {
		//calling movement scripts
		Creature* creature = thing->getCreature();

		if (creature) {
			g_moveEvents->onCreatureMove(creature, this, true);
		} else {
			Item* item = thing->getItem();
			if (item) {
				g_moveEvents->onItemMove(item, this, true);
			}
		}

		if (hasFlag(TILESTATE_TELEPORT)) {
			Teleport* teleport = getTeleportItem();

			if (teleport) {
				teleport->__addThing(thing);
			}
		} else if (hasFlag(TILESTATE_TRASHHOLDER)) {
			TrashHolder* trashholder = getTrashHolder();

			if (trashholder) {
				trashholder->__addThing(thing);
			}
		} else if (hasFlag(TILESTATE_MAILBOX)) {
			Mailbox* mailbox = getMailbox();

			if (mailbox) {
				mailbox->__addThing(thing);
			}
		}
	}

	//release the reference to this item onces we are finished
	g_game.FreeThing(thing);
}
Esempio n. 10
0
bool CreateUnwindAddressSpaceCallback::operator()(unw_accessors_t *ap, 
                                                  int byteorder) 
{
  lock->_Lock(FILE__, __LINE__);
  ap_ = ap;
  byteorder_ = byteorder;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 11
0
bool WaitpidCallback::operator()(pid_t pid, int *status, int options)
{
  lock->_Lock(FILE__, __LINE__);
  pid_ = pid;
  status_ = status;
  options_ = options;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 12
0
bool InitFrameCallback::operator()(unw_cursor_t *cp, unw_addr_space_t as, void *arg)
{
  lock->_Lock(FILE__, __LINE__);
  cp_ = cp;
  as_ = as;
  arg_ = arg;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 13
0
bool SetFrameRegisterCallback::operator()(unw_cursor_t *cp, 
                                          unw_regnum_t reg, 
                                          unw_word_t val)
{
  lock->_Lock(FILE__, __LINE__);
  cp_ = cp;
  reg_ = reg;
  val_ = val;
  getMailbox()->executeOrRegisterCallback(this);
  if (synchronous) {
    dbi_printf("%s[%d]:  waiting for completion of callback\n", FILE__, __LINE__);
    waitForCompletion();
  }
  lock->_Unlock(FILE__, __LINE__);
  return true;
}
Esempio n. 14
0
EventRecord &EventGate::wait(bool executeCallbacks /* = true */)
{
  trigger.type = evtUndefined;
  assert(lock->depth());
 
  still_waiting:
  waiting = true;
  if (executeCallbacks) 
    getMailbox()->executeCallbacks(FILE__, __LINE__);

  if (trigger.type != evtUndefined) {
    return trigger;
  }
  extern int dyn_debug_signal;
  if (dyn_debug_signal) {
    signal_printf("%s[%d][%s]: waiting for event matching:\n", FILE__, __LINE__,
            getThreadStr(getExecThreadID()));
    for (unsigned int i = 0; i < evts.size(); ++i) {
      char buf[1024];
      signal_printf("\t%s\n", evts[i].sprint_event(buf));
    }
  }

  lock->_WaitForSignal(FILE__, __LINE__);
  waiting = false;
  

  bool triggered = false;
  for (unsigned int i = 0; i < evts.size(); ++i) {
    if (evts[i].isTemplateOf(trigger)) {
      triggered = true;
      break;
    }
  }
  if (!triggered) goto still_waiting;

  return trigger;
}