void messageCountEvent::dispatch(messageCountListener* listener) { if (m_type == TYPE_ADDED) listener->messagesAdded(thisRef().dynamicCast <messageCountEvent>()); else listener->messagesRemoved(thisRef().dynamicCast <messageCountEvent>()); }
void folderEvent::dispatch(folderListener* listener) { switch (m_type) { case TYPE_CREATED: listener->folderCreated(thisRef().dynamicCast <folderEvent>()); break; case TYPE_RENAMED: listener->folderRenamed(thisRef().dynamicCast <folderEvent>()); break; case TYPE_DELETED: listener->folderDeleted(thisRef().dynamicCast <folderEvent>()); break; } }
bodyPart::bodyPart() : m_header(vmime::create <header>()), m_body(vmime::create <body>()), m_parent(NULL) { m_body->setParentPart(thisRef().dynamicCast <bodyPart>()); }
bodyPart::bodyPart(weak_ref <vmime::bodyPart> parentPart) : m_header(vmime::create <header>()), m_body(vmime::create <body>()), m_parent(parentPart) { m_body->setParentPart(thisRef().dynamicCast <bodyPart>()); }
bool SASLSession::evaluateChallenge (const byte_t* challenge, const long challengeLen, byte_t** response, long* responseLen) { return m_mech->step(thisRef().dynamicCast <SASLSession>(), challenge, challengeLen, response, responseLen); }
le_bool ClassDefinitionTable::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const { LEReferenceTo<ClassDefinitionTable> thisRef(base, success); if (LE_FAILURE(success)) return 0; switch(SWAPW(classFormat)) { case 0: return 0; case 1: { const LEReferenceTo<ClassDefFormat1Table> f1Table(thisRef, success); return f1Table->hasGlyphClass(f1Table, glyphClass, success); } case 2: { const LEReferenceTo<ClassDefFormat2Table> f2Table(thisRef, success); return f2Table->hasGlyphClass(f2Table, glyphClass, success); } default: return 0; } }
U_NAMESPACE_BEGIN le_int32 ClassDefinitionTable::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const { LEReferenceTo<ClassDefinitionTable> thisRef(base, success); if (LE_FAILURE(success)) return 0; switch(SWAPW(classFormat)) { case 0: return 0; case 1: { const LEReferenceTo<ClassDefFormat1Table> f1Table(thisRef, success); return f1Table->getGlyphClass(f1Table, glyphID, success); } case 2: { const LEReferenceTo<ClassDefFormat2Table> f2Table(thisRef, success); return f2Table->getGlyphClass(f2Table, glyphID, success); } default: return 0; } }
void maildirStore::connect() { if (isConnected()) throw exceptions::already_connected(); // Get root directory ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); m_fsPath = fsf->stringToPath(GET_PROPERTY(string, PROPERTY_SERVER_ROOTPATH)); ref <utility::file> rootDir = fsf->create(m_fsPath); // Try to create the root directory if it does not exist if (!(rootDir->exists() && rootDir->isDirectory())) { try { rootDir->createDirectory(); } catch (exceptions::filesystem_exception& e) { throw exceptions::connection_error("Cannot create root directory.", e); } } m_format = maildirFormat::detect(thisRef().dynamicCast <maildirStore>()); m_connected = true; }
ref <folder> IMAPStore::getFolder(const folder::path& path) { if (!isConnected()) throw exceptions::illegal_state("Not connected"); return vmime::create <IMAPFolder>(path, thisRef().dynamicCast <IMAPStore>()); }
ref <folder> IMAPStore::getDefaultFolder() { if (!isConnected()) throw exceptions::illegal_state("Not connected"); return vmime::create <IMAPFolder>(folder::path::component("INBOX"), thisRef().dynamicCast <IMAPStore>()); }
ref <folder> maildirStore::getRootFolder() { if (!isConnected()) throw exceptions::illegal_state("Not connected"); return vmime::create <maildirFolder>(folder::path(), thisRef().dynamicCast <maildirStore>()); }
/* *Interaction sur click de souris -> selection */ void KeyOrientation::onMouseButtonInteraction(ArRef<AbstractInteractor> /*source*/, int button, bool pressed) { if(button == 1 && pressed) { _c3dof->unselect(); _c3dof->select(thisRef()); } // Object3D::onMouseButtonInteraction(source, button, pressed); -> ne fait rien a priori }
void SASLSession::init() { ref <SASLAuthenticator> saslAuth = m_auth.dynamicCast <SASLAuthenticator>(); if (saslAuth) { saslAuth->setSASLMechanism(m_mech); saslAuth->setSASLSession(thisRef().dynamicCast <SASLSession>()); } }
ref <transport> session::getTransport (const utility::url& url, ref <security::authenticator> auth) { ref <session> sess = thisRef().dynamicCast <session>(); ref <service> sv = serviceFactory::getInstance()->create(sess, url, auth); if (sv->getType() != service::TYPE_TRANSPORT) throw exceptions::no_service_available(); return sv.staticCast <transport>(); }
void bodyPart::setBody(ref <body> b) { ref <bodyPart> oldPart = b->m_part.acquire(); m_body = b; m_body->setParentPart(thisRef().dynamicCast <bodyPart>()); // A body is associated to one and only one part if (oldPart != NULL) oldPart->setBody(vmime::create <body>()); }
void maildirMessagePart::initStructure(const bodyPart& part) { if (part.getBody()->getPartList().size() == 0) m_structure = NULL; else { m_structure = vmime::create <maildirMessageStructure> (thisRef().dynamicCast <maildirMessagePart>(), part.getBody()->getPartList()); } }
ref <store> session::getStore (const string& protocol, ref <security::authenticator> auth) { ref <session> sess = thisRef().dynamicCast <session>(); ref <service> sv = serviceFactory::getInstance()->create(sess, protocol, auth); if (sv->getType() != service::TYPE_STORE) throw exceptions::no_service_available(); return sv.staticCast <store>(); }
AxisButton::AxisButton(ArCW& arCW, ArRef<Texture> texture, bool textUp) : OSDSprite(arCW, texture), // _text(new_OSDText()) { _text(OSDText::NEW()) { setLocation(OSD::LOC_FREE); resizeWithRenderer(false); setRatio(1.0); addSetupCB(thisRef(), &AxisButton::_onSetupCB); setValue(0.0); _text->setDepth(1.0); _text->setLocation(OSD::LOC_FREE); _text->setFont("9x15bold"); _text->setMouseButtonInteraction(false); _text->setMotionInteraction(false); _text->attachTo(thisRef()); _textUp = textUp; }
ref <message> POP3Folder::getMessage(const int num) { ref <POP3Store> store = m_store.acquire(); if (!store) throw exceptions::illegal_state("Store disconnected"); else if (!isOpen()) throw exceptions::illegal_state("Folder not open"); else if (num < 1 || num > m_messageCount) throw exceptions::message_not_found(); return vmime::create <POP3Message>(thisRef().dynamicCast <POP3Folder>(), num); }
StringCell* StringCell::copy(World &world, SliceIndexType start, SliceIndexType end) { // Allocating a string below can actually change "this" // That is super annoying StringCell *oldThis = const_cast<StringCell*>(this); alloc::StringRef thisRef(world, oldThis); CharRange range = charRange(start, end); if (range.isNull()) { // Invalid range return nullptr; } if ((range.charCount == charLength()) && !dataIsInline()) { // We're copying the whole string // Share our byte array void *cellPlacement = alloc::allocateCells(world); HeapStringCell *heapThis = static_cast<HeapStringCell*>(thisRef.data()); return new (cellPlacement) HeapStringCell( heapThis->heapByteArray()->ref(), heapThis->byteLength(), heapThis->charLength() ); } const ByteLengthType newByteLength = range.byteCount(); // Create the new string auto newString = StringCell::createUninitialized(world, newByteLength, range.charCount); if (thisRef->dataIsInline() && (oldThis != thisRef.data())) { // The allocator ran and moved us along with our inline data // We have to update our range ptrdiff_t byteDelta = reinterpret_cast<std::uint8_t*>(thisRef.data()) - reinterpret_cast<std::uint8_t*>(oldThis); range.relocate(byteDelta); } std::uint8_t *newUtf8Data = newString->utf8Data(); memcpy(newUtf8Data, range.startPointer, newByteLength); return newString; }
void OSDSelector::_addRenderer(ArPtr<Renderer3D> renderer) { if(!_window && renderer->getClass()->isA(Window3D::CLASS())) { for(size_t i = _items.size(); i--;) { renderer->addOSD(_items[i]); } OSD::_addRenderer(renderer); _mustHide = false; _window = ar_down_cast<Window3D>(renderer); _window->addTimeOutCB(thisRef(), &OSDSelector::_timeOutCB); } }
OSDSelector::OSDSelector(ArCW& arCW) : OSD(arCW), _window(), _timeOut(0), _timeOutDelay(20), _selectedItem(0), _zoomedItem(0), _itemMaxWidth(32), _itemMaxHeight(32), _zoomFactor(1.33), _rotationDt(0.0), _mustHide(false), _selectCB(thisRef()) { setLocation(OSD::LOC_FREE); }
void OSDSelector::_reallyRemoveRenderer(void) { for(size_t i = _items.size(); i--;) { _window->removeOSD(_items[i]); } OSD::_removeRenderer(_window); _window->removeTimeOutCB(thisRef(), &OSDSelector::_timeOutCB); _window = Window3D::nullRef(); if(!_items.empty()) { _onSelectItem(_zoomedItem, _selectedItem); } }
void IMAPStore::connect() { if (isConnected()) throw exceptions::already_connected(); m_connection = vmime::create <IMAPConnection> (thisRef().dynamicCast <IMAPStore>(), getAuthenticator()); try { m_connection->connect(); } catch (std::exception&) { m_connection = NULL; throw; } }
//-------- Construction / Destruction ---------------------------------------- GtkAReViWidget::GtkAReViWidget(ArCW & arCW, const StlString &fileName, const StlString &mainWidget) // Protected : ArObject(arCW), _xmlObject(glade_xml_new(fileName.c_str(), mainWidget.c_str(), NULL)), _wndMain(NULL), _hideOnDestroy(false), _dockDst(), _dockDstWidget(""), _wndDockSrc(NULL), _docked(false) { if(_xmlObject) { _wndMain=GTK_WIDGET(glade_xml_get_widget(_xmlObject,mainWidget.c_str())); if (!_wndMain) setErrorMessage("Can't find main widget " + mainWidget); else g_signal_connect ((gpointer)_wndMain,"delete_event",G_CALLBACK(_onWidgetCloseCB),this); } else thisRef().destroy(); }
std::vector <ref <message> > POP3Folder::getMessages(const int from, const int to) { ref <POP3Store> store = m_store.acquire(); const int to2 = (to == -1 ? m_messageCount : to); if (!store) throw exceptions::illegal_state("Store disconnected"); else if (!isOpen()) throw exceptions::illegal_state("Folder not open"); else if (to2 < from || from < 1 || to2 < 1 || from > m_messageCount || to2 > m_messageCount) throw exceptions::message_not_found(); std::vector <ref <message> > v; ref <POP3Folder> thisFolder = thisRef().dynamicCast <POP3Folder>(); for (int i = from ; i <= to2 ; ++i) v.push_back(vmime::create <POP3Message>(thisFolder, i)); return (v); }
std::vector <ref <message> > POP3Folder::getMessages(const std::vector <int>& nums) { ref <POP3Store> store = m_store.acquire(); if (!store) throw exceptions::illegal_state("Store disconnected"); else if (!isOpen()) throw exceptions::illegal_state("Folder not open"); std::vector <ref <message> > v; ref <POP3Folder> thisFolder = thisRef().dynamicCast <POP3Folder>(); for (std::vector <int>::const_iterator it = nums.begin() ; it != nums.end() ; ++it) { if (*it < 1|| *it > m_messageCount) throw exceptions::message_not_found(); v.push_back(vmime::create <POP3Message>(thisFolder, *it)); } return (v); }
bool InternalNode::addChildNode(const NodeRef &node) { // Create a shared_ptr for passing it to contains() with a No-Op deleter so that "this" will not be deleted. NodeRef thisRef(this, [](void* ptr){}); if (node->contains(thisRef) || this == node.get()) { printf("This causes a circular reference.\n"); return false; } if (node->isInstanced()) { auto it = std::find(m_childNodes.begin(), m_childNodes.end(), node); if (it != m_childNodes.end()) { printf("Another instanced node already exists in this node.\n"); return false; } } else { if (contains(node)) { printf("This node already has the given node.\n"); return false; } } m_childNodes.push_back(node); return true; }
{ internalDisconnect(); throw e; } } #endif // VMIME_HAVE_SASL_SUPPORT // Secured authentication with APOP (if requested and if available) // // eg: C: APOP vincent <digest> // --- S: +OK vincent is a valid mailbox const string username = getAuthenticator()->getUsername(); const string password = getAuthenticator()->getPassword(); ref <POP3Connection> conn = thisRef().dynamicCast <POP3Connection>(); ref <POP3Response> response; if (GET_PROPERTY(bool, PROPERTY_OPTIONS_APOP)) { if (randomMID.getLeft().length() != 0 && randomMID.getRight().length() != 0) { // <digest> is the result of MD5 applied to "<message-id>password" ref <security::digest::messageDigest> md5 = security::digest::messageDigestFactory::getInstance()->create("md5"); md5->update(randomMID.generate() + password); md5->finalize(); POP3Command::APOP(username, md5->getHexDigest())->send(conn);
ref <net::socket> SASLSession::getSecuredSocket(ref <net::socket> sok) { return vmime::create <SASLSocket>(thisRef().dynamicCast <SASLSession>(), sok); }