def generate_im_group_chats(amount, friends_list): for i in range(0, amount): random_friend = get_random_in_list(friends_list) my_account_prefix = random_friend.split(':')[0] + ":" my_account = filter(lambda x: x[3].startswith(my_account_prefix), ACCOUNTS)[0] addresses = [my_account[3], random_friend] print_instance(get_random_uuid_uri(), "nmo:CommunicationChannel") for i in range(0, random.randint(0, 10)): print_instance(get_random_uuid_uri(), "nmo:IMMessage") if i % 2 == 0: print_property("nmo:sentDate", getPseudoRandomDate()) else: print_property("nmo:sentDate", getPseudoRandomDate()) print_property("nmo:receivedDate", getPseudoRandomDate()) print_anon_node("nmo:from", "nco:IMContact", "nco:hasIMAccount", addresses[i % 2], t="uri") print_anon_node("nmo:to", "nco:IMContact", "nco:hasIMAccount", addresses[(i + 1) % 2], t="uri", final=True) print_property("nie:plainTextContent", get_random_text(), t="str", final=True)
def generate_im_messages(n_convs, n_channels, msgs_per_convs, friends_list, n_friends): for i in range(0, len(friends_list)): same_friend = friends_list[i] channel_id = get_random_uuid_uri() print_instance(channel_id, "nmo:CommunicationChannel") print_property("nmo:lastMessageDate", getPseudoRandomDate()) print "\tnmo:hasParticipant nco:default-contact-me ;" if same_friend: print_anon_node("nmo:hasParticipant", "nco:IMContact", "nco:hasIMAccount", same_friend, t="uri", final=True) for j in range(0, n_convs): conversation_id = get_random_uuid_uri() print_instance(conversation_id, "nmo:Conversation", final=True) if same_friend: random_friend = same_friend else: random_friend = get_random_in_list(friends_list) my_account_prefix = random_friend.split(':')[0] + ":" my_account = filter(lambda x: x[3].startswith(my_account_prefix), ACCOUNTS)[0] addresses = [my_account[3], random_friend] for k in range(0, random.randint(1, msgs_per_convs + 1)): print_instance(get_random_uuid_uri(), "nmo:IMMessage") print_property("nmo:communicationChannel", channel_id, t="uri") print_property("nmo:conversation", conversation_id, t="uri") if k % 2 == 0: print_property("nmo:sentDate", getPseudoRandomDate()) else: print_property("nmo:sentDate", getPseudoRandomDate()) print_property("nmo:receivedDate", getPseudoRandomDate()) print_property("nie:plainTextContent", get_random_text()) print_anon_node("nmo:from", "nco:IMContact", "nco:hasIMAccount", addresses[k % 2], t="uri") print_anon_node("nmo:to", "nco:IMContact", "nco:hasIMAccount", addresses[(k + 1) % 2], t="uri", final=True)
def generate_im_group_chats(amount, friends_list): for i in range(0, amount): random_friend = get_random_in_list(friends_list) my_account_prefix = random_friend.split(":")[0] + ":" my_account = filter(lambda x: x[3].startswith(my_account_prefix), ACCOUNTS)[0] addresses = [my_account[3], random_friend] print_instance(get_random_uuid_uri(), "nmo:CommunicationChannel") for i in range(0, random.randint(0, 10)): print_instance(get_random_uuid_uri(), "nmo:IMMessage") if i % 2 == 0: print_property("nmo:sentDate", getPseudoRandomDate()) else: print_property("nmo:sentDate", getPseudoRandomDate()) print_property("nmo:receivedDate", getPseudoRandomDate()) print_anon_node("nmo:from", "nco:IMContact", "nco:hasIMAccount", addresses[i % 2], t="uri") print_anon_node("nmo:to", "nco:IMContact", "nco:hasIMAccount", addresses[(i + 1) % 2], t="uri", final=True) print_property("nie:plainTextContent", get_random_text(), t="str", final=True)
def generate_im_messages(n_convs, n_channels, msgs_per_convs, friends_list, n_friends): for i in range(0, len(friends_list)): same_friend = friends_list[i] channel_id = get_random_uuid_uri() print_instance(channel_id, "nmo:CommunicationChannel") print_property("nmo:lastMessageDate", getPseudoRandomDate()) print "\tnmo:hasParticipant nco:default-contact-me ;" if same_friend: print_anon_node("nmo:hasParticipant", "nco:IMContact", "nco:hasIMAccount", same_friend, t="uri", final=True) for j in range(0, n_convs): conversation_id = get_random_uuid_uri() print_instance(conversation_id, "nmo:Conversation", final=True) if same_friend: random_friend = same_friend else: random_friend = get_random_in_list(friends_list) my_account_prefix = random_friend.split(":")[0] + ":" my_account = filter(lambda x: x[3].startswith(my_account_prefix), ACCOUNTS)[0] addresses = [my_account[3], random_friend] for k in range(0, random.randint(1, msgs_per_convs + 1)): print_instance(get_random_uuid_uri(), "nmo:IMMessage") print_property("nmo:communicationChannel", channel_id, t="uri") print_property("nmo:conversation", conversation_id, t="uri") if k % 2 == 0: print_property("nmo:sentDate", getPseudoRandomDate()) else: print_property("nmo:sentDate", getPseudoRandomDate()) print_property("nmo:receivedDate", getPseudoRandomDate()) print_property("nie:plainTextContent", get_random_text()) print_anon_node("nmo:from", "nco:IMContact", "nco:hasIMAccount", addresses[k % 2], t="uri") print_anon_node( "nmo:to", "nco:IMContact", "nco:hasIMAccount", addresses[(k + 1) % 2], t="uri", final=True )
def generate_mail(amount, known_emails): for i in range(0, amount): random_address_friend = "mailto:" + get_random_in_list(known_emails) random_address_me = "mailto:" + get_random_in_list(MAIL_ADDRESSES) print_instance(get_random_uuid_uri(), "nmo:Email") # Half sent, half received if i % 2 == 0: #sent print_anon_node("nmo:from", "nco:Contact", "nco:hasEmailAddress", random_address_me, t="uri") print_anon_node("nmo:to", "nco:Contact", "nco:hasEmailAddress", random_address_friend, t="uri") print_property("nmo:sentDate", getPseudoRandomDate()) print_property("nie:isLogicalPartOf", "mailfolder://" + random_address_me[7:] + "/Sent", t="uri") else: #received print_anon_node("nmo:to", "nco:Contact", "nco:hasEmailAddress", random_address_me, t="uri") print_anon_node("nmo:from", "nco:Contact", "nco:hasEmailAddress", random_address_friend, t="uri") print_property("nmo:receivedDate", getPseudoRandomDate()) print_property("nie:isLogicalPartOf", "mailfolder://" + random_address_me[7:] + "/Inbox", t="uri") if random.randint(0, 5) > 3: print_anon_node("nmo:cc", "nco:Contact", "nco:hasEmailAddress", "mailto:" + get_random_in_list(known_emails), t="uri") if random.randint(0, 5) > 3: print_anon_node("nmo:bcc", "nco:Contact", "nco:hasEmailAddress", "mailto:" + get_random_in_list(known_emails), t="uri") print_property("nmo:messageSubject", get_random_text_short()) print_property("nmo:status", "eeeeeh uuuhhhmmmmm") print_property("nmo:responseType", "blublublu") print_property("nmo:messageId", "<" + get_random_message_id() + "@email.net>") print_property("nie:plainTextContent", get_random_text()) print_anon_node("nmo:replyTo", "nco:Contact", "nco:hasEmailAddress", REPLY_TO, t="uri") # FIXME Add message headers # FIXME Add inReplyTo print_property("nie:contentSize", random.randint(20, 120), t="str", final=True)
def generate_mail(amount, known_emails): for i in range(0, amount): random_address_friend = "mailto:" + get_random_in_list(known_emails) random_address_me = "mailto:" + get_random_in_list(MAIL_ADDRESSES) print_instance(get_random_uuid_uri(), "nmo:Email") # Half sent, half received if i % 2 == 0: # sent print_anon_node("nmo:from", "nco:Contact", "nco:hasEmailAddress", random_address_me, t="uri") print_anon_node("nmo:to", "nco:Contact", "nco:hasEmailAddress", random_address_friend, t="uri") print_property("nmo:sentDate", getPseudoRandomDate()) print_property("nie:isLogicalPartOf", "mailfolder://" + random_address_me[7:] + "/Sent", t="uri") else: # received print_anon_node("nmo:to", "nco:Contact", "nco:hasEmailAddress", random_address_me, t="uri") print_anon_node("nmo:from", "nco:Contact", "nco:hasEmailAddress", random_address_friend, t="uri") print_property("nmo:receivedDate", getPseudoRandomDate()) print_property("nie:isLogicalPartOf", "mailfolder://" + random_address_me[7:] + "/Inbox", t="uri") if random.randint(0, 5) > 3: print_anon_node( "nmo:cc", "nco:Contact", "nco:hasEmailAddress", "mailto:" + get_random_in_list(known_emails), t="uri" ) if random.randint(0, 5) > 3: print_anon_node( "nmo:bcc", "nco:Contact", "nco:hasEmailAddress", "mailto:" + get_random_in_list(known_emails), t="uri" ) print_property("nmo:messageSubject", get_random_text_short()) print_property("nmo:status", "eeeeeh uuuhhhmmmmm") print_property("nmo:responseType", "blublublu") print_property("nmo:messageId", "<" + get_random_message_id() + "@email.net>") print_property("nie:plainTextContent", get_random_text()) print_anon_node("nmo:replyTo", "nco:Contact", "nco:hasEmailAddress", REPLY_TO, t="uri") # FIXME Add message headers # FIXME Add inReplyTo print_property("nie:contentSize", random.randint(20, 120), t="str", final=True)