/** * \brief Check if the collision is with a player. * \param that The other item of the collision. * \param info Some informations about the collision. */ void ptb::honeypot::collision_check_and_apply ( bear::engine::base_item& that, bear::universe::collision_info& info ) { player_proxy p(&that); if ( p != NULL ) { if ( !m_given ) { create_decoration(); m_given = true; level_variables::set_honeypots_found ( get_level(), level_variables::get_honeypots_found(get_level()) + 1 ); level_variables::set_honeypot_found( get_level(), m_id, true); if ( level_variables::get_honeypots_found(get_level()) % 5 == 0 ) { give_life(1); give_life(2); } on_found(p.get_index()); send_notification(p.get_index()); kill(); } else default_collision(info); } else default_collision(info); } // honeypot::collision_check_and_apply()
static void debugger_run_handler (IdeRunManager *run_manager, IdeRunner *runner, gpointer user_data) { IdeDebuggerEditorAddin *self = user_data; IdeDebugManager *debug_manager; IdeContext *context; g_autoptr(GError) error = NULL; IDE_ENTRY; g_assert (IDE_IS_RUN_MANAGER (run_manager)); g_assert (IDE_IS_RUNNER (runner)); g_assert (IDE_IS_DEBUGGER_EDITOR_ADDIN (self)); /* * Get the currently configured debugger and attach it to our runner. * It might need to prepend arguments like `gdb', `pdb', `mdb', etc. */ context = ide_object_get_context (IDE_OBJECT (run_manager)); debug_manager = ide_debug_manager_from_context (context); if (!ide_debug_manager_start (debug_manager, runner, &error)) send_notification (self, _("Failed to start the debugger"), error->message, "computer-fail-symbolic", TRUE); IDE_EXIT; }
void resume_notifications() { waiting_notification_t* notification = nb_peek(); if (send_notification(notification) == NRF_SUCCESS) { #ifdef PRINT_MESH_VERBOSE LOGd("notification done"); #endif nb_pop(); if (nb_empty()) { notifactionsPending = false; #ifdef PRINT_MESH_VERBOSE LOGd("no more notifications pending"); #endif } else { #ifdef PRINT_MESH_VERBOSE LOGd("continue with next pending notification"); #endif resume_notifications(); } } }
// SendNotification int Volume::SendNotification(port_id port, int32 token, uint32 what, int32 op, nspace_id nsida, nspace_id nsidb, vnode_id vnida, vnode_id vnidb, vnode_id vnidc, const char *name) { PRINT(("Volume::SendNotification(%ld, %ld, 0x%lx, 0x%lx, %ld, %ld, %lld, %lld, %lld, \"%s\")\n", port, token, what, op, nsida, nsidb, vnida, vnidb, vnidc, name)); return send_notification(port, token, what, op, nsida, nsidb, vnida, vnidb, vnidc, name); }
void send_notification_nbr(struct nbr *nbr, uint32_t status_code, uint32_t msg_id, uint16_t msg_type) { log_debug("%s: lsr-id %s, status %s", __func__, inet_ntoa(nbr->id), status_code_name(status_code)); send_notification(status_code, nbr->tcp, msg_id, msg_type); nbr_fsm(nbr, NBR_EVT_PDU_SENT); }
/* Clientlib */ int ts3plugin_onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message, int ffIgnored) { printf("PLUGIN: onTextMessageEvent %llu %d %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, targetMode, fromID, fromName, message, ffIgnored); /* Friend/Foe manager has ignored the message, so ignore here as well. */ if(ffIgnored) { return 0; /* Client will ignore the message anyways, so return value here doesn't matter */ } send_notification(serverConnectionHandlerID, fromName, message); return 0; /* 0 = handle normally, 1 = client will ignore the text message */ }
void send_notification_nbr(struct nbr *nbr, u_int32_t status, u_int32_t msgid, u_int32_t type) { struct ibuf *buf; if (nbr->iface->passive) return; buf = send_notification(status, nbr->iface, msgid, type); evbuf_enqueue(&nbr->wbuf, buf); }
void service::send_notification(json_rpc_notification notification) { lock_guard lock(mutex_); for ( auto& ptr : connections_ ) { auto connection = ptr.lock(); if ( connection ) { connection->send_notification(notification); } } }
/* for reporting a sample that satisfies the reporting criteria and resetting the state machine */ int report_sample(sample s) { if(send_notification(s)){ // sends current_sample if observing is on last_band = band(s); // limits state machine high_step = s + LWM2M_step; // reset floating band upper limit defined by step low_step = s - LWM2M_step; // reset floating band lower limit defined by step pmin_timer.detach(); pmin_exceeded = false; // state machine to inhibit reporting at intervals < pmin pmin_timer.attach(&on_pmin, LWM2M_pmin); pmax_timer.detach(); pmax_timer.attach(&on_pmax, LWM2M_pmax); return 1; } else return 0; }
/** * The Notification timer looks for unsent notifications and sends them. * - because not all events should wait until the notifications for them are sent * @param ticks - the current time * @param param - pointer to the domain_list */ void notification_timer(unsigned int ticks, void* param) { r_notification *n; lock_get(notification_list->lock); while(notification_list->head){ n = notification_list->head; notification_list->head = n->next; if (n->next) n->next->prev=0; else notification_list->tail=n->next; lock_release(notification_list->lock); send_notification(n); free_r_notification(n); lock_get(notification_list->lock); } lock_release(notification_list->lock); }
/** * \brief The hideout is discovered. * \param index Index of player that discovers hideout. */ void ptb::hideout_bonus_item::discover(unsigned int index) { bool bonus(false); if ( !game_variables::get_hideout_state(m_id) ) { game_variables::set_hideout_state( m_id, true); bonus = true; } bear::engine::var_map vars; bear::engine::game::get_instance().get_game_variables ( vars, PTB_PERSISTENT_PREFIX + game_variables::get_main_level_name() + "/hideout/.*"); bear::engine::var_map::iterator<bool>::type it; std::string prefix (PTB_PERSISTENT_PREFIX + game_variables::get_main_level_name() + "/hideout/"); unsigned int found = 0; for ( it=vars.begin<bool>(); (it!=vars.end<bool>()); ++it ) { std::string var(it->first); std::string c1; c1 = var.erase(0, prefix.size()); if ( game_variables::get_hideout_state(c1) ) found++; else bonus = false; } if ( bonus ) level_variables::all_hideouts_found(get_level()); send_notification(index,found,vars.size()); kill(); } // hideout_bonus_item::discover()
void on_status ( OrgZlbruceEyerestBasic *object, guint arg_time_remain, const gchar *arg_state) { time_t time_remain = arg_time_remain; static gchar time_str[PATH_MAX]; struct tm* tm = localtime(&time_remain); int len = 0; if(tm == NULL) { len = g_snprintf(time_str, sizeof(time_str), "%lu", (unsigned long)time); } else { len = strftime(time_str, sizeof(time_str), "%M:%S", tm); } //g_printf("time_str = %s, state = %s\n", time_str, arg_state); gtk_menu_item_set_label(GTK_MENU_ITEM(menu_item_state), time_str); gtk_status_icon_set_tooltip_text (tray_icon, time_str); if(arg_time_remain < 60) { if(!g_notified) { send_notification(time_str, arg_time_remain); } } else { g_notified = FALSE; if(g_notify_id != 0) { close_notification(); } } }
void value_set_handler(void* p_event_data, uint16_t event_size) { // LOGd("value_set_handler"); // waiting_notification_t* notification = (waiting_notification_t*) p_event_data; waiting_notification_t* notification = nb_peek(); // printArray(notification, sizeof(waiting_notification_t)); uint32_t err_code = send_notification(notification); if (err_code == BLE_ERROR_NO_TX_BUFFERS) { #ifdef PRINT_MESH_VERBOSE LOGd("adding pending notification"); #endif notifactionsPending = true; } else { // LOGd("popping notification"); nb_pop(); } }
int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored) { anyID myID; printf("PLUGIN onClientPokeEvent: %llu %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, fromClientID, pokerName, message, ffIgnored); /* Check if the Friend/Foe manager has already blocked this poke */ if(ffIgnored) { return 0; /* Client will block anyways, doesn't matter what we return */ } /* Example code: Send text message back to poking client */ if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { /* Get own client ID */ ts3Functions.logMessage("Error querying own client id", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); return 0; } if(fromClientID != myID) { /* Don't reply when source is own client */ if(ts3Functions.requestSendPrivateTextMsg(serverConnectionHandlerID, "Received your poke!", fromClientID, NULL) != ERROR_ok) { ts3Functions.logMessage("Error requesting send text message", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); } } send_notification(serverConnectionHandlerID, pokerName, message); return 0; /* 0 = handle normally, 1 = client will ignore the poke */ }
/** * Envoie un message de failure vers le socket précisé, avec des détails ou non. */ static void send_failure(const int socket, const char *param) { send_notification(socket, RET_ERR, param); }
/** * Envoie un message okas vers le socket précisé, avec des détails ou non. */ static void send_ok(const int socket, const char *param) { send_notification(socket, RET_OK, param); }
int jrpc_ClientSendNotification(jrpc_ClientRef_t client, const char * method, cJSON * params) { return send_notification(client->connection, method, params); }
void process() { while (1) { char menu = get_menu(); switch (menu) { case 'm': // menu case 'M': break; case 'q': // quit case 'Q': printf("quit..!!\n"); return; case 's': // start server case 'S': start_listening_server(); break; case 't': // send request case 'T': send_request_all(); break; case 'c': // start client case 'C': start_discovery_server(); break; case 'r': // send request case 'R': send_request(); break; case 'b': // send notification case 'B': send_notification(); break; case 'n': // select network case 'N': select_network(); break; case 'x': // unselect network case 'X': unselect_network(); break; case 'h': // handle request response case 'H': handle_request_response(); break; case 'w': case 'W': g_received = 0; start_discovery_server(); send_secure_request(); while (g_received == 0) { sleep(1); handle_request_response(); } break; case 'z': case 'Z': start_listening_server(); while (1) { sleep(1); handle_request_response(); } break; case 'g': // get network information case 'G': get_network_info(); break; default: printf("not supported menu!!\n"); break; } } }