void SoVRMLAudioClipP::loadUrl() { #ifdef HAVE_THREADS SbThreadAutoLock autoLock(&this->syncmutex); #endif this->unloadUrl(); for (int i=0; i<PUBLIC(this)->url.getNum(); i++) { const char * str = PUBLIC(this)->url[i].getString(); if ( (str == NULL) || (strlen(str)==0) ) continue; // ignore empty url SbString filename = SoInput::searchForFile(SbString(str), SoInput::getDirectories(), SoVRMLAudioClip::getSubdirectories()); if (filename.getLength() <= 0) { SoDebugError::postWarning("SoVRMLAudioClipP::loadUrl(index)", "File not found: '%s'", str); continue; // ignore invalid file } this->playlist.append(filename); } }
// This contains the real constructor code (the two constructors are // only entry points for this method). void SoWinExaminerViewerP::constructor(SbBool build) { this->genericConstructor(); PUBLIC(this)->setClassName("SoWinExaminerViewer"); PUBLIC(this)->setPopupMenuString("Examiner Viewer"); if (! build) return; HWND widget = PUBLIC(this)->buildWidget(PUBLIC(this)->getParentWidget()); PUBLIC(this)->setBaseWidget(widget); PUBLIC(this)->setLeftWheelString("RotX"); PUBLIC(this)->setBottomWheelString("RotY"); PUBLIC(this)->setCursorEnabled(TRUE); PUBLIC(this)->setAnimationEnabled(TRUE); PUBLIC(this)->setSize(SbVec2s(500, 421)); // FIXME: If the new size is the same as the old size, Windows will // never size the widget, and layoutWidgets() will never be // called. mariusbu 20010823. }
void SoXtGLWidgetP::buildGLWidget(void) { this->cleanupGLWidget(); this->glxwidget = XtVaCreateManagedWidget("SoXtGLWidget", soxtGLAreaWidgetClass, this->glxmanager, SoXtNvisualInfo, this->normalvisual, XmNcolormap, this->colormap, SoXtNstencilSize, 1, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); PUBLIC(this)->registerWidget(this->glxwidget); XtAddCallback(this->glxwidget, SoXtNexposeCallback, SoXtGLWidgetP::exposeCB, this); PUBLIC(this)->setBorder(PUBLIC(this)->isBorder()); // "refresh" the widget offsets // Our callback has this signature: // (void (*)(_WidgetRec *, SoXtGLWidget *, XAnyEvent *, char *)) // ..so we need to cast to avoid a compiler warning or error. XtAddEventHandler(this->glxwidget, ExposureMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask, False, (void (*)(_WidgetRec *, void *, _XEvent *, char *)) SoXtGLWidget::eventHandler, PUBLIC(this)); this->needrebuild = FALSE; }
void SoXtGLWidgetP::buildContext(void) { XVisualInfo * visual; Display * display = SoXt::getDisplay(); XtVaGetValues(this->glxwidget, SoXtNvisualInfo, &visual, NULL); int screen = DefaultScreen(display); SoXtGLWidget * share = (SoXtGLWidget *) SoAny::si()->getSharedGLContext((void *)display, (void *)screen); //this->normalcontext = // glXCreateContext(display, visual, // share ? PRIVATE(share)->normalcontext : None, // GL_TRUE); if (!this->normalcontext) { SoDebugError::postInfo("SoXtGLWidget::glInit", "CreateContext() returned NULL"); XtAppError(SoXt::getAppContext(), "no context"); } else { SoAny::si()->registerGLContext((void *)PUBLIC(this), (void *)display, (void *)screen); } PUBLIC(this)->initGraphic(); }
// Check whether or not everything is ok and valid for any action // traversal. SbBool SoOrthoSliceP::confirmValidInContext(SoState * state) const { // Fetching the current volumedata const CvrVoxelBlockElement * vbelem = CvrVoxelBlockElement::getInstance(state); assert(vbelem != NULL); const int axisidx = PUBLIC(this)->axis.getValue(); if (axisidx < SoOrthoSlice::X || axisidx > SoOrthoSlice::Z) { SoDebugError::post("SoOrthoSliceP::confirmValidInContext", "SoOrthoSlice::axis has invalid value; %d", axisidx); return FALSE; } const int slicenr = PUBLIC(this)->sliceNumber.getValue(); const short slices = vbelem->getVoxelCubeDimensions()[axisidx]; if (slicenr < 0 || slicenr >= slices) { // I don't think this can legally happen, so assert if no slices // are available. mortene. assert(slices > 0); SoDebugError::post("SoOrthoSliceP::confirmValidInContext", "SoOrthoSlice::sliceNumber value %d out of range " "[0, %d]", slicenr, slices - 1); return FALSE; } return TRUE; }
void SceneTexture2::render_cb(void * closure, SoSensor * sensor) { assert(closure); SceneTexture2 * me = (SceneTexture2 *) closure; SbVec2f tempsize = PUBLIC(me)->size.getValue(); SbVec2s size; size[0] = (short) tempsize[0]; size[1] = (short) tempsize[1]; int nc = 3; SoNode * scene = PUBLIC(me)->scene.getValue(); SbBool save = PUBLIC(me)->image.enableNotify(FALSE); if ( scene != NULL ) { if ( me->renderer == NULL ) { me->renderer = new SoOffscreenRenderer(SbViewportRegion(size)); me->renderer->setComponents(SoOffscreenRenderer::RGB); me->renderer->getGLRenderAction()->setTransparencyType(SoGLRenderAction::BLEND); me->prevsize = size; PUBLIC(me)->image.setValue(size, nc, NULL); } me->renderer->render(scene); unsigned char * renderbuffer = me->renderer->getBuffer(); unsigned char * imagebytes = PUBLIC(me)->image.startEditing(size, nc); memcpy(imagebytes, renderbuffer, size[0] * size[1] * nc); PUBLIC(me)->image.finishEditing(); } else { unsigned char * imagebytes = PUBLIC(me)->image.startEditing(size, nc); memset(imagebytes, 0, size[0] * size[1] * nc); PUBLIC(me)->image.finishEditing(); } PUBLIC(me)->image.enableNotify(save); if ( save ) PUBLIC(me)->image.touch(); }
void SoWinFullViewerP::examinebuttonProc(SoWinBitmapButton * b, void * userdata) { SoWinFullViewerP * that = (SoWinFullViewerP *)userdata; that->viewerButton(SoWinFullViewerP::VIEWERBUTTON_VIEW)->setPressedState(TRUE); that->viewerButton(SoWinFullViewerP::VIEWERBUTTON_PICK)->setPressedState(FALSE); if (!PUBLIC(that)->isViewing()) { PUBLIC(that)->setViewing(TRUE); } }
void SoWinFullViewerP::rightWheelCB(SoWinThumbWheel::Interaction type, float val, void * userdata) { SoWinFullViewerP * that = (SoWinFullViewerP *)userdata; if (type == SoWinThumbWheel::START) { PUBLIC(that)->rightWheelStart(); } else if (type == SoWinThumbWheel::END) { PUBLIC(that)->rightWheelFinish(); } else { PUBLIC(that)->rightWheelMotion(val); } }
// // called when startTime changes // void SoVRMLAudioClipP::startTimeSensorCB(SoSensor *) { SbTime now = SbTime::getTimeOfDay(); SbTime start = PUBLIC(this)->startTime.getValue(); if (now>=start) { if (!PUBLIC(this)->isActive.getValue()) this->startPlaying(); } }
// used to render shape and non-shape nodes (usually SoGroup or SoSeparator). void SoBoxHighlightRenderActionP::drawHighlightBox(const SoPath * path) { if (this->camerasearch == NULL) { this->camerasearch = new SoSearchAction; } // find camera used to render node this->camerasearch->setFind(SoSearchAction::TYPE); this->camerasearch->setInterest(SoSearchAction::FIRST); // find first camera to break out asap this->camerasearch->setType(SoCamera::getClassTypeId()); this->camerasearch->apply(const_cast<SoPath*>(path)); if (this->camerasearch->getPath()) { this->bboxseparator->insertChild(this->camerasearch->getPath()->getTail(), 0); } this->camerasearch->reset(); if (this->bboxaction == NULL) { this->bboxaction = new SoGetBoundingBoxAction(SbViewportRegion(100, 100)); } this->bboxaction->setViewportRegion(PUBLIC(this)->getViewportRegion()); this->bboxaction->apply(const_cast<SoPath*>(path)); SbXfBox3f & box = this->bboxaction->getXfBoundingBox(); if (!box.isEmpty()) { // set cube size float x, y, z; box.getSize(x, y, z); this->bboxcube->width = x; this->bboxcube->height = y; this->bboxcube->depth = z; SbMatrix transform = box.getTransform(); // get center (in the local bbox coordinate system) SbVec3f center = box.SbBox3f::getCenter(); // if center != (0,0,0), move the cube if (center != SbVec3f(0.0f, 0.0f, 0.0f)) { SbMatrix t; t.setTranslate(center); transform.multLeft(t); } this->bboxtransform->matrix = transform; PUBLIC(this)->SoGLRenderAction::apply(this->bboxseparator); } // remove camera this->bboxseparator->removeChild(0); }
// Return a flag indicating whether or not OpenGL rendering is // happening directly from the CPU(s) to the GPU(s), ie on a local // display. SbBool SoXtGLWidgetP::isDirectRendering(void) { PUBLIC(this)->glLockNormal(); GLXContext ctx = 0 ; // glXGetCurrentContext(); if (!ctx) { SoDebugError::postWarning("SoXtGLWidgetP::isDirectRendering", "Could not get hold of current context."); return TRUE; } Bool isdirect = true;// glXIsDirect(SoXt::getDisplay(), ctx); PUBLIC(this)->glUnlockNormal(); return isdirect ? TRUE : FALSE; }
// // called when stopTime changes // void SoVRMLAudioClipP::stopTimeSensorCB(SoSensor *) { SbTime now = SbTime::getTimeOfDay(); SbTime start = PUBLIC(this)->startTime.getValue(); SbTime stop = PUBLIC(this)->stopTime.getValue(); if ( (now>=stop) && (stop>start) ) { // we shouldn't be playing now if (PUBLIC(this)->isActive.getValue()) this->stopPlaying(); return; } }
void SoVRMLAudioClipP::stopPlaying() { #if COIN_DEBUG && DEBUG_AUDIO SoDebugError::postInfo("SoVRMLAudioClipP::stopPlaying", "stop"); #endif // debug PUBLIC(this)->isActive.setValue(FALSE); #ifdef HAVE_THREADS this->syncmutex.lock(); #endif /* FIXME: If the stream is closed here, and read() is called before the sound figures out it should also stop playing, read() might try to open the next file (or reopen the existing file if loop==TRUE) and we might get an "echo-effect". We should perhaps keep an internal isActive that is "allways" equal to the external isActive, allthough this should be synchronized, so read() can check it safely, and decide to not open a file if it is FALSE. Investigate this further. 2002-11-15 thammer. */ this->closeFile(); #ifdef HAVE_THREADS this->syncmutex.unlock(); #endif }
Cvr2DTexPage * SoOrthoSliceP::getPage(const SoGLRenderAction * action, const int axis, const int slice) { while (this->cachedpages[axis].getLength() <= slice) { this->cachedpages[axis].append(NULL); } SoState * state = action->getState(); const CvrVoxelBlockElement * vbelem = CvrVoxelBlockElement::getInstance(state); SoOrthoSliceP::CachedPage * cp = this->cachedpages[axis][slice]; // Check validity. // // FIXME: this would probably be better replaced by a "BrickCache" // dependency tracker. 20041112 mortene. if (cp && (cp->volumedataid != vbelem->getNodeId())) { delete cp; cp = NULL; } if (!cp) { const SbVec3s & pagesize = CvrPageSizeElement::get(state); // Pagesize according to axis: X => [Z, Y], Y => [X, Z], Z => [X, Y]. SbVec2s subpagesize = SbVec2s(pagesize[(axis == 0) ? 2 : 0], pagesize[(axis == 1) ? 2 : 1]); Cvr2DTexPage * page = new Cvr2DTexPage(action, axis, slice, subpagesize); this->cachedpages[axis][slice] = cp = new SoOrthoSliceP::CachedPage(page, PUBLIC(this)); cp->volumedataid = vbelem->getNodeId(); } return cp->getPage(); }
// // called when loop changes // void SoVRMLAudioClipP::loopSensorCB(SoSensor *) { #ifdef HAVE_THREADS SbThreadAutoLock autoLock(&this->syncmutex); #endif this->loop = PUBLIC(this)->loop.getValue(); }
void SceneTexture2::size_updated_cb(void * closure, SoSensor * sensor) { assert(closure); SceneTexture2 * me = (SceneTexture2 *) closure; SbVec2f tempsize = PUBLIC(me)->size.getValue(); SbVec2s size; size[0] = (short) tempsize[0]; size[1] = (short) tempsize[1]; if ( size != me->prevsize ) { if ( me->renderer != NULL ) { me->renderer->setViewportRegion(SbViewportRegion(size)); PUBLIC(me)->image.setValue(size, 3, NULL); me->render_sensor->schedule(); } me->prevsize = size; } }
void SoXtGLWidgetP::cleanupGLWidget(void) { if (this->glxwidget) { XtRemoveEventHandler(this->glxwidget, ExposureMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask, False, (void (*)(_WidgetRec *, void *, _XEvent *, char *)) SoXtGLWidget::eventHandler, PUBLIC(this)); XtRemoveCallback(this->glxwidget, SoXtNexposeCallback, SoXtGLWidgetP::exposeCB, this); PUBLIC(this)->unregisterWidget(this->glxwidget); this->glxwidget = NULL; } }
// // checks current time to see if we should start or stop playing // void SoVRMLAudioClipP::timerCB(SoSensor *) { SbTime now = SbTime::getTimeOfDay(); SbTime start = PUBLIC(this)->startTime.getValue(); SbTime stop = PUBLIC(this)->stopTime.getValue(); #if COIN_DEBUG && DEBUG_AUDIO SbString start_str = start.format("%D %h %m %s"); SbString stop_str = stop.format("%D %h %m %s"); SbString now_str = now.format("%D %h %m %s"); #endif // debug #if COIN_DEBUG && DEBUG_AUDIO SoDebugError::postInfo("SoVRMLAudioClipP::timerCB", "(timerCB)"); #endif // debug if (((now>=stop) && (stop>start)) || (! SoAudioDevice::instance()->haveSound()) || (! SoAudioDevice::instance()->isEnabled())) { // we shouldn't be playing now if (PUBLIC(this)->isActive.getValue()) this->stopPlaying(); return; } // if we got this far, ( (now<stop) || (stop<=start) ) if (this->soundHasFinishedPlaying) { if (PUBLIC(this)->isActive.getValue()) { // FIXME: perhaps add some additional slack, the size of one buffer? 20021008 thammer. #if COIN_DEBUG && DEBUG_AUDIO SoDebugError::postInfo("SoVRMLAudioClipP::timerCB", "soundHasFinishedPlaying"); #endif // debug this->stopPlaying(); } return; } if (now>=start) { if (!PUBLIC(this)->isActive.getValue()) this->startPlaying(); } }
void SoXtGLWidgetP::cleanupContext(void) { if (this->normalcontext) { Display * display = SoXt::getDisplay(); int screen = DefaultScreen(display); SoAny::si()->unregisterGLContext((void *)PUBLIC(this)); //glXDestroyContext(display, this->normalcontext); this->normalcontext = NULL; } }
HWND SoWinFullViewerP::buildRightWheel(HWND parent) { // Create coords are not needed - the widget is moved into place // by layoutWidgets this->rightthumbwheel = new SoWinThumbWheel(SoWinThumbWheel::Vertical, parent, 2, 0, 0, "Dolly"); PUBLIC(this)->setRightWheelString("Dolly"); PUBLIC(this)->rightWheelVal = this->rightthumbwheel->value(); this->rightthumbwheel->setCallback(this->rightWheelCB, this); this->rightthumbwheel->setRangeBoundaryHandling(SoWinThumbWheel::ACCUMULATE); this->rightthumbwheel->setLabelOffset(- (this->bottomthumbwheel->getLabelSize().cx - this->rightthumbwheel->sizeHint().cx), ((DECORATION_SIZE - this->leftthumbwheel->sizeHint().cx) / 2) + DECORATION_BUFFER + 1); return this->rightthumbwheel->getWidget(); }
void giveDiamondsTick(){ cell_t result; IPluginFunction* func= PUBLIC("EXTGetClientTeam"); for(cell_t i=0;i<MAXPLAYERS;i++){ if(ValidPlayer(i)){ func->CallFunction(&i,1,&result); if(result>1){ diamonds[i]++; } } } }
// Find the plane definition. SbPlane SoOrthoSliceP::getSliceAsPlane(SoAction * action) const { const CvrVoxelBlockElement * vbelem = CvrVoxelBlockElement::getInstance(action->getState()); const int axis = PUBLIC(this)->axis.getValue(); // Finding the plane normal is straight forward -- it's the same as // the SoOrthoSlice axis: SbVec3f planenormal(axis == SoOrthoSlice::X ? 1.0f : 0.0f, axis == SoOrthoSlice::Y ? 1.0f : 0.0f, axis == SoOrthoSlice::Z ? 1.0f : 0.0f); if (PUBLIC(this)->clippingSide.getValue() == SoOrthoSlice::FRONT) { planenormal.negate(); } // Finding a point in the plane: const SbBox3f & spacesize = vbelem->getUnitDimensionsBox(); SbVec3f spacemin, spacemax; spacesize.getBounds(spacemin, spacemax); SbVec3f origo = spacesize.getCenter(); const SbVec3s & dimensions = vbelem->getVoxelCubeDimensions(); const float depthprslice = (spacemax[axis] - spacemin[axis]) / dimensions[axis]; const float depth = spacemin[axis] + PUBLIC(this)->sliceNumber.getValue() * depthprslice; origo[axis] = depth; // Return local unit coordinate system plane: return SbPlane(planenormal, origo); }
SoCamera * SoSceneTextureCubeMapP::findCamera(void) { SoSearchAction sa; sa.setType(SoCamera::getClassTypeId()); sa.setInterest(SoSearchAction::FIRST); sa.apply(PUBLIC(this)->scene.getValue()); SoPath * path = sa.getPath(); if (path == NULL) return NULL; else return (SoCamera *)path->getTail(); }
void SoXtExaminerViewerP::constructor(const SbBool build) { this->genericConstructor(); PUBLIC(this)->setClassName(PUBLIC(this)->getWidgetName()); this->camerabutton = (Widget) NULL; if (build) { Widget viewer = PUBLIC(this)->buildWidget(PUBLIC(this)->getParentWidget()); PUBLIC(this)->setBaseWidget(viewer); PUBLIC(this)->fitSize(SbVec2s(500, 300)); char * dollyString = NULL; SoXtResource rsc(PUBLIC(this)->getRightWheelLabelWidget()); if (rsc.getResource("dollyString", XmRString, dollyString) && dollyString != NULL) PUBLIC(this)->setRightWheelString(dollyString); } }
void SoVRMLAudioClipP::startPlaying() { #if COIN_DEBUG && DEBUG_AUDIO SoDebugError::postInfo("SoVRMLAudioClipP::startPlaying", "start"); #endif // debug #ifdef HAVE_THREADS this->syncmutex.lock(); #endif this->currentPause = SoVRMLAudioClipP::staticdata->introPause; this->currentPlaylistIndex = 0; this->soundHasFinishedPlaying = FALSE; this->actualStartTime = 0.0f; // will be set in read() this->totalNumberOfFramesToPlay = 0; // will be increased in read() #ifdef HAVE_THREADS this->syncmutex.unlock(); #endif PUBLIC(this)->isActive.setValue(TRUE); }
HWND SoWinFullViewerP::buildBottomWheel(HWND parent) { // Create coords are not needed - the widget is moved into place // by layoutWidgets this->bottomthumbwheel = new SoWinThumbWheel(SoWinThumbWheel::Horizontal, parent, 1, 0, 0, "RotY"); PUBLIC(this)->bottomWheelVal = this->bottomthumbwheel->value(); this->bottomthumbwheel->setCallback(this->bottomWheelCB, this); this->bottomthumbwheel->setRangeBoundaryHandling(SoWinThumbWheel::ACCUMULATE); this->bottomthumbwheel->setLabelOffset(-4, 0); return this->bottomthumbwheel->getWidget(); }
void SoXtPlaneViewerP::constructor(SbBool build) { this->commonConstructor(); // generic code const int numbuttons = sizeof(SoXtPlaneViewerButtons) / sizeof(SoXtViewerButton); this->buttons = new SoXtViewerButton[numbuttons]; memcpy(this->buttons, SoXtPlaneViewerButtons, sizeof(SoXtPlaneViewerButtons)); PUBLIC(this)->setClassName(PUBLIC(this)->getDefaultWidgetName()); if (build) { Widget viewer = PUBLIC(this)->buildWidget(PUBLIC(this)->getParentWidget()); PUBLIC(this)->setBaseWidget(viewer); PUBLIC(this)->fitSize(SbVec2s(500, 300)); SoXtResource rsc(PUBLIC(this)->getRightWheelLabelWidget()); char * dollystring = NULL; rsc.getResource("dollyString", XmRString, dollystring); if (dollystring != NULL) PUBLIC(this)->setRightWheelString(dollystring); } }
void SoXtGLWidgetP::exposeCB(Widget widget, XtPointer closure, XtPointer call_data) { SoXtGLWidgetP * thisp = (SoXtGLWidgetP *) closure; assert(thisp); if (thisp->needrebuild) { thisp->cleanupContext(); thisp->cleanupGLWidget(); thisp->cleanupVisual(); thisp->createVisual(); thisp->buildGLWidget(); thisp->buildContext(); thisp->firstexpose = TRUE; } Dimension width = 0, height = 0; XtVaGetValues(widget, XtNwidth, &width, XtNheight, &height, NULL); thisp->glsize = SbVec2s(width, height); if (thisp->firstexpose) { PUBLIC(thisp)->sizeChanged(SbVec2s(width, height)); thisp->firstexpose = FALSE; } }
int main(int argc, char *argv[], char *envp[]) { //FIXME:user could choose only a website no all website.which means --host is available. static const struct option options[] = { {"debug", 0, NULL, 'd'}, {"verbose", 0, NULL, 'V'}, {"action", 1, NULL, 'A'}, {"logfile", 1, NULL, 'L'}, {"shrink-urls", 0, NULL, 's'}, {"help", 0, NULL, 'h'}, {"bash", 0, NULL, 'b'}, {"background", 0, NULL, 'B'}, {"dry-run", 0, NULL, 'n'}, {"page", 1, NULL, 'g'}, {"version", 0, NULL, 'v'}, {"config", 1, NULL, 'c'}, {"replyto", 1, NULL, 'r'}, {"retweet", 1, NULL, 'w'}, {} }; struct session *session; pid_t child; int retval = 0; int option; char *home; const char *config_file; time_t t; int page_nr; char *tweet; debug = 0; session = session_alloc(); if (!session) { fprintf(stderr, "no more memory...\n"); return -1; } /* get the current time so that we can log it later */ time(&t); session->time = strdup(ctime(&t)); session->time[strlen(session->time) - 1] = 0x00; /* * Get the home directory so we can try to find a config file. * If we have no home dir set up, look in /etc/bti */ home = getenv("HOME"); if (home) { /* We have a home dir, so this might be a user */ session->homedir = strdup(home); config_file = config_user_default; } else { session->homedir = strdup(""); config_file = config_default; } /* set up a default config file location (traditionally ~/.bti) */ session->configfile = zalloc(strlen(session->homedir) + strlen(config_file) + 7); sprintf(session->configfile, "%s/%s", session->homedir, config_file); session_readline_init(session); struct account *account = parse_configfile(session); if (account == NULL) { fprintf(stderr, "parse err, goto exit\n"); exit(-1); } while (1) { option = getopt_long_only(argc, argv, "dp:P:H:a:A:u:c:hg:G:sr:nVvw:", options, NULL); if (option == -1) break; switch (option) { case 'd': debug = 1; break; case 'V': session->verbose = 1; break; case 'g': page_nr = atoi(optarg); dbg("page = %d\n", page_nr); session->page = page_nr; break; case 'r': session->replyto = strdup(optarg); dbg("in_reply_to_status_id = %s\n", session->replyto); break; case 'A': if (strcasecmp(optarg, "update") == 0) session->action = ACTION_UPDATE; else if (strcasecmp(optarg, "friends") == 0) session->action = ACTION_FRIENDS; else if (strcasecmp(optarg, "user") == 0) session->action = ACTION_USER; else if (strcasecmp(optarg, "replies") == 0) session->action = ACTION_REPLIES; else if (strcasecmp(optarg, "public") == 0) session->action = ACTION_PUBLIC; else if (strcasecmp(optarg, "group") == 0) session->action = ACTION_GROUP; else if (strcasecmp(optarg, "retweet") == 0) session->action = ACTION_RETWEET; else session->action = ACTION_UNKNOWN; dbg("action = %d\n", session->action); break; case 'u': if (session->user) free(session->user); session->user = strdup(optarg); dbg("user = %s\n", session->user); break; case 'G': if (session->group) free(session->group); session->group = strdup(optarg); dbg("group = %s\n", session->group); break; case 'L': if (session->logfile) free(session->logfile); session->logfile = strdup(optarg); dbg("logfile = %s\n", session->logfile); break; case 's': session->shrink_urls = 1; break; case 'b': session->bash = 1; /* fall-through intended */ case 'B': session->background = 1; break; case 'c': if (session->configfile) free(session->configfile); session->configfile = strdup(optarg); dbg("configfile = %s\n", session->configfile); /* * read the config file now. Yes, this could override * previously set options from the command line, but * the user asked for it... */ //bti_parse_configfile(session); break; case 'h': display_help(); goto exit; case 'n': session->dry_run = 1; break; case 'v': display_version(); goto exit; default: display_help(); goto exit; } } /* * Show the version to make it easier to determine what * is going on here */ if (debug) display_version(); if (session->action == ACTION_UNKNOWN) { fprintf(stderr, "Unknown action, valid actions are:\n" "'update', 'friends', 'public', 'replies', 'group' or 'user'.\n"); goto exit; } dbg("config file = %s\n", session->configfile); dbg("action = %d\n", session->action); /* fork ourself so that the main shell can get on * with it's life as we try to connect and handle everything */ if (session->background) { child = fork(); if (child) { dbg("child is %d\n", child); exit(0); } } switch (session->action) { case ACTION_PUBLIC: PUBLIC(account, session, retval); break; case ACTION_UPDATE: if (session->background || !session->interactive) tweet = get_string_from_stdin(); else tweet = session->readline("tweet: "); if (!tweet || strlen(tweet) == 0) { dbg("no tweet?\n"); return -1; } if (session->shrink_urls) tweet = shrink_urls(tweet); session->tweet = zalloc(strlen(tweet) + 10); if (session->bash) sprintf(session->tweet, "%c %s", getuid()? '$' : '#', tweet); else sprintf(session->tweet, "%s", tweet); if (tweet) free(tweet); dbg("tweet = %s\n", session->tweet); UPDATE(account, session, retval); break; case ACTION_FRIENDS: FRIENDS(account, session, retval); break; case ACTION_REPLIES: REPLIES(account, session, retval); break; default: retval = -1; break; } // retval = send_request(session); if (retval && !session->background) fprintf(stderr, "operation failed\n"); /* log_session(session, retval); */ DESTORY(account); exit: session_readline_cleanup(session); session_free(session); return retval;; }
0x80, 0x3a, 0x9c, 0xb0, 0x43, 0x02, 0x20, 0x71, 0xf0, 0xa0, 0xab, 0x82, 0xf5, 0xc4, 0x8c, 0xe0, 0x1c, 0xcb, 0x2e, 0x35, 0x22, 0x28, 0xa0, 0x24, 0x33, 0x64, 0x67, 0x69, 0xe7, 0xf2, 0xa9, 0x41, 0x09, 0x78, 0x4e, 0xaa, 0x95, 0x3e, 0x93, 0x02, 0x21, 0x00, 0x85, 0xcc, 0x4d, 0xd9, 0x0b, 0x39, 0xd9, 0x22, 0x75, 0xf2, 0x49, 0x46, 0x3b, 0xee, 0xc1, 0x69, 0x6d, 0x0b, 0x93, 0x24, 0x92, 0xf2, 0x61, 0xdf, 0xcc, 0xe2, 0xb1, 0xce, 0xb3, 0xde, 0xac, 0xe5, 0x02, 0x21, 0x00, 0x9c, 0x23, 0x6a, 0x95, 0xa6, 0xfe, 0x1e, 0xd8, 0x0c, 0x3f, 0x6e, 0xe6, 0x0a, 0xeb, 0x97, 0xd6, 0x36, 0x1c, 0x80, 0xc1, 0x02, 0x87, 0x0d, 0x4d, 0xfe, 0x28, 0x02, 0x1e, 0xde, 0xe1, 0xcc, 0x72 ), PUBLIC ( 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0xd2, 0xf1, 0x04, 0x67, 0xf6, 0x2c, 0x96, 0x07, 0xa6, 0xbd, 0x85, 0xac, 0xc1, 0x17, 0x5d, 0xe8, 0xf0, 0x93, 0x94, 0x0c, 0x45, 0x67, 0x26, 0x67, 0xde, 0x7e, 0xfb, 0xa8, 0xda, 0xbd, 0x07, 0xdf, 0xcf, 0x45, 0x04, 0x6d, 0xbd, 0x69, 0x8b, 0xfb, 0xc1, 0x72, 0xc0, 0xfc, 0x03, 0x04, 0xf2, 0x82, 0xc4, 0x7b, 0x6a, 0x3e, 0xec, 0x53, 0x7a, 0xe3, 0x4e, 0xa8, 0xc9, 0xf9, 0x1f, 0x2a, 0x13, 0x0d, 0x02, 0x03, 0x01, 0x00, 0x01 ), PLAINTEXT ( 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x0a ), CIPHERTEXT ( 0x39, 0xff, 0x5c, 0x54, 0x65, 0x3e, 0x6a, 0xab, 0xc0, 0x62, 0x91, 0xb2, 0xbf, 0x1d, 0x73, 0x5b, 0xd5, 0x4c, 0xbd, 0x16, 0x0f, 0x24, 0xc9, 0xf5, 0xa7, 0xdd, 0x94, 0xd6, 0xf8, 0xae, 0xd3, 0xa0, 0x9f, 0x4d, 0xff, 0x8d, 0x81, 0x34, 0x47, 0xff, 0x2a, 0x87, 0x96, 0xd3, 0x17, 0x5d, 0x93, 0x4d, 0x7b, 0x27, 0x88, 0x4f, 0xec, 0x43, 0x9c, 0xed, 0xb3, 0xf2, 0x19, 0x89, 0x38, 0x43, 0xf9, 0x41 ) ); /** Random message MD5 signature test */